map/map.component.ts
providers |
ManagedObjectRealtimeService
|
selector | c8y-map |
templateUrl | ./map.component.html |
Properties |
|
Methods |
|
Inputs |
Outputs |
constructor(moRealtimeService: ManagedObjectRealtimeService, mapService: MapService, layers$: Observable
|
|||||||||||||||||||||||||||
Parameters :
|
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. |
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. |
Protected addLayers | ||||||
addLayers(layers: MapTileLayer[])
|
||||||
Parameters :
Returns :
void
|
addMarkerToMap | ||||||||
addMarkerToMap(marker: C8yMarker | L.Marker)
|
||||||||
Adds a marker to the map and internal marker list.
Parameters :
Returns :
void
|
center |
center()
|
Centers the map on the configured center coordinates.
Returns :
void
|
Protected changeConfig | ||||||
changeConfig(change: SimpleChange)
|
||||||
Parameters :
Returns :
void
|
clearMarkers | ||||||||
clearMarkers(fragment?: C8yMarkerAttributes)
|
||||||||
Removes all markers from the map, optionally filtered by marker attribute.
Parameters :
Returns :
void
|
findMarker | ||||||||
findMarker(moOrId: string | IEvent | PositionManagedObject)
|
||||||||
Finds a marker on the map by asset, event, or ID.
Parameters :
Returns :
any
The found marker or undefined. |
getAssetIcon | ||||||||
getAssetIcon(asset: PositionManagedObject)
|
||||||||
Returns a Leaflet icon for the given asset, using config or asset icon and color.
Parameters :
Returns :
any
The Leaflet icon. |
getAssetMarker | ||||||||
getAssetMarker(asset: PositionManagedObject)
|
||||||||
Creates and returns a marker for the given asset, including icon and popup.
Parameters :
Returns :
any
The created marker. |
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 :
Returns :
any
The created marker. |
Protected handleMobile |
handleMobile()
|
Returns :
void
|
Protected hasChanged | |||||||||
hasChanged(change: SimpleChange, prop)
|
|||||||||
Parameters :
Returns :
boolean
|
Protected initMap | |||||||||
initMap(layers: MapTileLayer[], defaultConfig: MapConfig)
|
|||||||||
Parameters :
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 :
Returns :
void
|
Protected Async ngAfterViewInit |
ngAfterViewInit()
|
Returns :
any
|
Protected ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
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 :
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
|
Protected destroy$ |
Default value : new Subject<void>()
|
isInit |
Default value : false
|
Indicates if the map was already initialized. |
leaflet |
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$ |
Default value : new Subject<void>()
|
<div class="c8y-map">
<div #map></div>
</div>
<ng-content></ng-content>