You are here

public function Point::equals in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/lib/geometry/Point.class.php \Point::equals()

Overrides Geometry::equals

File

geoPHP/lib/geometry/Point.class.php, line 148

Class

Point
Point: The most basic geometry type. All other geometries are built out of Points.

Code

public function equals($geometry) {
  if (get_class($geometry) != 'Point') {
    return FALSE;
  }
  if (!$this
    ->isEmpty() && !$geometry
    ->isEmpty()) {
    return $this
      ->x() == $geometry
      ->x() && $this
      ->y() == $geometry
      ->y();
  }
  else {
    if ($this
      ->isEmpty() && $geometry
      ->isEmpty()) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
}