⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ogrgeometry.cpp

📁 用于读取TAB、MIF、SHP文件的类
💻 CPP
📖 第 1 页 / 共 5 页
字号:
 * * @return the newly created geometry, or NULL if an error occurs.  */OGRGeometry *OGRGeometry::Buffer( double dfDist, int nQuadSegs ) const{#ifndef HAVE_GEOS    CPLError( CE_Failure, CPLE_NotSupported,               "GEOS support not enabled." );    return NULL;#else    GEOSGeom hGeosGeom = NULL;    GEOSGeom hGeosProduct = NULL;    OGRGeometry *poOGRProduct = NULL;    hGeosGeom = exportToGEOS();    if( hGeosGeom != NULL )    {        hGeosProduct = GEOSBuffer( hGeosGeom, dfDist, nQuadSegs );        GEOSGeom_destroy( hGeosGeom );        if( hGeosProduct != NULL )        {            poOGRProduct = OGRGeometryFactory::createFromGEOS(hGeosProduct);            GEOSGeom_destroy( hGeosProduct );        }    }    return poOGRProduct;#endif /* HAVE_GEOS */}/************************************************************************//*                            OGR_G_Buffer()                            *//************************************************************************/OGRGeometryH OGR_G_Buffer( OGRGeometryH hTarget, double dfDist, int nQuadSegs ){    return (OGRGeometryH) ((OGRGeometry *) hTarget)->Buffer( dfDist, nQuadSegs );}/************************************************************************//*                            Intersection()                            *//************************************************************************//** * Compute intersection. * * Generates a new geometry which is the region of intersection of the * two geometries operated on.  The Intersect() method can be used to test if * two geometries intersect.  * * This method is the same as the C function OGR_G_Intersection(). * * This method is built on the GEOS library, check it for the definition * of the geometry operation. * If OGR is built without the GEOS library, this method will always fail,  * issuing a CPLE_NotSupported error.  * * @param poOtherGeom the other geometry intersected with "this" geometry. * * @return a new geometry representing the intersection or NULL if there is * no intersection or an error occurs. */OGRGeometry *OGRGeometry::Intersection( const OGRGeometry *poOtherGeom ) const{#ifndef HAVE_GEOS    CPLError( CE_Failure, CPLE_NotSupported,               "GEOS support not enabled." );    return NULL;#else    GEOSGeom hThisGeosGeom = NULL;    GEOSGeom hOtherGeosGeom = NULL;    GEOSGeom hGeosProduct = NULL;    OGRGeometry *poOGRProduct = NULL;    hThisGeosGeom = exportToGEOS();    hOtherGeosGeom = poOtherGeom->exportToGEOS();    if( hThisGeosGeom != NULL && hOtherGeosGeom != NULL )    {        hGeosProduct = GEOSIntersection( hThisGeosGeom, hOtherGeosGeom );        GEOSGeom_destroy( hThisGeosGeom );        GEOSGeom_destroy( hOtherGeosGeom );        if( hGeosProduct != NULL )        {            poOGRProduct = OGRGeometryFactory::createFromGEOS(hGeosProduct);            GEOSGeom_destroy( hGeosProduct );        }    }    return poOGRProduct;#endif /* HAVE_GEOS */}/************************************************************************//*                         OGR_G_Intersection()                         *//************************************************************************/OGRGeometryH OGR_G_Intersection( OGRGeometryH hThis, OGRGeometryH hOther ){    return (OGRGeometryH)         ((OGRGeometry *) hThis)->Intersection( (OGRGeometry *) hOther );}/************************************************************************//*                               Union()                                *//************************************************************************//** * Compute union. * * Generates a new geometry which is the region of union of the * two geometries operated on.   * * This method is the same as the C function OGR_G_Union(). * * This method is built on the GEOS library, check it for the definition * of the geometry operation. * If OGR is built without the GEOS library, this method will always fail,  * issuing a CPLE_NotSupported error.  * * @param poOtherGeom the other geometry unioned with "this" geometry. * * @return a new geometry representing the union or NULL if an error occurs. */OGRGeometry *OGRGeometry::Union( const OGRGeometry *poOtherGeom ) const{#ifndef HAVE_GEOS    CPLError( CE_Failure, CPLE_NotSupported,               "GEOS support not enabled." );    return NULL;#else    GEOSGeom hThisGeosGeom = NULL;    GEOSGeom hOtherGeosGeom = NULL;    GEOSGeom hGeosProduct = NULL;    OGRGeometry *poOGRProduct = NULL;    hThisGeosGeom = exportToGEOS();    hOtherGeosGeom = poOtherGeom->exportToGEOS();    if( hThisGeosGeom != NULL && hOtherGeosGeom != NULL )    {        hGeosProduct = GEOSUnion( hThisGeosGeom, hOtherGeosGeom );        GEOSGeom_destroy( hThisGeosGeom );        GEOSGeom_destroy( hOtherGeosGeom );        if( hGeosProduct != NULL )        {            poOGRProduct = OGRGeometryFactory::createFromGEOS(hGeosProduct);            GEOSGeom_destroy( hGeosProduct );        }    }    return poOGRProduct;#endif /* HAVE_GEOS */}/************************************************************************//*                            OGR_G_Union()                             *//************************************************************************/OGRGeometryH OGR_G_Union( OGRGeometryH hThis, OGRGeometryH hOther ){    return (OGRGeometryH)         ((OGRGeometry *) hThis)->Union( (OGRGeometry *) hOther );}/************************************************************************//*                             Difference()                             *//************************************************************************//** * Compute difference. * * Generates a new geometry which is the region of this geometry with the * region of the second geometry removed.  * * This method is the same as the C function OGR_G_Difference(). * * This method is built on the GEOS library, check it for the definition * of the geometry operation. * If OGR is built without the GEOS library, this method will always fail,  * issuing a CPLE_NotSupported error.  * * @param poOtherGeom the other geometry removed from "this" geometry. * * @return a new geometry representing the difference or NULL if the  * difference is empty or an error occurs. */OGRGeometry *OGRGeometry::Difference( const OGRGeometry *poOtherGeom ) const{#ifndef HAVE_GEOS    CPLError( CE_Failure, CPLE_NotSupported,               "GEOS support not enabled." );    return NULL;#else        GEOSGeom hThisGeosGeom = NULL;    GEOSGeom hOtherGeosGeom = NULL;    GEOSGeom hGeosProduct = NULL;    OGRGeometry *poOGRProduct = NULL;    hThisGeosGeom = exportToGEOS();    hOtherGeosGeom = poOtherGeom->exportToGEOS();    if( hThisGeosGeom != NULL && hOtherGeosGeom != NULL )    {        hGeosProduct = GEOSDifference( hThisGeosGeom, hOtherGeosGeom );        GEOSGeom_destroy( hThisGeosGeom );        GEOSGeom_destroy( hOtherGeosGeom );        if( hGeosProduct != NULL )        {            poOGRProduct = OGRGeometryFactory::createFromGEOS(hGeosProduct);            GEOSGeom_destroy( hGeosProduct );        }    }    return poOGRProduct;#endif /* HAVE_GEOS */}/************************************************************************//*                          OGR_G_Difference()                          *//************************************************************************/OGRGeometryH OGR_G_Difference( OGRGeometryH hThis, OGRGeometryH hOther ){    return (OGRGeometryH)         ((OGRGeometry *) hThis)->Difference( (OGRGeometry *) hOther );}/************************************************************************//*                        SymmetricDifference()                         *//************************************************************************//** * Compute symmetric difference. * * Generates a new geometry which is the symmetric difference of this * geometry and the second geometry passed into the method. * * This method is the same as the C function OGR_G_SymmetricDifference(). * * This method is built on the GEOS library, check it for the definition * of the geometry operation. * If OGR is built without the GEOS library, this method will always fail,  * issuing a CPLE_NotSupported error.  * * @param poOtherGeom the other geometry. * * @return a new geometry representing the symmetric difference or NULL if the  * difference is empty or an error occurs. */OGRGeometry *OGRGeometry::SymmetricDifference( const OGRGeometry *poOtherGeom ) const{#ifndef HAVE_GEOS    CPLError( CE_Failure, CPLE_NotSupported,               "GEOS support not enabled." );    return NULL;#else    GEOSGeom hThisGeosGeom = NULL;    GEOSGeom hOtherGeosGeom = NULL;    GEOSGeom hGeosProduct = NULL;    OGRGeometry *poOGRProduct = NULL;    hThisGeosGeom = exportToGEOS();    hOtherGeosGeom = poOtherGeom->exportToGEOS();    if( hThisGeosGeom != NULL && hOtherGeosGeom != NULL )    {        hGeosProduct = GEOSSymDifference( hThisGeosGeom, hOtherGeosGeom );        GEOSGeom_destroy( hThisGeosGeom );        GEOSGeom_destroy( hOtherGeosGeom );        if( hGeosProduct != NULL )        {            poOGRProduct = OGRGeometryFactory::createFromGEOS(hGeosProduct);            GEOSGeom_destroy( hGeosProduct );        }    }    return poOGRProduct;#endif /* HAVE_GEOS */}/************************************************************************//*                          OGR_G_Difference()                          *//************************************************************************/OGRGeometryH OGR_G_SymmetricDifference( OGRGeometryH hThis, OGRGeometryH hOther ){    return (OGRGeometryH)         ((OGRGeometry *) hThis)->SymmetricDifference( (OGRGeometry *) hOther );}/************************************************************************//*                              Disjoint()                              *//************************************************************************//** * Test for disjointness. * * Tests if this geometry and the other passed into the method are disjoint.  * * This method is the same as the C function OGR_G_Disjoint(). * * This method is built on the GEOS library, check it for the definition * of the geometry operation. * If OGR is built without the GEOS library, this method will always fail,  * issuing a CPLE_NotSupported error.  * * @param poOtherGeom the geometry to compare to this geometry. * * @return TRUE if they are disjoint, otherwise FALSE.   */OGRBooleanOGRGeometry::Disjoint( const OGRGeometry *poOtherGeom ) const{#ifndef HAVE_GEOS    CPLError( CE_Failure, CPLE_NotSupported,               "GEOS support not enabled." );    return FALSE;#else    GEOSGeom hThisGeosGeom = NULL;    GEOSGeom hOtherGeosGeom = NULL;    OGRBoolean bResult = FALSE;    hThisGeosGeom = exportToGEOS();    hOtherGeosGeom = poOtherGeom->exportToGEOS();    if( hThisGeosGeom != NULL && hOtherGeosGeom != NULL )    {        bResult = GEOSDisjoint( hThisGeosGeom, hOtherGeosGeom );        GEOSGeom_destroy( hThisGeosGeom );        GEOSGeom_destroy( hOtherGeosGeom );    }    return bResult;#endif /* HAVE_GEOS */}/************************************************************************//*                           OGR_G_Disjoint()                           *//************************************************************************/int OGR_G_Disjoint( OGRGeometryH hThis, OGRGeometryH hOther ){    return ((OGRGeometry *) hThis)->Disjoint( (OGRGeometry *) hOther );}/************************************************************************//*                              Touches()                               *//************************************************************************//** * Test for touching. * * Tests if this geometry and the other passed into the method are touching. * * This method is the same as the C function OGR_G_Touches(). * * This method is built on the GEOS library, check it for the definition * of the geometry operation. * If OGR is built without the GEOS library, this method will always fail,  * issuing a CPLE_NotSupported error.  * * @param poOtherGeom the geometry to compare to this geometry. * * @return TRUE if they are touchin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -