File

map/map.component.ts

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(moRealtimeService: ManagedObjectRealtimeService, mapService: MapService, layers$: Observable, defaultConfig$: Observable, translateService: TranslateService, geo: GeoService, datePipe: DatePipe, widgetGlobalAutoRefreshService: WidgetGlobalAutoRefreshService)
Parameters :
Name Type Optional
moRealtimeService ManagedObjectRealtimeService No
mapService MapService No
layers$ Observable<MapTileLayer[]> No
defaultConfig$ Observable<MapDefaultConfig> No
translateService TranslateService No
geo GeoService No
datePipe DatePipe No
widgetGlobalAutoRefreshService WidgetGlobalAutoRefreshService No

Inputs

assets
Type : PositionManagedObject | PositionManagedObject[]

Asset(s) to display as markers on the map.

config
Type : MapConfig
Default value : {}

Map configuration object (center, zoom, icon, color, etc).

polyline$
Type : Observable<[] | []>
Default value : NEVER

Observable for polyline coordinates to display on the map.

polylineOptions
Type : L.PolylineOptions

Polyline display options for the map.

Outputs

onInit
Type : EventEmitter

Emits when the map and Leaflet library are initialized.

onMap
Type : BehaviorSubject

Emits the Leaflet map instance when available.

onMove
Type : Observable<L.LeafletEvent>

Emits observable of map drag/move events.

onMoveEnd
Type : Observable<L.LeafletEvent>

Emits observable of map move end events.

onRealtimeUpdate
Type : EventEmitter

Emits when a tracked asset is updated in real-time.

onZoomEnd
Type : Observable<L.LeafletEvent>

Emits observable of map zoom end events.

onZoomStart
Type : Observable<L.LeafletEvent>

Emits observable of map zoom start events.

Methods

Protected addLayers
addLayers(layers: MapTileLayer[])
Parameters :
Name Type Optional
layers MapTileLayer[] No
Returns : void
addMarkerToMap
addMarkerToMap(marker: C8yMarker | L.Marker)

Adds a marker to the map and internal marker list.

Parameters :
Name Type Optional Description
marker C8yMarker | L.Marker No

The marker to add.

Returns : void
center
center()

Centers the map on the configured center coordinates.

Returns : void
Protected changeConfig
changeConfig(change: SimpleChange)
Parameters :
Name Type Optional
change SimpleChange No
Returns : void
clearMarkers
clearMarkers(fragment?: C8yMarkerAttributes)

Removes all markers from the map, optionally filtered by marker attribute.

Parameters :
Name Type Optional Description
fragment C8yMarkerAttributes Yes

Optional marker attribute to filter by.

Returns : void
createSpiderMarkers
createSpiderMarkers(group: GroupedPositionManagedObject, center: L.LatLng, originalMarker: C8yMarker)

Creates spider markers for a group of assets at the same position.

Parameters :
Name Type Optional Description
group GroupedPositionManagedObject No

The group of assets to create spider markers for.

center L.LatLng No

The center position of the group.

originalMarker C8yMarker No

The marker which was replaced by spider markers.

Returns : void
findMarker
findMarker(moOrId: string | IEvent | PositionManagedObject)

Finds a marker on the map by asset, event, or ID. (only if it is a C8yMarker)

Parameters :
Name Type Optional Description
moOrId string | IEvent | PositionManagedObject No

Asset, event, or string ID to search for.

The found marker or undefined.

getAssetIcon
getAssetIcon(asset: PositionManagedObject, anchor: [number, number])

Returns a Leaflet icon for the given asset, using config or asset icon and color.

Parameters :
Name Type Optional Default value Description
asset PositionManagedObject No

The asset to get the icon for.

anchor [number, number] No [8, 8]

The icon anchor point.

Returns : any

The Leaflet icon.

getAssetMarker
getAssetMarker(asset: GroupedPositionManagedObject)

Creates and returns a marker for the given asset, including icon and popup.

Parameters :
Name Type Optional Description
asset GroupedPositionManagedObject No

