Skip to content
Permalink
Browse files
Use default copy constructors and assignment operators for QgsDistanc…
…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 cdef0764b51f3bb9f05e6106c82a3350b7e263e9
Showing with 0 additions and 50 deletions.
  1. +0 −7 python/core/qgsdistancearea.sip
  2. +0 −34 src/core/qgsdistancearea.cpp
  3. +0 −9 src/core/qgsdistancearea.h
@@ -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
@@ -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;
@@ -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
@@ -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;

0 comments on commit cdef076

Please sign in to comment.