CanvasMap
Getting Started Tutorials 3D Reference

Implementation

The content below is for programmers that which to know more about the internals of CanvasMap either to help fix defects or to add additoinal funcionality.

Object Oriented Programming Approach

CanvasMap uses an Object Oriented Programming with the ability to both override object methods and create new classes that inherit from super classes. This can be achieved in JavaScript using the "prototype" approach (see JavaScript: The World's Most Misunderstood Programming Language). This approach is similar to other languages and straight forward. Other approaches were not used because they either limited inheritance or were difficult for novice programmers to work with.

Coding Practicies

Inheritance

CanvasMap makes use of inheritance according to the Mozilla documentation. This will be unusual for folks familiary with object oriented programing in other langauges as JavaScript does not have a "class" construct (it was added to the spec but is not yet impolemented widely). The approach is as follows:

SuperClass=function() // constructor for the base class

{
	// properties for the  super class can include functoins, variables, and complex objects if the approach below is followed
}

SubClass=function()
{
	SuperClass.call(this); // call super constructor to intialize it's properties (some may be overriden later)
}
SubClass.prototype=Object.create(SuperClass.prototype) // make a copy of the SuperClasses functions (including the constructor), this is only done once

SubClass.prototype.constructor=SubClass; // replace the SuperClasses constructor with the subclasses

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