Browse Source

Editable polygons

pull/3280/head
Mrkartoshka 6 years ago
parent
commit
9413b68ebf
  1. 230
      application/src/main/data/json/system/widget_bundles/input_widgets.json
  2. 6
      ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts
  3. 6
      ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts

230
application/src/main/data/json/system/widget_bundles/input_widgets.json

File diff suppressed because one or more lines are too long

6
ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts

@ -17,7 +17,7 @@
import L, {
FeatureGroup,
Icon,
LatLngBounds,
LatLngBounds, LatLngExpression,
LatLngTuple,
markerClusterGroup,
MarkerClusterGroup,
@ -362,7 +362,7 @@ export default abstract class LeafletMap {
return L.latLng(lat, lng) as L.LatLng;
}
convertPositionPolygon(expression: Array<[number, number]> | Array<Array<[number, number]>>) {
convertPositionPolygon(expression:LatLngExpression[][] | LatLngExpression[][][]) {
return (expression as Array<any>).map((el) => {
if (el.length === 2 && !el.some(isNaN)) {
return el;
@ -395,7 +395,7 @@ export default abstract class LeafletMap {
}
}
convertPolygonToCustomFormat(expression: Array<Array<any>>): object {
convertPolygonToCustomFormat(expression: any[][]): object {
return {
[this.options.polygonKeyName] : this.convertToPolygonFormat(expression)
}

6
ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import L, { LatLngBounds, LatLngLiteral, LatLngTuple } from 'leaflet';
import L, {LatLngBounds, LatLngExpression, LatLngLiteral, LatLngTuple} from 'leaflet';
import LeafletMap from '../leaflet-map';
import { MapImage, PosFuncton, UnitedMapSettings } from '../map-models';
import { Observable, ReplaySubject } from 'rxjs';
@ -224,7 +224,7 @@ export class ImageMap extends LeafletMap {
expression.y * this.height);
}
convertPositionPolygon(expression: Array<[number, number]> | Array<Array<[number, number]>>) {
convertPositionPolygon(expression: LatLngExpression[][] | LatLngExpression[][][]) {
return (expression as Array<any>).map((el) => {
if (el.length === 2 && !el.some(isNaN)) {
return this.pointToLatLng(
@ -269,7 +269,7 @@ export class ImageMap extends LeafletMap {
}
}
convertPolygonToCustomFormat(expression: Array<Array<any>>): object {
convertPolygonToCustomFormat(expression: any[][]): object {
return {
[this.options.polygonKeyName] : this.convertToPolygonFormat(expression)
}

Loading…
Cancel
Save