/usr/include/qgis/qgssymbolv2.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 | #ifndef QGSSYMBOLV2_H
#define QGSSYMBOLV2_H
#include "qgis.h"
#include <QList>
#include <QMap>
class QColor;
class QImage;
class QPainter;
class QSize;
class QPointF;
class QPolygonF;
//class
class QgsSymbolLayerV2;
class QgsRenderContext;
typedef QMap<QString, QString> QgsStringMap;
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
class CORE_EXPORT QgsSymbolV2
{
public:
enum OutputUnit
{
MM,
MapUnit
};
enum SymbolType
{
Marker,
Line,
Fill
};
//! @note added in 1.5
enum RenderHint
{
DataDefinedSizeScale = 1,
DataDefinedRotation = 2
};
virtual ~QgsSymbolV2();
//! return new default symbol for specified geometry type
static QgsSymbolV2* defaultSymbol( QGis::GeometryType geomType );
SymbolType type() const { return mType; }
// symbol layers handling
QgsSymbolLayerV2* symbolLayer( int layer );
int symbolLayerCount() { return mLayers.count(); }
//! insert symbol layer to specified index
bool insertSymbolLayer( int index, QgsSymbolLayerV2* layer );
//! append symbol layer at the end of the list
bool appendSymbolLayer( QgsSymbolLayerV2* layer );
//! delete symbol layer at specified index
bool deleteSymbolLayer( int index );
//! remove symbol layer from the list and return pointer to it
QgsSymbolLayerV2* takeSymbolLayer( int index );
//! delete layer at specified index and set a new one
bool changeSymbolLayer( int index, QgsSymbolLayerV2* layer );
void startRender( QgsRenderContext& context );
void stopRender( QgsRenderContext& context );
void setColor( const QColor& color );
QColor color();
void drawPreviewIcon( QPainter* painter, QSize size );
QImage bigSymbolPreviewImage();
QString dump();
virtual QgsSymbolV2* clone() const = 0;
OutputUnit outputUnit() const { return mOutputUnit; }
void setOutputUnit( OutputUnit u ) { mOutputUnit = u; }
//! Get alpha transparency 1 for opaque, 0 for invisible
qreal alpha() const { return mAlpha; }
//! Set alpha transparency 1 for opaque, 0 for invisible
void setAlpha( qreal alpha ) { mAlpha = alpha; }
//! @note added in 1.5
void setRenderHints( int hints ) { mRenderHints = hints; }
//! @note added in 1.5
int renderHints() { return mRenderHints; }
protected:
QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers ); // can't be instantiated
QgsSymbolLayerV2List cloneLayers() const;
//! check whether a symbol layer type can be used within the symbol
//! (marker-marker, line-line, fill-fill/line)
//! @note added in 1.7
bool isSymbolLayerCompatible( SymbolType t );
SymbolType mType;
QgsSymbolLayerV2List mLayers;
OutputUnit mOutputUnit;
/**Symbol opacity (in the range 0 - 1)*/
qreal mAlpha;
int mRenderHints;
};
///////////////////////
class CORE_EXPORT QgsSymbolV2RenderContext
{
public:
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0, bool selected = false, int renderHints = 0 );
~QgsSymbolV2RenderContext();
QgsRenderContext& renderContext() { return mRenderContext; }
//void setRenderContext( QgsRenderContext& c ) { mRenderContext = c;}
QgsSymbolV2::OutputUnit outputUnit() const { return mOutputUnit; }
void setOutputUnit( QgsSymbolV2::OutputUnit u ) { mOutputUnit = u; }
//! Get alpha transparency 1 for opaque, 0 for invisible
qreal alpha() const { return mAlpha; }
//! Set alpha transparency 1 for opaque, 0 for invisible
void setAlpha( qreal alpha ) { mAlpha = alpha; }
bool selected() const { return mSelected; }
void setSelected( bool selected ) { mSelected = selected; }
//! @note added in 1.5
int renderHints() const { return mRenderHints; }
//! @note added in 1.5
void setRenderHints( int hints ) { mRenderHints = hints; }
// Color used for selections
static QColor selectionColor();
double outputLineWidth( double width ) const;
double outputPixelSize( double size ) const;
// workaround for sip 4.7. Don't use assignment - will fail with assertion error
QgsSymbolV2RenderContext& operator=( const QgsSymbolV2RenderContext& );
private:
QgsRenderContext& mRenderContext;
QgsSymbolV2::OutputUnit mOutputUnit;
qreal mAlpha;
bool mSelected;
int mRenderHints;
};
//////////////////////
class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
{
public:
/** Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
This is a convenience method for easier creation of marker symbols.
\note added in v1.7
*/
static QgsMarkerSymbolV2* createSimple( const QgsStringMap& properties );
QgsMarkerSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
void setAngle( double angle );
double angle();
void setSize( double size );
double size();
void renderPoint( const QPointF& point, QgsRenderContext& context, int layer = -1, bool selected = false );
virtual QgsSymbolV2* clone() const;
};
class CORE_EXPORT QgsLineSymbolV2 : public QgsSymbolV2
{
public:
/** Create a line symbol with one symbol layer: SimpleLine with specified properties.
This is a convenience method for easier creation of line symbols.
\note added in v1.7
*/
static QgsLineSymbolV2* createSimple( const QgsStringMap& properties );
QgsLineSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
void setWidth( double width );
double width();
void renderPolyline( const QPolygonF& points, QgsRenderContext& context, int layer = -1, bool selected = false );
virtual QgsSymbolV2* clone() const;
};
class CORE_EXPORT QgsFillSymbolV2 : public QgsSymbolV2
{
public:
/** Create a fill symbol with one symbol layer: SimpleFill with specified properties.
This is a convenience method for easier creation of fill symbols.
\note added in v1.7
*/
static QgsFillSymbolV2* createSimple( const QgsStringMap& properties );
QgsFillSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() );
void setAngle( double angle );
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer = -1, bool selected = false );
virtual QgsSymbolV2* clone() const;
};
#endif
/*
QgsSymbolV2* ps = new QgsPointSymbol();
// ----
sl = QgsSymbolLayerV2Registry::instance()->createSymbolLayer("SimpleLine", { "color", "..." })
// (or)
sl = QgsSymbolLayerV2Registry::defaultSymbolLayer(QgsSymbolV2::Line)
// (or)
QgsSymbolLayerV2* sl = new QgsSimpleLineSymbolLayer(x,y,z);
QgsLineSymbol* s = new LineSymbol( [ sl ] );
// ----
rend = QgsSingleSymbolRenderer( new LineSymbol() );
*/
|