new SketchEditor(options)
sketchEditor/SketchEditor.js, line 15
Cesium引擎草图编辑类
继承自zondy.SketchEditor3D
[ES5引入方式]:
const { SketchEditor } = zondy.tool.sketch
[ES6引入方式]:
import { SketchEditor } from "@mapgis/webclient-leaflet-plugin"
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
构造参数
|
Fires
- SketchEditor#event:草图绘制完成事件
- SketchEditor#event:草图被选中事件
Extends
- SketchEditor3D
Members
-
arcTypeArcType
-
草图图形弧线类型。none不考虑弧度。geodesic大地线(或称为大圆线)。rhumb等角航线。目前绘制线、区、矩形时,该属性生效。
- Default Value: ArcType.rhumb
Methods
-
addVertex(point, index){Geometry}
sketchEditor/SketchEditor.js, line 59 -
Name Type Description pointPoint 新增/插入顶点
indexNumber 新增点的索引值,索引值从0开始
Returns:
Type Description Geometry 改变后的图形几何 -
drawPolylineToPolygon(snapAndReferGeometries)
sketchEditor/SketchEditor.js, line 210 -
Name Type Description snapAndReferGeometriesArray.<Polygon> 捕获参考几何对象数组
Example
三维草图线拓扑造区 // [ES5引入方式]: const { Polygon, LineString } = zondy.geometry const { SceneView} = zondy.cesium const { SketchEditor } = zondy.cesium.tool.sketch [ES6引入方式]: import { SceneView, SketchEditor } from "@mapgis/webclient-cesium-plugin"
import { Polygon, LineString } from "@mapgis/webclient-common"
var map = new Map() var sceneView = new SceneView({ viewId: "mapgis-3d-viewer", map: map, }) var testGeometries = [ new Polygon({ coordinates: [ [ [114.0, 29.0], [117.0, 29.0], [117.0, 35.0], [114.0, 35.0], [114.0, 29.0] ] ] }), new Polygon({ coordinates: [ [ [113.0, 29.0], [116.0, 29.0], [116.0, 35.0], [113.0, 35.0], [113.0, 29.0] ] ] }) ] testFeatures = [ new Feature({ id: '11114', geometry: this.testGeometries[0], symbol: new SimpleFillSymbol({ color: new Color(0, 255, 255, 0.5), outline: new SimpleLineSymbol({ color: new Color(0, 255, 255, 0.8), width: 2 }) }) }), new Feature({ id: '11115', geometry: this.testGeometries[1], symbol: new SimpleFillSymbol({ color: new Color(0, 255, 255, 0.5), outline: new SimpleLineSymbol({ color: new Color(0, 255, 255, 0.8), width: 2 }) }) }), ] var testLayer = new GraphicsLayer({ graphics: this.testFeatures }) map.add(testLayer) var sketchEditor = new SketchEditor({ view: sceneView, layer: new GraphicsLayer() }) sketchEditor.drawPolylineToPolygon(testGeometries) -
removeVertex(index){Geometry}
sketchEditor/SketchEditor.js, line 86 -
Name Type Description indexNumber 需移除的顶点的索引值,索引值从0开始
Returns:
Type Description Geometry 改变后的图形几何 -
split(target, splitPolyline){Array.<Polygon>}
sketchEditor/SketchEditor.js, line 132 -
Name Type Description targetPolygon | SketchEditor 被分割的几何/草图对象
splitPolylinePolyline 线几何对象
Returns:
Type Description Array.<Polygon> 分割后的几何对象 Example
三维草图几何分割 // [ES5引入方式]: const { Polygon, LineString } = zondy.geometry const { SceneView} = zondy.cesium const { SketchEditor } = zondy.cesium.tool.sketch [ES6引入方式]: import { SceneView, SketchEditor } from "@mapgis/webclient-cesium-plugin"
import { Polygon, LineString } from "@mapgis/webclient-common"
var map = new Map() var sceneView = new SceneView({ viewId: "mapgis-3d-viewer", map: map, }) var SketchEditor = new SketchEditor({ view: sceneView, layer: new GraphicsLayer() }) const polygon = new Polygon({ coordinates: [ [ [108, 29], [116, 29], [116, 33], [108, 33], [108, 29] ] ] }) const polyline = new LineString({ coordinates: [ [100, 30], [120, 30] ] }) const newSketchEditors = SketchEditor.split(polygon,polyline) -
updateVertex(point, index){Geometry}
sketchEditor/SketchEditor.js, line 73 -
Name Type Description pointPoint 新的顶点
indexNumber 需更新的顶点的索引值,索引值从0开始
Returns:
Type Description Geometry 改变后的图形几何