示例#1
0
 protected function __construct(LatLng $sw, LatLng $ne)
 {
     $s = $sw->lat();
     $w = $sw->lng();
     $n = $ne->lat();
     $e = $ne->lng();
     // Wrap latitudes around the globe
     $s = Geo::wrapLat($s);
     $n = Geo::wrapLat($n);
     // Compute difference in longitude extremities
     $lngDiff = $e - $w;
     // Compute new longitudes
     if ($lngDiff >= 360) {
         $e = 180;
         $w = -180;
     } else {
         $e = Geo::wrapLng($e);
         $w = Geo::wrapLng($w);
     }
     // Assign bounds' attributes
     $this->s = $s;
     $this->w = $w;
     $this->n = $n;
     $this->e = $e;
 }