Browse Source

refactor

features/update-page-map
Trung Nguyen 1 year ago
parent
commit
92b760102b
3 changed files with 6 additions and 5 deletions
  1. +2
    -1
      angular.json
  2. +1
    -0
      package.json
  3. +3
    -4
      src/app/modules/overview/map/map.component.ts

+ 2
- 1
angular.json View File

@@ -40,7 +40,8 @@
],
"scripts": [],
"allowedCommonJsDependencies": [
"leaflet"
"leaflet",
"leaflet.markercluster"
]
},
"configurations": {

+ 1
- 0
package.json View File

@@ -28,6 +28,7 @@
"express": "^4.19.2",
"express-ws": "^5.0.2",
"leaflet": "^1.9.4",
"leaflet.markercluster": "^1.5.3",
"ngx-toastr": "^17.0.2",
"rtsp-relay": "^1.8.0",
"rxjs": "~7.8.0",

+ 3
- 4
src/app/modules/overview/map/map.component.ts View File

@@ -160,7 +160,7 @@ const alarmData = [


const alarmDemo = {
title: ' Alarm System demo', // Thêm mới warning
title: ' Demo Alarm System', // Thêm mới warning
detail: {
position: 'Vinhomes Quận 9',
coordinates: {
@@ -232,10 +232,10 @@ export class MapComponent implements OnInit, AfterViewInit, OnDestroy {
}

onMessage(message: any) {
if (message.id === '0' && message.type === 'get') {
if (message.id == '0' && message.type === 'get') {
this.state1 = message.state1 === '0';// 1 OFF // alarm 12h
this.state2 = message.state2 === '0'; // 1 OFF // alarm 1h
this.state5 = message.state5 === '1';// alarm 9h && 6h // 1 ON, 0 OFF
this.state5 = message.state5 === '1';// 1 ON, 0 OFF
this.isReady = message.ready === '1';
this.updateIcons();
}
@@ -251,7 +251,6 @@ export class MapComponent implements OnInit, AfterViewInit, OnDestroy {
.bindPopup(this.popupDetail(item))
.addTo(this.markers);
});

const iconDemo = this.getIcon(this.state5, this.isReady, this.state1, this.state2);
L.marker([this.alarmDemo.detail.coordinates.lat,this.alarmDemo.detail.coordinates.lng], { icon: iconDemo })
.bindPopup(this.popupDetail(this.alarmDemo))

Loading…
Cancel
Save