Class CMLayer

Constructor for a layer object. Layers contain spatial data that appears in a scene @public, @constructs

Object Functions

ReturnsFunctionThrows
SetName(Name)
Name GetName()
SetVisible(Visible)
Visible GetVisible()
SetClickable(Clickable)
GetClickable()
IsVisible()
SetBounds(NewBounds)
Bounds GetBounds()
SetProjector(NewProjector)
TheProjector GetProjector()
TheScene GetScene()
SetStyle(NewStyle)
TheStyle GetStyle()
TheStyle SetInfoWindowWidth()
SetSelectedFeature(NewFeatureIndex)
UnselectAll()
SetMouseOverFeature(NewFeatureIndex)
FeatureIndex ResetMouseOverFeature()
SetProperty(Key, Value)
Value GetProperty(Key, Default)
SetPropertyAttribute(Key, Value)
Value GetPropertyAttribute(Key)
SetFeatureProperties(Key, FeatureProperties)
SetFeatureProperty(Key, FeatureIndex, Value)
Value GetFeatureProperty(Key, FeatureIndex, Default)
SetFeatureFillStyle(FeatureIndex, NewFillStyle)
SetIconImage(TheURL, OffsetX, OffsetY)
SetFeatureIconImage(TheURL, OffsetX, OffsetY)
ShowSettingsDialog()
SetURL(URL, NewView)
OnLoad()
NumAttributes GetNumAttributeRows()
NumColumns GetNumAttributeColumns()
GetAttributeHeading(ColumnIndex)
GetAttributeCell(ColumnIndex, RowIndex)
GetAttributeArrayByHeading(Heading)

Object Functions


SetName(Name)

Set the human-readable name for the layer. This name will appear in the layer list.

Parameters:
    Name - sets the name of the layer.


Name GetName()

Returns the current name of the layer

Returns: Name the name of the layer


SetVisible(Visible)

Make the layer visible or invisible (hidden) the scene will be repainted right after this call.

Parameters:
    Visible - true to make the layer visible, false for hidden


Visible GetVisible()

Returns if the layer is visible

Returns: Visible true or false


SetClickable(Clickable)

Make the layer clickable or not. A false value disables the mouse down events.

Parameters:
    Clickable - new clickable value, true or false


GetClickable()

Return the clickable value.


IsVisible()

Checks if the layer is visible. This is different form GetVisible() because it also checks for an optional zoom range


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 - Bounds with format {XMin,XMax,YMin,YMax}


Bounds GetBounds()

Returns the bounds of the data within the layer. Computed after loading the data.

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


SetProjector(NewProjector)

Sets up a projector for layer data to be projected on loading the data.

Parameters:
    NewProjector - an STProjector object to project layer data after it is loaded.


TheProjector GetProjector()

Returns the current projector.

Returns: TheProjector an STProjector object or null.


TheScene GetScene()

Returns the Scene the layer is in.

Returns: TheScene the scene the layer is contained in or null for none.


SetStyle(NewStyle)

Set the style to use for painting the content of the layer

Parameters:
    NewStyle - An HTML 5 Canvas style set


TheStyle GetStyle()

Returns the style to use for painting the content of the layer

Returns: TheStyle An HTML 5 Canvas style set or null


TheStyle SetInfoWindowWidth()

Returns the style to use for painting the content of the layer

Returns: TheStyle An HTML 5 Canvas style set or null


SetSelectedFeature(NewFeatureIndex)

Sets the feature that is selected

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


UnselectAll()

Unselects all features in the layer.


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


SetProperty(Key, Value)

Sets a property in the layer.

Parameters:
    Key - on of the CMLayer.INFO enumerated types
    Value - value for the type (see the documentation for types for each of the properties)


Value GetProperty(Key, Default)

Get a property value in the layer.

Parameters:
    Key - on of the CMLayer.INFO enumerated types
    Default - default value to use in none has been specified as of yet (optional)

Returns: Value curnet property value.


SetPropertyAttribute(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.


Value GetPropertyAttribute(Key)

Get the attribute column to obtain property values for features from

Parameters:
    Key - on of the CMLayer.INFO enumerated types

Returns: Value Heading of the column to extract values from.


SetFeatureProperties(Key, FeatureProperties)

Set the feature properties as an array indexed by FeatureIndexes

Parameters:
    Key - on of the CMLayer.INFO enumerated types
    FeatureProperties - array of properties indexed by the feature indexes


SetFeatureProperty(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 GetFeatureProperty(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


SetFeatureFillStyle(FeatureIndex, NewFillStyle)

Change the fill style for a specific feature

Parameters:
    FeatureIndex - Feature to apply the style to
    NewFillStyle - on of the CMLayer.INFO enumerated types


SetIconImage(TheURL, OffsetX, OffsetY)

Icon for point features

Parameters:
    TheURL - the URL of the image to use for all features
    OffsetX - horizontal offset in pixels to go from the upper left of the image to the hot spot
    OffsetY - vertical offset in pixels to go from the upper left of the image to the hot spot


SetFeatureIconImage(TheURL, OffsetX, OffsetY)

Icon for point features

Parameters:
    TheURL - the URL of the image to use for all features
    OffsetX - horizontal offset in pixels to go from the upper left of the image to the hot spot
    OffsetY - vertical offset in pixels to go from the upper left of the image to the hot spot


ShowSettingsDialog()

This provides a default settings window with the based vector drawing settings @override


SetURL(URL, NewView)

Called to obtain the data for the layer from a URL. TheView is required so the layer can be repainted when data is received.

Parameters:
    URL - the URL to use to obtain data
    NewView - the view for the scene


OnLoad()

Should be called by default after a data set is loaded so the layer can have it's properties setup that are based on attributes. Can be overriden by a caller or subclass.


NumAttributes GetNumAttributeRows()

Return the number of features (which is the same as the number of rows) in the attribute table.

Returns: NumAttributes the number of rows of attributes (number of features) in the layer.


NumColumns GetNumAttributeColumns()

Return the number of columns in the attributes

Returns: NumColumns the number of rows of attributes (number of features) in the layer.


GetAttributeHeading(ColumnIndex)

Return the heading for a specific column @override

Parameters:
    ColumnIndex - the column to pull the attribute value from


GetAttributeCell(ColumnIndex, RowIndex)

Return a value from a specific cell @override

Parameters:
    ColumnIndex - the column to pull the attribute value from
    RowIndex - the row to pull the attribute value from


GetAttributeArrayByHeading(Heading)

Helper function to return an entire array for an attribute @override

Parameters:
    Heading - the atribute/column heading to get the array from