Skip to content
Permalink
Browse files

Renamed one member and its funtcion, and undo last commit

  • Loading branch information
homann committed Aug 23, 2012
1 parent edb2a7f commit 1873866054909073774b12f35ed5e01df9501333
@@ -14,8 +14,8 @@ class QgsDistanceArea
~QgsDistanceArea();

//! sets whether coordinates must be projected to ellipsoid before measuring
void setProjectionsEnabled(bool flag);
void setEllipsoidalEnabled(bool flag) /Deprecated/;
void setEllipsoidalMode(bool flag);
void setProjectionsEnabled(bool flag) /Deprecated/;

//! returns projections enabled flag
bool ellipsoidalEnabled();
@@ -70,6 +70,6 @@ class QgsDistanceArea
static QString textUnit( double value, int decimals, QGis::UnitType u, bool isArea, bool keepBaseUnit = false );

//! Helper for conversion between physical units
void convertMeasurement( double &measure, QGis::UnitType &measureUnits, QGis::displayUnits, bool isArea );
void convertMeasurement( double &measure, QGis::UnitType &measureUnits, QGis::UnitType displayUnits, bool isArea );

};
@@ -46,7 +46,7 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface
{
mDa.setSourceCrs( mCrs.srsid() );
mDa.setEllipsoid( ellipsoidID );
mDa.setEllipsoidalEnabled( ctfEnabled );
mDa.setEllipsoidalMode( ctfEnabled );
}

//! Destructor
@@ -245,7 +245,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
QgsDistanceArea calc;
if ( !featureList.count() == 0 )
{
calc.setEllipsoidalEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
calc.setEllipsoidalMode( mCanvas->hasCrsTransformEnabled() );
calc.setEllipsoid( ellipsoid );
calc.setSourceCrs( layer->crs().srsid() );
}
@@ -183,7 +183,7 @@ void QgsMapToolMeasureAngle::configureDistanceArea()
QString ellipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
mDa.setSourceCrs( mCanvas->mapRenderer()->destinationCrs().srsid() );
mDa.setEllipsoid( ellipsoidId );
mDa.setEllipsoidalEnabled( mResultDisplay->projectionEnabled() );
mDa.setEllipsoidalMode( mResultDisplay->projectionEnabled() ); // FIXME (not when proj is turned off)
}


