Changeset 7832 for trunk/src


Ignore:
Timestamp:
Apr 18, 2010, 8:43:17 PM (15 years ago)
Author:
ddboer
Message:

created highlightCurrentMarker()

Currently only works on markers, clusters is work in progress

Location:
trunk/src/map/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/map/inc/nodemapWL.js

    r7830 r7832  
    1111var overNode;
    1212var markerSelected = "";
     13var highlightCircle;
     14var currentMarker;
    1315
    1416
     
    8284        });
    8385        GEvent.addListener(marker, 'click', function() {
     86                currentMarker = marker;
     87                  highlightCurrentMarker();     
    8488        mouseClickNode(current.id, current.name[0], marker);
    8589        });
     
    258262function mapZoomed()
    259263{
     264        highlightCurrentMarker()
    260265        if(!markerSelected == "")
    261266        {
     
    282287function deSelect()
    283288{
     289        map.removeOverlay(highlightCircle);
    284290        selected = false;
    285291        loadXMLDoc("inc/node_info.php");
  • trunk/src/map/inc/overlay.js

    r7798 r7832  
    1919    return polygon;
    2020   }
     21
     22
     23
     24function highlightCurrentMarker(){
     25var markerPoint = currentMarker.getPoint();
     26
     27var polyPoints = Array();
     28
     29if (highlightCircle) {
     30 map.removeOverlay(highlightCircle);
     31}
     32
     33var mapNormalProj = G_NORMAL_MAP.getProjection();
     34var mapZoom = map.getZoom();
     35var clickedPixel = mapNormalProj.fromLatLngToPixel(markerPoint, mapZoom);
     36
     37var polySmallRadius = 20;
     38
     39var polyNumSides = 20;
     40var polySideLength = 18;
     41
     42for (var a = 0; a<(polyNumSides+1); a++) {
     43 var aRad = polySideLength*a*(Math.PI/180);
     44 var polyRadius = polySmallRadius;
     45            var pixelX = clickedPixel.x + polyRadius * Math.cos(aRad);
     46 var pixelY = clickedPixel.y + polyRadius * Math.sin(aRad);
     47 var polyPixel = new GPoint(pixelX,pixelY);
     48 var polyPoint = mapNormalProj.fromPixelToLatLng(polyPixel,mapZoom);
     49 polyPoints.push(polyPoint);
     50}
     51// Using GPolygon(points,  strokeColor?,  strokeWeight?,  strokeOpacity?,  fillColor?,  fillOpacity?)
     52highlightCircle = new GPolygon(polyPoints,"#000000",2,0.0,"#F7FE2E",.5);
     53map.addOverlay(highlightCircle);
     54}
Note: See TracChangeset for help on using the changeset viewer.