Reference Material
This page contains reference information for calling CanvasMap from JavaScript and on how CanvasMap was designed.
- All Class Reference List of all classes in CanvasMap with links to their reference information
- Design Details page includes additional design information and a list of the current and potential future features for CanvasMap.
Quick Reference
Common Classes and Settings
Below is a list of the commonly used classes in CanvasMap for 2D maps and another list for 3D maps. Clicking on the class will take you to the reference information for the class.
2D Quick Links
- CMMainContainer
- CMScene
- CMGeo
- CM2View
- CMLayerDataset
- CMLayerRaster
- CMLayerGraticule
- CMDataset
- CMScaleBar
- CMNorthArrow
- CMUtilities
3D Quick Links
The following will be updated after the restructing for the new settings design:
- CM3Scene - To be added
- CM3Geo - To be added
- CM3LayerVector
- CM3LayerTerrain
- CM3LayerItems?
- CM3Light - When broken up, will add ambient lights, spot lights, point lights
- CM3View
- CM3OrbitControl -
2D Commonly Used Classes
CMMainContainer - The main container for a CanvasMap
Commonly Used Functions
- TheMainContainer.Initialize();
- TheScene=TheMainContainer.GetScene() - returns the first scene for the main container after initialization
- TheIndex=TheGeo.AddBackground(TheLayer) - Adds a new background layer
- TheGeo.SetSelectedBackgroundIndex(Index) - Sets the current background index
- TheMainContainer.AddLayer(TheCountryLayer); - Note that this just calls the Scene which calls the Geo to manage the layers
- TheView=TheMainContainer.GetView() - returns the first view in the first scene
Commonly Used Settings
CMScene - Contains the Geos for a scene
Commonly Used Functions
- TheView=TheScene.GetView(Index) - Returns the view based on the index, if the index is undefined, the first view is returned
- TheGeo=TheScene.GetGeo(Index) - Returns the geo based on the index, if the index is undefined, the first geo is returned
Commonly Used Settings
CMGeo - Contains the layers for a single geo (i.e. the Earth)
Commonly Used Functions
- TheGeo.SetProjector(TheProjector)
- TheProjector=TheGeo.GetProjector()
Commonly Used Settings
CM2View - manages the interactions between the CANVAS element and the scene.
Commonly Used Functions
- TheView.SetRefCenter(RefX,RefY)
- TheView.GetRefCenter()
- TheView.ZoomToBounds(NewBounds)
- TheView.ZoomToMaxBounds()
- TheView.ZoomIn()
- TheView.ZoomOut()
- TheView.ZoomTo(ZoomLevel)
- TheView.SetToolHandler(TheHandler)
- TheView.AddMapElement(TheMapElement); - Adds elements to the view scale bars which float on top of the map in the view
Commonly Used Settings
CMLayerDataset - the main layer for server-side data such as GeoJSON, Pyramids, etc
Commonly Used Functions
- TheLayer.SetFeatureSetting("Group","Key",FeatureIndex,Value); - sets the value for one setting for one feature
- TheLayer.SetSettingAttribute("Group","Key",AttributeName); - the setting value should be pulled from the indicated attribute column
- TheLayer.SetFeatureSettings(i,FeatureStyles); - sets a dictionary of settings for a specific feature to use (this function is fast but lacks error checking)
- TheDataset=TheLayer.GetDataset();
Common Functions to override
- YourLayer.MouseDown(TheView,RefX,RefY) {...}
- YourLayer.MouseMove(TheView,RefX,RefY) {...}
- YourLayer.MouseUp(TheView,RefX,RefY) {...}
- YourLayer.Paint(TheView) {...}
- YourLayer.PaintSelected(TheView) {...}
- YourLayer.Resize(TheView) {...}
- YourLayer.GetSearchResults(SearchPhrase,ResultsPanel) {...}
Commonly Used Settings
CMLayerRaster - the main layer for server-side data such as GeoJSON, Pyramids, etc
Commonly Used Functions
- None
Commonly Used Settings
CMLayerGraticule - places meridians and parallels over the map.
Commonly Used Functions
- None
Commonly Used Settings
- There are quite a few please see the class documentation
CMDataset - base class for datasets
Commonly Used Functions
- NumRows=TheDataset.GetNumAttributeRows();
- NumColumns=TheDataset.GetNumAttributeColumns();
- TheHeading=TheDataset.GetAttributeHeading(ColumnIndex);
- TheCellContents=TheDataset.GetAttributeCell(ColumnIndex,RowIndex);
- TheCellContents=TheDataset.GetAttributeCellByHeading(Heading,RowIndex);
- NumFeatures=TheDataset.GetNumFeatures();
- SetAttributeCell(Heading,RowIndex,NewValue); - change the value of a cell in the attribute table using a heading and row index
- TheLayer.AddPoint(X,Y);
Commonly Used Settings
- None
CMScaleBar - creates acurate scale bars
Commonly Used Functions
- None
Commonly Used Settings
- There are quite a few please see the class documentation
CMNorthArrow - creates north arrows that always point north
Commonly Used Functions
- None
Commonly Used Settings
CMUtilities - various utilities to support CanvasMap
Commonly Used Functions
- CMUtilities.AbsolutePosition(TheElement,Left,Top,Width,Height);
- CMUtilities.GetColorsFromArrays(FeatureValues,TheColors,Intervals);
- CMUtilities.AddLegend(TheCanvasElement,TheColors,LegendLabels,X,Y,Width,Height);
- CMUtilities.GetMean(TheArray);
- CMUtilities.GetStdDev(TheArray);
- CMUtilities.GetMinMax(TheArray);
- CMUtilities.GetHistogram(TheArray,NumBins);
- CMUtilities.GetQuantiles(TheHistogram,NumGroups);
- CMUtilities.FlipArray(TheArray);
- CMUtilities.Sort(TheArray);
- CMUtilities.ArraysEqual(TheArray1,TheArray2);
- CMUtilities.GetRegularPolygon(NumPoints,Size,CenterX,CenterY,StartAngle);
- CMUtilities.GetStar(NumPoints,Size,CenterX, CenterY, StartAngle);
- CMUtilities.GetCoordinateString(RefX,RefY,CoordinateUnits,TheProjector,TheView);
3D Commonly Used Classes
CM3Light - Lights for 3D scenes
Note: Lights will be broken up into mulitple classes in a future release
Commonly Used Functions
- None
Commonly Used Settings
CM3View - Views for 3D scenes
Commonly Used Functions
- None