2216 int iOpRing, bAltered = 0;
2232 for( iOpRing = 0; iOpRing < psObject->
nParts; iOpRing++ )
2234 int bInner, iVert, nVertCount, nVertStart, iCheckRing;
2235 double dfSum, dfTestX, dfTestY;
2255 for( iCheckRing = 0; iCheckRing < psObject->
nParts; iCheckRing++ )
2259 if( iCheckRing == iOpRing )
2264 if( iCheckRing == psObject->
nParts-1 )
2271 for( iEdge = 0; iEdge < nVertCount; iEdge++ )
2275 if( iEdge < nVertCount-1 )
2284 if ( ( psObject->
padfY[iEdge+nVertStart] < dfTestY
2285 && dfTestY <= psObject->padfY[iNext+nVertStart] )
2286 || ( psObject->
padfY[iNext+nVertStart] < dfTestY
2287 && dfTestY <= psObject->
padfY[iEdge+nVertStart] ) )
2292 double const intersect =
2293 ( psObject->
padfX[iEdge+nVertStart]
2294 + ( dfTestY - psObject->
padfY[iEdge+nVertStart] )
2295 / ( psObject->
padfY[iNext+nVertStart] - psObject->
padfY[iEdge+nVertStart] )
2296 * ( psObject->
padfX[iNext+nVertStart] - psObject->
padfX[iEdge+nVertStart] ) );
2298 if (intersect < dfTestX)
2312 if( iOpRing == psObject->
nParts-1 )
2321 dfSum = psObject->
padfX[nVertStart] * (psObject->
padfY[nVertStart+1] - psObject->
padfY[nVertStart+nVertCount-1]);
2322 for( iVert = nVertStart + 1; iVert < nVertStart+nVertCount-1; iVert++ )
2324 dfSum += psObject->
padfX[iVert] * (psObject->
padfY[iVert+1] - psObject->
padfY[iVert-1]);
2327 dfSum += psObject->
padfX[iVert] * (psObject->
padfY[nVertStart] - psObject->
padfY[iVert-1]);
2332 if( (dfSum < 0.0 && bInner) || (dfSum > 0.0 && !bInner) )
2337 for( i = 0; i < nVertCount/2; i++ )
2342 dfSaved = psObject->
padfX[nVertStart+i];
2343 psObject->
padfX[nVertStart+i] =
2344 psObject->
padfX[nVertStart+nVertCount-i-1];
2345 psObject->
padfX[nVertStart+nVertCount-i-1] = dfSaved;
2348 dfSaved = psObject->
padfY[nVertStart+i];
2349 psObject->
padfY[nVertStart+i] =
2350 psObject->
padfY[nVertStart+nVertCount-i-1];
2351 psObject->
padfY[nVertStart+nVertCount-i-1] = dfSaved;
2354 if( psObject->
padfZ )
2356 dfSaved = psObject->
padfZ[nVertStart+i];
2357 psObject->
padfZ[nVertStart+i] =
2358 psObject->
padfZ[nVertStart+nVertCount-i-1];
2359 psObject->
padfZ[nVertStart+nVertCount-i-1] = dfSaved;
2363 if( psObject->
padfM )
2365 dfSaved = psObject->
padfM[nVertStart+i];
2366 psObject->
padfM[nVertStart+i] =
2367 psObject->
padfM[nVertStart+nVertCount-i-1];
2368 psObject->
padfM[nVertStart+nVertCount-i-1] = dfSaved;