CanvasMap
Getting Started Tutorials 3D Reference

Class CMLayer extends CMItem

CMLayer
This class is the base class for all other layers. This class contains functions and properties for feature and raster based
classes. This is because the CMLayerPyramid supports both raster and vector data. This also may be a trend with data formats like KML.

Adds:
- Zooming: Min, Max, To Bounds
- Metadata
- InfoText popup balloon
- Painting Marks, labels, and icon images for point data
- Mouse over and selected styles
- Settings for features
- Getting and setting attributes
- Bounds of features

Settings Group: InfoWindow

Setting Name Type Options Default Comments
Width Width CMTYPE_INTEGER 300

Settings Group: Layer

Setting Name Type Options Default Comments
InfoText Info Text CMTYPE_STRING undefined HTML content to appear in the Info box
Metadata Metadata CMTYPE_STRING undefined source information for the data in the layer
MinZoom Min Zoom CMTYPE_FLOAT -Infinity layer is hidden below this zoom level
MaxZoom Max Zoom CMTYPE_FLOAT Infinity layer is hidden above this zoom level
ZoomToBoundsOnLoad Zoom To Bounds On Load CMTYPE_BOOLEAN false If true, the scene will zoom to the layer bounds after the layer's data is loaded

Object Functions

Inherited From: CMItem
ReturnsFunctionThrows
Bounds GetBounds()
SetBounds(NewBounds)
SetSelectedFeature(NewFeatureIndex)
SetMouseOverFeature(NewFeatureIndex)
FeatureIndex ResetMouseOverFeature()
SetSettingAttribute(Key, Value)
SetFeatureSettings(FeatureIndex, FeatureProperties)
SetFeatureSetting(Key, FeatureIndex, Value)
Value GetFeatureSetting(Key, FeatureIndex, Default)
SetProjector()
RequestData()

Object Functions

Bounds=GetBounds()

Override GetBounds so the bounds are not computed but are instead set into SetBounds() by the layer or its dataset.

Returns: Bounds - with format {XMin,XMax,YMin,YMax}

SetBounds(NewBounds)

Check if the feature is visible in the view.
This should be called by subclasses but can also be called to limit a layer's bounds after loading.

Parameters:
    NewBounds - Object for Bounds with format {XMin,XMax,YMin,YMax}

SetSelectedFeature(NewFeatureIndex)

Sets the feature that is selected

Parameters:
    NewFeatureIndex - >=0 indicates a feature, -1 is for none.

SetMouseOverFeature(NewFeatureIndex)

Sets the current feature that the mouse is over

Parameters:
    NewFeatureIndex - index to the feature the mouse is over (typcially returned by In())

FeatureIndex=ResetMouseOverFeature()

Returns the current feature that the mouse is over

Returns: FeatureIndex - index to the feature the mouse is over (typcially returned by In()), or 1 for none

SetSettingAttribute(Key, Value)

Set the attribute column to obtain property values for features from

Parameters:
    Key - on of the CMLayer.INFO enumerated types
    Value - Heading of the column to extract values from.

SetFeatureSettings(FeatureIndex, FeatureProperties)

Set the feature settings into an array indexed by FeatureIndexes

Parameters:
    FeatureIndex - Index to the feature
    FeatureProperties - array of properties indexed by the feature indexes

SetFeatureSetting(Key, FeatureIndex, Value)

Set an individual feature property based on it's FeatureIndex

Parameters:
    Key - on of the CMLayer.INFO enumerated types
    FeatureIndex - Feature to apply the property to
    Value - value for the property for the feature

Value=GetFeatureSetting(Key, FeatureIndex, Default)

Returns a property for a specific feature. Returns null if the property
is not specified for the feature.

Parameters:
    Key - on of the CMLayer.INFO enumerated types
    FeatureIndex - Feature to apply the property to
    Default - The default value to return if the property has not been specified.

Returns: Value - value for the property for the feature

SetProjector()

RequestData()

Called to obtain the data for the layer from a URL.
Only used by layers that set a URL for data