/
symbology-ng-core.sip
656 lines (432 loc) · 14.6 KB
/
symbology-ng-core.sip
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
typedef QList<QgsSymbolV2*> QgsSymbolV2List;
///////////////
/*
class QgsSymbolV2LevelItem
{
%TypeHeaderCode
#include <qgsrendererv2.h>
%End
public:
QgsSymbolV2LevelItem( QgsSymbolV2* symbol, int layer );
QgsSymbolV2* symbol();
int layer();
};
// every level has list of items: symbol + symbol layer num
typedef QList< QgsSymbolV2LevelItem > QgsSymbolV2Level;
// this is a list of levels
typedef QList< QgsSymbolV2Level > QgsSymbolV2LevelOrder;
*/
///////////////
class QgsFeatureRendererV2
{
%TypeHeaderCode
#include <qgsrendererv2.h>
%End
public:
enum RendererType
{
RendererSingleSymbol,
RendererCategorizedSymbol,
RendererGraduatedSymbol
// TODO: user type?
};
//! return a new renderer - used by default in vector layers
static QgsFeatureRendererV2* defaultRenderer(QGis::GeometryType geomType) /Factory/;
RendererType type() const;
virtual QgsSymbolV2* symbolForFeature(QgsFeature& feature)=0;
virtual void startRender(QgsRenderContext& context, const QMap<int, QgsField>& fields)=0;
virtual void stopRender(QgsRenderContext& context)=0;
virtual QList<QString> usedAttributes()=0;
virtual ~QgsFeatureRendererV2();
virtual QString dump();
virtual QgsFeatureRendererV2* clone()=0 /Factory/;
virtual QgsSymbolV2List symbols()=0;
void renderFeature(QgsFeature& feature, QgsRenderContext& context, int layer = -1);
bool usingSymbolLevels() const;
void setUsingSymbolLevels(bool usingSymbolLevels);
protected:
QgsFeatureRendererV2(RendererType type);
};
///////////////
class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2
{
%TypeHeaderCode
#include <qgssinglesymbolrendererv2.h>
%End
public:
QgsSingleSymbolRendererV2(QgsSymbolV2* symbol /Transfer/);
virtual ~QgsSingleSymbolRendererV2();
virtual QgsSymbolV2* symbolForFeature(QgsFeature& feature);
virtual void startRender(QgsRenderContext& context, const QMap<int, QgsField>& fields);
virtual void stopRender(QgsRenderContext& context);
virtual QList<QString> usedAttributes();
QgsSymbolV2* symbol() const;
void setSymbol(QgsSymbolV2* s /Transfer/);
virtual QString dump();
virtual QgsFeatureRendererV2* clone() /Factory/;
};
//////////
class QgsRendererCategoryV2
{
%TypeHeaderCode
#include <qgscategorizedsymbolrendererv2.h>
%End
public:
//! takes ownership of symbol
QgsRendererCategoryV2(QVariant value, QgsSymbolV2* symbol /Transfer/, QString label);
QgsRendererCategoryV2(const QgsRendererCategoryV2& cat);
~QgsRendererCategoryV2();
QVariant value() const;
QgsSymbolV2* symbol();
QString label() const;
void setSymbol(QgsSymbolV2* s /Transfer/);
void setLabel(QString label);
QString dump();
};
typedef QList<QgsRendererCategoryV2> QgsCategoryList;
class QgsCategorizedSymbolRendererV2 : QgsFeatureRendererV2
{
%TypeHeaderCode
#include <qgscategorizedsymbolrendererv2.h>
%End
public:
QgsCategorizedSymbolRendererV2(QString attrName = QString(), QgsCategoryList categories = QgsCategoryList());
virtual ~QgsCategorizedSymbolRendererV2();
virtual QgsSymbolV2* symbolForFeature(QgsFeature& feature);
virtual void startRender(QgsRenderContext& context, const QMap<int, QgsField>& fields);
virtual void stopRender(QgsRenderContext& context);
virtual QList<QString> usedAttributes();
virtual QString dump();
virtual QgsFeatureRendererV2* clone() /Factory/;
const QgsCategoryList& categories();
//! return index of category with specified value (-1 if not found)
int categoryIndexForValue(QVariant val);
bool updateCategorySymbol(int catIndex, QgsSymbolV2* symbol /Transfer/);
bool updateCategoryLabel(int catIndex, QString label);
bool deleteCategory(int catIndex);
void deleteAllCategories();
QString classAttribute() const;
void setClassAttribute(QString attr);
protected:
QgsSymbolV2* symbolForValue(QVariant value);
};
//////////
class QgsRendererRangeV2
{
%TypeHeaderCode
#include <qgsgraduatedsymbolrendererv2.h>
%End
public:
QgsRendererRangeV2(double lowerValue, double upperValue, QgsSymbolV2* symbol /Transfer/, QString label);
QgsRendererRangeV2(const QgsRendererRangeV2& range);
~QgsRendererRangeV2();
double lowerValue() const;
double upperValue() const;
QgsSymbolV2* symbol() const;
QString label() const;
void setSymbol(QgsSymbolV2* s /Transfer/);
void setLabel(QString label);
QString dump();
};
typedef QList<QgsRendererRangeV2> QgsRangeList;
class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
{
%TypeHeaderCode
#include <qgsgraduatedsymbolrendererv2.h>
%End
public:
QgsGraduatedSymbolRendererV2(QString attrNum = QString(), QgsRangeList ranges = QgsRangeList());
virtual ~QgsGraduatedSymbolRendererV2();
virtual QgsSymbolV2* symbolForFeature(QgsFeature& feature);
virtual void startRender(QgsRenderContext& context, const QMap<int, QgsField>& fields);
virtual void stopRender(QgsRenderContext& context);
virtual QList<QString> usedAttributes();
virtual QString dump();
virtual QgsFeatureRendererV2* clone() /Factory/;
QString classAttribute() const;
void setClassAttribute(QString attr);
const QgsRangeList& ranges();
bool updateRangeSymbol(int rangeIndex, QgsSymbolV2* symbol /Transfer/);
bool updateRangeLabel(int rangeIndex, QString label);
enum Mode
{
EqualInterval,
Quantile,
Custom
};
Mode mode() const;
void setMode(Mode mode);
static QgsGraduatedSymbolRendererV2* createRenderer(
QgsVectorLayer* vlayer,
QString attrName,
int classes,
Mode mode,
QgsSymbolV2* symbol,
QgsVectorColorRampV2* ramp);
protected:
QgsSymbolV2* symbolForValue(double value);
};
//////////
class QgsSymbolLayerV2
{
%TypeHeaderCode
#include <qgssymbollayerv2.h>
%End
%ConvertToSubClassCode
switch (sipCpp->type())
{
case QgsSymbolV2::Marker: sipClass = sipClass_QgsMarkerSymbolLayerV2; break;
case QgsSymbolV2::Line: sipClass = sipClass_QgsMarkerSymbolLayerV2; break;
case QgsSymbolV2::Fill: sipClass = sipClass_QgsMarkerSymbolLayerV2; break;
default: sipClass = 0; break;
}
%End
public:
virtual void setColor(const QColor& color);
virtual QColor color() const;
virtual ~QgsSymbolLayerV2();
virtual QString layerType() const = 0;
virtual void startRender(QgsRenderContext& context) = 0;
virtual void stopRender(QgsRenderContext& context) = 0;
virtual QgsSymbolLayerV2* clone() const = 0 /Factory/;
virtual QgsStringMap properties() const = 0;
virtual void drawPreviewIcon(QPainter* painter, QSize size) = 0;
virtual QgsSymbolV2* subSymbol();
virtual bool setSubSymbol(QgsSymbolV2* symbol /Transfer/);
QgsSymbolV2::SymbolType type() const;
void setLocked(bool locked);
bool isLocked() const;
// used only with rending with symbol levels is turned on (0 = first pass, 1 = second, ...)
void setRenderingPass(int renderingPass);
int renderingPass() const;
protected:
QgsSymbolLayerV2(QgsSymbolV2::SymbolType type, bool locked = false);
};
///////////////
class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
{
%TypeHeaderCode
#include <qgssymbollayerv2.h>
%End
public:
virtual void renderPoint(const QPointF& point, QgsRenderContext& context) = 0;
void drawPreviewIcon(QPainter* painter, QSize size);
void setAngle(double angle);
double angle() const;
void setSize(double size);
double size() const;
protected:
QgsMarkerSymbolLayerV2(bool locked = false);
};
class QgsLineSymbolLayerV2 : QgsSymbolLayerV2
{
%TypeHeaderCode
#include <qgssymbollayerv2.h>
%End
public:
virtual void renderPolyline(const QPolygonF& points, QgsRenderContext& context) = 0;
void setWidth(double width);
double width() const;
void drawPreviewIcon(QPainter* painter, QSize size);
protected:
QgsLineSymbolLayerV2(bool locked = false);
};
class QgsFillSymbolLayerV2 : QgsSymbolLayerV2
{
%TypeHeaderCode
#include <qgssymbollayerv2.h>
%End
public:
virtual void renderPolygon(const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context) = 0;
void drawPreviewIcon(QPainter* painter, QSize size);
protected:
QgsFillSymbolLayerV2(bool locked = false);
};
///////////////
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
class QgsSymbolV2
{
%TypeHeaderCode
#include <qgssymbolv2.h>
%End
%ConvertToSubClassCode
switch (sipCpp->type())
{
case QgsSymbolV2::Marker: sipClass = sipClass_QgsMarkerSymbolV2; break;
case QgsSymbolV2::Line: sipClass = sipClass_QgsMarkerSymbolV2; break;
case QgsSymbolV2::Fill: sipClass = sipClass_QgsMarkerSymbolV2; break;
default: sipClass = 0; break;
}
%End
public:
enum SymbolType
{
Marker,
Line,
Fill
};
virtual ~QgsSymbolV2();
//! return new default symbol for specified geometry type
static QgsSymbolV2* defaultSymbol(QGis::GeometryType geomType) /Factory/;
SymbolType type() const;
// symbol layers handling
QgsSymbolLayerV2* symbolLayer(int layer);
int symbolLayerCount();
//! insert symbol layer to specified index
bool insertSymbolLayer(int index, QgsSymbolLayerV2* layer /Transfer/);
//! append symbol layer at the end of the list
bool appendSymbolLayer(QgsSymbolLayerV2* layer /Transfer/);
//! 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) /TransferBack/;
//! delete layer at specified index and set a new one
bool changeSymbolLayer(int index, QgsSymbolLayerV2* layer /Transfer/);
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 /Factory/;
protected:
QgsSymbolV2(SymbolType type, QgsSymbolLayerV2List layers /Transfer/); // can't be instantiated
};
//////////
class QgsMarkerSymbolV2 : QgsSymbolV2
{
%TypeHeaderCode
#include <qgssymbolv2.h>
%End
public:
QgsMarkerSymbolV2(QgsSymbolLayerV2List layers /Transfer/ = QgsSymbolLayerV2List());
void setAngle(double angle);
double angle();
void setSize(double size);
double size();
void renderPoint(const QPointF& point, QgsRenderContext& context, int layer = -1);
virtual QgsSymbolV2* clone() const /Factory/;
};
class QgsLineSymbolV2 : QgsSymbolV2
{
%TypeHeaderCode
#include <qgssymbolv2.h>
%End
public:
QgsLineSymbolV2(QgsSymbolLayerV2List layers /Transfer/ = QgsSymbolLayerV2List());
void setWidth(double width);
double width();
void renderPolyline(const QPolygonF& points, QgsRenderContext& context, int layer = -1);
virtual QgsSymbolV2* clone() const /Factory/;
};
class QgsFillSymbolV2 : QgsSymbolV2
{
%TypeHeaderCode
#include <qgssymbolv2.h>
%End
public:
QgsFillSymbolV2(QgsSymbolLayerV2List layers /Transfer/ = QgsSymbolLayerV2List());
void renderPolygon(const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer = -1);
virtual QgsSymbolV2* clone() const /Factory/;
};
//////////
typedef QMap<QString, QString> QgsStringMap;
//////////
class QgsSymbolLayerV2Metadata
{
%TypeHeaderCode
#include <qgssymbollayerv2registry.h>
%End
public:
/** construct invalid metadata */
QgsSymbolLayerV2Metadata();
/** construct metadata */
// TODO
//QgsSymbolLayerV2Metadata(QString name, QgsSymbolV2::SymbolType type,
// QgsSymbolLayerV2CreateFunc pfCreate,
// QgsSymbolLayerV2WidgetFunc pfWidget);
QString name() const;
QgsSymbolV2::SymbolType type();
// TODO QgsSymbolLayerV2CreateFunc createFunction() const { return mCreateFunc; }
// TODO QgsSymbolLayerV2WidgetFunc widgetFunction() const { return mWidgetFunc; }
};
//////////
class QgsSymbolLayerV2Registry
{
%TypeHeaderCode
#include <qgssymbollayerv2registry.h>
%End
public:
//! return the single instance of this class (instantiate it if not exists)
static QgsSymbolLayerV2Registry* instance();
//! return metadata for specified symbol layer
QgsSymbolLayerV2Metadata symbolLayerMetadata(QString name) const;
//! register a new symbol layer type
void addSymbolLayerType(const QgsSymbolLayerV2Metadata& metadata);
//! create a new instance of symbol layer given symbol layer name and properties
QgsSymbolLayerV2* createSymbolLayer(QString name, const QgsStringMap& properties) const /Factory/;
//! return a list of available symbol layers for a specified symbol type
QStringList symbolLayersForType(QgsSymbolV2::SymbolType type);
//! create a new instance of symbol layer for specified symbol type with default settings
static QgsSymbolLayerV2* defaultSymbolLayer(QgsSymbolV2::SymbolType type) /Factory/;
protected:
QgsSymbolLayerV2Registry();
};
//////////
class QgsStyleV2
{
%TypeHeaderCode
#include <qgsstylev2.h>
%End
public:
QgsStyleV2();
~QgsStyleV2();
//! return default application-wide style
static QgsStyleV2* defaultStyle();
//! remove all contents of the style
void clear();
//! add symbol to style. takes symbol's ownership
bool addSymbol(QString name, QgsSymbolV2* symbol);
//! remove symbol from style (and delete it)
bool removeSymbol(QString name);
//! return a NEW copy of symbol
QgsSymbolV2* symbol(QString name);
//! return a const pointer to a symbol (doesn't create new instance)
const QgsSymbolV2* symbolRef(QString name) const;
//! return count of symbols in style
int symbolCount();
//! return a list of names of symbols
QStringList symbolNames();
//! add color ramp to style. takes ramp's ownership
bool addColorRamp(QString name, QgsVectorColorRampV2* colorRamp);
//! remove color ramp from style (and delete it)
bool removeColorRamp(QString name);
//! return a NEW copy of color ramp
QgsVectorColorRampV2* colorRamp(QString name);
//! return a const pointer to a symbol (doesn't create new instance)
const QgsVectorColorRampV2* colorRampRef(QString name) const;
//! return count of color ramps
int colorRampCount();
//! return a list of names of color ramps
QStringList colorRampNames();
//! load a file into the style
bool load(QString filename);
//! save style into a file
bool save(QString filename);
//! return last error from load/save operation
QString errorString();
};
//////////
class QgsVectorColorRampV2
{
%TypeHeaderCode
#include <qgsvectorcolorrampv2.h>
%End
public:
virtual ~QgsVectorColorRampV2();
virtual QColor color(double value) const = 0;
virtual QString type() const = 0;
virtual QgsVectorColorRampV2* clone() const = 0;
virtual QgsStringMap properties() const = 0;
};