Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bildMarkersForRoute: function (newMarkers) {
- console.log("WEBPassport.Views.FishkaMaps:bildMarkersForRoute");
- var $this = this;
- $this.newMarkersRadius = new Array();
- function isCheckedparters(p) {
- var checked = false;
- $this.arrSelectedPartners.forEach(function (partner_item, partner_i) {
- if (partner_item == p.partner.code) {
- checked = true;
- return false;
- }
- });
- return checked;
- }
- function isCheckedDescription(p) {
- var checked = false;
- $this.arrSelectedDescription.forEach(function (desc_item, partner_i) {
- p.location.categoryCodes.forEach(function (code, partner_i) {
- if (desc_item.code == code) {
- checked = true;
- return false;
- }
- });
- });
- return checked;
- }
- if (newMarkers) {
- if ($this.distance == 0) {
- $this.newMarkersRadius = newMarkers;
- }
- else {
- $this.routeBoxes = $this.routeBoxer.box($this.routePath, $this.distance / 2);
- for (var i = 0; i < $this.routeBoxes.length; i++) {
- for (var j = 0; j < newMarkers.length; j++) {
- if ($this.routeBoxes[i].contains(newMarkers[j].getPosition()))
- $this.newMarkersRadius.push(newMarkers[j]);
- }
- }
- }
- }
- else {
- if ($this.distance == 0) {
- for (var j = 0; j < $this.markers.length; j++) {
- if (isCheckedparters($this.markers[j]))
- $this.newMarkersRadius.push($this.markers[j]);
- }
- }
- else {
- // Convert the distance to box around the route from miles to km
- $this.routeBoxes = $this.routeBoxer.box($this.routePath, $this.distance / 2);
- for (var i = 0; i < $this.routeBoxes.length; i++) {
- for (var j = 0; j < $this.markers.length; j++) {
- if (($this.routeBoxes[i].contains($this.markers[j].getPosition()) && isCheckedparters($this.markers[j])) ||
- ($this.routeBoxes[i].contains($this.markers[j].getPosition()) && isCheckedDescription($this.markers[j]))) {
- $this.newMarkersRadius.push($this.markers[j]);
- }
- }
- }
- }
- }
- if ($this.markerCluster)
- $this.markerCluster.clearMarkers();
- $this.markerCluster = new MarkerClusterer($this.map, $this.newMarkersRadius, $this.mcOptions);
- google.maps.event.trigger($this.map, 'resize');
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement