Subversion Repositories public

Rev

Rev 275 | Rev 278 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 275 Rev 276
Line 11... Line 11...
11
//
11
//
12
#ifndef _RENDER_H
12
#ifndef _RENDER_H
13
#define _RENDER_H
13
#define _RENDER_H
14
 
14
 
15
#include <mapnik/map.hpp>
15
#include <mapnik/map.hpp>
16
#include <mapnik/load_map.hpp>
-
 
17
#include <mapnik/save_map.hpp>
-
 
18
#include <mapnik/datasource_cache.hpp>
16
#include <mapnik/datasource_cache.hpp>
19
#include <mapnik/font_engine_freetype.hpp>
17
#include <mapnik/font_engine_freetype.hpp>
20
#include <mapnik/agg_renderer.hpp>
18
#include <mapnik/agg_renderer.hpp>
21
#include <mapnik/filter_factory.hpp>
19
#include <mapnik/filter_factory.hpp>
22
#include <mapnik/color_factory.hpp>
20
#include <mapnik/color_factory.hpp>
23
#include <mapnik/image_util.hpp>
21
#include <mapnik/image_util.hpp>
24
#include <mapnik/config_error.hpp>
22
#include <mapnik/config_error.hpp>
25
#include <mapnik/color.hpp>
23
#include <mapnik/load_map.hpp>
26
#include <mapnik/layer.hpp>
24
#include <mapnik/save_map.hpp>
27
#include <mapnik/rule.hpp>
-
 
28
 
25
 
29
/* conversions */
26
/* conversions */
30
 
27
 
31
#define DEGREES      180.0
28
#define DEGREES      180.0
32
#define SEMICIRCLES  0x80000000
29
#define SEMICIRCLES  0x80000000
Line 67... Line 64...
67
 
64
 
68
typedef struct TEXTSYMBOLIZER
65
typedef struct TEXTSYMBOLIZER
69
{
66
{
70
	QString   name;
67
	QString   name;
71
	QString   face_name;
68
	QString   face_name;
-
 
69
	QString   placement;
-
 
70
	QString   alignment;
72
	double    size;
71
	double    size;
73
	unsigned  fill;			// Color
72
	unsigned  fill;			// Color
74
	double    halo_radius;
73
	double    halo_radius;
75
	double    wrap_width;
74
	double    wrap_width;
76
	double    dx;
75
	double    dx;
Line 127... Line 126...
127
	LINEPATTERNSYMBOLIZER *next;
126
	LINEPATTERNSYMBOLIZER *next;
128
}LINEPATTERNSYMBOLIZER;
127
}LINEPATTERNSYMBOLIZER;
129
 
128
 
130
typedef struct RULE
129
typedef struct RULE
131
{
130
{
-
 
131
	QString   name;
-
 
132
	QString   title;
132
	double    maxscale;
133
	double    maxscale;
133
	double    minscale;
134
	double    minscale;
134
	QString   filter;
135
	QString   filter;
-
 
136
	bool      elsefilter;
135
	LINESYMBOLIZER		 *LineSymbolizer;
137
	LINESYMBOLIZER		 *LineSymbolizer;
136
	POLYGONSYMBOLIZER	 *PolygonSymbolizer;
138
	POLYGONSYMBOLIZER	 *PolygonSymbolizer;
137
	TEXTSYMBOLIZER		 *TextSymbolizer;
139
	TEXTSYMBOLIZER		 *TextSymbolizer;
138
	POINTSYMBOLIZER		 *PointSymbolizer;
140
	POINTSYMBOLIZER		 *PointSymbolizer;
139
	POLYGONPATTERNSYMBOLIZER *PolygonPatternSymbolizer;
141
	POLYGONPATTERNSYMBOLIZER *PolygonPatternSymbolizer;
Line 152... Line 154...
152
 
154
 
153
typedef struct
155
typedef struct
154
{
156
{
155
	QString   type;
157
	QString   type;
156
	QString   file;
158
	QString   file;
-
 
159
	QString   parser;
-
 
160
	QString   url;
-
 
161
	QString   bbox;
157
	QString   host;
162
	QString   host;
158
	QString   user;
163
	QString   user;
159
	QString   dbname;
164
	QString   dbname;
160
	QString   table;
165
	QString   table;
161
	bool      estimate_extent;
166
	bool      estimate_extent;
Line 166... Line 171...
166
}DATASOURCE;
171
}DATASOURCE;
167
 
172
 
168
typedef struct LAYER
173
typedef struct LAYER
169
{
174
{
170
	QString    name;	// The unique name
175
	QString    name;	// The unique name
-
 
176
	QString    title;	// The title of the layer (optional)
-
 
177
	QString    abstract;	// Some short description (optional)
171
	bool       status;	// Is it active?
178
	bool       status;	// Is it active?
-
 
179
	bool	   clear_label; // Clear label cache?
172
	QString    srs;		// Projection
180
	QString    srs;		// Projection
173
	double     minzoom;
181
	double     minzoom;
174
	double     maxzoom;
182
	double     maxzoom;
-
 
183
	bool       queryable;
175
	QStringList Styles;	// The names of the Styles
184
	QStringList Styles;	// The names of the Styles
176
	DATASOURCE Datasource;
185
	DATASOURCE Datasource;
177
	LAYER      *next;	// Pointer to next layer
186
	LAYER      *next;	// Pointer to next layer
178
}LAYER;
187
}LAYER;
179
 
188
 
Line 199... Line 208...
199
	host		 = 110,
208
	host		 = 110,
200
	user		 = 111,
209
	user		 = 111,
201
	dbname		 = 112,
210
	dbname		 = 112,
202
	table		 = 113,
211
	table		 = 113,
203
	estimate_extent  = 114,
212
	estimate_extent  = 114,
204
	extent		 = 115
213
	extent		 = 115,
-
 
214
	parser__	 = 116,
-
 
215
	url		 = 117,
-
 
216
	bbox		 = 118
205
}NAMES;
217
}NAMES;
206
 
