gisviewer-vue3-arcgis 1.0.222 → 1.0.224

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.
Files changed (27) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +34 -0
  2. package/es/src/gis-map/gis-map.vue.mjs +110 -103
  3. package/es/src/gis-map/index.d.ts +34 -0
  4. package/es/src/gis-map/style/index.css +13 -1
  5. package/es/src/gis-map/utils/holo-flow/index.d.ts +3 -1
  6. package/es/src/gis-map/utils/holo-flow/index.mjs +33 -16
  7. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +31 -0
  8. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +98 -64
  9. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +17 -3
  10. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +222 -123
  11. package/es/src/gis-map/utils/sketchView.d.ts +1 -0
  12. package/es/src/gis-map/utils/sketchView.mjs +3 -0
  13. package/es/src/types/index.d.ts +1 -0
  14. package/lib/src/gis-map/gis-map.vue.d.ts +34 -0
  15. package/lib/src/gis-map/gis-map.vue.js +1 -1
  16. package/lib/src/gis-map/index.d.ts +34 -0
  17. package/lib/src/gis-map/style/index.css +13 -1
  18. package/lib/src/gis-map/utils/holo-flow/index.d.ts +3 -1
  19. package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
  20. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +31 -0
  21. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -1
  22. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +17 -3
  23. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
  24. package/lib/src/gis-map/utils/sketchView.d.ts +1 -0
  25. package/lib/src/gis-map/utils/sketchView.js +1 -1
  26. package/lib/src/types/index.d.ts +1 -0
  27. package/package.json +1 -1
@@ -11,6 +11,17 @@
11
11
  .esri-view .esri-view-surface:focus::after {
12
12
  outline: none !important;
13
13
  }
