gisviewer-vue3-arcgis 1.0.166 → 1.0.167
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 +11 -2
- package/es/src/gis-map/gis-map.vue.mjs +26 -23
- package/es/src/gis-map/index.d.ts +11 -2
- package/es/src/gis-map/utils/common-utils.mjs +9 -9
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +9 -1
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +1 -1
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +6 -5
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +1 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +103 -73
- package/es/src/gis-map/utils/map-initializer.d.ts +1 -0
- package/es/src/gis-map/utils/map-initializer.mjs +121 -122
- package/es/src/types/index.d.ts +1 -0
- package/es/style.css +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +11 -2
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +11 -2
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +9 -1
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.d.ts +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.d.ts +1 -0
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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 y=require("@arcgis/core/core/reactiveUtils"),w=require("@arcgis/core/geometry"),S=require("@arcgis/core/layers/GraphicsLayer"),L=require("@turf/bearing"),R=require("@turf/destination"),v=require("@turf/helpers"),M=require("../../stores/index.js"),b=require("../common-utils.js"),x=require("./signal-holo-flow.js");function P(h){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>h[t]})}}return e.default=h,Object.freeze(e)}const C=P(y),m=P(v);class T extends x.default{constructor(e){super(e),this.stopLineLayer=new S,this.store=M.default.useAppDataStore,this.watchHandle=null,this.stopLineMap=new Map,this.view.map.add(this.stopLineLayer)}async initializeLayer(){var p,f;console.time("初始化停止线图层");let e=(f=(p=this.mapConfig.holoFlow)==null?void 0:p.signal)==null?void 0:f.stopLineLayer;if(!e)return;e=this.mapConfig.assetsRoot+"/"+e,(await(await fetch(e)).json()).features.forEach(a=>{const{roadId:o,nodeId:s}=a.properties,{coordinates:r}=a.geometry,n=this.stopLineMap.get(s);n?n.set(o,r):this.stopLineMap.set(s,new Map([[o,r]]))}),console.timeEnd("初始化停止线图层")}async handleSignalData(e){this.watchHandle||(this.watchHandle=C.watch(()=>this.view.extent,()=>{for(const o of this.store.countdownPanels){const{mapPoint:s}=o,r=this.view.toScreen({type:"point",x:s[0],y:s[1]});o.position.left=r.x,o.position.top=r.y}}));const t=e.crossId,i=e.rtStage,p=e.nonCurStageRemainingTime,f=e.allStageFlows;console.log(t,i,p,f);const a=new Map;f.forEach(o=>{const{stageId:s,stageFlows:r}=o;let n="green",u=i.stageRemainingTime;if(s===i.stageId)u<=i.stageAllRedTime?n="red":i.stageYellowTime!==0&&u<=i.stageYellowTime+i.stageAllRedTime&&(n="yellow");else{n="red";const l=p.find(g=>g.stageId===s);u=l?l.stageNextRunRemainingTime:0}r.forEach(l=>{let{fromRoadId:g}=l;g.startsWith("-")&&(g=g.slice(1));const d=l.direction.toLowerCase();let c=a.get(g);c||(c={},a.set(g,c)),d==="u"?(c.uNumber=u,c.uColor=n):d==="l"?(c.lNumber=u,c.lColor=n):d==="s"?(c.sNumber=u,c.sColor=n):d==="r"&&(c.rNumber=u,c.rColor=n==="yellow"?"red":n)})}),a.forEach((o,s)=>{console.log(s,o);const r=this.stopLineMap.get(t);if(!r){console.error(`路口${t}没有找到对应的停止线`);return}const n=r.get(s);if(!n){console.error(`路口${t}的进口道${s}没有找到对应的停止线`);return}const u=this.store.countdownPanels.find(l=>l.crossId===t&&l.roadId===s);if(u)u.lampStatus=o;else{const l=this.getPanelPoint(n),g=this.view.toScreen({type:"point",x:l[0],y:l[1]}),d=this.getPanelRotation(n);this.store.countdownPanels.push({displayMode:"complete",crossId:t,roadId:s,mapPoint:l,stopLine:n,position:{left:g.x,top:g.y},rotation:d,lampStatus:o})}})}clearSignal(){var e;this.stopLineLayer.removeAll(),this.store.countdownPanels=[],(e=this.watchHandle)==null||e.remove(),this.watchHandle=null}getPanelPoint(e){const t=b.default.getCenterPointInLine(e),i=e[0],p=e[e.length-1];let a=L(m.point(i),m.point(p))-90;return a<-180&&(a+=360),R(m.point(t),1,a,{units:"meters"}).geometry.coordinates}getPanelRotation(e){const t=e[0],i=new w.Point({x:t[0],y:t[1],spatialReference:this.view.spatialReference}),p=this.view.toScreen(i),f=e[e.length-1],a=new w.Point({x:f[0],y:f[1],spatialReference:this.view.spatialReference}),o=this.view.toScreen(a),s=o.x-p.x,r=o.y-p.y;return Math.atan2(r,s)*(180/Math.PI)}}exports.default=T;
|
|
@@ -11,6 +11,7 @@ export default class MapInitializer {
|
|
|
11
11
|
*/
|
|
12
12
|
initialize(params: {
|
|
13
13
|
container: HTMLElement;
|
|
14
|
+
mapConfig: any;
|
|
14
15
|
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
15
16
|
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
16
17
|
}): Promise<MapView | SceneView>;
|
|
@@ -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 k=require("@arcgis/core/Basemap"),d=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/MapImageLayer"),x=require("@arcgis/core/layers/TileLayer"),I=require("@arcgis/core/layers/WebTileLayer"),S=require("@arcgis/core/Map"),R=require("@arcgis/core/views/MapView"),H=require("@arcgis/core/views/SceneView"),_=require("@turf/destination"),G=require("@turf/helpers"),j=require("./custom-layer/custom-wmts-layer.js");function b(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const T=b(z),m=b(L),B=b(G);function q(r,e){return r&&(r.startsWith("http://")||r.startsWith("https://")?r:e+r)}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){var u,y,v,M;this.mapConfig=e.mapConfig;const{container:t,markerClickCallback:s,mapClickCallback:o}=e;d.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,d.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,d.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const n=new S;if(((u=this.mapConfig)==null?void 0:u.mapOptions.mode.toLowerCase())==="2d"?this.view=new R({map:n,container:t,...this.mapConfig.mapOptions}):this.view=new H({map:n,container:t,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(y=this.mapConfig)==null?void 0:y.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!1},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async i=>{var C,P;if(o){let a=i.mapPoint;a.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),o([a.x,a.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const p=m.webMercatorToGeographic(a.position),f={heading:a.heading,tilt:a.tilt,position:p.toJSON()};console.log(f),(C=navigator.clipboard)==null||C.writeText(JSON.stringify(f))}else console.log(a.toJSON());console.log(this.view.zoom,this.view.scale)}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=m.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(P=(await this.view.hitTest(i)).results)==null?void 0:P.filter(a=>a.type==="graphic");c.length>0&&c.forEach(a=>{var f;const p=a.graphic;(f=p.attributes)!=null&&f.type&&s&&s(p.attributes.type,p.attributes.id,p.attributes,i)})}),(v=this.mapConfig)!=null&&v.baseLayers?this.mapConfig.baseLayers.forEach(i=>{const l=q(i.url,this.mapConfig.assetsRoot);switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const c=new I({urlTemplate:l,...i.options});n.add(c);break}case"tile":{const c=new x({url:l,...i.options});n.add(c);break}case"customWMTS".toLowerCase():{const c=new j.default({urlTemplate:l,...i.options});n.add(c);break}case"mapImage".toLowerCase():{const c=new O({url:l,...i.options});n.add(c);break}case"arcgis":{const c=new k(i.options);n.basemap=c;break}}}):n.basemap=new k({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(M=this.mapConfig)!=null&&M.hdLayers){const i=this.mapConfig.hdLayers.map(l=>new W({url:q(l.url,this.mapConfig.assetsRoot),...l.options,title:l.options.id}));n.addMany(i)}this.view.ui.remove("attribution"),await this.view.when();const w=this.mapConfig.camera;let h;if(this.view.type==="2d"){let i=this.view.center;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={center:[i.x,i.y],zoom:this.view.zoom}}else{let i=this.view.camera.position;this.view.spatialReference.isWebMercator&&(i=m.webMercatorToGeographic(i)),h={position:i,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=h:this.mapConfig.camera={home:h},this.view}setLayerVisibility(e){const{id:t,visible:s}=e,o=this.view.map.findLayerById(t);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var t;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((t=e.target)==null?void 0:t.type){case"point":e.target=new g.Point(e.target);break;case"polyline":e.target=new g.Polyline(e.target);break;case"polygon":e.target=new g.Polygon(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}async lookAt(e){if(this.view.type==="2d")return;const t=e.tilt||0,s=e.heading||0;if(t===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(t*Math.PI/180)*e.height,n=_(B.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:e.height},heading:s,tilt:t},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:t,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[t];return n?(await this.view.goTo(n,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,t){let s=0;const n=1e3/30,w=T.watch(()=>this.view.center,()=>{const h=this.transformPoints(e),u=Date.now();u-s>n&&(t(h),s=u)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,w),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(t=>{const s=new g.Point({x:t[0],y:t[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const t=this.watchHandleMap.get(e);t&&(t.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:t,max:s}=e;!t&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{t&&o<=t&&(this.view.zoom=t),s&&o>=s&&(this.view.zoom=s)}))}}exports.default=N;
|
package/lib/src/types/index.d.ts
CHANGED