基本信息
以下是所在類或對象的基本信息。
AMD:
require(["esri/views/draw/PointDrawAction"], (PointDrawAction) => { /* code goes here */ });
ESM:
import PointDrawAction from "@arcgis/core/views/draw/PointDrawAction";
類:
esri/views/draw/PointDrawAction
繼承: PointDrawAction > DrawAction > Accessor
自從:用於 JavaScript 4.5 的 ArcGIS API
用法說明
此類使用視圖事件生成一組坐標,以使用 Draw 創建新的 Point 幾何圖形。當調用 draw.create("point") 方法時,將返回對 PointDrawAction 的引用。偵聽 PointDrawAction 的 cursor-update 和 draw-complete 事件來處理點幾何體的創建。
例子:
function enableCreatePoint(draw, view) {
let action = draw.create("point");
// PointDrawAction.cursor-update
// Give a visual feedback to users as they move the pointer over the view
action.on("cursor-update", function (evt) {
createPointGraphic(evt.coordinates);
});
// PointDrawAction.draw-complete
// Create a point when user clicks on the view or presses "C" key.
action.on("draw-complete", function (evt) {
createPointGraphic(evt.coordinates);
});
}
function createPointGraphic(coordinates){
view.graphics.removeAll();
let point = {
type: "point", // autocasts as /Point
x: coordinates[0],
y: coordinates[1],
spatialReference: view.spatialReference
};
let graphic = new Graphic({
geometry: point,
symbol: {
type: "simple-marker", // autocasts as SimpleMarkerSymbol
style: "square",
color: "red",
size: "16px",
outline: { // autocasts as SimpleLineSymbol
color: [255, 255, 0],
width: 3
}
}
});
view.graphics.add(graphic);
}
相關用法
- JavaScript ArcGIS PointDrawAction.undo用法及代碼示例
- JavaScript ArcGIS PointDrawAction.redo用法及代碼示例
- JavaScript ArcGIS PointDrawAction.on用法及代碼示例
- JavaScript ArcGIS PointDrawAction draw-complete事件用法及代碼示例
- JavaScript ArcGIS PointDrawAction cursor-update事件用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.apiKey用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.fields用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.on用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.when用法及代碼示例
- JavaScript ArcGIS PointCloudLayer layerview-create-error事件用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.url用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.queryCachedStatistics用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.version用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.filters用法及代碼示例
- JavaScript ArcGIS PointCloudValueFilter用法及代碼示例
- JavaScript ArcGIS PointCloudFilter用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.fieldsIndex用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.fullExtent用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.visible用法及代碼示例
- JavaScript ArcGIS PointCloudLayer.layerId用法及代碼示例
- JavaScript ArcGIS PointSymbol3D.clone用法及代碼示例
- JavaScript ArcGIS PointSymbol3D用法及代碼示例
- JavaScript ArcGIS PointCloudLayerView.when用法及代碼示例
- JavaScript ArcGIS PointCloudLayerView.highlight用法及代碼示例
- JavaScript ArcGIS PointCloudLayer layerview-create事件用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 PointDrawAction。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。