Class GSDrawingHandler
Base class for creating helper classes for drawing SVG features.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
GSDrawingHandler(layer, options)
Constructs a new
GSDrawingHandler. |
| Method Attributes | Method Name and Description |
|---|---|
|
Cancels the current drawing operation
|
|
|
snapPoint(point)
Snap a point to any other snappable features on the map
|
|
|
Start the drawing operation
|
|
|
Stop the drawing operation and, if possible, create the shape
|
Class Detail
GSDrawingHandler(layer, options)
Constructs a new
GSDrawingHandler. This class should not be instantiated directly.
- Parameters:
- {GSLayer} layer
- the layer object that this drawing handler will create features on
- {Object} options Optional
- an object literal specifying the options to set:
- {String} options.drawStyle
- object literal specifying the style properties to use while drawing the shape
- {Object} options.featureOptions
- options to set on new features created by the drawing handler. Any valid option supported by the feature type to be drawn
- {Function} options.onShapeCreated
- callback function that is invoked when drawing has finished and the shape is created. Receives the newly created shape as an argument.
- {Function} options.onDrawingCancelled
- callback function that is invoked when a drawing is cancelled, no shape is created.
Method Detail
cancelDrawing()
Cancels the current drawing operation
{GSPoint}
snapPoint(point)
Snap a point to any other snappable features on the map
- Parameters:
- {GSPoint} point
- the point that should be snapped
- Returns:
- {GSPoint} the snapped point
startDrawing()
Start the drawing operation
stopDrawing()
Stop the drawing operation and, if possible, create the shape