Skip to content

Commit 6360c46

Browse files
author
wonder
committed
merge from trunk r11300:11350
git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11886 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5662cdb commit 6360c46

21 files changed

+1692
-1400
lines changed

ms-windows/osgeo4w/package.cmd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ set BISON=%PROGRAMFILES%\GnuWin32\bin\bison.exe
1717

1818
set VERSION=%1
1919
set PACKAGE=%2
20+
if %VERSION%=="" goto error
21+
if %PACKAGE%=="" goto error
2022

2123
PROMPT qgis%VERSION%$g
2224

@@ -76,7 +78,8 @@ cmake -G "Visual Studio 9 2008" ^
7678
-D BISON_EXECUTABLE=%BISON% ^
7779
-D GDAL_INCLUDE_DIR=%OSGEO4W_ROOT%\apps\gdal-16\include -D GDAL_LIBRARY=%OSGEO4W_ROOT%\apps\gdal-16\lib\gdal_i.lib ^
7880
-D PYTHON_EXECUTABLE=%OSGEO4W_ROOT%\bin\python.exe ^
79-
-D PYTHON_INCLUDE_DIR=%OSGEO4W_ROOT%\apps\Python25\include -D PYTHON_LIBRARY=%OSGEO4W_ROOT%\apps\Python25\libs\python25.lib ^
81+
-D PYTHON_INCLUDE_PATH=%OSGEO4W_ROOT%\apps\Python25\include ^
82+
-D PYTHON_LIBRARY=%OSGEO4W_ROOT%\apps\Python25\libs\python25.lib ^
8083
-D SIP_BINARY_PATH=%OSGEO4W_ROOT%\apps\Python25\sip.exe ^
8184
-D GRASS_PREFIX=%OSGEO4W_ROOT%\apps\grass\grass-%GRASS_VERSION% ^
8285
-D QT_BINARY_DIR=%OSGEO4W_ROOT%\bin -D QT_LIBRARY_DIR=%OSGEO4W_ROOT%\lib ^
@@ -87,6 +90,9 @@ cmake -G "Visual Studio 9 2008" ^
8790
../../..>>%LOG% 2>&1
8891
if errorlevel 1 goto error
8992

93+
egrep -vq "^(Python not being built|Could not find GRASS)" %LOG%
94+
if errorlevel 1 goto error
95+
9096
:skipcmake
9197

9298
echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1

python/core/qgscomposerlabel.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class QgsComposerLabel: QgsComposerItem
1818

1919
QString text();
2020
void setText( const QString& text );
21+
22+
/**Returns the text as it appears on screen (with replaced data field)
23+
@note this function was added in version 1.2*/
24+
QString displayText() const;
25+
2126
QFont font() const;
2227
void setFont( const QFont& f );
2328
double margin();

python/plugins/fTools/tools/doGeoprocessing.py

Lines changed: 1437 additions & 1364 deletions
Large diffs are not rendered by default.

src/app/legend/qgslegend.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ void QgsLegend::removeAll()
130130
updateMapCanvasLayerSet();
131131
setIconSize( mMinimumIconSize );
132132
mItemBeingMoved = 0;
133+
mDropTarget = 0;
133134
}
134135

135136
void QgsLegend::selectAll( bool select )

src/app/qgisapp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4671,7 +4671,6 @@ void QgisApp::isInOverview()
46714671

