double getRingArea ( int path ) { if ( isRingAreaValid_ ( path ) ) return m_path_areas . get ( getPathIndex_ ( path ) ) ; Line line = new Line ( ) ; int vertex = getFirstVertex ( path ) ; if ( vertex == - 1 ) return 0 ; Point2D pt0 = new Point2D ( ) ; getXY ( vertex , pt0 ) ; double area = 0 ; for ( int i = 0 , n = getPathSize ( path ) ; i < n ; i ++ , vertex = getNextVertex ( vertex ) ) { Segment seg = getSegment ( vertex ) ; if ( seg == null ) { if ( ! queryLineConnector ( vertex , line ) ) continue ; seg = line ; } double a = seg . _calculateArea2DHelper ( pt0 . x , pt0 . y ) ; area += a ; } setRingAreaValid_ ( path , true ) ; m_path_areas . set ( getPathIndex_ ( path ) , area ) ; return area ; }
Returns the ring area