@@ -410,5 +410,5 @@ void QgsMeasureDialog::configureDistanceArea()
mDa.setSourceCrs( mTool->canvas()->mapRenderer()->destinationCrs().srsid() );
mDa.setEllipsoid( ellipsoidId );
// Only use ellipsoidal calculation when project wide transformation is enabled.
mDa.setEllipsoidalEnabled( mcbProjectionEnabled->isChecked() && mTool->canvas()->hasCrsTransformEnabled() );
mDa.setEllipsoidalMode( mcbProjectionEnabled->isChecked() && mTool->canvas()->hasCrsTransformEnabled() );
}
@@ -188,7 +188,7 @@ double QgsComposerScaleBar::mapDiagonal() const
else
{
QgsDistanceArea da;
da.setEllipsoidalEnabled( mComposerMap->mapRenderer()->hasCrsTransformEnabled() );
da.setEllipsoidalMode( mComposerMap->mapRenderer()->hasCrsTransformEnabled() );
da.setSourceCrs( mComposerMap->mapRenderer()->destinationCrs().srsid() );
QSettings s;
da.setEllipsoid( s.value( "/qgis/measure/ellipsoid", "WGS84" ).toString() );
@@ -41,7 +41,7 @@
QgsDistanceArea::QgsDistanceArea()
{
// init with default settings
mEllipsoidalEnabled = false;
mEllipsoidalMode = false;
mCoordTransform = new QgsCoordinateTransform;
setSourceCrs( GEOCRS_ID ); // WGS 84
setEllipsoid( "WGS84" );
@@ -53,9 +53,9 @@ QgsDistanceArea::~QgsDistanceArea()
delete mCoordTransform;
}

void QgsDistanceArea::setEllipsoidalEnabled( bool flag )
void QgsDistanceArea::setEllipsoidalMode( bool flag )
{
mEllipsoidalEnabled = flag;
mEllipsoidalMode = flag;
}

void QgsDistanceArea::setSourceCrs( long srsid )
@@ -337,14 +337,14 @@ double QgsDistanceArea::measureLine( const QList<QgsPoint>& points )

try
{
if ( mEllipsoidalEnabled && ( mEllipsoid != "NONE" ) )
if ( mEllipsoidalMode && ( mEllipsoid != "NONE" ) )
p1 = mCoordTransform->transform( points[0] );
else
p1 = points[0];

for ( QList<QgsPoint>::const_iterator i = points.begin(); i != points.end(); ++i )
{
if ( mEllipsoidalEnabled && ( mEllipsoid != "NONE" ) )
if ( mEllipsoidalMode && ( mEllipsoid != "NONE" ) )
{
p2 = mCoordTransform->transform( *i );
total += computeDistanceBearing( p1, p2 );
@@ -378,7 +378,7 @@ double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2 )
QgsPoint pp1 = p1, pp2 = p2;

QgsDebugMsg( QString( "Measuring from %1 to %2" ).arg( p1.toString( 4 ) ).arg( p2.toString( 4 ) ) );
if ( mEllipsoidalEnabled && ( mEllipsoid != "NONE" ) )
if ( mEllipsoidalMode && ( mEllipsoid != "NONE" ) )
{
QgsDebugMsg( QString( "Ellipsoidal calculations is enabled, using ellipsoid %1" ).arg( mEllipsoid ) );
QgsDebugMsg( QString( "From proj4 : %1" ).arg( mCoordTransform->sourceCrs().toProj4() ) );
@@ -447,7 +447,7 @@ unsigned char* QgsDistanceArea::measurePolygon( unsigned char* feature, double*

pnt = QgsPoint( x, y );

if ( mEllipsoidalEnabled && ( mEllipsoid != "NONE" ) )
if ( mEllipsoidalMode && ( mEllipsoid != "NONE" ) )
{
pnt = mCoordTransform->transform( pnt );
}
@@ -499,7 +499,7 @@ double QgsDistanceArea::measurePolygon( const QList<QgsPoint>& points )

try
{
if ( mEllipsoidalEnabled && ( mEllipsoid != "NONE" ) )
if ( mEllipsoidalMode && ( mEllipsoid != "NONE" ) )
{
QList<QgsPoint> pts;
for ( QList<QgsPoint>::const_iterator i = points.begin(); i != points.end(); ++i )
@@ -527,7 +527,7 @@ double QgsDistanceArea::bearing( const QgsPoint& p1, const QgsPoint& p2 )
QgsPoint pp1 = p1, pp2 = p2;
double bearing;

if ( mEllipsoidalEnabled && ( mEllipsoid != "NONE" ) )
if ( mEllipsoidalMode && ( mEllipsoid != "NONE" ) )
{
pp1 = mCoordTransform->transform( p1 );
pp2 = mCoordTransform->transform( p2 );
@@ -689,7 +689,7 @@ double QgsDistanceArea::computePolygonArea( const QList<QgsPoint>& points )
double area;

QgsDebugMsgLevel( "Ellipsoid: " + mEllipsoid, 3 );
if (( ! mEllipsoidalEnabled ) || ( mEllipsoid == "NONE" ) )
if (( ! mEllipsoidalMode ) || ( mEllipsoid == "NONE" ) )
{
return computePolygonFlatArea( points );
}
@@ -886,7 +886,7 @@ void QgsDistanceArea::convertMeasurement( double &measure, QGis::UnitType &measu

if (( measureUnits == QGis::Degrees || measureUnits == QGis::Feet ) &&
mEllipsoid != "NONE" &&
mEllipsoidalEnabled )
mEllipsoidalMode )
{
// Measuring on an ellipsoid returned meters. Force!
measureUnits = QGis::Meters;
@@ -41,12 +41,12 @@ class CORE_EXPORT QgsDistanceArea
~QgsDistanceArea();

//! sets whether coordinates must be projected to ellipsoid before measuring
void setEllipsoidalEnabled( bool flag );
Q_DECL_DEPRECATED void QgsDistanceArea::setProjectionsEnabled( bool flag ) { setEllipsoidalEnabled( flag ); };
void setEllipsoidalMode( bool flag );
Q_DECL_DEPRECATED void setProjectionsEnabled( bool flag ) { setEllipsoidalMode( flag ); };

//! returns projections enabled flag
bool ellipsoidalEnabled() { return mEllipsoidalEnabled; }
Q_DECL_DEPRECATED bool hasCrsTransformEnabled() { return mEllipsoidalEnabled; }
bool ellipsoidalEnabled() const { return mEllipsoidalMode; }
Q_DECL_DEPRECATED bool hasCrsTransformEnabled() { return mEllipsoidalMode; }

//! sets source spatial reference system (by QGIS CRS)
void setSourceCrs( long srsid );
@@ -139,7 +139,7 @@ class CORE_EXPORT QgsDistanceArea
QgsCoordinateTransform* mCoordTransform;

//! indicates whether we will transform coordinates
bool mEllipsoidalEnabled;
bool mEllipsoidalMode;

//! id of the source spatial reference system
long mSourceRefSys;
@@ -913,7 +913,7 @@ bool QgsExpression::needsGeometry()
void QgsExpression::initGeomCalculator()
{
mCalc = new QgsDistanceArea;
mCalc->setEllipsoidalEnabled( false );
mCalc->setEllipsoidalMode( false );
QSettings settings;
QString ellipsoid = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
mCalc->setEllipsoid( ellipsoid );
@@ -73,7 +73,6 @@ QgsMapRenderer::~QgsMapRenderer()
delete mCachedTr;
}


QgsRectangle QgsMapRenderer::extent() const
{
return mExtent;
@@ -664,14 +663,14 @@ void QgsMapRenderer::setProjectionsEnabled( bool enabled )
{
mProjectionsEnabled = enabled;
QgsDebugMsg( "Adjusting DistArea projection on/off" );
mDistArea->setEllipsoidalEnabled( enabled );
mDistArea->setEllipsoidalMode( enabled );
updateFullExtent();
mLastExtent.setMinimal();
emit hasCrsTransformEnabled( enabled );
}
}

bool QgsMapRenderer::hasCrsTransformEnabled()
bool QgsMapRenderer::hasCrsTransformEnabled() const
{
return mProjectionsEnabled;
}
@@ -184,7 +184,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
void setProjectionsEnabled( bool enabled );

//! returns true if projections are enabled for this layer set
bool hasCrsTransformEnabled();
bool hasCrsTransformEnabled() const;

/** sets destination coordinate reference system
* @note deprecated by qgis 1.7
@@ -307,7 +307,7 @@ float Heatmap::mapUnitsOf( float meters, QgsCoordinateReferenceSystem layerCrs )
da.setEllipsoid( layerCrs.ellipsoidAcronym() );
if ( da.geographic() )
{
da.setEllipsoidalEnabled( true );
da.setEllipsoidalMode( true );
}
return meters / da.measureLine( QgsPoint( 0.0, 0.0 ), QgsPoint( 0.0, 1.0 ) );
}
@@ -336,7 +336,7 @@ float HeatmapGui::mapUnitsOf( float meters, QgsCoordinateReferenceSystem layerCr
da.setEllipsoid( layerCrs.ellipsoidAcronym() );
if ( da.geographic() )
{
da.setEllipsoidalEnabled( true );
da.setEllipsoidalMode( true );
}
double unitDistance = da.measureLine( QgsPoint( 0.0, 0.0 ), QgsPoint( 0.0, 1.0 ) );
QgsDebugMsg( QString( "Converted %1 meters to %2 mapunits" ).arg( meters ).arg( meters / unitDistance ) );

0 comments on commit 1873866

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