Skip to content
Permalink
Browse files

Move overriden methods from headers to cpp files

Since they can't be inlined anyway
  • Loading branch information
nyalldawson committed Sep 19, 2017
1 parent f387210 commit 9e61cd63df35415336f8a6cf22b30f4b294c6504
Showing with 221 additions and 39 deletions.
  1. +2 −0 python/core/geometry/qgscircle.sip
  2. +2 −0 python/core/geometry/qgsgeometrycollection.sip
  3. +3 −0 python/core/geometry/qgslinestring.sip
  4. +1 −0 python/core/geometry/qgsmulticurve.sip
  5. +2 −0 python/core/geometry/qgsmultilinestring.sip
  6. +3 −0 python/core/geometry/qgsmultipoint.sip
  7. +2 −0 python/core/geometry/qgsmultipolygon.sip
  8. +1 −0 python/core/geometry/qgsmultisurface.sip
  9. +12 −0 python/core/geometry/qgspoint.sip
  10. +1 −0 python/core/geometry/qgstriangle.sip
  11. +12 −0 src/core/geometry/qgscircle.cpp
  12. +2 −10 src/core/geometry/qgscircle.h
  13. +10 −0 src/core/geometry/qgscompoundcurve.cpp
  14. +2 −2 src/core/geometry/qgscompoundcurve.h
  15. +10 −0 src/core/geometry/qgsgeometrycollection.cpp
  16. +2 −2 src/core/geometry/qgsgeometrycollection.h
  17. +15 −0 src/core/geometry/qgslinestring.cpp
  18. +3 −3 src/core/geometry/qgslinestring.h
  19. +5 −0 src/core/geometry/qgsmulticurve.cpp
  20. +1 −1 src/core/geometry/qgsmulticurve.h
  21. +10 −0 src/core/geometry/qgsmultilinestring.cpp
  22. +2 −2 src/core/geometry/qgsmultilinestring.h
  23. +15 −0 src/core/geometry/qgsmultipoint.cpp
  24. +3 −3 src/core/geometry/qgsmultipoint.h
  25. +10 −0 src/core/geometry/qgsmultipolygon.cpp
  26. +2 −2 src/core/geometry/qgsmultipolygon.h
  27. +5 −0 src/core/geometry/qgsmultisurface.cpp
  28. +1 −1 src/core/geometry/qgsmultisurface.h
  29. +64 −0 src/core/geometry/qgspoint.cpp
  30. +12 −12 src/core/geometry/qgspoint.h
  31. +5 −0 src/core/geometry/qgstriangle.cpp
  32. +1 −1 src/core/geometry/qgstriangle.h
@@ -133,13 +133,15 @@ class QgsCircle : QgsEllipse


virtual void setSemiMajorAxis( const double semiMajorAxis );

%Docstring
Inherited method. Use setRadius instead.
.. seealso:: radius()
.. seealso:: setRadius()
%End

virtual void setSemiMinorAxis( const double semiMinorAxis );

%Docstring
Inherited method. Use setRadius instead.
.. seealso:: radius()
@@ -152,8 +152,10 @@ Adds a geometry and takes ownership. Returns true in case of success.
virtual int ringCount( int part = 0 ) const;

virtual int partCount() const;

virtual QgsPoint vertexAt( QgsVertexId id ) const;


virtual bool addZValue( double zValue = 0 );

virtual bool addMValue( double mValue = 0 );
@@ -168,7 +168,9 @@ Closes the line string by appending the first point to the end of the line, if i


virtual QString geometryType() const;

virtual int dimension() const;

virtual QgsLineString *clone() const /Factory/;

virtual void clear();
@@ -212,6 +214,7 @@ Closes the line string by appending the first point to the end of the line, if i
virtual int numPoints() const;

virtual int nCoordinates() const;

virtual void points( QgsPointSequence &pt /Out/ ) const;


@@ -21,6 +21,7 @@ class QgsMultiCurve: QgsGeometryCollection
public:
QgsMultiCurve();
virtual QString geometryType() const;

virtual QgsMultiCurve *clone() const /Factory/;

virtual QgsMultiCurve *toCurveType() const /Factory/;
@@ -21,6 +21,7 @@ class QgsMultiLineString: QgsMultiCurve
public:
QgsMultiLineString();
virtual QString geometryType() const;

virtual QgsMultiLineString *clone() const /Factory/;


@@ -52,6 +53,7 @@ Adds a geometry and takes ownership. Returns true in case of success
protected:

virtual bool wktOmitChildType() const;

};

