You are here

function test_geometry in geoPHP 7

Same name and namespace in other branches
  1. 8 geoPHP/tests/test.php \test_geometry()
1 call to test_geometry()
run_test in geoPHP/tests/test.php

File

geoPHP/tests/test.php, line 43

Code

function test_geometry($geometry) {

  // Test common functions
  $geometry
    ->area();
  $geometry
    ->boundary();
  $geometry
    ->envelope();
  $geometry
    ->getBBox();
  $geometry
    ->centroid();
  $geometry
    ->length();
  $geometry
    ->greatCircleLength();
  $geometry
    ->haversineLength();
  $geometry
    ->y();
  $geometry
    ->x();
  $geometry
    ->numGeometries();
  $geometry
    ->geometryN(1);
  $geometry
    ->startPoint();
  $geometry
    ->endPoint();
  $geometry
    ->isRing();
  $geometry
    ->isClosed();
  $geometry
    ->numPoints();
  $geometry
    ->pointN(1);
  $geometry
    ->exteriorRing();
  $geometry
    ->numInteriorRings();
  $geometry
    ->interiorRingN(1);
  $geometry
    ->dimension();
  $geometry
    ->geometryType();
  $geometry
    ->SRID();
  $geometry
    ->setSRID(4326);

  // Aliases
  $geometry
    ->getCentroid();
  $geometry
    ->getArea();
  $geometry
    ->getX();
  $geometry
    ->getY();
  $geometry
    ->getGeos();
  $geometry
    ->getGeomType();
  $geometry
    ->getSRID();
  $geometry
    ->asText();
  $geometry
    ->asBinary();

  // GEOS only functions
  $geometry
    ->geos();
  $geometry
    ->setGeos($geometry
    ->geos());
  $geometry
    ->pointOnSurface();
  $geometry
    ->equals($geometry);
  $geometry
    ->equalsExact($geometry);
  $geometry
    ->relate($geometry);
  $geometry
    ->checkValidity();
  $geometry
    ->isSimple();
  $geometry
    ->buffer(10);
  $geometry
    ->intersection($geometry);
  $geometry
    ->convexHull();
  $geometry
    ->difference($geometry);
  $geometry
    ->symDifference($geometry);
  $geometry
    ->union($geometry);
  $geometry
    ->simplify(0);

  // @@TODO: Adjust this once we can deal with empty geometries
  $geometry
    ->disjoint($geometry);
  $geometry
    ->touches($geometry);
  $geometry
    ->intersects($geometry);
  $geometry
    ->crosses($geometry);
  $geometry
    ->within($geometry);
  $geometry
    ->contains($geometry);
  $geometry
    ->overlaps($geometry);
  $geometry
    ->covers($geometry);
  $geometry
    ->coveredBy($geometry);
  $geometry
    ->distance($geometry);
  $geometry
    ->hausdorffDistance($geometry);

  // Place holders
  $geometry
    ->hasZ();
  $geometry
    ->is3D();
  $geometry
    ->isMeasured();
  $geometry
    ->isEmpty();
  $geometry
    ->coordinateDimension();
  $geometry
    ->z();
  $geometry
    ->m();
}