gisviewer-vue3-arcgis 1.0.249 → 1.0.250
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 +3 -1
- package/es/src/gis-map/index.d.ts +3 -1
- package/es/src/gis-map/utils/map-initializer.d.ts +3 -1
- package/es/src/gis-map/utils/map-initializer.mjs +5 -5
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -1
- package/lib/src/gis-map/index.d.ts +3 -1
- package/lib/src/gis-map/utils/map-initializer.d.ts +3 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/package.json +1 -1
|
@@ -80,7 +80,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
80
80
|
handleShowPlateNumber: () => void;
|
|
81
81
|
setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
82
82
|
setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
83
|
-
setMapZoom: (
|
|
83
|
+
setMapZoom: (params: {
|
|
84
|
+
zoom: number;
|
|
85
|
+
}) => import("../types").IResult;
|
|
84
86
|
lookAt: (params: ILookAtParams) => Promise<void>;
|
|
85
87
|
setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
|
|
86
88
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
@@ -65,7 +65,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
65
65
|
handleShowPlateNumber: () => void;
|
|
66
66
|
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
67
67
|
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
68
|
-
setMapZoom: (
|
|
68
|
+
setMapZoom: (params: {
|
|
69
|
+
zoom: number;
|
|
70
|
+
}) => import("../types").IResult;
|
|
69
71
|
lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
|
|
70
72
|
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
|
|
71
73
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
@@ -23,7 +23,9 @@ export default class MapInitializer {
|
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
25
|
setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
|
|
26
|
-
setMapZoom(
|
|
26
|
+
setMapZoom(params: {
|
|
27
|
+
zoom: number;
|
|
28
|
+
}): IResult;
|
|
27
29
|
/**
|
|
28
30
|
* 在一定的高度,以一定的角度去观察某个坐标
|
|
29
31
|
* */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import M from "@arcgis/core/Basemap";
|
|
2
2
|
import d from "@arcgis/core/config";
|
|
3
3
|
import * as k from "@arcgis/core/core/reactiveUtils";
|
|
4
|
-
import { Multipoint as P, Polygon as C, Polyline as
|
|
4
|
+
import { Multipoint as P, Polygon as C, Polyline as z, Point as T } from "@arcgis/core/geometry";
|
|
5
5
|
import * as u from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
6
|
-
import
|
|
6
|
+
import W from "@arcgis/core/layers/FeatureLayer";
|
|
7
7
|
import x from "@arcgis/core/layers/GeoJSONLayer";
|
|
8
8
|
import I from "@arcgis/core/layers/GroupLayer";
|
|
9
9
|
import G from "@arcgis/core/layers/IntegratedMesh3DTilesLayer";
|
|
@@ -168,7 +168,7 @@ class ae {
|
|
|
168
168
|
break;
|
|
169
169
|
}
|
|
170
170
|
case "feature": {
|
|
171
|
-
c = new
|
|
171
|
+
c = new W({ url: n, ...t.options });
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
case "3dtiles": {
|
|
@@ -258,7 +258,7 @@ class ae {
|
|
|
258
258
|
e.target = new T(e.target);
|
|
259
259
|
break;
|
|
260
260
|
case "polyline":
|
|
261
|
-
e.target = new
|
|
261
|
+
e.target = new z(e.target);
|
|
262
262
|
break;
|
|
263
263
|
case "polygon":
|
|
264
264
|
e.target = new C(e.target);
|
|
@@ -272,7 +272,7 @@ class ae {
|
|
|
272
272
|
return { status: 0, message: "成功" };
|
|
273
273
|
}
|
|
274
274
|
setMapZoom(e) {
|
|
275
|
-
return this.view ? (this.view.zoom = e, { status: 0, message: "成功" }) : { status: -1, message: "未初始化" };
|
|
275
|
+
return this.view ? (this.view.zoom = e.zoom, { status: 0, message: "成功" }) : { status: -1, message: "未初始化" };
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* 在一定的高度,以一定的角度去观察某个坐标
|
|
@@ -80,7 +80,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
80
80
|
handleShowPlateNumber: () => void;
|
|
81
81
|
setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
82
82
|
setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
83
|
-
setMapZoom: (
|
|
83
|
+
setMapZoom: (params: {
|
|
84
|
+
zoom: number;
|
|
85
|
+
}) => import("../types").IResult;
|
|
84
86
|
lookAt: (params: ILookAtParams) => Promise<void>;
|
|
85
87
|
setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
|
|
86
88
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
@@ -65,7 +65,9 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
65
65
|
handleShowPlateNumber: () => void;
|
|
66
66
|
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
67
67
|
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
68
|
-
setMapZoom: (
|
|
68
|
+
setMapZoom: (params: {
|
|
69
|
+
zoom: number;
|
|
70
|
+
}) => import("../types").IResult;
|
|
69
71
|
lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
|
|
70
72
|
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
|
|
71
73
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
@@ -23,7 +23,9 @@ export default class MapInitializer {
|
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
25
|
setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
|
|
26
|
-
setMapZoom(
|
|
26
|
+
setMapZoom(params: {
|
|
27
|
+
zoom: number;
|
|
28
|
+
}): IResult;
|
|
27
29
|
/**
|
|
28
30
|
* 在一定的高度,以一定的角度去观察某个坐标
|
|
29
31
|
* */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),v=require("@arcgis/core/config"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("@arcgis/core/Basemap"),v=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),W=require("@arcgis/core/layers/FeatureLayer"),O=require("@arcgis/core/layers/GeoJSONLayer"),S=require("@arcgis/core/layers/GroupLayer"),x=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),I=require("@arcgis/core/layers/MapImageLayer"),G=require("@arcgis/core/layers/TileLayer"),H=require("@arcgis/core/layers/WebTileLayer"),R=require("@arcgis/core/layers/WMSLayer"),_=require("@arcgis/core/Map"),B=require("@arcgis/core/views/MapView"),U=require("@arcgis/core/views/SceneView"),j=require("@turf/destination"),N=require("@turf/helpers"),E=require("./custom-layer/custom-wmts-layer.js");function y(u){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const i in u)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(u,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>u[i]})}}return e.default=u,Object.freeze(e)}const L=y(z),d=y(C),A=y(N);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var m,M,k,P;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:a}=e;v.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,v.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,v.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const r=new _;((m=this.mapConfig)==null?void 0:m.mapOptions.mode.toLowerCase())==="2d"?(this.view=new B({map:r,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new U({map:r,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(M=this.mapConfig)==null?void 0:M.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,f;if(a){let o=t.mapPoint;o.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),a([o.x,o.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const o=this.view.camera;if(this.view.spatialReference.isWebMercator){const h=d.webMercatorToGeographic(o.position),p={heading:o.heading,tilt:o.tilt,position:h.toJSON()};console.log(p),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(p))}else console.log(o.toJSON());console.log(this.view.zoom,this.view.scale)}else{let o=this.view.center;this.view.spatialReference.isWebMercator&&(o=d.webMercatorToGeographic(o)),console.log({center:o.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(f=(await this.view.hitTest(t)).results)==null?void 0:f.filter(o=>o.type==="graphic");c.length>0&&c.forEach(o=>{var p;const h=o.graphic;(p=h.attributes)!=null&&p.type&&s&&s(h.attributes.type,h.attributes.id,h.attributes,t)})});{let t=0,n=!1;this.view.on("pointer-move",async c=>{var f;const l=performance.now();if(!(n||l-t<100)){t=l,n=!0;try{const h=(f=(await this.view.hitTest(c)).results)==null?void 0:f.some(q=>q.type==="graphic"),p=this.view.container;p&&(p.style.cursor=h?"pointer":"default")}finally{n=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(k=this.mapConfig)!=null&&k.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const n=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new H({urlTemplate:n,...t.options});break}case"tile":{c=new G({url:n,...t.options});break}case"customwmts".toLowerCase():{c=new E.default({urlTemplate:n,...t.options});break}case"mapimage".toLowerCase():{c=new I({url:n,...t.options});break}case"arcgis":{const l=new T(t.options);r.basemap=l;break}case"feature":{c=new W({url:n,...t.options});break}case"3dtiles":{c=new x({url:n,...t.options});break}case"wms":{c=new R({url:n,...t.options});break}default:console.warn(`不支持的图层类型: ${t.type}`);break}if(c)if(t.group){let l=r.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new S({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),r.add(l))}else r.add(c)}):r.basemap=new T({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(P=this.mapConfig)!=null&&P.hdLayers){const t=this.mapConfig.hdLayers.map(n=>new O({url:this.processUrl(n.url),...n.options,title:n.options.id}));r.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const b=this.mapConfig.camera;let w;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=d.webMercatorToGeographic(t)),w={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return b?b.home=w:this.mapConfig.camera={home:w},this.view}setLayerVisibility(e){const{id:i,visible:s}=e,a=this.view.map.findLayerById(i);return a?(a.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){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;case"multipoint":e.target=new g.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===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 a=Math.tan(i*Math.PI/180)*e.height,r=j(A.point(e.center),a,s+180,{units:"meters"});await this.view.goTo({position:{x:r.geometry.coordinates[0],y:r.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:a}=this.mapConfig;if(!a)return{status:-1,message:"未配置camera"};const r=a[i];return r?(await this.view.goTo(r,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const r=1e3/30,b=L.watch(()=>this.view.center,()=>{const w=this.transformPoints(e),m=Date.now();m-s>r&&(i(w),s=m)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,b),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new g.Point({x:i[0],y:i[1]}),a=this.view.toScreen(s);return[a.x,a.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=L.watch(()=>this.view.zoom,a=>{i&&a<=i&&(this.view.zoom=i),s&&a>=s&&(this.view.zoom=s)}))}}exports.default=J;
|