基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/views/draw/MultipointDrawAction"], (MultipointDrawAction) => { /* code goes here */ });
ESM:
import MultipointDrawAction from "@arcgis/core/views/draw/MultipointDrawAction";
类:
esri/views/draw/MultipointDrawAction
继承: MultipointDrawAction > DrawAction > Accessor
自从:用于 JavaScript 4.6 的 ArcGIS API
用法说明
此类使用视图事件生成一组坐标,以使用 Draw 创建新的 Multipoint 几何图形。当调用 draw.create("multipoint") 方法时,将返回对 MultipointDrawAction 的引用。您可以侦听 MultipointDrawAction 实例上的事件,这允许用户创建满足应用程序指定条件的多点。
已知限制
目前,MultipointDrawAction 仅在 MapView 中受支持。
例子:
function enableCreateMultipoint(draw, view) {
let action = draw.create("multipoint");
// Give a visual feedback to users as they move the pointer over the view
action.on("cursor-update", function (evt) {
createMultipointGraphic(evt.vertices);
});
// Fires when the user clicks, or presses the "F" key on the view
// Can also fire when the "R" key is pressed to redo.
action.on("vertex-add", function (evt) {
createMultipointGraphic(evt.vertices);
});
// Fires when the "Z" key is pressed to undo the last added point
action.on("vertex-remove", function (evt) {
createMultipointGraphic(evt.vertices);
});
// Create a point when user clicks on the view or presses "C" key.
action.on("draw-complete", function (evt) {
createMultipointGraphic(evt.vertices);
});
}
function createMultipointGraphic(vertices) {
view.graphics.removeAll();
let multipoint = new Multipoint({
points: vertices,
spatialReference: view.spatialReference
});
graphic = new Graphic({
geometry: multipoint,
symbol: {
type: "simple-marker",
style: "square",
color: "red",
size: "16px",
outline: {
color: [255, 255, 0],
width: 3
}
}
});
view.graphics.add(graphic);
}
相关用法
- JavaScript ArcGIS MultipointDrawAction vertex-add事件用法及代码示例
- JavaScript ArcGIS MultipointDrawAction.redo用法及代码示例
- JavaScript ArcGIS MultipointDrawAction draw-complete事件用法及代码示例
- JavaScript ArcGIS MultipointDrawAction vertex-remove事件用法及代码示例
- JavaScript ArcGIS MultipointDrawAction undo事件用法及代码示例
- JavaScript ArcGIS MultipointDrawAction.undo用法及代码示例
- JavaScript ArcGIS MultipointDrawAction cursor-update事件用法及代码示例
- JavaScript ArcGIS MultipointDrawAction redo事件用法及代码示例
- JavaScript ArcGIS MultipointDrawAction.on用法及代码示例
- JavaScript ArcGIS MapImageLayer.minScale用法及代码示例
- JavaScript Math abs()用法及代码示例
- JavaScript Measurement.areaUnit用法及代码示例
- JavaScript ArcGIS MosaicRule.lockRasterIds用法及代码示例
- JavaScript ArcGIS MapImageLayer.customParameters用法及代码示例
- JavaScript ArcGIS MosaicRule.viewpoint用法及代码示例
- JavaScript ArcGIS Map.allTables用法及代码示例
- JavaScript Math hypot()用法及代码示例
- JavaScript ArcGIS MeshComponent.faces用法及代码示例
- JavaScript Map.delete()用法及代码示例
- JavaScript ArcGIS MapView double-click事件用法及代码示例
- JavaScript Math.tanh()用法及代码示例
- JavaScript ArcGIS MapNotesLayer.maxScale用法及代码示例
- JavaScript ArcGIS MapView.constraints用法及代码示例
- JavaScript ArcGIS MapView.takeScreenshot用法及代码示例
- JavaScript ArcGIS MapView.when用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 MultipointDrawAction。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。