Constructor | Description |
|---|---|
drawing.DrawingManager(options) | Creates a DrawingManager instance. In the constructor, options is used to set DrawingManager attributes. For details, please refer to DrawingManagerOptions. |
Method | Description | Type | Return Value |
|---|---|---|---|
getDrawingMode() | Obtains the drawing mode of DrawingManager. | - | |
getMap() | Obtains the bound map instance. | - | |
setDrawingMode(drawingMode) | Sets the drawing mode of DrawingManager. | - | |
setMap(map,HWMapJsSDK) | Sets the map to which the drawn shape will be bound. | - | |
setOptions(options) | Sets options for DrawingManager. | - |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
boxOptions | No | Sets the custom style for a rectangle. | |
circleOptions | No | Sets the custom style for a circle. | |
drawingControl | Yes | Boolean | Indicates whether to enable the drawing control.
The default value is true. |
drawingControlOptions | No | Drawing control display options. | |
drawingMode | No | Drawing mode, which specifies the type of the ground overlay to be drawn. The default value is None. | |
polygonOptions | No | Sets the custom style for a polygon. | |
polylineOptions | No | Sets the custom style for a polyline. | |
map | No | Map instance. | |
markerOptions | No | Sets the custom style for a point. | |
onComplete | No | Function | Called when the drawing is completed. NOTE: The callback function has two parameters:
|
onChange | No | Function | Called when the shape is changed. NOTE: The callback function has two parameters:
|
selectedObjectType | No | Object type used for drawing. The options include HW Object (default) and OL Object. | |
showSelectedObjectType | No | Boolean | Indicates whether to show the HW Object and OL Object select boxes.
The default value is false. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
fillColor | No | String | Fill color. The default value is #D8D8D8. The color can be set in hexadecimal, for example, #ff0000. |
fillOpacity | No | Number | Opacity of the fill color. The value range is [0, 1]. 0: transparent 1: opaque The default value is 0.6. |
strokeColor | No | String | Stroke color. The default value is #969696. The color can be set in hexadecimal, for example, #ff0000. |
strokeWeight | No | Number | Stroke width, in pixels. The default value is 4. |
clickable | No | Boolean | Indicates whether the shape can be clicked. true: yes false: no The default value is true. |
editable | No | Boolean | Indicates whether the shape can be edited. true: yes false: no The default value is false. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
fillColor | No | String | Fill color. The default value is #D8D8D8. The color can be set in hexadecimal, for example, #ff0000. |
fillOpacity | No | Number | Opacity of the fill color. The value range is [0, 1]. 0: transparent 1: opaque The default value is 1. |
strokeColor | No | String | Stroke color. The default value is #969696. The color can be set in hexadecimal, for example, #ff0000. |
strokeWeight | No | Number | Stroke width, in pixels. The default value is 4. |
clickable | No | Boolean | Indicates whether the shape can be clicked. true: yes false: no The default value is true. |
editable | No | Boolean | Indicates whether the shape can be edited. true: yes false: no The default value is false. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
fillColor | No | String | Fill color. The default value is #D8D8D8. The color can be set in hexadecimal, for example, #ff0000. |
fillOpacity | No | Number | Opacity of the fill color. The value range is [0, 1]. 0: transparent 1: opaque The default value is 0.6. |
strokeColor | No | String | Stroke color. The default value is #969696. The color can be set in hexadecimal, for example, #ff0000. |
strokeWeight | No | Number | Stroke width, in pixels. The default value is 4. |
clickable | No | Boolean | Indicates whether the shape can be clicked. true: yes false: no The default value is true. |
editable | No | Boolean | Indicates whether the shape can be edited. true: yes false: no The default value is false. |
maxPoints | No | Number | Maximum number of vertices in a polygon. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
fillColor | No | String | Fill color. The default value is #D8D8D8. The color can be set in hexadecimal, for example, #ff0000. |
fillOpacity | No | Number | Opacity of the fill color. The value range is [0, 1]. 0: transparent 1: opaque The default value is 1. |
strokeColor | No | String | Stroke color. The default value is #969696. The color can be set in hexadecimal, for example, #ff0000. |
strokeWeight | No | Number | Stroke width, in pixels. The default value is 4. |
clickable | No | Boolean | Indicates whether the shape can be clicked. true: yes false: no The default value is true. |
editable | No | Boolean | Indicates whether the shape can be edited. true: yes false: no The default value is false. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
icon | No | Icon of a marker, which can be the URL of an image or a file path. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
url | No | String | Image address, which can be the image URL or file path. By default, a built-in image is provided. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
drawingModes | No | Array<OverlayType> | Order for displaying elements in the drawing control. The hand icon (which corresponds to the null drawing mode) is always available and does not need to be specified in this array. By default, elements are sorted in the following order: point, circle, polygon, polyline, and rectangle. |
position | No | Position ID, which specifies the position for displaying the control on the map. The default value is TOP_CENTER. |
Constant | Description |
|---|---|
NONE | Do not set any drawing mode. |
POINT | Specifies DrawingManager to create a point. |
CIRCLE | Specifies DrawingManager to create a circle. |
POLYGON | Specifies DrawingManager to create a polygon. |
LINE_STRING | Specifies DrawingManager to create a polyline. |
BOX | Specifies DrawingManager to create a rectangle. |
Constant | Description |
|---|---|
BOTTOM_CENTER | The drawing control is displayed in the center of the bottom side. |
BOTTOM_LEFT | The drawing control is displayed in the lower left corner. |
BOTTOM_RIGHT | The drawing control is displayed in the lower right corner. |
LEFT_CENTER | The drawing control is displayed in the center of the left side. |
RIGHT_CENTER | The drawing control is displayed in the center of the right side. |
TOP_CENTER | The drawing control is displayed in the center of the top side. |
TOP_LEFT | The drawing control is displayed in the upper left corner, and flows towards the middle. |
TOP_RIGHT | The drawing control is displayed in the upper right corner, and flows towards the middle. |