The asset to create a marker for.

Returns : any

The created marker.

getAssetMarkerSingle
getAssetMarkerSingle(asset: PositionManagedObject)

Creates and returns a marker for a single asset, including icon and popup.

Parameters :
Name Type Optional Description
asset PositionManagedObject No

The asset to create a marker for.

Returns : any

The created marker.

getGroupAssetIcon
getGroupAssetIcon(group: GroupedPositionManagedObject)

The icon for a group of assets (clustered). It shows the count and is colored based on the highest severity status in the group.

Parameters :
Name Type Optional Description
group GroupedPositionManagedObject No

The group of assets.

Returns : any

The marker icon for the group.

getGroupedMarker
getGroupedMarker(group: GroupedPositionManagedObject)

Returns a marker with popup for a group of assets (clustered).

Parameters :
Name Type Optional Description
group GroupedPositionManagedObject No

The asset group.

Returns : any

A marker for a group of assets (clustered).

getTrackingIcon
getTrackingIcon()

Returns a Leaflet icon for a tracking event.

Returns : any

The Leaflet icon.

getTrackingMarker
getTrackingMarker(event: IEvent)

Creates and returns a marker for a tracking event, including icon and popup.

Parameters :
Name Type Optional Description
event IEvent No

The event to create a marker for.

Returns : any

The created marker.

Protected handleMobile
handleMobile()
Returns : void
Protected hasChanged
hasChanged(change: SimpleChange, prop: unknown)
Parameters :
Name Type Optional
change SimpleChange No
prop unknown No
Returns : boolean
Protected initMap
initMap(layers: MapTileLayer[], defaultConfig: MapConfig)
Parameters :
Name Type Optional
layers MapTileLayer[] No
defaultConfig MapConfig No
Returns : void
Protected initOutputs
initOutputs()
Returns : void
moveToPositionOfMo
moveToPositionOfMo(positions: PositionManagedObject | PositionManagedObject[])

Moves the map view to the position of the given asset(s) if follow is enabled.

Parameters :
Name Type Optional Description
positions PositionManagedObject | PositionManagedObject[] No

The asset or array of assets to center the map on.

Returns : void
Protected Async ngAfterViewInit
ngAfterViewInit()
Returns : any
Protected ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
Protected ngOnDestroy
ngOnDestroy()
Returns : void
refresh
refresh()

Refreshes the map and markers if the map is initialized.

Returns : void
refreshMarkers
refreshMarkers()

Refreshes all markers on the map based on the current assets.

Returns : void
removeMarker
removeMarker(marker: C8yMarker | L.Marker)

Removes a marker from the map and internal marker list.

Parameters :
Name Type Optional Description
marker C8yMarker | L.Marker No

The marker to remove.

Returns : void
startRealtime
startRealtime()

Starts real-time updates for a single asset on the map. Updates marker position and icon as new data arrives.

Returns : void
stopRealtime
stopRealtime()

Stops real-time updates for the asset.

Returns : void
Protected toggleControls
toggleControls()
Returns : void
Protected unsubscribeAllListeners
unsubscribeAllListeners()
Returns : void

Properties

Protected destroy$
Type : unknown
Default value : new Subject<void>()
isInit
Type : unknown
Default value : false

Indicates if the map was already initialized.

leaflet
Type : unknown

The leaflet library reference used for map operations.

map
Type : L.Map

The leaflet map object instance.

mapElement
Type : ElementRef
Decorators :
@ViewChild('map')

Reference to the map DOM element.

markers
Type : Array<C8yMarker | L.Marker>
Default value : []

The markers currently placed on the map.

popup
Type : MapPopupDirective
Decorators :
@ContentChild(MapPopupDirective)

Reference to the custom popup directive for map markers.

Protected realtimeSubscription
Type : Subscription
Protected unsubscribeTrigger$
Type : unknown
Default value : new Subject<void>()
<div class="c8y-map">
  <div #map></div>
</div>
<ng-content></ng-content>

results matching ""

    No results matching ""