|
@@ -1,45 +1,56 @@
|
|
|
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
|
|
|
import Graphic from "@arcgis/core/Graphic.js";
|
|
|
import Point from "@arcgis/core/geometry/Point.js";
|
|
|
+import dangerIcon from "../../assets/预警.png";
|
|
|
+import levelFrIcon from "../../assets/三维_点.png";
|
|
|
class MoveCarEvent {
|
|
|
constructor(options) {
|
|
|
this.view = options.view;
|
|
|
- this.paths = options.paths;
|
|
|
+ this.data = options.data;
|
|
|
this.graphicsLayer = null;
|
|
|
this.ready();
|
|
|
}
|
|
|
ready(){
|
|
|
this.graphicsLayer = new GraphicsLayer({
|
|
|
id:"moveCar",
|
|
|
- title:"汽车移动",
|
|
|
+ title:"汽车移动"
|
|
|
});
|
|
|
this.view.map.add(this.graphicsLayer);
|
|
|
- this.setGraphics(this.paths);
|
|
|
+ this.setGraphics(this.data);
|
|
|
}
|
|
|
- update(paths){
|
|
|
+ update(data){
|
|
|
//更新点位geometry以及attribute信息
|
|
|
this.graphicsLayer.removeAll();
|
|
|
- this.setGraphics(paths);
|
|
|
+ this.setGraphics(data);
|
|
|
+ this.updateTrajectories(data);
|
|
|
}
|
|
|
- setGraphics(paths){
|
|
|
- for(let key in paths){
|
|
|
+ setGraphics(data){
|
|
|
+ for(let key in data){
|
|
|
this.graphicsLayer.add(new Graphic({
|
|
|
geometry:new Point({
|
|
|
- x:paths[key].point.x,
|
|
|
- y:paths[key].point.y,
|
|
|
- z:paths[key].point.z,
|
|
|
+ x:data[key].x,
|
|
|
+ y:data[key].y,
|
|
|
+ z:data[key].z,
|
|
|
spatialReference:this.view.spatialReference,
|
|
|
}),
|
|
|
- symbolLayers:[{
|
|
|
- type:"point-3d",
|
|
|
- resource:{
|
|
|
- href:"gltf/wrj.glb"
|
|
|
- },
|
|
|
- depth:6
|
|
|
- }],
|
|
|
+ symbol: {
|
|
|
+ type: "point-3d",
|
|
|
+ symbolLayers:[{
|
|
|
+ type: "icon",
|
|
|
+ resource: {
|
|
|
+ href: levelFrIcon
|
|
|
+ },
|
|
|
+ size: 50,
|
|
|
+ outline: {
|
|
|
+ color: "white",
|
|
|
+ size: 2
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
attributes:{
|
|
|
- id:paths[key].id,
|
|
|
- name:paths[key].name
|
|
|
+ id:data[key].id,
|
|
|
+ name:data[key].name,
|
|
|
+ type:data[key].overall,
|
|
|
},
|
|
|
}));
|
|
|
}
|