Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 25, 2015
1 parent b7a4e98 commit 8389918
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 43 deletions.
Binary file modified src/browser/browser.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -522,6 +522,7 @@ int QgsGeometry::addRing( QgsCurveV2* ring )

int QgsGeometry::addPart( const QList<QgsPoint> &points, QGis::GeometryType geomType )
{
Q_UNUSED( geomType );
if ( !d || !d->geometry )
{
return 2;
Expand Down Expand Up @@ -1084,6 +1085,7 @@ double QgsGeometry::area() const
}
QgsGeos g( d->geometry );

#if 0
//debug: compare geos area with calculation in QGIS
double geosArea = g.area();
double qgisArea = 0;
Expand All @@ -1092,6 +1094,7 @@ double QgsGeometry::area() const
{
qgisArea = surface->area();
}
#endif

return g.area();
}
Expand Down
9 changes: 8 additions & 1 deletion src/core/geometry/qgsgeometryengine.h
Expand Up @@ -59,7 +59,14 @@ class CORE_EXPORT QgsGeometryEngine
virtual int splitGeometry( const QgsLineStringV2& splitLine,
QList<QgsAbstractGeometryV2*>& newGeometries,
bool topological,
QList<QgsPointV2> &topologyTestPoints ) const { return 2; } //= 0;
QList<QgsPointV2> &topologyTestPoints ) const
{
Q_UNUSED( splitLine );
Q_UNUSED( newGeometries );
Q_UNUSED( topological );
Q_UNUSED( topologyTestPoints );
return 2;
} //= 0;

virtual QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const = 0;

Expand Down
87 changes: 45 additions & 42 deletions src/core/geometry/qgsgeos.cpp
Expand Up @@ -204,6 +204,7 @@ QgsAbstractGeometryV2* QgsGeos::symDifference( const QgsAbstractGeometryV2& geom

double QgsGeos::distance( const QgsAbstractGeometryV2& geom ) const
{
Q_UNUSED( geom );
return 0.0;
}

Expand Down Expand Up @@ -1230,6 +1231,10 @@ bool QgsGeos::pointOnSurface( QgsPointV2& pt ) const
double x, y;
GEOSGeomGetX_r( geosinit.ctxt, geos, &x );
GEOSGeomGetY_r( geosinit.ctxt, geos, &y );

pt.setX( x );
pt.setY( y );

return true;
}

Expand Down Expand Up @@ -1354,69 +1359,67 @@ GEOSCoordSequence* QgsGeos::createCoordinateSequence( const QgsCurveV2* curve )
GEOSGeometry* QgsGeos::createGeosPoint( const QgsAbstractGeometryV2* point, int coordDims )
{
const QgsPointV2* pt = dynamic_cast<const QgsPointV2*>( point );
if ( pt )
if ( !pt )
return 0;

GEOSCoordSequence* coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, 1, coordDims );
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, 0, pt->x() );
GEOSCoordSeq_setY_r( geosinit.ctxt, coordSeq, 0, pt->y() );
if ( pt->is3D() )
{
GEOSCoordSequence* coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, 1, coordDims );
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, 0, pt->x() );
GEOSCoordSeq_setY_r( geosinit.ctxt, coordSeq, 0, pt->y() );
if ( pt->is3D() )
{
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, 0, 2, pt->z() );
}
if ( pt->isMeasure() )
{
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, 0, 3, pt->m() );
}
return GEOSGeom_createPoint_r( geosinit.ctxt, coordSeq );
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, 0, 2, pt->z() );
}
if ( pt->isMeasure() )
{
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, 0, 3, pt->m() );
}
return GEOSGeom_createPoint_r( geosinit.ctxt, coordSeq );
}

GEOSGeometry* QgsGeos::createGeosLinestring( const QgsAbstractGeometryV2* curve )
{
const QgsCurveV2* c = dynamic_cast<const QgsCurveV2*>( curve );
if ( c )
{
GEOSCoordSequence* coordSeq = createCoordinateSequence( c );
if ( !coordSeq )
{
return 0;
}
return GEOSGeom_createLineString_r( geosinit.ctxt, coordSeq );
}
if ( !c )
return 0;

GEOSCoordSequence* coordSeq = createCoordinateSequence( c );
if ( !coordSeq )
return 0;

return GEOSGeom_createLineString_r( geosinit.ctxt, coordSeq );
}

