mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Server: set selection color prior to each render
This commit is contained in:
parent
67d432c7bd
commit
d24c53c272
@ -33,6 +33,7 @@ QgsConfigParser::QgsConfigParser()
|
||||
, mOutputUnits( QgsMapRenderer::Millimeters )
|
||||
{
|
||||
setDefaultLegendSettings();
|
||||
mSelectionColor = QColor( 255, 255, 0 ); //yellow opaque is default selection color
|
||||
}
|
||||
|
||||
QgsConfigParser::~QgsConfigParser()
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define QGSCONFIGPARSER_H
|
||||
|
||||
#include "qgsmaprenderer.h"
|
||||
#include <QColor>
|
||||
#include <QDomDocument>
|
||||
#include <QFont>
|
||||
#include <QList>
|
||||
@ -113,6 +114,9 @@ class QgsConfigParser
|
||||
/**Appends service metadata to the capabilities document*/
|
||||
virtual void serviceCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
|
||||
|
||||
QColor selectionColor() const { return mSelectionColor; }
|
||||
void setSelectionColor( const QColor& c ) { mSelectionColor = c; }
|
||||
|
||||
protected:
|
||||
/**Parser to forward not resolved requests (e.g. SLD parser based on user request might have a fallback parser with admin configuration)*/
|
||||
QgsConfigParser* mFallbackParser;
|
||||
@ -150,6 +154,8 @@ class QgsConfigParser
|
||||
double mLegendSymbolWidth;
|
||||
double mLegendSymbolHeight;
|
||||
|
||||
QColor mSelectionColor;
|
||||
|
||||
/**Transforms layer extent to epsg 4326 and appends ExGeographicBoundingBox and BoundingBox elements to the layer element*/
|
||||
void appendLayerBoundingBoxes( QDomElement& layerElem, QDomDocument& doc, const QgsRectangle& layerExtent, const QgsCoordinateReferenceSystem& layerCRS ) const;
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ void QgsProjectParser::setSelectionColor()
|
||||
}
|
||||
}
|
||||
|
||||
QgsRenderer::setSelectionColor( QColor( red, green, blue, alpha ) );
|
||||
mSelectionColor = QColor( red, green, blue, alpha );
|
||||
}
|
||||
|
||||
const QgsCoordinateReferenceSystem& QgsProjectParser::projectCRS() const
|
||||
|
@ -154,14 +154,14 @@ class QgsProjectParser: public QgsConfigParser
|
||||
/**Converts a (possibly relative) path to absolute*/
|
||||
QString convertToAbsolutePath( const QString& file ) const;
|
||||
|
||||
/**Sets global selection color from the project or yellow if not defined in project*/
|
||||
void setSelectionColor();
|
||||
|
||||
/**Returns mapcanvas output CRS from project file*/
|
||||
const QgsCoordinateReferenceSystem& projectCRS() const;
|
||||
|
||||
/**Returns bbox of layer in project CRS (or empty rectangle in case of error)*/
|
||||
QgsRectangle layerBoundingBoxInProjectCRS( const QDomElement& layerElem ) const;
|
||||
|
||||
/**Reads selection color from project and sets it to QgsConfigParser::mSelectionColor*/
|
||||
void setSelectionColor();
|
||||
};
|
||||
|
||||
#endif // QGSPROJECTPARSER_H
|
||||
|
@ -966,6 +966,9 @@ QImage* QgsWMSServer::initializeRendering( QStringList& layersList, QStringList&
|
||||
QgsDebugMsg( QString( "Number of layers to be rendered. %1" ).arg( layerIdList.count() ) );
|
||||
#endif
|
||||
mMapRenderer->setLayerSet( layerIdList );
|
||||
|
||||
//set selection color prior to each render to avoid problems with caching (selection color is a global property of QgsRenderer)
|
||||
QgsRenderer::setSelectionColor( mConfigParser->selectionColor() );
|
||||
return theImage;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user