[QGIS Commit] r13465 - in trunk/qgis/src: app providers/wms ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon May 10 17:32:29 EDT 2010
Author: jef
Date: 2010-05-10 17:32:27 -0400 (Mon, 10 May 2010)
New Revision: 13465
Modified:
trunk/qgis/src/app/qgswmssourceselect.cpp
trunk/qgis/src/providers/wms/qgswmsprovider.cpp
trunk/qgis/src/providers/wms/qgswmsprovider.h
trunk/qgis/src/ui/qgswmssourceselectbase.ui
Log:
implement #2702
Modified: trunk/qgis/src/app/qgswmssourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.cpp 2010-05-10 20:28:42 UTC (rev 13464)
+++ trunk/qgis/src/app/qgswmssourceselect.cpp 2010-05-10 21:32:27 UTC (rev 13465)
@@ -77,6 +77,9 @@
mAddButton->setEnabled( false );
populateConnectionList();
+ cbxIgnoreGetMap->setEnabled( false );
+ cbxIgnoreGetFeatureInfo->setEnabled( false );
+
QHBoxLayout *layout = new QHBoxLayout;
mImageFormatGroup = new QButtonGroup;
@@ -403,6 +406,49 @@
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
}
+ if ( wmsProvider->baseUrl() != wmsProvider->getMapUrl() )
+ {
+ if ( QMessageBox::information( this,
+ tr( "WMS Provider" ),
+ tr( "Advertised GetMap URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
+ "This might be an server configuration error. Should the URL be used?" )
+ .arg( wmsProvider->baseUrl() )
+ .arg( wmsProvider->getMapUrl() ),
+ QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
+ {
+ cbxIgnoreGetMap->setChecked( false );
+ }
+ else
+ {
+ cbxIgnoreGetMap->setChecked( true );
+ }
+ cbxIgnoreGetMap->setEnabled( true );
+ }
+ else
+ {
+ cbxIgnoreGetMap->setEnabled( false );
+ cbxIgnoreGetMap->setChecked( false );
+ }
+
+ if ( wmsProvider->baseUrl() != wmsProvider->getFeatureInfoUrl() )
+ {
+ if ( QMessageBox::information( this,
+ tr( "WMS Provider" ),
+ tr( "Advertised GetFeatureInfo URL\n\n %2\n\nis different from GetCapabilities URL\n\n %1\n\n"
+ "This might be an server configuration error. Should the URL be used?" )
+ .arg( wmsProvider->baseUrl() )
+ .arg( wmsProvider->getFeatureInfoUrl() ),
+ QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
+ {
+ cbxIgnoreGetFeatureInfo->setChecked( false );
+ }
+ else
+ {
+ cbxIgnoreGetFeatureInfo->setChecked( true );
+ }
+ cbxIgnoreGetFeatureInfo->setEnabled( true );
+ }
+
return true;
}
@@ -513,6 +559,31 @@
}
}
+ if ( cbxIgnoreGetMap->isChecked() || cbxIgnoreGetFeatureInfo->isChecked() )
+ {
+ QString connArgs = "ignoreUrl=";
+
+ if ( cbxIgnoreGetMap->isChecked() )
+ {
+ connArgs += "GetMap";
+ if ( cbxIgnoreGetFeatureInfo->isChecked() )
+ connArgs += ";GetFeatureInfo";
+ }
+ else
+ {
+ connArgs += "GetFeatureInfo";
+ }
+
+ if ( connInfo.startsWith( "username=" ) )
+ {
+ connInfo.prepend( connArgs + "," );
+ }
+ else
+ {
+ connInfo.prepend( connArgs + ",url=" );
+ }
+ }
+
QgisApp::instance()->addRasterLayer( connInfo,
leLayerName->text().isEmpty() ? layers.join( "/" ) : leLayerName->text(),
"wms", layers, styles, format, crs );
Modified: trunk/qgis/src/providers/wms/qgswmsprovider.cpp
===================================================================
--- trunk/qgis/src/providers/wms/qgswmsprovider.cpp 2010-05-10 20:28:42 UTC (rev 13464)
+++ trunk/qgis/src/providers/wms/qgswmsprovider.cpp 2010-05-10 21:32:27 UTC (rev 13465)
@@ -99,9 +99,9 @@
// 2) http://xxx.xxx.xx/yyy/yyy?
// 3) http://xxx.xxx.xx/yyy/yyy?zzz=www
- baseUrl = prepareUri( httpuri );
+ mBaseUrl = prepareUri( httpuri );
- QgsDebugMsg( "baseUrl = " + baseUrl );
+ QgsDebugMsg( "mBaseUrl = " + mBaseUrl );
QgsDebugMsg( "exiting constructor." );
}
@@ -118,6 +118,9 @@
mTileHeight = 0;
mResolutions.clear();
+ mIgnoreGetMapUrl = false;
+ mIgnoreGetFeatureInfoUrl = false;
+
// uri potentially contains username and password
QStringList parts = uri.split( "," );
QStringListIterator iter( parts );
@@ -156,12 +159,26 @@
httpuri = item.mid( 4 );
QgsDebugMsg( "set httpuri to " + httpuri );
}
+ else if ( item.startsWith( "ignoreUrl=" ) )
+ {
+ foreach( QString param, item.mid( 10 ).split( ";" ) )
+ {
+ if ( param == "GetMap" )
+ {
+ mIgnoreGetMapUrl = true;
+ }
+ else if ( param == "GetFeatureInfo" )
+ {
+ mIgnoreGetFeatureInfoUrl = true;
+ }
+ }
+ }
}
}
}
-QString QgsWmsProvider::prepareUri( QString uri )
+QString QgsWmsProvider::prepareUri( QString uri ) const
{
if ( !uri.contains( "?" ) )
{
@@ -247,6 +264,25 @@
return mCapabilities.capability.tileSetProfiles.size() > 0;
}
+QString QgsWmsProvider::baseUrl() const
+{
+ return mBaseUrl;
+}
+
+QString QgsWmsProvider::getMapUrl() const
+{
+ return mCapabilities.capability.request.getMap.dcpType.size() == 0
+ ? mBaseUrl
+ : prepareUri( mCapabilities.capability.request.getMap.dcpType.front().http.get.onlineResource.xlinkHref );
+}
+
+QString QgsWmsProvider::getFeatureInfoUrl() const
+{
+ return mCapabilities.capability.request.getFeatureInfo.dcpType.size() == 0
+ ? mBaseUrl
+ : prepareUri( mCapabilities.capability.request.getFeatureInfo.dcpType.front().http.get.onlineResource.xlinkHref );
+}
+
void QgsWmsProvider::addLayers( QStringList const &layers,
QStringList const &styles )
{
@@ -375,16 +411,7 @@
crsKey = "CRS";
}
- QString url;
- QVector<QgsWmsDcpTypeProperty> dcpType = mCapabilities.capability.request.getMap.dcpType;
- if ( dcpType.size() < 1 )
- {
- url = baseUrl;
- }
- else
- {
- url = prepareUri( dcpType.front().http.get.onlineResource.xlinkHref );
- }
+ QString url = mIgnoreGetMapUrl ? mBaseUrl : getMapUrl();
cachedImage = new QImage( pixelWidth, pixelHeight, QImage::Format_ARGB32 );
cachedImage->fill( 0 );
@@ -463,15 +490,7 @@
url += "&TRANSPARENT=true";
}
- dcpType = mCapabilities.capability.request.getFeatureInfo.dcpType;
- if ( dcpType.size() < 1 )
- {
- mGetFeatureInfoUrlBase = baseUrl;
- }
- else
- {
- mGetFeatureInfoUrlBase = prepareUri( dcpType.front().http.get.onlineResource.xlinkHref );
- }
+ mGetFeatureInfoUrlBase = mIgnoreGetFeatureInfoUrl ? mBaseUrl : getFeatureInfoUrl();
// cache some details for if the user wants to do an identifyAsHtml() later
mGetFeatureInfoUrlBase += "SERVICE=WMS";
@@ -815,7 +834,7 @@
if ( httpcapabilitiesresponse.isNull() || forceRefresh )
{
- QString url = baseUrl + "SERVICE=WMS&REQUEST=GetCapabilities";
+ QString url = mBaseUrl + "SERVICE=WMS&REQUEST=GetCapabilities";
QNetworkRequest request( url );
request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork );
@@ -1789,7 +1808,7 @@
{
mErrorCaption = tr( "Dom Exception" );
mError = tr( "Could not get WMS Service Exception at %1: %2 at line %3 column %4" )
- .arg( baseUrl )
+ .arg( mBaseUrl )
.arg( errorMsg )
.arg( errorLine )
.arg( errorColumn );
@@ -2090,7 +2109,175 @@
return capability;
}
+QString QgsWmsProvider::layerMetadata( QgsWmsLayerProperty &layer )
+{
+ QString myMetadataQString;
+ // Layer Properties section
+ myMetadataQString += "<tr><td bgcolor=\"white\">";
+ myMetadataQString += layer.name;
+ myMetadataQString += "</td></tr>";
+
+ // Use a nested table
+ myMetadataQString += "<tr><td bgcolor=\"white\">";
+ myMetadataQString += "<table width=\"100%\">";
+
+ // Table header
+ myMetadataQString += "<tr><th bgcolor=\"black\">";
+ myMetadataQString += "<font color=\"white\">" + tr( "Property" ) + "</font>";
+ myMetadataQString += "</th>";
+ myMetadataQString += "<th bgcolor=\"black\">";
+ myMetadataQString += "<font color=\"white\">" + tr( "Value" ) + "</font>";
+ myMetadataQString += "</th></tr>";
+
+ // Layer Visibility (as managed by this provider)
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Visibility" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += activeSubLayerVisibility.find( layer.name ).value() ? tr( "Visible" ) : tr( "Hidden" );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Title
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Title" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.title;
+ myMetadataQString += "</td></tr>";
+
+ // Layer Abstract
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Abstract" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.abstract;
+ myMetadataQString += "</td></tr>";
+
+ // Layer Queryability
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Can Identify" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.queryable ? tr( "Yes" ) : tr( "No" );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Opacity
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Can be Transparent" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.opaque ? tr( "No" ) : tr( "Yes" );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Subsetability
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Can Zoom In" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.noSubsets ? tr( "No" ) : tr( "Yes" );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Server Cascade Count
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Cascade Count" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += QString::number( layer.cascaded );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Fixed Width
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Fixed Width" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += QString::number( layer.fixedWidth );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Fixed Height
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Fixed Height" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += QString::number( layer.fixedHeight );
+ myMetadataQString += "</td></tr>";
+
+ // Layer Fixed Height
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "WGS 84 Bounding Box" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += extentForLayer[ layer.name ].toString();
+ myMetadataQString += "</td></tr>";
+
+ // Layer Coordinate Reference Systems
+ for ( int j = 0; j < std::min( layer.crs.size(), 10 ); j++ )
+ {
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Available in CRS" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.crs[j];
+ myMetadataQString += "</td></tr>";
+ }
+
+ if ( layer.crs.size() > 10 )
+ {
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Available in CRS" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += tr( "(and %n more)", "crs", layer.crs.size() - 10 );
+ myMetadataQString += "</td></tr>";
+ }
+
+ // Layer Styles
+ for ( int j = 0; j < layer.style.size(); j++ )
+ {
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Available in style" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td>";
+
+ // Nested table.
+ myMetadataQString += "<table width=\"100%\">";
+
+ // Layer Style Name
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Name" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.style[j].name;
+ myMetadataQString += "</td></tr>";
+
+ // Layer Style Title
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Title" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.style[j].title;
+ myMetadataQString += "</td></tr>";
+
+ // Layer Style Abstract
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "Abstract" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += layer.style[j].abstract;
+ myMetadataQString += "</td></tr>";
+
+ // Close the nested table
+ myMetadataQString += "</table>";
+ myMetadataQString += "</td></tr>";
+ }
+
+ // Close the nested table
+ myMetadataQString += "</table>";
+ myMetadataQString += "</td></tr>";
+
+ return myMetadataQString;
+}
+
QString QgsWmsProvider::metadata()
{
QString myMetadataQString = "";
@@ -2101,9 +2288,11 @@
myMetadataQString += tr( "Server Properties" );
myMetadataQString += "</a> ";
- myMetadataQString += "<a href=\"#layerproperties\">";
- myMetadataQString += tr( "Layer Properties" );
- myMetadataQString += "</a> ";
+ myMetadataQString += " <a href=\"#selectedlayers\">";
+ myMetadataQString += tr( "Selected Layers" );
+ myMetadataQString += "</a> <a href=\"#otherlayers\">";
+ myMetadataQString += tr( "Other Layers" );
+ myMetadataQString += "</a>";
if ( tilesetsSupported.size() > 0 )
{
@@ -2242,10 +2431,24 @@
// Base URL
myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "GetCapabilitiesUrl" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += mBaseUrl;
+ myMetadataQString += "</td></tr>";
+
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
+ myMetadataQString += tr( "GetMapUrl" );
+ myMetadataQString += "</td>";
+ myMetadataQString += "<td bgcolor=\"gray\">";
+ myMetadataQString += getMapUrl() + ( mIgnoreGetMapUrl ? tr( " <font color=\"red\">(advertised but ignored)</font>" ) : "" );
+ myMetadataQString += "</td></tr>";
+
+ myMetadataQString += "<tr><td bgcolor=\"gray\">";
myMetadataQString += tr( "GetFeatureInfoUrl" );
myMetadataQString += "</td>";
myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += mGetFeatureInfoUrlBase;
+ myMetadataQString += getFeatureInfoUrl() + ( mIgnoreGetFeatureInfoUrl ? tr( " <font color=\"red\">(advertised but ignored)</font>" ) : "" );
myMetadataQString += "</td></tr>";
// Close the nested table
@@ -2253,195 +2456,29 @@
myMetadataQString += "</td></tr>";
// Layer properties
- myMetadataQString += "<tr><td bgcolor=\"gray\"><a name=\"layerproperties\"></a>";
- myMetadataQString += tr( "Layer Properties:" );
+ myMetadataQString += "<tr><td><a name=\"selectedlayers\"></a>";
+ myMetadataQString += tr( "Selected Layers:" );
myMetadataQString += "</td></tr>";
- // Iterate through layers
-
for ( int i = 0; i < layersSupported.size(); i++ )
{
- // TODO: Handle nested layers
- QString layerName = layersSupported[i].name; // for aesthetic convenience
-
- // Layer Properties section
- myMetadataQString += "<tr><td bgcolor=\"white\">";
- myMetadataQString += layerName;
- myMetadataQString += "</td></tr>";
-
- // Use a nested table
- myMetadataQString += "<tr><td bgcolor=\"white\">";
- myMetadataQString += "<table width=\"100%\">";
-
- // Table header
- myMetadataQString += "<tr><th bgcolor=\"black\">";
- myMetadataQString += "<font color=\"white\">" + tr( "Property" ) + "</font>";
- myMetadataQString += "</th>";
- myMetadataQString += "<th bgcolor=\"black\">";
- myMetadataQString += "<font color=\"white\">" + tr( "Value" ) + "</font>";
- myMetadataQString += "</th></tr>";
-
- bool selected = !mTiled && activeSubLayers.indexOf( layerName ) >= 0;
-
- // Layer Selectivity (as managed by this provider)
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Selected" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += selected ? tr( "Yes" ) : tr( "No" );
- myMetadataQString += "</td></tr>";
-
- // Layer Visibility (as managed by this provider)
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Visibility" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- if ( selected )
+ if ( !mTiled && activeSubLayers.indexOf( layersSupported[i].name ) >= 0 )
{
- myMetadataQString += activeSubLayerVisibility.find( layerName ).value() ? tr( "Visible" ) : tr( "Hidden" );
+ myMetadataQString += layerMetadata( layersSupported[i] );
}
- else
- {
- myMetadataQString += tr( "n/a" );
- }
- myMetadataQString += "</td></tr>";
+ } // for each layer
- // Layer Title
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Title" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += layersSupported[i].title;
- myMetadataQString += "</td></tr>";
+ // Layer properties
+ myMetadataQString += "<tr><td><a name=\"otherlayers\"></a>";
+ myMetadataQString += tr( "Other layers:" );
+ myMetadataQString += "</td></tr>";
- // Layer Abstract
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Abstract" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += layersSupported[i].abstract;
- myMetadataQString += "</td></tr>";
-
- // Layer Queryability
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Can Identify" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += (( layersSupported[i].queryable ) ? tr( "Yes" ) : tr( "No" ) );
- myMetadataQString += "</td></tr>";
-
- // Layer Opacity
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Can be Transparent" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += (( layersSupported[i].opaque ) ? tr( "No" ) : tr( "Yes" ) );
- myMetadataQString += "</td></tr>";
-
- // Layer Subsetability
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Can Zoom In" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += (( layersSupported[i].noSubsets ) ? tr( "No" ) : tr( "Yes" ) );
- myMetadataQString += "</td></tr>";
-
- // Layer Server Cascade Count
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Cascade Count" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += QString::number( layersSupported[i].cascaded );
- myMetadataQString += "</td></tr>";
-
- // Layer Fixed Width
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Fixed Width" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += QString::number( layersSupported[i].fixedWidth );
- myMetadataQString += "</td></tr>";
-
- // Layer Fixed Height
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Fixed Height" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += QString::number( layersSupported[i].fixedHeight );
- myMetadataQString += "</td></tr>";
-
- // Layer Fixed Height
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "WGS 84 Bounding Box" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += extentForLayer[ layerName ].toString();
- myMetadataQString += "</td></tr>";
-
- // Layer Coordinate Reference Systems
- for ( int j = 0; j < std::min( layersSupported[i].crs.size(), 10 ); j++ )
+ for ( int i = 0; i < layersSupported.size(); i++ )
+ {
+ if ( activeSubLayers.indexOf( layersSupported[i].name ) < 0 )
{
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Available in CRS" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += layersSupported[i].crs[j];
- myMetadataQString += "</td></tr>";
+ myMetadataQString += layerMetadata( layersSupported[i] );
}
-
- if ( layersSupported[i].crs.size() > 10 )
- {
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Available in CRS" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += tr( "(and more)" );
- myMetadataQString += "</td></tr>";
- }
-
- // Layer Styles
- for ( int j = 0; j < layersSupported[i].style.size(); j++ )
- {
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Available in style" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td>";
-
- // Nested table.
- myMetadataQString += "<table width=\"100%\">";
-
- // Layer Style Name
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Name" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += layersSupported[i].style[j].name;
- myMetadataQString += "</td></tr>";
-
- // Layer Style Title
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Title" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += layersSupported[i].style[j].title;
- myMetadataQString += "</td></tr>";
-
- // Layer Style Abstract
- myMetadataQString += "<tr><td bgcolor=\"gray\">";
- myMetadataQString += tr( "Abstract" );
- myMetadataQString += "</td>";
- myMetadataQString += "<td bgcolor=\"gray\">";
- myMetadataQString += layersSupported[i].style[j].abstract;
- myMetadataQString += "</td></tr>";
-
- // Close the nested table
- myMetadataQString += "</table>";
- myMetadataQString += "</td></tr>";
- }
-
- // Close the nested table
- myMetadataQString += "</table>";
- myMetadataQString += "</td></tr>";
} // for each layer
// Tileset properties
@@ -2691,7 +2728,6 @@
} // QgsWmsProvider::name()
-
QString QgsWmsProvider::description() const
{
return WMS_DESCRIPTION;
Modified: trunk/qgis/src/providers/wms/qgswmsprovider.h
===================================================================
--- trunk/qgis/src/providers/wms/qgswmsprovider.h 2010-05-10 20:28:42 UTC (rev 13464)
+++ trunk/qgis/src/providers/wms/qgswmsprovider.h 2010-05-10 21:32:27 UTC (rev 13465)
@@ -468,9 +468,25 @@
bool isValid();
/**Returns true if layer has tile set profiles
+ * @added in 1.5
*/
virtual bool hasTiles() const;
+ /**Returns the base url
+ * @added in 1.5
+ */
+ virtual QString baseUrl() const;
+
+ /**Returns the GetMap url
+ * @added in 1.5
+ */
+ virtual QString getMapUrl() const;
+
+ /**Returns the GetFeatureInfo url
+ * @added in 1.5
+ */
+ virtual QString getFeatureInfoUrl() const;
+
//! get WMS Server version string
QString wmsVersion();
@@ -706,8 +722,10 @@
* \param uri uri to prepare
* \retval prepared uri
*/
- QString prepareUri( QString uri );
+ QString prepareUri( QString uri ) const;
+ QString layerMetadata( QgsWmsLayerProperty &layer );
+
//! Data source URI of the WMS for this layer
QString httpuri;
@@ -715,7 +733,7 @@
QString connectionName;
//! URL part of URI (httpuri)
- QString baseUrl;
+ QString mBaseUrl;
/**
* Flag indicating if the layer data source is a valid WMS layer
@@ -883,6 +901,11 @@
int mTileWidth;
int mTileHeight;
QVector<double> mResolutions;
+
+ //! whether to use hrefs from GetCapabilities (default) or
+ // the given base urls for GetMap and GetFeatureInfo
+ bool mIgnoreGetMapUrl;
+ bool mIgnoreGetFeatureInfoUrl;
};
#endif
Modified: trunk/qgis/src/ui/qgswmssourceselectbase.ui
===================================================================
--- trunk/qgis/src/ui/qgswmssourceselectbase.ui 2010-05-10 20:28:42 UTC (rev 13464)
+++ trunk/qgis/src/ui/qgswmssourceselectbase.ui 2010-05-10 21:32:27 UTC (rev 13465)
@@ -197,6 +197,30 @@
</property>
</widget>
</item>
+ <item row="2" column="0" colspan="3">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QCheckBox" name="cbxIgnoreGetMap">
+ <property name="toolTip">
+ <string>Use base url instead of advertised GetFeatureInfo URL</string>
+ </property>
+ <property name="text">
+ <string>Ignore GetMap URL</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbxIgnoreGetFeatureInfo">
+ <property name="toolTip">
+ <string>Use base url instead of advertised GetFeatureInfo URL</string>
+ </property>
+ <property name="text">
+ <string>Ignore GetFeatureInfo URL</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
More information about the QGIS-commit
mailing list