GetContext()
Returns the context for the CanvasMap's canvas. This is not used often but is required do things like great gradients.
The GetExtent()
Returns the current extent of the viewing area in reference units
Returns: The reference bounds of the canvas map { XMin,XMax,YMin,YMax }
Flag MouseDown()
Handles a mouse down event in the view. Can be overriden to place items in the view and have the user interact with them.
Returns: Flag returns True if the function "used" the event so other stuff does not use it.
Flag MouseMove()
Handles a mouse move event in the view. Can be overriden to place items in the view and have the user interact with them.
Returns: Flag returns True if the function "used" the event so other stuff does not use it.
Flag MouseUp()
Handles a mouse move up in the view. Can be overriden to place items in the view and have the user interact with them.
Returns: Flag returns True if the function "used" the event so other stuff does not use it.
Flag MouseWheel()
Handles a mouse wheel event. Can be overriden to change the action taken when the user moves the wheel.
Returns: Flag returns True if the function "used" the event so other stuff does not use it.
SetMaxBounds(MaxBounds)
Sets the maximum baonds the view will allow it self to be panned.
Parameters:
MaxBounds - { XMin,XMax,YMin,YMax }
SetZoomRange(MinZoom, MaxZoom)
Sets the Minimum and maximum zoom levels for the map.
Parameters:
MinZoom - lowest allowed value for the zoom level
MaxZoom - hightest allowed value for the zoom level.
SetRefCenter(RefX, RefY)
Sets the center of the map to the specified coordinate
Parameters:
RefX -
RefY -
Result GetRefCenter()
Returns the coordinate that is in the center of the view
Returns: Result null
ZoomToBounds(NewBounds)
Zooms the view to the specified bounds. Selects a zoom level that will contain the entire map.
Parameters:
NewBounds -
ZoomIn()
Zoom in to a higher resolution (map units are doubled relative to pixels)
ZoomOut()
Zoom in to a lower resolution (map units are halved relative to pixels)
ZoomTo(ZoomLevel)
Zoom to a specific zoom level. This can be fractional value.
Parameters:
ZoomLevel - desired zoom level, 1 is 1:1 pixels to reference units
ZoomToMaxBounds()
Zoom to the maxum bounds that have been set in the veiw
ZoomLevel GetZoomLevel()
Returns the current zoom level. 1 is one pixel per one map unit, doubles with each zoom in so 2 is two pixels per map unit, 3 is 4 pixels per map unit, 4 is 16 pixels per map unit, etc.
Returns: ZoomLevel null
SetTool(NewTool)
Change the current tool that will be used when the user clicks with the mouse
Parameters:
NewTool from the enums: CMView.TOOL_HAND,...
NewTool GetTool()
Returns the current tool
Returns: NewTool from the enums: CMView.TOOL_HAND,...
PixelX GetPixelXFromRefX(RefX)
Converts a horiziontal coordinate value to a horizontal pixel value
Parameters:
RefX horiziontal coordinate value in reference coordinates
Returns: PixelX null
PixelY GetPixelYFromRefY(RefY)
Converts a vertical coordinate value to a vertical pixel value
Parameters:
RefY vertical coordinate value in reference coordinates
Returns: PixelY null
PixelCoordinate GetPixelFromRef(RefX, RefY)
Converts a horiziontal reference coordinate to a horizontal pixel coordinate value
Parameters:
RefX horiziontal coordinate value in reference coordinates
RefY vertical coordinate value in vertical coordinates
Returns: PixelCoordinate { PixelX,PixelY }
PixelWidth GetPixelWidthFromRefWidth(RefWidth)
Converts a horiziontal reference width to a pixel width value
Parameters:
RefWidth horiziontal reference value
Returns: PixelWidth null
PixelHeight GetPixelHeightFromRefHeight(RefHeight)
Converts a vertical reference height to a pixel height
Parameters:
RefHeight vertical height in reference units
Returns: PixelHeight null
RefWidth GetRefWidthFromPixelWidth(PixelWidth)
Converts a horiziontal reference width to a horizontal pixel width
Parameters:
PixelWidth horiziontal width in pixels
Returns: RefWidth horiziontal reference width
RefHeight GetRefHeightFromPixelHeight(PixelHeight)
Converts a vertical reference height to a vertical pixel widthheight
Parameters:
PixelHeight vertical height in pixels
Returns: RefHeight vertical reference height
RefX GetRefXFromPixelX(PixelX)
Converts a horiziontal reference value to a horizontal pixel value
Parameters:
PixelX horiziontal coordinate value in pixels
Returns: RefX horiziontal reference coordinate value
RefY GetRefYFromPixelY(PixelY)
Converts a vertical reference value to a vertical pixel value
Parameters:
PixelY vertical coordinate value in pixels
Returns: RefY vertical reference coordinate value
SetStyle(NewStyle, SaveCurrentStyle)
Sets a style for painting. The existing style is saved. New style is an array of key value pairs (i.e. objects)
Parameters:
NewStyle the style to use for painting
SaveCurrentStyle - true to have the current style saved
SaveStyle()
Saves the current style to a stack
RestoreStyle()
Restores the style from the stack
Paint()
Paints the contents of the view. Called by the Scene which is called by the CanvasMap object.
PaintImage(TheImage, PixelX, PixelY)
Paints an image at the specified pixel location. CanvasMap object.
Parameters:
TheImage
PixelX
PixelY
PaintBackground()
Paints the background of the canvas element.
PaintCircle(X, Y, RadiusInPixels)
Paints a circle using pixel coordinate values
Parameters:
X
Y
RadiusInPixels
PaintRect(PixelXMin, PixelXMax, PixelYMin, PixelYMax)
Paints a rectangle based on the specified bounds
Parameters:
PixelXMin - Left side of the rectangle
PixelXMax - Right side of the rectangle
PixelYMin - Top of the rectangle
PixelYMax - Bottom of the rectangle
PaintRoundedRect(PixelXMin, PixelXMax, PixelYMin, PixelYMax, PixelXRadius, PixelYRadius)
Function to paint a rounded rectangle Adapted from: http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas
Parameters:
PixelXMin - Left side of the rectangle
PixelXMax - Right side of the rectangle
PixelYMin - Top of the rectangle
PixelYMax - Bottom of the rectangle
PixelXRadius - Horizontal radius or both if PixelYRadius is not specified
PixelYRadius - Vertical radius of the corners
PaintRefBounds(TheBounds)
Paints a rectangle based on the bounds.
Parameters:
TheBounds
PaintRefRect(XMin, XMax, YMin, YMax)
Paints a rectangle based on the specified bounds.
Parameters:
XMin
XMax
YMin
YMax
PaintRefCircle(X, Y, RadiusInPixels)
Function to draw a circle from a reference coordinate
Parameters:
X
Y
RadiusInPixels
PaintRefText(X, Y, Text)
Function to draw text using reference coordinates
Parameters:
X
Y
Text
PaintRefLine(X1, Y1, X2, Y2)
Function to draw a line using reference coordinates
Parameters:
X1
Y1
X2
Y2
PaintRefPoly2(Xs, Ys, Closed, Stroke)
Function to paint a polygon.
Parameters:
Xs - array of horiziontal coordinate values in reference units
Ys
Closed - true to close the polygon (filled)
Stroke - true to stroke (outline) the polygon
PaintRefImage(TheImage, RefX, RefY)
Function to paint an image using reference coordinates
Parameters:
TheImage -
RefX - Left side of the image
RefY
PaintRefImageScaled(TheImage, RefX, RefY, RefWidth, RefHeight)
Function to draw a raster using a bounding box in reference coordinates The second parameter may be a RefX or a Bounds object.
Parameters:
TheImage -
RefX - Left side of the image or a bound box
RefY - Top of the image
RefWidth - width of the image
RefHeight
PaintRefPolygon(TheCoordinates)
Draw a simple poly using the specified coordinates
Parameters:
TheCoordinates
PaintRefLineString(TheCoordinates)
Draw a simple line string using the specified coordinates
Parameters:
TheCoordinates
PaintRefPoly(TheCoordinates, Closed)
Draw a simple poly using the specified coordinates
Parameters:
TheCoordinates
Closed
PaintRefGeometry(TheGeometry)
Paint a geometry that is in reference coordinates (i.e. GeoJSON)
Parameters:
TheGeometry
CreateInfoWindow(ID, RefX, RefY, WindowWidth, WindowHeight, TheHTML)
Creates an info popup window and displays the specific HTML. jjg - not sure this should be in CMView
Parameters:
ID
RefX
RefY
WindowWidth
WindowHeight
TheHTML