/**
  * @see ValueFormatter::format
  *
  * @since 0.1
  *
  * @param GlobeCoordinateValue $value The value to format
  *
  * @return string
  * @throws InvalidArgumentException
  */
 public function format($value)
 {
     if (!$value instanceof GlobeCoordinateValue) {
         throw new InvalidArgumentException('The GlobeCoordinateFormatter can only format instances of GlobeCoordinateValue.');
     }
     $formatter = new GeoCoordinateFormatter($this->options);
     return $formatter->formatLatLongValue($value->getLatLong(), $value->getPrecision());
 }
Esempio n. 2
0
 /**
  * @see ValueFormatter::format
  *
  * @since 0.1
  *
  * @param GlobeCoordinateValue $value The value to format
  *
  * @return string
  * @throws InvalidArgumentException
  */
 public function format($value)
 {
     if (!$value instanceof GlobeCoordinateValue) {
         throw new InvalidArgumentException('Data value type mismatch. Expected a GlobeCoordinateValue.');
     }
     $formatter = new GeoCoordinateFormatter($this->options);
     return $formatter->formatLatLongValue($value->getLatLong(), $value->getPrecision());
 }
Esempio n. 3
0
 /**
  * Normalizes latitude to [-90°..+90°]. Normalizes longitude to [-180°..+180°[ on Earth and
  * Moon and to [0°..+360°[ on all other globes.
  * @see http://planetarynames.wr.usgs.gov/TargetCoordinates
  *
  * @param GlobeCoordinateValue $value
  *
  * @return GlobeCoordinateValue
  */
 public function normalizeGlobeCoordinate(GlobeCoordinateValue $value)
 {
     return new GlobeCoordinateValue($this->normalizeGlobeLatLong($value->getLatLong(), $value->getGlobe()), $value->getPrecision(), $value->getGlobe());
 }