Changeset 9275


Ignore:
Timestamp:
Jun 22, 2011, 10:46:13 AM (14 years ago)
Author:
dennisw
Message:

Added signallayer to default layers. Removed the ability to remove default layers.

Location:
src/django_gheat/website
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/website/static/OpenStreetMap.js

    r9274 r9275  
    178178    CLASS_NAME: "OpenLayers.Layer.Overlay"
    179179});
     180
     181OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
     182  initialize: function(name, options) {
     183    var url = [
     184      "/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100"
     185    ];
     186    options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     187    var newArguments = [name, url, options];
     188    OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
     189  },
     190  colour: "250,250,0",
     191  CLASS_NAME: "OpenLayers.Layer.Overlay"
     192});
  • src/django_gheat/website/static/heatmap.js

    r9274 r9275  
    5353  map.setCenter (lonLat, zoom);
    5454
    55   $("#default").append("<span id=\"" + layerHeatmap.name + "\"><input type=checkbox id=togglelayer /><font style='color:rgb(" + layerHeatmap.colour + ")'>" + layerHeatmap.name + " </font><a id=rmvlayer>X</a><br /></span>");
     55  signallayer = new OpenLayers.Layer.OSM.Overlay4("signallayer", {isBaseLayer: false, visibility: true});
     56  map.addLayer(signallayer);
    5657
    57   $("#default").append("<span id=\"" + layerHeatmap2.name + "\"><input type=checkbox id=togglelayer checked/><font style='color:rgb(" + layerHeatmap2.colour + ")'>" + layerHeatmap2.name + " </font><a id=rmvlayer>X</a><br /></span>");
     58  $("#default").append("<span id=\"" + layerHeatmap.name + "\"><input type=checkbox id=togglelayer /><font style='color:rgb(" + layerHeatmap.colour + ")'>" + layerHeatmap.name + " </font><br /></span>");
    5859
    59   $("#default").append("<span id=\"" + layerHeatmap3.name + "\"><input type=checkbox id=togglelayer checked/><font style='color:rgb(" + layerHeatmap3.colour + ")'>" + layerHeatmap3.name + " </font><a id=rmvlayer>X</a><br /></span>");
     60  $("#default").append("<span id=\"" + layerHeatmap2.name + "\"><input type=checkbox id=togglelayer checked/><font style='color:rgb(" + layerHeatmap2.colour + ")'>" + layerHeatmap2.name + " </font><br /></span>");
    6061
     62  $("#default").append("<span id=\"" + layerHeatmap3.name + "\"><input type=checkbox id=togglelayer checked/><font style='color:rgb(" + layerHeatmap3.colour + ")'>" + layerHeatmap3.name + " </font><br /></span>");
    6163
    62 
    63 
     64  $("#default").append("<span id=\"" + signallayer.name + "\"><input type=checkbox id=togglelayer checked /><font style='color:rgb(" + signallayer.colour + ")'>Signal strength: 0 - 100</font><br /></span>");
    6465}
  • src/django_gheat/website/static/heatmap_extensions.js

    r9274 r9275  
    5050    slide: function(event, sig){
    5151      $("#sig_value").text("Signal strength: " + sig.values[0] + " - " + sig.values[1]);
     52      $("#signallayer font").text("Signal strength: " + sig.values[0] + " - " + sig.values[1]);
    5253    },
    5354    // on slider stop, it tries to delete the old layer and creates a new layer with the slider values
    5455    stop: function(event, sig){
    55       if(signallayer){
    56         map.removeLayer(signallayer);
    57       }
    58       OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
    59         initialize: function(name, options) {
    60           var url = [
    61             "/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=" + sig.values[0] + "&signaal__lte=" + sig.values[1]
    62           ];
    63           options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
    64           var newArguments = [name, url, options];
    65           OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    66         },
    67       CLASS_NAME: "OpenLayers.Layer.Overlay"
    68       });
    69       lname = "Signal strength: " + sig.values[0] + " - " + sig.values[1];
    70       signallayer = new OpenLayers.Layer.OSM.Overlay(lname, {isBaseLayer: false, visibility: true});
    71       map.addLayer(signallayer);
     56      signallayer = map.getLayersByName('signallayer');
     57      console.log(signallayer[0]);
     58      signallayer[0].setUrl("/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=" + sig.values[0] + "&signaal__lte=" + sig.values[1]);
     59      signallayer[0].redraw();
    7260    },
    7361  });
  • src/django_gheat/website/templates/home.html

    r9274 r9275  
    5959  </div>
    6060  <div id="layer_switcher">
    61     <div id="layer_switcher_cat">Base layers</div><p><span id="default"></span><p>
     61    <div id="layer_switcher_cat">Default layers</div><p><span id="default"></span><p>
    6262    <div id="layer_switcher_cat">Nodes</div><p><span id="node"></span><input type="button" id="node_filter" value="Add nodefilter"/><br /><p>
    6363    <div id="layer_switcher_cat">Users</div><p><span id="user"></span><input type="button" id="user_filter" value="Add userfilter"/><br /><P>
Note: See TracChangeset for help on using the changeset viewer.