Browse Source
Merge pull request #2765 from vvlladd28/bug/3.0/map/minor-fix
[3.0] Minor improvement for the map widgets
pull/2785/head
Igor Kulikov
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
11 additions and
11 deletions
-
ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts
-
ui-ngx/src/app/modules/home/components/widget/lib/maps/maps-utils.ts
-
ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts
|
|
|
@ -20,12 +20,12 @@ import 'leaflet-providers'; |
|
|
|
import 'leaflet.markercluster/dist/leaflet.markercluster'; |
|
|
|
|
|
|
|
import { |
|
|
|
FormattedData, |
|
|
|
MapSettings, |
|
|
|
MarkerSettings, |
|
|
|
PolygonSettings, |
|
|
|
PolylineSettings, |
|
|
|
UnitedMapSettings |
|
|
|
FormattedData, |
|
|
|
MapSettings, |
|
|
|
MarkerSettings, |
|
|
|
PolygonSettings, |
|
|
|
PolylineSettings, |
|
|
|
UnitedMapSettings |
|
|
|
} from './map-models'; |
|
|
|
import { Marker } from './markers'; |
|
|
|
import { BehaviorSubject, Observable } from 'rxjs'; |
|
|
|
@ -405,8 +405,8 @@ export default abstract class LeafletMap { |
|
|
|
|
|
|
|
updatePolygon(polyData: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) { |
|
|
|
this.ready$.subscribe(() => { |
|
|
|
const poly = this.polygons.get(polyData.datasource.entityName); |
|
|
|
poly.updatePolygon(polyData.data, dataSources, settings); |
|
|
|
const poly = this.polygons.get(polyData.$datasource.entityName); |
|
|
|
poly.updatePolygon(polyData, dataSources, settings); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -152,7 +152,7 @@ function parseTemplate(template: string, data: { $datasource?: Datasource, [key: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const value = data[label]; |
|
|
|
const value = data[label] || ''; |
|
|
|
let textValue: string; |
|
|
|
if (isNumber(value)) { |
|
|
|
textValue = padValue(value, valDec); |
|
|
|
|
|
|
|
@ -14,7 +14,7 @@ |
|
|
|
/// limitations under the License.
|
|
|
|
///
|
|
|
|
|
|
|
|
import L, { LatLngExpression, LatLngTuple, LeafletMouseEvent } from 'leaflet'; |
|
|
|
import L, { LatLngExpression, LeafletMouseEvent } from 'leaflet'; |
|
|
|
import { createTooltip, parseWithTranslation, safeExecute } from './maps-utils'; |
|
|
|
import { FormattedData, PolygonSettings } from './map-models'; |
|
|
|
|
|
|
|
@ -61,7 +61,7 @@ export class Polygon { |
|
|
|
this.tooltip.setContent(parseWithTranslation.parseTemplate(pattern, data, true)); |
|
|
|
} |
|
|
|
|
|
|
|
updatePolygon(data: LatLngTuple[], dataSources: FormattedData[], settings: PolygonSettings) { |
|
|
|
updatePolygon(data: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) { |
|
|
|
this.data = data; |
|
|
|
this.dataSources = dataSources; |
|
|
|
this.leafletPoly.setLatLngs(data[this.settings.polygonKeyName]); |
|
|
|
|