OGRGeometry::Buffer

OGRGeometry *OGRGeometry::Buffer( UNUSED_IF_NO_GEOS double dfDist,
                                  UNUSED_IF_NO_GEOS int nQuadSegs ) const

{
#ifndef HAVE_GEOS

    CPLError( CE_Failure, CPLE_NotSupported,
              “GEOS support not enabled.” );
    return nullptr;

#else

    OGRGeometry *poOGRProduct = nullptr;

    GEOSContextHandle_t hGEOSCtxt = createGEOSContext();
    GEOSGeom hGeosGeom = exportToGEOS(hGEOSCtxt);
    if( hGeosGeom != nullptr )
    {
        GEOSGeom hGeosProduct =
            GEOSBuffer_r( hGEOSCtxt, hGeosGeom, dfDist, nQuadSegs );
        GEOSGeom_destroy_r( hGEOSCtxt, hGeosGeom );

        poOGRProduct = BuildGeometryFromGEOS(hGEOSCtxt, hGeosProduct,
                                             this, nullptr);
    }
    freeGEOSContext(hGEOSCtxt);

    return poOGRProduct;

#endif  // HAVE_GEOS
}

转载自:https://blog.csdn.net/durongze/article/details/81159066

You may also like...

退出移动版