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

], ],
"scripts": [], "scripts": [],
"allowedCommonJsDependencies": [ "allowedCommonJsDependencies": [
"leaflet"
"leaflet",
"leaflet.markercluster"
] ]
}, },
"configurations": { "configurations": {

+ 1
- 0
package.json View File

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

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





const alarmDemo = { const alarmDemo = {
title: ' Alarm System demo', // Thêm mới warning
title: ' Demo Alarm System', // Thêm mới warning
detail: { detail: {
position: 'Vinhomes Quận 9', position: 'Vinhomes Quận 9',
coordinates: { coordinates: {
} }


onMessage(message: any) { 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.state1 = message.state1 === '0';// 1 OFF // alarm 12h
this.state2 = message.state2 === '0'; // 1 OFF // alarm 1h 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.isReady = message.ready === '1';
this.updateIcons(); this.updateIcons();
} }
.bindPopup(this.popupDetail(item)) .bindPopup(this.popupDetail(item))
.addTo(this.markers); .addTo(this.markers);
}); });

const iconDemo = this.getIcon(this.state5, this.isReady, this.state1, this.state2); 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 }) L.marker([this.alarmDemo.detail.coordinates.lat,this.alarmDemo.detail.coordinates.lng], { icon: iconDemo })
.bindPopup(this.popupDetail(this.alarmDemo)) .bindPopup(this.popupDetail(this.alarmDemo))

Loading…
Cancel
Save