Skip to content

Commit f503bc3

Browse files
committedMay 16, 2012
Revert last four accidental commits:
backport wmts support: 50ba992 WMTS/WMS updates: 84959cb missed a dialog: 4b5d265. [FEATURE] WMTS: 2130b02
1 parent 50ba992 commit f503bc3

22 files changed

+975
-2266
lines changed
 

‎scripts/prepare-commit.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ fi
3333

3434
# save original changes
3535
if [ -d .svn ]; then
36-
REV=r$(svn info | sed -ne "s/Revision: //p")
37-
svn diff >rev-$REV.diff
36+
REV=$(svn info | sed -ne "s/Revision: //p")
37+
svn diff >r$REV.diff
3838
elif [ -d .git ]; then
39-
REV=$(git log -n1 --pretty=%H)
40-
git diff >sha-$REV.diff
39+
REV=$(git svn info | sed -ne "s/Revision: //p")
40+
git diff >r$REV.diff
4141
fi
4242

4343
ASTYLEDIFF=astyle.r$REV.diff

‎src/app/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ SET(QGIS_APP_SRCS
8080
qgsrastercalcdialog.cpp
8181
qgsrasterlayerproperties.cpp
8282
qgstextannotationdialog.cpp
83+
qgswmssourceselect.cpp
8384
qgsshortcutsmanager.cpp
8485
qgssinglesymboldialog.cpp
8586
qgssnappingdialog.cpp
8687
qgsundowidget.cpp
88+
qgstilescalewidget.cpp
8789
qgstipgui.cpp
8890
qgstipfactory.cpp
8991
qgsuniquevaluedialog.cpp
@@ -210,11 +212,13 @@ SET (QGIS_APP_MOC_HDRS
210212
qgssnappingdialog.h
211213
qgssponsors.h
212214
qgstextannotationdialog.h
215+
qgstilescalewidget.h
213216
qgstipgui.h
214217
qgstipfactory.h
215218
qgsundowidget.h
216219
qgsuniquevaluedialog.h
217220
qgsvectorlayerproperties.h
221+
qgswmssourceselect.h
218222
qgshandlebadlayers.h
219223

220224
composer/qgsattributeselectiondialog.h

‎src/app/qgisapp.cpp

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
#include "qgssnappingdialog.h"
156156
#include "qgssponsors.h"
157157
#include "qgstextannotationitem.h"
158+
#include "qgstilescalewidget.h"
158159
#include "qgstipgui.h"
159160
#include "qgsundowidget.h"
160161
#include "qgsvectordataprovider.h"
@@ -374,6 +375,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
374375
, mSplash( splash )
375376
, mShowProjectionTab( false )
376377
, mPythonUtils( NULL )
378+
, mpTileScaleWidget( NULL )
377379
#ifdef Q_OS_WIN
378380
, mSkipNextContextMenuEvent( 0 )
379381
#endif
@@ -575,8 +577,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
575577
// request notification of FileOpen events (double clicking a file icon in Mac OS X Finder)
576578
QgsApplication::setFileOpenEventReceiver( this );
577579

578-
QgsProviderRegistry::instance()->registerGuis( this );
579-
580580
// update windows
581581
qApp->processEvents();
582582

@@ -694,6 +694,11 @@ void QgisApp::readSettings()
694694
// Add the recently accessed project file paths to the File menu
695695
mRecentProjectPaths = settings.value( "/UI/recentProjectsList" ).toStringList();
696696

697+
// Restore state of tile scale widget
698+
if ( settings.value( "/UI/tileScaleEnabled", false ).toBool() )
699+
{
700+
showTileScale();
701+
}
697702
// Restore state of GPS Tracker
698703
if ( settings.value( "/gps/widgetEnabled", false ).toBool() )
699704
{
@@ -795,6 +800,7 @@ void QgisApp::createActions()
795800
connect( mActionRemoveLayer, SIGNAL( triggered() ), this, SLOT( removeLayer() ) );
796801
connect( mActionSetLayerCRS, SIGNAL( triggered() ), this, SLOT( setLayerCRS() ) );
797802
connect( mActionSetProjectCRSFromLayer, SIGNAL( triggered() ), this, SLOT( setProjectCRSFromLayer() ) );
803+
connect( mActionTileScale, SIGNAL( triggered() ), this, SLOT( showTileScale() ) );
798804
connect( mActionGpsTool, SIGNAL( triggered() ), this, SLOT( showGpsTool() ) );
799805
connect( mActionLayerProperties, SIGNAL( triggered() ), this, SLOT( layerProperties() ) );
800806
connect( mActionLayerSubsetString, SIGNAL( triggered() ), this, SLOT( layerSubsetString() ) );
@@ -1844,6 +1850,17 @@ void QgisApp::saveWindowState()
18441850
// store window geometry
18451851
settings.setValue( "/UI/geometry", saveGeometry() );
18461852

1853+
// Persist state of tile scale slider
1854+
if ( mpTileScaleWidget )
1855+
{
1856+
settings.setValue( "/UI/tileScaleEnabled", true );
1857+
delete mpTileScaleWidget;
1858+
}
1859+
else
1860+
{
1861+
settings.setValue( "/UI/tileScaleEnabled", false );
1862+
}
1863+
18471864
// Persist state of GPS Tracker
18481865
if ( mpGpsWidget )
18491866
{
@@ -4486,6 +4503,32 @@ void QgisApp::showGpsTool()
44864503
}
44874504
}
44884505

4506+
void QgisApp::showTileScale()
4507+
{
4508+
if ( !mpTileScaleWidget )
4509+
{
4510+
mpTileScaleWidget = new QgsTileScaleWidget( mMapCanvas );
4511+
//create the dock widget
4512+
mpTileScaleDock = new QDockWidget( tr( "Tile scale" ), this );
4513+
mpTileScaleDock->setObjectName( "TileScale" );
4514+
mpTileScaleDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
4515+
addDockWidget( Qt::RightDockWidgetArea, mpTileScaleDock );
4516+
// add to the Panel submenu
4517+
mPanelMenu->addAction( mpTileScaleDock->toggleViewAction() );
4518+
// now add our widget to the dock - ownership of the widget is passed to the dock
4519+
mpTileScaleDock->setWidget( mpTileScaleWidget );
4520+
mpTileScaleDock->show();
4521+
4522+
connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
4523+
mpTileScaleWidget, SLOT( layerChanged( QgsMapLayer* ) ) );
4524+
4525+
}
4526+
else
4527+
{
4528+
mpTileScaleDock->setVisible( mpTileScaleDock->isHidden() );
4529+
}
4530+
}
4531+
44894532
void QgisApp::zoomToLayerExtent()
44904533
{
44914534
mMapLegend->legendLayerZoom();

‎src/app/qgisapp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class QgsRasterLayer;
5959
class QgsRectangle;
6060
class QgsUndoWidget;
6161
class QgsVectorLayer;
62+
class QgsTileScaleWidget;
6263

6364
class QDomDocument;
6465
class QNetworkReply;
@@ -276,6 +277,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
276277
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
277278
QAction *actionSetLayerCRS() { return mActionSetLayerCRS; }
278279
QAction *actionSetProjectCRSFromLayer() { return mActionSetProjectCRSFromLayer; }
280+
QAction *actionTileScale() { return mActionTileScale; }
279281
QAction *actionGpsTool() { return mActionGpsTool; }
280282
QAction *actionLayerProperties() { return mActionLayerProperties; }
281283
QAction *actionLayerSubsetString() { return mActionLayerSubsetString; }
@@ -485,6 +487,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
485487
void setProjectCRSFromLayer();
486488
//! Show GPS tool
487489
void showGpsTool();
490+
//! Show tile scale slider
491+
void showTileScale();
488492
//! zoom to extent of layer
489493
void zoomToLayerExtent();
490494
//! zoom to actual size of raster layer
@@ -900,6 +904,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
900904
// docks ------------------------------------------
901905
QDockWidget *mLegendDock;
902906
QDockWidget *mOverviewDock;
907+
QDockWidget *mpTileScaleDock;
903908
QDockWidget *mpGpsDock;
904909

905910

@@ -1058,6 +1063,9 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
10581063

10591064
QgsSnappingDialog* mSnappingDialog;
10601065

1066+
//! Persistent tile scale slider
1067+
QgsTileScaleWidget * mpTileScaleWidget;
1068+
10611069
int mLastComposerId;
10621070

10631071
#ifdef Q_OS_WIN

‎src/providers/wms/qgstilescalewidget.cpp renamed to ‎src/app/qgstilescalewidget.cpp

Lines changed: 38 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919
#include "qgstilescalewidget.h"
2020
#include "qgsmapcanvas.h"
2121
#include "qgsrasterlayer.h"
22-
#include "qgswmsprovider.h"
2322
#include "qgslogger.h"
2423

25-
#include <QDockWidget>
26-
#include <QMainWindow>
27-
#include <QMenu>
28-
#include <QGraphicsView>
29-
3024
QgsTileScaleWidget::QgsTileScaleWidget( QgsMapCanvas * mapCanvas, QWidget * parent, Qt::WindowFlags f )
3125
: QWidget( parent, f )
3226
, mMapCanvas( mapCanvas )
@@ -38,46 +32,54 @@ QgsTileScaleWidget::QgsTileScaleWidget( QgsMapCanvas * mapCanvas, QWidget * pare
3832
layerChanged( mMapCanvas->currentLayer() );
3933
}
4034

41-
QgsTileScaleWidget::~QgsTileScaleWidget()
42-
{
43-
QSettings settings;
44-
settings.setValue( "/UI/tileScaleEnabled", isVisible() );
45-
}
46-
4735
void QgsTileScaleWidget::layerChanged( QgsMapLayer *layer )
4836
{
4937
QgsRasterLayer *rl = qobject_cast<QgsRasterLayer *>( layer );
50-
if ( !rl )
51-
return;
5238

53-
QgsWmsProvider *wms = qobject_cast<QgsWmsProvider *>( rl->dataProvider() );
54-
if ( !wms )
55-
return;
39+
mResolutions.clear();
40+
mSlider->setDisabled( true );
5641

57-
QgsWmtsTileMatrixSet *tileMatrixSet = wms->tileMatrixSet();
58-
if ( !tileMatrixSet )
42+
if ( !rl || rl->providerKey() != "wms" )
5943
return;
6044

61-
mSlider->setDisabled( true );
62-
63-
mResolutions = tileMatrixSet->tileMatrices.keys();
64-
qSort( mResolutions );
45+
QString uri = rl->source();
46+
int tiledpos = uri.indexOf( "tiled=" );
47+
int urlpos = uri.indexOf( "url=" );
6548

66-
for ( int i = 0; i < mResolutions.size(); i++ )
49+
if ( tiledpos >= 0 && urlpos >= 0 && urlpos > tiledpos )
6750
{
68-
QgsDebugMsg( QString( "found resolution %1: %2" ).arg( i ).arg( mResolutions[i] ) );
51+
uri = uri.mid( tiledpos + 6 );
52+
int pos = uri.indexOf( "," );
53+
if ( pos >= 0 )
54+
uri = uri.left( pos );
55+
QStringList params = uri.split( ";" );
56+
if ( params.size() < 3 )
57+
return;
58+
59+
params.takeFirst();
60+
params.takeFirst();
61+
62+
mResolutions.clear();
63+
foreach( QString r, params )
64+
{
65+
mResolutions << r.toDouble();
66+
}
67+
qSort( mResolutions );
68+
69+
for ( int i = 0; i < mResolutions.size(); i++ )
70+
QgsDebugMsg( QString( "found resolution %1: %2" ).arg( i ).arg( mResolutions[i] ) );
71+
72+
mSlider->setRange( 0, mResolutions.size() - 1 );
73+
mSlider->setTickInterval( 1 );
74+
mSlider->setInvertedAppearance( true );
75+
mSlider->setPageStep( 1 );
76+
mSlider->setTracking( false );
77+
78+
scaleChanged( mMapCanvas->scale() );
79+
80+
mSlider->setEnabled( true );
81+
show();
6982
}
70-
71-
mSlider->setRange( 0, mResolutions.size() - 1 );
72-
mSlider->setTickInterval( 1 );
73-
mSlider->setInvertedAppearance( true );
74-
mSlider->setPageStep( 1 );
75-
mSlider->setTracking( false );
76-
77-
scaleChanged( mMapCanvas->scale() );
78-
79-
mSlider->setEnabled( true );
80-
show();
8183
}
8284

8385
void QgsTileScaleWidget::scaleChanged( double scale )
@@ -100,68 +102,11 @@ void QgsTileScaleWidget::scaleChanged( double scale )
100102
}
101103

102104
QgsDebugMsg( QString( "selected resolution %1: %2" ).arg( i ).arg( mResolutions[i] ) );
103-
mSlider->blockSignals( true );
104105
mSlider->setValue( i );
105-
mSlider->blockSignals( false );
106106
}
107107

