h3('extend(london, donostia, newyork)');
p($bounds->extend($london)->toString());
p($bounds->extend($donostia)->toString());
p($bounds->extend($newyork)->toString());
h3('isEmpty()');
p($bounds->isEmpty());
h3('toSpan()');
p($bounds->toSpan()->toString());
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');
p($bounds->getNorthEast()->toString());
h3('contains(moscow)');
p($bounds->contains($moscow));
h3('contains(donostia)');
p($bounds->contains($donostia));
h3('contains(sydney)');
p($bounds->contains($sydney));
h3('equals((buenosaires, moscow))');
p($bounds->equals($bounds));
h3('equals((sydney, newyork))');
p($bounds->equals($bounds2));
h3('Sw only constructor (london)');
$bounds = new LatLngBounds($london);
p($bounds->toString());
h3('empty constructor ( , )');
$bounds = new LatLngBounds();
p($bounds->toString());
h3('isEmpty()');
p($bounds->isEmpty());
h3('extend(london, donostia, newyork)');
p($bounds->extend($london)->toString());
p($bounds->extend($donostia)->toString());
p($bounds->extend($newyork)->toString());
h3('isEmpty()');
p($bounds->isEmpty());
h3('toSpan()');
p($bounds->toSpan()->toString());
h3('toUrlValue()');
p($bounds->toUrlValue());
h3('intersects(sydney, newyork)');
p($bounds->intersects($bounds2));
 /**
  * Check if given object in in the bounds.
  *
  * @param LatLng|LatLngBounds $object The given object.
  *
  * @return bool
  * @throws \RuntimeException If LatLngBounds is checked. Not implemented yet.
  */
 public function contains($object)
 {
     if ($object instanceof LatLng) {
         $lat = $object->getLatitude();
         $lng = $object->getLongitude();
         if ($this->getWest() > $lng || $this->getEast() < $lng) {
             return false;
         }
         return $this->getSouth() <= $lat && $this->getNorth() >= $lat;
     } elseif ($object instanceof LatLngBounds) {
         throw new \RuntimeException('LatLngBounds checking not implemented so far');
     }
     return false;
 }
 function cgmp_calculate_boundbox_from_db($width, $height, $layer_id = 0)
 {
     global $wpdb;
     if ($layer_id !== 0) {
         $markers = $wpdb->get_row('SELECT  min(lat) as minlat, max(lat) as maxlat, min(lon) as minlon, max(lon) as maxlon FROM ' . $wpdb->prefix . 'leafletmapsmarker_markers WHERE layer = ' . $layer_id);
     } else {
         $markers = $wpdb->get_row('SELECT  min(lat) as minlat, max(lat) as maxlat, min(lon) as minlon, max(lon) as maxlon FROM ' . $wpdb->prefix . 'leafletmapsmarker_markers');
     }
     if ($markers) {
         if (class_exists('LatLngBounds')) {
             $LatLngSw = new LatLng($markers->minlat, $markers->minlon);
             $LatLngNe = new LatLng($markers->maxlat, $markers->maxlon);
             $layercenter = new LatLngBounds($LatLngSw, $LatLngNe);
             $results['layerviewlat'] = $layercenter->getCenter()->getLat();
             $results['layerviewlon'] = $layercenter->getCenter()->getLng();
             $results['layerzoom'] = getBoundsZoomLevel(array('width' => $width, 'height' => $height), $LatLngSw, $LatLngNe);
         }
         return $results;
     } else {
         return false;
     }
 }