API Docs for: 7.2
Show:

MQA.DrawingOverlay Class

Module: MQA

The DrawingOverlay class is a general purpose implementation for shape drawing that is used as a mix-in for shape overlay classes in order to provide user-created drawing capabilities.

Constructor

MQA.DrawingOverlay

() private

Properties

dragging

Boolean

Whether a vertex/point is currently being dragged.

drawingEnabled

Boolean

Whether user-created drawing is currently enabled for the overlay.

firstPoint

Boolean

Whether the first point is still undetermined.

True if it has not yet been set, false otherwise.

hasBoundaries

Boolean

Whether this drawing overlay is boundary-based: A shape is described by a pair of lat/lng pairs for the upper-left and lower-right boundaries.

hasBoundingBox

Boolean

Whether this drawing overlay is boundary-based, but not resized at the vertices (no vertices in the corners of the boundaries, like ellipses).

hasVertices

Boolean

Whether this drawing overlay is vertex-based: A shape is described by a list of lat/lng pairs that make up the points of the shape.

isCircle

Boolean

Whether this drawing overlay instance derives from the Circle shape overlay.

isEllipse

Boolean

Whether this drawing overlay instance derives from the Ellipse shape overlay.

isLine

Boolean

Whether this drawing overlay instance derives from the Line shape overlay.

isPolygon

Boolean

Whether this drawing overlay instance derives from the Polygon shape overlay.

isRectangle

Boolean

Whether this drawing overlay instance derives from the Rectangle shape overlay.

isUnknown

Boolean

Whether this drawing overlay instance derives from an unknown shape overlay.

overlay

DrawingOverlay

A reference to the source drawing overlay class.

pois

Array

A cache of all poi objects that are owned by the drawing overlay.

Methods

_createBoundingBox

() RectangleOverlay private

Creates a bounding box shape for use with dragging/changing shapes that don't have true vertices.

Returns <RectangleOverlay>

boundingBox

_createVertex

(
  • latLng
  • shapePointIndex
)
BasePoi private

Creates a vertex poi for use with dragging/changing shapes.

Parameters:

  • latLng Object

    The lat/lng pair for this poi.

  • shapePointIndex Number

    The index of this point in relation to other vertices.

Returns <BasePoi>

poi

_drawPoints

() private

Ensures that all of the vertex pois and the bounding box exist and are properly rendered.

_getBoundingPoints

(
  • shapePoints
)
Array private

Determines the new upper-left/lower-right bounding points given a pair of lat/lng pairs.

Parameters:

Returns <Array>

boundingPoints

_getMouseLatLng

(
  • evt
)
Object private

Retrieves the corresponding lat/lng pair for a given mouse event.

Parameters:

  • evt Event

Returns <Object>

latLng

_onmapclick

(
  • evt
)
private

Handles the map click event.

Parameters:

  • evt Event

_onmapdoubleclick

(
  • evt
)
private

Handles the map double-click event.

Parameters:

  • evt Event

_onmapmove

(
  • evt
)
private

Handles the map mousemove event.

Parameters:

  • evt Event

_onmapmoveend

(
  • event
)
private

Handle map moveend event.

Override cursor style as appropriate.

Parameters:

  • event Event

_triggerDrawingModified

() private

Trigger drawingmodified events for this shape on itself and its map.

createShapeDrawingOverlay

(
  • sourceClass
)
Function private

Generates a drawing-enhanced class derived from the source shape overlay class.

Parameters:

  • sourceClass Function

    The source shape overlay class.

Returns <Function>

drawingOverlayClass

dispose

()

Cleans up after the drawing overlay and removes all related shapes.

onclick

()

Handles the shape overlay click event.

onmouseout

()

Handles the shape overlay mouseout event.

onmouseover

()

Handles the shape overlay mouseover event.

setSelected

(
  • selected
)

Show or hide the visuals that mark this shape as editable.

'Selection' is primarily a visual aid to show the user what shape will be updated if they take an action.

It also activates the drag handles so they can change the shape's points.

Parameters:

setShapePoints

(
  • newShapePoints
)

setShapePoints overrides the default ShapeOverlay implementation to update the bounding box shape whenever the base shape has changed.

Parameters:

setVertexVisibility

(
  • visible
)

Sets the visibility of vertex pois.

Parameters:

startDrawing

()

Initiates the drawing of a new shape within the drawing overlay.

stopDrawing

(
  • fromDispose
)

Finishes the drawing/changing of a shape within the drawing overlay.

Parameters:

  • fromDispose Boolean

    Whether this method was called from the dispose() method.