VladyCoder преди 5 години
родител
ревизия
fac17a312a
променени са 3 файла, в които са добавени 39 реда и са изтрити 34 реда
  1. 6 2
      src/components/LeafletMap/LElement.js
  2. 3 2
      src/views/LMaps/mapfunctions.js
  3. 30 30
      src/views/LMaps/tempData.js

+ 6 - 2
src/components/LeafletMap/LElement.js

@@ -18,7 +18,7 @@ class LElement {
         this._trackStatus = false;
         this._updateTrack();
 
-        if(this._marker) this._marker.remove();
+        if(this._marker) this._removeFromMap();
         this._marker = null;
         this._marker = this._createMarker();
 
@@ -228,7 +228,11 @@ class LElement {
     }
 
     _removeFromMap(){
-        this._marker.remove();
+        let pOptions = this._parent.options;
+        if(pOptions.clustering) this._parent.clusterGroup.removeLayer(this._marker);
+        else this._marker.remove();
+
+        this.hideTrack();
     }
 
     on(event, callback, target){

+ 3 - 2
src/views/LMaps/mapfunctions.js

@@ -15,7 +15,7 @@ export default class MapFunctions extends React.Component{
             elevation: true,
             geosearch: true,
             routing: true,
-            language: 'ES'
+            language: 'EN'
         });
 
         this.positionMap.addTileLayers([ '_OPENSTREET_', '_OPENTOPO_', '_AERIAL_', '_TERRAIN_', '_TRAFFIC_' ],{
@@ -24,6 +24,7 @@ export default class MapFunctions extends React.Component{
             maxNativeZoom: 17,
         });
         
+        ////********* function for map *///////////
         this.positionMap.addElements(data.map_elem);
 
         var _allEl = this.positionMap.getAllElements();
@@ -45,7 +46,7 @@ export default class MapFunctions extends React.Component{
         var _zone = this.positionMap.getZoneByName('Zone');
         console.log('zone', _zone);
 
-
+        ///////******* functions for Element *****////////
         var curStatus = _oneEl.getStatus();
         console.log('element status', curStatus);
 

+ 30 - 30
src/views/LMaps/tempData.js

@@ -34,12 +34,12 @@ export var data = {
                 tags: ['is_car', 'is_beatiful', 'has_wheels']
             },
             data: [
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444}
+                {cord: '49.7580791,13.3540124', timestamp: 2342342444},
+                {cord: '49.6580791,13.3540124', timestamp: 2342342444},
+                {cord: '49.6580791,13.2540124', timestamp: 2342342444},
+                {cord: '49.5580791,13.2540124', timestamp: 2342342444},
+                {cord: '49.5580791,13.1540124', timestamp: 2342342444},
+                {cord: '49.4580791,13.1540124', timestamp: 2342342444}
             ]
         },
         {
@@ -54,12 +54,12 @@ export var data = {
                 tags: ['is_car', 'is_beatiful', 'has_wheels']
             },
             data: [
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444}
+                {cord: '46.9547232,7.3598507', timestamp: 2342342444},
+                {cord: '46.9547232,7.4598507', timestamp: 2342342444},
+                {cord: '46.8547232,7.4598507', timestamp: 2342342444},
+                {cord: '46.8547232,7.5598507', timestamp: 2342342444},
+                {cord: '46.7547232,7.5598507', timestamp: 2342342444},
+                {cord: '46.7547232,7.6598507', timestamp: 2342342444}
             ]
         },
         {
@@ -74,12 +74,12 @@ export var data = {
                 tags: ['is_car', 'is_beatiful', 'has_wheels']
             },
             data: [
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444}
+                {cord: '47.5546492,7.5594406', timestamp: 2342342444},
+                {cord: '47.6546492,7.5594406', timestamp: 2342342444},
+                {cord: '47.6546492,7.6594406', timestamp: 2342342444},
+                {cord: '47.4546492,7.6594406', timestamp: 2342342444},
+                {cord: '47.4546492,7.7594406', timestamp: 2342342444},
+                {cord: '47.3546492,7.7594406', timestamp: 2342342444}
             ]
         },
         {
@@ -94,12 +94,12 @@ export var data = {
                 tags: ['is_car', 'is_beatiful', 'has_wheels']
             },
             data: [
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444}
+                {cord: '46.5285767,6.5824555', timestamp: 2342342444},
+                {cord: '46.6285767,6.6824555', timestamp: 2342342444},
+                {cord: '46.7285767,6.7824555', timestamp: 2342342444},
+                {cord: '46.8285767,6.6824555', timestamp: 2342342444},
+                {cord: '46.9285767,6.5824555', timestamp: 2342342444},
+                {cord: '46.7285767,6.4824555', timestamp: 2342342444}
             ]
         },
         {
@@ -114,12 +114,12 @@ export var data = {
                 tags: ['is_car', 'is_beatiful', 'has_wheels']
             },
             data: [
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444},
-                {cord: '32.434343, 43.043043', timestamp: 2342342444}
+                {cord: '46.0295228,8.9216256', timestamp: 2342342444},
+                {cord: '46.5295228,8.5216256', timestamp: 2342342444},
+                {cord: '46.7295228,8.4216256', timestamp: 2342342444},
+                {cord: '46.4295228,8.6216256', timestamp: 2342342444},
+                {cord: '46.6295228,8.4216256', timestamp: 2342342444},
+                {cord: '46.7295228,8.2216256', timestamp: 2342342444}
             ]
         },