dmBridge PHP API
UNLVSpatialRectObject.php
00001 <?php
00002 #
00003 # UNLVSpatial: a dmBridge module for spatial content
00004 #
00005 # Copyright © 2011 Board of Regents of the Nevada System of Higher
00006 # Education, on behalf of the University of Nevada, Las Vegas
00007 #
00008 
00022 class UNLVSpatialRectObject extends UNLVSpatialAbstractSpatialObject {
00023 
00025    private $north_lat, $south_lat, $east_long, $west_long;
00026 
00027 
00031    public function getSpatialCenterLat() {
00032       return ($this->getSpatialNorthLat() + $this->getSpatialSouthLat()) / 2;
00033    }
00034 
00038    public function getSpatialCenterLong() {
00039       return ($this->getSpatialEastLong() + $this->getSpatialWestLong()) / 2;
00040    }
00041 
00045    public function getSpatialEastLong() {
00046       return $this->east_long;
00047    }
00048 
00052    public function setSpatialEastLong($float) {
00053       $this->east_long = (float) $float;
00054    }
00055 
00059    public function getSpatialNorthLat() {
00060       return $this->north_lat;
00061    }
00062 
00066    public function setSpatialNorthLat($float) {
00067       $this->north_lat = (float) $float;
00068    }
00069 
00073    public function getSpatialSouthLat() {
00074       return $this->south_lat;
00075    }
00076 
00080    public function setSpatialSouthLat($float) {
00081       $this->south_lat = (float) $float;
00082    }
00083 
00088    public function getSpatialDataSource() {
00089       return $this->data_source;
00090    }
00091 
00096    public function setSpatialDataSource($source) {
00097       $this->data_source = $source;
00098    }
00099 
00103    public function getSpatialWestLong() {
00104       return $this->west_long;
00105    }
00106 
00110    public function setSpatialWestLong($float) {
00111       $this->west_long = (float) $float;
00112    }
00113 
00117    public function isSpatiallyValid() {
00118       if ($this->getSpatialEastLong() > 180
00119             || $this->getSpatialEastLong() < -180
00120             || $this->getSpatialWestLong() > 180
00121             || $this->getSpatialWestLong() < -180) {
00122          return false;
00123       }
00124       if ($this->getSpatialNorthLat() > 90
00125             || $this->getSpatialNorthLat() < -90
00126             || $this->getSpatialSouthLat() > 90
00127             || $this->getSpatialSouthLat() < -90) {
00128          return false;
00129       }
00130       return true;
00131    }
00132 
00133 }
00134 
 All Data Structures Functions Variables