Skip to content

Commit

Permalink
Use default copy constructors and assignment operators for QgsDistanc…
Browse files Browse the repository at this point in the history
…eArea

There's no complex member variables here - the default implementations
should be fine (actually faster, since they won't require
recalculation of the derived parameters)
  • Loading branch information
nyalldawson committed Apr 17, 2017
1 parent 275158a commit cdef076
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 50 deletions.
7 changes: 0 additions & 7 deletions python/core/qgsdistancearea.sip
Expand Up @@ -32,13 +32,6 @@ General purpose distance and area calculator.
Constructor
%End

QgsDistanceArea( const QgsDistanceArea &origDA );
%Docstring
Copy constructor
%End

// QgsDistanceArea &operator=( const QgsDistanceArea &origDA );

void setEllipsoidalMode( bool flag );
%Docstring
Sets whether coordinates must be projected to ellipsoid before measuring
Expand Down
34 changes: 0 additions & 34 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -55,40 +55,6 @@ QgsDistanceArea::QgsDistanceArea()
setEllipsoid( GEO_NONE );
}


QgsDistanceArea::QgsDistanceArea( const QgsDistanceArea &origDA )
{
_copy( origDA );
}

QgsDistanceArea &QgsDistanceArea::operator=( const QgsDistanceArea &origDA )
{
if ( this == & origDA )
{
// Do not copy unto self
return *this;
}
_copy( origDA );
return *this;
}

//! Copy helper. Avoid Sqlite3 accesses.
void QgsDistanceArea::_copy( const QgsDistanceArea &origDA )
{
mEllipsoidalMode = origDA.mEllipsoidalMode;
mEllipsoid = origDA.mEllipsoid;
mSemiMajor = origDA.mSemiMajor;
mSemiMinor = origDA.mSemiMinor;
mInvFlattening = origDA.mInvFlattening;
if ( ( mSemiMajor > 0 ) && ( mSemiMinor > 0 ) )
{
// Some calculations and trig. Should not be TOO time consuming.
// Alternatively we could copy the temp vars?
computeAreaInit();
}
mCoordTransform = origDA.mCoordTransform;
}

void QgsDistanceArea::setEllipsoidalMode( bool flag )
{
mEllipsoidalMode = flag;
Expand Down
9 changes: 0 additions & 9 deletions src/core/qgsdistancearea.h
Expand Up @@ -42,12 +42,6 @@ class CORE_EXPORT QgsDistanceArea
//! Constructor
QgsDistanceArea();

//! Copy constructor
QgsDistanceArea( const QgsDistanceArea &origDA );

//! Assignment operator
QgsDistanceArea &operator=( const QgsDistanceArea &origDA );

/** Sets whether coordinates must be projected to ellipsoid before measuring
* \note for calculations to use the ellipsoid, both the ellipsoid mode must be true
* and an ellipse must be set
Expand Down Expand Up @@ -340,9 +334,6 @@ class CORE_EXPORT QgsDistanceArea
Length
};

//! Copy helper
void _copy( const QgsDistanceArea &origDA );

//! used for transforming coordinates from source CRS to ellipsoid's coordinates
QgsCoordinateTransform mCoordTransform;

Expand Down

0 comments on commit cdef076

Please sign in to comment.