123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
- import Graphic from "@arcgis/core/Graphic.js";
- import Point from "@arcgis/core/geometry/Point.js";
- //测试数据
- import Path from '../../config/pathJson.json'
- class SymbolPointCubeEvent{
- constructor(options) {
- this.view = options.view;
- this.points = options.points;
- this.size = options.size;
- this.graphicsLayer = null;
- this.add();
- }
- add(){
- this.graphicsLayer = new GraphicsLayer({
- id: "symbolPointCubeEvent",
- title: "绘制立方体"
- });
- //this.points = Path.ypPath;
- this.points.forEach((point)=>{
- let geometry = new Point({
- type:"point",
- spatialReference:this.view.spatialReference,
- x:point.x,
- y:point.y,
- z:point.z
- });
- let symbol = {
- type: "point-3d",
- symbolLayers: [{
- type: "object",
- material: {
- color: [0, 255, 0,0.3]
- },
- resource: { primitive: "cube" },
- width: this.size.x, // the width in m
- height: this.size.y, // the height in m
- depth:this.size.z
- }]
- };
- let graphic = new Graphic({
- geometry: geometry,
- symbol: symbol
- });
- this.graphicsLayer.add(graphic);
- })
- }
- clear(){
- this.graphicsLayer.removeAll();
- }
- }
- export default SymbolPointCubeEvent;
|