218
 
207
typedef enum {
219
typedef enum {
208
	in_root			= 0,
220
	in_root			= 0,
209
	in_map			= 100,
221
	in_map			= 100,
Line 216... Line 228...
216
	in_polygonpatternsymbolizer = 107,
228
	in_polygonpatternsymbolizer = 107,
217
	in_layer		= 108,
229
	in_layer		= 108,
218
	in_datasource		= 109,
230
	in_datasource		= 109,
219
	in_symbolizer		= 110,
231
	in_symbolizer		= 110,
220
	in_shieldsymbolizer	= 111,
232
	in_shieldsymbolizer	= 111,
221
	in_linepatternsymbolizer = 112
233
	in_linepatternsymbolizer = 112,
-
 
234
	in_elsefilter		= 113
222
}CONTAINER;
235
}CONTAINER;
223
 
236
 
224
typedef struct
237
typedef struct
225
{
238
{
226
	int id;
239
	int id;
Line 231... Line 244...
231
using namespace mapnik;
244
using namespace mapnik;
232
 
245
 
233
class SRender : public QXmlDefaultHandler
246
class SRender : public QXmlDefaultHandler
234
{
247
{
235
	public:
248
	public:
-
 
249
	   enum map_type
-
 
250
	   {
-
 
251
	      MAP_SHAPE,
-
 
252
	      MAP_GIS,
-
 
253
	      MAP_OSM,
-
 
254
	      map_type_MAX
-
 
255
	   };
-
 
256
 
-
 
257
	public:
236
	   SRender();
258
	   SRender();
237
	   ~SRender();
259
	   ~SRender();
238
 
260
 
239
	   void setDrawArea(const QLabel &lb) { label = (QLabel *)&lb; };
261
	   void setDrawArea(const QLabel &lb) { label = (QLabel *)&lb; };
240
	   void setShapePath(const QString &str) { if (str.isNull()) return; shapePath = str; };
262
	   void setShapePath(const QString &str) { if (str.isNull()) return; shapePath = str; };
241
	   void setXmlPath(const QString &path) { if (path.isNull()) return; XmlPath = path; };
263
	   void setXmlPath(const QString &path) { if (path.isNull()) return; XmlPath = path; };
242
	   bool getMap(double lx, double ly, double rx, double ry);
264
	   bool getMap(double lx, double ly, double rx, double ry);
243
	   QString getOutBuf () { return OutBuf; };
265
	   QString getOutBuf () { return OutBuf; };
-
 
266
	   inline void setMapType(map_type mt) { __map_type = mt; }
-
 
267
	   inline map_type getMapType() { return __map_type; }
244
 
268
 
245
	   // Functions to parse the XML file
269
	   // Functions to parse the XML file
246
	   bool startDocument ();
270
	   bool startDocument ();
247
	   bool startElement (const QString&, const QString&, const QString& , const QXmlAttributes&);
271
	   bool startElement (const QString&, const QString&, const QString& , const QXmlAttributes&);
248
	   bool endElement (const QString&, const QString&, const QString&);
272
	   bool endElement (const QString&, const QString&, const QString&);
Line 284... Line 308...
284
	   QString shapePath;
308
	   QString shapePath;
285
	   QString pluginPath;
309
	   QString pluginPath;
286
	   QString fontPath;
310
	   QString fontPath;
287
	   QString XmlPath;
311
	   QString XmlPath;
288
	   QString OutBuf;
312
	   QString OutBuf;
-
 
313
	   map_type __map_type;
289
	   CONTAINER Container;
314
	   CONTAINER Container;
290
	   bool ControlSet;
315
	   bool ControlSet;
291
	   int Field;
316
	   int Field;
292
	   int XmlLine;	// Line number of the current position in XML file
317
	   int XmlLine;	// Line number of the current position in XML file
293
	   double _lx, _ly, _rx, _ry;
318
	   double _lx, _ly, _rx, _ry;