14
+ @keyframes blink {
15
+ 0% {
16
+ opacity: 1;
17
+ }
18
+ 50% {
19
+ opacity: 0;
20
+ }
21
+ 100% {
22
+ opacity: 1;
23
+ }
24
+ }
14
25
  .signal-countdown-panel {
15
26
  position: absolute;
16
27
  display: flex;
@@ -21,7 +32,7 @@
21
32
  .signal-countdown-container {
22
33
  margin: 0 1px;
23
34
  padding: 0px;
24
- background-color: rgba(0, 0, 0, 0.8);
35
+ background-color: rgba(0, 0, 0, 0.9);
25
36
  border-style: solid;
26
37
  border-color: turquoise;
27
38
  border-width: 2px;
@@ -36,4 +47,5 @@
36
47
  }
37
48
  .signal-countdown-number {
38
49
  font: 28px Digital;
50
+ height: 34px;
39
51
  }
@@ -1,4 +1,4 @@
1
- import { ISignalCountdownProps, IToggleTrafficInfoParams } from '../../../types';
1
+ import { IResult, ISignalCountdownProps, IToggleTrafficInfoParams } from '../../../types';
2
2
  export default class Index {
3
3
  private readonly view;
4
4
  private traceHoloFlow;
@@ -16,6 +16,8 @@ export default class Index {
16
16
  togglePause(pause: boolean): void;
17
17
  updatePanelContent(contentType: string): void;
18
18
  handleSignalData(data: any): Promise<void>;
19
+ initializeLampGroup(data: any): Promise<void>;
20
+ handleUniSignalData(data: any): IResult;
19
21
  clearHoloSignal(): void;
20
22
  setInterpolate(enable: boolean): void;
21
23
  downloadTrackLog(): void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),t=require("../../../types/index.js"),s=require("../../stores/index.js"),n=require("./signal-holo-flow.js"),r=require("./signal-holo-flow-lsr.js"),c=require("./trace-holo-flow.js");class h{constructor(e,o){this.view=e,this.signalCountdownPanelProps=o}async init(){this.traceHoloFlow=new c.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let o=t.EVehiclePlateState.None;switch(e){case"none":o=t.EVehiclePlateState.None;break;case"plateNumber":o=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":o=t.EVehiclePlateState.Id;break;case"mix":o=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(o)}async handleSignalData(e){var o,l;if(!this.signalHoloFlow){const a=s.default.useAppDataStore;((l=(o=i.toRaw(a.mapConfig).holoFlow)==null?void 0:o.signal)==null?void 0:l.style)==="LSR"?this.signalHoloFlow=new r.default(this.view,this.signalCountdownPanelProps):this.signalHoloFlow=new n.default(this.view),await this.signalHoloFlow.initializeLayer()}await this.signalHoloFlow.handleHoloSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),l=require("../../../types/index.js"),n=require("../../stores/index.js"),c=require("./signal-holo-flow.js"),s=require("./signal-holo-flow-lsr.js"),h=require("./trace-holo-flow.js");class w{constructor(e,o){this.view=e,this.signalCountdownPanelProps=o}async init(){this.traceHoloFlow=new h.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let o=l.EVehiclePlateState.None;switch(e){case"none":o=l.EVehiclePlateState.None;break;case"plateNumber":o=l.EVehiclePlateState.PlateNumber;break;case"vehicleId":o=l.EVehiclePlateState.Id;break;case"mix":o=l.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(o)}async handleSignalData(e){var o,a;if(!this.signalHoloFlow){const t=n.default.useAppDataStore;((a=(o=i.toRaw(t.mapConfig).holoFlow)==null?void 0:o.signal)==null?void 0:a.style)==="LSR"?this.signalHoloFlow=new s.default(this.view,this.signalCountdownPanelProps):this.signalHoloFlow=new c.default(this.view),await this.signalHoloFlow.initializeLayer()}await this.signalHoloFlow.handleHoloSignalData(e)}async initializeLampGroup(e){var o,a;if(!this.signalHoloFlow){const t=n.default.useAppDataStore;if(((a=(o=i.toRaw(t.mapConfig).holoFlow)==null?void 0:o.signal)==null?void 0:a.style)==="LSR")this.signalHoloFlow=new s.default(this.view,this.signalCountdownPanelProps);else return}await this.signalHoloFlow.initializeLayer(),this.signalHoloFlow.initializeLampGroup(e)}handleUniSignalData(e){return this.signalHoloFlow.handleUniSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=w;
@@ -3,6 +3,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
3
3
  type: StringConstructor;
4
4
  required: true;
5
5
  };
6
+ flash: {
7
+ type: BooleanConstructor;
8
+ required: true;
9
+ };
6
10
  crossId: {
7
11
  type: StringConstructor;
8
12
  required: true;
@@ -36,6 +40,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
36
40
  required: true;
37
41
  };
38
42
  }, {
43
+ colors: string[];
39
44
  props: any;
40
45
  panelStyle: import("vue").ComputedRef<{
41
46
  top: string;
@@ -43,14 +48,36 @@ declare const _sfc_main: import("vue").DefineComponent<{
43
48
  'transform-origin': string;
44
49
  transform: string;
45
50
  }>;
51
+ blImage: import("vue").ComputedRef<string>;
52
+ blNumberStyle: import("vue").ComputedRef<any>;
53
+ blLampStyle: import("vue").ComputedRef<{
54
+ display: string;
55
+ animation: string;
56
+ }>;
46
57
  uImage: import("vue").ComputedRef<string>;
47
58
  uNumberStyle: import("vue").ComputedRef<any>;
59
+ uLampStyle: import("vue").ComputedRef<{
60
+ display: string;
61
+ animation: string;
62
+ }>;
48
63
  lImage: import("vue").ComputedRef<string>;
49
64
  lNumberStyle: import("vue").ComputedRef<any>;
65
+ lLampStyle: import("vue").ComputedRef<{
66
+ display: string;
67
+ animation: string;
68
+ }>;
50
69
  sImage: import("vue").ComputedRef<string>;
51
70
  sNumberStyle: import("vue").ComputedRef<any>;
71
+ sLampStyle: import("vue").ComputedRef<{
72
+ display: string;
73
+ animation: string;
74
+ }>;
52
75
  rImage: import("vue").ComputedRef<string>;
53
76
  rNumberStyle: import("vue").ComputedRef<any>;
77
+ rLampStyle: import("vue").ComputedRef<{
78
+ display: string;
79
+ animation: string;
80
+ }>;
54
81
  getColorString: (color: string | undefined) => "red" | "rgb(255, 192, 2)" | "lime" | "white";
55
82
  getNumberStyle: (color: string | undefined) => any;
56
83
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -58,6 +85,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
58
85
  type: StringConstructor;
59
86
  required: true;
60
87
  };
88
+ flash: {
89
+ type: BooleanConstructor;
90
+ required: true;
91
+ };
61
92
  crossId: {
62
93
  type: StringConstructor;
63
94
  required: true;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v={key:0,class:"signal-countdown-container"},N=["src"],h={key:1,class:"signal-countdown-container"},w=["src"],V={key:2,class:"signal-countdown-container"},C=["src"],b={key:3,class:"signal-countdown-container"},E=["src"],_=e.defineComponent({__name:"signal-countdown-panel",props:{displayMode:{},crossId:{},roadId:{},mapPoint:{},stopLine:{},scale:{},position:{},rotation:{},lampStatus:{}},setup(a){const t=a,r=e.computed(()=>({top:`${t.position.top}px`,left:`${t.position.left}px`,"transform-origin":"bottom center",transform:`translateX(-50%) translateY(-100%) rotate(${t.rotation}deg) scale(${t.scale})`})),c=e.computed(()=>`/GisViewerAssets/Images/SignalLamp/u-${t.lampStatus.uColor}.png`),i=e.computed(()=>l(t.lampStatus.uColor)),u=e.computed(()=>`/GisViewerAssets/Images/SignalLamp/l-${t.lampStatus.lColor}.png`),m=e.computed(()=>l(t.lampStatus.lColor)),d=e.computed(()=>`/GisViewerAssets/Images/SignalLamp/s-${t.lampStatus.sColor}.png`),p=e.computed(()=>l(t.lampStatus.sColor)),g=e.computed(()=>`/GisViewerAssets/Images/SignalLamp/r-${t.lampStatus.rColor}.png`),S=e.computed(()=>l(t.lampStatus.rColor)),y=o=>{switch(o){case"red":return"red";case"yellow":return"rgb(255, 192, 2)";case"green":return"lime";default:return"white"}},l=o=>{const n={color:y(o)},s=t.rotation<0?t.rotation+360:t.rotation;return s>135&&s<225&&(n.transform="rotate(180deg)"),n};return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:"signal-countdown-panel",style:e.normalizeStyle(r.value)},[o.lampStatus.uColor?(e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(i.value)},e.toDisplayString(o.lampStatus.uNumber),5),e.createElementVNode("div",null,[e.createElementVNode("img",{src:c.value,width:"20px",height:"20px"},null,8,N)])])):e.createCommentVNode("",!0),o.lampStatus.lColor?(e.openBlock(),e.createElementBlock("div",h,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(m.value)},e.toDisplayString(o.lampStatus.lNumber),5),e.createElementVNode("div",null,[e.createElementVNode("img",{src:u.value,width:"20px",height:"20px"},null,8,w)])])):e.createCommentVNode("",!0),o.lampStatus.sColor?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(p.value)},e.toDisplayString(o.lampStatus.sNumber),5),e.createElementVNode("div",null,[e.createElementVNode("img",{src:d.value,width:"20px",height:"20px"},null,8,C)])])):e.createCommentVNode("",!0),o.lampStatus.rColor!==void 0?(e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(S.value)},e.toDisplayString(o.lampStatus.rNumber),5),e.createElementVNode("div",null,[e.createElementVNode("img",{src:g.value,width:"20px",height:"20px"},null,8,E)])])):e.createCommentVNode("",!0)],4))}});exports.default=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),V={key:0,class:"signal-countdown-container"},E=["src"],_={key:1,class:"signal-countdown-container"},B=["src"],I={key:2,class:"signal-countdown-container"},z=["src"],L={key:3,class:"signal-countdown-container"},$=["src"],A={key:4,class:"signal-countdown-container"},D=["src"],G=e.defineComponent({__name:"signal-countdown-panel",props:{displayMode:{},flash:{type:Boolean},crossId:{},roadId:{},mapPoint:{},stopLine:{},scale:{},position:{},rotation:{},lampStatus:{}},setup(r){const o=["red","yellow","green","grey"],t=r,i=e.computed(()=>({top:`${t.position.top}px`,left:`${t.position.left}px`,"transform-origin":"bottom center",transform:`translateX(-50%) translateY(-100%) rotate(${t.rotation}deg) scale(${t.scale})`})),u=e.computed(()=>!t.lampStatus.blColor||!o.includes(t.lampStatus.blColor)?"":`/GisViewerAssets/Images/SignalLamp/bl-${t.lampStatus.blColor}.png`),m=e.computed(()=>n(t.lampStatus.blColor)),c=e.computed(()=>({display:t.lampStatus.blColor&&o.includes(t.lampStatus.blColor)?"block":"none",animation:t.flash?"blink 2s infinite":"none"})),p=e.computed(()=>!t.lampStatus.uColor||!o.includes(t.lampStatus.uColor)?"":`/GisViewerAssets/Images/SignalLamp/u-${t.lampStatus.uColor}.png`),d=e.computed(()=>n(t.lampStatus.uColor)),S=e.computed(()=>({display:t.lampStatus.uColor&&o.includes(t.lampStatus.uColor)?"block":"none",animation:t.flash?"blink 2s infinite":"none"})),g=e.computed(()=>!t.lampStatus.lColor||!o.includes(t.lampStatus.lColor)?"":`/GisViewerAssets/Images/SignalLamp/l-${t.lampStatus.lColor}.png`),y=e.computed(()=>n(t.lampStatus.lColor)),b=e.computed(()=>({display:t.lampStatus.lColor&&o.includes(t.lampStatus.lColor)?"block":"none",animation:t.flash?"blink 2s infinite":"none"})),C=e.computed(()=>!t.lampStatus.sColor||!o.includes(t.lampStatus.sColor)?"":`/GisViewerAssets/Images/SignalLamp/s-${t.lampStatus.sColor}.png`),v=e.computed(()=>n(t.lampStatus.sColor)),h=e.computed(()=>({display:t.lampStatus.sColor&&o.includes(t.lampStatus.sColor)?"block":"none",animation:t.flash?"blink 2s infinite":"none"})),N=e.computed(()=>!t.lampStatus.rColor||!o.includes(t.lampStatus.rColor)?"":`/GisViewerAssets/Images/SignalLamp/r-${t.lampStatus.rColor}.png`),f=e.computed(()=>n(t.lampStatus.rColor)),k=e.computed(()=>({display:t.lampStatus.rColor&&o.includes(t.lampStatus.rColor)?"block":"none",animation:t.flash?"blink 2s infinite":"none"})),w=l=>{switch(l){case"red":return"red";case"yellow":return"rgb(255, 192, 2)";case"green":return"lime";default:return"white"}},n=l=>{const a={color:w(l)},s=t.rotation<0?t.rotation+360:t.rotation;return s>135&&s<225&&(a.transform="rotate(180deg)"),a};return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:"signal-countdown-panel",style:e.normalizeStyle(i.value)},[l.lampStatus.uColor?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(d.value)},e.toDisplayString(l.lampStatus.uNumber),5),e.createElementVNode("div",{style:e.normalizeStyle(S.value)},[e.createElementVNode("img",{src:p.value,width:"20px",height:"20px"},null,8,E)],4)])):e.createCommentVNode("",!0),l.lampStatus.blColor?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(m.value)},e.toDisplayString(l.lampStatus.blNumber),5),e.createElementVNode("div",{style:e.normalizeStyle(c.value)},[e.createElementVNode("img",{src:u.value,width:"20px",height:"20px"},null,8,B)],4)])):e.createCommentVNode("",!0),l.lampStatus.lColor?(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(y.value)},e.toDisplayString(l.lampStatus.lNumber),5),e.createElementVNode("div",{style:e.normalizeStyle(b.value)},[e.createElementVNode("img",{src:g.value,width:"20px",height:"20px"},null,8,z)],4)])):e.createCommentVNode("",!0),l.lampStatus.sColor?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(v.value)},e.toDisplayString(l.lampStatus.sNumber),5),e.createElementVNode("div",{style:e.normalizeStyle(h.value)},[e.createElementVNode("img",{src:C.value,width:"20px",height:"20px"},null,8,$)],4)])):e.createCommentVNode("",!0),l.lampStatus.rColor!==void 0?(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",{class:"signal-countdown-number",style:e.normalizeStyle(f.value)},e.toDisplayString(l.lampStatus.rNumber),5),e.createElementVNode("div",{style:e.normalizeStyle(k.value)},[e.createElementVNode("img",{src:N.value,width:"20px",height:"20px"},null,8,D)],4)])):e.createCommentVNode("",!0)],4))}});exports.default=G;
@@ -1,19 +1,31 @@
1
- import { ISignalCountdownProps } from '../../../types';
1
+ import { IResult, ISignalCountdownProps } from '../../../types';
2
2
  import SignalHoloFlow from './signal-holo-flow';
3
3
  export default class LSRSignalHoloFlow extends SignalHoloFlow {
4
4
  private stopLineLayer;
5
5
  private watchHandle;
6
6
  private countdownPanelProps;
7
+ private currentPanelScale;
7
8
  /** 轨迹延迟时间 */
8
9
  private trajectoryDelayTime;
9
- constructor(view: __esri.MapView | __esri.SceneView, countdownPanelInfos: ISignalCountdownProps[]);
10
+ /** 按照路口id->进口道路段id->停止线坐标保存的停止线 */
10
11
  private stopLineMap;
12
+ /** 信号机id->进口道id->灯组id */
13
+ private lampGroupMap;
14
+ constructor(view: __esri.MapView | __esri.SceneView, countdownPanelInfos: ISignalCountdownProps[]);
11
15
  /**
12
16
  * 读取停止线图层,将灯组面板沿着停止线放置
13
17
  * @returns
14
18
  */
15
19
  initializeLayer(): Promise<void>;
16
- private currentPanelScale;
20
+ /**
21
+ * 初始化灯组与进口道的关联关系
22
+ */
23
+ initializeLampGroup(data: any): void;
24
+ /**
25
+ * 处理统一信控平台信号灯数据
26
+ * @param data
27
+ */
28
+ handleUniSignalData(data: any): IResult;
17
29
  /**
18
30
  * 根据地图比例尺计算灯组面板缩放比例
19
31
  */
@@ -22,6 +34,8 @@ export default class LSRSignalHoloFlow extends SignalHoloFlow {
22
34
  * 地图移动时更新灯组面板位置
23
35
  */
24
36
  private updatePanelPosition;
37
+ private doHoloSignalData;
38
+ private updateLampGroupPanelStatus;
25
39
  /**
26
40
  * 处理全息流信号灯数据
27
41
  * @param data
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils.js"),M=require("@arcgis/core/layers/GraphicsLayer"),S=require("./signal-holo-flow.js");function w(f){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const e in f)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(f,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>f[e]})}}return t.default=f,Object.freeze(t)}const b=w(m),d=w(L);class v extends S.default{constructor(t,e){var i,l;super(t),this.stopLineLayer=new M,this.watchHandle=null,this.trajectoryDelayTime=0,this.stopLineMap=new Map,this.countdownPanelProps=e,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=((l=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:l.delay)||2}async initializeLayer(){var l,c;console.time("初始化停止线图层");let t=(c=(l=this.mapConfig.holoFlow)==null?void 0:l.signal)==null?void 0:c.stopLineLayer;if(!t)return;t=this.mapConfig.assetsRoot+"/"+t;const i=await(await fetch(t)).json();for(const n of i.features){const{roadId:r,nodeId:o}=n.properties;let{destinationPoint:a}=n.properties;const{coordinates:s}=n.geometry;if(a){if(typeof a=="string")try{a=JSON.parse(a)}catch(h){console.error("解析面板基准点失败",h);continue}}else{const h=s[0],P=s[s.length-1],g=(h[0]+P[0])/2,y=(h[1]+P[1])/2;a=[g,y]}const p=this.stopLineMap.get(o);p?p.set(r,{coord:s,panelPoint:a}):this.stopLineMap.set(o,new Map([[r,{coord:s,panelPoint:a}]]))}console.timeEnd("初始化停止线图层")}getPanelScale(){const t=this.view.scale;let e=1;return t<1e3?e=1:t<2e3?e=.8:t<4e3?e=.4:e=0,e}updatePanelPosition(){const t=this.getPanelScale();for(const e of this.countdownPanelProps){t!==this.currentPanelScale&&(e.scale=t);const{mapPoint:i}=e;let l=new u.Point({x:i[0],y:i[1]});this.view.spatialReference.isWebMercator&&(l=d.geographicToWebMercator(l));const c=this.view.toScreen(l);if(e.position.left=c.x,e.position.top=c.y,this.view.type==="3d"){const n=this.getPanelRotation(e.stopLine);e.rotation=n}}this.currentPanelScale=t}async handleHoloSignalData(t){this.watchHandle||(this.watchHandle=b.watch(()=>this.view.extent,()=>this.updatePanelPosition())),setTimeout(()=>{const e=t.crossId,i=this.stopLineMap.get(e);if(!i){console.log(`没有找到路口${e}`);return}const l=t.phaseCountDownList,c=new Map;for(const n of l){let r="";for(let p of n.roadIdList)if(p.startsWith("-")&&(p=p.slice(1)),i.has(p)){r=p;break}if(!r){console.log(`没有找到对应的进口道${e}--${r}`);continue}let o=c.get(r);if(o||(o={},c.set(r,o)),!n.direction)continue;const a=n.direction.toLowerCase(),s=n.color===1?"red":n.color===2?"yellow":"green";a==="u"?(o.uNumber=n.leftTime,o.uColor=s):a==="l"?(o.lNumber=n.leftTime,o.lColor=s):a==="s"?(o.sNumber=n.leftTime,o.sColor=s):a==="r"&&(o.rNumber=n.leftTime,o.rColor=s)}c.forEach((n,r)=>{const o=i.get(r);if(!o)return;const a=this.countdownPanelProps.find(s=>s.crossId===e&&s.roadId===r);if(a)a.lampStatus=n;else{let s=new u.Point({x:o.panelPoint[0],y:o.panelPoint[1]});this.view.spatialReference.isWebMercator&&(s=d.geographicToWebMercator(s));const p=this.view.toScreen(s),h=this.getPanelRotation(o.coord);this.countdownPanelProps.push({displayMode:"complex",crossId:e,roadId:r,mapPoint:o.panelPoint,stopLine:o.coord,position:{left:p.x,top:p.y},rotation:h,scale:this.getPanelScale(),lampStatus:n})}})},this.trajectoryDelayTime*1e3)}clearSignal(){var t;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(t=this.watchHandle)==null||t.remove(),this.watchHandle=null}getPanelRotation(t){const e=t[0];let i=new u.Point({x:e[0],y:e[1]});this.view.spatialReference.isWebMercator&&(i=d.geographicToWebMercator(i));const l=this.view.toScreen(i),c=t[t.length-1];let n=new u.Point({x:c[0],y:c[1]});this.view.spatialReference.isWebMercator&&(n=d.geographicToWebMercator(n));const r=this.view.toScreen(n),o=r.x-l.x,a=r.y-l.y;return Math.atan2(a,o)*(180/Math.PI)}}exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@arcgis/core/core/reactiveUtils"),d=require("@arcgis/core/geometry"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),L=require("./signal-holo-flow.js");function P(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const a in u)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(u,a);Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:()=>u[a]})}}return e.default=u,Object.freeze(e)}const w=P(y),m=P(S);class M extends L.default{constructor(e,a){var l,i;super(e),this.stopLineLayer=new b,this.watchHandle=null,this.trajectoryDelayTime=2,this.stopLineMap=new Map,this.lampGroupMap=new Map,this.countdownPanelProps=a,this.view.map.add(this.stopLineLayer),this.trajectoryDelayTime=((i=(l=this.mapConfig.holoFlow)==null?void 0:l.signal)==null?void 0:i.delay)||2}async initializeLayer(){var i,t;if(this.stopLineMap.size>0)return;console.time("初始化停止线图层");let e=(t=(i=this.mapConfig.holoFlow)==null?void 0:i.signal)==null?void 0:t.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e;const l=await(await fetch(e)).json();for(const n of l.features){const{roadId:s}=n.properties;let{destinationPoint:o}=n.properties;const{coordinates:r}=n.geometry;if(o){if(typeof o=="string")try{o=JSON.parse(o)}catch(c){console.error("解析面板基准点失败",c);continue}}else{const c=r[0],h=r[r.length-1],p=(c[0]+h[0])/2,f=(c[1]+h[1])/2;o=[p,f]}this.stopLineMap.set(s,{coord:r,panelPoint:o})}console.timeEnd("初始化停止线图层")}initializeLampGroup(e){const{sigId:a,lampGroupList:l}=e,i=[];l.forEach(t=>{const{lampGroupNo:n,lampGroupType:s,crossFlowList:o,pedList:r}=t;o.length>0&&o.forEach(c=>{const h=c.upSectionId;let p="s";switch(c.turn){case 1:p="s";break;case 2:p="l";break;case 4:p="r";break;case 8:p="u";break}s===81&&(p="bl"),i.push({lampGroupId:n,roadId:h,dir:p})}),r.length>0}),this.lampGroupMap.set(a,i)}handleUniSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition()));const{sigId:a,runningStatus:l}=e.data.basicInfo,i=this.lampGroupMap.get(a);if(!i)return{status:-1,message:"灯组未初始化"};const t=new Map;let n=!1;switch(String(l)){case"4":{n=!0,i.forEach(s=>{const{roadId:o,dir:r}=s;t.set(o,{...t.get(o)||{},[`${r}Number`]:"",[`${r}Color`]:"yellow"})});break}case"5":{i.forEach(s=>{const{roadId:o,dir:r}=s;t.set(o,{...t.get(o)||{},[`${r}Number`]:"",[`${r}Color`]:"red"})});break}case"6":case"9":{i.forEach(s=>{const{roadId:o,dir:r}=s;t.set(o,{...t.get(o)||{},[`${r}Number`]:"",[`${r}Color`]:"off"})});break}default:{const{curSigColorInfo:s}=e.data;s.forEach(o=>{const r=String(o.lamgroupId),{color:c,leftTime:h}=o,p=i.find(f=>f.lampGroupId===r);if(p){const{roadId:f,dir:g}=p;t.set(f,{...t.get(f)||{},[`${g}Number`]:h,[`${g}Color`]:c===1?"red":c===2?"yellow":"green"})}})}}return this.updateLampGroupPanelStatus(a,t,n),{status:0,message:"ok"}}getPanelScale(){const e=this.view.scale;let a=1;return e<1e3?a=1:e<2e3?a=.8:e<4e3?a=.4:a=0,a}updatePanelPosition(){const e=this.getPanelScale();for(const a of this.countdownPanelProps){e!==this.currentPanelScale&&(a.scale=e);const{mapPoint:l}=a;let i=new d.Point({x:l[0],y:l[1]});this.view.spatialReference.isWebMercator&&(i=m.geographicToWebMercator(i));const t=this.view.toScreen(i);if(a.position.left=t.x,a.position.top=t.y,this.view.type==="3d"){const n=this.getPanelRotation(a.stopLine);a.rotation=n}}this.currentPanelScale=e}doHoloSignalData(e){const a=e.crossId,l=e.phaseCountDownList,i=new Map;for(const t of l){let n="";for(let c of t.roadIdList)if(c.startsWith("-")&&(c=c.slice(1)),this.stopLineMap.has(c)){n=c;break}if(!n){console.log(`没有找到对应的进口道${a}--${n}`);continue}let s=i.get(n);if(s||(s={},i.set(n,s)),!t.direction)continue;const o=t.direction.toLowerCase(),r=t.color===1?"red":t.color===2?"yellow":"green";o==="u"?(s.uNumber=t.leftTime,s.uColor=r):o==="l"?(s.lNumber=t.leftTime,s.lColor=r):o==="s"?(s.sNumber=t.leftTime,s.sColor=r):o==="r"&&(s.rNumber=t.leftTime,s.rColor=r)}this.updateLampGroupPanelStatus(a,i)}updateLampGroupPanelStatus(e,a,l=!1){a.forEach((i,t)=>{const n=this.stopLineMap.get(t);if(!n)return;const s=this.countdownPanelProps.find(o=>o.roadId===t);if(s)s.lampStatus=i,s.flash=l;else{let o=new d.Point({x:n.panelPoint[0],y:n.panelPoint[1]});this.view.spatialReference.isWebMercator&&(o=m.geographicToWebMercator(o));const r=this.view.toScreen(o),c=this.getPanelRotation(n.coord);this.countdownPanelProps.push({displayMode:"complex",flash:l,crossId:e,roadId:t,mapPoint:n.panelPoint,stopLine:n.coord,position:{left:r.x,top:r.y},rotation:c,scale:this.getPanelScale(),lampStatus:i})}})}async handleHoloSignalData(e){this.watchHandle||(this.watchHandle=w.watch(()=>this.view.extent,()=>this.updatePanelPosition())),this.trajectoryDelayTime===0?this.doHoloSignalData(e):setTimeout(()=>this.doHoloSignalData(e),this.trajectoryDelayTime*1e3)}clearSignal(){var e;this.stopLineLayer.removeAll(),this.countdownPanelProps.length=0,(e=this.watchHandle)==null||e.remove(),this.watchHandle=null}getPanelRotation(e){const a=e[0];let l=new d.Point({x:a[0],y:a[1]});this.view.spatialReference.isWebMercator&&(l=m.geographicToWebMercator(l));const i=this.view.toScreen(l),t=e[e.length-1];let n=new d.Point({x:t[0],y:t[1]});this.view.spatialReference.isWebMercator&&(n=m.geographicToWebMercator(n));const s=this.view.toScreen(n),o=s.x-i.x,r=s.y-i.y;return Math.atan2(r,o)*(180/Math.PI)}}exports.default=M;
@@ -49,6 +49,7 @@ export default class SketchView {
49
49
  options: sketchViewOptions;
50
50
  constructor(view: MapView | SceneView, options?: sketchViewOptions);
51
51
  updateSketch(ring: number[][]): void;
52
+ cancelSketch(): void;
52
53
  init(): void;
53
54
  /**
54
55
  * 初始化绘图
@@ -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/Polygon"),G=require("@arcgis/core/geometry/Polyline"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),k=require("@arcgis/core/widgets/Sketch"),M=require("@arcgis/core/widgets/Sketch/SketchViewModel"),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(S),u=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 d({...this.options.GraphicsLayer}),this.TextGraphicsLayer=new d,this.viewer.map.addMany([this.graphicsLayer,this.TextGraphicsLayer]),this.init()}updateSketch(e){const t=new l({geometry:{type:"polygon",rings:[e]},symbol:{type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}}});this.graphicsLayer.add(t),this.sketchViewModel.update([t],{tool:"reshape",enableRotation:!0})}init(){this.sketchViewModel=new M({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 k({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,creationMode:this.options.creationMode||"single",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 G({paths:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}createPolygonGraphic(e,t,i){const s=new P({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)){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(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),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(u.polygon(t),u.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=!1){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}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;
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/Polygon"),G=require("@arcgis/core/geometry/Polyline"),S=require("@arcgis/core/geometry/support/webMercatorUtils.js"),l=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),k=require("@arcgis/core/widgets/Sketch"),M=require("@arcgis/core/widgets/Sketch/SketchViewModel"),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(S),u=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 d({...this.options.GraphicsLayer}),this.TextGraphicsLayer=new d,this.viewer.map.addMany([this.graphicsLayer,this.TextGraphicsLayer]),this.init()}updateSketch(e){const t=new l({geometry:{type:"polygon",rings:[e]},symbol:{type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}}});this.graphicsLayer.add(t),this.sketchViewModel.update([t],{tool:"reshape",enableRotation:!0})}cancelSketch(){this.sketchViewModel.cancel()}init(){this.sketchViewModel=new M({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 k({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,creationMode:this.options.creationMode||"single",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 G({paths:e}),r=g.geographicToWebMercator(s);return new l({geometry:r,symbol:t,attributes:i})}createPolygonGraphic(e,t,i){const s=new P({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)){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(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),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(u.polygon(t),u.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=!1){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}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;
@@ -248,6 +248,7 @@ export interface IJunctionTableData {
248
248
  factoryCode?: string;
249
249
  }
250
250
  export interface ISignalCountdownProps {
251
+ flash: boolean;
251
252
  displayMode: string;
252
253
  crossId: string;
253
254
  roadId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.222",
3
+ "version": "1.0.224",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [