Changeset 8303 in genesis for nodes/nodemap.html


Ignore:
Timestamp:
Aug 10, 2010, 6:21:48 PM (14 years ago)
Author:
rick
Message:

Opacity dynamic set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nodes/nodemap.html

    r8292 r8303  
    1616    <script>
    1717      var map, rulerControl;
     18      var mapnik, wms;
    1819      var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
    1920      var projection_smp = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator Projection
    2021
     22      var current_opacity = 0.5;
     23      var max_opacity = 0.9;
     24      var min_opacity = 0.1;
     25
     26
     27      function setOpacity(new_opacity) {
     28          current_opacity = new_opacity;
     29          mapnik.setOpacity(new_opacity);
     30          wms.setOpacity(new_opacity);
     31      }
     32
     33      function changeOpacity(by_opacity) {
     34          var new_opacity = current_opacity + by_opacity;
     35          new_opacity = Math.min(max_opacity, Math.max(min_opacity, new_opacity));
     36          setOpacity(new_opacity);
     37      }
     38
    2139      function init() {
    2240        map = new OpenLayers.Map("basicMap");
    2341
    2442        var world_bound = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34);
    25         var mapnik = new OpenLayers.Layer.OSM("OpenStreepMap");
     43        // Development focus maps
     44        mapnik = new OpenLayers.Layer.OSM("OpenStreetMap");
     45        wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
     46                "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
     47
     48        // Added extra's
    2649        var google_sat = new OpenLayers.Layer.Google("Google Satellite" ,
    2750           { type: G_SATELLITE_MAP,
    2851             sphericalMercator: true,
    2952             maxExtent: world_bound,
    30              wrapDateLine: false});
     53             wrapDateLine: false,
     54           });
    3155        var google_normal = new OpenLayers.Layer.Google("Google Normal" ,
    3256           { type: G_NORMAL_MAP,
    3357             sphericalMercator: true,
    3458             maxExtent: world_bound,
    35              wrapDateLine: false});
    36 
    37         var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
    38                 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
    39 
    40         map.addLayers([mapnik, google_sat, wms, google_normal]);
    41         //map.setCenter(new OpenLayers.LonLat(4.40,52.186), 9);
    42 
     59             wrapDateLine: false
     60           });
     61
     62       
     63        map.addLayers([mapnik, wms, google_sat, google_normal]);
     64        setOpacity(0.5);
    4365        defaultFocus();
    4466
     
    256278          <li>holding down shift, whilst dragging the mouse to do box zooming</li>
    257279          <li>Keyboard Navigation is enabled</li>
     280          <li>Contrast of background: <a title="decrease opacity" href="javascript: changeOpacity(-0.1);">Decrease</a> or <a title="increase opacity" href="javascript: changeOpacity(0.1);">Increase</a></li>
     281
     282
    258283        </ul>
    259284      </div>
Note: See TracChangeset for help on using the changeset viewer.