gisviewer-vue3-arcgis 1.0.85 → 1.0.88

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.
@@ -169,7 +169,7 @@ class j {
169
169
  const a = Math.tan(i * Math.PI / 180) * e.height, c = S(
170
170
  L.point(e.center),
171
171
  a,
172
- 180,
172
+ t + 180,
173
173
  {
174
174
  units: "meters"
175
175
  }
@@ -221,7 +221,7 @@ class I {
221
221
  if (o.status !== 200)
222
222
  throw new Error(`OpenDriveRenderer: ${o.statusText}`);
223
223
  let l = o.data.result.json;
224
- l.startsWith("http") || (l = `http://${e}${l}`);
224
+ l.startsWith(window.location.protocol) || (l = `${window.location.protocol}://${e}${l}`);
225
225
  const r = await (await fetch(l)).arrayBuffer(), n = f.inflate(r, { to: "string" }), a = JSON.parse(n);
226
226
  this.showRoad(a);
227
227
  }
@@ -81,6 +81,8 @@ export interface IPointSymbol {
81
81
  url?: string;
82
82
  width?: number;
83
83
  height?: number;
84
+ xoffset?: number;
85
+ yoffset?: number;
84
86
  horizontalOrigin?: string;
85
87
  verticalOrigin?: string;
86
88
  color?: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@arcgis/core/Basemap"),P=require("@arcgis/core/Map"),p=require("@arcgis/core/config"),T=require("@arcgis/core/core/reactiveUtils"),z=require("@arcgis/core/geometry"),k=require("@arcgis/core/geometry/support/webMercatorUtils"),q=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/TileLayer"),S=require("@arcgis/core/layers/WebTileLayer"),x=require("@arcgis/core/views/MapView"),W=require("@arcgis/core/views/SceneView"),L=require("@turf/destination"),I=require("@turf/helpers"),R=require("../stores/index.js");function g(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const t=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,t.get?t:{enumerable:!0,get:()=>r[s]})}}return e.default=r,Object.freeze(e)}const M=g(T),f=g(k),_=g(I);function m(r,e){return r.startsWith("http://")||r.startsWith("https://")?r:e+r}class H{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(e){const s=R.default.useAppDataStore,t=JSON.parse(JSON.stringify(s.mapConfig));this.mapConfig=t;const{container:a,markerClickCallback:h,mapClickCallback:w}=e;p.assetsPath=`${t.assetsRoot}/ArcgisAssets`,p.fontsUrl=`${t.assetsRoot}/fonts`,p.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const c=new P;if((t==null?void 0:t.mapOptions.mode.toLowerCase())==="2d"?this.view=new x({map:c,container:a,...t.mapOptions}):this.view=new W({map:c,container:a,...t==null?void 0:t.mapOptions}),this.view.on("click",async i=>{var b,y;if(w){let o=i.mapPoint;o.spatialReference.isWebMercator&&(o=f.webMercatorToGeographic(o)),w([o.x,o.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=f.webMercatorToGeographic(o.position),d={heading:o.heading,tilt:o.tilt,position:u.toJSON()};console.log(d),(b=navigator.clipboard)==null||b.writeText(JSON.stringify(d))}else console.log(o.toJSON())}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=f.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom})}const l=(y=(await this.view.hitTest(i)).results)==null?void 0:y.filter(o=>o.type==="graphic");l.length>0&&l.forEach(o=>{var d;const u=o.graphic;(d=u.attributes)!=null&&d.type&&h&&h(u.attributes.type,u.attributes.id,u.attributes,i)})}),t!=null&&t.baseLayers?t.baseLayers.forEach(i=>{switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const n=m(i.url,t.assetsRoot),l=new S({urlTemplate:n,...i.options});c.add(l);break}case"tile":{const n=m(i.url,t.assetsRoot),l=new O({url:n,...i.options});c.add(l);break}case"arcgis":{const n=new v(i.options);c.basemap=n;break}}}):c.basemap=new v({style:{id:"arcgis/dark-gray",language:"zh-CN"}}),t!=null&&t.hdLayers){const i=t.hdLayers.map(n=>new q({url:m(n.url,t.assetsRoot),...n.options,title:n.options.id}));c.addMany(i)}return this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when(),this.view}async setMapCenter(e){return this.view?(e.center?await this.view.goTo({target:e.center,zoom:e.zoom},{duration:(e.duration||0)*1e3}):e.camera&&await this.view.goTo(e.camera,{duration:(e.duration||0)*1e3}),{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const s=e.tilt||0,t=e.heading||0;if(s===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:t,tilt:0},{duration:(e.duration||2)*1e3});else{const a=Math.tan(s*Math.PI/180)*e.height,h=L(_.point(e.center),a,180,{units:"meters"});await this.view.goTo({position:{x:h.geometry.coordinates[0],y:h.geometry.coordinates[1],z:e.height},heading:t,tilt:s},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{crossId:s,duration:t=0}=e,{camera:a}=this.mapConfig;return a?a[s]?(await this.view.goTo({target:a.center,zoom:e.zoom||15},{duration:t*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}:{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,s){let t=0;const h=1e3/30,w=M.watch(()=>this.view.center,()=>{const c=this.transformPoints(e),i=Date.now();i-t>h&&(s(c),t=i)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,w),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(s=>{const t=new z.Point({x:s[0],y:s[1]}),a=this.view.toScreen(t);return[a.x,a.y]})}cancelCoordinateTransform(e){const s=this.watchHandleMap.get(e);s&&(s.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:s,max:t}=e;!s&&!t||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=M.watch(()=>this.view.zoom,a=>{s&&a<=s&&(this.view.zoom=s),t&&a>=t&&(this.view.zoom=t)}))}}exports.default=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@arcgis/core/Basemap"),P=require("@arcgis/core/Map"),p=require("@arcgis/core/config"),T=require("@arcgis/core/core/reactiveUtils"),z=require("@arcgis/core/geometry"),k=require("@arcgis/core/geometry/support/webMercatorUtils"),q=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/TileLayer"),S=require("@arcgis/core/layers/WebTileLayer"),x=require("@arcgis/core/views/MapView"),W=require("@arcgis/core/views/SceneView"),L=require("@turf/destination"),I=require("@turf/helpers"),R=require("../stores/index.js");function g(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const e=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,e.get?e:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const M=g(T),f=g(k),_=g(I);function m(r,t){return r.startsWith("http://")||r.startsWith("https://")?r:t+r}class H{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(t){const s=R.default.useAppDataStore,e=JSON.parse(JSON.stringify(s.mapConfig));this.mapConfig=e;const{container:a,markerClickCallback:h,mapClickCallback:w}=t;p.assetsPath=`${e.assetsRoot}/ArcgisAssets`,p.fontsUrl=`${e.assetsRoot}/fonts`,p.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const c=new P;if((e==null?void 0:e.mapOptions.mode.toLowerCase())==="2d"?this.view=new x({map:c,container:a,...e.mapOptions}):this.view=new W({map:c,container:a,...e==null?void 0:e.mapOptions}),this.view.on("click",async i=>{var b,y;if(w){let o=i.mapPoint;o.spatialReference.isWebMercator&&(o=f.webMercatorToGeographic(o)),w([o.x,o.y],[i.screenPoint.x,i.screenPoint.y],i)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=f.webMercatorToGeographic(o.position),d={heading:o.heading,tilt:o.tilt,position:u.toJSON()};console.log(d),(b=navigator.clipboard)==null||b.writeText(JSON.stringify(d))}else console.log(o.toJSON())}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=f.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom})}const l=(y=(await this.view.hitTest(i)).results)==null?void 0:y.filter(o=>o.type==="graphic");l.length>0&&l.forEach(o=>{var d;const u=o.graphic;(d=u.attributes)!=null&&d.type&&h&&h(u.attributes.type,u.attributes.id,u.attributes,i)})}),e!=null&&e.baseLayers?e.baseLayers.forEach(i=>{switch(i.type.toLowerCase()){case"webTile".toLowerCase():{const n=m(i.url,e.assetsRoot),l=new S({urlTemplate:n,...i.options});c.add(l);break}case"tile":{const n=m(i.url,e.assetsRoot),l=new O({url:n,...i.options});c.add(l);break}case"arcgis":{const n=new v(i.options);c.basemap=n;break}}}):c.basemap=new v({style:{id:"arcgis/dark-gray",language:"zh-CN"}}),e!=null&&e.hdLayers){const i=e.hdLayers.map(n=>new q({url:m(n.url,e.assetsRoot),...n.options,title:n.options.id}));c.addMany(i)}return this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when(),this.view}async setMapCenter(t){return this.view?(t.center?await this.view.goTo({target:t.center,zoom:t.zoom},{duration:(t.duration||0)*1e3}):t.camera&&await this.view.goTo(t.camera,{duration:(t.duration||0)*1e3}),{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(t){if(this.view.type==="2d")return;const s=t.tilt||0,e=t.heading||0;if(s===0)await this.view.goTo({position:{x:t.center[0],y:t.center[1],z:t.height},heading:e,tilt:0},{duration:(t.duration||2)*1e3});else{const a=Math.tan(s*Math.PI/180)*t.height,h=L(_.point(t.center),a,e+180,{units:"meters"});await this.view.goTo({position:{x:h.geometry.coordinates[0],y:h.geometry.coordinates[1],z:t.height},heading:e,tilt:s},{duration:(t.duration||2)*1e3})}}async setMapCamera(t){if(!this.view)return{status:-1,message:"未初始化"};const{crossId:s,duration:e=0}=t,{camera:a}=this.mapConfig;return a?a[s]?(await this.view.goTo({target:a.center,zoom:t.zoom||15},{duration:e*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}:{status:-1,message:"未配置camera"}}requestCoordinateTransform(t,s){let e=0;const h=1e3/30,w=M.watch(()=>this.view.center,()=>{const c=this.transformPoints(t),i=Date.now();i-e>h&&(s(c),e=i)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,w),{handle:this.handleIndex,points:this.transformPoints(t)}}transformPoints(t){return t.map(s=>{const e=new z.Point({x:s[0],y:s[1]}),a=this.view.toScreen(e);return[a.x,a.y]})}cancelCoordinateTransform(t){const s=this.watchHandleMap.get(t);s&&(s.remove(),this.watchHandleMap.delete(t))}setMapZoomRange(t){const{min:s,max:e}=t;!s&&!e||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=M.watch(()=>this.view.zoom,a=>{s&&a<=s&&(this.view.zoom=s),e&&a>=e&&(this.view.zoom=e)}))}}exports.default=H;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),m=require("axios"),f=require("pako");class b{constructor(e){this.view=e,this.laneLayer=new w({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"}],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:"#2F4F4F",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.view.map.add(this.laneLayer)}async showOpenDrive(e,i){const t=`http://${e}/api/openDrive/analyzeXodr`,o=await m.get(t,{headers:{projectName:i},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let l=o.data.result.json;l.startsWith("http")||(l=`http://${e}${l}`);const r=await(await fetch(l)).arrayBuffer(),n=f.inflate(r,{to:"string"}),a=JSON.parse(n);this.showRoad(a)}async showRoad(e){const i=await this.laneLayer.queryFeatures();i.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:i.features});for(const t of e){const o=t.id,l=[];for(const s of t.laneSections){const r=s.id;for(const n of s.lanePaths){const{id:a,type:c,innerPath:d,outerPath:p}=n,y=d.concat(p.reverse());y.push(d[0]);const u=new h({geometry:{type:"polygon",rings:[y]},attributes:{id:a,roadId:o,roadName:t.name,sectionId:r,laneId:a,type:c}});l.push(u)}}await this.laneLayer.applyEdits({addFeatures:l})}}async hideOpenDrive(){const e=await this.laneLayer.queryFeatures();e.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:e.features})}}exports.default=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),m=require("axios"),f=require("pako");class b{constructor(e){this.view=e,this.laneLayer=new w({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"}],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:"#2F4F4F",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.view.map.add(this.laneLayer)}async showOpenDrive(e,i){const t=`http://${e}/api/openDrive/analyzeXodr`,o=await m.get(t,{headers:{projectName:i},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}://${e}${l}`);const r=await(await fetch(l)).arrayBuffer(),n=f.inflate(r,{to:"string"}),a=JSON.parse(n);this.showRoad(a)}async showRoad(e){const i=await this.laneLayer.queryFeatures();i.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:i.features});for(const t of e){const o=t.id,l=[];for(const s of t.laneSections){const r=s.id;for(const n of s.lanePaths){const{id:a,type:y,innerPath:d,outerPath:p}=n,c=d.concat(p.reverse());c.push(d[0]);const u=new h({geometry:{type:"polygon",rings:[c]},attributes:{id:a,roadId:o,roadName:t.name,sectionId:r,laneId:a,type:y}});l.push(u)}}await this.laneLayer.applyEdits({addFeatures:l})}}async hideOpenDrive(){const e=await this.laneLayer.queryFeatures();e.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:e.features})}}exports.default=b;
@@ -81,6 +81,8 @@ export interface IPointSymbol {
81
81
  url?: string;
82
82
  width?: number;
83
83
  height?: number;
84
+ xoffset?: number;
85
+ yoffset?: number;
84
86
  horizontalOrigin?: string;
85
87
  verticalOrigin?: string;
86
88
  color?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.85",
3
+ "version": "1.0.88",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "description": "",
20
20
  "typings": "lib/index.d.ts",
21
21
  "dependencies": {
22
- "@arcgis/core": "^4.28.6",
22
+ "@arcgis/core": "^4.29.10",
23
23
  "@easyest/utils": "1.0.2",
24
24
  "@turf/area": "^6.5.0",
25
25
  "@turf/bearing": "^6.5.0",