108108
void QgsTileScaleWidget::on_mSlider_valueChanged( int value )
109109
{
110110
QgsDebugMsg( QString( "slider released at %1: %2" ).arg( mSlider->value() ).arg( mResolutions[mSlider->value()] ) );
111111
mMapCanvas->zoomByFactor( mResolutions[mSlider->value()] / mMapCanvas->mapUnitsPerPixel() );
112112
}
113-
114-
void QgsTileScaleWidget::showTileScale( QMainWindow *mainWindow )
115-
{
116-
QDockWidget *dock = mainWindow->findChild<QDockWidget *>( "theTileScaleDock" );
117-
if ( dock )
118-
{
119-
dock->setVisible( dock->isHidden() );
120-
return;
121-
}
122-
123-
QgsMapCanvas *canvas = mainWindow->findChild<QgsMapCanvas *>( "theMapCanvas" );
124-
QgsDebugMsg( QString( "canvas:%1 [%2]" ).arg(( ulong ) canvas, 0, 16 ).arg( canvas ? canvas->objectName() : "" ) );
125-
if ( !canvas )
126-
{
127-
QgsDebugMsg( "map canvas theMapCanvas not found" );
128-
return;
129-
}
130-
131-
QgsTileScaleWidget *tws = new QgsTileScaleWidget( canvas );
132-
tws->setObjectName( "theTileScaleWidget" );
133-
134-
QObject *legend = mainWindow->findChild<QObject*>( "theMapLegend" );
135-
if ( legend )
136-
{
137-
connect( legend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
138-
tws, SLOT( layerChanged( QgsMapLayer* ) ) );
139-
}
140-
else
141-
{
142-
QgsDebugMsg( "legend not found" );
143-
}
144-
145-
//create the dock widget
146-
dock = new QDockWidget( tr( "Tile scale" ), mainWindow );
147-
dock->setObjectName( "theTileScaleDock" );
148-
dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
149-
mainWindow->addDockWidget( Qt::RightDockWidgetArea, dock );
150-
151-
// add to the Panel submenu
152-
QMenu *panelMenu = mainWindow->findChild<QMenu *>( "mPanelMenu" );
153-
if ( panelMenu )
154-
{
155-
// add to the Panel submenu
156-
panelMenu->addAction( dock->toggleViewAction() );
157-
}
158-
else
159-
{
160-
QgsDebugMsg( "panel menu not found" );
161-
}
162-
163-
panelMenu->addAction( dock->toggleViewAction() );
164-
165-
dock->setWidget( tws );
166-
dock->show();
167-
}

‎src/providers/wms/qgstilescalewidget.h renamed to ‎src/app/qgstilescalewidget.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,20 @@
2323

2424
class QgsMapCanvas;
2525
class QgsMapLayer;
26-
class QMainWindow;
26+
class QwtSlider;
2727

2828
class QgsTileScaleWidget : public QWidget, private Ui::QgsTileScaleWidget
2929
{
3030
Q_OBJECT
31-
3231
public:
33-
static void showTileScale( QMainWindow *mainWindow );
32+
QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget * parent = 0, Qt::WindowFlags f = 0 );
3433

3534
public slots:
3635
void layerChanged( QgsMapLayer *layer );
3736
void scaleChanged( double );
3837
void on_mSlider_valueChanged( int );
3938

4039
private:
41-
QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget *parent = 0, Qt::WindowFlags f = 0 );
42-
~QgsTileScaleWidget();
43-
4440
QgsMapCanvas *mMapCanvas;
4541
QList<double> mResolutions;
4642
};

‎src/providers/wms/qgswmssourceselect.cpp renamed to ‎src/app/qgswmssourceselect.cpp

Lines changed: 59 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
copyright :
66
original : (C) 2005 by Brendan Morley email : morb at ozemail dot com dot au
77
wms search : (C) 2009 Mathias Walker <mwa at sourcepole.ch>, Sourcepole AG
8-
wmts/wms-c support : (C) 2010-2012 Juergen E. Fischer < jef at norbit dot de >, norBIT GmbH
8+
wms-c support : (C) 2010 Juergen E. Fischer < jef at norbit dot de >, norBIT GmbH
99
1010
***************************************************************************/
1111

