gisviewer-vue3-arcgis 1.0.235 → 1.0.237

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 (31) hide show
  1. package/es/src/gis-map/utils/common-utils.d.ts +2 -0
  2. package/es/src/gis-map/utils/common-utils.mjs +37 -23
  3. package/es/src/gis-map/utils/detect-gpu.mjs +4 -4
  4. package/es/src/gis-map/utils/signal-control-area/district-controller.d.ts +2 -0
  5. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +42 -26
  6. package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
  7. package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +19 -24
  8. package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +30 -34
  9. package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +0 -7
  10. package/es/src/gis-map/utils/signal-control-area/show-area.mjs +39 -72
  11. package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +3 -4
  12. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +36 -37
  13. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +13 -6
  14. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +95 -107
  15. package/es/src/types/index.d.ts +6 -0
  16. package/lib/src/gis-map/utils/common-utils.d.ts +2 -0
  17. package/lib/src/gis-map/utils/common-utils.js +1 -1
  18. package/lib/src/gis-map/utils/detect-gpu.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area/district-controller.d.ts +2 -0
  20. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
  21. package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
  22. package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
  23. package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -1
  24. package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +0 -7
  25. package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
  26. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +3 -4
  27. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
  28. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +13 -6
  29. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
  30. package/lib/src/types/index.d.ts +6 -0
  31. package/package.json +1 -1
@@ -1,15 +1,18 @@
1
- import { IResult, IRoadLine } from '../../../types';
1
+ import { IDistrictRoad, IFindSignalControlAreaParams, IResult } from '../../../types';
2
2
  import DistrictController from './district-controller';
