static VALUE method_geometry_intersects(VALUE self, VALUE rhs) { VALUE result; RGeo_GeometryData* self_data; const GEOSGeometry* self_geom; const GEOSGeometry* rhs_geom; char val; #ifdef RGEO_GEOS_SUPPORTS_PREPARED1 const GEOSPreparedGeometry* prep; #endif result = Qnil; self_data = RGEO_GEOMETRY_DATA_PTR(self); self_geom = self_data->geom; if (self_geom) { rhs_geom = rgeo_convert_to_geos_geometry(self_data->factory, rhs, Qnil); if (rhs_geom) { #ifdef RGEO_GEOS_SUPPORTS_PREPARED1 prep = rgeo_request_prepared_geometry(self_data); if (prep) val = GEOSPreparedIntersects_r(self_data->geos_context, prep, rhs_geom); else #endif val = GEOSIntersects_r(self_data->geos_context, self_geom, rhs_geom); if (val == 0) { result = Qfalse; } else if (val == 1) { result = Qtrue; } } } return result; }
bool LabelPosition::crossesLine( PointSet* line ) const { if ( !mGeos ) createGeosGeom(); if ( !line->mGeos ) line->createGeosGeom(); GEOSContextHandle_t geosctxt = geosContext(); try { if ( GEOSPreparedIntersects_r( geosctxt, line->preparedGeom(), mGeos ) == 1 ) { return true; } else if ( nextPart ) { return nextPart->crossesLine( line ); } } catch ( GEOSException &e ) { QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) ); return false; } return false; }
bool LabelPosition::isInConflictSinglePart( LabelPosition* lp ) { if ( !mGeos ) createGeosGeom(); if ( !lp->mGeos ) lp->createGeosGeom(); GEOSContextHandle_t geosctxt = geosContext(); bool result = ( GEOSPreparedIntersects_r( geosctxt, preparedGeom(), lp->mGeos ) == 1 ); return result; }
bool LabelPosition::isInConflictSinglePart( LabelPosition* lp ) { if ( !mGeos ) createGeosGeom(); if ( !lp->mGeos ) lp->createGeosGeom(); GEOSContextHandle_t geosctxt = geosContext(); try { bool result = ( GEOSPreparedIntersects_r( geosctxt, preparedGeom(), lp->mGeos ) == 1 ); return result; } catch ( GEOSException &e ) { QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) ); return false; } }
bool LabelPosition::crossesLine( PointSet* line ) const { if ( !mGeos ) createGeosGeom(); if ( !line->mGeos ) line->createGeosGeom(); GEOSContextHandle_t geosctxt = geosContext(); if ( GEOSPreparedIntersects_r( geosctxt, line->preparedGeom(), mGeos ) == 1 ) { return true; } else if ( nextPart ) { return nextPart->crossesLine( line ); } return false; }