Skip to content
Permalink
Browse files

Add more parameters as enum

  • Loading branch information
pblottiere committed Jul 2, 2018
1 parent 683975c commit e2b69c375c537513ffd449d00e71014cd3ae29dd
@@ -393,6 +393,21 @@ namespace QgsWms
const QgsWmsParameter pFilterGeom( QgsWmsParameter::FILTER_GEOM );
save( pFilterGeom );

const QgsWmsParameter pPolygTol( QgsWmsParameter::FI_POLYGON_TOLERANCE,
QVariant::Double,
QVariant( 0.0 ) );
save( pPolygTol );

const QgsWmsParameter pLineTol( QgsWmsParameter::FI_LINE_TOLERANCE,
QVariant::Double,
QVariant( 0.0 ) );
save( pLineTol );

const QgsWmsParameter pPointTol( QgsWmsParameter::FI_POINT_TOLERANCE,
QVariant::Double,
QVariant( 0.0 ) );
save( pPointTol );

const QgsWmsParameter pSelection( QgsWmsParameter::SELECTION );
save( pSelection );

@@ -916,6 +931,36 @@ namespace QgsWms
return mWmsParameters[ QgsWmsParameter::ITEMFONTBOLD ].toString();
}

QString QgsWmsParameters::polygonTolerance() const
{
return mWmsParameters[ QgsWmsParameter::FI_POLYGON_TOLERANCE ].toString();
}

QString QgsWmsParameters::lineTolerance() const
{
return mWmsParameters[ QgsWmsParameter::FI_LINE_TOLERANCE ].toString();
}

QString QgsWmsParameters::pointTolerance() const
{
return mWmsParameters[ QgsWmsParameter::FI_POINT_TOLERANCE ].toString();
}

int QgsWmsParameters::polygonToleranceAsInt() const
{
return mWmsParameters[ QgsWmsParameter::FI_POLYGON_TOLERANCE ].toInt();
}

int QgsWmsParameters::lineToleranceAsInt() const
{
return mWmsParameters[ QgsWmsParameter::FI_LINE_TOLERANCE ].toInt();
}

int QgsWmsParameters::pointToleranceAsInt() const
{
return mWmsParameters[ QgsWmsParameter::FI_POINT_TOLERANCE ].toInt();
}

bool QgsWmsParameters::itemFontBoldAsBool() const
{
return mWmsParameters[ QgsWmsParameter::ITEMFONTBOLD ].toBool();
@@ -116,6 +116,9 @@ namespace QgsWms
SYMBOLWIDTH,
OPACITIES,
SLD,
FI_POLYGON_TOLERANCE,
FI_LINE_TOLERANCE,
FI_POINT_TOLERANCE,
FILTER,
FILTER_GEOM,
FORMAT,
@@ -346,6 +349,18 @@ namespace QgsWms
*/
QList<QgsWmsParametersLayer> layersParameters() const;

QString polygonTolerance() const;

QString lineTolerance() const;

QString pointTolerance() const;

int polygonToleranceAsInt() const;

int lineToleranceAsInt() const;

int pointToleranceAsInt() const;

/**
* Returns FORMAT parameter as a string.
* \returns FORMAT parameter as string
@@ -2307,10 +2307,9 @@ namespace QgsWms
double mapUnitTolerance = 0.0;
if ( ml->geometryType() == QgsWkbTypes::PolygonGeometry )
{
QMap<QString, QString>::const_iterator tolIt = mParameters.find( QStringLiteral( "FI_POLYGON_TOLERANCE" ) );
if ( tolIt != mParameters.constEnd() )
if ( ! mWmsParameters.polygonTolerance().isEmpty() )
{
mapUnitTolerance = tolIt.value().toInt() * rct.mapToPixel().mapUnitsPerPixel();
mapUnitTolerance = mWmsParameters.polygonToleranceAsInt() * rct.mapToPixel().mapUnitsPerPixel();
}
else
{
@@ -2319,10 +2318,9 @@ namespace QgsWms
}
else if ( ml->geometryType() == QgsWkbTypes::LineGeometry )
{
QMap<QString, QString>::const_iterator tolIt = mParameters.find( QStringLiteral( "FI_LINE_TOLERANCE" ) );
if ( tolIt != mParameters.constEnd() )
if ( ! mWmsParameters.lineTolerance().isEmpty() )
{
mapUnitTolerance = tolIt.value().toInt() * rct.mapToPixel().mapUnitsPerPixel();
mapUnitTolerance = mWmsParameters.lineToleranceAsInt() * rct.mapToPixel().mapUnitsPerPixel();
}
else
{
@@ -2331,10 +2329,9 @@ namespace QgsWms
}
else //points
{
QMap<QString, QString>::const_iterator tolIt = mParameters.find( QStringLiteral( "FI_POINT_TOLERANCE" ) );
if ( tolIt != mParameters.constEnd() )
if ( ! mWmsParameters.pointTolerance().isEmpty() )
{
mapUnitTolerance = tolIt.value().toInt() * rct.mapToPixel().mapUnitsPerPixel();
mapUnitTolerance = mWmsParameters.pointToleranceAsInt() * rct.mapToPixel().mapUnitsPerPixel();
}
else
{
@@ -292,7 +292,6 @@ namespace QgsWms

private:

QgsServerRequest::Parameters mParameters;
const QgsWmsParameters &mWmsParameters;

#ifdef HAVE_SERVER_PYTHON_PLUGINS

0 comments on commit e2b69c3

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