double OGRCircularString::get_Area() const { if( IsEmpty() || !get_IsClosed() ) return 0; double cx = 0.0; double cy = 0.0; double square_R = 0.0; if( IsFullCircle(cx, cy, square_R) ) { return M_PI * square_R; } // Optimization for convex rings. if( IsConvex() ) { // Compute area of shape without the circular segments. double dfArea = get_LinearArea(); // Add the area of the spherical segments. dfArea += get_AreaOfCurveSegments(); return dfArea; } OGRLineString* poLS = CurveToLine(); const double dfArea = poLS->get_Area(); delete poLS; return dfArea; }
double OGRCompoundCurve::get_Area() const { if( IsEmpty() || !get_IsClosed() ) return 0; // Optimization for convex rings. if( IsConvex() ) { // Compute area of shape without the circular segments. OGRPointIterator* poIter = getPointIterator(); OGRLineString oLS; oLS.setNumPoints( getNumPoints() ); OGRPoint p; for( int i = 0; poIter->getNextPoint(&p); i++ ) { oLS.setPoint( i, p.getX(), p.getY() ); } double dfArea = oLS.get_Area(); delete poIter; // Add the area of the spherical segments. dfArea += get_AreaOfCurveSegments(); return dfArea; } OGRLineString* poLS = CurveToLine(); double dfArea = poLS->get_Area(); delete poLS; return dfArea; }
OGRGeometry* OGRCircularString::getLinearGeometry( double dfMaxAngleStepSizeDegrees, const char* const* papszOptions) const { return CurveToLine(dfMaxAngleStepSizeDegrees, papszOptions); }