Core Classes
Below are additional details on the design of CanvasMap.
Classes in CanvasMap can be broken down into the following areas with a few examples added:
- Utilities
- CMDefs,CMControlPoints, CMToolHandler, CMUtilities, CMUtilitiesBezier
- Base
- CMBase
- Datasets
- CMDataset
- CMDatasetVector
- Projectors:
- CMProjector, CMProjectorWebMercator
- Panels:
- CMMainContainer, CMPanelFooter, CMPanelTool
- Items:
- CMItem, CMItemPoly, CMItemRect, CMNorthArrow
- Layers:
- CMLayer, CM2Layer
- Geos:
- CMGeo
- Scenes:
- CMScene
- Views:
- CMView, CM2View
The main container contents the panels that make up a CanvasMap map. While users will interact with the MainContainer regularlly, they will probably not interact with the other panels unless they are creating new panel classes so the focus of this document is on the other classes.
Main Hierarchy
Core classes the main hierarchy for 2D and 3D:
- CMBase
- Settings: Name
- Functions: Deallocate, Child and Parents, Listeners. Properties, Settings, Selection, Open/Closed
- CMItem: CMBase
- Settings: Name, Status,
- 2D only: Position, Style, Text, TextVisible,TextStyle,
- Functions: FillPopupMenu, Painting, Bounds
- Settings: Name, Status,
- CMLayer: CMItem -
Adds features from from various sources
- Settings: layer, InfoWindow,
- 2D only: IconImage, LabelBox, LabelStyle, MouseOverStyle,SelectedStyle, marks,
- Functions: In, MouseEvents, Features, Attributes, Projectors? RequestData, SearchResults, InfoBox, Metadata, Icons,
- 2D: ZoomRange, Painting Features, Mouse Events,
- Settings: layer, InfoWindow,
- CMGeo: CMItem - projected space and contains the forground and background layer lists
- Settings: DynamicProjections
- Functions: Projectors,
- Children: LayerLists
- CMView: CMitem -
- Settings: PixelTolerance, Geustures
- Functions: Collisions, Resize, Mouse, Kye, and Mobile event handling, Painting
- Children: Map Elements
- CMScene: CMItem -
- Settings: Name, fillStyle, Current Tool
- Functions: Tools, Resize views, Bounds, Painting
Main Hierarchy 2D
- CM2View: CMView - 2D rendering
- CM2Layer - move ref drawing to CMLayer? Rename PaintPoint to PaintRefPoint
- CM2Item: ? - probably not
- CM2Scene? maybe, paint is different
- CM2Geo? - no code
Main Hierarchy 3D
- CM3Defs - Extrusions
- CM3Item: CMItem, CM3THREEBase -
- Settings: Position, Angles, Color, Shadows
- Functions: MouseHandling
- CM3Geo: CMGeo, CM3THREEBase
- CM3Scene: CMScene
- Settings: Fog, Background Color
- CM3View: CMView
- Settings: LookAt, ShadowMapType
- Functions: Painting, Screen Position (x,y), Events
- Children: Camera, Controls
- CM3Layer: CMLayer, CM3THREEBase -
Additional Core Classes
- CMDefs
- Definitions: Keys, data types, Statuses, Label positions, Canvas Settings, CSS Settings
- Structures: RegisteredClasses
- Functions: RegisterClasses
- CMDataset
- CMMainContainer
- CMProjector
- CMPanel
- CMToolHandler
- CMUtilities
Design Details
CMBase
Almost all classes in CanvasMap inherit from CMBase, typically through another superclass. CMBase provides a strong superclass to create consistency and limit code redundancy throughout CanvasMap.
CMBase is rather large and this could create performance problems as JavaScript dupilcates the functions for each object. However, this can be overcome by moving the content of large functions to a static function and having the object function call the static function. There are some examples of this in CanvasMap and this could be used with CMBase if performance becomes a problem in the future.
The key functions within CMBase include:
Issues
- CMItem
- LayerList - only called by PanelayerList, move?
- AddItemToPopup()
- IsVisible() - overriden by Layer
- CM2Item w/settings and functions that are 2D? (yes)
- Style, Position, Text,TextVisible, TextStyle
- CMLayer
- Bounds - Move to CMItem?
- Request data?
- Icon images,
- OnLoad() - replace with listener
- Functions to project stuff -> Static functions
- Projector support could be a MixIn
- CMGeo
- CMScene
- Resize()?
- Painting() -> CM2Scene?
- Bounds - > CMItem?
- CMMainContainer
- GetGeo() needs to be adapted for CM3Geo and CM2Geo
3D
- CM3Item - move out THREE to new MixIn?
- CM3Scene - use CM3THREEBase?
- CM3View - use CM3THREEBase?