Rev 274 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
//
// C++ Interface: render
//
// Description: This defines the class for render.
//
//
// Author: Andreas Theofilu <andreas@theosys.at>, (C) 2009
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef _RENDER_H
#define _RENDER_H
#include <QLabel>
#include <QString>
#include <QPainter>
#include <QXmlReader>
#include <KStandardDirs>
typedef struct LINESYMBOLIZER
{
Color stroke;
double stroke_width;
short int stroke_linejoin;
short int stroke_linecap;
double stroke_dasharray[10];
double stroke_opacity;
LINESYMBOLIZER *next;
}LINESYMBOLIZER;
typedef struct POLYGONSYMBOLIZER
{
Color fill;
double fill_opacity;
POLYGONSYMBOLIZER *next;
}POLYGONSYMBOLIZER;
typedef struct TEXTSYMBOLIZER
{
QString name;
QString face_name;
double size;
Color fill;
double halo_radius;
double wrap_width;
double dy;
double mindistance;
double maxdistance;
TEXTSYMBOLIZER *next;
}TEXTSYMBOLIZER;
typedef struct POINTSYMBOLIZER
{
QString file;
int type; // enum TYPES
double width;
double height;
bool allow_overlap;
POINTSYMBOLIZER *next;
}POINTSYMBOLIZER;
typedef struct POLYGONPATTERNSYMBOLIZER
{
QString file;
int type; // enum TYPES
double width;
double height;
bool allow_overlap;
POLYGONPATTERNSYMBOLIZER *next;
}POLYGONPATTERNSYMBOLIZER;
typedef struct SHIELDSYMBOLIZER
{
QString name;
QString face_name;
double size;
Color fill;
QString placement;
QString file;
int type;
double width;
double height;
double mindistance;
double maxdistance;
SHIELDSYMBOLIZER *next;
}SHIELDSYMBOLIZER;
typedef struct LINEPATTERNSYMBOLIZER
{
QString file;
int type;
double width;
double height;
LINEPATTERNSYMBOLIZER *next;
}LINEPATTERNSYMBOLIZER;
typedef struct RULE
{
double maxscale;
double minscale;
QString filter;
LINESYMBOLIZER *LineSymbolizer;
POLYGONSYMBOLIZER *PolygonSymbolizer;
TEXTSYMBOLIZER *TextSymbolizer;
POINTSYMBOLIZER *PointSymbolizer;
POLYGONPATTERNSYMBOLIZER *PolygonPatternSymbolizer;
SHIELDSYMBOLIZER *ShieldSymbolizer;
LINEPATTERNSYMBOLIZER *LinePatternSymbolizer;
RULE *next; // Pointer to next rule
}RULE;
typedef struct STYLE
{
QString name;
RULE *rule; // Pointer to first rule node of the chain
STYLE *next; // Pointer to next style
}STYLE;
typedef struct
{
QString type;
QString file;
QString host;
QString user;
QString dbname;
QString table;
bool estimate_extend;
double ext_lx;
double ext_ly;
double ext_rx;
double ext_ry;
}DATASOURCE;
typedef struct LAYER
{
QString name;
bool status;
QString srs; // Projection
STYLE *Style; // Pointer to first style
DATASOURCE Datasource;
LAYER *next; // Pointer to next layer
}LAYER;
typedef struct
{
Color bgcolor;
int buffer_size;
QString srs;
}MAP;
typedef enum {
stroke = 100,
stroke_width = 101,
stroke_linejoin = 102,
stroke_linecap = 103,
stroke_opacity = 104,
stroke_dasharray = 105
}NAMES;
typedef enum {
type_png = 150,
type_gif = 151,
type_jpg = 152,
type_xpm = 153,
type_tif = 154,
type_bmp = 155
}TYPES;
typedef enum {
in_map = 100,
in_style = 101,
in_rule = 102,
in_linesymbolizer = 103,
in_pointsymbolizer = 104,
in_polygonsymbolizer = 105,
in_textsymbolizer = 106,
in_polygonpatternsymbolizer = 107,
in_layer = 108,
in_datasource = 109
}CONTAINER;
extern KEYS keys[]; // defined at >import.h<
class render
{
public:
render();
bool setDrawArea(QLabel *lb) { if (!lb) return false; label = *lb; return true; };
bool setShapePath(QString *str) { if (!str) return false; shapePath = *str; return true; };
bool getMap(double lx, double ly, double rx, double ry);
bool startDocument ();
bool startElement (const QString&, const QString&, const QString& , const QXmlAttributes&);
bool endElement (const QString&, const QString&, const QString&);
bool characters (const QString&);
protected:
void addRule (feature_type_style &fts, char *filter, double minscale, double maxscale, Color &polcol, Color &symcol, double symwidth, QString &pattern, int pw, int ph);
void addRulePoint (feature_type_style &fts, char *filter, double minscale, double maxscale, Color &polcol, Color &symcol, double symwidth, QString &pattern, int pw, int ph);
void addTextSymbolizer (char *name, char *font, int size, Color &col, int radius, int wrap, double dy);
private:
QString getKey (int pos);
RULE *getLastRule(RULE *first);
POINTSYMBOLIZER *getLastPointSymbolizer(POINTSYMBOLIZER *first);
private:
QLabel label;
QString shapePath;
QString XmlPath;
int indent;
CONTAINER Container;
TYPES Types;
NAMES Names;
MAP MapPars;
LAYER *Layer;
STYLE *Style, *firstStyle, *lastStyle;
RULE *Rule;
LINESYMBOLIZER *LineSymbolizer;
POLYGONSYMBOLIZER *PolygonSymbolizer;
TEXTSYMBOLIZER *TextSymbolizer;
POINTSYMBOLIZER *PointSymbolizer;
POLYGONPATTERNSYMBOLIZER *PolygonPatternSymbolizer;
SHIELDSYMBOLIZER *ShieldSymbolizer;
LINEPATTERNSYMBOLIZER *LinePatternSymbolizer;
};
#endif // _RENDER_H
Generated by GNU Enscript 1.6.5.90.