-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*************************************************************************** | ||
qgswmtsdimensions.cpp - selector for WMTS dimensions | ||
------------------- | ||
begin : 2. May 2012 | ||
copyright : (C) 2012 Juergen E. Fischer < jef at norbit dot de >, norBIT GmbH | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgswmsprovider.h" | ||
#include "qgswmtsdimensions.h" | ||
|
||
#include <QSettings> | ||
#include <QComboBox> | ||
|
||
QgsWmtsDimensions::QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *parent, Qt::WFlags fl ) | ||
: QDialog( parent, fl ) | ||
{ | ||
setupUi( this ); | ||
|
||
QStringList dims = layer.dimensions.keys(); | ||
qSort( dims ); | ||
|
||
mDimensions->setRowCount( dims.size() ); | ||
|
||
for( int i = 0; i < mDimensions->rowCount(); i++ ) | ||
{ | ||
const QgsWmtsDimension &d = layer.dimensions[ dims[i] ]; | ||
|
||
mDimensions->setItem( i, 0, new QTableWidgetItem( d.identifier ) ); | ||
mDimensions->setItem( i, 1, new QTableWidgetItem( d.title ) ); | ||
mDimensions->setItem( i, 2, new QTableWidgetItem( d.abstract ) ); | ||
mDimensions->setItem( i, 3, new QTableWidgetItem( d.defaultValue ) ); | ||
|
||
QComboBox *cb = new QComboBox( mDimensions ); | ||
cb->addItems( d.values ); | ||
int idx = cb->findText( d.defaultValue ); | ||
cb->setCurrentIndex( idx < 0 ? 0 : idx ); | ||
mDimensions->setCellWidget( i, 4, cb ); | ||
|
||
i++; | ||
} | ||
|
||
QSettings settings; | ||
QgsDebugMsg( "restoring geometry" ); | ||
restoreGeometry( settings.value( "/Windows/WMTSDimensions/geometry" ).toByteArray() ); | ||
} | ||
|
||
QgsWmtsDimensions::~QgsWmtsDimensions() | ||
{ | ||
QSettings settings; | ||
QgsDebugMsg( "saving geometry" ); | ||
settings.setValue( "/Windows/WmtsDimensions/geometry", saveGeometry() ); | ||
} | ||
|
||
void QgsWmtsDimensions::selectedDimensions( QHash<QString, QString> &selected ) | ||
{ | ||
selected.clear(); | ||
|
||
for( int i = 0; i<mDimensions->rowCount(); i++ ) | ||
{ | ||
QComboBox *cb = qobject_cast< QComboBox * >( mDimensions->cellWidget( i, 4 ) ); | ||
Q_ASSERT( cb ); | ||
selected.insert( mDimensions->item( i, 0 )->text(), cb->currentText() ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/*************************************************************************** | ||
qgswmtsdimensions.h - selector for WMTS dimensions | ||
------------------- | ||
begin : 2. May 2012 | ||
copyright : (C) 2012 by Jürgen Fischer, norBIT GmbH | ||
email: : jef (at) norbit (dot) de | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSWMTSDIMENSIONS_H | ||
#define QGSWMTSDIMENSIONS_H | ||
#include "ui_qgswmtsdimensionsbase.h" | ||
#include "qgisgui.h" | ||
#include "qgscontexthelp.h" | ||
#include "qgswmsprovider.h" | ||
|
||
#include <QHash> | ||
|
||
/*! | ||
* \brief Dialog to select dimension values for WMTS layers | ||
* | ||
* This dialog allows the user to select dimensions values the | ||
* WMTS offers. | ||
* | ||
*/ | ||
class QgsWmtsDimensions : public QDialog, private Ui::QgsWmtsDimensionsBase | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
//! Constructor | ||
QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *parent = 0, Qt::WFlags fl = 0 ); | ||
//! Destructor | ||
~QgsWmtsDimensions(); | ||
|
||
void selectedDimensions( QHash<QString, QString> &dims ); | ||
|
||
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } | ||
}; | ||
|
||
|
||
#endif // QGSWMTSDIMENSIONS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsWmtsDimensionsBase</class> | ||
<widget class="QDialog" name="QgsWmtsDimensionsBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>767</width> | ||
<height>315</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QTableWidget" name="mDimensions"> | ||
<column> | ||
<property name="text"> | ||
<string>Dimension</string> | ||
</property> | ||
</column> | ||
<column> | ||
<property name="text"> | ||
<string>Value</string> | ||
</property> | ||
</column> | ||
<column> | ||
<property name="text"> | ||
<string>Abstract</string> | ||
</property> | ||
</column> | ||
<column> | ||
<property name="text"> | ||
<string>Default</string> | ||
</property> | ||
</column> | ||
<column> | ||
<property name="text"> | ||
<string>Value</string> | ||
</property> | ||
</column> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>QgsWmtsDimensionsBase</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>248</x> | ||
<y>254</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>QgsWmtsDimensionsBase</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>316</x> | ||
<y>260</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |