...
|
...
|
@@ -27,6 +27,7 @@ import { Observable, of, BehaviorSubject, Subject } from 'rxjs'; |
27
|
27
|
import { filter } from 'rxjs/operators';
|
28
|
28
|
import { Polyline } from './polyline';
|
29
|
29
|
import { Polygon } from './polygon';
|
|
30
|
+import { string } from 'prop-types';
|
30
|
31
|
|
31
|
32
|
export default abstract class LeafletMap {
|
32
|
33
|
|
...
|
...
|
@@ -140,15 +141,10 @@ export default abstract class LeafletMap { |
140
|
141
|
this.map.invalidateSize(true);
|
141
|
142
|
}
|
142
|
143
|
|
143
|
|
-
|
144
|
144
|
onResize() {
|
145
|
145
|
|
146
|
146
|
}
|
147
|
147
|
|
148
|
|
- getTooltips() {
|
149
|
|
- return this.tooltips;//rewrite
|
150
|
|
- }
|
151
|
|
-
|
152
|
148
|
getCenter() {
|
153
|
149
|
return this.map.getCenter();
|
154
|
150
|
}
|
...
|
...
|
@@ -247,21 +243,24 @@ export default abstract class LeafletMap { |
247
|
243
|
|
248
|
244
|
updatePolygons(polyData: Array<Array<any>>) {
|
249
|
245
|
polyData.forEach((data: any) => {
|
250
|
|
- if (data.data.length) {
|
251
|
|
- let dataSource = polyData.map(arr => arr[0]);
|
|
246
|
+ if (data.data.length && data.dataKey.name === this.options.polygonKeyName) {
|
|
247
|
+ if (typeof (data?.data[0][1]) === 'string') {
|
|
248
|
+ data.data = JSON.parse(data.data[0][1]);
|
|
249
|
+ }
|
252
|
250
|
if (this.polygon) {
|
253
|
|
- this.updatePolygon(data, dataSource, this.options);
|
|
251
|
+ this.updatePolygon(data.data, polyData, this.options);
|
254
|
252
|
}
|
255
|
253
|
else {
|
256
|
|
- this.createPolygon(data, dataSource, this.options);
|
|
254
|
+ this.createPolygon(data.data, polyData, this.options);
|
257
|
255
|
}
|
258
|
256
|
}
|
259
|
|
- })
|
|
257
|
+ });
|
260
|
258
|
}
|
261
|
259
|
|
262
|
260
|
createPolygon(data, dataSources, settings) {
|
263
|
261
|
this.ready$.subscribe(() => {
|
264
|
|
- this.polygon = new Polygon(this.map, data.map(data => this.convertPosition(data)), data, dataSources, settings);
|
|
262
|
+ //public map, coordinates, dataSources, settings, onClickListener?
|
|
263
|
+ this.polygon = new Polygon(this.map, data, dataSources, settings);
|
265
|
264
|
const bounds = this.bounds.extend(this.polygon.leafletPoly.getBounds());
|
266
|
265
|
if (bounds.isValid()) {
|
267
|
266
|
this.map.fitBounds(bounds);
|
...
|
...
|
@@ -272,7 +271,7 @@ export default abstract class LeafletMap { |
272
|
271
|
|
273
|
272
|
updatePolygon(data, dataSources, settings) {
|
274
|
273
|
this.ready$.subscribe(() => {
|
275
|
|
- this.poly.updatePolyline(settings, data, dataSources);
|
|
274
|
+ // this.polygon.updatePolygon(settings, data, dataSources);
|
276
|
275
|
});
|
277
|
276
|
}
|
278
|
277
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|