Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix oracle provider and remove dead code
  • Loading branch information
wonder-sk committed Nov 14, 2016
1 parent 9872b48 commit 514d443
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
5 changes: 0 additions & 5 deletions src/core/qgspallabeling.cpp
Expand Up @@ -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() )
{
Expand Down
15 changes: 4 additions & 11 deletions src/providers/oracle/qgsoraclefeatureiterator.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down
8 changes: 4 additions & 4 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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() );
}
Expand Down

0 comments on commit 514d443

Please sign in to comment.