12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import Graphic from "@arcgis/core/Graphic.js";
- import dangerIcon from "../../assets/预警.png";
- import Point from "@arcgis/core/geometry/Point.js";
- class AddGraphicsEvent {
- constructor(options) {
- this.id = options.id;
- this.view = options.view;
- this.data = options.data;
- this.add();
- }
- add(){
- let point = new Point({
- type: "point", // autocasts as new Point()
- x: this.data.geometry.x,
- y: this.data.geometry.y,
- z: this.data.geometry.z,
- spatialReference: this.view.spatialReference
- })
- let graphic = new Graphic({
- id: this.id,
- geometry: point,
- attributes: this.data.attributes,
- symbol:{
- type: "point-3d",
- symbolLayers: [
- {
- type: "icon",
- resource: {
- href: dangerIcon
- },
- size: 50,
- outline: {
- color: "white",
- size: 2
- }
- }
- ]
- },
- });
- this.view.graphics.add(graphic)
- }
- }
- export default AddGraphicsEvent;
|