Changeset 9273 for src


Ignore:
Timestamp:
Jun 21, 2011, 1:19:10 PM (13 years ago)
Author:
dennisw
Message:

Added SWITCHER_COLOUR & SWITCHER_CLASS to layers. The colour part is to give the layernames their corresponding map colours. The class part is more of a test for something else I'm trying.

Location:
src/django_gheat/website/static
Files:
2 edited

Legend:

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

    r9271 r9273  
    149149        OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    150150    },
    151 
     151    SWITCHER_CLASS: "default",
    152152    CLASS_NAME: "OpenLayers.Layer.Overlay"
    153153});
     
    162162        OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    163163    },
    164 
     164    SWITCHER_COLOUR: "90,90,90",
     165    SWITCHER_CLASS: "default",
    165166    CLASS_NAME: "OpenLayers.Layer.Overlay"
    166167});
     
    175176        OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    176177    },
    177 
     178    SWITCHER_COLOUR: "255,0,0",
     179    SWITCHER_CLASS: "default",
    178180    CLASS_NAME: "OpenLayers.Layer.Overlay"
    179181});
  • src/django_gheat/website/static/heatmap_extensions.js

    r9272 r9273  
    6565          OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    6666        },
     67      SWITCHER_CLASS: "signal",
    6768      CLASS_NAME: "OpenLayers.Layer.Overlay"
    6869      });
     
    7879    testarray = map.getLayersByClass("OpenLayers.Layer.Overlay");
    7980    $.each(testarray, function(v, value){
    80       $("#filter_text").append("<span id=\"" + value.name + "\"><input type=checkbox id=togglelayer />" + value.name + " <a style='color:#FF0000' id=rmvlayer name=\"" + value.name + "\">X</a><br /></span>");
     81      colour = value.SWITCHER_COLOUR;
     82      $("#filter_text").append("<span id=\"" + value.name + "\"><input type=checkbox id=togglelayer /><font style='color:rgb(" + colour + ")'>" + value.name + " </font><a id=rmvlayer>X</a><br /></span>");
    8183    });
    8284  });
     
    8991  });
    9092
    91 
    9293  $("#rmvlayer").live("click", function(){
    93     $("#filter_text").append("<br />Removed " + this.name);
    94     layer = map.getLayersByName(this.name);
    95     console.log(rmvlayer);
     94    layername = $(this).parents('span').attr('id');
     95    layer = map.getLayersByName(layername);
     96    $("#filter_text").append("<br />Removed " + layername);
    9697    map.removeLayer(layer[0]);
    9798    $(this).parents('span').remove();
     
    134135    if(this.value=='Add userfilter'){
    135136      $.each(userlist, function(u, user){
    136         colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);
     137        colour = Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);
    137138        OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
    138139          initialize: function(name, options) {
    139140            var url = [
    140               "/website/tile/${z}/${x},${y}.png?" + colour + "&meetrondje__gebruiker__naam=" + user
     141              "/website/tile/${z}/${x},${y}.png?&colour=" + colour + "&meetrondje__gebruiker__naam=" + user
    141142            ];
    142143            options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     
    144145            OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    145146          },
     147        SWITCHER_COLOUR: colour,
     148        SWITCHER_CLASS: "user",
    146149        CLASS_NAME: "OpenLayers.Layer.Overlay"
    147150        });
     
    164167    if(this.value=='Add nodefilter'){
    165168      $.each(nodelist, function(n, node){
    166         colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);
     169        colour = Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);
    167170        OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
    168171          initialize: function(name, options) {
    169172            var url = [
    170               "/website/tile/${z}/${x},${y}.png?" + colour + "&accespoint__ssid=" + node
     173              "/website/tile/${z}/${x},${y}.png?&colour=" + colour + "&accespoint__ssid=" + node
    171174            ];
    172175            options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     
    174177            OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    175178          },
     179        SWITCHER_COLOUR: colour,
     180        SWITCHER_CLASS: "node",
    176181        CLASS_NAME: "OpenLayers.Layer.Overlay"
    177182        });
    178183        nodefilterlayer = new OpenLayers.Layer.OSM.Overlay("Node: "+ node, {isBaseLayer: false, visibility: true});
    179184        map.addLayer(nodefilterlayer);
     185        console.log(nodefilterlayer);
    180186      });
    181187      $(this).attr('value', 'Del nodefilter');
     
    235241      end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d;
    236242    }
    237     if (colour != 'NaN,NaN,NaN'){colour='colour='+colour;}
    238     else {colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);}
     243    if (colour != 'NaN,NaN,NaN'){colour=colour;}
     244    else {colour = Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);}
    239245    if (lname != ''){lname=lname;}
    240246    else {lname = 'Custom Filter';}
     
    244250      initialize: function(name, options) {
    245251        var url = [
    246           "/website/tile/${z}/${x},${y}.png?" + colour + user + dataset + wlnode + start_date + end_date
     252          "/website/tile/${z}/${x},${y}.png?&colour=" + colour + user + dataset + wlnode + start_date + end_date
    247253        ];
    248254        options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     
    250256        OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    251257      },
     258    SWITCHER_COLOURL: colour,
     259    SWITCHER_CLASS: "custom",
    252260    CLASS_NAME: "OpenLayers.Layer.Overlay"
    253261    });
Note: See TracChangeset for help on using the changeset viewer.