0.5.1 • Published 4 years ago
ponton-map-library v0.5.1
Ponton Map Library
An angular library to help create maps for the Ponton system.
Install
Install by running the following the command:
npm install ponton-map-libraryThe dependencies get installed automatically, but you have to include their stylesheets manually. Stylesheets that needs to be added:
"node_modules/leaflet/dist/leaflet.css",Usage
Import PontonMapLibraryModule into your app or feature module:
import { PontonMapLibraryModule } from 'ponton-map-library';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
PontonMapLibraryModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }The library provides a single component called PontonMapLibraryComponent. A map can be created through this component.
<ponton-map
style="width: 100%"
[floorplan]="img"
[floorplanConfig]="mapSettings"
[tagList]="mapTags"
[selectedTag]="selectedTagMarker"
(mapLoaded)="mapLoaded()"
(tagSelected)="tagSelectedMarker($event)"
>Reference
PontonMapLibraryComponent
Attributes
| Attribute | Type | Descriptpion |
|---|---|---|
| floorplan | Blob | Image blob received from the backend |
| floorplanConfig | FloorplanConfigModel | Config for setting the floorplan properly |
| tagList | TagModel[] | Tags to display |
| selecetedTag | TagModel | The selected tag |
Events | Event | Type | Descriptpion | ------------- |:-------------:| :-------------:| | mapLoaded | simple event | Fired when the map finished loading. | | tagSelected | TagModel | Fired when a tag is selected (clicked) on the map.|
Models
FloorPlanConfig
| Attribute | Type | Descriptpion |
|---|---|---|
| width | number | width of area (in meters) |
| height | number | height of area (in meters) |
| xOffset | number | offset of X axis (in meters) |
| yOffset | number | offset of Y axis (in meters) |
Tag
id: 4967 pos: ts: "2021-06-14T18:55:31.598066" x: 5.794398875598649 y: 2.2591296950107456 z: 0.9049999999999999 tag_id: 4967
| Attribute | Type | Descriptpion |
|---|---|---|
| id | number | id in the DB |
| pos | positionData | (x,y,z, timestamp) |
| tag_id | number | id of the Tag |