Changeset e30d0c7 in osmose-frontend


Ignore:
Timestamp:
Mar 1, 2014 11:08:40 AM (6 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
2e41833
Parents:
c518f86
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (15/02/2014 22:09:09)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (01/03/2014 11:08:40)
Message:

Move error layer in his own plugin

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • static/map/map.js

    r0418ec7 re30d0c7  
    1111  }); 
    1212 
    13   var osmoseLayer = L.layerGroup([]); 
    14   mapOverlay['Osmose Errors'] = osmoseLayer; 
    15   var layers = L.control.layers(mapBases, mapOverlay); 
    16   map.addControl(layers); 
    17  
    1813  var scale = L.control.scale({ 
    1914    position: 'bottomright' 
     
    2621  map.addControl(menu); 
    2722  menu.show(); 
     23 
     24  var osmoseLayer = new OsmoseErrors(menu); 
     25  mapOverlay['Osmose Errors'] = osmoseLayer; 
     26  var layers = L.control.layers(mapBases, mapOverlay); 
     27  map.addControl(layers); 
    2828 
    2929  var permalink = new L.Control.Permalink({ 
     
    5555  }); 
    5656 
    57   function updateOsmoseLayer (urlPart) { 
    58     if (map.getZoom() >= 6) { 
    59       var params = { 
    60           item: urlPart.item, 
    61           level: urlPart.level, 
    62           bbox: map.getBounds().toBBoxString(), 
    63           zoom: map.getZoom() 
    64         }, 
    65         url = L.Util.getParamString(params); 
    66       $.ajax({ 
    67         url: 'markers' + url, 
    68         dataType: 'json' 
    69       }).done(function (data) { 
    70         osmoseLayer.clearLayers(); 
    71         osmoseLayer.addLayer(new OsmoseMarker(data)); 
    72       }); 
    73     } 
    74   } 
    75  
    76   map.on('moveend', function (e) { 
    77     updateOsmoseLayer(menu.urlPart()); 
    78   }, this); 
    79   menu.on('itemchanged', function (e) { 
    80     updateOsmoseLayer(e.urlPart); 
    81   }, this); 
    82  
    8357  map.on('zoomend', function (e) { 
    8458    if (map.getZoom() < 6) { 
  • views/map/index.tpl

    rf6a2ac9 re30d0c7  
    2222  <script type="text/javascript" src="{{get_url('static', filename='/map/Osmose.Menu.js')}}"></script> 
    2323  <script type="text/javascript" src="{{get_url('static', filename='/map/Osmose.Marker.js')}}"></script> 
     24  <script type="text/javascript" src="{{get_url('static', filename='/map/Osmose.Errors.js')}}"></script> 
    2425  <script type="text/javascript" src="{{get_url('static', filename='/map/map.js')}}"></script> 
    2526  <script type="text/javascript" src="{{get_url('static', filename='/map/menu.js')}}"></script> 
Note: See TracChangeset for help on using the changeset viewer.