Skip to content
Permalink
Browse files

Fix oracle provider and remove dead code

  • Loading branch information
wonder-sk committed Nov 14, 2016
1 parent 9872b48 commit 514d4439bd7428d1889aa9a21832da79e2f442d4
@@ -3407,11 +3407,6 @@ QgsGeometry QgsPalLabeling::prepareGeometry( const QgsGeometry& geometry, QgsRen
}
}

// MD: exporting geometry to GEOS just to see if the geometry is wrong...?
// if still needed, we could have a more specific test here
//if ( !geom.asGeos() )
// return QgsGeometry(); // there is something really wrong with the geometry

// fix invalid polygons
if ( geom.type() == QgsWkbTypes::PolygonGeometry && !geom.isGeosValid() )
{
@@ -270,11 +270,8 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
QByteArray *ba = static_cast<QByteArray*>( mQry.value( col++ ).data() );
if ( ba->size() > 0 )
{
unsigned char *copy = new unsigned char[ba->size()];
memcpy( copy, ba->constData(), ba->size() );

QgsGeometry g;
g.fromWkb( copy, ba->size() );
g.fromWkb( *ba );
feature.setGeometry( g );
}
else
@@ -381,13 +378,9 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
QByteArray *ba = static_cast<QByteArray*>( v.data() );
if ( ba->size() > 0 )
{
unsigned char *copy = new unsigned char[ba->size()];
memcpy( copy, ba->constData(), ba->size() );

QgsGeometry *g = new QgsGeometry();
g->fromWkb( copy, ba->size() );
v = g->exportToWkt();
delete g;
QgsGeometry g;
g.fromWkb( *ba );
v = g.exportToWkt();
}
else
{
@@ -1856,8 +1856,10 @@ void QgsOracleProvider::appendGeomParam( const QgsGeometry& geom, QSqlQuery &qry
{
QOCISpatialGeometry g;

QByteArray wkb = geom.exportToWkb();

wkbPtr ptr;
ptr.ucPtr = !geom.isEmpty() ? ( unsigned char * ) geom.asWkb() : 0;
ptr.ucPtr = !geom.isEmpty() ? reinterpret_cast< unsigned char * >( const_cast<char *>( wkb.constData() ) ) : 0;
g.isNull = !ptr.ucPtr;
g.gtype = -1;
g.srid = mSrid < 1 ? -1 : mSrid;
@@ -2274,10 +2276,8 @@ QgsRectangle QgsOracleProvider::extent() const
if ( ok && qry.next() )
{
QByteArray *ba = static_cast<QByteArray*>( qry.value( 0 ).data() );
unsigned char *copy = new unsigned char[ba->size()];
memcpy( copy, ba->constData(), ba->size() );
QgsGeometry g;
g.fromWkb( copy, ba->size() ); // take ownership
g.fromWkb( *ba );
mLayerExtent = g.boundingBox();
QgsDebugMsg( "extent: " + mLayerExtent.toString() );
}

0 comments on commit 514d443

Please sign in to comment.
You can’t perform that action at this time.