Ejemplo n.º 1
0
 /**
  * Check if bounds intersects.
  *
  * @param LatLngBounds $other The other bounds.
  *
  * @return bool
  */
 public function intersects(LatLngBounds $other)
 {
     $southWest = $other->getSouthWest();
     $northEast = $other->getNorthEast();
     $latOverlaps = $northEast->getLatitude() >= $this->southWest->getLatitude() && $southWest->getLatitude() <= $this->northEast->getLatitude();
     $lngOverlaps = $northEast->getLongitude() >= $this->southWest->getLongitude() && $southWest->getLongitude() <= $northEast->getLongitude();
     return $latOverlaps && $lngOverlaps;
 }
Ejemplo n.º 2
0
h3('toUrlValue()');
p($bounds->toUrlValue());
h3('intersects(sydney, newyork)');
p($bounds->intersects($bounds2));
h3('union(sydney, newyork)');
p($bounds->union($bounds2)->toString());
h2("LatLngBounds class: maximum bounds in GMaps");
$bounds3 = new LatLngBounds(new LatLng(-85.051128779807, -180), new LatLng(85.051128779807, 180));
h3("Constructor (new LatLng(-85.051128779807, -180), new LatLng(85.051128779807, 180))");
p($bounds3->toString());
h3("getCenter()");
p($bounds3->getCenter()->toString());
h3("getSouthWest()");
p($bounds3->getSouthWest()->toString());
h3("getNorthEast()");
p($bounds3->getNorthEast()->toString());
h3('contains(moscow)');
p($bounds3->contains($moscow));
h3('contains(sydney)');
p($bounds3->contains($sydney));
h3('contains(buenosaires)');
p($bounds3->contains($buenosaires));
h2('Spherical geometry static class');
h3('computeArea(london, donostia, newyork)');
p(float_to_string(SphericalGeometry::computeArea(array($london, $donostia, $newyork))));
h3('computeSignedArea(london, donostia, newyork)');
p(float_to_string(SphericalGeometry::computeSignedArea(array($london, $donostia, $newyork))));
h3('computeDistanceBetween(london, newyork)');
p(float_to_string(SphericalGeometry::computeDistanceBetween($london, $newyork)));
h3('computeHeading(london, newyork)');
p(float_to_string(SphericalGeometry::computeHeading($london, $newyork)));
Ejemplo n.º 3
0
 /**
  * Compare two bounds.
  *
  * @param LatLngBounds $other The other bounds.
  *
  * @return bool
  */
 public function equals(LatLngBounds $other)
 {
     if (!$this->getNorthEast()->equals($other->getNorthEast())) {
         return false;
     }
     return $this->getSouthWest()->equals($other->getSouthWest());
 }