Skip to content

Commit

Permalink
Changed to use SetX and SetY
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Potts committed Nov 1, 2019
1 parent 5b3984f commit 9abb4f2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/base/ossimPolyArea2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ void ossimPolyArea2dPrivate::setGeometry(const ossimPolygon &exteriorRing,
//fill the exterior ring
for (idx = 0; idx < n; idx++)
{
GEOSCoordSeq_setXY(shellSeq, idx, pts[idx].x, pts[idx].y);
GEOSCoordSeq_setX(shellSeq, idx, pts[idx].x);
GEOSCoordSeq_setY(shellSeq, idx, pts[idx].y);
}
//if the original polygon didn't have the first and last point the same, make it so
if (!firstAndLastSame)
{
GEOSCoordSeq_setXY(shellSeq, n, pts[0].x, pts[0].y);
GEOSCoordSeq_setX(shellSeq, n, pts[0].x);
GEOSCoordSeq_setY(shellSeq, n, pts[0].y);
}
shell = GEOSGeom_createLinearRing(shellSeq);
//fill the interior rings
Expand All @@ -142,13 +144,15 @@ void ossimPolyArea2dPrivate::setGeometry(const ossimPolygon &exteriorRing,
vertexPts.size() + ((firstAndLastSame) ? 0 : 1), 2);
for (ossim_uint32 vertexIndex = 0; vertexIndex < vertexPts.size(); ++vertexIndex)
{
GEOSCoordSeq_setXY(ring, vertexIndex, vertexPts[vertexIndex].x, vertexPts[vertexIndex].y);
GEOSCoordSeq_setX(ring, vertexIndex, vertexPts[vertexIndex].x);
GEOSCoordSeq_setY(ring, vertexIndex, vertexPts[vertexIndex].y);
}

//if the original polygon didn't have the first and last point the same, make it so
if (!firstAndLastSame)
{
GEOSCoordSeq_setXY(ring, vertexPts.size(), vertexPts[0].x, vertexPts[0].y);
GEOSCoordSeq_setX(ring, vertexPts.size(), vertexPts[0].x);
GEOSCoordSeq_setY(ring, vertexPts.size(), vertexPts[0].y);
}
GEOSGeometryPtr hole = GEOSGeom_createLinearRing(ring);
holes.push_back(hole);
Expand Down Expand Up @@ -389,7 +393,8 @@ bool ossimPolyArea2dPrivate::isPointWithin(const ossimDpt &pt) const
if (!isEmpty())
{
GEOSCoordSequence *pointSeq = GEOSCoordSeq_create(1, 2);
GEOSCoordSeq_setXY(pointSeq, 0, pt.x, pt.y);
GEOSCoordSeq_setX(pointSeq, 0, pt.x);
GEOSCoordSeq_setY(pointSeq, 0, pt.y);
GEOSGeometry *geom = GEOSGeom_createPoint(pointSeq);
result = (GEOSWithin(geom, m_geometry) == 1);

Expand Down

0 comments on commit 9abb4f2

Please sign in to comment.