Skip to content
Snippets Groups Projects
Commit c406c5db authored by Oleksandr Husak's avatar Oleksandr Husak
Browse files

waypoint: spelling mistake, color and message structure

parent 7d20d803
Branches master
No related tags found
No related merge requests found
......@@ -73,7 +73,7 @@ Connection settings
```
- More objects can be added to the `"object": []`
- There are special colours for objects. Config: [MarkerColorList](src/environments/environment.ts)
- topic `ipos/client/way`
- topic `ipos/client/waypoint`
- new way points
- ```json
[
......
......@@ -69,11 +69,13 @@ export class MapComponent implements OnInit {
// --- Agent waypoints
this.subsWayPoint = this._mqttService.observe('ipos/client/way').subscribe((message: IMqttMessage) => {
this.subsWayPoint = this._mqttService.observe('ipos/client/waypoint').subscribe((message: IMqttMessage) => {
try {
let points: WayPoint[] = <WayPoint[]>JSON.parse(message.payload.toString())
console.log(points)
if (!(Array.isArray(points))) {
points = [points]
}
points.forEach(wayPoint => {
if (isWayPoint(wayPoint)) {
......@@ -143,21 +145,21 @@ export class MapComponent implements OnInit {
registerWayPoint(wayPoint: WayPoint) {
// empty position
if (wayPoint.position==undefined) {
console.log("Error: empty position.")
console.log("Error: empty waypoint position.")
return
}
// empty position
if (Object.values(wayPoint.position).every((e)=>{e==undefined})) {
console.log("Error: empty point.")
console.log("Error: empty position.")
return;
}
let key = wayPoint.agentId
// --- Marker config
let serialNum = Object.keys(this.markOverlays).indexOf(key)
var markerConf = getMarkerConfig(serialNum)
// let serialNum = Object.keys(this.markOverlays).indexOf(key) // ref to markers
// var markerConf = getMarkerConfig(serialNum)
// --- Layer on the map
if (!(key in this.wayPointsOverlays)) {
......@@ -173,14 +175,13 @@ export class MapComponent implements OnInit {
}
// --- Marker
let markerDesc = `<p> \
<h4>Way point</h4>
<h3>Waypoint</h3>
<strong>Agent</strong>: ${wayPoint.agentId} <br>\
<strong>Time</strong>: ${wayPoint.time} <br>
</p>`
let marker = L.circleMarker(globPos, {radius: 5, color: markerConf.color}).bindPopup(markerDesc).openPopup();
let marker = L.circleMarker(globPos, {radius: 5, color: "#d97b16"}).bindPopup(markerDesc).openPopup();
marker.addTo(this.wayPointsOverlays[key])
}
......
......@@ -114,11 +114,11 @@ export function isAgent(obj: any): obj is Agent {
// --- Way points
export interface WayPoint {
"agentId": string
"agentType"?: AgentType
"publisher"?: string
"position": Position
"time": string
agentId: string
agentType?: AgentType
publisher?: string
position: Position
time: string
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment