26 : QDialog( parent, f )
31 QApplication::setOverrideCursor( Qt::ArrowCursor );
33 setWindowTitle(
tr(
"Select datum transformations for layer" ) +
" " + layerName );
36 restoreGeometry( settings.value(
"/Windows/DatumTransformDialog/geometry" ).toByteArray() );
37 mHideDeprecatedCheckBox->setChecked( settings.value(
"/Windows/DatumTransformDialog/hideDeprecated",
false ).toBool() );
38 mRememberSelectionCheckBox->setChecked( settings.value(
"/Windows/DatumTransformDialog/rememberSelection",
false ).toBool() );
40 for (
int i = 0; i < 2; i++ )
42 mDatumTransformTreeWidget->setColumnWidth( i, settings.value( QString(
"/Windows/DatumTransformDialog/columnWidths/%1" ).arg( i ), mDatumTransformTreeWidget->columnWidth( i ) ).toInt() );
52 mDatumTransformTreeWidget->clear();
54 QList< QList< int > >::const_iterator it =
mDt.constBegin();
55 for ( ; it !=
mDt.constEnd(); ++it )
57 QTreeWidgetItem *item =
new QTreeWidgetItem();
58 bool itemDisabled =
false;
59 bool itemHidden =
false;
61 for (
int i = 0; i < 2 && i < it->size(); ++i )
64 item->setData( i, Qt::UserRole, nr );
71 QString srcGeoProj, destGeoProj, remarks, scope;
73 bool preferred, deprecated;
77 if ( mHideDeprecatedCheckBox->isChecked() && deprecated )
82 QString toolTipString;
85 toolTipString.append( QString(
"<p><b>NTv2</b></p>" ) );
89 toolTipString.append( QString(
"<p><b>EPSG Transformations Code:</b> %1</p>" ).arg( epsgNr ) );
91 toolTipString.append( QString(
"<p><b>Source CRS:</b> %1</p><p><b>Destination CRS:</b> %2</p>" ).arg( srcGeoProj ).arg( destGeoProj ) );
93 if ( !remarks.isEmpty() )
94 toolTipString.append( QString(
"<p><b>Remarks:</b> %1</p>" ).arg( remarks ) );
95 if ( !scope.isEmpty() )
96 toolTipString.append( QString(
"<p><b>Scope:</b> %1</p>" ).arg( scope ) );
98 toolTipString.append(
"<p><b>Preferred transformation</b></p>" );
100 toolTipString.append(
"<p><b>Deprecated transformation</b></p>" );
102 item->setToolTip( i, toolTipString );
112 item->setDisabled( itemDisabled );
113 mDatumTransformTreeWidget->addTopLevelItem( item );
125 settings.setValue(
"/Windows/DatumTransformDialog/geometry", saveGeometry() );
126 settings.setValue(
"/Windows/DatumTransformDialog/hideDeprecated", mHideDeprecatedCheckBox->isChecked() );
127 settings.setValue(
"/Windows/DatumTransformDialog/rememberSelection", mRememberSelectionCheckBox->isChecked() );
129 for (
int i = 0; i < 2; i++ )
131 settings.setValue( QString(
"/Windows/DatumTransformDialog/columnWidths/%1" ).arg( i ), mDatumTransformTreeWidget->columnWidth( i ) );
134 QApplication::restoreOverrideCursor();
140 QTreeWidgetItem * item = mDatumTransformTreeWidget->currentItem();
143 for (
int i = 0; i < 2; ++i )
145 int transformNr = item->data( i, Qt::UserRole ).toInt();
154 return mRememberSelectionCheckBox->isChecked();
159 return !itemText.isEmpty() && !itemText.contains(
"towgs84", Qt::CaseInsensitive );
169 QString itemText = item->text( col );
170 if ( itemText.isEmpty() )
175 char* projLib = getenv(
"PROJ_LIB" );
181 QStringList itemEqualSplit = itemText.split(
"=" );
183 for (
int i = 1; i < itemEqualSplit.size(); ++i )
187 filename.append(
"=" );
189 filename.append( itemEqualSplit.at( i ) );
192 QDir projDir( projLib );
193 if ( projDir.exists() )
196 QStringList fileList = projDir.entryList();
197 QStringList::const_iterator fileIt = fileList.constBegin();
198 for ( ; fileIt != fileList.constEnd(); ++fileIt )
200 #if defined(Q_OS_WIN)
201 if ( fileIt->compare( filename, Qt::CaseInsensitive ) == 0 )
203 if ( fileIt->compare( filename ) == 0 )
209 item->setToolTip( col,
tr(
"File '%1' not found in directory '%2'" ).arg( filename ).arg( projDir.absolutePath() ) );