46724672
void QgisApp::removeLayer()
46734673
{
4674-
QgsLegendLayerFile* currentLayerFile = mMapLegend->currentLayerFile();
46754674
mMapLegend->legendLayerRemove();
46764675
// notify the project we've made a change
46774676
QgsProject::instance()->dirty( true );
@@ -5450,7 +5449,9 @@ void QgisApp::projectProperties()
54505449
QApplication::restoreOverrideCursor();
54515450

54525451
//pass any refresg signals off to canvases
5453-
//connect (pp,SIGNAL(refresh()), mMapCanvas, SLOT(refresh()));
5452+
// Line below was commented out by wonder three years ago (r4949).
5453+
// It is needed to refresh scale bar after changing display units.
5454+
connect( pp, SIGNAL( refresh() ), mMapCanvas, SLOT( refresh() ) );
54545455

54555456
QgsMapRenderer* myRender = mMapCanvas->mapRenderer();
54565457
bool wasProjected = myRender->hasCrsTransformEnabled();

src/app/qgsmeasuredialog.cpp

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "qgsmeasuredialog.h"
1919
#include "qgsmeasuretool.h"
2020

21+
#include "qgslogger.h"
2122
#include "qgscontexthelp.h"
2223
#include "qgsdistancearea.h"
2324
#include "qgsmapcanvas.h"
@@ -96,9 +97,12 @@ void QgsMeasureDialog::mouseMove( QgsPoint &point )
9697
QgsPoint p1( mTool->points().last() ), p2( point );
9798

9899
double d = mTool->canvas()->mapRenderer()->distanceArea()->measureLine( p1, p2 );
100+
editTotal->setText( formatDistance( mTotal + d ) );
101+
QGis::UnitType myDisplayUnits;
102+
// Ignore units
103+
convertMeasurement( d, myDisplayUnits, false );
99104
QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
100105
item->setText( 0, QLocale::system().toString( d, 'f', 2 ) );
101-
editTotal->setText( formatDistance( mTotal + d ) );
102106
}
103107
}
104108

@@ -121,6 +125,10 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )
121125
mTotal += d;
122126
editTotal->setText( formatDistance( mTotal ) );
123127

128+
QGis::UnitType myDisplayUnits;
129+
// Ignore units
130+
convertMeasurement( d, myDisplayUnits, false );
131+
124132
QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
125133
item->setText( 0, QLocale::system().toString( d, 'f', 2 ) );
126134

@@ -173,24 +181,26 @@ void QgsMeasureDialog::on_btnHelp_clicked()
173181

174182
QString QgsMeasureDialog::formatDistance( double distance )
175183
{
176-
QString txt;
177-
QString unitLabel;
178-
179-
QGis::UnitType myMapUnits = mTool->canvas()->mapUnits();
180-
return QgsDistanceArea::textUnit( distance, 2, myMapUnits, false );
184+
QGis::UnitType myDisplayUnits;
185+
convertMeasurement( distance, myDisplayUnits, false );
186+
return QgsDistanceArea::textUnit( distance, 2, myDisplayUnits, false );
181187
}
182188

183189
QString QgsMeasureDialog::formatArea( double area )
184190
{
185-
QGis::UnitType myMapUnits = mTool->canvas()->mapUnits();
186-
return QgsDistanceArea::textUnit( area, 2, myMapUnits, true );
191+
QGis::UnitType myDisplayUnits;
192+
convertMeasurement( area, myDisplayUnits, true );
193+
return QgsDistanceArea::textUnit( area, 2, myDisplayUnits, true );
187194
}
188195

