Unverified Commit 133f2d89 authored by Stuart Sides's avatar Stuart Sides Committed by GitHub
Browse files

GEOS 3.9 LimitPolygonSeeder (#4450)

parent d1084553
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ namespace Isis {
        geos::geom::Geometry *gridSquarePolygon = GetMultiPolygon(x - xSpacing / 2.0, y - ySpacing / 2,
            x + xSpacing / 2.0, y + ySpacing / 2, *multiPoly);

        geos::geom::Point *centroid = gridSquarePolygon->getCentroid();
        geos::geom::Point *centroid = gridSquarePolygon->getCentroid().release();

        delete gridSquarePolygon;
        if(centroid == NULL) continue;
@@ -121,7 +121,7 @@ namespace Isis {
  geos::geom::Geometry *LimitPolygonSeeder::GetMultiPolygon(double dMinX, double dMinY,
      double dMaxX, double dMaxY,
      const geos::geom::MultiPolygon &orig) {
    geos::geom::CoordinateSequence *points = new geos::geom::CoordinateArraySequence();
    geos::geom::CoordinateArraySequence *points = new geos::geom::CoordinateArraySequence();

    points->add(geos::geom::Coordinate(dMinX, dMinY));
    points->add(geos::geom::Coordinate(dMaxX, dMinY));
@@ -130,7 +130,7 @@ namespace Isis {
    points->add(geos::geom::Coordinate(dMinX, dMinY));

    geos::geom::Polygon *poly = Isis::globalFactory->createPolygon(Isis::globalFactory->createLinearRing(points), NULL);
    geos::geom::Geometry *overlap = poly->intersection(&orig);
    geos::geom::Geometry *overlap = poly->intersection(&orig).release();

    return overlap;
  }
+7 −7
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ int main() {

    Pvl pvl;
    pvl.addObject(o);
    cout << pvl << endl << endl;
    std::cout << pvl << std::endl << std::endl;

    PolygonSeeder *ps = PolygonSeederFactory::Create(pvl);

@@ -57,10 +57,10 @@ int main() {
    std::cout << "MinimumArea = " << ps->MinimumArea() << std::endl;


    cout << "Test 2, test a triangular polygon" << endl;
    std::cout << "Test 2, test a triangular polygon" << std::endl;
    try {
      // Call the seed member with a polygon
      geos::geom::CoordinateSequence *pts;
      geos::geom::CoordinateArraySequence *pts;
      vector<geos::geom::Geometry *> polys;

      // Create the A polygon
@@ -74,9 +74,9 @@ int main() {
      polys.push_back(Isis::globalFactory->createPolygon(
                        Isis::globalFactory->createLinearRing(pts), NULL));

      geos::geom::MultiPolygon *mp = Isis::globalFactory->createMultiPolygon(polys);
      geos::geom::MultiPolygon *mp = Isis::globalFactory->createMultiPolygon(&polys);

      cout << "Lon/Lat polygon = " << mp->toString() << endl;
      std::cout << "Lon/Lat polygon = " << mp->toString() << std::endl;
      // Create the projection necessary for seeding
      PvlGroup radii = Target::radiiGroup("MARS");
      Isis::Pvl maplab;
@@ -122,7 +122,7 @@ int main() {
    cout << "Test 3, test for too thin" << endl;
    try {
      // Call the seed member with a polygon
      geos::geom::CoordinateSequence *pts;
      geos::geom::CoordinatArraySequence *pts;
      vector<geos::geom::Geometry *> polys;

      // Create the A polygon
@@ -136,7 +136,7 @@ int main() {
      polys.push_back(Isis::globalFactory->createPolygon(
                        Isis::globalFactory->createLinearRing(pts), NULL));

      geos::geom::MultiPolygon *mp = Isis::globalFactory->createMultiPolygon(polys);
      geos::geom::MultiPolygon *mp = Isis::globalFactory->createMultiPolygon(&polys);

      cout << "Lon/Lat polygon = " << mp->toString() << endl;