3
3
  export default class SubDistrictRenderer {
4
4
  private view;
5
- private hasGpu;
6
5
  private clickHandler;
7
6
  private subDistrictPointLayer;
8
7
  private subDistrictLineLayer;
9
- roadLines: IRoadLine[];
10
- constructor(view: __esri.MapView | __esri.SceneView, hasGpu: boolean);
8
+ roadConnections: IDistrictRoad[];
9
+ constructor(view: __esri.MapView | __esri.SceneView);
11
10
  showSubDistricts(controllers: DistrictController[]): Promise<void>;
12
- showRoads(districtId: string): Promise<void>;
11
+ /**
12
+ * 显示区控下的所有子区,用道路线表示
13
+ * @param id 区控ID
14
+ */
15
+ showRoads(params: IFindSignalControlAreaParams): Promise<void>;
13
16
  clearSubDistricts(): Promise<void>;
14
17
  setVisible(visible: boolean): void;
15
18
  /**
@@ -31,12 +34,16 @@ export default class SubDistrictRenderer {
31
34
  * @param type 类型,district 或 subDistrict
32
35
  * @param id
33
36
  */
34
- filter(type: string, id: string): void;
37
+ filter(param: IFindSignalControlAreaParams): void;
35
38
  /**
36
39
  * 重置过滤器,显示所有子区
37
40
  */
38
41
  resetFilter(): void;
39
42
  private currentPointRenderer;
40
43
  private currentLineRenderer;
44
+ /**
45
+ * 监听地图点击事件,进行子区高亮
46
+ * @param event
47
+ */
41
48
  private viewHitTest;
42
49
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),g=require("./layer-symbol.js");class z{constructor(e,t){this.view=e,this.hasGpu=t,this.subDistrictPointLayer=new w(g.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=e.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(g.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=e.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(e){await this.clearSubDistricts(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let t=0;const s=[],r=[];e.forEach(i=>{r.push({value:i.id,label:i.name,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[...i.areaColor],width:4}}}),i.signals.forEach(a=>{const u=new m({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:t++,id:a.nodeId,name:a.name,subDistrictId:i.id,subDistrictName:i.name,districtId:i.parentId,districtName:i.parentName,signalCount:i.signalCount,color:i.areaColor.join(","),type:"subDistrict"}});s.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:s}),await this.view.goTo(s,{duration:this.hasGpu?1e3:0})}async showRoads(e){const t=this.subDistrictPointLayer.createQuery();t.where=`districtId = '${e}'`;const s=await this.subDistrictPointLayer.queryFeatures(t),r=new Map;s.features.forEach(u=>{var o;const{subDistrictId:c,color:l,id:p,districtName:b,subDistrictName:n,signalCount:y}=u.attributes;r.has(c)||r.set(c,{color:l,signalIds:[],districtName:b,subDistrictName:n,signalCount:y}),(o=r.get(c))==null||o.signalIds.push(p)});const i=[],a=[];for(const u of r){let c=0;const l=u[0];i.push({value:l,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:p,subDistrictName:b,signalIds:n,signalCount:y}=u[1];if(!(n.length<2))for(let o=0;o<n.length;o++)for(let d=0;d<n.length;d++){if(o===d)continue;const L=n[o],D=n[d];if(a.some(h=>{const v=h.attributes;return v&&v.fromNode===D&&v.toNode===L}))continue;const f=this.roadLines.find(h=>h.fromNode===L&&h.toNode===D);if(!f)continue;const P=new m({geometry:{type:"polyline",paths:[f.coordinates]},attributes:{ObjectID:c++,id:f.id,districtId:e,subDistrictId:l,subDistrictName:b,districtName:p,signalCount:y,fromNode:L,toNode:D,color:u[1].color}});a.push(P)}}this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",color:[180,180,180,.5],width:2,style:"solid"},defaultLabel:"其他子区",uniqueValueInfos:i,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:a})}async clearSubDistricts(){var s;const e=await this.subDistrictPointLayer.queryFeatures();e.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictPointLayer.definitionExpression="1=1";const t=await this.subDistrictLineLayer.queryFeatures();t.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:t.features}),this.subDistrictLineLayer.definitionExpression="1=1",(s=this.clickHandler)==null||s.remove()}setVisible(e){this.subDistrictPointLayer.visible=e,this.subDistrictLineLayer.visible=e}async locateSubDistrict(e){const t=this.subDistrictPointLayer.createQuery();t.where=`subDistrictId = '${e}'`,t.returnGeometry=!0;const s=await this.subDistrictPointLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(e){let t="";const s=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${e}'`;const r=await this.subDistrictPointLayer.queryFeatures(),i=r.features.length;return i>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${e}'`,t=r.features[0].attributes.districtId,await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0})):this.subDistrictPointLayer.definitionExpression=s,{count:i,parentId:t}}filter(e,t){const s=`${e==="district"?"districtId":"subDistrictId"} = '${t}'`;this.subDistrictPointLayer.definitionExpression=s,this.subDistrictLineLayer.definitionExpression=s}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(e){var r;const s=(r=(await this.view.hitTest(e,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(i=>i.type==="graphic");if(s.length===0)this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const i=s[0].graphic;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:i.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:i.attributes.color.split(",").map(Number),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:i.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:i.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=z;
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 y;const{subDistrictId:o,color:c,id:d,districtName:b,subDistrictName:L,signalCount:p}=n.attributes;u.has(o)||u.set(o,{color:c,signalIds:[],districtName:b,subDistrictName:L,signalCount:p}),(y=u.get(o))==null||y.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:p}=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:p,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),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const t=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i}'`;const r=await this.subDistrictPointLayer.queryFeatures(),e=r.features.length;return e>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i}'`,s=r.features[0].attributes.districtId,await m.default.viewGoto(this.view,r.features)):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;
@@ -275,6 +275,12 @@ export interface IShowSignalControlAreaParams {
275
275
  areaList: any[];
276
276
  style?: string;
277
277
  }
278
+ export interface IDistrictRoad {
279
+ id: string;
280
+ coordinates: number[][];
281
+ districtId: string;
282
+ subDistrictId: string;
283
+ }
278
284
  export interface IFindSignalControlAreaParams {
279
285
  type: string;
280
286
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.235",
3
+ "version": "1.0.237",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [