Skip to content
Permalink
Browse files
Declutter header files
Implementations of virtual methods will never be inlined, there's no
reason to keep them in headers. It just makes code less readable and
potentially slows down compilation.
  • Loading branch information
m-kuhn committed May 19, 2017
1 parent 95ac7d0 commit ac50214347f0fe604088bdb11686ab1fd6b4a34c
@@ -145,6 +145,16 @@ void QgsAnnotation::setMapLayer( QgsMapLayer *layer )
emit mapLayerChanged();
}

void QgsAnnotation::setAssociatedFeature( const QgsFeature &feature )
{
mFeature = feature;
}

QSizeF QgsAnnotation::minimumFrameSize() const
{
return QSizeF( 0, 0 );
}

void QgsAnnotation::updateBalloon()
{
//first test if the point is in the frame. In that case we don't need a balloon.
@@ -252,7 +252,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* Sets the feature associated with the annotation.
* \see associatedFeature()
*/
virtual void setAssociatedFeature( const QgsFeature &feature ) { mFeature = feature; }
virtual void setAssociatedFeature( const QgsFeature &feature );

signals:

@@ -282,7 +282,7 @@ class CORE_EXPORT QgsAnnotation : public QObject
* Returns the minimum frame size for the annotation. Subclasses should implement this if they
* cannot be resized smaller than a certain minimum size.
*/
virtual QSizeF minimumFrameSize() const { return QSizeF( 0, 0 ); }
virtual QSizeF minimumFrameSize() const;

/**
* Writes common annotation properties to a DOM element.
@@ -52,6 +52,36 @@ void QgsComposerMapItem::setComposerMap( QgsComposerMap *map )
mComposerMap = map;
}

const QgsComposerMap *QgsComposerMapItem::composerMap() const
{
return mComposerMap;
}

void QgsComposerMapItem::setName( const QString &name )
{
mName = name;
}

QString QgsComposerMapItem::name() const
{
return mName;
}

void QgsComposerMapItem::setEnabled( const bool enabled )
{
mEnabled = enabled;
}

bool QgsComposerMapItem::enabled() const
{
return mEnabled;
}

bool QgsComposerMapItem::usesAdvancedEffects() const
{
return false;
}

//
// QgsComposerMapItemStack
//
@@ -68,7 +68,7 @@ class CORE_EXPORT QgsComposerMapItem : public QgsComposerObject
* \returns composer map
* \see setComposerMap
*/
virtual const QgsComposerMap *composerMap() const { return mComposerMap; }
virtual const QgsComposerMap *composerMap() const;

/** Get the unique id for the map item
* \returns unique id
@@ -79,13 +79,13 @@ class CORE_EXPORT QgsComposerMapItem : public QgsComposerObject
* \param name display name
* \see name
*/
virtual void setName( const QString &name ) { mName = name; }
virtual void setName( const QString &name );

/** Get friendly display name for the item
* \returns display name
* \see setName
*/
virtual QString name() const { return mName; }
virtual QString name() const;

/** Controls whether the item will be drawn
* \param enabled set to true to enable drawing of the item
@@ -41,6 +41,21 @@ QgsComposerMultiFrame::~QgsComposerMultiFrame()
deleteFrames();
}

QSizeF QgsComposerMultiFrame::fixedFrameSize( const int frameIndex ) const
{
Q_UNUSED( frameIndex ); return QSizeF( 0, 0 );
}

QSizeF QgsComposerMultiFrame::minFrameSize( const int frameIndex ) const
{
Q_UNUSED( frameIndex ); return QSizeF( 0, 0 );
}

double QgsComposerMultiFrame::findNearbyPageBreak( double yPos )
{
return yPos;
}

void QgsComposerMultiFrame::setResizeMode( ResizeMode mode )
{
if ( mode != mResizeMode )
@@ -78,7 +78,7 @@ class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
* \see minFrameSize
* \see recalculateFrameRects
*/
virtual QSizeF fixedFrameSize( const int frameIndex = -1 ) const { Q_UNUSED( frameIndex ); return QSizeF( 0, 0 ); }
virtual QSizeF fixedFrameSize( const int frameIndex = -1 ) const;

/** Returns the minimum size for a frames, if desired. If the minimum
* size changes, the sizes of all frames can be recalculated by calling
@@ -90,7 +90,7 @@ class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
* \see fixedFrameSize
* \see recalculateFrameRects
*/
virtual QSizeF minFrameSize( const int frameIndex = -1 ) const { Q_UNUSED( frameIndex ); return QSizeF( 0, 0 ); }
virtual QSizeF minFrameSize( const int frameIndex = -1 ) const;

/** Renders a portion of the multiframe's content into a painter.
* \param painter destination painter
@@ -113,7 +113,7 @@ class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
* to and before the specified yPos
* \since QGIS 2.3
*/
virtual double findNearbyPageBreak( double yPos ) { return yPos; }
virtual double findNearbyPageBreak( double yPos );

/** Removes a frame from the multiframe. This method automatically removes the frame from the
* composition.
@@ -168,11 +168,21 @@ QgsDropShadowEffect::QgsDropShadowEffect()

}

QString QgsDropShadowEffect::type() const
{
return QStringLiteral( "dropShadow" );
}

QgsDropShadowEffect *QgsDropShadowEffect::clone() const
{
return new QgsDropShadowEffect( *this );
}

bool QgsDropShadowEffect::exteriorShadow() const
{
return true;
}


//
// QgsInnerShadowEffect
@@ -191,7 +201,17 @@ QgsInnerShadowEffect::QgsInnerShadowEffect()

}

QString QgsInnerShadowEffect::type() const
{
return QStringLiteral( "innerShadow" );
}

QgsInnerShadowEffect *QgsInnerShadowEffect::clone() const
{
return new QgsInnerShadowEffect( *this );
}

bool QgsInnerShadowEffect::exteriorShadow() const
{
return false;
}
@@ -199,12 +199,12 @@ class CORE_EXPORT QgsDropShadowEffect : public QgsShadowEffect

QgsDropShadowEffect();

virtual QString type() const override { return QStringLiteral( "dropShadow" ); }
virtual QString type() const override;
virtual QgsDropShadowEffect *clone() const override;

protected:

virtual bool exteriorShadow() const override { return true; }
virtual bool exteriorShadow() const override;

};

@@ -228,12 +228,12 @@ class CORE_EXPORT QgsInnerShadowEffect : public QgsShadowEffect

QgsInnerShadowEffect();

virtual QString type() const override { return QStringLiteral( "innerShadow" ); }
virtual QString type() const override;
virtual QgsInnerShadowEffect *clone() const override;

protected:

virtual bool exteriorShadow() const override { return false; }
virtual bool exteriorShadow() const override;

};

@@ -122,6 +122,10 @@ QgsRectangle QgsAbstractGeometry::calculateBoundingBox() const
return QgsRectangle( xmin, ymin, xmax, ymax );
}

void QgsAbstractGeometry::clearCache() const
{
}

int QgsAbstractGeometry::nCoordinates() const
{
int nCoords = 0;
@@ -137,6 +141,21 @@ int QgsAbstractGeometry::nCoordinates() const
return nCoords;
}

double QgsAbstractGeometry::length() const
{
return 0.0;
}

double QgsAbstractGeometry::perimeter() const
{
return 0.0;
}

double QgsAbstractGeometry::area() const
{
return 0.0;
}

QString QgsAbstractGeometry::wktTypeStr() const
{
QString wkt = geometryType();
@@ -237,6 +256,11 @@ bool QgsAbstractGeometry::isEmpty() const
return !nextVertex( vId, vertex );
}

bool QgsAbstractGeometry::hasCurvedSegments() const
{
return false;
}


QgsAbstractGeometry *QgsAbstractGeometry::segmentize( double tolerance, SegmentationToleranceType toleranceType ) const
{
@@ -245,3 +269,8 @@ QgsAbstractGeometry *QgsAbstractGeometry::segmentize( double tolerance, Segmenta
return clone();
}

QgsAbstractGeometry *QgsAbstractGeometry::toCurveType() const
{
return 0;
}

@@ -306,19 +306,19 @@ class CORE_EXPORT QgsAbstractGeometry
* \see area()
* \see perimeter()
*/
virtual double length() const { return 0.0; }
virtual double length() const;

/** Returns the perimeter of the geometry.
* \see area()
* \see length()
*/
virtual double perimeter() const { return 0.0; }
virtual double perimeter() const;

/** Returns the area of the geometry.
* \see length()
* \see perimeter()
*/
virtual double area() const { return 0.0; }
virtual double area() const;

//! Returns the centroid of the geometry
virtual QgsPointV2 centroid() const;
@@ -329,7 +329,7 @@ class CORE_EXPORT QgsAbstractGeometry

/** Returns true if the geometry contains curved segments
*/
virtual bool hasCurvedSegments() const { return false; }
virtual bool hasCurvedSegments() const;

/** Returns a version of the geometry without curves. Caller takes ownership of
* the returned geometry.
@@ -342,7 +342,7 @@ class CORE_EXPORT QgsAbstractGeometry
E.g. QgsLineString -> QgsCompoundCurve, QgsPolygonV2 -> QgsCurvePolygon,
QgsMultiLineString -> QgsMultiCurve, QgsMultiPolygonV2 -> QgsMultiSurface
\returns the converted geometry. Caller takes ownership*/
virtual QgsAbstractGeometry *toCurveType() const SIP_FACTORY { return 0; }
virtual QgsAbstractGeometry *toCurveType() const SIP_FACTORY;

/** Returns approximate angle at a vertex. This is usually the average angle between adjacent
* segments, and can be pictured as the orientation of a line following the curvature of the
@@ -422,7 +422,7 @@ class CORE_EXPORT QgsAbstractGeometry

/** Clears any cached parameters associated with the geometry, e.g., bounding boxes
*/
virtual void clearCache() const {}
virtual void clearCache() const;

};

@@ -97,6 +97,24 @@ QgsCurve *QgsCurve::segmentize( double tolerance, SegmentationToleranceType tole
return curveToLine( tolerance, toleranceType );
}

int QgsCurve::vertexCount( int part, int ring ) const
{
Q_UNUSED( part );
Q_UNUSED( ring );
return numPoints();
}

int QgsCurve::ringCount( int part ) const
{
Q_UNUSED( part );
return numPoints() > 0 ? 1 : 0;
}

int QgsCurve::partCount() const
{
return numPoints() > 0 ? 1 : 0;
}

QgsPointV2 QgsCurve::vertexAt( QgsVertexId id ) const
{
QgsPointV2 v;
@@ -126,3 +144,10 @@ QPolygonF QgsCurve::asQPolygonF() const
return points;
}

void QgsCurve::clearCache() const
{
mBoundingBox = QgsRectangle();
mCoordinateSequence.clear();
QgsAbstractGeometry::clearCache();
}

@@ -109,9 +109,9 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry
* \param toleranceType maximum segmentation angle or maximum difference between approximation and curve*/
QgsCurve *segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override SIP_FACTORY;

virtual int vertexCount( int part = 0, int ring = 0 ) const override { Q_UNUSED( part ); Q_UNUSED( ring ); return numPoints(); }
virtual int ringCount( int part = 0 ) const override { Q_UNUSED( part ); return numPoints() > 0 ? 1 : 0; }
virtual int partCount() const override { return numPoints() > 0 ? 1 : 0; }
virtual int vertexCount( int part = 0, int ring = 0 ) const override;
virtual int ringCount( int part = 0 ) const override;
virtual int partCount() const override;
virtual QgsPointV2 vertexAt( QgsVertexId id ) const override;

virtual QgsRectangle boundingBox() const override;
@@ -137,7 +137,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry

protected:

virtual void clearCache() const override { mBoundingBox = QgsRectangle(); mCoordinateSequence.clear(); QgsAbstractGeometry::clearCache(); }
virtual void clearCache() const override;

private:

0 comments on commit ac50214

Please sign in to comment.