* @package WB * @subpackage geo */ WBClass::load('WBGeo'); /** * Geo Information Tools: Point * * @todo alpha * @version 0.1.0 * @package WB * @subpackage geo */ class WBGeo_Point extends WBStdClass { private $latitude = 0; private $longitude = 0; private $height = 0; /** * Constructor * * Parameter * - lat * - lon * - height * - isdeg * * @param array */ public function __construct($parameter = array()) { $parameter = array_merge( array( 'lat' => 0, 'lon' => 0, 'height' => 0, 'isdeg' => 1 ), $parameter); if (0 < $parameter['isdeg']) { $parameter['lat'] = WBGeo::deg2rad($parameter['lat']); $parameter['lon'] = WBGeo::deg2rad($parameter['lon']); } $this->latitude = $parameter['lat']; $this->longitude = $parameter['lon']; $this->height = $parameter['height']; } /** * Get Latitude * * @param bool convert to deg * @return floa */ public function getLatitude($deg = true) { if ($deg) { return WBGeo::rad2deg($this->latitude); } return $this->latitude; } /** * Get Longitude * * @param bool convert to deg * @return floa */ public function getLongitude($deg = true) { if ($deg) { return WBGeo::rad2deg($this->longitude); } return $this->longitude; } /** * Get Height * * @return floa */ public function getHeight() { return $this->height; } /** * Is Point Empty? * * Check if Coordinates are zero. * @return bool */ public function isEmpty() { if (0 == $this->latitude && 0 == $this->longitude) { return true; } return false; } }