From 6c0d7e512c585fe159aa30c8bb844b02bb9d99be Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 28 Mar 2017 14:15:02 +0500 Subject: Move map related classes to subfolder --- web/app/view/map/Map.js | 140 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 web/app/view/map/Map.js (limited to 'web/app/view/map/Map.js') diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js new file mode 100644 index 0000000..d4e654e --- /dev/null +++ b/web/app/view/map/Map.js @@ -0,0 +1,140 @@ +/* + * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +Ext.define('Traccar.view.map.Map', { + extend: 'Traccar.view.map.BaseMap', + xtype: 'mapView', + + requires: [ + 'Traccar.view.map.MapController', + 'Traccar.view.SettingsMenu' + ], + + controller: 'map', + + title: Strings.mapTitle, + tbar: { + componentCls: 'toolbar-header-style', + defaults: { + xtype: 'button', + tooltipType: 'title', + stateEvents: ['toggle'], + enableToggle: true, + stateful: { + pressed: true + } + }, + items: [{ + xtype: 'tbtext', + html: Strings.mapTitle, + baseCls: 'x-panel-header-title-default' + }, { + xtype: 'tbfill' + }, { + handler: 'showReports', + reference: 'showReportsButton', + glyph: 'xf0f6@FontAwesome', + stateful: false, + enableToggle: false, + tooltip: Strings.reportTitle + }, { + handler: 'updateGeofences', + reference: 'showGeofencesButton', + glyph: 'xf21d@FontAwesome', + pressed: true, + stateId: 'show-geofences-button', + tooltip: Strings.sharedGeofences + }, { + handler: 'showLiveRoutes', + reference: 'showLiveRoutes', + glyph: 'xf1b0@FontAwesome', + stateId: 'show-live-routes-button', + tooltip: Strings.mapLiveRoutes + }, { + reference: 'deviceFollowButton', + glyph: 'xf05b@FontAwesome', + tooltip: Strings.deviceFollow, + stateId: 'device-follow-button', + toggleHandler: 'onFollowClick' + }, { + id: 'soundButton', + glyph: 'xf0a2@FontAwesome', + tooltip: Strings.sharedSound, + stateId: 'sound-button' + }, { + xtype: 'settingsMenu', + enableToggle: false + }] + }, + + getMarkersSource: function () { + return this.markersSource; + }, + + getAccuracySource: function () { + return this.accuracySource; + }, + + getRouteSource: function () { + return this.routeSource; + }, + + getGeofencesSource: function () { + return this.geofencesSource; + }, + + getLiveRouteSource: function () { + return this.liveRouteSource; + }, + + getLiveRouteLayer: function () { + return this.liveRouteLayer; + }, + + initMap: function () { + this.callParent(); + + this.geofencesSource = new ol.source.Vector({}); + this.map.addLayer(new ol.layer.Vector({ + name: 'geofencesLayer', + source: this.geofencesSource + })); + + this.liveRouteSource = new ol.source.Vector({}); + this.liveRouteLayer = new ol.layer.Vector({ + source: this.liveRouteSource, + visible: false + }); + this.map.addLayer(this.liveRouteLayer); + + this.routeSource = new ol.source.Vector({}); + this.map.addLayer(new ol.layer.Vector({ + source: this.routeSource + })); + + this.accuracySource = new ol.source.Vector({}); + this.map.addLayer(new ol.layer.Vector({ + name: 'accuracyLayer', + source: this.accuracySource + })); + + this.markersSource = new ol.source.Vector({}); + this.map.addLayer(new ol.layer.Vector({ + source: this.markersSource + })); + } +}); -- cgit v1.2.3