Skip to content
Permalink
Browse files

Fixed ui conflict and Fixed UI options

  • Loading branch information
elpaso authored and mhugent committed Aug 11, 2014
1 parent 324826e commit 6148bba07316f204a748d016bf7d5cb56b7a7070
@@ -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", "/",
@@ -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 )
@@ -99,6 +99,7 @@ class QgsSLDConfigParser : public QgsWMSConfigParser
double maxWidth() const;
double maxHeight() const;
double imageQuality() const;
int WMSPrecision() const;

//printing

@@ -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*/
@@ -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<const QgsComposerHtml *>& htmlList ) const
{
//Create composition from xml
@@ -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<const QgsComposerHtml *>& htmlFrameList ) const;
@@ -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;
}
@@ -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

0 comments on commit 6148bba

Please sign in to comment.
You can’t perform that action at this time.