@@ -19,24 +19,22 @@
1919
***************************************************************************/
2020
/* $Id$ */
2121

22-
#include "qgswmsprovider.h"
22+
#include "../providers/wms/qgswmsprovider.h"
2323
#include "qgis.h" // GEO_EPSG_CRS_ID
24+
#include "qgisapp.h" //for getThemeIcon
2425
#include "qgscontexthelp.h"
2526
#include "qgscoordinatereferencesystem.h"
27+
#include "qgsgenericprojectionselector.h"
2628
#include "qgslogger.h"
29+
#include "qgsmanageconnectionsdialog.h"
2730
#include "qgsmessageviewer.h"
31+
#include "qgsnewhttpconnection.h"
32+
#include "qgsnumericsortlistviewitem.h"
2833
#include "qgsproject.h"
2934
#include "qgsproviderregistry.h"
3035
#include "qgswmssourceselect.h"
31-
#include "qgswmtsdimensions.h"
3236
#include "qgsnetworkaccessmanager.h"
3337

34-
#include "../../gui/qgsgenericprojectionselector.h"
35-
36-
#include "../../app/qgsnewhttpconnection.h"
37-
#include "../../app/qgsnumericsortlistviewitem.h"
38-
#include "../../app/qgsmanageconnectionsdialog.h"
39-
4038
#include <QButtonGroup>
4139
#include <QFileDialog>
4240
#include <QRadioButton>
@@ -64,8 +62,8 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl )
6462
buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole );
6563
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClicked() ) );
6664

67-
// mLayerUpButton->setIcon( QgisApp::getThemeIcon( "/mActionArrowUp.png" ) );
68-
// mLayerDownButton->setIcon( QgisApp::getThemeIcon( "/mActionArrowDown.png" ) );
65+
mLayerUpButton->setIcon( QgisApp::getThemeIcon( "/mActionArrowUp.png" ) );
66+
mLayerDownButton->setIcon( QgisApp::getThemeIcon( "/mActionArrowDown.png" ) );
6967

7068
mAddButton->setEnabled( false );
7169
populateConnectionList();
@@ -349,68 +347,57 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
349347

350348
lstLayers->sortByColumn( 0, Qt::AscendingOrder );
351349

352-
wmsProvider->supportedTileLayers( mTileLayers );
350+
QVector<QgsWmsTileSetProfile> tilesets;
351+
wmsProvider->supportedTileSets( tilesets );
353352

