Reference Material

Below is reference material on how CanvasMap was designed and more technical details.

The Function Reference contains definitions for all the public functions in CanvaMap.

The Design Details page includes additional design information and a list of the current and potential future features for CanvasMap.

Additional Reference Material

Below is a reference for each of the classes in CanvasMap. This includes the "public" functions within each of the classes. There are other functions that you can call but be warned that they may not be supported in the future. All classes in CanvasMap, except CanvasMap itself, are prefixed with "CM" to avoid name collision with other libraries.

CanvasMap

Coordinate Unit Defintions

The following definitions are used to specify the units for coordinates that are displayed in the footer and in scale bars. Note that conversions to coordinates that are in a different spatial reference than the map can only be done if a projector is provided.

CMLayer

Layers display spatial data. Each layer is a little different but they call use the functions described here.

Mark Types

The following definitions are used to change the type of mark that is displayed for points. CIRCLE is the default and you can specify an IconImage instead of these marks.

Icon Images

An icon image can replace a mark for point layers. The image will be displayed at it's full resolution and they should be relatively small for layers with lots of points. For an ICON_IMAGE, an object is provided with the following format:

{ 
  TheImage:Image Object,
  OffsetX:OffsetX,
  OffsetY:OffsetY
};

Note that the image object's onload function should call a repaint to its layer to make sure the layer is repainted after the image is loaded.

Label Positions

Labels can be positioned on points in each of the eight cardinal directions:

The position is specified with a JSON object. The labels are placed based on the corner that is nearest to the point based on the direction of the positioning. Then, the OffsetX and Offset Y values are added to the location. The object has the form:

{
	Direction:Direction,
	OffsetX:OffsetX,
	OffsetY:OffsetY
};

Optional Property Defintions

The following properties can be set for any layer but whether they are implemented or not may depend on the layer type. All of these properties can be set for the entire layer and some can be set for individual features as well.

Property Description Attribute Column All Features Individual Features
CMLayer.INFO The attribute to use for HTML to be placed in an information window Yes Yes Yes
CMLayer.FEATURE_STYLE Style to use to paint features Yes Yes Yes
CMLayer.MOUSE_OVER_STYLE Style to use when the user moves the mouse over a feature Yes Yes Yes
CMLayer.SELECTED_STYLE Style to to paint a feature when it is selected Yes Yes Yes
CMLayer.ICON_IMAGE Image to replace the mark for a point. Yes (1) Yes Yes
CMLayer.MARK_TYPE Type of mark to display for points Yes Yes Yes
CMLayer.MARK_SIZE Size of marks in pixels Yes Yes Yes
CMLayer.ZOOM_RANGE Sets the zoom range for a layer to be displayed at. Value is an array formated at [MinZoomLevel,MaxZoomLevel] Yes Yes Yes
CMLayer.LABEL_STYLE A standard HTML Canvas style object Yes Yes Yes
CMLayer.LABEL The source for the actual label Yes Yes Yes
CMLayer.LABEL_POSITION The position to draw the label in defined by the direction and offsets {Direction:UL,OffsetX:10,OffsetY:10} Yes Yes Yes
CMLayer.LABEL_FONT A standard HTML Canvas font string such as "30px Arial". The "px" is required. Yes Yes Yes

1. For images specified through an attribute, the image object is replaced by "src=<URL>" where "<URL>" is the URL for the image file.

CMView

Typically, only the CanvasMap code will call the view. This is for those wishing to create their own layer types.

Below are the currently defined tools:

Documentation Standard

The documentation standard within CanvasMap is a subset of the JSDoc standard.

"//**********" is used to delineate large blocks of code. These are ignoried by the documentation genorator.

Header blocks for files, functions, enums, and other areas of code are delinated as follows. These headers are examined by the documentation generated (the Java program CreateDocsJS).

/**
* This is a heading for code 
*/

We use the following notation within the header to ducment the code:

@module myModule – file with classes and other code
@class - class

@param FunctionParameter - description
@returns FunctionReturnParameter - description

Enumerated definition
@enum

Function notation:
@public  - appears in scripting reference
@protected – subclasses typically call this? (appears in extension reference)
@override – subclasses typically override? (appears in extension reference)

The following are not used in CanvasMap:

@inheritdoc
@override Indicate that a symbol overrides its parent.
@static – can get from not having “prototype” in the definition
@private – this is implied by a function that does not have @protected or @public