/
qgswmsprojectparser.h
163 lines (118 loc) · 7.51 KB
/
qgswmsprojectparser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/***************************************************************************
qgswmsprojectparser.h
---------------------
begin : March 25, 2014
copyright : (C) 2014 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSWMSPROJECTPARSER_H
#define QGSWMSPROJECTPARSER_H
#include "qgswmsconfigparser.h"
#include "qgsserverprojectparser.h"
#include "qgslayertreegroup.h"
class QTextDocument;
class QSvgRenderer;
class QgsWMSProjectParser : public QgsWMSConfigParser
{
public:
QgsWMSProjectParser( const QString& filePath );
virtual ~QgsWMSProjectParser();
/**Adds layer and style specific capabilities elements to the parent node. This includes the individual layers and styles, their description, native CRS, bounding boxes, etc.
@param fullProjectInformation If true: add extended project information (does not validate against WMS schema)*/
void layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc, const QString& version, bool fullProjectSettings = false ) const;
QList<QgsMapLayer*> mapLayerFromStyle( const QString& lName, const QString& styleName, bool useCache = true ) const;
QString serviceUrl() const;
QStringList wfsLayerNames() const;
void owsGeneralAndResourceList( QDomElement& parentElement, QDomDocument& doc, const QString& strHref ) const;
//legend
double legendBoxSpace() const;
double legendLayerSpace() const;
double legendLayerTitleSpace() const;
double legendSymbolSpace() const;
double legendIconLabelSpace() const;
double legendSymbolWidth() const;
double legendSymbolHeight() const;
const QFont& legendLayerFont() const;
const QFont& legendItemFont() const;
double maxWidth() const;
double maxHeight() const;
double imageQuality() const;
int WMSPrecision() const;
//printing
QgsComposition* initComposition( const QString& composerTemplate, QgsMapRenderer* mapRenderer, QList< QgsComposerMap* >& mapList, QList< QgsComposerLegend* >& legendList, QList< QgsComposerLabel* >& labelList, QList<const QgsComposerHtml *>& htmlFrameList ) const;
void printCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
//todo: fixme
void setScaleDenominator( double ) {}
void addExternalGMLData( const QString&, QDomDocument* ) {}
QList< QPair< QString, QgsLayerCoordinateTransform > > layerCoordinateTransforms() const;
/**Fills a layer and a style list. The two list have the same number of entries and the style and the layer at a position belong together (similar to the HTTP parameters 'Layers' and 'Styles'. Returns 0 in case of success*/
int layersAndStyles( QStringList& layers, QStringList& styles ) const;
/**Returns the xml fragment of a style*/
QDomDocument getStyle( const QString& styleName, const QString& layerName ) const;
/**Returns the xml fragment of layers styles*/
QDomDocument getStyles( QStringList& layerList ) const;
/**Returns if output are MM or PIXEL*/
QgsMapRenderer::OutputUnits outputUnits() const;
/**True if the feature info response should contain the wkt geometry for vector features*/
bool featureInfoWithWktGeometry() const;
/**Returns map with layer aliases for GetFeatureInfo (or 0 pointer if not supported). Key: layer name, Value: layer alias*/
QHash<QString, QString> featureInfoLayerAliasMap() const;
QString featureInfoDocumentElement( const QString& defaultValue ) const;
QString featureInfoDocumentElementNS() const;
QString featureInfoSchema() const;
/**Return feature info in format SIA2045?*/
bool featureInfoFormatSIA2045() const;
/**Draw text annotation items from the QGIS projectfile*/
void drawOverlays( QPainter* p, int dpi, int width, int height ) const;
/**Load PAL engine settings from projectfile*/
void loadLabelSettings( QgsLabelingEngineInterface* lbl ) const;
int nLayers() const;
void serviceCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
bool useLayerIDs() const { return mProjectParser->useLayerIDs(); }
private:
QgsServerProjectParser* mProjectParser;
mutable QFont mLegendLayerFont;
mutable QFont mLegendItemFont;
/**Watermark text items*/
QList< QPair< QTextDocument*, QDomElement > > mTextAnnotationItems;
/**Watermark items (content cached in QgsSVGCache)*/
QList< QPair< QSvgRenderer*, QDomElement > > mSvgAnnotationElems;
/**Returns an ID-list of layers which are not queryable (comes from <properties> -> <Identify> -> <disabledLayers in the project file*/
virtual QStringList identifyDisabledLayers() const;
/**Reads layer drawing order from the legend section of the project file and appends it to the parent elemen (usually the <Capability> element)*/
void addDrawingOrder( QDomElement& parentElem, QDomDocument& doc ) const;
/**Adds drawing order info from layer element or group element (recursive)*/
void addDrawingOrder( QDomElement groupElem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const;
/**Adds drawing order info from embedded layer element or embedded group element (recursive)*/
void addDrawingOrderEmbeddedGroup( QDomElement groupElem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const;
void addLayers( QDomDocument &doc,
QDomElement &parentLayer,
const QDomElement &legendElem,
const QMap<QString, QgsMapLayer *> &layerMap,
const QStringList &nonIdentifiableLayers,
QString version, //1.1.1 or 1.3.0
bool fullProjectSettings = false ) const;
void addOWSLayers( QDomDocument &doc, QDomElement &parentElem, const QDomElement &legendElem,
const QMap<QString, QgsMapLayer *> &layerMap, const QStringList &nonIdentifiableLayers,
const QString& strHref, QgsRectangle& combinedBBox, QString strGroup ) const;
/**Adds layers from a legend group to list (could be embedded or a normal group)*/
void addLayersFromGroup( const QDomElement& legendGroupElem, QMap< int, QgsMapLayer*>& layers, bool useCache = true ) const;
QDomElement composerByName( const QString& composerName ) const;
QgsLayerTreeGroup* projectLayerTreeGroup() const;
static bool annotationPosition( const QDomElement& elem, double scaleFactor, double& xPos, double& yPos );
static void drawAnnotationRectangle( QPainter* p, const QDomElement& elem, double scaleFactor, double xPos, double yPos, int itemWidth, int itemHeight );
void createTextAnnotationItems();
void createSvgAnnotationItems();
void cleanupSvgAnnotationItems();
void cleanupTextAnnotationItems();
QString getCapaServiceUrl( QDomDocument& doc ) const;
};
#endif // QGSWMSPROJECTPARSER_H