Skip to content
Permalink
Browse files

Reduce warning noise and fix some doxymentation issues

Some warnings are wrapped in Q_NOWARN_DEPRECATED_*, these are warnings for
issues which are not critical and therefore of limited importance.

The general idea is to leave the space for compiler warnings to the one that
really need to be addressed.

Also removes a no longer required header file of dxflib.

Exposes some ready-to use doxymentation by wrapping it in appropriate comment
structure.

And some more cleanup
  • Loading branch information
m-kuhn committed Jun 15, 2015
1 parent f1eb380 commit 038f99b505d6d233f201196909e090aa97d10e6a
@@ -16,7 +16,7 @@ notifications:
urls:
- https://webhooks.gitter.im/e/467e3aff72e344d1dae3
on_success: change # options: [always|never|change] default: always
on_failure: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # default: never

addons:
@@ -288,7 +288,9 @@ int QgsTransectSample::createSample( QProgressDialog* pd )
outputPointWriter.addFeature( samplePointFeature );

sIndex.insertFeature( sampleLineFeature );
Q_NOWARN_DEPRECATED_PUSH
lineFeatureMap.insert( fid, sampleLineFeature.geometryAndOwnership() );
Q_NOWARN_DEPRECATED_POP

delete lineFarAwayGeom;
++nTotalTransects;
@@ -336,7 +338,9 @@ QgsGeometry* QgsTransectSample::findBaselineGeometry( QVariant strataId )
{
if ( strataId == fet.attribute( mBaselineStrataId ) || mShareBaseline )
{
Q_NOWARN_DEPRECATED_PUSH
return fet.geometryAndOwnership();
Q_NOWARN_DEPRECATED_POP
}
}
return 0;
@@ -22,19 +22,9 @@
QgsLabelPreview::QgsLabelPreview( QWidget* parent )
: QLabel( parent )
{
mTmpLyr = new QgsPalLayerSettings();

// construct a device-based render context
QgsMapToPixel newCoordXForm;
newCoordXForm.setParameters( 1, 0, 0, 0 );
mContext = new QgsRenderContext();
mContext->setMapToPixel( newCoordXForm );
}

QgsLabelPreview::~QgsLabelPreview()
{
delete mTmpLyr;
delete mContext;
QgsMapToPixel newCoordXForm( 1 );
mContext.setMapToPixel( newCoordXForm );
}

void QgsLabelPreview::setTextColor( QColor color )
@@ -45,13 +35,13 @@ void QgsLabelPreview::setTextColor( QColor color )

void QgsLabelPreview::setBuffer( double size, QColor color, Qt::PenJoinStyle joinStyle, bool noFill )
{
mTmpLyr->bufferSize = size * 88 / 25.4; //assume standard dpi for preview;
mTmpLyr->bufferSizeInMapUnits = false;
mTmpLyr->bufferColor = color;
mTmpLyr->bufferJoinStyle = joinStyle;
mTmpLyr->bufferNoFill = noFill;
mTmpLyr.bufferSize = size * 88 / 25.4; //assume standard dpi for preview;
mTmpLyr.bufferSizeInMapUnits = false;
mTmpLyr.bufferColor = color;
mTmpLyr.bufferJoinStyle = joinStyle;
mTmpLyr.bufferNoFill = noFill;

mTmpLyr->textFont = font();
mTmpLyr.textFont = font();
update();
}

@@ -62,28 +52,28 @@ void QgsLabelPreview::paintEvent( QPaintEvent *e )

// TODO: draw all label components when this preview is an actual map canvas
// for now, only preview label's text and buffer
mTmpLyr->shadowDraw = false;
mTmpLyr.shadowDraw = false;

p.setRenderHint( QPainter::Antialiasing );
p.setFont( font() );
QFontMetrics fm( font() );

// otherwise thin buffers don't look like those on canvas
if ( mTmpLyr->bufferSize != 0 && mTmpLyr->bufferSize < 1 )
mTmpLyr->bufferSize = 1;
if ( mTmpLyr.bufferSize != 0 && mTmpLyr.bufferSize < 1 )
mTmpLyr.bufferSize = 1;

double xtrans = 0;
if ( mTmpLyr->bufferSize != 0 )
xtrans = mTmpLyr->bufferSize / 4;
if ( mTmpLyr.bufferSize != 0 )
xtrans = mTmpLyr.bufferSize / 4;