/************************************************************************
@@ -21,6 +21,7 @@ class QgsMultiPointV2: QgsGeometryCollection
public:
QgsMultiPointV2();
virtual QString geometryType() const;

virtual QgsMultiPointV2 *clone() const /Factory/;

virtual QgsMultiPointV2 *toCurveType() const /Factory/;
@@ -38,6 +39,7 @@ class QgsMultiPointV2: QgsGeometryCollection

virtual int nCoordinates() const;


virtual bool addGeometry( QgsAbstractGeometry *g /Transfer/ );

%Docstring
@@ -52,6 +54,7 @@ Adds a geometry and takes ownership. Returns true in case of success

virtual bool wktOmitChildType() const;


};

/************************************************************************
@@ -21,6 +21,7 @@ class QgsMultiPolygonV2: QgsMultiSurface
public:
QgsMultiPolygonV2();
virtual QString geometryType() const;

virtual QgsMultiPolygonV2 *clone() const /Factory/;


@@ -55,6 +56,7 @@ Adds a geometry and takes ownership. Returns true in case of success
protected:

virtual bool wktOmitChildType() const;

};

/************************************************************************
@@ -21,6 +21,7 @@ class QgsMultiSurface: QgsGeometryCollection
public:
QgsMultiSurface();
virtual QString geometryType() const;

virtual QgsMultiSurface *clone() const /Factory/;

virtual QgsMultiSurface *toCurveType() const /Factory/;
@@ -329,9 +329,13 @@ class QgsPoint: QgsAbstractGeometry
%End

virtual bool isEmpty() const;

virtual QgsRectangle boundingBox() const;

virtual QString geometryType() const;

virtual int dimension() const;

virtual QgsPoint *clone() const /Factory/;

virtual void clear();
@@ -359,20 +363,24 @@ class QgsPoint: QgsAbstractGeometry
virtual QgsCoordinateSequence coordinateSequence() const;

virtual int nCoordinates() const;

virtual QgsAbstractGeometry *boundary() const /Factory/;


virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );

virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos );

virtual bool deleteVertex( QgsVertexId position );


virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;

virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;


virtual double vertexAngle( QgsVertexId vertex ) const;

%Docstring
Angle undefined. Always returns 0.0
\param vertex the vertex id
@@ -381,9 +389,13 @@ class QgsPoint: QgsAbstractGeometry
%End

virtual int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const;

virtual int ringCount( int /*part*/ = 0 ) const;

virtual int partCount() const;

virtual QgsPoint vertexAt( QgsVertexId /*id*/ ) const;

virtual QgsPoint *toCurveType() const /Factory/;


@@ -56,6 +56,7 @@ class QgsTriangle : QgsPolygonV2
%End

virtual QString geometryType() const;

virtual QgsTriangle *clone() const /Factory/;

virtual void clear();
@@ -227,6 +227,18 @@ double QgsCircle::perimeter() const
return 2.0 * M_PI * mSemiMajorAxis;
}

void QgsCircle::setSemiMajorAxis( const double semiMajorAxis )
{
mSemiMajorAxis = std::fabs( semiMajorAxis );
mSemiMinorAxis = mSemiMajorAxis;
}

void QgsCircle::setSemiMinorAxis( const double semiMinorAxis )
{
mSemiMajorAxis = std::fabs( semiMinorAxis );
mSemiMinorAxis = mSemiMajorAxis;
}

QVector<QgsPoint> QgsCircle::northQuadrant() const
{
QVector<QgsPoint> quad;
@@ -143,21 +143,13 @@ class CORE_EXPORT QgsCircle : public QgsEllipse
* \see radius()
* \see setRadius()
*/
void setSemiMajorAxis( const double semiMajorAxis ) override
{
mSemiMajorAxis = std::fabs( semiMajorAxis );
mSemiMinorAxis = mSemiMajorAxis;
}
void setSemiMajorAxis( const double semiMajorAxis ) override;

/** Inherited method. Use setRadius instead.
* \see radius()
* \see setRadius()
*/
void setSemiMinorAxis( const double semiMinorAxis ) override
{
mSemiMajorAxis = std::fabs( semiMinorAxis );
mSemiMinorAxis = mSemiMajorAxis;
}
void setSemiMinorAxis( const double semiMinorAxis ) override;

//! Returns the radius of the circle
double radius() const {return mSemiMajorAxis;}
@@ -49,6 +49,16 @@ bool QgsCompoundCurve::operator!=( const QgsCurve &other ) const
return !operator==( other );
}

QString QgsCompoundCurve::geometryType() const
{
return QStringLiteral( "CompoundCurve" );
}

int QgsCompoundCurve::dimension() const
{
return 1;
}

