Вход Регистрация
Файл: module-assets/admin/gmaps/lib/gmaps.native_extensions.js
Строк: 178
<?php
//==========================
// Polygon containsLatLng
// https://github.com/tparkin/Google-Maps-Point-in-Polygon
// Poygon getBounds extension - google-maps-extensions
// http://code.google.com/p/google-maps-extensions/source/browse/google.maps.Polygon.getBounds.js
if (!google.maps.Polygon.prototype.getBounds) {
  
google.maps.Polygon.prototype.getBounds = function(latLng) {
    var 
bounds = new google.maps.LatLngBounds();
    var 
paths this.getPaths();
    var 
path;

    for (var 
0paths.getLength(); p++) {
      
path paths.getAt(p);
      for (var 
0path.getLength(); i++) {
        
bounds.extend(path.getAt(i));
      }
    }

    return 
bounds;
  };
}

if (!
google.maps.Polygon.prototype.containsLatLng) {
  
// Polygon containsLatLng - method to determine if a latLng is within a polygon
  
google.maps.Polygon.prototype.containsLatLng = function(latLng) {
    
// Exclude points outside of bounds as there is no way they are in the poly
    
var bounds this.getBounds();

    if (
bounds !== null && !bounds.contains(latLng)) {
      return 
false;
    }

    
// Raycast point in polygon method
    
var inPoly false;

    var 
numPaths this.getPaths().getLength();
    for (var 
0numPathsp++) {
      var 
path this.getPaths().getAt(p);
      var 
numPoints path.getLength();
      var 
numPoints 1;

      for (var 
0numPointsi++) {
        var 
vertex1 path.getAt(i);
        var 
vertex2 path.getAt(j);

        if (
vertex1.lng() < latLng.lng() && vertex2.lng() >= latLng.lng() || vertex2.lng() < latLng.lng() && vertex1.lng() >= latLng.lng()) {
          if (
vertex1.lat() + (latLng.lng() - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < latLng.lat()) {
            
inPoly = !inPoly;
          }
        }

        
i;
      }
    }

    return 
inPoly;
  };
}

google.maps.LatLngBounds.prototype.containsLatLng = function(latLng) {
  return 
this.contains(latLng);
};

google.maps.Marker.prototype.setFences = function(fences) {
  
this.fences fences;
};

google.maps.Marker.prototype.addFence = function(fence) {
  
this.fences.push(fence);
};

google.maps.Marker.prototype.getId = function() {
  return 
this['__gm_id'];
};

//==========================
// Array indexOf
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf) {
  Array.
prototype.indexOf = function (searchElement /*, fromIndex */ ) {
      
"use strict";
      if (
this == null) {
          throw new 
TypeError();
      }
      var 
Object(this);
      var 
len t.length >>> 0;
      if (
len === 0) {
          return -
1;
      }
      var 
0;
      if (
arguments.length 1) {
          
Number(arguments[1]);
          if (
!= n) { // shortcut for verifying if it's NaN
              
0;
          } else if (
!= && != Infinity && != -Infinity) {
              
= (|| -1) * Math.floor(Math.abs(n));
          }
      }
      if (
>= len) {
          return -
1;
      }
      var 
>= Math.max(len Math.abs(n), 0);
      for (; 
lenk++) {
          if (
k in t && t[k] === searchElement) {
              return 
k;
          }
      }
      return -
1;
  }
}
?>
Онлайн: 0
Реклама