// Fully node given linework static GEOSGeometry *LWGEOM_GEOS_nodeLines( const GEOSGeometry *lines ) { GEOSContextHandle_t handle = QgsGeos::getGEOSHandler(); // Union with first geometry point, obtaining full noding // and dissolving of duplicated repeated points // // TODO: substitute this with UnaryUnion? GEOSGeometry *point = LWGEOM_GEOS_getPointN( lines, 0 ); if ( ! point ) return nullptr; GEOSGeometry *noded = nullptr; try { noded = GEOSUnion_r( handle, lines, point ); } catch ( GEOSException & ) { // no need to do anything here - we'll return nullptr anyway } GEOSGeom_destroy_r( handle, point ); return noded; }
static VALUE method_geometry_union(VALUE self, VALUE rhs) { VALUE result = Qnil; RGeo_GeometryData* self_data = RGEO_GEOMETRY_DATA_PTR(self); const GEOSGeometry* self_geom = self_data->geom; if (self_geom) { VALUE factory = self_data->factory; const GEOSGeometry* rhs_geom = rgeo_convert_to_geos_geometry(factory, rhs, Qnil); if (rhs_geom) { result = rgeo_wrap_geos_geometry(factory, GEOSUnion_r(self_data->geos_context, self_geom, rhs_geom), Qnil); } } return result; }
// Fully node given linework static GEOSGeometry *LWGEOM_GEOS_nodeLines( const GEOSGeometry *lines ) { GEOSContextHandle_t handle = QgsGeos::getGEOSHandler(); // Union with first geometry point, obtaining full noding // and dissolving of duplicated repeated points // // TODO: substitute this with UnaryUnion? GEOSGeometry *point = LWGEOM_GEOS_getPointN( lines, 0 ); if ( ! point ) return nullptr; GEOSGeometry *noded = GEOSUnion_r( handle, lines, point ); if ( !noded ) { GEOSGeom_destroy_r( handle, point ); return nullptr; } GEOSGeom_destroy_r( handle, point ); return noded; }