Changeset 7733


Ignore:
Timestamp:
Apr 13, 2010, 2:07:42 PM (13 years ago)
Author:
janveeden
Message:

Mouseover function for clusternodes done. Gives titles(id's) of each node in the cluster for now.

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

Legend:

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

    r7732 r7733  
    7979  var clusters_ = [];
    8080  var map_ = map;
    81   var maxZoom_ = null;
     81  var maxZoom_ = 15;
    8282  var me_ = this;
    8383  var gridSize_ = 60;
     
    554554      }
    555555      if (clusterMarker_ === null) {
    556         clusterMarker_ = new ClusterMarker_(center_, this.getTotalMarkers(), markerClusterer_.getStyles_(), markerClusterer_.getGridSize_());
     556        clusterMarker_ = new ClusterMarker_(center_, this.getTotalMarkers(), markerClusterer_.getStyles_(), markerClusterer_.getGridSize_(), markers_);
    557557        map_.addOverlay(clusterMarker_);
    558558      } else {
     
    605605 * @param {Number} padding Padding of marker center.
    606606 */
    607 function ClusterMarker_(latlng, count, styles, padding) {
     607function ClusterMarker_(latlng, count, styles, padding, markerArray) {
    608608  var index = 0;
     609  this.markerArray = markerArray;
    609610  var dv = count;
    610611  while (dv !== 0) {
     
    636637ClusterMarker_.prototype.initialize = function (map) {
    637638  this.map_ = map;
     639  var markerArray = this.markerArray;
    638640  var div = document.createElement("div");
    639641  var latlng = this.latlng_;
     
    670672  map.getPane(G_MAP_MAP_PANE).appendChild(div);
    671673  var padding = this.padding_;
    672   GEvent.addDomListener(div, "click", function () {
     674  GEvent.addDomListener(div, "doubleclick", function () {
    673675    var pos = map.fromLatLngToDivPixel(latlng);
    674676    var sw = new GPoint(pos.x - padding, pos.y + padding);
     
    679681    map.setCenter(latlng, zoom);
    680682  });
     683  //Jan: We add our own mouseover listener for the cluster.
     684  GEvent.addDomListener(div, "mouseover", function() {
     685          mouseOverCluster(markerArray);
     686      });
    681687  this.div_ = div;
    682688};
  • trunk/src/map/inc/nodemapWL.js

    r7732 r7733  
    3333        //This function adds a marker with an object from our 'marker'array defined in index.php
    3434        function addMarker(current, i) {
    35       var marker  = new GMarker(new GLatLng(current.latitude[0], current.longitude[0]));
     35          var id = current.id;
     36      var marker  = new GMarker(new GLatLng(current.latitude[0], current.longitude[0]), {title: id});
    3637          //Added mouseover listener that calls on our mouseOver function when the mouse moves over a marker on the map
    3738      GEvent.addListener(marker, 'mouseover', function() {
     
    4243    }
    4344       
    44         //Our mouseover function
     45        //Our mouseover function for single nodes. Gives the ID(our own given ID) and the name of the node.
    4546        function mouseOver(id, name)
    4647        {
     
    4950                obj.innerHTML = id+" - "+name;
    5051                //We will replace this function with a httprequest to a php file in the future
     52               
     53               
     54                /*
     55                *Hieronder verdergaan met dekking
     56                */
     57        }
     58       
     59        //Our mouseover function for Cluster nodes. 'markers' is an array containing all markers within the cluster
     60        function mouseOverCluster(markers)
     61        {
     62                var markerTitles = new Array;
     63                this.obj = document.getElementById("infotop");
     64                for(var i=0; i<markers.length; i++) {
     65                        markerTitles.push(markers[i].marker.getTitle()+"<br/>");
     66                }
     67                obj.innerHTML = markerTitles;
     68               
     69                /*
     70                *Hieronder verdergaan met dekking
     71                */
    5172        }
    5273
Note: See TracChangeset for help on using the changeset viewer.