
Setting Properties
There are a number of properties for layers. The properties will effect all the features iwthin a laye.
Seting properties is as easy as calling "TheLayer.SetProperty(CMLayer.FEATURE_STYLE,TheStyle)". This is the same as calling "SetStyle(TheStyle)" as you did in the second tutorial. The format for this function is:
TheLayer.SetProperty(Property,Value);
The full set of available properties are:
Property | Value |
---|---|
CMLayer.INFO | The HTML content ot be placed in the information window |
CMLayer.FEATURE_STYLE | Style to use to paint features |
CMLayer.MOUSE_OVER_STYLE | Style to use when the user moves the mouse over a feature |
CMLayer.SELECTED_STYLE | Style to to paint a feature when it is selected |
CMLayer.ICON_IMAGE | Image to replace the mark for a point with: { TheImage:Image Object, OffsetX:OffsetX, OffsetY:OffsetY }; |
CMLayer.MARK_TYPE | Type of mark to display for points |
CMLayer.MARK_SIZE | Size of marks in pixels |
CMLayer.ZOOM_RANGE | Sets the zoom range for a layer to be displayed at. Value is an array formated at [MinZoomLevel,MaxZoomLevel] |
the styles are all JSON objects containing Canvas style key/value pairs. There is more information on setting properties in the CMLayer portion of the reference material.
You can also set properties to have values pulled from an attribute table. This allows you to customize the properties for each feature in a layer. We'll cover how to change properties for individual layers in JavaScript in tutorial 10. The format for this function is:
TheLayer.SetPropertyAttribute(Property,Value);
You can also set properties for individual features within your files. This can be done with individual features or by providing an entire array of feature properties.
TheLayer.SetFeatureProperty(Property,FeatureIndex,Value); TheLayer.SetFeatureProperties(Key,FeatureProperties);