diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index 6e899246713..5e72a2ae05c 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -272,6 +272,13 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa mWMSAccessConstraints->setText( QgsProject::instance()->readEntry( "WMSAccessConstraints", "/", "" ) ); mWMSKeywordList->setText( QgsProject::instance()->readListEntry( "WMSKeywordList", "/" ).join( "," ) ); + // WMS GetFeatureInfo precision + int WMSprecision = QgsProject::instance()->readNumEntry( "WMSPrecision", "/", -1 ); + if ( WMSprecision != -1 ) + { + mWMSPrecisionSpinBox->setValue( WMSprecision ); + } + bool ok; QStringList values; @@ -743,6 +750,9 @@ void QgsProjectProperties::apply() QgsProject::instance()->removeEntry( "WMSKeywordList", "/" ); } + // WMS GetFeatureInfo geometry precision (decimal places) + QgsProject::instance()->writeEntry( "WMSPrecision", "/", mWMSPrecisionSpinBox->text()); + if ( grpWMSExt->isChecked() ) { QgsProject::instance()->writeEntry( "WMSExtent", "/", diff --git a/src/mapserver/qgssldconfigparser.cpp b/src/mapserver/qgssldconfigparser.cpp index 59cf03c66d7..263ed55843f 100644 --- a/src/mapserver/qgssldconfigparser.cpp +++ b/src/mapserver/qgssldconfigparser.cpp @@ -678,6 +678,15 @@ double QgsSLDConfigParser::imageQuality() const return -1; } +int QgsSLDConfigParser::WMSPrecision() const +{ + if ( mFallbackParser ) + { + return mFallbackParser->WMSPrecision(); + } + return -1; +} + QgsComposition* QgsSLDConfigParser::createPrintComposition( const QString& composerTemplate, QgsMapRenderer* mapRenderer, const QMap< QString, QString >& parameterMap ) const { if ( mFallbackParser ) diff --git a/src/mapserver/qgssldconfigparser.h b/src/mapserver/qgssldconfigparser.h index f5de2333685..89b5c30185f 100644 --- a/src/mapserver/qgssldconfigparser.h +++ b/src/mapserver/qgssldconfigparser.h @@ -99,6 +99,7 @@ class QgsSLDConfigParser : public QgsWMSConfigParser double maxWidth() const; double maxHeight() const; double imageQuality() const; + int WMSPrecision() const; //printing diff --git a/src/mapserver/qgswmsconfigparser.h b/src/mapserver/qgswmsconfigparser.h index 0f1d1c06365..ed1bd47aba4 100644 --- a/src/mapserver/qgswmsconfigparser.h +++ b/src/mapserver/qgswmsconfigparser.h @@ -98,6 +98,9 @@ class QgsWMSConfigParser virtual double maxHeight() const = 0; virtual double imageQuality() const = 0; + // WMS GetFeatureInfo precision (decimal places) + virtual int WMSPrecision() const = 0; + //printing /**Creates a print composition, usually for a GetPrint request. Replaces map and label parameters*/ diff --git a/src/mapserver/qgswmsprojectparser.cpp b/src/mapserver/qgswmsprojectparser.cpp index b691b19ad5f..16c583e0c60 100644 --- a/src/mapserver/qgswmsprojectparser.cpp +++ b/src/mapserver/qgswmsprojectparser.cpp @@ -353,6 +353,21 @@ double QgsWMSProjectParser::imageQuality() const return imageQuality; } +int QgsWMSProjectParser::WMSPrecision() const +{ + int WMSPrecision = -1; + QDomElement propertiesElem = mProjectParser.propertiesElem(); + if ( !propertiesElem.isNull() ) + { + QDomElement WMSPrecisionElem = propertiesElem.firstChildElement( "WMSPrecision" ); + if ( !WMSPrecisionElem.isNull() ) + { + WMSPrecision = WMSPrecisionElem.text().toInt(); + } + } + return WMSPrecision; +} + QgsComposition* QgsWMSProjectParser::initComposition( const QString& composerTemplate, QgsMapRenderer* mapRenderer, QList< QgsComposerMap*>& mapList, QList< QgsComposerLabel* >& labelList, QList& htmlList ) const { //Create composition from xml diff --git a/src/mapserver/qgswmsprojectparser.h b/src/mapserver/qgswmsprojectparser.h index 9255cb24fee..8fec7db975a 100644 --- a/src/mapserver/qgswmsprojectparser.h +++ b/src/mapserver/qgswmsprojectparser.h @@ -56,6 +56,7 @@ class QgsWMSProjectParser : public QgsWMSConfigParser double maxWidth() const; double maxHeight() const; double imageQuality() const; + int WMSPrecision() const; //printing QgsComposition* initComposition( const QString& composerTemplate, QgsMapRenderer* mapRenderer, QList< QgsComposerMap*>& mapList, QList< QgsComposerLabel* >& labelList, QList& htmlFrameList ) const; diff --git a/src/mapserver/qgswmsserver.cpp b/src/mapserver/qgswmsserver.cpp index 46dac41f306..50349c92a4e 100644 --- a/src/mapserver/qgswmsserver.cpp +++ b/src/mapserver/qgswmsserver.cpp @@ -1830,10 +1830,10 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, { QDomElement bBoxElem = infoDocument.createElement( "BoundingBox" ); bBoxElem.setAttribute( version == "1.1.1" ? "SRS" : "CRS", outputCrs.authid() ); - bBoxElem.setAttribute( "minx", qgsDoubleToString( box.xMinimum(), 8 ) ); - bBoxElem.setAttribute( "maxx", qgsDoubleToString( box.xMaximum(), 8 ) ); - bBoxElem.setAttribute( "miny", qgsDoubleToString( box.yMinimum(), 8 ) ); - bBoxElem.setAttribute( "maxy", qgsDoubleToString( box.yMaximum(), 8 ) ); + bBoxElem.setAttribute( "minx", qgsDoubleToString( box.xMinimum(), getWMSPrecision( 8 ) ) ); + bBoxElem.setAttribute( "maxx", qgsDoubleToString( box.xMaximum(), getWMSPrecision( 8 ) ) ); + bBoxElem.setAttribute( "miny", qgsDoubleToString( box.yMinimum(), getWMSPrecision( 8 ) ) ); + bBoxElem.setAttribute( "maxy", qgsDoubleToString( box.yMaximum(), getWMSPrecision( 8 ) ) ); featureElement.appendChild( bBoxElem ); } @@ -1851,7 +1851,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, } QDomElement geometryElement = infoDocument.createElement( "Attribute" ); geometryElement.setAttribute( "name", "geometry" ); - geometryElement.setAttribute( "value", geom->exportToWkt( 8 ) ); + geometryElement.setAttribute( "value", geom->exportToWkt( getWMSPrecision( 8 ) ) ); geometryElement.setAttribute( "type", "derived" ); featureElement.appendChild( geometryElement ); } @@ -3020,3 +3020,25 @@ int QgsWMSServer::getImageQuality( ) const } return imageQuality; } + +int QgsWMSServer::getWMSPrecision( int defaultValue = 8) const +{ + // First taken from QGIS project + int WMSPrecision = mConfigParser->WMSPrecision(); + + // Then checks if a parameter is given, if so use it instead + if ( mParameters.contains( "WMS_PRECISION" ) ) + { + bool conversionSuccess; + int WMSPrecisionParameter; + WMSPrecisionParameter = mParameters[ "WMS_PRECISION" ].toInt( &conversionSuccess ); + if ( conversionSuccess ) + { + WMSPrecision = WMSPrecisionParameter; + } + } + if ( WMSPrecision == -1 ){ + WMSPrecision = defaultValue; + } + return WMSPrecision; +} diff --git a/src/mapserver/qgswmsserver.h b/src/mapserver/qgswmsserver.h index ade61c6aa37..cf0d5b5cd9f 100644 --- a/src/mapserver/qgswmsserver.h +++ b/src/mapserver/qgswmsserver.h @@ -258,6 +258,9 @@ class QgsWMSServer: public QgsOWSServer /** Return the image quality to use for getMap request */ int getImageQuality() const; + + /** Return precision to use for GetFeatureInfo request */ + int getWMSPrecision(int defaultValue ) const; }; #endif diff --git a/src/ui/qgsprojectpropertiesbase.ui b/src/ui/qgsprojectpropertiesbase.ui index ef9ec48d8fc..6c9aad13afc 100644 --- a/src/ui/qgsprojectpropertiesbase.ui +++ b/src/ui/qgsprojectpropertiesbase.ui @@ -42,7 +42,16 @@ QFrame::Raised - + + 0 + + + 0 + + + 0 + + 0 @@ -179,7 +188,16 @@ QFrame::Raised - + + 0 + + + 0 + + + 0 + + 0 @@ -191,11 +209,20 @@ - 1 + 4 - + + 0 + + + 0 + + + 0 + + 0 @@ -211,8 +238,8 @@ 0 0 - 683 - 779 + 637 + 696 @@ -609,7 +636,16 @@ QFrame::Raised - + + 0 + + + 0 + + + 0 + + 0 @@ -782,7 +818,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -798,8 +843,8 @@ 0 0 - 683 - 779 + 328 + 54 @@ -832,7 +877,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -848,8 +902,8 @@ 0 0 - 683 - 779 + 141 + 100 @@ -904,7 +958,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -920,8 +983,8 @@ 0 0 - 683 - 779 + 379 + 570 @@ -1320,7 +1383,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -1335,9 +1407,9 @@ 0 - 0 - 667 - 1570 + -330 + 671 + 1624 @@ -1368,15 +1440,11 @@ projowsserver - - - - Person - - - mWMSContactPerson - - + + + + + @@ -1388,21 +1456,8 @@ - - - - - - - Organization - - - mWMSContactOrganization - - - - - + + @@ -1411,8 +1466,18 @@ - - + + + + Person + + + mWMSContactPerson + + + + + @@ -1424,8 +1489,8 @@ - - + + @@ -1437,8 +1502,8 @@ - - + + @@ -1450,21 +1515,31 @@ + + + - - - - - + + - Fees + Keyword list - - + + + + + + + Organization + + + mWMSContactOrganization + + @@ -1473,13 +1548,10 @@ - - - - - + + - Keyword list + Fees @@ -1494,55 +1566,8 @@ projowsserver - - - - - CRS restrictions - - - true - - - false - - - false - - - true - - - - - - - :/images/themes/default/mActionSignPlus.png:/images/themes/default/mActionSignPlus.png - - - - - - - - - - Used - - - - - - - - :/images/themes/default/symbologyRemove.png:/images/themes/default/symbologyRemove.png - - - - - - - + + Exclude composers @@ -1601,7 +1626,7 @@ - + Exclude layers @@ -1660,68 +1685,7 @@ - - - - - - Advertised URL - - - - - - - - - - - - - - Width - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 6 - 20 - - - - - - - - - - - - - - Height - - - - - - - Maximums for GetMap request - - - - - - + Advertised extent @@ -1830,7 +1794,61 @@ - + + + + CRS restrictions + + + true + + + false + + + false + + + true + + + + + + + :/images/themes/default/mActionSignPlus.png:/images/themes/default/mActionSignPlus.png + + + + + + + + + + Used + + + + + + + + :/images/themes/default/symbologyRemove.png:/images/themes/default/symbologyRemove.png + + + + + + + + + + Use layer ids as names + + + + @@ -1857,19 +1875,97 @@ - + Add geometry to feature response - - - - Use layer ids as names - - + + + + + + Width + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 6 + 20 + + + + + + + + + + + + + + Height + + + + + + + Maximums for GetMap request + + + + + + + + + + + GetFeatureInfo geometry precision (decimal places) + + + + + + + 1 + + + 17 + + + 8 + + + + + + + + + + + Advertised URL + + + + + + + @@ -2042,7 +2138,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -2058,8 +2163,8 @@ 0 0 - 683 - 779 + 170 + 54 @@ -2095,7 +2200,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -2121,7 +2235,16 @@ QFrame::Raised - + + 0 + + + 0 + + + 0 + + 0 @@ -2221,7 +2344,6 @@ mButtonImportColors mButtonExportColors scrollArea_5 - mWmsUseLayerIDs buttonBox mWMSAccessConstraints mWMSKeywordList @@ -2229,8 +2351,6 @@ mComposerListWidget mAddWMSComposerButton mRemoveWMSComposerButton - mAddWktGeometryCheckBox - mLayerRestrictionsGroupBox mLayerRestrictionsListWidget mAddLayerRestrictionButton mRemoveLayerRestrictionButton