GEOSGeometry* QgsGeos::createGeosPolygon( const QgsAbstractGeometryV2* poly )
{
const QgsCurvePolygonV2* polygon = dynamic_cast<const QgsCurvePolygonV2*>( poly );
if ( polygon )
{
const QgsCurveV2* exteriorRing = polygon->exteriorRing();
GEOSGeometry* exteriorRingGeos = GEOSGeom_createLinearRing_r( geosinit.ctxt, createCoordinateSequence( exteriorRing ) );
if ( !polygon )
return 0;

int nHoles = polygon->numInteriorRings();
GEOSGeometry** holes = 0;
if ( nHoles > 0 )
{
holes = new GEOSGeometry*[ nHoles ];
}
const QgsCurveV2* exteriorRing = polygon->exteriorRing();
GEOSGeometry* exteriorRingGeos = GEOSGeom_createLinearRing_r( geosinit.ctxt, createCoordinateSequence( exteriorRing ) );

for ( int i = 0; i < nHoles; ++i )
{
const QgsCurveV2* interiorRing = polygon->interiorRing( i );
holes[i] = GEOSGeom_createLinearRing_r( geosinit.ctxt, createCoordinateSequence( interiorRing ) );
}
GEOSGeometry* geosPolygon = GEOSGeom_createPolygon_r( geosinit.ctxt, exteriorRingGeos, holes, nHoles );
delete[] holes;
return geosPolygon;
int nHoles = polygon->numInteriorRings();
GEOSGeometry** holes = 0;
if ( nHoles > 0 )
{
holes = new GEOSGeometry*[ nHoles ];
}

for ( int i = 0; i < nHoles; ++i )
{
const QgsCurveV2* interiorRing = polygon->interiorRing( i );
holes[i] = GEOSGeom_createLinearRing_r( geosinit.ctxt, createCoordinateSequence( interiorRing ) );
}
GEOSGeometry* geosPolygon = GEOSGeom_createPolygon_r( geosinit.ctxt, exteriorRingGeos, holes, nHoles );
delete[] holes;

return geosPolygon;
}

QgsAbstractGeometryV2* QgsGeos::offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const
{
if ( !mGeos )
{
return 0;
}

GEOSGeometry* offset = 0;
try
Expand Down
8 changes: 8 additions & 0 deletions src/server/qgssldconfigparser.cpp
Expand Up @@ -958,7 +958,10 @@ bool QgsSLDConfigParser::labelSettingsFromUserStyle( const QDomElement& userStyl
if ( userStyleElement.isNull() || !vec )
return false;

Q_NOWARN_DEPRECATED_PUSH
vec->enableLabels( false );
Q_NOWARN_DEPRECATED_POP

QDomNodeList featureTypeList = userStyleElement.elementsByTagName( "FeatureTypeStyle" );
if ( featureTypeList.size() <= 0 )
return false;
Expand Down Expand Up @@ -1010,7 +1013,10 @@ bool QgsSLDConfigParser::labelSettingsFromUserStyle( const QDomElement& userStyl
if ( propertyNameList.size() <= 0 )
return false;

Q_NOWARN_DEPRECATED_PUSH
vec->enableLabels( true );
Q_NOWARN_DEPRECATED_POP

QDomElement propertyNameElement = propertyNameList.item( 0 ).toElement();
QString labelAttribute = propertyNameElement.text();
vec->label()->setLabelField( QgsLabel::Text, vec->dataProvider()->fieldNameIndex( labelAttribute ) );
Expand Down Expand Up @@ -1301,7 +1307,9 @@ bool QgsSLDConfigParser::labelSettingsFromUserStyle( const QDomElement& userStyl
myLabelAttributes->setAngle( rotationAngle );
}
} // end labelPlacement
Q_NOWARN_DEPRECATED_PUSH
vec->enableLabels( true );
Q_NOWARN_DEPRECATED_POP

return true;
}
Expand Down

0 comments on commit 8389918

Please sign in to comment.