QgsCompoundCurve::QgsCompoundCurve( const QgsCompoundCurve &curve ): QgsCurve( curve )
{
mWkbType = QgsWkbTypes::CompoundCurve;
@@ -38,8 +38,8 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve
virtual bool operator==( const QgsCurve &other ) const override;
virtual bool operator!=( const QgsCurve &other ) const override;

virtual QString geometryType() const override { return QStringLiteral( "CompoundCurve" ); }
virtual int dimension() const override { return 1; }
virtual QString geometryType() const override;
virtual int dimension() const override;
virtual QgsCompoundCurve *clone() const override SIP_FACTORY;
virtual void clear() override;

@@ -639,6 +639,16 @@ int QgsGeometryCollection::ringCount( int part ) const
return mGeometries[part]->ringCount();
}

int QgsGeometryCollection::partCount() const
{
return mGeometries.size();
}

QgsPoint QgsGeometryCollection::vertexAt( QgsVertexId id ) const
{
return mGeometries[id.part]->vertexAt( id );
}

bool QgsGeometryCollection::addZValue( double zValue )
{
if ( QgsWkbTypes::hasZ( mWkbType ) )
@@ -123,8 +123,8 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry

int vertexCount( int part = 0, int ring = 0 ) const override;
int ringCount( int part = 0 ) const override;
int partCount() const override { return mGeometries.size(); }
QgsPoint vertexAt( QgsVertexId id ) const override { return mGeometries[id.part]->vertexAt( id ); }
int partCount() const override;
QgsPoint vertexAt( QgsVertexId id ) const override;

bool addZValue( double zValue = 0 ) override;
bool addMValue( double mValue = 0 ) override;
@@ -370,6 +370,11 @@ int QgsLineString::numPoints() const
return mX.size();
}

int QgsLineString::nCoordinates() const
{
return mX.size();
}

QgsPoint QgsLineString::pointN( int i ) const
{
if ( i < 0 || i >= mX.size() )
@@ -698,6 +703,16 @@ void QgsLineString::extend( double startDistance, double endDistance )
}
}

QString QgsLineString::geometryType() const
{
return QStringLiteral( "LineString" );
}

int QgsLineString::dimension() const
{
return 1;
}

/***************************************************************************
* This class is considered CRITICAL and any change MUST be accompanied with
* full unit tests.
@@ -162,8 +162,8 @@ class CORE_EXPORT QgsLineString: public QgsCurve

//reimplemented methods

QString geometryType() const override { return QStringLiteral( "LineString" ); }
int dimension() const override { return 1; }
QString geometryType() const override;
int dimension() const override;
QgsLineString *clone() const override SIP_FACTORY;
void clear() override;
bool isEmpty() const override;
@@ -189,7 +189,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve
QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const override SIP_FACTORY;

int numPoints() const override;
int nCoordinates() const override { return mX.size(); }
int nCoordinates() const override;
void points( QgsPointSequence &pt SIP_OUT ) const override;

void draw( QPainter &p ) const override;
@@ -28,6 +28,11 @@ QgsMultiCurve::QgsMultiCurve()
mWkbType = QgsWkbTypes::MultiCurve;
}

QString QgsMultiCurve::geometryType() const
{
return QStringLiteral( "MultiCurve" );
}

QgsMultiCurve *QgsMultiCurve::clone() const
{
return new QgsMultiCurve( *this );
@@ -29,7 +29,7 @@ class CORE_EXPORT QgsMultiCurve: public QgsGeometryCollection
{
public:
QgsMultiCurve();
QString geometryType() const override { return QStringLiteral( "MultiCurve" ); }
QString geometryType() const override;
QgsMultiCurve *clone() const override SIP_FACTORY;
QgsMultiCurve *toCurveType() const override SIP_FACTORY;

@@ -28,6 +28,11 @@ QgsMultiLineString::QgsMultiLineString()
mWkbType = QgsWkbTypes::MultiLineString;
}

QString QgsMultiLineString::geometryType() const
{
return QStringLiteral( "MultiLineString" );
}

QgsMultiLineString *QgsMultiLineString::clone() const
{
return new QgsMultiLineString( *this );
@@ -119,3 +124,8 @@ QgsMultiCurve *QgsMultiLineString::toCurveType() const
return multiCurve;
}

bool QgsMultiLineString::wktOmitChildType() const
{
return true;
}

@@ -29,7 +29,7 @@ class CORE_EXPORT QgsMultiLineString: public QgsMultiCurve
{
public:
QgsMultiLineString();
QString geometryType() const override { return QStringLiteral( "MultiLineString" ); }
QString geometryType() const override;
QgsMultiLineString *clone() const override SIP_FACTORY;

bool fromWkt( const QString &wkt ) override;
@@ -66,7 +66,7 @@ class CORE_EXPORT QgsMultiLineString: public QgsMultiCurve
#endif
protected:

bool wktOmitChildType() const override { return true; }
bool wktOmitChildType() const override;
};

#endif // QGSMULTILINESTRINGV2_H

0 comments on commit 9e61cd6

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