p.translate( xtrans, fm.ascent() + 4 );

if ( mTmpLyr->bufferSize != 0 )
if ( mTmpLyr.bufferSize != 0 )
{
mContext->setPainter( &p );
mContext.setPainter( &p );
QgsLabelComponent component;
component.setText( text() );
QgsPalLabeling::drawLabelBuffer( *mContext, component, *mTmpLyr );
QgsPalLabeling::drawLabelBuffer( mContext, component, mTmpLyr );
}

QPainterPath path;
@@ -25,7 +25,6 @@ class APP_EXPORT QgsLabelPreview : public QLabel
{
public:
QgsLabelPreview( QWidget* parent = NULL );
~QgsLabelPreview();

void setTextColor( QColor color );

@@ -37,12 +36,12 @@ class APP_EXPORT QgsLabelPreview : public QLabel
void paintEvent( QPaintEvent* e ) override;

private:
QgsPalLayerSettings* mTmpLyr;
QgsPalLayerSettings mTmpLyr;
QColor mTextColor;
QFont mFont;

// device-based render context
QgsRenderContext* mContext;
QgsRenderContext mContext;
};

#endif // LABELPREVIEW_H
@@ -278,8 +278,10 @@ QgsGeometry* QgsMapToolOffsetCurve::createOriginGeometry( QgsVectorLayer* vl, co

if ( vl == currentVectorLayer() && !mForceCopy )
{
Q_NOWARN_DEPRECATED_PUSH
//don't consider selected geometries, only the snap result
return convertToSingleLine( snappedFeature.geometryAndOwnership(), partVertexNr, mMultiPartGeometry );
Q_NOWARN_DEPRECATED_POP
}
else //snapped to a background layer
{
@@ -294,14 +296,18 @@ QgsGeometry* QgsMapToolOffsetCurve::createOriginGeometry( QgsVectorLayer* vl, co
const QgsFeatureIds& selection = vl->selectedFeaturesIds();
if ( selection.size() < 1 || !selection.contains( match.featureId() ) )
{
Q_NOWARN_DEPRECATED_PUSH
return convertToSingleLine( snappedFeature.geometryAndOwnership(), partVertexNr, mMultiPartGeometry );
Q_NOWARN_DEPRECATED_POP
}
else
{
//merge together if several features
QgsFeatureList selectedFeatures = vl->selectedFeatures();
QgsFeatureList::iterator selIt = selectedFeatures.begin();
Q_NOWARN_DEPRECATED_PUSH
QgsGeometry* geom = selIt->geometryAndOwnership();
Q_NOWARN_DEPRECATED_POP
++selIt;
for ( ; selIt != selectedFeatures.end(); ++selIt )
{
@@ -314,7 +320,9 @@ QgsGeometry* QgsMapToolOffsetCurve::createOriginGeometry( QgsVectorLayer* vl, co
if ( geom->isMultipart() )
{
delete geom;
Q_NOWARN_DEPRECATED_PUSH
return convertToSingleLine( snappedFeature.geometryAndOwnership(), match.vertexIndex(), mMultiPartGeometry );
Q_NOWARN_DEPRECATED_POP
}

return geom;
@@ -50,7 +50,9 @@ QgsDxfPalLabeling::QgsDxfPalLabeling( QgsDxfExport* dxf, const QgsRectangle& bbo
mRenderContext.setRendererScale( scale );
mRenderContext.setExtent( bbox );
mRenderContext.setScaleFactor( 96.0 / 25.4 );
Q_NOWARN_DEPRECATED_PUSH
mRenderContext.setMapToPixel( QgsMapToPixel( 1.0 / factor, bbox.xMinimum(), bbox.yMinimum(), bbox.height() * factor ) );
Q_NOWARN_DEPRECATED_POP
}

QgsDxfPalLabeling::~QgsDxfPalLabeling()
@@ -202,7 +202,7 @@ QgsRenderContext * QgsSymbolV2LegendNode::createTemporaryRenderContext() const
QScopedPointer<QgsRenderContext> context( new QgsRenderContext );
context->setScaleFactor( dpi / 25.4 );
context->setRendererScale( scale );
context->setMapToPixel( QgsMapToPixel( mupp ) ); // hope it's ok to leave out other params
context->setMapToPixel( QgsMapToPixel( mupp ) );
return validData ? context.take() : 0;
}

@@ -309,7 +309,7 @@ QSizeF QgsSymbolV2LegendNode::drawSymbol( const QgsLegendSettings& settings, Ite
QgsRenderContext context;
context.setScaleFactor( settings.dpi() / 25.4 );
context.setRendererScale( settings.mapScale() );
context.setMapToPixel( QgsMapToPixel( 1 / ( settings.mmPerMapUnit() * context.scaleFactor() ) ) ); // hope it's ok to leave out other params
context.setMapToPixel( QgsMapToPixel( 1 / ( settings.mmPerMapUnit() * context.scaleFactor() ) ) );
context.setForceVectorOutput( true );
context.setPainter( ctx ? ctx->painter : 0 );

@@ -84,7 +84,7 @@ namespace pal
friend class FeaturePart;

public:
Feature( Layer* l, const char* id, PalGeometry* userG, double lx, double ly );
Feature( Layer* l, const char* geom_id, PalGeometry* userG, double lx, double ly );
~Feature();

void setLabelInfo( LabelInfo* info ) { labelInfo = info; }
@@ -451,9 +451,9 @@ typedef unsigned long long qgssize;
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
#define Q_NOWARN_DEPRECATED_PUSH \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"");
#define Q_NOWARN_DEPRECATED_POP \
_Pragma("GCC diagnostic pop")
_Pragma("GCC diagnostic pop");
#elif defined(_MSC_VER)
#define Q_NOWARN_DEPRECATED_PUSH \
__pragma(warning(push)) \
@@ -465,7 +465,6 @@ typedef unsigned long long qgssize;
#define Q_NOWARN_DEPRECATED_POP
#endif

// FIXME: also in qgisinterface.h
#ifndef QGISEXTERN
#ifdef WIN32
# define QGISEXTERN extern "C" __declspec( dllexport )
@@ -175,7 +175,7 @@ void QgsMapRenderer::adjustExtentToSize()
if ( !myWidth || !myHeight )
{
mScale = 1.0;
newCoordXForm.setParameters( 1, 0, 0, 0 );
newCoordXForm.setParameters( 1, 0, 0, 0, 0, 0 );
return;
}

@@ -225,7 +225,9 @@ void QgsMapRenderer::adjustExtentToSize()

QgsDebugMsg( QString( "Scale (assuming meters as map units) = 1:%1" ).arg( qgsDoubleToString( mScale ) ) );

Q_NOWARN_DEPRECATED_PUSH
newCoordXForm.setParameters( mMapUnitsPerPixel, dxmin, dymin, myHeight );
Q_NOWARN_DEPRECATED_POP
mRenderContext.setMapToPixel( newCoordXForm );
mRenderContext.setExtent( mExtent );
}
@@ -485,7 +487,9 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
bk_mapToPixel = mRenderContext.mapToPixel();
rasterMapToPixel = mRenderContext.mapToPixel();
rasterMapToPixel.setMapUnitsPerPixel( mRenderContext.mapToPixel().mapUnitsPerPixel() / rasterScaleFactor );
Q_NOWARN_DEPRECATED_PUSH
rasterMapToPixel.setYMaximum( mSize.height() * rasterScaleFactor );
Q_NOWARN_DEPRECATED_POP
mRenderContext.setMapToPixel( rasterMapToPixel );
mRenderContext.painter()->save();
mRenderContext.painter()->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
@@ -42,6 +42,20 @@ QgsMapToPixel::QgsMapToPixel( double mapUnitsPerPixel,
updateMatrix();
}

QgsMapToPixel::QgsMapToPixel( double mapUnitsPerPixel )
: mMapUnitsPerPixel( mapUnitsPerPixel )
, mWidth( 0 )
, mHeight( 0 )
, mRotation( 0 )
, xCenter( 0 )
, yCenter( 0 )
, xMin( 0 )
, yMin( 0 )
{
Q_ASSERT( mapUnitsPerPixel > 0 );
updateMatrix();
}

QgsMapToPixel::QgsMapToPixel()
: mMapUnitsPerPixel( 1 )
, mWidth( 1 )

0 comments on commit 038f99b

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