gisviewer-vue3-arcgis 1.0.251 → 1.0.253
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 +5 -1
- package/es/src/gis-map/gis-map.vue.mjs +171 -166
- package/es/src/gis-map/index.d.ts +3 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +52 -0
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +260 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.d.ts +1 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +69 -65
- package/es/src/gis-map/utils/overlay.d.ts +3 -8
- package/es/src/gis-map/utils/overlay.mjs +48 -52
- package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +2 -2
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +6 -2
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +15 -15
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -1
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +6 -2
- package/es/src/types/index.d.ts +31 -4
- package/lib/src/gis-map/gis-map.vue.d.ts +5 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +52 -0
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.d.ts +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +3 -8
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +2 -2
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/lib/src/types/index.d.ts +31 -4
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import Graphic from '@arcgis/core/Graphic';
|
|
|
2
2
|
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer';
|
|
3
3
|
import MapView from '@arcgis/core/views/MapView';
|
|
4
4
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
5
|
-
import {
|
|
5
|
+
import { IClusterPointParams, IMaskParam, IOverlayParam, IResult } from '../../types';
|
|
6
6
|
interface IOverlayOptions {
|
|
7
7
|
id: string;
|
|
8
8
|
}
|
|
@@ -73,13 +73,8 @@ export default class Overlay {
|
|
|
73
73
|
* @memberof Overlay
|
|
74
74
|
*/
|
|
75
75
|
showLayer(): void;
|
|
76
|
-
/**
|
|
77
|
-
* 添加点覆盖物
|
|
78
|
-
* @param overlay
|
|
79
|
-
* @param symbol
|
|
80
|
-
* @param properties
|
|
81
|
-
*/
|
|
82
|
-
addPoint(overlay: IOverlay, symbol: IPointSymbol, properties: any, visible?: boolean): IResult;
|
|
83
76
|
private addOverlay;
|
|
77
|
+
private clusterLayer;
|
|
78
|
+
addClusterPoint(params: IClusterPointParams): void;
|
|
84
79
|
}
|
|
85
80
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/geometry"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/geometry"),v=require("@arcgis/core/geometry/geometryEngine"),u=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/FeatureLayer"),g=require("@arcgis/core/layers/GraphicsLayer");function f(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>o[r]})}}return e.default=o,Object.freeze(e)}const n=f(v);class p{constructor(e,r){this.defaultPointSymbol={type:"simple-marker",style:"circle",color:"yellow",size:10},this.view=e,this.overlayLayer=new g({...r}),this.view.map.layers.add(this.overlayLayer)}addMask(e){this.removeMask();const r=e.maskColor||[100,100,100,.8],i=e.maskSize||100;let t=new c.Polygon({rings:[e.geometry.rings[0]]});const s=t.centroid,a=n.geodesicBuffer(s,i,"kilometers");let l=n.difference(a,t);if(e.geometry.rings.length>1)for(let y=1;y<e.geometry.rings.length;y++)t=new c.Polygon({rings:[e.geometry.rings[y]]}),l=n.difference(l,t);const d=new u({geometry:l,symbol:{type:"simple-fill",color:r,outline:{style:"long-dash",color:"white"}},attributes:{type:"mask"}});this.overlayLayer.add(d)}removeMask(){const e=this.overlayLayer.graphics.find(r=>r.getAttribute("type")==="mask");e&&this.overlayLayer.remove(e)}addOverlays(e){let r=0,i=0;e.defaultVisible==null&&(e.defaultVisible=!0);for(const t of e.overlays){t.properties?(t.properties.type||(t.properties.type=e.type),t.properties.id||(t.properties.id=t.id)):t.properties={type:e.type,id:t.id};const s=t.symbol||e.defaultSymbol||this.defaultPointSymbol,a=t.visible==null?e.defaultVisible:t.visible;this.addOverlay(t,s,t.properties,a).message==="add"?r++:i++}return{status:0,message:`新增${r}, 更新${i}`}}removeOverlaysByType(e){const r=this.overlayLayer.graphics.filter(i=>{const t=i.getAttribute("type");return e.includes(t)});return this.overlayLayer.graphics.removeMany(r),{status:0,message:`删除${r.length}`}}removeOverlaysById(e){const r=this.overlayLayer.graphics.filter(i=>{const t=i.getAttribute("id");return e.includes(t)});return this.overlayLayer.graphics.removeMany(r),{status:0,message:`删除${r.length}`}}isShowOverlaysByIds(e,r){this.overlayLayer.graphics.map(i=>{const t=i.getAttribute("id");e.includes(t)?i.visible=r:i.visible=!r})}showAllOverlays(){this.overlayLayer.graphics.forEach(e=>{e.visible=!0})}removeAllOverlays(){const e=this.overlayLayer.graphics.length;return this.overlayLayer.removeAll(),{status:0,message:`删除${e}`}}destroy(){this.view.map.remove(this.overlayLayer),this.overlayLayer.destroy()}removeGraphics(e){Array.isArray(e)||(e=[e]),this.overlayLayer.graphics.removeMany(e)}async findGraphic(e){var t;return(t=(await this.view.hitTest(e)).results)==null?void 0:t.filter(s=>s.type==="graphic"&&s.graphic.layer===this.overlayLayer)}hideLayer(){this.overlayLayer.visible=!1}showLayer(){this.overlayLayer.visible=!0}addOverlay(e,r,i,t){let s,a=!0;return e.id&&(s=this.overlayLayer.graphics.find(l=>l.getAttribute("id")===e.id)),s?s.visible=t:(s=new u({visible:t}),this.overlayLayer.add(s),a=!1),s.geometry=e.geometry,s.symbol=r,s.attributes=i,{status:0,message:a?"add":"update"}}addClusterPoint(e){this.clusterLayer||(this.clusterLayer=new h({id:"clusterPointLayer",source:[],outFields:["*"],geometryType:"point"}),this.view.map.add(this.clusterLayer))}}exports.default=p;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IResult } from '../../../types';
|
|
1
|
+
import { IFindSignalControlAreaParams, IResult } from '../../../types';
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class DistrictRenderer {
|
|
4
4
|
private view;
|
|
@@ -33,7 +33,7 @@ export default class DistrictRenderer {
|
|
|
33
33
|
* @param id 区控ID
|
|
34
34
|
* @return 返回高亮区控的数量
|
|
35
35
|
*/
|
|
36
|
-
highlightDistrict(
|
|
36
|
+
highlightDistrict(params: IFindSignalControlAreaParams): Promise<number>;
|
|
37
37
|
filter(id: string): void;
|
|
38
38
|
resetFilter(): void;
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("@arcgis/core/Graphic"),c=require("@arcgis/core/layers/FeatureLayer"),L=require("@turf/helpers"),d=require("@turf/turf"),l=require("../common-utils.js"),u=require("./layer-symbol.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const n=g(L);class D{constructor(t){this.style="",this.view=t,this.districtControllerDashLayer=new c(u.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer=new c(u.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer.popupEnabled=!0,this.view.map.addMany([this.districtControllerDashLayer,this.districtControllerSolidLayer])}async showDistricts(t){await this.clearDistricts();const e=[];for(let i=0;i<t.length;i++){const r=t[i],s=r.getAllSignalCoordinates();let a=null;if(s.length>=2)if(s.length===2)a=n.lineString(s);else{const f=n.featureCollection(s.map(p=>n.point(p)));a=d.convex(f),a||(a=n.lineString(s))}else if(s.length===1)a=n.point(s[0]);else continue;const h=d.buffer(a.geometry,200,{units:"meters"}),y=new C({geometry:{type:"polyline",paths:h.geometry.coordinates},attributes:{ObjectID:i,id:r.id,name:r.name,subDistrictCount:r.subDistrictCount,signalCount:r.signalCount,parentId:r.parentId,parentName:r.parentName,selected:this.style,type:"district"}});e.push(y)}await this.districtControllerDashLayer.applyEdits({addFeatures:e}),await this.districtControllerSolidLayer.applyEdits({addFeatures:e}),await l.default.viewGoto(this.view,e)}async clearDistricts(){let t=await this.districtControllerDashLayer.queryFeatures();await this.districtControllerDashLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerDashLayer.definitionExpression="1=1",t=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerSolidLayer.definitionExpression="1=1"}setVisible(t){this.districtControllerDashLayer.visible=t,this.districtControllerSolidLayer.visible=t}async locateDistrict(t){const e=this.districtControllerDashLayer.createQuery();e.where=`id = '${t}'`,e.returnGeometry=!0,e.outFields=["*"];const i=await this.districtControllerDashLayer.queryFeatures(e);return i.features.length>0?(await l.default.viewGoto(this.view,i.features),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightDistrict(t){const e=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${t}'`;const i=await this.districtControllerDashLayer.queryFeatures(),r=i.features.length;return r>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${t}'`,await l.default.viewGoto(this.view,i.features)):this.districtControllerDashLayer.definitionExpression=e,r}filter(t){const e=`id = '${t}'`;this.districtControllerDashLayer.definitionExpression=e,this.districtControllerSolidLayer.definitionExpression=e}resetFilter(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1"}}exports.default=D;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("@arcgis/core/Graphic"),c=require("@arcgis/core/layers/FeatureLayer"),L=require("@turf/helpers"),d=require("@turf/turf"),l=require("../common-utils.js"),u=require("./layer-symbol.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const n=g(L);class D{constructor(t){this.style="",this.view=t,this.districtControllerDashLayer=new c(u.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer=new c(u.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer.popupEnabled=!0,this.view.map.addMany([this.districtControllerDashLayer,this.districtControllerSolidLayer])}async showDistricts(t){await this.clearDistricts();const e=[];for(let i=0;i<t.length;i++){const r=t[i],s=r.getAllSignalCoordinates();let a=null;if(s.length>=2)if(s.length===2)a=n.lineString(s);else{const f=n.featureCollection(s.map(p=>n.point(p)));a=d.convex(f),a||(a=n.lineString(s))}else if(s.length===1)a=n.point(s[0]);else continue;const h=d.buffer(a.geometry,200,{units:"meters"}),y=new C({geometry:{type:"polyline",paths:h.geometry.coordinates},attributes:{ObjectID:i,id:r.id,name:r.name,subDistrictCount:r.subDistrictCount,signalCount:r.signalCount,parentId:r.parentId,parentName:r.parentName,selected:this.style,type:"district"}});e.push(y)}await this.districtControllerDashLayer.applyEdits({addFeatures:e}),await this.districtControllerSolidLayer.applyEdits({addFeatures:e}),await l.default.viewGoto(this.view,e)}async clearDistricts(){let t=await this.districtControllerDashLayer.queryFeatures();await this.districtControllerDashLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerDashLayer.definitionExpression="1=1",t=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerSolidLayer.definitionExpression="1=1"}setVisible(t){this.districtControllerDashLayer.visible=t,this.districtControllerSolidLayer.visible=t}async locateDistrict(t){const e=this.districtControllerDashLayer.createQuery();e.where=`id = '${t}'`,e.returnGeometry=!0,e.outFields=["*"];const i=await this.districtControllerDashLayer.queryFeatures(e);return i.features.length>0?(await l.default.viewGoto(this.view,i.features),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightDistrict(t){const e=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${t.id}'`;const i=await this.districtControllerDashLayer.queryFeatures(),r=i.features.length;return r>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${t.id}'`,await l.default.viewGoto(this.view,i.features,t.needZoom!==!1)):this.districtControllerDashLayer.definitionExpression=e,r}filter(t){const e=`id = '${t}'`;this.districtControllerDashLayer.definitionExpression=e,this.districtControllerSolidLayer.definitionExpression=e}resetFilter(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1"}}exports.default=D;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),y=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/GraphicsLayer"),R=require("../../stores/index.js"),D=require("./district-controller.js"),m=require("./district-renderer.js"),S=require("./signal-renderer.js"),C=require("./sub-district-renderer.js");class p{constructor(e){this.detachmentLayerLoaded=!1,this.view=e;const t=R.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new w,this.view.map.add(this.detachmentLayer),this.districtRenderer=new m.default(e),this.subDistrictRenderer=new C.default(e),this.signalRenderer=new S.default(e)}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const n of e.areaList){const i=new D.default(n,e.style||"");t.push(i),s.push(...i.subDistricts)}return this.districtRenderer.style=e.style||"",await this.districtRenderer.showDistricts(t),await this.subDistrictRenderer.showSubDistricts(s),await this.signalRenderer.showSignals(t),{status:0,message:"ok"}}async clearSignalControlArea(){return await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":this.signalRenderer.setPointVisible(e.visible);break;case"signalCluster":this.signalRenderer.setClusterVisible(e.visible);break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/geometry"),y=require("@arcgis/core/geometry/support/webMercatorUtils"),g=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/GraphicsLayer"),R=require("../../stores/index.js"),D=require("./district-controller.js"),m=require("./district-renderer.js"),S=require("./signal-renderer.js"),C=require("./sub-district-renderer.js");class p{constructor(e){this.detachmentLayerLoaded=!1,this.view=e;const t=R.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.detachmentLayer=new w,this.view.map.add(this.detachmentLayer),this.districtRenderer=new m.default(e),this.subDistrictRenderer=new C.default(e),this.signalRenderer=new S.default(e)}async showSignalControlArea(e){this.detachmentLayerLoaded||await this.loadDetachmentLayer(),await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const n of e.areaList){const i=new D.default(n,e.style||"");t.push(i),s.push(...i.subDistricts)}return this.districtRenderer.style=e.style||"",await this.districtRenderer.showDistricts(t),await this.subDistrictRenderer.showSubDistricts(s),await this.signalRenderer.showSignals(t),{status:0,message:"ok"}}async clearSignalControlArea(){return await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),await this.signalRenderer.clearSignals(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":this.signalRenderer.setPointVisible(e.visible);break;case"signalCluster":this.signalRenderer.setClusterVisible(e.visible);break;case"shanghai_district":this.detachmentLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e)?(this.subDistrictRenderer.filter(e),this.signalRenderer.filter(e),await this.subDistrictRenderer.showRoads(e),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e);return t>0?(this.districtRenderer.filter(s),this.signalRenderer.filter(e),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:n}=await this.signalRenderer.highlightSignal(e.id);return n>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter(e),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.signalRenderer.resetFilter(),{status:0,message:"ok"}}async loadDetachmentLayer(){const e=this.mapConfig.baseLayers;if(!e)return;const t=e.find(s=>s.options.id==="shanghai_district");if(t)try{const n=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),i=[],{renderer:r,labelingInfo:u}=t.options;n.features.forEach(o=>{const l=o.attributes.ZD_NAME;if(l!=="高架支队"){let c=new f.Polygon({rings:o.geometry.rings});c=y.webMercatorToGeographic(c);const a=new g({geometry:c,attributes:o.attributes});if(r){if(r.type==="simple")a.symbol=r.symbol;else if(r.type==="unique-value"){const d=a.getAttribute("OBJECTID"),h=r.uniqueValueInfos.find(b=>b.value==d);a.symbol=h?h.symbol:r.defaultSymbol}}else a.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(i.push(a),u&&l!=="边防港航支队"&&l!=="机场支队"){const d=new g({geometry:c.centroid,symbol:{...u.symbol,text:l}});i.push(d)}}}),this.detachmentLayer.addMany(i),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=p;
|
|
@@ -25,7 +25,7 @@ export default class SubDistrictRenderer {
|
|
|
25
25
|
* @param id 子区ID
|
|
26
26
|
* @return 返回高亮子区的数量以及区控id
|
|
27
27
|
*/
|
|
28
|
-
highlightSubDistrict(
|
|
28
|
+
highlightSubDistrict(params: IFindSignalControlAreaParams): Promise<{
|
|
29
29
|
count: number;
|
|
30
30
|
parentId: string;
|
|
31
31
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),v=require("@arcgis/core/layers/FeatureLayer"),m=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new v(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new v(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const t=[],r=[];i.forEach(e=>{e.roadConnections.length>0&&this.roadConnections.push(...e.roadConnections),r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[...e.areaColor,.8],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const u=new f({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount,color:e.areaColor.join(","),type:"subDistrict"}});t.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:t})}async showRoads(i){const{type:s,id:t}=i,r=this.subDistrictPointLayer.createQuery(),e=s==="district"?"districtId":"subDistrictId";r.where=`${e} = '${t}'`;const a=await this.subDistrictPointLayer.queryFeatures(r),u=new Map;a.features.forEach(n=>{var
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/Graphic"),v=require("@arcgis/core/layers/FeatureLayer"),m=require("../common-utils.js"),w=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new v(w.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new v(w.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const t=[],r=[];i.forEach(e=>{e.roadConnections.length>0&&this.roadConnections.push(...e.roadConnections),r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[...e.areaColor,.8],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const u=new f({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount,color:e.areaColor.join(","),type:"subDistrict"}});t.push(u)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:t})}async showRoads(i){const{type:s,id:t}=i,r=this.subDistrictPointLayer.createQuery(),e=s==="district"?"districtId":"subDistrictId";r.where=`${e} = '${t}'`;const a=await this.subDistrictPointLayer.queryFeatures(r),u=new Map;a.features.forEach(n=>{var p;const{subDistrictId:o,color:c,id:d,districtName:b,subDistrictName:L,signalCount:y}=n.attributes;u.has(o)||u.set(o,{color:c,signalIds:[],districtName:b,subDistrictName:L,signalCount:y}),(p=u.get(o))==null||p.signalIds.push(d)});const h=[],D=[];for(const n of u){let o=0;const c=n[0];h.push({value:c,symbol:{type:"simple-line",color:n[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:d,subDistrictName:b,signalIds:L,signalCount:y}=n[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new f({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:b,districtName:d,signalCount:y,color:n[1].color}});D.push(I)})}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:h,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:D})}async clearSubDistricts(){var t;const i=await this.subDistrictPointLayer.queryFeatures();i.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:i.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",(t=this.clickHandler)==null||t.remove()}setVisible(i){this.subDistrictPointLayer.visible=i,this.subDistrictLineLayer.visible=i}async locateSubDistrict(i){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${i}'`,s.returnGeometry=!0;const t=await this.subDistrictPointLayer.queryFeatures(s);return t.features.length>0?(await m.default.viewGoto(this.view,t.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const t=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),e=r.features.length;return e>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i.id}'`,s=r.features[0].attributes.districtId,await m.default.viewGoto(this.view,r.features,i.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=t,{count:e,parentId:s}}filter(i){const{type:s,id:t}=i,r=`${s==="district"?"districtId":"subDistrictId"} = '${t}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(i){var r;const t=(r=(await this.view.hitTest(i,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(e=>e.type==="graphic");if(t.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const e=t[0].graphic,a=e.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:e.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...a,.8],size:"8px",outline:{color:a,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:e.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:e.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -96,14 +96,18 @@ export interface IPointSymbol {
|
|
|
96
96
|
type: string;
|
|
97
97
|
style?: string;
|
|
98
98
|
url?: string;
|
|
99
|
-
width?: number;
|
|
100
|
-
height?: number;
|
|
99
|
+
width?: number | string;
|
|
100
|
+
height?: number | string;
|
|
101
101
|
xoffset?: number;
|
|
102
102
|
yoffset?: number;
|
|
103
103
|
horizontalOrigin?: string;
|
|
104
104
|
verticalOrigin?: string;
|
|
105
105
|
color?: string;
|
|
106
106
|
size?: number;
|
|
107
|
+
outline?: {
|
|
108
|
+
color?: string | number[];
|
|
109
|
+
width?: number;
|
|
110
|
+
};
|
|
107
111
|
}
|
|
108
112
|
export interface ILineSymbol {
|
|
109
113
|
type: string;
|
|
@@ -139,7 +143,30 @@ export interface IOverlayParam {
|
|
|
139
143
|
defaultSymbol?: IPointSymbol | ILineSymbol | IPolygonSymbol;
|
|
140
144
|
defaultVisible?: boolean;
|
|
141
145
|
overlays: Array<IOverlay>;
|
|
142
|
-
|
|
146
|
+
}
|
|
147
|
+
export interface IClusterPointParams {
|
|
148
|
+
type?: string;
|
|
149
|
+
clusterSymbol?: IPointSymbol;
|
|
150
|
+
pointSymbol?: IPointSymbol;
|
|
151
|
+
points: IClusterLocation[];
|
|
152
|
+
}
|
|
153
|
+
export interface IClusterLocation {
|
|
154
|
+
id: string;
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
properties?: any;
|
|
158
|
+
visited?: boolean;
|
|
159
|
+
clusterId?: number;
|
|
160
|
+
symbol?: IPointSymbol;
|
|
161
|
+
}
|
|
162
|
+
export interface ICluster {
|
|
163
|
+
id: number;
|
|
164
|
+
items: IClusterLocation[];
|
|
165
|
+
count: number;
|
|
166
|
+
center: {
|
|
167
|
+
x: number;
|
|
168
|
+
y: number;
|
|
169
|
+
} | null;
|
|
143
170
|
}
|
|
144
171
|
export interface ISetMapCameraParams {
|
|
145
172
|
name: string;
|
|
@@ -285,7 +312,7 @@ export interface IDistrictRoad {
|
|
|
285
312
|
export interface IFindSignalControlAreaParams {
|
|
286
313
|
type: string;
|
|
287
314
|
id: string;
|
|
288
|
-
|
|
315
|
+
needZoom?: boolean;
|
|
289
316
|
}
|
|
290
317
|
export interface INode {
|
|
291
318
|
id: string;
|