/usr/include/qgis/qgssymbol.h is in libqgis-dev 1.7.4+1.7.5~20120320-1.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | /***************************************************************************
qgssymbol.h - description
-------------------
begin : Sat Jun 22 2002
copyright : (C) 2002 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSSYMBOL_H
#define QGSSYMBOL_H
#include "qgis.h"
#include <QBrush>
#include <QPen>
#include <QImage>
class QDomNode;
class QDomDocument;
class QDomElement;
class QgsVectorLayer;
/**Encapsulates settings for drawing (QPen, QBrush, Point symbol) and classification
(lower value, upper value)*/
class CORE_EXPORT QgsSymbol
{
public:
/**Constructor*/
QgsSymbol( QGis::GeometryType t, QString lvalue = "", QString uvalue = "", QString label = "" );
/**Constructor*/
QgsSymbol( QGis::GeometryType t, QString lvalue, QString uvalue, QString label, QColor c );
QgsSymbol( const QgsSymbol& );
/**old constructors*/
QgsSymbol();
QgsSymbol( QColor c );
/**Sets the brush*/
virtual void setBrush( QBrush b );
/**Gets a reference to m_brush, Don't use the brush to change color/style */
virtual const QBrush& brush() const;
/**Set the color*/
virtual void setColor( QColor c );
/**Get the current color*/
virtual QColor color() const;
/**Get the fill color*/
virtual QColor fillColor() const;
/**Sets the fill color*/
virtual void setFillColor( QColor c );
/**Get the line width*/
virtual double lineWidth() const;
/**Sets the line width*/
virtual void setLineWidth( double w );
/**Sets the pen*/
virtual void setPen( QPen p );
/**Gets a reference to m_pen. Don't use the pen to change color/style */
virtual const QPen& pen() const;
/**Set the line (pen) style*/
virtual void setLineStyle( Qt::PenStyle s );
/**Set the fill (brush) style*/
virtual void setFillStyle( Qt::BrushStyle s );
/**Gets the path to the customs texture image*/
virtual QString customTexture() const;
/**Sets the path to the custom texture, and sets the brush to use TexturePattern */
virtual void setCustomTexture( QString path );
virtual void setLowerValue( QString value );
virtual QString lowerValue() const;
virtual void setUpperValue( QString value );
virtual QString upperValue() const;
virtual void setLabel( QString label );
virtual QString label() const;
/**Set point symbol from name*/
virtual void setNamedPointSymbol( QString name );
/**Get point symbol*/
virtual QString pointSymbolName() const;
/**Set point size*/
virtual void setPointSize( double s );
/**Get size*/
virtual double pointSize() const;
/**Set point size units*/
virtual void setPointSizeUnits( bool sizeInMapUnits );
/**get point size units*/
virtual bool pointSizeUnits() const;
//! Destructor
virtual ~QgsSymbol();
//! Get a little icon for the legend
virtual QImage getLineSymbolAsImage();
//! Get a little icon for the legend
virtual QImage getPolygonSymbolAsImage();
/** Get QImage representation of point symbol with current settings
*/
virtual QImage getCachedPointSymbolAsImage( double widthScale = 1.0,
bool selected = false,
QColor selectionColor = Qt::yellow,
double opacity = 1.0 );
/** Get QImage representation of point symbol with current settings
* and scaled (can be slow when scale != 1.0)
*/
virtual QImage getPointSymbolAsImage( double widthScale = 1.0,
bool selected = false,
QColor selectionColor = Qt::yellow,
double scale = 1.0,
double rotation = 0.0,
double rasterScaleFactor = 1.0,
double opacity = 1.0 );
/**Writes the contents of the symbol to a configuration file
@ return true in case of success*/
virtual bool writeXML( QDomNode & item, QDomDocument & document, const QgsVectorLayer *vl ) const;
/**Reads the contents of the symbol from a configuration file
@ return true in case of success*/
virtual bool readXML( QDomNode & symbol, const QgsVectorLayer *vl );
/**Returns if this symbol is point/ line or polygon*/
QGis::GeometryType type() const {return mType;}
/**Returns the number of the rotation classification field*/
int rotationClassificationField() const;
/**Sets the number of the rotation classicifation field
\param field the number of the field to classify for rotation*/
void setRotationClassificationField( int field );
/**Returns the number of the scale classification field*/
int scaleClassificationField() const;
/**Sets the number of the scale classicifation field
\param field the number of the field to classify for scale*/
void setScaleClassificationField( int field );
/**Returns the number of the symbol field*/
int symbolField() const;
/**Sets the number of the symbol field
\param field the number of the field to select the symbol*/
void setSymbolField( int field );
protected:
/**Lower value for classification*/
QString mLowerValue;
/**Upper value for classification*/
QString mUpperValue;
QString mLabel;
/**Vector type (point, line, polygon)*/
QGis::GeometryType mType;
QPen mPen;
QBrush mBrush;
QString mTextureFilePath;
/* Point symbol name */
QString mPointSymbolName;
/* size */
double mSize;
/* units of size */
bool mSizeInMapUnits;
/* TODO Because for printing we always need a symbol without oversampling but with line width scale,
* we keep also separate picture with line width scale */
//
//
// NOTE THE LOGIC OF THESE MEMBER VARS NEED TO BE REVISITED NOW THAT
// I HAVE REMOVED SVG OVERSAMPLING (NEEDED IN QT3 WITH POOR SVG SUPPORT)
// Tim Sutton 2006 XXX FIXME
//
//
/* Point symbol cache */
QImage mPointSymbolImage;
/* Point symbol cache */
QImage mPointSymbolImageSelected;
/* Current line width scale used by mPointSymbolVectorImage. Equals -1.0 if not set */
double mWidthScale;
/* Point symbol cache but with line width scale mWidthScale */
QImage mPointSymbolImage2;
QImage mPointSymbolImageSelected2;
/* The alpha channel of the symbol */
double mOpacity;
/* Create point symbol mPointSymbolImage/mPointSymbolImage cache */
void cache( QColor selectionColor );
/* Create point symbol mPointSymbolImage2 cache */
void cache2( double widthScale, QColor selectionColor, double opacity );
/* mPointSymbolImage/mPointSymbolImage cache updated */
bool mCacheUpToDate;
/* mPointSymbolImage2 cache updated */
bool mCacheUpToDate2;
/* Selection color used in cache */
QColor mSelectionColor;
QColor mSelectionColor2;
/**Index of the classification fields (it must be a numerical field index)*/
int mRotationClassificationField;
int mScaleClassificationField;
int mSymbolField;
private:
int readFieldName( QDomNode &synode, QString name, const QgsVectorLayer &vl );
void appendField( QDomElement &symbol, QDomDocument &document, const QgsVectorLayer &vl, QString name, int idx ) const;
void appendText( QDomElement &symbol, QDomDocument &document, QString name, QString value ) const;
};
inline void QgsSymbol::setBrush( QBrush b )
{
mBrush = b;
}
inline const QBrush& QgsSymbol::brush() const
{
return mBrush;
}
inline void QgsSymbol::setPen( QPen p )
{
mPen = p;
}
inline const QPen& QgsSymbol::pen() const
{
return mPen;
}
inline void QgsSymbol::setLowerValue( QString value )
{
mLowerValue = value;
}
inline QString QgsSymbol::lowerValue() const
{
return mLowerValue;
}
inline void QgsSymbol::setUpperValue( QString value )
{
mUpperValue = value;
}
inline QString QgsSymbol::upperValue() const
{
return mUpperValue;
}
inline void QgsSymbol::setLabel( QString label )
{
mLabel = label;
}
inline QString QgsSymbol::label() const
{
return mLabel;
}
#endif // QGSSYMBOL_H
|