189196
void QgsMeasureDialog::updateUi()
190197
{
198+
double dummy = 1.0;
199+
QGis::UnitType myDisplayUnits;
200+
// The dummy distance is ignored
201+
convertMeasurement( dummy, myDisplayUnits, false );
191202

192-
QGis::UnitType myMapUnits = mTool->canvas()->mapUnits();
193-
switch ( myMapUnits )
203+
switch ( myDisplayUnits )
194204
{
195205
case QGis::Meters:
196206
mTable->setHeaderLabels( QStringList( tr( "Segments (in meters)" ) ) );
@@ -218,3 +228,48 @@ void QgsMeasureDialog::updateUi()
218228

219229
}
220230

231+
void QgsMeasureDialog::convertMeasurement(double &measure, QGis::UnitType &u, bool isArea)
232+
{
233+
// Helper for converting between meters and feet
234+
// The parameter &u is out only...
235+
236+
QGis::UnitType myUnits = mTool->canvas()->mapUnits();
237+
if ( myUnits == QGis::Degrees &&
238+
mTool->canvas()->mapRenderer()->distanceArea()->ellipsoid() != "NONE" &&
239+
mTool->canvas()->mapRenderer()->distanceArea()->hasCrsTransformEnabled() )
240+
{
241+
// Measuring on an ellipsoid returns meters
242+
myUnits = QGis::Meters;
243+
QgsDebugMsg( "We're measuring on an ellipsoid, returning meters" );
244+
}
245+
246+
// Get the units for display
247+
QSettings settings;
248+
QString myDisplayUnitsTxt = settings.value( "/qgis/measure/displayunits", "meters").toString();
249+
250+
// Only convert between meters and feet
251+
if ( myUnits == QGis::Meters && myDisplayUnitsTxt == "feet" )
252+
{
253+
QgsDebugMsg( QString( "Converting %1 meters" ).arg( QString::number( measure ) ) );
254+
measure /= 0.3048;
255+
if ( isArea )
256+
{
257+
measure /= 0.3048;
258+
}
259+
QgsDebugMsg( QString( "to %1 feet" ).arg( QString::number( measure ) ) );
260+
myUnits = QGis::Feet;
261+
}
262+
if ( myUnits == QGis::Feet && myDisplayUnitsTxt == "meters" )
263+
{
264+
QgsDebugMsg( QString( "Converting %1 feet" ).arg( QString::number( measure ) ) );
265+
measure *= 0.3048;
266+
if ( isArea )
267+
{
268+
measure *= 0.3048;
269+
}
270+
QgsDebugMsg( QString( "to %1 meters" ).arg( QString::number( measure ) ) );
271+
myUnits = QGis::Meters;
272+
}
273+
274+
u = myUnits;
275+
}

src/app/qgsmeasuredialog.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "ui_qgsmeasurebase.h"
2121

2222
#include "qgspoint.h"
23+
#include "qgsdistancearea.h"
2324

2425
class QCloseEvent;
2526
class QgsMeasureTool;
@@ -72,6 +73,9 @@ class QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
7273
//! shows/hides table, shows correct units
7374
void updateUi();
7475

76+
//! Converts the measurement, depending on settings in options and current transformation
77+
void convertMeasurement(double &measure, QGis::UnitType &u, bool isArea);
78+
7579
double mTotal;
7680

7781
//! Help context id

src/app/qgsoptions.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
113113
getEllipsoidList();
114114
QString myEllipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
115115
cmbEllipsoid->setItemText( cmbEllipsoid->currentIndex(), getEllipsoidName( myEllipsoidId ) );
116+
117+
// Set the units for measuring
118+
QString myUnitsTxt = settings.value( "/qgis/measure/displayunits", "meters").toString();
119+
if ( myUnitsTxt == "feet" )
120+
{
121+
radFeet->setChecked( true );
122+
} else {
123+
radMeters->setChecked( true );
124+
}
125+
126+
116127
// add the themes to the combo box on the option dialog
117128
QDir myThemeDir( QgsApplication::pkgDataPath() + "/themes/" );
118129
myThemeDir.setFilter( QDir::Dirs );
@@ -405,6 +416,15 @@ void QgsOptions::saveOptions()
405416

406417
settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );
407418

419+
if ( radFeet->isChecked() )
420+
{
421+
settings.setValue( "/qgis/measure/displayunits", "feet" );
422+
}
423+
else
424+
{
425+
settings.setValue( "/qgis/measure/displayunits", "meters" );
426+
}
427+
settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );
408428
//set the colour for selections
409429
QColor myColor = pbnSelectionColour->color();
410430
settings.setValue( "/qgis/default_selection_color_red", myColor.red() );

src/app/qgsprojectproperties.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
5858
//see if the user wants on the fly projection enabled
5959
bool myProjectionEnabled = myRender->hasCrsTransformEnabled();
6060
cbxProjectionEnabled->setChecked( myProjectionEnabled );
61+
btnGrpMapUnits->setEnabled( !myProjectionEnabled );
6162

6263
long myCRSID = myRender->destinationSrs().srsid();
6364
QgsDebugMsg( "Read project CRSID: " + QString::number( myCRSID ) );
@@ -430,3 +431,9 @@ void QgsProjectProperties::on_mSnappingOptionsPushButton_clicked()
430431
d.layerSettings( mSnappingLayerSettings );
431432
}
432433
}
434+
435+
void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged(int state)
436+
{
437+
btnGrpMapUnits->setEnabled( state == Qt::Unchecked );
438+
}
439+

src/app/qgsprojectproperties.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
9393
*/
9494
void on_mSnappingOptionsPushButton_clicked();
9595

96+
void on_cbxProjectionEnabled_stateChanged(int state);
97+
98+
9699
signals:
97100
//! Signal used to inform listeners that the mouse display precision may have changed
98101
void displayPrecisionChanged();

0 commit comments

Comments
 (0)