Changeset 8471 in genesis for nodes/nodemap.html


Ignore:
Timestamp:
Sep 19, 2010, 10:18:48 AM (14 years ago)
Author:
rick
Message:

Coordinate converter with alert was not very user friendy, converted to infofield clickable setup.

Thanks to Martijn for feedback!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nodes/nodemap.html

    r8469 r8471  
    6868      }
    6969     
    70       OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {               
     70      OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
    7171          defaultHandlerOptions: {
    7272              'single': true,
     
    9595              lonlat = lonlat.transform( projection_smp, projection_wgs);
    9696              var url = coordConvert(lonlat.lon, lonlat.lat);
    97               alert("You clicked near " + lonlat.lon + " N, " + lonlat.lat + " E\n\n" +
    98               'Copy/paste URL in NEW browser window to get your RDNAP coordinates\n\n'  + url);
     97              document.getElementById('coordOutput').href = url;
     98               document.getElementById('coordOutput').innerHTML = Math.round(lonlat.lon * 1000) / 1000 + " N, " + Math.round(lonlat.lat * 1000) / 1000 + " E";
    9999          }
    100100     
     
    291291     
    292292     
    293         var vectors = new OpenLayers.Layer.Vector("Vector Layer");
    294         map.addLayer(vectors);
     293        // XXX: Enable if we found some use for it somewhere
     294        // var vectors = new OpenLayers.Layer.Vector("Vector Layer");
     295        // map.addLayer(vectors);
     296        // map.addControl(new OpenLayers.Control.EditingToolbar(vectors));
     297
    295298        map.addControl(new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }));
    296         map.addControl(new OpenLayers.Control.EditingToolbar(vectors));
    297299        map.addControl(new OpenLayers.Control.LayerSwitcher());
    298300        map.addControl(new OpenLayers.Control.OverviewMap());
     
    389391      }
    390392     
    391      
    392      
    393      
     393      function toggleFieldById(field) {
     394        var e = document.getElementById(field);
     395        if (e.style.visibility == "hidden") {
     396          e.style.visibility = "visible";
     397        } else {
     398          e.style.visibility = "hidden";
     399        }
     400      }
    394401     
    395402      function toggleClickControl() {
     403          toggleFieldById('coordField');
    396404          if (!clickControl.active) {
    397405             clickControl.activate();
     
    404412      }
    405413     
     414
    406415      function toggleRulerControl() {
    407416          if (!rulerControl.active) {
     
    419428      }
    420429     
    421       function toggleInfo() {
    422         var e = document.getElementById('infofield');
    423         if (e.style.visibility == "hidden") {
    424           e.style.visibility = "visible";
    425         } else {
    426           e.style.visibility = "hidden";
    427         }
    428       }
    429      
    430      
    431430      // http://openlayers.org/dev/examples/strategy-cluster-threshold.html
    432431      // ]]>
     
    438437    <div id="basicMap">
    439438      <div id="controller" style="position: absolute; top: 10px; left : 80px; z-index:1004">
    440           <img id="ruler" src="ruler_off.png" onclick="toggleRulerControl()" alt="ruler"/>
     439          <img id="ruler" src="ruler_off.png"
     440                  onclick="toggleRulerControl()" alt="ruler" title="Measure distance between points"/>
    441441          <img height="22" src="http://maps.google.com/mapfiles/kml/pal3/icon23.png" title="Reset focus" onclick="defaultFocus()" alt="Focus reset" />
    442442          <img height="22"
    443443                  src="http://maps.google.com/mapfiles/kml/pal3/icon36.png"
    444                   title="Information" onclick="toggleInfo()" alt="information" />
     444                  title="Information" onclick="toggleFieldById('infoField')" alt="information" />
    445445          <img id="click" height="22"
    446446                  src="http://maps.google.com/mapfiles/kml/pal3/icon28.png"
    447                   title="Coordinate converter" onclick="toggleClickControl()"
     447                  title="Get RD coordinates for use in Genesis" onclick="toggleClickControl()"
    448448                  alt="coordinate converter"/>
    449449          <div id="output"></div>
    450450      </div>
    451       <div id="infofield" style="position: absolute; bottom: 40px; left : 10px; z-index:1004; background-color: red; visibility: hidden">
     451      <div id="infoField" style="position: absolute; bottom: 40px; left : 10px; z-index:1004; background-color: red; visibility: hidden">
    452452        <ul>
    453453          <li>holding down shift, whilst dragging the mouse to do box zooming</li>
     
    462462  </p>
    463463      </div>
     464      <div id="coordField" style="position: absolute; bottom: 40px; left : 10px; z-index:1005; background-color: green; visibility: hidden">
     465      Click on a location on the map to receive a link to calculate the RD coordinates: <br />
     466      <a id="coordOutput" href="#" target="_blank">Click on MAP first</a>
     467     </div>
    464468    </div>
    465469  </body>
Note: See TracChangeset for help on using the changeset viewer.