Skip to content

Commit

Permalink
Fixed ui conflict and Fixed UI options
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and mhugent committed Aug 22, 2014
1 parent 324826e commit 6148bba
Show file tree
Hide file tree
Showing 9 changed files with 380 additions and 196 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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", "/",
Expand Down
9 changes: 9 additions & 0 deletions src/mapserver/qgssldconfigparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
1 change: 1 addition & 0 deletions src/mapserver/qgssldconfigparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class QgsSLDConfigParser : public QgsWMSConfigParser
double maxWidth() const;
double maxHeight() const;
double imageQuality() const;
int WMSPrecision() const;

//printing

Expand Down
3 changes: 3 additions & 0 deletions src/mapserver/qgswmsconfigparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
15 changes: 15 additions & 0 deletions src/mapserver/qgswmsprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/mapserver/qgswmsprojectparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
32 changes: 27 additions & 5 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand All @@ -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 );
}
Expand Down Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions src/mapserver/qgswmsserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 6148bba

Please sign in to comment.