Browse Source

聚合物初步晚上

上海一张图
陈鹏飞 4 years ago
parent
commit
034eb48a67
  1. 6
      src/app/data-collection/fire-force/fire-force.component.ts
  2. 2
      src/app/data-collection/linkage-forces/linkage-forces.component.ts
  3. 2
      src/app/data-collection/water-collection/water-collection.component.ts
  4. 4
      src/app/gis-management/gis-labeling/gis-labeling.component.ts
  5. 2
      src/app/key-unit/water-road/water-road.component.ts
  6. 35
      src/modules/map/declare/keda-map.ts
  7. 11
      src/modules/map/declare/map.d.ts

6
src/app/data-collection/fire-force/fire-force.component.ts

@ -7,7 +7,7 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
import { MapFactory } from '@src/modules/map/declare/factory'; import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker, IPlaceSearch } from '@src/modules/map/declare/map'; import { IMap, IMarker, IMarkerCluster, IPlaceSearch } from '@src/modules/map/declare/map';
import { Console } from 'console'; import { Console } from 'console';
import { TreeService } from 'src/app/http-interceptors/tree.service'; import { TreeService } from 'src/app/http-interceptors/tree.service';
import Viewer from 'viewerjs' import Viewer from 'viewerjs'
@ -67,7 +67,7 @@ export class FireForceComponent implements OnInit {
} }
} }
//循环渲染出所有力量markers //循环渲染出所有力量markers
cluster:any //力量聚合实例 cluster:IMarkerCluster //力量聚合实例
createMarker(list){ createMarker(list){
let markerArrcluster = [] let markerArrcluster = []
this.cluster ? this.cluster.setData([]) : null this.cluster ? this.cluster.setData([]) : null
@ -191,7 +191,7 @@ export class FireForceComponent implements OnInit {
} }
}) })
} }
}) },this)
} }

2
src/app/data-collection/linkage-forces/linkage-forces.component.ts

@ -176,7 +176,7 @@ export class LinkageForcesComponent implements OnInit {
item.location?this.positionLngLat = item.location:null item.location?this.positionLngLat = item.location:null
this.AttachmentArr = JSON.parse(item.relevantInfomationData) this.AttachmentArr = JSON.parse(item.relevantInfomationData)
} }
}) },this)
} }

2
src/app/data-collection/water-collection/water-collection.component.ts

@ -135,7 +135,7 @@ export class WaterCollectionComponent implements OnInit {
item.waterSourceType == 2 && item.detailData ? this.naturalWaterData = JSON.parse(item.detailData) : null item.waterSourceType == 2 && item.detailData ? this.naturalWaterData = JSON.parse(item.detailData) : null
this.positionLngLat = item.location this.positionLngLat = item.location
} }
}) },this)
} }

4
src/app/gis-management/gis-labeling/gis-labeling.component.ts

@ -458,7 +458,7 @@ export class GisLabelingComponent implements OnInit {
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#seePlan'), 'click', (event) => { this.seePlan(item) })//查看预案点击事件 this.renderer2.listen(this.elementRef.nativeElement.querySelector('#seePlan'), 'click', (event) => { this.seePlan(item) })//查看预案点击事件
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#share'), 'click', (event) => { this.share(item) })//分享点击事件 this.renderer2.listen(this.elementRef.nativeElement.querySelector('#share'), 'click', (event) => { this.share(item) })//分享点击事件
} }
}) },this)
} }
@ -915,7 +915,7 @@ export class GisLabelingComponent implements OnInit {
if (e.clusterData.length == 1) { if (e.clusterData.length == 1) {
} }
}) },this)
} }
//取消显示水源 //取消显示水源

2
src/app/key-unit/water-road/water-road.component.ts

@ -266,7 +266,7 @@ export class WaterRoadComponent implements OnInit {
if(e.clusterData.length == 1){ if(e.clusterData.length == 1){
} }
}) },this)
} }

35
src/modules/map/declare/keda-map.ts

@ -1,4 +1,4 @@
import { AutocompleteSearchCallback, AutocompleteSelectCallback, ClickOptions, DrivingSearchCallback, EventCallback, HtmlRender, IAutocomplete, ICircle, IDriving, IInfoWindow, ILayer, ILngLat, IMap, IMapOptions, IMarker, IMarkerCluster, IMarkOptions, IMouseTool, IPixel, IPlaceSearch, IRenderClusterMarker, ISelf, ITileLayer, PixelRender, PlaceSearchCallback } from './map' import { AutocompleteSearchCallback, AutocompleteSelectCallback, ClickOptions, DrivingSearchCallback, EventCallback, HtmlRender, IAutocomplete, ICircle, IDriving, IInfoWindow, ILayer, ILngLat, IMap, IMapOptions, IMarker, IMarkerCluster, IMarkOptions, IMouseTool, IPixel, IPlaceSearch, IRenderClusterMarker, ISelf, ITileLayer, MarkerClusterCallback, PixelRender, PlaceSearchCallback } from './map'
import { SearchDownList } from './component/SearchDownListPlugins/SearchDownList'; import { SearchDownList } from './component/SearchDownListPlugins/SearchDownList';
import { SearchService } from '@src/app/searchComponent.service'; import { SearchService } from '@src/app/searchComponent.service';
import * as ObjectID from 'bson-objectid'; import * as ObjectID from 'bson-objectid';
@ -495,14 +495,39 @@ export class KedaCircle extends KedaBasic implements ICircle { //圆形 图层
} }
export class KedaMarkerCluster extends KedaBasic implements IMarkerCluster { //Marker 聚合物 export class KedaMarkerCluster extends KedaBasic implements IMarkerCluster { //Marker 聚合物
public map:KeDaMap
public id:string
constructor(map: IMap, list: Object[], options: any) { constructor(map: IMap, list: Object[], options: any) {
super(); super();
} this.map = map
on(eventName: string, callback: Function): void { }
throw new Error('Method not implemented.'); on(eventName: string, callback: MarkerClusterCallback, component?: any): void {
// 绑定聚合事件时获取信息
this.map.self.addEventOnLayerObject({
layerId: this.id,
event: eventName,
handler: (e, info) => {
//查询聚合详情
if (info.type === 'aggs') {
this.map.self.queryClusterDetail({
queryOptions: info,
serviceName: 'service_tzn_test7',
maxCount: 999,
callback: function (res) {
console.log(res, '聚合详情');
callback.call(component,res)
}
});
} else if (info.type === 'details') {
console.log(info.data,'聚合详情');
}
}
});
} }
setData(list: any[]) { setData(list: any[]) {
throw new Error('Method not implemented.'); if (!list.length) {
this.map.self.removeLayer({layerId: this.id});
}
} }
} }

11
src/modules/map/declare/map.d.ts vendored

@ -43,8 +43,17 @@ export interface IMarker extends ISelf {
setMap(); setMap();
} }
export class MarkerClusterOptions { //聚合物 click 数据类型
cluster:any[]
clusterData:any[]
lnglat:ILngLat
target:any
markers:IMarker[]
}
type MarkerClusterCallback = (event:MarkerClusterOptions)=>void;
export interface IMarkerCluster extends ISelf { export interface IMarkerCluster extends ISelf {
on(eventName: string, callback: Function): void; on(eventName: string, callback: MarkerClusterCallback, component?: any): void;
setData(list: any[]); setData(list: any[]);
} }

Loading…
Cancel
Save