Class GSPolylineDrawingHandler
Extends GSDrawingHandler.
A helper class for drawing polyline shapes. Use the Enter key when you have finished drawing the line, or use the Esc key to abort.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
GSPolylineDrawingHandler(layer, options)
Constructs a new
GSPolylineDrawingHandler that is initialized with the properties provided. |
- Methods borrowed from class GSDrawingHandler:
- cancelDrawing, snapPoint, startDrawing, stopDrawing
Class Detail
GSPolylineDrawingHandler(layer, options)
Constructs a new
GSPolylineDrawingHandler that is initialized with the properties provided. This class should not
be instantiated directly, but instead referenced by GSPolyline.drawingHandler.
var drawStyle = {stroke: '#a80510', 'stroke-width': '2px', 'stroke-opacity': 0.8};
var viewStyle = {stroke: '#3886d9', 'stroke-width': '2px', 'stroke-opacity': 0.8};
var options = {
drawStyle: drawStyle,
viewStyle: viewStyle,
onShapeCreated: function(shape) {
console.log(shape);
}
};
var drawingHandler = new GSPolylineDrawingHandler(map.getLayer('base'), options);
- 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:
- {Object} 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.