otfr_by_default.diff
src/app/qgsoptions.cpp (working copy) | ||
---|---|---|
191 | 191 | |
192 | 192 |
txtGlobalWkt->setText( settings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() ); |
193 | 193 | |
194 |
//on the fly CRS transformation settings |
|
195 |
grpOtfTransform->setChecked( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() ); |
|
196 |
leGlobalOtfProjString->setText( settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString() ); |
|
197 | ||
194 | 198 |
// populate combo box with ellipsoids |
195 | 199 |
getEllipsoidList(); |
196 | 200 |
QString myEllipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString(); |
... | ... | |
631 | 635 | |
632 | 636 |
settings.setValue( "/Projections/defaultProjectionString", txtGlobalWkt->toPlainText() ); |
633 | 637 | |
638 |
// save 'on the fly' CRS transformation settings |
|
639 |
settings.setValue( "/Projections/otfTransformEnabled", grpOtfTransform->isChecked() ); |
|
640 |
settings.setValue( "/Projections/defaultOTFProjectionString", leGlobalOtfProjString->text() ); |
|
641 | ||
634 | 642 |
settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) ); |
635 | 643 | |
636 | 644 |
if ( radFeet->isChecked() ) |
... | ... | |
760 | 768 | |
761 | 769 |
} |
762 | 770 | |
771 |
void QgsOptions::on_pbnSelectOtfProjection_clicked() |
|
772 |
{ |
|
773 |
QSettings settings; |
|
774 |
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector( this ); |
|
775 | ||
776 |
//find out srs id of current proj4 string |
|
777 |
QgsCoordinateReferenceSystem refSys; |
|
778 |
if ( refSys.createFromProj4( leGlobalOtfProjString->text() ) ) |
|
779 |
{ |
|
780 |
mySelector->setSelectedCrsId( refSys.srsid() ); |
|
781 |
} |
|
782 | ||
783 |
if ( mySelector->exec() ) |
|
784 |
{ |
|
785 |
leGlobalOtfProjString->setText( mySelector->selectedProj4String() ); |
|
786 |
QgsDebugMsg( QString( "------ Global OTF Projection Selection set to ----------\n%1" ).arg( leGlobalOtfProjString->text() ) ); |
|
787 |
} |
|
788 |
else |
|
789 |
{ |
|
790 |
QgsDebugMsg( "------ Global OTF Projection Selection change cancelled ----------" ); |
|
791 |
QApplication::restoreOverrideCursor(); |
|
792 |
} |
|
793 |
} |
|
794 | ||
763 | 795 |
// Return state of the visibility flag for newly added layers. If |
764 | 796 | |
765 | 797 |
bool QgsOptions::newVisible() |
src/app/qgsoptions.h (working copy) | ||
---|---|---|
50 | 50 |
public slots: |
51 | 51 |
//! Slot called when user chooses to change the project wide projection. |
52 | 52 |
void on_pbnSelectProjection_clicked(); |
53 |
//! Slot called when user chooses to change the default 'on the fly' projection. |
|
54 |
void on_pbnSelectOtfProjection_clicked(); |
|
53 | 55 |
void saveOptions(); |
54 | 56 |
//! Slot to change the theme this is handled when the user |
55 | 57 |
// activates or highlights a theme name in the drop-down list |
... | ... | |
125 | 127 |
QString getEllipsoidName( QString theEllipsoidAcronym ); |
126 | 128 | |
127 | 129 |
private: |
128 |
// |
|
129 | 130 |
QStringList i18nList(); |
130 | ||
131 |
//!Default proj4 string used for new layers added that have no projection |
|
132 |
QString mGlobalProj4String; |
|
133 | ||
134 | 131 |
}; |
135 | 132 | |
136 | 133 |
#endif // #ifndef QGSOPTIONS_H |
src/app/qgisapp.cpp (working copy) | ||
---|---|---|
3256 | 3256 |
mMapCanvas->refresh(); |
3257 | 3257 |
mMapCanvas->clearExtentHistory(); |
3258 | 3258 | |
3259 |
mMapCanvas->mapRenderer()->setProjectionsEnabled( false ); |
|
3259 |
// enable OTF CRS transformation if necessary |
|
3260 |
if ( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() ) |
|
3261 |
{ |
|
3262 |
QgsMapRenderer* myRenderer = mMapCanvas->mapRenderer(); |
|
3263 |
QString projString = settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString(); |
|
3264 |
QgsCoordinateReferenceSystem srs; |
|
3265 |
srs.createFromProj4( projString ); |
|
3266 |
myRenderer->setProjectionsEnabled( true ); |
|
3267 |
myRenderer->setDestinationSrs( srs ); |
|
3268 |
// write the projections _proj string_ to project settings |
|
3269 |
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", projString ); |
|
3270 |
prj->dirty( false ); |
|
3271 |
if ( srs.mapUnits() != QGis::UnknownUnit ) |
|
3272 |
{ |
|
3273 |
myRenderer->setMapUnits( srs.mapUnits() ); |
|
3274 |
} |
|
3275 |
mOnTheFlyProjectionStatusButton->setIcon( getThemeIcon( "mIconProjectionEnabled.png" ) ); |
|
3276 |
} |
|
3277 |
else |
|
3278 |
{ |
|
3279 |
mMapCanvas->mapRenderer()->setProjectionsEnabled( false ); |
|
3280 |
} |
|
3260 | 3281 | |
3261 | 3282 |
// set the initial map tool |
3262 | 3283 |
mMapCanvas->setMapTool( mMapTools.mPan ); |
... | ... | |
5506 | 5527 |
int action = mySettings.value( "/qgis/wheel_action", 0 ).toInt(); |
5507 | 5528 |
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble(); |
5508 | 5529 |
mMapCanvas->setWheelAction(( QgsMapCanvas::WheelAction ) action, zoomFactor ); |
5509 |
} |
|
5510 | 5530 | |
5531 |
//apply OTF CRS transformation if necessary |
|
5532 |
if ( mySettings.value( "/Projections/otfTransformEnabled", 0 ).toBool() ) |
|
5533 |
{ |
|
5534 |
QgsMapRenderer* myRenderer = mMapCanvas->mapRenderer(); |
|
5535 |
QString projString = mySettings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString(); |
|
5536 |
QgsCoordinateReferenceSystem srs; |
|
5537 |
srs.createFromProj4( projString ); |
|
5538 |
myRenderer->setProjectionsEnabled( true ); |
|
5539 |
myRenderer->setDestinationSrs( srs ); |
|
5540 |
// write the projections _proj string_ to project settings |
|
5541 |
QgsProject::instance()->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", projString ); |
|
5542 |
if ( srs.mapUnits() != QGis::UnknownUnit ) |
|
5543 |
{ |
|
5544 |
myRenderer->setMapUnits( srs.mapUnits() ); |
|
5545 |
} |
|
5546 |
} |
|
5547 |
else |
|
5548 |
{ |
|
5549 |
QgsMapRenderer* myRenderer = mMapCanvas->mapRenderer(); |
|
5550 |
myRenderer->setProjectionsEnabled( false ); |
|
5551 |
} |
|
5552 |
mMapCanvas->refresh(); |
|
5553 |
} |
|
5554 | ||
5511 | 5555 |
delete optionsDialog; |
5512 | 5556 |
} |
5513 | 5557 |
src/ui/qgsoptionsbase.ui (working copy) | ||
---|---|---|
61 | 61 |
<x>0</x> |
62 | 62 |
<y>0</y> |
63 | 63 |
<width>744</width> |
64 |
<height>817</height>
|
|
64 |
<height>806</height>
|
|
65 | 65 |
</rect> |
66 | 66 |
</property> |
67 | 67 |
<layout class="QGridLayout" name="gridLayout_12"> |
... | ... | |
499 | 499 |
<rect> |
500 | 500 |
<x>0</x> |
501 | 501 |
<y>0</y> |
502 |
<width>666</width>
|
|
503 |
<height>466</height>
|
|
502 |
<width>589</width>
|
|
503 |
<height>499</height>
|
|
504 | 504 |
</rect> |
505 | 505 |
</property> |
506 | 506 |
<layout class="QGridLayout" name="gridLayout_8"> |
... | ... | |
670 | 670 |
<rect> |
671 | 671 |
<x>0</x> |
672 | 672 |
<y>0</y> |
673 |
<width>612</width>
|
|
674 |
<height>469</height>
|
|
673 |
<width>509</width>
|
|
674 |
<height>471</height>
|
|
675 | 675 |
</rect> |
676 | 676 |
</property> |
677 | 677 |
<layout class="QGridLayout" name="gridLayout_4"> |
... | ... | |
950 | 950 |
<rect> |
951 | 951 |
<x>0</x> |
952 | 952 |
<y>0</y> |
953 |
<width>310</width>
|
|
954 |
<height>86</height>
|
|
953 |
<width>258</width>
|
|
954 |
<height>88</height>
|
|
955 | 955 |
</rect> |
956 | 956 |
</property> |
957 | 957 |
<layout class="QGridLayout" name="gridLayout_10"> |
... | ... | |
1025 | 1025 |
<rect> |
1026 | 1026 |
<x>0</x> |
1027 | 1027 |
<y>0</y> |
1028 |
<width>838</width>
|
|
1029 |
<height>432</height>
|
|
1028 |
<width>714</width>
|
|
1029 |
<height>441</height>
|
|
1030 | 1030 |
</rect> |
1031 | 1031 |
</property> |
1032 | 1032 |
<layout class="QGridLayout" name="gridLayout_13"> |
... | ... | |
1355 | 1355 |
<rect> |
1356 | 1356 |
<x>0</x> |
1357 | 1357 |
<y>0</y> |
1358 |
<width>416</width>
|
|
1359 |
<height>568</height>
|
|
1358 |
<width>365</width>
|
|
1359 |
<height>667</height>
|
|
1360 | 1360 |
</rect> |
1361 | 1361 |
</property> |
1362 | 1362 |
<layout class="QGridLayout" name="gridLayout_15"> |
... | ... | |
1413 | 1413 |
</property> |
1414 | 1414 |
</widget> |
1415 | 1415 |
</item> |
1416 |
<item row="3" column="0">
|
|
1416 |
<item row="5" column="0">
|
|
1417 | 1417 |
<spacer> |
1418 | 1418 |
<property name="orientation"> |
1419 | 1419 |
<enum>Qt::Vertical</enum> |
... | ... | |
1426 | 1426 |
</property> |
1427 | 1427 |
</spacer> |
1428 | 1428 |
</item> |
1429 |
<item row="3" column="0"> |
|
1430 |
<widget class="QGroupBox" name="grpOtfTransform"> |
|
1431 |
<property name="title"> |
|
1432 |
<string>Always use 'on the fly' CRS transformation</string> |
|
1433 |
</property> |
|
1434 |
<property name="checkable"> |
|
1435 |
<bool>true</bool> |
|
1436 |
</property> |
|
1437 |
<layout class="QVBoxLayout" name="verticalLayout_3"> |
|
1438 |
<item> |
|
1439 |
<widget class="QLineEdit" name="leGlobalOtfProjString"> |
|
1440 |
<property name="readOnly"> |
|
1441 |
<bool>true</bool> |
|
1442 |
</property> |
|
1443 |
</widget> |
|
1444 |
</item> |
|
1445 |
<item> |
|
1446 |
<widget class="QPushButton" name="pbnSelectOtfProjection"> |
|
1447 |
<property name="text"> |
|
1448 |
<string>Select CRS for 'on the fly' transformation ...</string> |
|
1449 |
</property> |
|
1450 |
</widget> |
|
1451 |
</item> |
|
1452 |
</layout> |
|
1453 |
</widget> |
|
1454 |
</item> |
|
1429 | 1455 |
</layout> |
1430 | 1456 |
</widget> |
1431 | 1457 |
</widget> |
... | ... | |
1452 | 1478 |
<x>0</x> |
1453 | 1479 |
<y>0</y> |
1454 | 1480 |
<width>519</width> |
1455 |
<height>567</height>
|
|
1481 |
<height>555</height>
|
|
1456 | 1482 |
</rect> |
1457 | 1483 |
</property> |
1458 | 1484 |
<layout class="QGridLayout" name="gridLayout_17"> |
... | ... | |
1542 | 1568 |
<rect> |
1543 | 1569 |
<x>0</x> |
1544 | 1570 |
<y>0</y> |
1545 |
<width>407</width>
|
|
1546 |
<height>508</height>
|
|
1571 |
<width>337</width>
|
|
1572 |
<height>545</height>
|
|
1547 | 1573 |
</rect> |
1548 | 1574 |
</property> |
1549 | 1575 |
<layout class="QGridLayout" name="gridLayout_20"> |