354-
tabServers->setTabEnabled( tabServers->indexOf( tabTilesets ), mTileLayers.size() > 0 );
353+
tabServers->setTabEnabled( tabServers->indexOf( tabTilesets ), tilesets.size() > 0 );
355354
if ( tabServers->isTabEnabled( tabServers->indexOf( tabTilesets ) ) )
356355
tabServers->setCurrentWidget( tabTilesets );
357356

358-
if ( mTileLayers.size() > 0 )
357+
if ( tilesets.size() > 0 )
359358
{
360-
QHash<QString, QgsWmtsTileMatrixSet> tileMatrixSets;
361-
wmsProvider->supportedTileMatrixSets( tileMatrixSets );
362-
363-
int rows = 0;
364-
foreach( const QgsWmtsTileLayer &l, mTileLayers )
365-
{
366-
rows += l.styles.size() * l.setLinks.size();
367-
}
368-
369359
lstTilesets->clearContents();
370-
lstTilesets->setRowCount( rows );
360+
lstTilesets->setRowCount( tilesets.size() );
371361
lstTilesets->setSortingEnabled( true );
372362

373-
int row = 0;
374-
foreach( const QgsWmtsTileLayer &l, mTileLayers )
363+
for ( int i = 0; i < tilesets.size(); i++ )
375364
{
376-
foreach( const QgsWmtsStyle &style, l.styles )
365+
QTableWidgetItem *item = new QTableWidgetItem( tilesets[i].layers.join( ", " ) );
366+
367+
item->setData( Qt::UserRole + 0, tilesets[i].layers.join( "," ) );
368+
item->setData( Qt::UserRole + 1, tilesets[i].styles.join( "," ) );
369+
item->setData( Qt::UserRole + 2, tilesets[i].format );
370+
item->setData( Qt::UserRole + 3, tilesets[i].crs );
371+
item->setData( Qt::UserRole + 4, tilesets[i].tileWidth );
372+
item->setData( Qt::UserRole + 5, tilesets[i].tileHeight );
373+
item->setData( Qt::UserRole + 6, tilesets[i].resolutions );
374+
375+
lstTilesets->setItem( i, 0, item );
376+
lstTilesets->setItem( i, 1, new QTableWidgetItem( tilesets[i].styles.join( ", " ) ) );
377+
lstTilesets->setItem( i, 2, new QTableWidgetItem( QString( "%1x%2" ).arg( tilesets[i].tileWidth ).arg( tilesets[i].tileHeight ) ) );
378+
lstTilesets->setItem( i, 3, new QTableWidgetItem( tilesets[i].format ) );
379+
lstTilesets->setItem( i, 4, new QTableWidgetItem( tilesets[i].crs ) );
380+
381+
for ( int j = 0; j < 5; j++ )
382+
{
383+
QTableWidgetItem *item = lstTilesets->item( i, j );
384+
item->setFlags( item->flags() & ~Qt::ItemIsEditable );
385+
}
386+
387+
if ( !mMimeMap.contains( tilesets[i].format ) )
377388
{
378-
foreach( const QgsWmtsTileMatrixSetLink &setLink, l.setLinks )
389+
for ( int j = 0; j < 5; j++ )
379390
{
380-
foreach( QString format, l.formats )
381-
{
382-
QTableWidgetItem *item = new QTableWidgetItem( l.identifier );
383-
item->setData( Qt::UserRole + 0, l.identifier );
384-
385-
item->setData( Qt::UserRole + 1, format );
386-
item->setData( Qt::UserRole + 2, style.identifier );
387-
item->setData( Qt::UserRole + 3, setLink.tileMatrixSet );
388-
item->setData( Qt::UserRole + 4, tileMatrixSets[ setLink.tileMatrixSet ].crs );
389-
390-
lstTilesets->setItem( row, 0, item );
391-
lstTilesets->setItem( row, 1, new QTableWidgetItem( format ) );
392-
lstTilesets->setItem( row, 2, new QTableWidgetItem( style.identifier ) );
393-
QTableWidgetItem *styleItem = new QTableWidgetItem( l.title );
394-
if ( !l.abstract.isEmpty() )
395-
styleItem->setToolTip( "<p>" + l.abstract + "</p>" );
396-
lstTilesets->setItem( row, 3, styleItem );
397-
lstTilesets->setItem( row, 4, new QTableWidgetItem( setLink.tileMatrixSet ) );
398-
lstTilesets->setItem( row, 5, new QTableWidgetItem( tileMatrixSets[ setLink.tileMatrixSet ].crs ) );
399-
400-
if ( !mMimeMap.contains( format ) )
401-
{
402-
for ( int i = 0; i < lstTilesets->columnCount(); i++ )
403-
{
404-
QTableWidgetItem *item = lstTilesets->item( row, i );
405-
item->setFlags( item->flags() & ~Qt::ItemIsEnabled );
406-
item->setToolTip( tr( "encoding %1 not supported." ).arg( format ) );
407-
}
408-
}
409-
}
410-
411-
row++;
391+
QTableWidgetItem *item = lstTilesets->item( i, j );
392+
item->setFlags( item->flags() & ~Qt::ItemIsEnabled );
393+
item->setToolTip( tr( "encoding %1 not supported." ).arg( tilesets[i].format ) );
412394
}
413395
}
396+
397+
QString crsName = descriptionForAuthId( tilesets[i].crs );
398+
if ( crsName.isEmpty() )
399+
crsName = tr( "CRS %1 not supported." ).arg( tilesets[i].crs );
400+
lstTilesets->item( i, 4 )->setToolTip( crsName );
414401
}
415402

416403
lstTilesets->resizeColumnsToContents();
@@ -524,8 +511,6 @@ void QgsWMSSourceSelect::addClicked()
524511
QString crs;
525512
QString connInfo = connectionInfo();
526513

527-
QStringList connArgs;
528-
529514
if ( lstTilesets->selectedItems().isEmpty() )
530515
{
531516
collectSelectedLayers( layers, styles );
@@ -535,70 +520,26 @@ void QgsWMSSourceSelect::addClicked()
535520
else
536521
{
537522
QTableWidgetItem *item = lstTilesets->selectedItems().first();
523+
layers = item->data( Qt::UserRole + 0 ).toStringList();
524+
styles = item->data( Qt::UserRole + 1 ).toStringList();
525+
format = item->data( Qt::UserRole + 2 ).toString();
526+
crs = item->data( Qt::UserRole + 3 ).toString();
538527

539-
layers = QStringList( item->data( Qt::UserRole + 0 ).toString() );
540-
format = item->data( Qt::UserRole + 1 ).toString();
541-
styles = QStringList( item->data( Qt::UserRole + 2 ).toString() );
542-
crs = item->data( Qt::UserRole + 4 ).toString();
543-
544-
connArgs << QString( "tileMatrixSet=%1" ).arg( item->data( Qt::UserRole + 3 ).toStringList().join( ";" ) );
545-
546-
const QgsWmtsTileLayer *layer = 0;
547-
548-
foreach( const QgsWmtsTileLayer &l, mTileLayers )
549-
{
550-
if ( l.identifier == layers.join( "," ) )
551-
{
552-
layer = &l;
553-
break;
554-
}
555-
}
556-
557-
Q_ASSERT( layer );
528+
QString connArgs = QString( "tiled=%1;%2;%3" )
529+
.arg( item->data( Qt::UserRole + 4 ).toInt() )
530+
.arg( item->data( Qt::UserRole + 5 ).toInt() )
531+
.arg( item->data( Qt::UserRole + 6 ).toStringList().join( ";" ) );
558532

559-
if ( !layer->dimensions.isEmpty() )
533+
if ( connInfo.startsWith( "username=" ) || connInfo.startsWith( "ignoreUrl=" ) )
560534
{
561-
QgsWmtsDimensions *dlg = new QgsWmtsDimensions( *layer, this );
562-
if ( dlg->exec() != QDialog::Accepted )
563-
{
564-
delete dlg;
565-
return;
566-
}
567-
568-
QHash<QString, QString> dims;
569-
dlg->selectedDimensions( dims );
570-
571-
QString dimString = "tileDimensions=";
572-
QString delim;
573-
574-
for ( QHash<QString, QString>::const_iterator it = dims.constBegin();
575-
it != dims.constEnd();
576-
++it )
577-
{
578-
dimString += delim + it.key() + "=" + it.value();
579-
delim = ";";
580-
}
581-
582-
delete dlg;
583-
584-
connArgs << dimString;
535+
connInfo.prepend( connArgs + "," );
585536
}
586-
}
587-
588-
if ( !connArgs.isEmpty() )
589-
{
590-
if ( !connInfo.startsWith( "username=" ) && !connInfo.startsWith( "ignoreUrl=" ) )
537+
else
591538
{
592-
connInfo.prepend( "url=" );
539+
connInfo.prepend( connArgs + ",url=" );
593540
}
594-
595-
connArgs << connInfo;
596-
597-
connInfo = connArgs.join( "," );
598541
}
599542

600-
QgsDebugMsg( QString( "connInfo=%1 crs=%2 " ).arg( connInfo ).arg( crs ) );
601-
602543
QgisApp::instance()->addRasterLayer( connInfo,
603544
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
604545
"wms", layers, styles, format, crs );

‎src/providers/wms/qgswmssourceselect.h renamed to ‎src/app/qgswmssourceselect.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***************************************************************************
2-
qgswmssourceselect.h - selector for WMS servers, etc.
2+
qgserversourceselect.h - selector for WMS servers, etc.
33
-------------------
44
begin : 3 April 2005
55
original : (C) 2005 by Brendan Morley email : morb at ozemail dot com dot au
@@ -21,7 +21,6 @@
2121
#include "ui_qgswmssourceselectbase.h"
2222
#include "qgisgui.h"
2323
#include "qgscontexthelp.h"
24-
#include "qgswmsprovider.h"
2524

2625
#include <QStringList>
2726
#include <QPushButton>
@@ -189,17 +188,6 @@ class QgsWMSSourceSelect : public QDialog, private Ui::QgsWMSSourceSelectBase
189188
QList<QTreeWidgetItem*> mCurrentSelection;
190189
QTableWidgetItem* mCurrentTileset;
191190

192-
QList<QgsWmtsTileLayer> mTileLayers;
193-
194-
signals:
195-
void addRasterLayer( QString const & rasterLayerPath,
196-
QString const & baseName,
197-
QString const & providerKey,
198-
QStringList const & layers,
199-
QStringList const & styles,
200-
QString const & format,
201-
QString const & crs );
202-
void connectionsChanged();
203191
private slots:
204192
void on_btnSearch_clicked();
205193
void on_btnAddWMS_clicked();

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,16 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString theDefinition
128128

129129
bool QgsCoordinateReferenceSystem::createFromOgcWmsCrs( QString theCrs )
130130
{
131-
QRegExp re( "urn:ogc:def:crs:([^:]+).+([^:]+)", Qt::CaseInsensitive );
132-
if ( re.exactMatch( theCrs ) )
131+
QRegExp re( "(user|custom|qgis):(\\d+)", Qt::CaseInsensitive );
132+
if ( re.exactMatch( theCrs ) && createFromSrsId( re.cap( 2 ).toInt() ) )
133133
{
134-
theCrs = re.cap( 1 ) + ":" + re.cap( 2 );
135-
}
136-
else
137-
{
138-
re.setPattern( "(user|custom|qgis):(\\d+)" );
139-
if ( re.exactMatch( theCrs ) && createFromSrsId( re.cap( 2 ).toInt() ) )
140-
{
141-
return true;
142-
}
134+
return true;
143135
}
144136

145137
if ( loadFromDb( QgsApplication::srsDbFilePath(), "lower(auth_name||':'||auth_id)", theCrs.toLower() ) )
146138
return true;
147139

148-
if ( theCrs.compare( "CRS:84", Qt::CaseInsensitive ) == 0 ||
149-
theCrs.compare( "OGC:CRS84", Qt::CaseInsensitive ) == 0 )
140+
if ( theCrs.compare( "CRS:84", Qt::CaseInsensitive ) == 0 )
150141
{
151142
createFromSrsId( GEOCRS_ID );
152143
return true;
@@ -170,7 +161,6 @@ QgsCoordinateReferenceSystem& QgsCoordinateReferenceSystem::operator=( const Qgs
170161
mDescription = srs.mDescription;
171162
mProjectionAcronym = srs.mProjectionAcronym;
172163
mEllipsoidAcronym = srs.mEllipsoidAcronym;
173-
mAxisInverted = srs.mAxisInverted;
174164
mGeoFlag = srs.mGeoFlag;
175165
mMapUnits = srs.mMapUnits;
176166
mSRID = srs.mSRID;
@@ -268,7 +258,6 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString expression, Q
268258
mSRID = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 5 ) ).toLong();
269259
mAuthId = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 6 ) );
270260
mGeoFlag = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 7 ) ).toInt() != 0;
271-
mAxisInverted = -1;
272261

