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
Copyright (C) 2020, Humboldt State University, Jim Graham
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see
.
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 |
IconCanvasWidth |
Icon Canvas Width |
CMTYPE_FLOAT |
|
18 |
Sets the width, in pixels of the canvas used to create the icon used in the layer list |
IconCanvasHeight |
Icon Canvas Height |
CMTYPE_FLOAT |
|
18 |
Sets the height, in pixels, of the canvas used to create the icon used in the layer list |
AddToLegend |
Add To Legend |
CMTYPE_BOOLEAN |
|
|
Only used in LayerCategories right now, might want to move to that class |
Object Functions
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()). -1 for none
MouseOverFeatureIndex=GetMouseOverFeature()
Gets the current feature that the mouse is over
Returns: MouseOverFeatureIndex - index to the feature the mouse is over (typcially returned by In()). 1 for none
SetSettingAttribute(Param1, Param2, Param3)
Set the attribute column to obtain property values for features from
Parameters:
Param1 - Group or Setting
Param2 - Setting or AttributeName
Param3 - AttributeName or Setting
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