当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


JavaScript ArcGIS SegmentDrawAction draw-complete事件用法及代码示例


基本信息

以下是所在类或对象的基本信息。

AMD: require(["esri/views/draw/SegmentDrawAction"], (SegmentDrawAction) => { /* code goes here */ });

ESM: import SegmentDrawAction from "@arcgis/core/views/draw/SegmentDrawAction";

类: esri/views/draw/SegmentDrawAction

继承: SegmentDrawAction > DrawAction > Accessor

自从:用于 JavaScript 4.7 的 ArcGIS API

用法说明

SegmentDrawAction draw-complete事件的定义如下:

draw-complete


在用户完成几何图形绘制后触发。

属性:

类型说明
vertices Number[][]

一个二维数字数组,表示构成几何的每个顶点的坐标。

preventDefault Function

防止事件传播在事件链上冒泡。

defaultPrevented Boolean

调用 preventDefault() 时设置为 true。

type String

事件的类型。

值永远是"draw-complete".

例子:

// listen to SegmentDrawAction.draw-complete
// add the graphic representing the completed
// polygon to the view
action.on("draw-complete", function (evt) {
  view.graphics.removeAll();
  let polygon = new Polygon({
    rings: evt.vertices,
    spatialReference: view.spatialReference
  });
  graphic = createGraphic(polygon);
  view.graphics.add(graphic);
});

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 SegmentDrawAction draw-complete event。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。