273262
if ( mSrsId >= USER_CRS_START_ID && mAuthId.isEmpty() )
274263
{
@@ -756,22 +745,6 @@ bool QgsCoordinateReferenceSystem::geographicFlag() const
756745
return mGeoFlag;
757746
}
758747

759-
bool QgsCoordinateReferenceSystem::axisInverted() const
760-
{
761-
if ( mAxisInverted == -1 )
762-
{
763-
OGRAxisOrientation orientation;
764-
const char *axis0 = OSRGetAxis( mCRS, mGeoFlag ? "GEOGCS" : "PROJCS", 0, &orientation );
765-
mAxisInverted = mGeoFlag
766-
? ( orientation == OAO_East || orientation == OAO_West || orientation == OAO_Other )
767-
: ( orientation == OAO_North || orientation == OAO_South );
768-
QgsDebugMsg( QString( "srid:%1 axis0:%2 orientation:%3 inverted:%4" ).arg( mSRID ).arg( axis0 ).arg( OSRAxisEnumToName( orientation ) ).arg( mAxisInverted ) );
769-
Q_UNUSED( axis0 );
770-
}
771-
772-
return mAxisInverted != 0;
773-
}
774-
775748
QGis::UnitType QgsCoordinateReferenceSystem::mapUnits() const
776749
{
777750
return mMapUnits;

‎src/core/qgscoordinatereferencesystem.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,6 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
308308
*/
309309
bool geographicFlag() const;
310310

311-
/*! return if axis is inverted (eg. for WMS 1.3)
312-
* @return bool Whether this is crs axis is inverted
313-
* @note added in 1.9.90
314-
*/
315-
bool axisInverted() const;
316-
317311
/*! Get the units that the projection is in
318312
* @return QGis::UnitType that gives the units for the coordinate system
319313
*/
@@ -432,9 +426,6 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
432426

433427
QString mValidationHint;
434428

435-
//!Whether this is a coordinate system has inverted axis
436-
mutable int mAxisInverted;
437-
438429
static CUSTOM_CRS_VALIDATION mCustomSrsValidation;
439430
};
440431

