gisviewer-vue3-arcgis 1.0.143 → 1.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/gis-map.vue.d.ts +0 -17
- package/es/src/gis-map/gis-map.vue.mjs +110 -115
- package/es/src/gis-map/index.d.ts +0 -17
- package/es/src/gis-map/stores/appData.d.ts +1 -0
- package/es/src/gis-map/stores/appData.mjs +2 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +231 -215
- package/es/src/gis-map/utils/sketchView.mjs +16 -11
- package/es/style.css +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +0 -17
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +0 -17
- package/lib/src/gis-map/stores/appData.d.ts +1 -0
- package/lib/src/gis-map/stores/appData.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/sketchView.js +1 -1
- package/package.json +1 -1
- package/es/_virtual/_plugin-vue_export-helper.mjs +0 -9
- package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
- package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +0 -7
- package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +0 -48
- package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +0 -4
- package/lib/_virtual/_plugin-vue_export-helper.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
- package/lib/src/gis-map/utils/components/sketch-tool.vue.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +0 -1
|
@@ -4,11 +4,12 @@ import l from "@arcgis/core/Graphic";
|
|
|
4
4
|
import f from "@arcgis/core/layers/GraphicsLayer";
|
|
5
5
|
import G from "@arcgis/core/widgets/Sketch";
|
|
6
6
|
import P from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import S from "@arcgis/core/geometry/Polygon.js";
|
|
8
|
+
import b from "@arcgis/core/geometry/Polyline.js";
|
|
9
9
|
import * as d from "@turf/helpers";
|
|
10
|
-
import
|
|
11
|
-
import { v4 as
|
|
10
|
+
import k from "@turf/intersect";
|
|
11
|
+
import { v4 as A } from "uuid";
|
|
12
|
+
import M from "../stores/index.mjs";
|
|
12
13
|
function u(c, t = []) {
|
|
13
14
|
if (c === null || typeof c != "object")
|
|
14
15
|
return c;
|
|
@@ -33,7 +34,7 @@ const x = {
|
|
|
33
34
|
maxAllowedGraphics: 0,
|
|
34
35
|
GraphicsLayer: {},
|
|
35
36
|
sketchVisibleElements: {},
|
|
36
|
-
sketchPosition: "top-
|
|
37
|
+
sketchPosition: "top-right",
|
|
37
38
|
defaultSketchVisible: !0,
|
|
38
39
|
sketchViewModelItemSymbol: {}
|
|
39
40
|
}, m = {
|
|
@@ -50,7 +51,7 @@ const x = {
|
|
|
50
51
|
width: 1
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
class
|
|
54
|
+
class B {
|
|
54
55
|
constructor(t, e) {
|
|
55
56
|
this.viewer = t, this.options = {
|
|
56
57
|
...x,
|
|
@@ -82,6 +83,10 @@ class R {
|
|
|
82
83
|
}), this.sketch.visibleElements = {
|
|
83
84
|
...this.options.sketchVisibleElements
|
|
84
85
|
}, this.viewer.ui.add(this.sketch, this.options.sketchPosition);
|
|
86
|
+
const i = M.useAppDataStore;
|
|
87
|
+
this.sketch.on("create", (s) => {
|
|
88
|
+
s.state === "complete" ? i.isSketching = !1 : s.state === "start" && (i.isSketching = !0);
|
|
89
|
+
});
|
|
85
90
|
}
|
|
86
91
|
/**
|
|
87
92
|
* 初始化绘图
|
|
@@ -137,7 +142,7 @@ class R {
|
|
|
137
142
|
return Object.keys(t).map((r) => {
|
|
138
143
|
const o = t[r][0], a = t[r][1];
|
|
139
144
|
e && (o.reverse(), a.reverse());
|
|
140
|
-
const n =
|
|
145
|
+
const n = A(), h = this.createPolylineGraphic(
|
|
141
146
|
o,
|
|
142
147
|
m,
|
|
143
148
|
{
|
|
@@ -152,7 +157,7 @@ class R {
|
|
|
152
157
|
}), i;
|
|
153
158
|
}
|
|
154
159
|
createPolylineGraphic(t, e, i) {
|
|
155
|
-
const s = new
|
|
160
|
+
const s = new b({
|
|
156
161
|
paths: t
|
|
157
162
|
}), r = g.geographicToWebMercator(s);
|
|
158
163
|
return new l({
|
|
@@ -164,7 +169,7 @@ class R {
|
|
|
164
169
|
});
|
|
165
170
|
}
|
|
166
171
|
createPolygonGraphic(t, e, i) {
|
|
167
|
-
const s = new
|
|
172
|
+
const s = new S({
|
|
168
173
|
rings: t
|
|
169
174
|
}), r = g.geographicToWebMercator(s);
|
|
170
175
|
return new l({
|
|
@@ -303,7 +308,7 @@ class R {
|
|
|
303
308
|
let s = !1;
|
|
304
309
|
for (let r = 0; r < i.length; r++) {
|
|
305
310
|
const o = i[r], a = t[o];
|
|
306
|
-
if (
|
|
311
|
+
if (k(
|
|
307
312
|
d.polygon(e),
|
|
308
313
|
d.polygon(a)
|
|
309
314
|
)) {
|
|
@@ -516,5 +521,5 @@ class R {
|
|
|
516
521
|
}
|
|
517
522
|
}
|
|
518
523
|
export {
|
|
519
|
-
|
|
524
|
+
B as default
|
|
520
525
|
};
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gis-viewer{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}}
|
|
1
|
+
.gis-viewer{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}}
|
|
@@ -30,7 +30,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
30
30
|
openDriveRenderer: OpenDriveRenderer;
|
|
31
31
|
signalControlAreaController: SignalControlAreaController;
|
|
32
32
|
showLogDiv: import("vue").Ref<boolean>;
|
|
33
|
-
showGroupSelect: import("vue").Ref<boolean>;
|
|
34
33
|
mapViewer: import("vue").ComputedRef<MapView | SceneView>;
|
|
35
34
|
startSaveTrackLog: () => void;
|
|
36
35
|
downloadTrackLog: () => void;
|
|
@@ -89,22 +88,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
89
88
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
90
89
|
props: any;
|
|
91
90
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
92
|
-
sketchTool: import("vue").DefineComponent<{
|
|
93
|
-
view: {
|
|
94
|
-
type: null;
|
|
95
|
-
required: true;
|
|
96
|
-
};
|
|
97
|
-
}, {
|
|
98
|
-
props: any;
|
|
99
|
-
sketchVM: __esri.SketchViewModel;
|
|
100
|
-
resetButtonHandler: () => void;
|
|
101
|
-
geometrySelectionHandler: (event: any) => void;
|
|
102
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
103
|
-
view: {
|
|
104
|
-
type: null;
|
|
105
|
-
required: true;
|
|
106
|
-
};
|
|
107
|
-
}>>, {}, {}>;
|
|
108
91
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
109
92
|
config: {
|
|
110
93
|
type: StringConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),y=require("./stores/index.js");require("./style/index.css");const Se=require("./utils/holo-flow/index.js"),Ce=require("./utils/map-initializer.js"),C=require("./utils/open-drive-renderer/index.js"),Oe=require("./utils/overlay.js"),ke=require("./utils/queue-length.js"),O=require("./utils/road-config-tool/index.js"),Te=require("./utils/signal-control-area-controller/index.js"),Ae=require("./utils/traffic-flow.js"),De={class:"gis-viewer"},Le={style:{position:"absolute",bottom:"10px",left:"10px"}},Ie=o.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:A}){const d=o.ref(null);let i,l,c,n,a,r,g,t,s;const p=o.ref(!1);o.onMounted(async()=>{if(y.registerStore(),!d.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(p.value=!p.value)});const e=o.getCurrentInstance(),{$gisviewerAssetsRoot:u}=e.appContext.config.globalProperties,S=await(await fetch(h.config)).json();S.assetsRoot=h.assetsRoot||u;const ye=y.default.useAppDataStore;ye.mapConfig=S,l=new Ce.default,i=await l.initialize({container:d.value,markerClickCallback:(m,w,v,he)=>{f("markerClick",m,w,v,he)},mapClickCallback:(m,w,v)=>{f("mapClick",m,w,v)}}),a=new Se.default(i),await a.init(),f("mapLoaded")}),o.onUnmounted(()=>{s==null||s.clearSignalControlArea(),t==null||t.clearOpenDrive(),a==null||a.clearHoloTrace(),a==null||a.clearHoloSignal(),n==null||n.disconnectTrafficFlow()});const D=o.computed(()=>i),L=()=>{const e=y.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{a.downloadTrackLog()},b=async e=>await l.setMapCenter(e),q=async e=>await l.setMapCamera(e),_=async e=>await l.lookAt(e),x=e=>l.setLayerVisibility(e),H=(e,u)=>l.requestCoordinateTransform(e,u),V=e=>{l.cancelCoordinateTransform(e)},M=e=>{l.setMapZoomRange(e)},N=e=>(c||(c=new O.default(i)),c.showLaneNumber(e)),B=()=>{c==null||c.clearLaneNumber()},E=async e=>(c||(c=new O.default(i)),await c.initializeSearch(e)),j=async()=>c==null?void 0:c.calCrossIndicatorArea(),z=async()=>{},P=async(e,u)=>{n||(n=new Ae.default(i)),n.connectTrafficFlow(e,u)},Q=()=>{n==null||n.disconnectTrafficFlow()},F=e=>{a.handleVehicleTraceData(e)},Z=()=>{a.clearHoloTrace()},K=e=>{a.setInterpolate(e)},U=async e=>{await a.handleSignalData(e)},G=()=>{a.clearHoloSignal()},J=e=>{n==null||n.toggleTrafficInfo(e),a.toggleTrafficInfo(e)},R=e=>{a.togglePause(e)},W=e=>{n==null||n.toggleTrafficObject(e),a.toggleTrafficObject(e)},X=e=>{a.updatePanelContent(e)},Y=async e=>(r||(r=new Oe.default(i)),r.addOverlays(e)),$=e=>r==null?void 0:r.removeOverlaysByType(e),ee=e=>r==null?void 0:r.removeOverlaysById(e),te=()=>r==null?void 0:r.removeAllOverlays(),ae=()=>{r==null||r.showAllOverlays()},ne=e=>{g||(g=new ke.default(i)),g.updateQueueLength(e)},re=()=>{g==null||g.removeQueueLength()},se=async(e,u)=>(t||(t=new C.default(i)),await t.showOpenDriveFromServer(e,u)),oe=async e=>(t||(t=new C.default(i)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),ce=async()=>await(t==null?void 0:t.clearOpenDrive()),ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},le=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ue=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ge=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},me=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},de=e=>(s||(s=new Te.default(i)),s.showSignalControlArea(e)),pe=()=>{s==null||s.clearSignalControlArea()},fe=async e=>s?await s.locateSignalControlArea(e):{status:-1,message:"未加载信号控制区"},we=async e=>s?await s.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},ve=()=>s?s.resetHighlight():{status:-1,message:"未加载信号控制区"},h=k,f=A;return T({mapViewer:D,setLayerVisibility:x,setMapCenter:b,lookAt:_,setMapCamera:q,setMapZoomRange:M,requestCoordinateTransform:H,cancelCoordinateTransform:V,addOverlays:Y,showAllOverlays:ae,removeOverlaysByType:$,removeOverlaysById:ee,removeAllOverlays:te,showLaneNumber:N,clearLaneNumber:B,initializeAreaTool:E,calCrossIndicatorArea:j,calRoadIndicatorArea:z,connectCarFlow:P,disconnectCarFlow:Q,handleHoloVehicleTraceData:F,clearHoloTrace:Z,handleHoloSignalData:U,clearHoloSignal:G,setInterpolate:K,toggleTrafficInfo:J,toggleTrafficObject:W,toggleVehicleInfo:X,togglePause:R,updateQueueLength:ne,removeQueueLength:re,showOpenDriveFromServer:se,showOpenDriveFromFile:oe,clearOpenDrive:ce,findSumoInOpenDrive:ie,selectSumoInOpenDrive:le,unselectSumoInOpenDrive:ue,getSumoInfo:ge,splitOpenDriveLane:me,showSignalControlArea:de,clearSignalControlArea:pe,locateSignalControlArea:fe,highlightSignalControlArea:we,resetHighlightSignalControlArea:ve}),(e,u)=>(o.openBlock(),o.createElementBlock("div",De,[o.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},[o.withDirectives(o.createElementVNode("div",Le,[o.createElementVNode("button",{style:{"margin-right":"10px"},onClick:L}," 开始记录 "),o.createElementVNode("button",{onClick:I},"下载日志")],512),[[o.vShow,p.value]])],512)]))}});exports.default=Ie;
|
|
@@ -19,7 +19,6 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
19
19
|
openDriveRenderer: import("./utils/open-drive-renderer").default;
|
|
20
20
|
signalControlAreaController: import("./utils/signal-control-area-controller").default;
|
|
21
21
|
showLogDiv: import("vue").Ref<boolean>;
|
|
22
|
-
showGroupSelect: import("vue").Ref<boolean>;
|
|
23
22
|
mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
|
|
24
23
|
startSaveTrackLog: () => void;
|
|
25
24
|
downloadTrackLog: () => void;
|
|
@@ -78,22 +77,6 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
78
77
|
resetHighlightSignalControlArea: () => import("../types").IResult;
|
|
79
78
|
props: any;
|
|
80
79
|
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
81
|
-
sketchTool: import("vue").DefineComponent<{
|
|
82
|
-
view: {
|
|
83
|
-
type: null;
|
|
84
|
-
required: true;
|
|
85
|
-
};
|
|
86
|
-
}, {
|
|
87
|
-
props: any;
|
|
88
|
-
sketchVM: __esri.SketchViewModel;
|
|
89
|
-
resetButtonHandler: () => void;
|
|
90
|
-
geometrySelectionHandler: (event: any) => void;
|
|
91
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
92
|
-
view: {
|
|
93
|
-
type: null;
|
|
94
|
-
required: true;
|
|
95
|
-
};
|
|
96
|
-
}>>, {}, {}>;
|
|
97
80
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
98
81
|
config: {
|
|
99
82
|
type: StringConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("pinia"),t=e.defineStore("appData",{state:()=>({mapConfig:{},saveTrackLog:!1})});exports.useAppDataStore=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("pinia"),t=e.defineStore("appData",{state:()=>({mapConfig:{},saveTrackLog:!1,isSketching:!1})});exports.useAppDataStore=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),M=require("@arcgis/core/core/promiseUtils"),$=require("@arcgis/core/geometry"),P=require("@arcgis/core/geometry/geometryEngine"),S=require("@arcgis/core/layers/FeatureLayer"),v=require("@arcgis/core/layers/GraphicsLayer"),g=require("axios"),J=require("md5"),G=require("pako"),A=require("../common-utils.js");function O(b){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const t in b)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(b,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>b[t]})}}return e.default=b,Object.freeze(e)}const C=O(M),N=O(P);class D{constructor(e){this.junctionNames=new Map,this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={collapseButton:!1,actionBar:!1},this.laneLayer=new S({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new S({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new v({id:"OpenDriveJunction"}),this.sectionLayer=new v({id:"OpenDriveSection"}),this.highlightLayer=new v({id:"OpenDriveHighlight"}),this.flashLayer=new v({id:"OpenDriveFlash"}),this.drawLayer=new v({id:"Draw"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer,this.drawLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const i=await(await fetch(e)).text();return{status:0,message:"ok",result:J(i)}}catch(t){return{status:-1,message:t.message}}}async showOpenDriveFromFile(e){var h,y;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const t=await this.makeMd5FromFile(e.file);if(t.status!==0)return t;this.projectName=t.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const i=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await g.post(i,{},{params:{url:e.file,projectName:this.projectName}})}catch(d){return{status:-1,message:d.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;A.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e.server}${l}`);const a=await(await fetch(l)).arrayBuffer(),r=G.inflate(a,{to:"string"}),c=JSON.parse(r);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((y=e.options)==null?void 0:y.showRoadName)||!0);const m=o.data.result.junctions;if(this.showJunction(m),e.options&&e.options.centerMap!==!1){const d=A.default.transformPointProjection([0,0]);await this.view.goTo(d)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,t){const i=`http://${e}/api/openDrive/analyzeXodr`,o=await g.get(i,{headers:{projectName:t},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const n=await(await fetch(s)).arrayBuffer(),a=G.inflate(n,{to:"string"}),r=JSON.parse(a);return await this.showAllLanes(r,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,t,i){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=i,new Promise(s=>{let l=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const n=[];for(const r of e){if(!t&&r.junction!=="-1")continue;const{id:c,refLine:m}=r;let h=r.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const y=new p({geometry:{type:"polyline",paths:[m]},attributes:{ObjectID:l++,roadId:c,roadName:h}});this.allRefLineGraphics.push(y),r.laneSections.sort((d,f)=>Number(d.id)-Number(f.id));for(let d=0;d<r.laneSections.length;d++){const f=r.laneSections[d],u=Number(f.id);for(const w of f.lanePaths){const I=Number(w.id);if(I===0)continue;const F=w.type,L=w.innerPath.concat(w.outerPath.reverse());if(L.length<=3){console.warn(`lane ${I} has less than 3 points`);continue}L.push(w.innerPath[0]);const j=new $.Polygon({rings:[L]});if(j){const k=new p({geometry:j,attributes:{ObjectID:l++,id:`${c}+${u}+${I}`,fromNode:r.fromNode,toNode:r.toNode,roadId:c,roadName:r.name,sectionId:u,sectionIndex:d,laneId:I,type:F,sumoId:""}});this.allLaneGraphics.push(k),n.push(k)}}}}const a=setInterval(()=>{if(n.length>0||this.allRefLineGraphics.length>0){if(n.length>0){const r=n.splice(0,100);this.laneLayer.applyEdits({addFeatures:r})}if(this.allRefLineGraphics.length>0){const r=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:r})}}else clearInterval(a),s()},10)})}showJunction(e){const t=[];for(const i of e){if(!i)continue;this.junctionNames.set(i.id,i.name),i.nodeType=i.type;const o=new p({geometry:{type:"point",x:i.coordinates[0],y:i.coordinates[1]},attributes:{...i,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:i.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30},popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"路口编号"},{fieldName:"crossId",label:"信号机编号"}]}]}});t.push(o)}this.junctionLayer.addMany(t)}monitorMouseMove(){const e=C.debounce(async t=>{var l;const o=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(n=>n.type==="graphic");if(o.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const s=o[0];if(this.hitGraphic=s.graphic,s.layer.id==="OpenDriveLane"){const n=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(n===this.currentSectionCode||this.sectionLayer.graphics.findIndex(u=>u.getAttribute("id")===n)>=0)return;this.currentSectionCode=n;const r=this.allLaneGraphics.filter(u=>`${u.attributes.roadId}+${u.attributes.sectionId}`===n),c=N.union(r.map(u=>u.geometry)),m=this.hitGraphic.getAttribute("fromNode"),h=this.hitGraphic.getAttribute("toNode"),y=this.junctionNames.get(m)||m,d=this.junctionNames.get(h)||h;this.highlightGraphic=new p({geometry:c,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:n,selected:!1,fromNodeName:y,toNodeName:d,laneCount:r.length},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic);const f=this.view.toMap(t);this.view.openPopup({features:[this.highlightGraphic],location:f})}else if(s.layer.id==="OpenDriveJunction"){const n=this.hitGraphic.getAttribute("id");if(n===this.currentJunctionId)return;this.currentJunctionId=n,this.view.openPopup({features:[this.hitGraphic],location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})})}monitorMouseClick(){const e=C.debounce(async t=>{var a;const o=(a=(await this.view.hitTest(t,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:a.filter(r=>r.type==="graphic");if(o.length===0)return;const s=o[0].graphic,l=s.getAttribute("type"),n=s.getAttribute("id");if(l==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const r=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await g.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:n,details:void 0}),s.setAttribute("selected",!1);const r=s.getAttribute("crossId");s.symbol.url=r?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(l==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const r=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await g.get(r,{params:{id:n,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:n,details:c.data.result}))}});this.mouseClickHandler=this.view.on("immediate-click",async t=>{e(t).catch(()=>{})})}increasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s<t?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(i)},20)}decreasePictureMarkerSize(e,t){const i=setInterval(()=>{const o=e.symbol,s=o.width;s>t?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(i)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const t=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,i=await g.get(t,{params:{id:e.id,projectName:this.projectName}});return i.status===200?i.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.find(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s){const l=`${i}+${s.getAttribute("sectionId")}`,n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,a=await g.get(n,{params:{id:l,projectName:this.projectName}});return a.status===200?a.data:{status:-1,message:`路段信息查询失败: ${l}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var t,i;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(t=this.mouseMoveHandler)==null||t.remove(),this.mouseMoveHandler=void 0,(i=this.mouseClickHandler)==null||i.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:t,id:i}=e,o=e.flash===void 0?!0:e.flash;if(t==="junction")return await this.findJunction(i,o);if(t==="edge"){const s=i.split("+");if(s.length>2)return{status:-1,message:"id格式错误"};const l=s.length===2?Number(s[1]):void 0,n=s[0].split("#");if(n.length>2)return{status:-1,message:"id格式错误"};const a=n[0],r=n.length===2?Number(n[1]):void 0;return await this.findLane({roadsectId:a,segmentId:r,laneId:l,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,t){const i=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!i)return{status:-1,message:"未找到。请检查路口编号"};if(t){const o=new p({geometry:i.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(o)}return await this.view.goTo(i.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:t,segmentId:i,laneId:o}=e;t.startsWith("-")&&(t=t.slice(1));let s=this.allLaneGraphics.filter(a=>a.attributes.roadId===t);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(i!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.sectionId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),i>a.length-1)return{status:-1,message:"未找到。请检查基本段编号"};i=a[i],s=s.filter(r=>Number(r.attributes.sectionId)===i)}if(o!==void 0){const a=[];if(s.forEach(r=>{const c=Number(r.attributes.laneId);a.indexOf(c)===-1&&a.push(c)}),a.sort((r,c)=>r-c),o>a.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=a[o],s=s.filter(r=>Number(r.attributes.laneId)===o)}const l=s.map(a=>a.geometry),n=N.union(l);if(e.flash){const a=new p({geometry:n,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(a)}return await this.view.goTo(n,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let t=0,i=!0;const o=setInterval(()=>{i?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(i=!1,t++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(i=!0)),t>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(t=>{if((!e||!e.id||e.id===""||e.id===t.getAttribute("id"))&&t.getAttribute("selected")){t.setAttribute("selected",!1);const i=t.getAttribute("crossId");t.symbol.url=i?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(t,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.removeAll();else{const t=this.sectionLayer.graphics.find(i=>i.getAttribute("edgeId")===e.id);t&&this.sectionLayer.remove(t)}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(t=>{if(e.id===t.getAttribute("id"))return t.setAttribute("selected",!0),t.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(t,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const t=e.id.split("#");let i=t[0];i.startsWith("-")&&(i=i.slice(1));let o=0;t.length===2&&(o=Number(t[1]));const s=this.allLaneGraphics.filter(l=>l.getAttribute("roadId")===i&&l.getAttribute("sectionIndex")===o);if(s.length>0){const l=N.union(s.map(a=>a.geometry)),n=new p({geometry:l,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(n),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),M=require("@arcgis/core/core/promiseUtils"),$=require("@arcgis/core/geometry"),P=require("@arcgis/core/geometry/geometryEngine"),S=require("@arcgis/core/layers/FeatureLayer"),w=require("@arcgis/core/layers/GraphicsLayer"),f=require("axios"),J=require("md5"),G=require("pako"),x=require("vue"),T=require("../../stores/index.js"),A=require("../common-utils.js");function O(g){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const i in g)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(g,i);Object.defineProperty(e,i,t.get?t:{enumerable:!0,get:()=>g[i]})}}return e.default=g,Object.freeze(e)}const C=O(M),N=O(P);class D{constructor(e){this.junctionNames=new Map,this.projectName="",this.openDriveServer="",this.currentSectionCode="",this.currentJunctionId="",this.view=e,this.view.popup.visibleElements={collapseButton:!1,actionBar:!1},this.laneLayer=new S({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"},{name:"sumoId",alias:"sumo编号",type:"string"},{name:"fromNode",alias:"起点路口",type:"string"},{name:"toNode",alias:"终点路口",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.8],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.roadNameLayer=new S({id:"OpenDriveRoadName",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"}],objectIdField:"ObjectID",geometryType:"polyline",spatialReference:{wkid:4326},source:[],renderer:{type:"simple",symbol:{type:"simple-line",style:"solid",color:[0,0,0,0],width:1}},labelingInfo:[{symbol:{type:"text",color:"black",haloColor:"white",haloSize:1,font:{size:12,family:"sans-serif"}},labelPlacement:this.view.type==="2d"?"center-along":void 0,labelExpressionInfo:{expression:"$feature.roadName"}}]}),this.junctionLayer=new w({id:"OpenDriveJunction"}),this.sectionLayer=new w({id:"OpenDriveSection"}),this.highlightLayer=new w({id:"OpenDriveHighlight"}),this.flashLayer=new w({id:"OpenDriveFlash"}),this.drawLayer=new w({id:"Draw"}),this.view.map.addMany([this.laneLayer,this.junctionLayer,this.sectionLayer,this.roadNameLayer,this.highlightLayer,this.flashLayer,this.drawLayer])}static getInstance(e){return this.instance||(this.instance=new D(e)),this.instance}async makeMd5FromFile(e){try{const t=await(await fetch(e)).text();return{status:0,message:"ok",result:J(t)}}catch(i){return{status:-1,message:i.message}}}async showOpenDriveFromFile(e){var h,p;this.openDriveClickCallback=e.selectedCallback,console.time("md5用时");const i=await this.makeMd5FromFile(e.file);if(i.status!==0)return i;this.projectName=i.result,console.timeEnd("md5用时"),this.openDriveServer=e.server,await this.makeMd5FromFile(e.file);const t=`http://${this.openDriveServer}/api/openDrive/uploadXodr`;let o;try{o=await f.post(t,{},{params:{url:e.file,projectName:this.projectName}})}catch(u){return{status:-1,message:u.message}}if(o.status!==200)return{status:-1,message:o.statusText};console.time("渲染用时");const s=o.data.result.geoSetting;A.default.setGeoData(s.geoReference,s.offsetX,s.offsetY);let a=o.data.result.json;a.startsWith(window.location.protocol)||(a=`${window.location.protocol}//${e.server}${a}`);const r=await(await fetch(a)).arrayBuffer(),n=G.inflate(r,{to:"string"}),c=JSON.parse(n);await this.showAllLanes(c,((h=e.options)==null?void 0:h.showJunctionLane)||!1,((p=e.options)==null?void 0:p.showRoadName)||!0);const b=o.data.result.junctions;if(this.showJunction(b),e.options&&e.options.centerMap!==!1){const u=A.default.transformPointProjection([0,0]);await this.view.goTo(u)}return this.mouseMoveHandler||this.monitorMouseMove(),this.mouseClickHandler||this.monitorMouseClick(),console.timeEnd("渲染用时"),{status:0,message:"ok"}}async showOpenDriveFromServer(e,i){const t=`http://${e}/api/openDrive/analyzeXodr`,o=await f.get(t,{headers:{projectName:i},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let s=o.data.result.json;s.startsWith(window.location.protocol)||(s=`${window.location.protocol}//${e}${s}`);const l=await(await fetch(s)).arrayBuffer(),r=G.inflate(l,{to:"string"}),n=JSON.parse(r);return await this.showAllLanes(n,!1,!1),{status:0,message:"ok"}}async showAllLanes(e,i,t){const o=await this.laneLayer.queryFeatures();return o.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:o.features}),this.roadNameLayer.visible=t,new Promise(s=>{let a=0;this.allLaneGraphics=[],this.allRefLineGraphics=[];const l=[];for(const n of e){if(!i&&n.junction!=="-1")continue;const{id:c,refLine:b}=n;let h=n.name;h.includes("(")&&(h=h.slice(0,h.indexOf("("))),h=h.replace(/(.)/g,"$1 ");const p=new m({geometry:{type:"polyline",paths:[b]},attributes:{ObjectID:a++,roadId:c,roadName:h}});this.allRefLineGraphics.push(p),n.laneSections.sort((u,y)=>Number(u.id)-Number(y.id));for(let u=0;u<n.laneSections.length;u++){const y=n.laneSections[u],v=Number(y.id);for(const d of y.lanePaths){const I=Number(d.id);if(I===0)continue;const F=d.type,L=d.innerPath.concat(d.outerPath.reverse());if(L.length<=3){console.warn(`lane ${I} has less than 3 points`);continue}L.push(d.innerPath[0]);const k=new $.Polygon({rings:[L]});if(k){const j=new m({geometry:k,attributes:{ObjectID:a++,id:`${c}+${v}+${I}`,fromNode:n.fromNode,toNode:n.toNode,roadId:c,roadName:n.name,sectionId:v,sectionIndex:u,laneId:I,type:F,sumoId:""}});this.allLaneGraphics.push(j),l.push(j)}}}}const r=setInterval(()=>{if(l.length>0||this.allRefLineGraphics.length>0){if(l.length>0){const n=l.splice(0,100);this.laneLayer.applyEdits({addFeatures:n})}if(this.allRefLineGraphics.length>0){const n=this.allRefLineGraphics.splice(0,10);this.roadNameLayer.applyEdits({addFeatures:n})}}else clearInterval(r),s()},10)})}showJunction(e){const i=[];for(const t of e){if(!t)continue;this.junctionNames.set(t.id,t.name),t.nodeType=t.type;const o=new m({geometry:{type:"point",x:t.coordinates[0],y:t.coordinates[1]},attributes:{...t,selected:!1,type:"OpenDriveJunction"},symbol:{type:"picture-marker",url:t.crossId?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",width:30,height:30},popupTemplate:{title:t.name,content:[{type:"fields",fieldInfos:[{fieldName:"id",label:"路口编号"},{fieldName:"crossId",label:"信号机编号"}]}]}});i.push(o)}this.junctionLayer.addMany(i)}monitorMouseMove(){const e=C.debounce(async t=>{var l;const s=(l=(await this.view.hitTest(t,{include:[this.laneLayer,this.junctionLayer]})).results)==null?void 0:l.filter(r=>r.type==="graphic");if(s.length===0){this.currentSectionCode!==""&&(this.currentSectionCode="",this.highlightGraphic=void 0,this.highlightLayer.removeAll()),this.currentJunctionId!==""&&(this.currentJunctionId="",this.view.closePopup());return}const a=s[0];if(this.hitGraphic=a.graphic,a.layer.id==="OpenDriveLane"){const r=`${this.hitGraphic.getAttribute("roadId")}+${this.hitGraphic.getAttribute("sectionId")}`;if(r===this.currentSectionCode||this.sectionLayer.graphics.findIndex(d=>d.getAttribute("id")===r)>=0)return;this.currentSectionCode=r;const c=this.allLaneGraphics.filter(d=>`${d.attributes.roadId}+${d.attributes.sectionId}`===r),b=N.union(c.map(d=>d.geometry)),h=this.hitGraphic.getAttribute("fromNode"),p=this.hitGraphic.getAttribute("toNode"),u=this.junctionNames.get(h)||h,y=this.junctionNames.get(p)||p;this.highlightGraphic=new m({geometry:b,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",id:r,selected:!1,fromNodeName:u,toNodeName:y,laneCount:c.length},popupTemplate:{title:this.hitGraphic.getAttribute("roadName"),content:[{type:"fields",fieldInfos:[{fieldName:"fromNodeName",label:"起点路口"},{fieldName:"toNodeName",label:"终点路口"},{fieldName:"laneCount",label:"车道数量"}]}]}}),this.highlightLayer.removeAll(),this.highlightLayer.add(this.highlightGraphic);const v=this.view.toMap(t);this.view.openPopup({features:[this.highlightGraphic],location:v})}else if(a.layer.id==="OpenDriveJunction"){const r=this.hitGraphic.getAttribute("id");if(r===this.currentJunctionId)return;this.currentJunctionId=r,this.view.openPopup({features:[this.hitGraphic],location:this.hitGraphic.geometry})}});this.mouseMoveHandler=this.view.on("pointer-move",async t=>{e(t).catch(()=>{})});const i=T.default.useAppDataStore;x.watch(()=>i.isSketching,()=>{var t;i.isSketching?(t=this.mouseMoveHandler)==null||t.remove():this.mouseMoveHandler=this.view.on("pointer-move",async o=>{e(o).catch(()=>{})})})}monitorMouseClick(){const e=C.debounce(async i=>{var r;const o=(r=(await this.view.hitTest(i,{include:[this.highlightLayer,this.junctionLayer,this.sectionLayer]})).results)==null?void 0:r.filter(n=>n.type==="graphic");if(o.length===0)return;const s=o[0].graphic,a=s.getAttribute("type"),l=s.getAttribute("id");if(a==="OpenDriveJunction")if(s.getAttribute("selected")===!1){const n=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,c=await f.get(n,{params:{id:l,projectName:this.projectName}});c.status===200&&c.data.status===0&&(this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:l,details:c.data.result}),s.setAttribute("selected",!0),s.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(s,50))}else{this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveJunction",id:l,details:void 0}),s.setAttribute("selected",!1);const n=s.getAttribute("crossId");s.symbol.url=n?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(s,30)}else if(a==="OpenDriveSection")if(s.getAttribute("selected"))this.sectionLayer.remove(s),this.openDriveClickCallback&&this.openDriveClickCallback({type:"OpenDriveSection",id:l,details:void 0});else{this.highlightLayer.remove(s),this.sectionLayer.add(s),s.setAttribute("selected",!0);const n=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,c=await f.get(n,{params:{id:l,projectName:this.projectName}});c.status===200&&c.data.status===0&&this.openDriveClickCallback&&(s.setAttribute("edgeId",c.data.result.obj_id),this.openDriveClickCallback({type:"OpenDriveSection",id:l,details:c.data.result}))}});this.mouseClickHandler=this.view.on("immediate-click",async i=>{e(i).catch(()=>{})})}increasePictureMarkerSize(e,i){const t=setInterval(()=>{const o=e.symbol,s=o.width;s<i?e.symbol={type:"picture-marker",url:o.url,width:s+1,height:s+1}:clearInterval(t)},20)}decreasePictureMarkerSize(e,i){const t=setInterval(()=>{const o=e.symbol,s=o.width;s>i?e.symbol={type:"picture-marker",url:o.url,width:s-1,height:s-1}:clearInterval(t)},20)}async getSumoInfo(e){switch(e.type){case"junction":{const i=`http://${this.openDriveServer}/api/sumo/getSumoJunction`,t=await f.get(i,{params:{id:e.id,projectName:this.projectName}});return t.status===200?t.data:{status:-1,message:`路口信息查询失败: ${e.id}`}}case"edge":{const i=e.id.split("#");let t=i[0];t.startsWith("-")&&(t=t.slice(1));let o=0;i.length===2&&(o=Number(i[1]));const s=this.allLaneGraphics.find(a=>a.getAttribute("roadId")===t&&a.getAttribute("sectionIndex")===o);if(s){const a=`${t}+${s.getAttribute("sectionId")}`,l=`http://${this.openDriveServer}/api/sumo/getSumoEdge`,r=await f.get(l,{params:{id:a,projectName:this.projectName}});return r.status===200?r.data:{status:-1,message:`路段信息查询失败: ${a}`}}else return{status:-1,message:"未知类型"}}default:return{status:-1,message:"未知类型"}}}async clearOpenDrive(){var i,t;let e=await this.laneLayer.queryFeatures();e.features.length>0&&await this.laneLayer.applyEdits({deleteFeatures:e.features}),e=await this.roadNameLayer.queryFeatures(),e.features.length>0&&await this.roadNameLayer.applyEdits({deleteFeatures:e.features}),this.highlightLayer.removeAll(),this.junctionLayer.removeAll(),this.sectionLayer.removeAll(),this.flashLayer.removeAll(),(i=this.mouseMoveHandler)==null||i.remove(),this.mouseMoveHandler=void 0,(t=this.mouseClickHandler)==null||t.remove(),this.mouseClickHandler=void 0}async findSumo(e){const{type:i,id:t}=e,o=e.flash===void 0?!0:e.flash;if(i==="junction")return await this.findJunction(t,o);if(i==="edge"){const s=t.split("+");if(s.length>2)return{status:-1,message:"id格式错误"};const a=s.length===2?Number(s[1]):void 0,l=s[0].split("#");if(l.length>2)return{status:-1,message:"id格式错误"};const r=l[0],n=l.length===2?Number(l[1]):void 0;return await this.findLane({roadsectId:r,segmentId:n,laneId:a,flash:o})}else return{status:-1,message:"未知类型"}}async findJunction(e,i){const t=this.junctionLayer.graphics.find(o=>o.attributes.id===e);if(!t)return{status:-1,message:"未找到。请检查路口编号"};if(i){const o=new m({geometry:t.geometry,symbol:{type:"simple-marker",style:"circle",size:30,color:[255,0,0,.6],outline:{color:"red",width:1}}});this.flashGraphic(o)}return await this.view.goTo(t.geometry,{duration:1e3}),{status:0,message:"ok"}}async findLane(e){let{roadsectId:i,segmentId:t,laneId:o}=e;i.startsWith("-")&&(i=i.slice(1));let s=this.allLaneGraphics.filter(r=>r.attributes.roadId===i);if(s.length===0)return{status:-1,message:"未找到。请检查路段编号"};if(t!==void 0){const r=[];if(s.forEach(n=>{const c=Number(n.attributes.sectionId);r.indexOf(c)===-1&&r.push(c)}),r.sort((n,c)=>n-c),t>r.length-1)return{status:-1,message:"未找到。请检查基本段编号"};t=r[t],s=s.filter(n=>Number(n.attributes.sectionId)===t)}if(o!==void 0){const r=[];if(s.forEach(n=>{const c=Number(n.attributes.laneId);r.indexOf(c)===-1&&r.push(c)}),r.sort((n,c)=>n-c),o>r.length-1)return{status:-1,message:"未找到。请检查车道编号"};o=r[o],s=s.filter(n=>Number(n.attributes.laneId)===o)}const a=s.map(r=>r.geometry),l=N.union(a);if(e.flash){const r=new m({geometry:l,symbol:{type:"simple-fill",color:[255,0,0,.5],style:"solid",outline:{color:"red",width:0}}});this.flashGraphic(r)}return await this.view.goTo(l,{duration:1e3}),{status:0,message:"ok"}}flashGraphic(e){this.flashLayer.removeAll(),this.flashLayer.add(e);let i=0,t=!0;const o=setInterval(()=>{t?(this.flashLayer.opacity-=.02,this.flashLayer.opacity<=.1&&(t=!1,i++)):(this.flashLayer.opacity+=.02,this.flashLayer.opacity>=1&&(t=!0)),i>=5&&(this.flashLayer.removeAll(),this.flashLayer.opacity=1,clearInterval(o))},10)}unselectSumo(e){if((!e||e.type==="junction")&&this.junctionLayer.graphics.forEach(i=>{if((!e||!e.id||e.id===""||e.id===i.getAttribute("id"))&&i.getAttribute("selected")){i.setAttribute("selected",!1);const t=i.getAttribute("crossId");i.symbol.url=t?"/GisViewerAssets/Images/point_green.png":"/GisViewerAssets/Images/point_yellow.png",this.decreasePictureMarkerSize(i,30)}}),!e||e.type==="edge")if(!e||!e.id||e.id==="")this.sectionLayer.removeAll();else{const i=this.sectionLayer.graphics.find(t=>t.getAttribute("edgeId")===e.id);i&&this.sectionLayer.remove(i)}return{status:0,message:"ok"}}selectSumo(e){switch(e.type){case"junction":return this.junctionLayer.graphics.forEach(i=>{if(e.id===i.getAttribute("id"))return i.setAttribute("selected",!0),i.symbol.url="/GisViewerAssets/Images/point_red.png",this.increasePictureMarkerSize(i,50),{status:0,message:"ok"}}),{status:-1,message:"未找到路口"};case"edge":{const i=e.id.split("#");let t=i[0];t.startsWith("-")&&(t=t.slice(1));let o=0;i.length===2&&(o=Number(i[1]));const s=this.allLaneGraphics.filter(a=>a.getAttribute("roadId")===t&&a.getAttribute("sectionIndex")===o);if(s.length>0){const a=N.union(s.map(r=>r.geometry)),l=new m({geometry:a,symbol:{type:"simple-fill",color:[0,255,255,.5],style:"solid",outline:{color:[0,255,255],width:1}},attributes:{type:"OpenDriveSection",edgeId:e.id,selected:!0}});return this.sectionLayer.add(l),{status:0,message:"ok"}}else return{status:-1,message:"未找到路段"}}default:return{status:-1,message:"未知类型"}}}async splitLane(e){return{status:0,message:"ok",result:e}}}exports.default=D;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/geometry/geometryEngine.js"),P=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/geometry/geometryEngine.js"),P=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/GraphicsLayer"),G=require("@arcgis/core/widgets/Sketch"),S=require("@arcgis/core/widgets/Sketch/SketchViewModel"),k=require("@arcgis/core/geometry/Polygon.js"),M=require("@arcgis/core/geometry/Polyline.js"),A=require("@turf/helpers"),x=require("@turf/intersect"),v=require("uuid"),E=require("../stores/index.js");function f(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const V=f(b),g=f(P),d=f(A);function w(a,e=[]){if(a===null||typeof a!="object")return a;if(Object.prototype.toString.call(a)==="[object Date]")return new Date(a);if(Object.prototype.toString.call(a)==="[object RegExp]")return new RegExp(a);if(Object.prototype.toString.call(a)==="[object Error]")return new Error(a);const t=e.filter(s=>s.original===a)[0];if(t)return t.copy;const i=Array.isArray(a)?[]:{};return e.push({original:a,copy:i}),Object.keys(a).forEach(s=>{i[s]=w(a[s],e)}),i}const O={maxAllowedGraphics:0,GraphicsLayer:{},sketchVisibleElements:{},sketchPosition:"top-right",defaultSketchVisible:!0,sketchViewModelItemSymbol:{}},m={type:"simple-line",color:"#556DEA",width:2},y={type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}};class D{constructor(e,t){this.viewer=e,this.options={...O,...t},this.graphicsLayer=new u({...this.options.GraphicsLayer}),this.TextGraphicsLayer=new u,this.viewer.map.layers.add(this.graphicsLayer),this.viewer.map.layers.add(this.TextGraphicsLayer),this.init()}init(){this.sketchViewModel=new S({layer:this.graphicsLayer,view:this.viewer,updateOnGraphicClick:!0,polylineSymbol:m,polygonSymbol:y,...this.options.sketchViewModelItemSymbol});const e=this.findLayerById("TrafficMarkings"),t=[];e&&t.push({layer:e,enabled:!0}),this.sketch=new G({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,snappingOptions:{enabled:!0,featureSources:t}}),this.sketch.visibleElements={...this.options.sketchVisibleElements},this.viewer.ui.add(this.sketch,this.options.sketchPosition);const i=E.default.useAppDataStore;this.sketch.on("create",s=>{s.state==="complete"?i.isSketching=!1:s.state==="start"&&(i.isSketching=!0)})}initPoint(e,t="all",i=!1){if(!e)return;const{crossArea:s,sectionArea:r}=e;if(s&&(t=="crossArea"||t=="all")){const o=this.initCrossArea(s);this.graphicsLayer.add(o)}if(r&&(t=="sectionArea"||t=="all")){const o=this.initSectionArea(r,i);this.graphicsLayer.addMany(o)}}initEntranceFusionZone(e){const t=[];e.map(i=>{t.push(this.createPolygonGraphic(i,y,{}))}),this.graphicsLayer.addMany(t)}initCrossArea(e){return this.createPolygonGraphic(e,y,{})}initSectionArea(e,t=!1){const i=[],s={type:"simple-line",color:[0,0,255],width:2};return Object.keys(e).map(r=>{const o=e[r][0],c=e[r][1];t&&(o.reverse(),c.reverse());const n=v.v4(),h=this.createPolylineGraphic(o,m,{type:"draw",id:n}),p=this.createPolylineGraphic(c,s,{type:"shiftLine",id:n});i.push(h,p)}),i}createPolylineGraphic(e,t,i){const s=new M({paths:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}createPolygonGraphic(e,t,i){const s=new k({rings:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}on(e){const t=this;this.sketchViewModel.on("create",function(i){var r,o,c;const s=t.graphicsLayer.graphics;if((r=t.options)!=null&&r.maxAllowedGraphics&&s.length>((o=t.options)==null?void 0:o.maxAllowedGraphics)){t.graphicsLayer.remove(i.graphic),console.log("已达到最大图形数量,无法继续绘制!");return}if(i.state==="complete"&&((c=i.graphic)!=null&&c.geometry)){console.log(i.graphic);const n=i.graphic.geometry;i.graphic.setAttribute("type","draw"),i.graphic.setAttribute("id",new Date().getTime());const h=t.getGraphicPoint(n);e&&e("create",h,i)}}),this.sketchViewModel.on("update",function(i){if(console.log("update",i),i.aborted){const s=i.graphics[0];t.graphicsLayer.remove(s);return}if(i.state==="complete"&&i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("update",o,i)}}),this.sketchViewModel.on("delete",function(i){if(console.log("delete",i,t.graphicsLayer.graphics),i.graphics.length>0){const r=i.graphics[0].geometry,o=t.getGraphicPoint(r);e&&e("delete",o,i)}})}graphicPoint(){const e=[];return this.graphicsLayer.graphics.map(t=>{var r;const i=t.geometry,s=this.getGraphicPoint(i);e.push({point:s,type:(r=t.attributes)==null?void 0:r.type,attributes:t.attributes})}),e}getEntranceRoad(){const e={},t=this.graphicPoint().filter(n=>n.point.type==="polyline");if(console.log("🚀 ~ file: sketchView.ts:378 ~ SketchView ~ getEntranceRoad ~ graphics:",t),!t.length)return!1;const i=t.filter(n=>n.type=="draw"),s=t.filter(n=>n.type=="shiftLine");if(s.length==0)throw"未绘制平移!";if(i.length!=s.length)throw"绘制的线和平移的线数量不一致!";const r=i.sort((n,h)=>n.point.angle-h.point.angle),o=r.findIndex(n=>n.point.angle>135);return[...r.slice(o),...r.slice(0,o).reverse()].map((n,h)=>{const p=s.find(L=>L.attributes.id==n.attributes.id);if(!p)throw"绘制的线和平移的线不匹配!";console.log("🚀 ~ file: sketchView.ts:393 ~ SketchView ~ getEntranceRoad ~ m:",n,p),e[h+1]={0:[n.point.paths[0],n.point.paths[n.point.paths.length-1]],1:[p.point.paths[0],p.point.paths[p.point.paths.length-1]]}}),e}getEntranceFusionZone(e){const t=[],i={};this.graphicsLayer.graphics.map(r=>{var n;const o=r.geometry,c=this.getGraphicPoint(o,!1);t.push({point:c,type:(n=r.attributes)==null?void 0:n.type,attributes:r.attributes})});const s=t;return e.map((r,o)=>{i[r]=t[o]}),{graphics:i,rawData:s}}getIntersectionArea(e,t){const i=Object.keys(e);let s=!1;for(let r=0;r<i.length;r++){const o=i[r],c=e[o];if(x(d.polygon(t),d.polygon(c))){s=o;break}}return s}filterData(e){const t=w(e);return t.length>0&&t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&t.pop(),t}getGraphicPoint(e,t=!0){let i=e;this.viewer.spatialReference.isWebMercator&&(i=g.webMercatorToGeographic(e));let s;if(e.type==="point")s={type:e.type,x:i.x,y:i.y};else if(e.type==="polyline"){s={type:e.type,paths:[]},i.paths.forEach(n=>{let h=n;t&&(h=this.filterData(n)),h.forEach(p=>{s.paths.push(p)})});const r={x:s.paths[0][0],y:s.paths[0][1]},o={x:s.paths[s.paths.length-1][0],y:s.paths[s.paths.length-1][1]},c=this.getAngle(r,o);s.angle=c}else e.type==="polygon"&&(s={type:e.type,rings:[]},i.rings.forEach(r=>{let o=r;t&&(o=this.filterData(r)),o.forEach(c=>{s.rings.push(c)})}));return s}close(){this.sketch.visible=!1}show(){this.sketch.visible=!0}removeAll(){this.graphicsLayer.removeAll()}getAngle(e,t){const i=t.x-e.x,s=t.y-e.y;return Math.atan2(s,i)*180/Math.PI}getShiftLine(e,t,i="meters"){const s=e,r=-t;return V.offset(s,r,i)}setShiftLine(e,t="meters",i){i||(i={type:"simple-line",color:[0,0,255],width:2}),this.removeShiftLine(),this.graphicsLayer.graphics.map(s=>{const r=s.geometry,o=s.attributes;if((r==null?void 0:r.type)==="polyline"&&(o==null?void 0:o.type)==="draw"){const c=o.id,n=this.getShiftLine(r,e,t),h=new l({geometry:n,symbol:i,attributes:{type:"shiftLine",id:c}});this.graphicsLayer.add(h)}})}removeShiftLine(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="shiftLine"&&e.push(t)}),this.graphicsLayer.removeMany(e)}removeDraw(){const e=[];this.graphicsLayer.graphics.map(t=>{const i=t.attributes;(i==null?void 0:i.type)==="draw"&&e.push(t)}),this.graphicsLayer.removeMany(e)}addGraphic(e,t={type:"simple-line",color:[0,0,255],width:2},i){const s=new l({geometry:e,symbol:t,attributes:i});this.graphicsLayer.add(s)}getDirection(e,t){const i=t.x-e.x,s=t.y-e.y,o=Math.atan2(s,i)*180/Math.PI;return o>=-45&&o<=45?0:o>45&&o<=135?1:o>135||o<=-135?2:3}findLayerById(e){return this.viewer.map.findLayerById(e)}findShiftLineGraphicsById(e){return this.graphicsLayer.graphics.find(i=>i.attributes.id===e&&i.attributes.type==="shiftLine")}remove(e){this.graphicsLayer.remove(e)}setMaxAllowedGraphics(e){this.options.maxAllowedGraphics=e===0?void 0:e}deepClone(e){}destroy(){var e,t;this.viewer.map.remove(this.graphicsLayer),this.viewer.map.remove(this.TextGraphicsLayer),(e=this.sketch)==null||e.destroy(),(t=this.sketchViewModel)==null||t.destroy()}}exports.default=D;
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
|
|
2
|
-
declare const _sfc_main: import("vue").DefineComponent<{
|
|
3
|
-
view: {
|
|
4
|
-
type: null;
|
|
5
|
-
required: true;
|
|
6
|
-
};
|
|
7
|
-
}, {
|
|
8
|
-
props: any;
|
|
9
|
-
sketchVM: SketchViewModel;
|
|
10
|
-
resetButtonHandler: () => void;
|
|
11
|
-
geometrySelectionHandler: (event: any) => void;
|
|
12
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
-
view: {
|
|
14
|
-
type: null;
|
|
15
|
-
required: true;
|
|
16
|
-
};
|
|
17
|
-
}>>, {}, {}>;
|
|
18
|
-
export default _sfc_main;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { defineComponent as a, onMounted as m, onUnmounted as p, openBlock as u, createElementBlock as d, createElementVNode as n } from "vue";
|
|
2
|
-
import g from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
-
import y from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
4
|
-
const k = { class: "gisviewer-sketch-tool gisviewer-sketch-tool-position" }, _ = /* @__PURE__ */ a({
|
|
5
|
-
__name: "sketch-tool",
|
|
6
|
-
props: {
|
|
7
|
-
view: {}
|
|
8
|
-
},
|
|
9
|
-
setup(l) {
|
|
10
|
-
const c = l;
|
|
11
|
-
let o;
|
|
12
|
-
m(() => {
|
|
13
|
-
const e = new g();
|
|
14
|
-
c.view.map.add(e), o = new y({
|
|
15
|
-
layer: e,
|
|
16
|
-
view: c.view
|
|
17
|
-
});
|
|
18
|
-
}), p(() => {
|
|
19
|
-
o.destroy();
|
|
20
|
-
});
|
|
21
|
-
const i = () => {
|
|
22
|
-
}, r = (e) => {
|
|
23
|
-
var s;
|
|
24
|
-
console.log(e);
|
|
25
|
-
const t = (s = e.target) == null ? void 0 : s.value;
|
|
26
|
-
console.log(t), o.create(t);
|
|
27
|
-
};
|
|
28
|
-
return (e, t) => (u(), d("div", k, [
|
|
29
|
-
n("button", {
|
|
30
|
-
class: "esri-icon-pan geometry-button",
|
|
31
|
-
onClick: i
|
|
32
|
-
}),
|
|
33
|
-
n("button", {
|
|
34
|
-
class: "esri-icon-cursor geometry-button",
|
|
35
|
-
value: "rectangle",
|
|
36
|
-
onClick: r
|
|
37
|
-
}),
|
|
38
|
-
n("button", {
|
|
39
|
-
class: "esri-icon-polygon geometry-button",
|
|
40
|
-
value: "polygon",
|
|
41
|
-
onClick: r
|
|
42
|
-
})
|
|
43
|
-
]));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
export {
|
|
47
|
-
_ as default
|
|
48
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=(e,o)=>{const t=e.__vccOpts||e;for(const[r,s]of o)t[r]=s;return t};exports.default=u;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel';
|
|
2
|
-
declare const _sfc_main: import("vue").DefineComponent<{
|
|
3
|
-
view: {
|
|
4
|
-
type: null;
|
|
5
|
-
required: true;
|
|
6
|
-
};
|
|
7
|
-
}, {
|
|
8
|
-
props: any;
|
|
9
|
-
sketchVM: SketchViewModel;
|
|
10
|
-
resetButtonHandler: () => void;
|
|
11
|
-
geometrySelectionHandler: (event: any) => void;
|
|
12
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
-
view: {
|
|
14
|
-
type: null;
|
|
15
|
-
required: true;
|
|
16
|
-
};
|
|
17
|
-
}>>, {}, {}>;
|
|
18
|
-
export default _sfc_main;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./sketch-tool.vue2.js");require("./sketch-tool.vue3.js");const t=require("../../../../_virtual/_plugin-vue_export-helper.js"),u=t.default(e.default,[["__scopeId","data-v-f302a42f"]]);exports.default=u;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),a=require("@arcgis/core/layers/GraphicsLayer"),u=require("@arcgis/core/widgets/Sketch/SketchViewModel"),d={class:"gisviewer-sketch-tool gisviewer-sketch-tool-position"},g=e.defineComponent({__name:"sketch-tool",props:{view:{}},setup(l){const c=l;let t;e.onMounted(()=>{const o=new a;c.view.map.add(o),t=new u({layer:o,view:c.view})}),e.onUnmounted(()=>{t.destroy()});const i=()=>{},r=o=>{var s;console.log(o);const n=(s=o.target)==null?void 0:s.value;console.log(n),t.create(n)};return(o,n)=>(e.openBlock(),e.createElementBlock("div",d,[e.createElementVNode("button",{class:"esri-icon-pan geometry-button",onClick:i}),e.createElementVNode("button",{class:"esri-icon-cursor geometry-button",value:"rectangle",onClick:r}),e.createElementVNode("button",{class:"esri-icon-polygon geometry-button",value:"polygon",onClick:r})]))}});exports.default=g;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="";exports.default=e;
|