GDAL
ogr_featurestyle.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Project: OpenGIS Simple Features Reference Implementation
4 * Purpose: Define of Feature Representation
5 * Author: Stephane Villeneuve, stephane.v@videtron.ca
6 *
7 ******************************************************************************
8 * Copyright (c) 1999, Frank Warmerdam
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef OGR_FEATURESTYLE_INCLUDE
14#define OGR_FEATURESTYLE_INCLUDE
15
16#include "cpl_conv.h"
17#include "cpl_string.h"
18#include "ogr_core.h"
19
20class OGRFeature;
21
27
28/*
29 * All OGRStyleTool param lists are defined in ogr_core.h.
30 */
31
33typedef enum ogr_style_type
34{
35 OGRSTypeUnused = -1,
36 OGRSTypeString,
37 OGRSTypeDouble,
38 OGRSTypeInteger,
39 OGRSTypeBoolean
41
43typedef struct ogr_style_param
44{
45 int eParam;
46 const char *pszToken;
47 GBool bGeoref;
48 OGRSType eType;
49} OGRStyleParamId;
50
51typedef struct ogr_style_value
52{
53 char *pszValue;
54 double dfValue;
55 int nValue; // Used for both integer and boolean types
56 GBool bValid;
57 OGRSTUnitId eUnit;
58} OGRStyleValue;
59
61
62// Every time a pszStyleString given in parameter is NULL,
63// the StyleString defined in the Mgr will be use.
64
68class CPL_DLL OGRStyleTable
69{
70 private:
71 char **m_papszStyleTable = nullptr;
72
73 CPLString osLastRequestedStyleName{};
74 int iNextStyle = 0;
75
76 CPL_DISALLOW_COPY_ASSIGN(OGRStyleTable)
77
78 public:
79 OGRStyleTable();
80 ~OGRStyleTable();
81 GBool AddStyle(const char *pszName, const char *pszStyleString);
82 GBool RemoveStyle(const char *pszName);
83 GBool ModifyStyle(const char *pszName, const char *pszStyleString);
84
85 GBool SaveStyleTable(const char *pszFilename);
86 GBool LoadStyleTable(const char *pszFilename);
87 const char *Find(const char *pszStyleString);
88 GBool IsExist(const char *pszName);
89 const char *GetStyleName(const char *pszName);
90 void Print(FILE *fpOut);
91 void Clear();
92 OGRStyleTable *Clone();
94 const char *GetNextStyle();
95 const char *GetLastStyleName();
96};
97
98class OGRStyleTool;
99
103class CPL_DLL OGRStyleMgr
104{
105 private:
106 OGRStyleTable *m_poDataSetStyleTable = nullptr;
107 char *m_pszStyleString = nullptr;
108
110
111 public:
112 explicit OGRStyleMgr(OGRStyleTable *poDataSetStyleTable = nullptr);
113 ~OGRStyleMgr();
114
116 const char *pszStyleString = nullptr,
117 GBool bNoMatching = FALSE);
118 /* It will set in the given feature the pszStyleString with
119 the style or will set the style name found in
120 dataset StyleTable (if bNoMatching == FALSE). */
121
122 const char *InitFromFeature(OGRFeature *);
123 GBool InitStyleString(const char *pszStyleString = nullptr);
124
125 const char *GetStyleName(const char *pszStyleString = nullptr);
126 const char *GetStyleByName(const char *pszStyleName);
127
128 GBool AddStyle(const char *pszStyleName,
129 const char *pszStyleString = nullptr);
130
131 const char *GetStyleString(OGRFeature * = nullptr);
132
134 GBool AddPart(const char *);
135
136 int GetPartCount(const char *pszStyleString = nullptr);
137 OGRStyleTool *GetPart(int hPartId, const char *pszStyleString = nullptr);
138
139 /* It could have a reference counting process us for the OGRStyleTable, if
140 needed. */
142 OGRStyleTable *GetDataSetStyleTable()
143 {
144 return m_poDataSetStyleTable;
145 }
146
147 static OGRStyleTool *
148 CreateStyleToolFromStyleString(const char *pszStyleString);
150};
151
155class CPL_DLL OGRStyleTool
156{
157 private:
158 GBool m_bModified = false;
159 GBool m_bParsed = false;
160 double m_dfScale = 1.0;
161 OGRSTUnitId m_eUnit = OGRSTUMM;
162 OGRSTClassId m_eClassId = OGRSTCNone;
163 char *m_pszStyleString = nullptr;
164
165 virtual GBool Parse() = 0;
166
167 CPL_DISALLOW_COPY_ASSIGN(OGRStyleTool)
168
169 protected:
170#ifndef DOXYGEN_SKIP
171 GBool Parse(const OGRStyleParamId *pasStyle, OGRStyleValue *pasValue,
172 int nCount);
173#endif
174
175 public:
176 OGRStyleTool()
177 : m_bModified(FALSE), m_bParsed(FALSE), m_dfScale(0.0),
178 m_eUnit(OGRSTUGround), m_eClassId(OGRSTCNone),
179 m_pszStyleString(nullptr)
180 {
181 }
182
183 explicit OGRStyleTool(OGRSTClassId eClassId);
184 virtual ~OGRStyleTool();
185
186 static GBool GetRGBFromString(const char *pszColor, int &nRed, int &nGreen,
187 int &nBlue, int &nTransparence);
188 static int GetSpecificId(const char *pszId, const char *pszWanted);
189
190#ifndef DOXYGEN_SKIP
191 GBool IsStyleModified()
192 {
193 return m_bModified;
194 }
195
196 void StyleModified()
197 {
198 m_bModified = TRUE;
199 }
200
201 GBool IsStyleParsed()
202 {
203 return m_bParsed;
204 }
205
206 void StyleParsed()
207 {
208 m_bParsed = TRUE;
209 }
210#endif
211
213
214#ifndef DOXYGEN_SKIP
215 void SetInternalInputUnitFromParam(char *pszString);
216#endif
217
218 void SetUnit(OGRSTUnitId,
219 double dfScale = 1.0); // the dfScale will be
220 // used if we are working with Ground
221 // Unit ( ground = paper * scale);
222
224 {
225 return m_eUnit;
226 }
227
228 // There are two way to set the parameters in the Style, with generic
229 // methods (using a defined enumeration) or with the reel method specific
230 // for Each style tools.
231
232 virtual const char *GetStyleString() = 0;
233 void SetStyleString(const char *pszStyleString);
234 const char *GetStyleString(const OGRStyleParamId *pasStyleParam,
235 OGRStyleValue *pasStyleValue, int nSize);
236
237 const char *GetParamStr(const OGRStyleParamId &sStyleParam,
238 const OGRStyleValue &sStyleValue,
239 GBool &bValueIsNull);
240
241 int GetParamNum(const OGRStyleParamId &sStyleParam,
242 const OGRStyleValue &sStyleValue, GBool &bValueIsNull);
243
244 double GetParamDbl(const OGRStyleParamId &sStyleParam,
245 const OGRStyleValue &sStyleValue, GBool &bValueIsNull);
246
247 double GetRawParamDbl(const OGRStyleParamId &sStyleParam,
248 const OGRStyleValue &sStyleValue,
249 OGRSTUnitId &eRawUnit, GBool &bValueIsNull);
250
251 void SetParamStr(const OGRStyleParamId &sStyleParam,
252 OGRStyleValue &sStyleValue, const char *pszParamString);
253
254 void SetParamNum(const OGRStyleParamId &sStyleParam,
255 OGRStyleValue &sStyleValue, int nParam);
256
257 void SetParamDbl(const OGRStyleParamId &sStyleParam,
258 OGRStyleValue &sStyleValue, double dfParam);
259#ifndef DOXYGEN_SKIP
260 double ComputeWithUnit(double, OGRSTUnitId);
261 int ComputeWithUnit(int, OGRSTUnitId);
262#endif
263};
264
266
270class CPL_DLL OGRStylePen : public OGRStyleTool
271{
272 private:
273 OGRStyleValue *m_pasStyleValue;
274
275 GBool Parse() override;
276
277 CPL_DISALLOW_COPY_ASSIGN(OGRStylePen)
278
279 public:
280 OGRStylePen();
281 ~OGRStylePen() override;
282
283 /**********************************************************************/
284 /* Explicit fct for all parameters defined in the Drawing tools Pen */
285 /**********************************************************************/
286
287 const char *Color(GBool &bDefault)
288 {
289 return GetParamStr(OGRSTPenColor, bDefault);
290 }
291
292 void SetColor(const char *pszColor)
293 {
294 SetParamStr(OGRSTPenColor, pszColor);
295 }
296
297 double Width(GBool &bDefault)
298 {
299 return GetParamDbl(OGRSTPenWidth, bDefault);
300 }
301
302 double RawWidth(OGRSTUnitId &eRawUnit, GBool &bDefault)
303 {
304 return GetRawParamDbl(OGRSTPenWidth, eRawUnit, bDefault);
305 }
306
307 void SetWidth(double dfWidth)
308 {
309 SetParamDbl(OGRSTPenWidth, dfWidth);
310 }
311
312 const char *Pattern(GBool &bDefault)
313 {
314 return GetParamStr(OGRSTPenPattern, bDefault);
315 }
316
317 void SetPattern(const char *pszPattern)
318 {
319 SetParamStr(OGRSTPenPattern, pszPattern);
320 }
321
322 const char *Id(GBool &bDefault)
323 {
324 return GetParamStr(OGRSTPenId, bDefault);
325 }
326
327 void SetId(const char *pszId)
328 {
329 SetParamStr(OGRSTPenId, pszId);
330 }
331
332 double PerpendicularOffset(GBool &bDefault)
333 {
334 return GetParamDbl(OGRSTPenPerOffset, bDefault);
335 }
336
337 void SetPerpendicularOffset(double dfPerp)
338 {
339 SetParamDbl(OGRSTPenPerOffset, dfPerp);
340 }
341
342 const char *Cap(GBool &bDefault)
343 {
344 return GetParamStr(OGRSTPenCap, bDefault);
345 }
346
347 void SetCap(const char *pszCap)
348 {
349 SetParamStr(OGRSTPenCap, pszCap);
350 }
351
352 const char *Join(GBool &bDefault)
353 {
354 return GetParamStr(OGRSTPenJoin, bDefault);
355 }
356
357 void SetJoin(const char *pszJoin)
358 {
359 SetParamStr(OGRSTPenJoin, pszJoin);
360 }
361
362 int Priority(GBool &bDefault)
363 {
364 return GetParamNum(OGRSTPenPriority, bDefault);
365 }
366
367 void SetPriority(int nPriority)
368 {
369 SetParamNum(OGRSTPenPriority, nPriority);
370 }
371
372 /*****************************************************************/
373
374 const char *GetParamStr(OGRSTPenParam eParam, GBool &bValueIsNull);
375 int GetParamNum(OGRSTPenParam eParam, GBool &bValueIsNull);
376 double GetParamDbl(OGRSTPenParam eParam, GBool &bValueIsNull);
377 double GetRawParamDbl(OGRSTPenParam eParam, OGRSTUnitId &eRawUnit,
378 GBool &bValueIsNull);
379 void SetParamStr(OGRSTPenParam eParam, const char *pszParamString);
380 void SetParamNum(OGRSTPenParam eParam, int nParam);
381 void SetParamDbl(OGRSTPenParam eParam, double dfParam);
382 const char *GetStyleString() override;
383};
384
388class CPL_DLL OGRStyleBrush : public OGRStyleTool
389{
390 private:
391 OGRStyleValue *m_pasStyleValue;
392
393 GBool Parse() override;
394
395 CPL_DISALLOW_COPY_ASSIGN(OGRStyleBrush)
396
397 public:
398 OGRStyleBrush();
399 ~OGRStyleBrush() override;
400
401 /* Explicit fct for all parameters defined in the Drawing tools Brush */
402
403 const char *ForeColor(GBool &bDefault)
404 {
405 return GetParamStr(OGRSTBrushFColor, bDefault);
406 }
407
408 void SetForeColor(const char *pszColor)
409 {
410 SetParamStr(OGRSTBrushFColor, pszColor);
411 }
412
413 const char *BackColor(GBool &bDefault)
414 {
415 return GetParamStr(OGRSTBrushBColor, bDefault);
416 }
417
418 void SetBackColor(const char *pszColor)
419 {
420 SetParamStr(OGRSTBrushBColor, pszColor);
421 }
422
423 const char *Id(GBool &bDefault)
424 {
425 return GetParamStr(OGRSTBrushId, bDefault);
426 }
427
428 void SetId(const char *pszId)
429 {
430 SetParamStr(OGRSTBrushId, pszId);
431 }
432
433 double Angle(GBool &bDefault)
434 {
435 return GetParamDbl(OGRSTBrushAngle, bDefault);
436 }
437
438 void SetAngle(double dfAngle)
439 {
440 SetParamDbl(OGRSTBrushAngle, dfAngle);
441 }
442
443 double Size(GBool &bDefault)
444 {
445 return GetParamDbl(OGRSTBrushSize, bDefault);
446 }
447
448 void SetSize(double dfSize)
449 {
450 SetParamDbl(OGRSTBrushSize, dfSize);
451 }
452
453 double SpacingX(GBool &bDefault)
454 {
455 return GetParamDbl(OGRSTBrushDx, bDefault);
456 }
457
458 void SetSpacingX(double dfX)
459 {
460 SetParamDbl(OGRSTBrushDx, dfX);
461 }
462
463 double SpacingY(GBool &bDefault)
464 {
465 return GetParamDbl(OGRSTBrushDy, bDefault);
466 }
467
468 void SetSpacingY(double dfY)
469 {
470 SetParamDbl(OGRSTBrushDy, dfY);
471 }
472
473 int Priority(GBool &bDefault)
474 {
475 return GetParamNum(OGRSTBrushPriority, bDefault);
476 }
477
478 void SetPriority(int nPriority)
479 {
480 SetParamNum(OGRSTBrushPriority, nPriority);
481 }
482
483 /*****************************************************************/
484
485 const char *GetParamStr(OGRSTBrushParam eParam, GBool &bValueIsNull);
486 int GetParamNum(OGRSTBrushParam eParam, GBool &bValueIsNull);
487 double GetParamDbl(OGRSTBrushParam eParam, GBool &bValueIsNull);
488 void SetParamStr(OGRSTBrushParam eParam, const char *pszParamString);
489 void SetParamNum(OGRSTBrushParam eParam, int nParam);
490 void SetParamDbl(OGRSTBrushParam eParam, double dfParam);
491 const char *GetStyleString() override;
492};
493
497class CPL_DLL OGRStyleSymbol : public OGRStyleTool
498{
499 private:
500 OGRStyleValue *m_pasStyleValue;
501
502 GBool Parse() override;
503
504 CPL_DISALLOW_COPY_ASSIGN(OGRStyleSymbol)
505
506 public:
507 OGRStyleSymbol();
508 ~OGRStyleSymbol() override;
509
510 /*****************************************************************/
511 /* Explicit fct for all parameters defined in the Drawing tools */
512 /*****************************************************************/
513
514 const char *Id(GBool &bDefault)
515 {
516 return GetParamStr(OGRSTSymbolId, bDefault);
517 }
518
519 void SetId(const char *pszId)
520 {
521 SetParamStr(OGRSTSymbolId, pszId);
522 }
523
524 double Angle(GBool &bDefault)
525 {
526 return GetParamDbl(OGRSTSymbolAngle, bDefault);
527 }
528
529 void SetAngle(double dfAngle)
530 {
531 SetParamDbl(OGRSTSymbolAngle, dfAngle);
532 }
533
534 const char *Color(GBool &bDefault)
535 {
536 return GetParamStr(OGRSTSymbolColor, bDefault);
537 }
538
539 void SetColor(const char *pszColor)
540 {
541 SetParamStr(OGRSTSymbolColor, pszColor);
542 }
543
544 double Size(GBool &bDefault)
545 {
546 return GetParamDbl(OGRSTSymbolSize, bDefault);
547 }
548
549 void SetSize(double dfSize)
550 {
551 SetParamDbl(OGRSTSymbolSize, dfSize);
552 }
553
554 double SpacingX(GBool &bDefault)
555 {
556 return GetParamDbl(OGRSTSymbolDx, bDefault);
557 }
558
559 void SetSpacingX(double dfX)
560 {
561 SetParamDbl(OGRSTSymbolDx, dfX);
562 }
563
564 double SpacingY(GBool &bDefault)
565 {
566 return GetParamDbl(OGRSTSymbolDy, bDefault);
567 }
568
569 void SetSpacingY(double dfY)
570 {
571 SetParamDbl(OGRSTSymbolDy, dfY);
572 }
573
574 double Step(GBool &bDefault)
575 {
576 return GetParamDbl(OGRSTSymbolStep, bDefault);
577 }
578
579 void SetStep(double dfStep)
580 {
581 SetParamDbl(OGRSTSymbolStep, dfStep);
582 }
583
584 double Offset(GBool &bDefault)
585 {
586 return GetParamDbl(OGRSTSymbolOffset, bDefault);
587 }
588
589 void SetOffset(double dfOffset)
590 {
591 SetParamDbl(OGRSTSymbolOffset, dfOffset);
592 }
593
594 double Perp(GBool &bDefault)
595 {
596 return GetParamDbl(OGRSTSymbolPerp, bDefault);
597 }
598
599 void SetPerp(double dfPerp)
600 {
601 SetParamDbl(OGRSTSymbolPerp, dfPerp);
602 }
603
604 int Priority(GBool &bDefault)
605 {
606 return GetParamNum(OGRSTSymbolPriority, bDefault);
607 }
608
609 void SetPriority(int nPriority)
610 {
611 SetParamNum(OGRSTSymbolPriority, nPriority);
612 }
613
614 const char *FontName(GBool &bDefault)
615 {
616 return GetParamStr(OGRSTSymbolFontName, bDefault);
617 }
618
619 void SetFontName(const char *pszFontName)
620 {
621 SetParamStr(OGRSTSymbolFontName, pszFontName);
622 }
623
624 const char *OColor(GBool &bDefault)
625 {
626 return GetParamStr(OGRSTSymbolOColor, bDefault);
627 }
628
629 void SetOColor(const char *pszColor)
630 {
631 SetParamStr(OGRSTSymbolOColor, pszColor);
632 }
633
634 /*****************************************************************/
635
636 const char *GetParamStr(OGRSTSymbolParam eParam, GBool &bValueIsNull);
637 int GetParamNum(OGRSTSymbolParam eParam, GBool &bValueIsNull);
638 double GetParamDbl(OGRSTSymbolParam eParam, GBool &bValueIsNull);
639 void SetParamStr(OGRSTSymbolParam eParam, const char *pszParamString);
640 void SetParamNum(OGRSTSymbolParam eParam, int nParam);
641 void SetParamDbl(OGRSTSymbolParam eParam, double dfParam);
642 const char *GetStyleString() override;
643};
644
648class CPL_DLL OGRStyleLabel : public OGRStyleTool
649{
650 private:
651 OGRStyleValue *m_pasStyleValue;
652
653 GBool Parse() override;
654
655 CPL_DISALLOW_COPY_ASSIGN(OGRStyleLabel)
656
657 public:
658 OGRStyleLabel();
659 ~OGRStyleLabel() override;
660
661 /*****************************************************************/
662 /* Explicit fct for all parameters defined in the Drawing tools */
663 /*****************************************************************/
664
665 const char *FontName(GBool &bDefault)
666 {
667 return GetParamStr(OGRSTLabelFontName, bDefault);
668 }
669
670 void SetFontName(const char *pszFontName)
671 {
672 SetParamStr(OGRSTLabelFontName, pszFontName);
673 }
674
675 double Size(GBool &bDefault)
676 {
677 return GetParamDbl(OGRSTLabelSize, bDefault);
678 }
679
680 void SetSize(double dfSize)
681 {
682 SetParamDbl(OGRSTLabelSize, dfSize);
683 }
684
685 const char *TextString(GBool &bDefault)
686 {
687 return GetParamStr(OGRSTLabelTextString, bDefault);
688 }
689
690 void SetTextString(const char *pszTextString)
691 {
692 SetParamStr(OGRSTLabelTextString, pszTextString);
693 }
694
695 double Angle(GBool &bDefault)
696 {
697 return GetParamDbl(OGRSTLabelAngle, bDefault);
698 }
699
700 void SetAngle(double dfAngle)
701 {
702 SetParamDbl(OGRSTLabelAngle, dfAngle);
703 }
704
705 const char *ForeColor(GBool &bDefault)
706 {
707 return GetParamStr(OGRSTLabelFColor, bDefault);
708 }
709
710 void SetForColor(const char *pszForColor)
711 {
712 SetParamStr(OGRSTLabelFColor, pszForColor);
713 }
714
715 const char *BackColor(GBool &bDefault)
716 {
717 return GetParamStr(OGRSTLabelBColor, bDefault);
718 }
719
720 void SetBackColor(const char *pszBackColor)
721 {
722 SetParamStr(OGRSTLabelBColor, pszBackColor);
723 }
724
725 const char *Placement(GBool &bDefault)
726 {
727 return GetParamStr(OGRSTLabelPlacement, bDefault);
728 }
729
730 void SetPlacement(const char *pszPlacement)
731 {
732 SetParamStr(OGRSTLabelPlacement, pszPlacement);
733 }
734
735 int Anchor(GBool &bDefault)
736 {
737 return GetParamNum(OGRSTLabelAnchor, bDefault);
738 }
739
740 void SetAnchor(int nAnchor)
741 {
742 SetParamNum(OGRSTLabelAnchor, nAnchor);
743 }
744
745 double SpacingX(GBool &bDefault)
746 {
747 return GetParamDbl(OGRSTLabelDx, bDefault);
748 }
749
750 void SetSpacingX(double dfX)
751 {
752 SetParamDbl(OGRSTLabelDx, dfX);
753 }
754
755 double SpacingY(GBool &bDefault)
756 {
757 return GetParamDbl(OGRSTLabelDy, bDefault);
758 }
759
760 void SetSpacingY(double dfY)
761 {
762 SetParamDbl(OGRSTLabelDy, dfY);
763 }
764
765 double Perp(GBool &bDefault)
766 {
767 return GetParamDbl(OGRSTLabelPerp, bDefault);
768 }
769
770 void SetPerp(double dfPerp)
771 {
772 SetParamDbl(OGRSTLabelPerp, dfPerp);
773 }
774
775 GBool Bold(GBool &bDefault)
776 {
777 return GetParamNum(OGRSTLabelBold, bDefault);
778 }
779
780 void SetBold(GBool bBold)
781 {
782 SetParamNum(OGRSTLabelBold, bBold);
783 }
784
785 GBool Italic(GBool &bDefault)
786 {
787 return GetParamNum(OGRSTLabelItalic, bDefault);
788 }
789
790 void SetItalic(GBool bItalic)
791 {
792 SetParamNum(OGRSTLabelItalic, bItalic);
793 }
794
795 GBool Underline(GBool &bDefault)
796 {
797 return GetParamNum(OGRSTLabelUnderline, bDefault);
798 }
799
800 void SetUnderline(GBool bUnderline)
801 {
802 SetParamNum(OGRSTLabelUnderline, bUnderline);
803 }
804
805 int Priority(GBool &bDefault)
806 {
807 return GetParamNum(OGRSTLabelPriority, bDefault);
808 }
809
810 void SetPriority(int nPriority)
811 {
812 SetParamNum(OGRSTLabelPriority, nPriority);
813 }
814
815 GBool Strikeout(GBool &bDefault)
816 {
817 return GetParamNum(OGRSTLabelStrikeout, bDefault);
818 }
819
820 void SetStrikeout(GBool bStrikeout)
821 {
822 SetParamNum(OGRSTLabelStrikeout, bStrikeout);
823 }
824
825 double Stretch(GBool &bDefault)
826 {
827 return GetParamDbl(OGRSTLabelStretch, bDefault);
828 }
829
830 void SetStretch(double dfStretch)
831 {
832 SetParamDbl(OGRSTLabelStretch, dfStretch);
833 }
834
835 const char *ShadowColor(GBool &bDefault)
836 {
837 return GetParamStr(OGRSTLabelHColor, bDefault);
838 }
839
840 void SetShadowColor(const char *pszShadowColor)
841 {
842 SetParamStr(OGRSTLabelHColor, pszShadowColor);
843 }
844
845 const char *OutlineColor(GBool &bDefault)
846 {
847 return GetParamStr(OGRSTLabelOColor, bDefault);
848 }
849
850 void SetOutlineColor(const char *pszOutlineColor)
851 {
852 SetParamStr(OGRSTLabelOColor, pszOutlineColor);
853 }
854
855 /*****************************************************************/
856
857 const char *GetParamStr(OGRSTLabelParam eParam, GBool &bValueIsNull);
858 int GetParamNum(OGRSTLabelParam eParam, GBool &bValueIsNull);
859 double GetParamDbl(OGRSTLabelParam eParam, GBool &bValueIsNull);
860 void SetParamStr(OGRSTLabelParam eParam, const char *pszParamString);
861 void SetParamNum(OGRSTLabelParam eParam, int nParam);
862 void SetParamDbl(OGRSTLabelParam eParam, double dfParam);
863 const char *GetStyleString() override;
864};
865
867
868#endif /* OGR_FEATURESTYLE_INCLUDE */
Convenient string class based on std::string.
Definition cpl_string.h:320
A simple feature, including geometry and attributes.
Definition ogr_feature.h:934
GBool InitStyleString(const char *pszStyleString=nullptr)
Initialize style manager from the style string.
Definition ogrfeaturestyle.cpp:283
GBool AddPart(OGRStyleTool *)
Add a part (style tool) to the current style.
Definition ogrfeaturestyle.cpp:511
GBool SetFeatureStyleString(OGRFeature *, const char *pszStyleString=nullptr, GBool bNoMatching=FALSE)
Set a style in a feature.
Definition ogrfeaturestyle.cpp:188
OGRStyleTool * GetPart(int hPartId, const char *pszStyleString=nullptr)
Fetch a part (style tool) from the current style.
Definition ogrfeaturestyle.cpp:643
const char * GetStyleString(OGRFeature *=nullptr)
Get the style string from the style manager.
Definition ogrfeaturestyle.cpp:454
int GetPartCount(const char *pszStyleString=nullptr)
Get the number of parts in a style.
Definition ogrfeaturestyle.cpp:576
const char * GetStyleByName(const char *pszStyleName)
find a style in the current style table.
Definition ogrfeaturestyle.cpp:370
const char * GetStyleName(const char *pszStyleString=nullptr)
Get the name of a style from the style table.
Definition ogrfeaturestyle.cpp:342
const char * InitFromFeature(OGRFeature *)
Initialize style manager from the style string of a feature.
Definition ogrfeaturestyle.cpp:225
GBool AddStyle(const char *pszStyleName, const char *pszStyleString=nullptr)
Add a style to the current style table.
Definition ogrfeaturestyle.cpp:397
OGRStyleMgr(OGRStyleTable *poDataSetStyleTable=nullptr)
Constructor.
Definition ogrfeaturestyle.cpp:111
This class represents a style table.
Definition ogr_featurestyle.h:69
GBool LoadStyleTable(const char *pszFilename)
Load a style table from a file.
Definition ogrfeaturestyle.cpp:1023
OGRStyleTable * Clone()
Duplicate style table.
Definition ogrfeaturestyle.cpp:1182
void Clear()
Clear a style table.
Definition ogrfeaturestyle.cpp:778
const char * GetNextStyle()
Get the next style string from the table.
Definition ogrfeaturestyle.cpp:1234
GBool SaveStyleTable(const char *pszFilename)
Save a style table to a file.
Definition ogrfeaturestyle.cpp:973
GBool ModifyStyle(const char *pszName, const char *pszStyleString)
Modify a style in the table by its name If the style does not exist, it will be added.
Definition ogrfeaturestyle.cpp:948
const char * GetLastStyleName()
Get the style name of the last style string fetched with OGR_STBL_GetNextStyle.
Definition ogrfeaturestyle.cpp:1288
GBool RemoveStyle(const char *pszName)
Remove a style in the table by its name.
Definition ogrfeaturestyle.cpp:920
const char * Find(const char *pszStyleString)
Get a style string by name.
Definition ogrfeaturestyle.cpp:1074
void Print(FILE *fpOut)
Print a style table to a FILE pointer.
Definition ogrfeaturestyle.cpp:1125
GBool IsExist(const char *pszName)
Get the index of a style in the table by its name.
Definition ogrfeaturestyle.cpp:1150
void ResetStyleStringReading()
Reset the next style pointer to 0.
Definition ogrfeaturestyle.cpp:1197
const char * GetStyleName(const char *pszName)
Get style name by style string.
Definition ogrfeaturestyle.cpp:823
GBool AddStyle(const char *pszName, const char *pszStyleString)
Add a new style in the table.
Definition ogrfeaturestyle.cpp:864
This class represents a style tool.
Definition ogr_featurestyle.h:156
void SetParamStr(const OGRStyleParamId &sStyleParam, OGRStyleValue &sStyleValue, const char *pszParamString)
Undocumented.
Definition ogrfeaturestyle.cpp:2170
void SetStyleString(const char *pszStyleString)
Undocumented.
Definition ogrfeaturestyle.cpp:1390
double GetParamDbl(const OGRStyleParamId &sStyleParam, const OGRStyleValue &sStyleValue, GBool &bValueIsNull)
Undocumented.
Definition ogrfeaturestyle.cpp:2075
const char * GetParamStr(const OGRStyleParamId &sStyleParam, const OGRStyleValue &sStyleValue, GBool &bValueIsNull)
Undocumented.
Definition ogrfeaturestyle.cpp:2000
double GetRawParamDbl(const OGRStyleParamId &sStyleParam, const OGRStyleValue &sStyleValue, OGRSTUnitId &eRawUnit, GBool &bValueIsNull)
Return the raw value of a parameter of type double.
Definition ogrfeaturestyle.cpp:2130
OGRSTClassId GetType()
Determine type of Style Tool.
Definition ogrfeaturestyle.cpp:1596
OGRSTUnitId GetUnit()
Get Style Tool units.
Definition ogr_featurestyle.h:223
void SetParamDbl(const OGRStyleParamId &sStyleParam, OGRStyleValue &sStyleValue, double dfParam)
Undocumented.
Definition ogrfeaturestyle.cpp:2252
void SetParamNum(const OGRStyleParamId &sStyleParam, OGRStyleValue &sStyleValue, int nParam)
Undocumented.
Definition ogrfeaturestyle.cpp:2211
virtual const char * GetStyleString()=0
Get the style string for this Style Tool.
static int GetSpecificId(const char *pszId, const char *pszWanted)
Undocumented.
Definition ogrfeaturestyle.cpp:1561
void SetUnit(OGRSTUnitId, double dfScale=1.0)
Set Style Tool units.
Definition ogrfeaturestyle.cpp:1658
int GetParamNum(const OGRStyleParamId &sStyleParam, const OGRStyleValue &sStyleValue, GBool &bValueIsNull)
Undocumented.
Definition ogrfeaturestyle.cpp:2054
static GBool GetRGBFromString(const char *pszColor, int &nRed, int &nGreen, int &nBlue, int &nTransparence)
Return the r,g,b,a components of a color encoded in #RRGGBB[AA] format.
Definition ogrfeaturestyle.cpp:1524
Various convenience functions for CPL.
int GBool
Type for boolean values (alias to int).
Definition cpl_port.h:186
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition cpl_port.h:936
Various convenience functions for working with strings and string lists.
Core portability services for cross-platform OGR code.
@ OGRSTSymbolDy
Dy.
Definition ogr_core.h:1151
@ OGRSTSymbolId
Id.
Definition ogr_core.h:1146
@ OGRSTSymbolSize
Size.
Definition ogr_core.h:1149
@ OGRSTSymbolFontName
Font name.
Definition ogr_core.h:1156
@ OGRSTSymbolColor
Color.
Definition ogr_core.h:1148
@ OGRSTSymbolDx
Dx.
Definition ogr_core.h:1150
@ OGRSTSymbolPerp
Perpendicular.
Definition ogr_core.h:1153
@ OGRSTSymbolAngle
Angle.
Definition ogr_core.h:1147
@ OGRSTSymbolOColor
Outline color.
Definition ogr_core.h:1157
@ OGRSTSymbolPriority
Priority.
Definition ogr_core.h:1155
@ OGRSTSymbolStep
Step.
Definition ogr_core.h:1152
@ OGRSTSymbolOffset
Offset.
Definition ogr_core.h:1154
enum ogr_style_tool_param_symbol_id OGRSTSymbolParam
List of parameters for use with OGRStyleSymbol.
enum ogr_style_tool_param_pen_id OGRSTPenParam
List of parameters for use with OGRStylePen.
@ OGRSTLabelUnderline
Underline.
Definition ogr_core.h:1181
@ OGRSTLabelPriority
Priority.
Definition ogr_core.h:1182
@ OGRSTLabelBold
Bold.
Definition ogr_core.h:1179
@ OGRSTLabelStrikeout
Strike out.
Definition ogr_core.h:1183
@ OGRSTLabelBColor
Background color.
Definition ogr_core.h:1173
@ OGRSTLabelPlacement
Placement.
Definition ogr_core.h:1174
@ OGRSTLabelPerp
Perpendicular.
Definition ogr_core.h:1178
@ OGRSTLabelOColor
Outline color.
Definition ogr_core.h:1188
@ OGRSTLabelDx
Dx.
Definition ogr_core.h:1176
@ OGRSTLabelHColor
Highlight color.
Definition ogr_core.h:1187
@ OGRSTLabelItalic
Italic.
Definition ogr_core.h:1180
@ OGRSTLabelTextString
Text string.
Definition ogr_core.h:1170
@ OGRSTLabelSize
Size.
Definition ogr_core.h:1169
@ OGRSTLabelAngle
Angle.
Definition ogr_core.h:1171
@ OGRSTLabelFColor
Foreground color.
Definition ogr_core.h:1172
@ OGRSTLabelDy
Dy.
Definition ogr_core.h:1177
@ OGRSTLabelFontName
Font name.
Definition ogr_core.h:1168
@ OGRSTLabelStretch
Stretch.
Definition ogr_core.h:1184
@ OGRSTLabelAnchor
Anchor.
Definition ogr_core.h:1175
@ OGRSTUGround
Ground unit.
Definition ogr_core.h:1096
@ OGRSTUMM
Millimeter.
Definition ogr_core.h:1099
enum ogr_style_tool_class_id OGRSTClassId
OGRStyleTool derived class types (returned by GetType()).
enum ogr_style_tool_units_id OGRSTUnitId
List of units supported by OGRStyleTools.
enum ogr_style_tool_param_brush_id OGRSTBrushParam
List of parameters for use with OGRStyleBrush.
enum ogr_style_tool_param_label_id OGRSTLabelParam
List of parameters for use with OGRStyleLabel.
@ OGRSTBrushAngle
Angle.
Definition ogr_core.h:1130
@ OGRSTBrushId
Id.
Definition ogr_core.h:1129
@ OGRSTBrushPriority
Priority.
Definition ogr_core.h:1134
@ OGRSTBrushBColor
Background color.
Definition ogr_core.h:1128
@ OGRSTBrushSize
Size.
Definition ogr_core.h:1131
@ OGRSTBrushDy
Dy.
Definition ogr_core.h:1133
@ OGRSTBrushFColor
Foreground color.
Definition ogr_core.h:1127
@ OGRSTBrushDx
Dx.
Definition ogr_core.h:1132
@ OGRSTCNone
None.
Definition ogr_core.h:1083
@ OGRSTPenId
Id.
Definition ogr_core.h:1112
@ OGRSTPenCap
Cap.
Definition ogr_core.h:1114
@ OGRSTPenPerOffset
Perpendicular offset.
Definition ogr_core.h:1113
@ OGRSTPenWidth
Width.
Definition ogr_core.h:1110
@ OGRSTPenColor
Color.
Definition ogr_core.h:1109
@ OGRSTPenJoin
Join.
Definition ogr_core.h:1115
@ OGRSTPenPriority
Priority.
Definition ogr_core.h:1116
@ OGRSTPenPattern
Pattern.
Definition ogr_core.h:1111
ogr_style_type
OGR Style type.
Definition ogr_featurestyle.h:34
enum ogr_style_type OGRSType
OGR Style type.