‎src/core/qgsproviderregistry.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ class CORE_EXPORT QgsProviderRegistry
126126
/** type for data provider metadata associative container */
127127
typedef std::map<QString, QgsProviderMetadata*> Providers;
128128

129-
void registerGuis( QWidget *widget );
130-
131129
private:
132130

133131
/** ctor private since instance() creates it */

‎src/core/spatialindex/storagemanager/DiskStorageManager.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <sys/types.h>
2626
#include <sys/stat.h>
2727
#include <stdio.h>
28-
#include <unistd.h>
2928
#include <cstring>
3029

3130
#ifdef WIN32

‎src/core/spatialindex/tools/TemporaryFile.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
// mhadji@gmail.com
2121

2222
#include <stdio.h>
23-
#include <unistd.h>
2423

2524
#include <Tools.h>
2625

‎src/gui/qgsmapcanvas.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
8484
, mPainting( false )
8585
, mAntiAliasing( false )
8686
{
87-
setObjectName( name );
8887
//disable the update that leads to the resize crash
8988
if ( viewport() )
9089
{

‎src/providers/wms/CMakeLists.txt

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,19 @@
1-
SET (WMS_SRCS
2-
qgswmsprovider.cpp
3-
qgswmssourceselect.cpp
4-
qgstilescalewidget.cpp
5-
qgswmtsdimensions.cpp
6-
../../app/qgsnewhttpconnection.cpp
7-
../../app/qgsnumericsortlistviewitem.cpp
8-
../../app/qgsmanageconnectionsdialog.cpp
9-
)
10-
SET (WMS_MOC_HDRS
11-
qgswmsprovider.h
12-
qgswmssourceselect.h
13-
qgstilescalewidget.h
14-
qgswmtsdimensions.h
15-
../../app/qgsnewhttpconnection.h
16-
../../app/qgsnumericsortlistviewitem.h
17-
../../app/qgsmanageconnectionsdialog.h
18-
)
1+
2+
SET (WMS_SRCS qgswmsprovider.cpp)
3+
SET (WMS_MOC_HDRS qgswmsprovider.h)
194

205
QT4_WRAP_CPP (WMS_MOC_SRCS ${WMS_MOC_HDRS})
216

227
INCLUDE_DIRECTORIES( .
23-
${CMAKE_CURRENT_BINARY_DIR}/../../ui
248
../../core
259
../../core/raster
26-
../../gui
2710
${GDAL_INCLUDE_DIR}
2811
)
2912

3013
ADD_LIBRARY(wmsprovider MODULE ${WMS_SRCS} ${WMS_MOC_SRCS})
3114

3215
TARGET_LINK_LIBRARIES(wmsprovider
3316
qgis_core
34-
qgis_gui
3517
)
3618

3719
INSTALL (TARGETS wmsprovider

‎src/providers/wms/qgswmsprovider.cpp

Lines changed: 742 additions & 1543 deletions
Large diffs are not rendered by default.

‎src/providers/wms/qgswmsprovider.h

Lines changed: 55 additions & 195 deletions
Large diffs are not rendered by default.

‎src/providers/wms/qgswmtsdimensions.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

‎src/providers/wms/qgswmtsdimensions.h

Lines changed: 0 additions & 50 deletions
This file was deleted.

‎src/ui/qgisapp.ui

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<addaction name="mActionNewBookmark"/>
120120
<addaction name="mActionShowBookmarks"/>
121121
<addaction name="mActionDraw"/>
122+
<addaction name="mActionTileScale"/>
122123
<addaction name="mActionGpsTool"/>
123124
</widget>
124125
<widget class="QMenu" name="mLayerMenu">
@@ -1213,6 +1214,11 @@
12131214
<string>Set Project CRS from Layer</string>
12141215
</property>
12151216
</action>
1217+
<action name="mActionTileScale">
1218+
<property name="text">
1219+
<string>Tile scale slider</string>
1220+
</property>
1221+
</action>
12161222
<action name="mActionGpsTool">
12171223
<property name="text">
12181224
<string>Live GPS tracking</string>

‎src/ui/qgswmssourceselectbase.ui

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,27 +326,22 @@
326326
</attribute>
327327
<column>
328328
<property name="text">
329-
<string>Layer</string>
329+
<string>Layers</string>
330330
</property>
331331
</column>
332332
<column>
333333
<property name="text">
334-
<string>Format</string>
334+
<string>Styles</string>
335335
</property>
336336
</column>
337337
<column>
338338
<property name="text">
339-
<string>Style</string>
339+
<string>Size</string>
340340
</property>
341341
</column>
342342
<column>
343343
<property name="text">
344-
<string>Title</string>
345-
</property>
346-
</column>
347-
<column>
348-
<property name="text">
349-
<string>Tileset</string>
344+
<string>Format</string>
350345
</property>
351346
</column>
352347
<column>

‎src/ui/qgswmtsdimensionsbase.ui

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.