|
|
@ -42,7 +42,7 @@ import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; |
|
|
import { AttributeService } from '@core/http/attribute.service'; |
|
|
import { AttributeService } from '@core/http/attribute.service'; |
|
|
import { Type } from '@angular/core'; |
|
|
import { Type } from '@angular/core'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
import { TranslateService } from '@ngx-translate/core'; |
|
|
import { UtilsService } from '@app/core/services/utils.service'; |
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
|
|
|
|
|
|
// @dynamic
|
|
|
// @dynamic
|
|
|
export class MapWidgetController implements MapWidgetInterface { |
|
|
export class MapWidgetController implements MapWidgetInterface { |
|
|
@ -85,26 +85,27 @@ export class MapWidgetController implements MapWidgetInterface { |
|
|
public static getProvidersSchema(mapProvider: MapProviders) { |
|
|
public static getProvidersSchema(mapProvider: MapProviders) { |
|
|
mapProviderSchema.schema.properties.provider.default = mapProvider; |
|
|
mapProviderSchema.schema.properties.provider.default = mapProvider; |
|
|
return mergeSchemes([mapProviderSchema, |
|
|
return mergeSchemes([mapProviderSchema, |
|
|
...Object.values(providerSets)?.map( |
|
|
...Object.keys(providerSets)?.map( |
|
|
(setting: IProvider) => addCondition(setting?.schema, `model.provider === '${setting.name}'`))]); |
|
|
(key: string) => { const setting = providerSets[key]; return addCondition(setting?.schema, `model.provider === '${setting.name}'`) })]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static settingsSchema(mapProvider: MapProviders, drawRoutes: boolean): JsonSettingsSchema { |
|
|
public static settingsSchema(mapProvider: MapProviders, drawRoutes: boolean): JsonSettingsSchema { |
|
|
const schema = initSchema(); |
|
|
const schema = initSchema(); |
|
|
addToSchema(schema, this.getProvidersSchema(mapProvider)); |
|
|
addToSchema(schema, this.getProvidersSchema(mapProvider)); |
|
|
if(mapProvider!=='image-map'){ |
|
|
if (mapProvider !== 'image-map') { |
|
|
addGroupInfo(schema, 'Map Provider Settings'); |
|
|
addGroupInfo(schema, 'Map Provider Settings'); |
|
|
addToSchema(schema, mergeSchemes([commonMapSettingsSchema, addCondition(mapPolygonSchema, 'model.showPolygon === true')])); |
|
|
addToSchema(schema, mergeSchemes([commonMapSettingsSchema, addCondition(mapPolygonSchema, 'model.showPolygon === true')])); |
|
|
addGroupInfo(schema, 'Common Map Settings'); |
|
|
addGroupInfo(schema, 'Common Map Settings'); |
|
|
if (drawRoutes) { |
|
|
if (drawRoutes) { |
|
|
addToSchema(schema, routeMapSettingsSchema); |
|
|
addToSchema(schema, routeMapSettingsSchema); |
|
|
addGroupInfo(schema, 'Route Map Settings'); |
|
|
addGroupInfo(schema, 'Route Map Settings'); |
|
|
} else if (mapProvider !== 'image-map') { |
|
|
} else if (mapProvider !== 'image-map') { |
|
|
const clusteringSchema = mergeSchemes([markerClusteringSettingsSchema, |
|
|
const clusteringSchema = mergeSchemes([markerClusteringSettingsSchema, |
|
|
addCondition(markerClusteringSettingsSchemaLeaflet, `model.useClusterMarkers === true`)]) |
|
|
addCondition(markerClusteringSettingsSchemaLeaflet, `model.useClusterMarkers === true`)]) |
|
|
addToSchema(schema, clusteringSchema); |
|
|
addToSchema(schema, clusteringSchema); |
|
|
addGroupInfo(schema, 'Markers Clustering Settings'); |
|
|
addGroupInfo(schema, 'Markers Clustering Settings'); |
|
|
}} |
|
|
} |
|
|
|
|
|
} |
|
|
return schema; |
|
|
return schema; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -125,7 +126,7 @@ export class MapWidgetController implements MapWidgetInterface { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
translate = (key: string, defaultTranslation?: string):string => { |
|
|
translate = (key: string, defaultTranslation?: string): string => { |
|
|
return (this.ctx.$injector.get(UtilsService).customTranslation(key, defaultTranslation || key) |
|
|
return (this.ctx.$injector.get(UtilsService).customTranslation(key, defaultTranslation || key) |
|
|
|| this.ctx.$injector.get(TranslateService).instant(key)); |
|
|
|| this.ctx.$injector.get(TranslateService).instant(key)); |
|
|
} |
|
|
} |
|
|
@ -143,7 +144,7 @@ export class MapWidgetController implements MapWidgetInterface { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private onCustomAction(descriptor: WidgetActionDescriptor, $event: any) { |
|
|
private onCustomAction(descriptor: WidgetActionDescriptor, $event: any) { |
|
|
if ($event & $event.stopPropagation) { |
|
|
if ($event && $event.stopPropagation) { |
|
|
$event?.stopPropagation(); |
|
|
$event?.stopPropagation(); |
|
|
} |
|
|
} |
|
|
// safeExecute(parseFunction(descriptor.customFunction, ['$event', 'widgetContext']), [$event, this.ctx])
|
|
|
// safeExecute(parseFunction(descriptor.customFunction, ['$event', 'widgetContext']), [$event, this.ctx])
|
|
|
|