Line data Source code
1 : /******************************************************************************
2 : * $Id$
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Define of Feature Representation
6 : * Author: Stephane Villeneuve, stephane.v@videtron.ca
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 1999, Frank Warmerdam
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #ifndef OGR_FEATURESTYLE_INCLUDE
31 : #define OGR_FEATURESTYLE_INCLUDE
32 :
33 : #include "cpl_conv.h"
34 : #include "cpl_string.h"
35 : #include "ogr_core.h"
36 :
37 : class OGRFeature;
38 :
39 : /**
40 : * \file ogr_featurestyle.h
41 : *
42 : * Simple feature style classes.
43 : */
44 :
45 : /*
46 : * All OGRStyleTool param lists are defined in ogr_core.h.
47 : */
48 :
49 : /** OGR Style type */
50 : typedef enum ogr_style_type
51 : {
52 : OGRSTypeUnused = -1,
53 : OGRSTypeString,
54 : OGRSTypeDouble,
55 : OGRSTypeInteger,
56 : OGRSTypeBoolean
57 : } OGRSType;
58 :
59 : //! @cond Doxygen_Suppress
60 : typedef struct ogr_style_param
61 : {
62 : int eParam;
63 : const char *pszToken;
64 : GBool bGeoref;
65 : OGRSType eType;
66 : } OGRStyleParamId;
67 :
68 : typedef struct ogr_style_value
69 : {
70 : char *pszValue;
71 : double dfValue;
72 : int nValue; // Used for both integer and boolean types
73 : GBool bValid;
74 : OGRSTUnitId eUnit;
75 : } OGRStyleValue;
76 :
77 : //! @endcond
78 :
79 : // Every time a pszStyleString given in parameter is NULL,
80 : // the StyleString defined in the Mgr will be use.
81 :
82 : /**
83 : * This class represents a style table
84 : */
85 : class CPL_DLL OGRStyleTable
86 : {
87 : private:
88 : char **m_papszStyleTable = nullptr;
89 :
90 : CPLString osLastRequestedStyleName{};
91 : int iNextStyle = 0;
92 :
93 : CPL_DISALLOW_COPY_ASSIGN(OGRStyleTable)
94 :
95 : public:
96 : OGRStyleTable();
97 : ~OGRStyleTable();
98 : GBool AddStyle(const char *pszName, const char *pszStyleString);
99 : GBool RemoveStyle(const char *pszName);
100 : GBool ModifyStyle(const char *pszName, const char *pszStyleString);
101 :
102 : GBool SaveStyleTable(const char *pszFilename);
103 : GBool LoadStyleTable(const char *pszFilename);
104 : const char *Find(const char *pszStyleString);
105 : GBool IsExist(const char *pszName);
106 : const char *GetStyleName(const char *pszName);
107 : void Print(FILE *fpOut);
108 : void Clear();
109 : OGRStyleTable *Clone();
110 : void ResetStyleStringReading();
111 : const char *GetNextStyle();
112 : const char *GetLastStyleName();
113 : };
114 :
115 : class OGRStyleTool;
116 :
117 : /**
118 : * This class represents a style manager
119 : */
120 : class CPL_DLL OGRStyleMgr
121 : {
122 : private:
123 : OGRStyleTable *m_poDataSetStyleTable = nullptr;
124 : char *m_pszStyleString = nullptr;
125 :
126 : CPL_DISALLOW_COPY_ASSIGN(OGRStyleMgr)
127 :
128 : public:
129 : explicit OGRStyleMgr(OGRStyleTable *poDataSetStyleTable = nullptr);
130 : ~OGRStyleMgr();
131 :
132 : GBool SetFeatureStyleString(OGRFeature *,
133 : const char *pszStyleString = nullptr,
134 : GBool bNoMatching = FALSE);
135 : /* It will set in the given feature the pszStyleString with
136 : the style or will set the style name found in
137 : dataset StyleTable (if bNoMatching == FALSE). */
138 :
139 : const char *InitFromFeature(OGRFeature *);
140 : GBool InitStyleString(const char *pszStyleString = nullptr);
141 :
142 : const char *GetStyleName(const char *pszStyleString = nullptr);
143 : const char *GetStyleByName(const char *pszStyleName);
144 :
145 : GBool AddStyle(const char *pszStyleName,
146 : const char *pszStyleString = nullptr);
147 :
148 : const char *GetStyleString(OGRFeature * = nullptr);
149 :
150 : GBool AddPart(OGRStyleTool *);
151 : GBool AddPart(const char *);
152 :
153 : int GetPartCount(const char *pszStyleString = nullptr);
154 : OGRStyleTool *GetPart(int hPartId, const char *pszStyleString = nullptr);
155 :
156 : /* It could have a reference counting process us for the OGRStyleTable, if
157 : needed. */
158 : //! @cond Doxygen_Suppress
159 : OGRStyleTable *GetDataSetStyleTable()
160 : {
161 : return m_poDataSetStyleTable;
162 : }
163 :
164 : static OGRStyleTool *
165 : CreateStyleToolFromStyleString(const char *pszStyleString);
166 : //! @endcond
167 : };
168 :
169 : /**
170 : * This class represents a style tool
171 : */
172 : class CPL_DLL OGRStyleTool
173 : {
174 : private:
175 : GBool m_bModified = false;
176 : GBool m_bParsed = false;
177 : double m_dfScale = 1.0;
178 : OGRSTUnitId m_eUnit = OGRSTUMM;
179 : OGRSTClassId m_eClassId = OGRSTCNone;
180 : char *m_pszStyleString = nullptr;
181 :
182 : virtual GBool Parse() = 0;
183 :
184 : CPL_DISALLOW_COPY_ASSIGN(OGRStyleTool)
185 :
186 : protected:
187 : #ifndef DOXYGEN_SKIP
188 : GBool Parse(const OGRStyleParamId *pasStyle, OGRStyleValue *pasValue,
189 : int nCount);
190 : #endif
191 :
192 : public:
193 : OGRStyleTool()
194 : : m_bModified(FALSE), m_bParsed(FALSE), m_dfScale(0.0),
195 : m_eUnit(OGRSTUGround), m_eClassId(OGRSTCNone),
196 : m_pszStyleString(nullptr)
197 : {
198 : }
199 :
200 : explicit OGRStyleTool(OGRSTClassId eClassId);
201 : virtual ~OGRStyleTool();
202 :
203 : static GBool GetRGBFromString(const char *pszColor, int &nRed, int &nGreen,
204 : int &nBlue, int &nTransparence);
205 : static int GetSpecificId(const char *pszId, const char *pszWanted);
206 :
207 : #ifndef DOXYGEN_SKIP
208 666 : GBool IsStyleModified()
209 : {
210 666 : return m_bModified;
211 : }
212 :
213 1571 : void StyleModified()
214 : {
215 1571 : m_bModified = TRUE;
216 1571 : }
217 :
218 2530 : GBool IsStyleParsed()
219 : {
220 2530 : return m_bParsed;
221 : }
222 :
223 573 : void StyleParsed()
224 : {
225 573 : m_bParsed = TRUE;
226 573 : }
227 : #endif
228 :
229 : OGRSTClassId GetType();
230 :
231 : #ifndef DOXYGEN_SKIP
232 : void SetInternalInputUnitFromParam(char *pszString);
233 : #endif
234 :
235 : void SetUnit(OGRSTUnitId,
236 : double dfScale = 1.0); // the dfScale will be
237 : // used if we are working with Ground
238 : // Unit ( ground = paper * scale);
239 :
240 1804 : OGRSTUnitId GetUnit()
241 : {
242 1804 : return m_eUnit;
243 : }
244 :
245 : // There are two way to set the parameters in the Style, with generic
246 : // methods (using a defined enumeration) or with the reel method specific
247 : // for Each style tools.
248 :
249 : virtual const char *GetStyleString() = 0;
250 : void SetStyleString(const char *pszStyleString);
251 : const char *GetStyleString(const OGRStyleParamId *pasStyleParam,
252 : OGRStyleValue *pasStyleValue, int nSize);
253 :
254 : const char *GetParamStr(const OGRStyleParamId &sStyleParam,
255 : const OGRStyleValue &sStyleValue,
256 : GBool &bValueIsNull);
257 :
258 : int GetParamNum(const OGRStyleParamId &sStyleParam,
259 : const OGRStyleValue &sStyleValue, GBool &bValueIsNull);
260 :
261 : double GetParamDbl(const OGRStyleParamId &sStyleParam,
262 : const OGRStyleValue &sStyleValue, GBool &bValueIsNull);
263 :
264 : void SetParamStr(const OGRStyleParamId &sStyleParam,
265 : OGRStyleValue &sStyleValue, const char *pszParamString);
266 :
267 : void SetParamNum(const OGRStyleParamId &sStyleParam,
268 : OGRStyleValue &sStyleValue, int nParam);
269 :
270 : void SetParamDbl(const OGRStyleParamId &sStyleParam,
271 : OGRStyleValue &sStyleValue, double dfParam);
272 : #ifndef DOXYGEN_SKIP
273 : double ComputeWithUnit(double, OGRSTUnitId);
274 : int ComputeWithUnit(int, OGRSTUnitId);
275 : #endif
276 : };
277 :
278 : //! @cond Doxygen_Suppress
279 :
280 : /**
281 : * This class represents a style pen
282 : */
283 : class CPL_DLL OGRStylePen : public OGRStyleTool
284 : {
285 : private:
286 : OGRStyleValue *m_pasStyleValue;
287 :
288 : GBool Parse() override;
289 :
290 : CPL_DISALLOW_COPY_ASSIGN(OGRStylePen)
291 :
292 : public:
293 : OGRStylePen();
294 : ~OGRStylePen() override;
295 :
296 : /**********************************************************************/
297 : /* Explicit fct for all parameters defined in the Drawing tools Pen */
298 : /**********************************************************************/
299 :
300 44 : const char *Color(GBool &bDefault)
301 : {
302 44 : return GetParamStr(OGRSTPenColor, bDefault);
303 : }
304 :
305 53 : void SetColor(const char *pszColor)
306 : {
307 53 : SetParamStr(OGRSTPenColor, pszColor);
308 53 : }
309 :
310 64 : double Width(GBool &bDefault)
311 : {
312 64 : return GetParamDbl(OGRSTPenWidth, bDefault);
313 : }
314 :
315 83 : void SetWidth(double dfWidth)
316 : {
317 83 : SetParamDbl(OGRSTPenWidth, dfWidth);
318 83 : }
319 :
320 6 : const char *Pattern(GBool &bDefault)
321 : {
322 6 : return GetParamStr(OGRSTPenPattern, bDefault);
323 : }
324 :
325 : void SetPattern(const char *pszPattern)
326 : {
327 : SetParamStr(OGRSTPenPattern, pszPattern);
328 : }
329 :
330 28 : const char *Id(GBool &bDefault)
331 : {
332 28 : return GetParamStr(OGRSTPenId, bDefault);
333 : }
334 :
335 : void SetId(const char *pszId)
336 : {
337 : SetParamStr(OGRSTPenId, pszId);
338 : }
339 :
340 : double PerpendicularOffset(GBool &bDefault)
341 : {
342 : return GetParamDbl(OGRSTPenPerOffset, bDefault);
343 : }
344 :
345 : void SetPerpendicularOffset(double dfPerp)
346 : {
347 : SetParamDbl(OGRSTPenPerOffset, dfPerp);
348 : }
349 :
350 : const char *Cap(GBool &bDefault)
351 : {
352 : return GetParamStr(OGRSTPenCap, bDefault);
353 : }
354 :
355 : void SetCap(const char *pszCap)
356 : {
357 : SetParamStr(OGRSTPenCap, pszCap);
358 : }
359 :
360 : const char *Join(GBool &bDefault)
361 : {
362 : return GetParamStr(OGRSTPenJoin, bDefault);
363 : }
364 :
365 : void SetJoin(const char *pszJoin)
366 : {
367 : SetParamStr(OGRSTPenJoin, pszJoin);
368 : }
369 :
370 : int Priority(GBool &bDefault)
371 : {
372 : return GetParamNum(OGRSTPenPriority, bDefault);
373 : }
374 :
375 : void SetPriority(int nPriority)
376 : {
377 : SetParamNum(OGRSTPenPriority, nPriority);
378 : }
379 :
380 : /*****************************************************************/
381 :
382 : const char *GetParamStr(OGRSTPenParam eParam, GBool &bValueIsNull);
383 : int GetParamNum(OGRSTPenParam eParam, GBool &bValueIsNull);
384 : double GetParamDbl(OGRSTPenParam eParam, GBool &bValueIsNull);
385 : void SetParamStr(OGRSTPenParam eParam, const char *pszParamString);
386 : void SetParamNum(OGRSTPenParam eParam, int nParam);
387 : void SetParamDbl(OGRSTPenParam eParam, double dfParam);
388 : const char *GetStyleString() override;
389 : };
390 :
391 : /**
392 : * This class represents a style brush
393 : */
394 : class CPL_DLL OGRStyleBrush : public OGRStyleTool
395 : {
396 : private:
397 : OGRStyleValue *m_pasStyleValue;
398 :
399 : GBool Parse() override;
400 :
401 : CPL_DISALLOW_COPY_ASSIGN(OGRStyleBrush)
402 :
403 : public:
404 : OGRStyleBrush();
405 : ~OGRStyleBrush() override;
406 :
407 : /* Explicit fct for all parameters defined in the Drawing tools Brush */
408 :
409 24 : const char *ForeColor(GBool &bDefault)
410 : {
411 24 : return GetParamStr(OGRSTBrushFColor, bDefault);
412 : }
413 :
414 83 : void SetForeColor(const char *pszColor)
415 : {
416 83 : SetParamStr(OGRSTBrushFColor, pszColor);
417 83 : }
418 :
419 17 : const char *BackColor(GBool &bDefault)
420 : {
421 17 : return GetParamStr(OGRSTBrushBColor, bDefault);
422 : }
423 :
424 : void SetBackColor(const char *pszColor)
425 : {
426 : SetParamStr(OGRSTBrushBColor, pszColor);
427 : }
428 :
429 17 : const char *Id(GBool &bDefault)
430 : {
431 17 : return GetParamStr(OGRSTBrushId, bDefault);
432 : }
433 :
434 : void SetId(const char *pszId)
435 : {
436 : SetParamStr(OGRSTBrushId, pszId);
437 : }
438 :
439 : double Angle(GBool &bDefault)
440 : {
441 : return GetParamDbl(OGRSTBrushAngle, bDefault);
442 : }
443 :
444 : void SetAngle(double dfAngle)
445 : {
446 : SetParamDbl(OGRSTBrushAngle, dfAngle);
447 : }
448 :
449 : double Size(GBool &bDefault)
450 : {
451 : return GetParamDbl(OGRSTBrushSize, bDefault);
452 : }
453 :
454 : void SetSize(double dfSize)
455 : {
456 : SetParamDbl(OGRSTBrushSize, dfSize);
457 : }
458 :
459 : double SpacingX(GBool &bDefault)
460 : {
461 : return GetParamDbl(OGRSTBrushDx, bDefault);
462 : }
463 :
464 : void SetSpacingX(double dfX)
465 : {
466 : SetParamDbl(OGRSTBrushDx, dfX);
467 : }
468 :
469 : double SpacingY(GBool &bDefault)
470 : {
471 : return GetParamDbl(OGRSTBrushDy, bDefault);
472 : }
473 :
474 : void SetSpacingY(double dfY)
475 : {
476 : SetParamDbl(OGRSTBrushDy, dfY);
477 : }
478 :
479 : int Priority(GBool &bDefault)
480 : {
481 : return GetParamNum(OGRSTBrushPriority, bDefault);
482 : }
483 :
484 : void SetPriority(int nPriority)
485 : {
486 : SetParamNum(OGRSTBrushPriority, nPriority);
487 : }
488 :
489 : /*****************************************************************/
490 :
491 : const char *GetParamStr(OGRSTBrushParam eParam, GBool &bValueIsNull);
492 : int GetParamNum(OGRSTBrushParam eParam, GBool &bValueIsNull);
493 : double GetParamDbl(OGRSTBrushParam eParam, GBool &bValueIsNull);
494 : void SetParamStr(OGRSTBrushParam eParam, const char *pszParamString);
495 : void SetParamNum(OGRSTBrushParam eParam, int nParam);
496 : void SetParamDbl(OGRSTBrushParam eParam, double dfParam);
497 : const char *GetStyleString() override;
498 : };
499 :
500 : /**
501 : * This class represents a style symbol
502 : */
503 : class CPL_DLL OGRStyleSymbol : public OGRStyleTool
504 : {
505 : private:
506 : OGRStyleValue *m_pasStyleValue;
507 :
508 : GBool Parse() override;
509 :
510 : CPL_DISALLOW_COPY_ASSIGN(OGRStyleSymbol)
511 :
512 : public:
513 : OGRStyleSymbol();
514 : ~OGRStyleSymbol() override;
515 :
516 : /*****************************************************************/
517 : /* Explicit fct for all parameters defined in the Drawing tools */
518 : /*****************************************************************/
519 :
520 228 : const char *Id(GBool &bDefault)
521 : {
522 228 : return GetParamStr(OGRSTSymbolId, bDefault);
523 : }
524 :
525 44 : void SetId(const char *pszId)
526 : {
527 44 : SetParamStr(OGRSTSymbolId, pszId);
528 44 : }
529 :
530 6 : double Angle(GBool &bDefault)
531 : {
532 6 : return GetParamDbl(OGRSTSymbolAngle, bDefault);
533 : }
534 :
535 3 : void SetAngle(double dfAngle)
536 : {
537 3 : SetParamDbl(OGRSTSymbolAngle, dfAngle);
538 3 : }
539 :
540 115 : const char *Color(GBool &bDefault)
541 : {
542 115 : return GetParamStr(OGRSTSymbolColor, bDefault);
543 : }
544 :
545 3 : void SetColor(const char *pszColor)
546 : {
547 3 : SetParamStr(OGRSTSymbolColor, pszColor);
548 3 : }
549 :
550 115 : double Size(GBool &bDefault)
551 : {
552 115 : return GetParamDbl(OGRSTSymbolSize, bDefault);
553 : }
554 :
555 3 : void SetSize(double dfSize)
556 : {
557 3 : SetParamDbl(OGRSTSymbolSize, dfSize);
558 3 : }
559 :
560 6 : double SpacingX(GBool &bDefault)
561 : {
562 6 : return GetParamDbl(OGRSTSymbolDx, bDefault);
563 : }
564 :
565 2 : void SetSpacingX(double dfX)
566 : {
567 2 : SetParamDbl(OGRSTSymbolDx, dfX);
568 2 : }
569 :
570 6 : double SpacingY(GBool &bDefault)
571 : {
572 6 : return GetParamDbl(OGRSTSymbolDy, bDefault);
573 : }
574 :
575 2 : void SetSpacingY(double dfY)
576 : {
577 2 : SetParamDbl(OGRSTSymbolDy, dfY);
578 2 : }
579 :
580 : double Step(GBool &bDefault)
581 : {
582 : return GetParamDbl(OGRSTSymbolStep, bDefault);
583 : }
584 :
585 : void SetStep(double dfStep)
586 : {
587 : SetParamDbl(OGRSTSymbolStep, dfStep);
588 : }
589 :
590 : double Offset(GBool &bDefault)
591 : {
592 : return GetParamDbl(OGRSTSymbolOffset, bDefault);
593 : }
594 :
595 : void SetOffset(double dfOffset)
596 : {
597 : SetParamDbl(OGRSTSymbolOffset, dfOffset);
598 : }
599 :
600 : double Perp(GBool &bDefault)
601 : {
602 : return GetParamDbl(OGRSTSymbolPerp, bDefault);
603 : }
604 :
605 : void SetPerp(double dfPerp)
606 : {
607 : SetParamDbl(OGRSTSymbolPerp, dfPerp);
608 : }
609 :
610 : int Priority(GBool &bDefault)
611 : {
612 : return GetParamNum(OGRSTSymbolPriority, bDefault);
613 : }
614 :
615 : void SetPriority(int nPriority)
616 : {
617 : SetParamNum(OGRSTSymbolPriority, nPriority);
618 : }
619 :
620 2 : const char *FontName(GBool &bDefault)
621 : {
622 2 : return GetParamStr(OGRSTSymbolFontName, bDefault);
623 : }
624 :
625 : void SetFontName(const char *pszFontName)
626 : {
627 : SetParamStr(OGRSTSymbolFontName, pszFontName);
628 : }
629 :
630 : const char *OColor(GBool &bDefault)
631 : {
632 : return GetParamStr(OGRSTSymbolOColor, bDefault);
633 : }
634 :
635 : void SetOColor(const char *pszColor)
636 : {
637 : SetParamStr(OGRSTSymbolOColor, pszColor);
638 : }
639 :
640 : /*****************************************************************/
641 :
642 : const char *GetParamStr(OGRSTSymbolParam eParam, GBool &bValueIsNull);
643 : int GetParamNum(OGRSTSymbolParam eParam, GBool &bValueIsNull);
644 : double GetParamDbl(OGRSTSymbolParam eParam, GBool &bValueIsNull);
645 : void SetParamStr(OGRSTSymbolParam eParam, const char *pszParamString);
646 : void SetParamNum(OGRSTSymbolParam eParam, int nParam);
647 : void SetParamDbl(OGRSTSymbolParam eParam, double dfParam);
648 : const char *GetStyleString() override;
649 : };
650 :
651 : /**
652 : * This class represents a style label
653 : */
654 : class CPL_DLL OGRStyleLabel : public OGRStyleTool
655 : {
656 : private:
657 : OGRStyleValue *m_pasStyleValue;
658 :
659 : GBool Parse() override;
660 :
661 : CPL_DISALLOW_COPY_ASSIGN(OGRStyleLabel)
662 :
663 : public:
664 : OGRStyleLabel();
665 : ~OGRStyleLabel() override;
666 :
667 : /*****************************************************************/
668 : /* Explicit fct for all parameters defined in the Drawing tools */
669 : /*****************************************************************/
670 :
671 6 : const char *FontName(GBool &bDefault)
672 : {
673 6 : return GetParamStr(OGRSTLabelFontName, bDefault);
674 : }
675 :
676 : void SetFontName(const char *pszFontName)
677 : {
678 : SetParamStr(OGRSTLabelFontName, pszFontName);
679 : }
680 :
681 6 : double Size(GBool &bDefault)
682 : {
683 6 : return GetParamDbl(OGRSTLabelSize, bDefault);
684 : }
685 :
686 : void SetSize(double dfSize)
687 : {
688 : SetParamDbl(OGRSTLabelSize, dfSize);
689 : }
690 :
691 10 : const char *TextString(GBool &bDefault)
692 : {
693 10 : return GetParamStr(OGRSTLabelTextString, bDefault);
694 : }
695 :
696 : void SetTextString(const char *pszTextString)
697 : {
698 : SetParamStr(OGRSTLabelTextString, pszTextString);
699 : }
700 :
701 9 : double Angle(GBool &bDefault)
702 : {
703 9 : return GetParamDbl(OGRSTLabelAngle, bDefault);
704 : }
705 :
706 : void SetAngle(double dfAngle)
707 : {
708 : SetParamDbl(OGRSTLabelAngle, dfAngle);
709 : }
710 :
711 9 : const char *ForeColor(GBool &bDefault)
712 : {
713 9 : return GetParamStr(OGRSTLabelFColor, bDefault);
714 : }
715 :
716 3 : void SetForColor(const char *pszForColor)
717 : {
718 3 : SetParamStr(OGRSTLabelFColor, pszForColor);
719 3 : }
720 :
721 4 : const char *BackColor(GBool &bDefault)
722 : {
723 4 : return GetParamStr(OGRSTLabelBColor, bDefault);
724 : }
725 :
726 : void SetBackColor(const char *pszBackColor)
727 : {
728 : SetParamStr(OGRSTLabelBColor, pszBackColor);
729 : }
730 :
731 : const char *Placement(GBool &bDefault)
732 : {
733 : return GetParamStr(OGRSTLabelPlacement, bDefault);
734 : }
735 :
736 : void SetPlacement(const char *pszPlacement)
737 : {
738 : SetParamStr(OGRSTLabelPlacement, pszPlacement);
739 : }
740 :
741 5 : int Anchor(GBool &bDefault)
742 : {
743 5 : return GetParamNum(OGRSTLabelAnchor, bDefault);
744 : }
745 :
746 : void SetAnchor(int nAnchor)
747 : {
748 : SetParamNum(OGRSTLabelAnchor, nAnchor);
749 : }
750 :
751 4 : double SpacingX(GBool &bDefault)
752 : {
753 4 : return GetParamDbl(OGRSTLabelDx, bDefault);
754 : }
755 :
756 : void SetSpacingX(double dfX)
757 : {
758 : SetParamDbl(OGRSTLabelDx, dfX);
759 : }
760 :
761 4 : double SpacingY(GBool &bDefault)
762 : {
763 4 : return GetParamDbl(OGRSTLabelDy, bDefault);
764 : }
765 :
766 : void SetSpacingY(double dfY)
767 : {
768 : SetParamDbl(OGRSTLabelDy, dfY);
769 : }
770 :
771 : double Perp(GBool &bDefault)
772 : {
773 : return GetParamDbl(OGRSTLabelPerp, bDefault);
774 : }
775 :
776 : void SetPerp(double dfPerp)
777 : {
778 : SetParamDbl(OGRSTLabelPerp, dfPerp);
779 : }
780 :
781 5 : GBool Bold(GBool &bDefault)
782 : {
783 5 : return GetParamNum(OGRSTLabelBold, bDefault);
784 : }
785 :
786 : void SetBold(GBool bBold)
787 : {
788 : SetParamNum(OGRSTLabelBold, bBold);
789 : }
790 :
791 5 : GBool Italic(GBool &bDefault)
792 : {
793 5 : return GetParamNum(OGRSTLabelItalic, bDefault);
794 : }
795 :
796 : void SetItalic(GBool bItalic)
797 : {
798 : SetParamNum(OGRSTLabelItalic, bItalic);
799 : }
800 :
801 4 : GBool Underline(GBool &bDefault)
802 : {
803 4 : return GetParamNum(OGRSTLabelUnderline, bDefault);
804 : }
805 :
806 : void SetUnderline(GBool bUnderline)
807 : {
808 : SetParamNum(OGRSTLabelUnderline, bUnderline);
809 : }
810 :
811 : int Priority(GBool &bDefault)
812 : {
813 : return GetParamNum(OGRSTLabelPriority, bDefault);
814 : }
815 :
816 : void SetPriority(int nPriority)
817 : {
818 : SetParamNum(OGRSTLabelPriority, nPriority);
819 : }
820 :
821 : GBool Strikeout(GBool &bDefault)
822 : {
823 : return GetParamNum(OGRSTLabelStrikeout, bDefault);
824 : }
825 :
826 : void SetStrikeout(GBool bStrikeout)
827 : {
828 : SetParamNum(OGRSTLabelStrikeout, bStrikeout);
829 : }
830 :
831 4 : double Stretch(GBool &bDefault)
832 : {
833 4 : return GetParamDbl(OGRSTLabelStretch, bDefault);
834 : }
835 :
836 3 : void SetStretch(double dfStretch)
837 : {
838 3 : SetParamDbl(OGRSTLabelStretch, dfStretch);
839 3 : }
840 :
841 : const char *ShadowColor(GBool &bDefault)
842 : {
843 : return GetParamStr(OGRSTLabelHColor, bDefault);
844 : }
845 :
846 : void SetShadowColor(const char *pszShadowColor)
847 : {
848 : SetParamStr(OGRSTLabelHColor, pszShadowColor);
849 : }
850 :
851 4 : const char *OutlineColor(GBool &bDefault)
852 : {
853 4 : return GetParamStr(OGRSTLabelOColor, bDefault);
854 : }
855 :
856 : void SetOutlineColor(const char *pszOutlineColor)
857 : {
858 : SetParamStr(OGRSTLabelOColor, pszOutlineColor);
859 : }
860 :
861 : /*****************************************************************/
862 :
863 : const char *GetParamStr(OGRSTLabelParam eParam, GBool &bValueIsNull);
864 : int GetParamNum(OGRSTLabelParam eParam, GBool &bValueIsNull);
865 : double GetParamDbl(OGRSTLabelParam eParam, GBool &bValueIsNull);
866 : void SetParamStr(OGRSTLabelParam eParam, const char *pszParamString);
867 : void SetParamNum(OGRSTLabelParam eParam, int nParam);
868 : void SetParamDbl(OGRSTLabelParam eParam, double dfParam);
869 : const char *GetStyleString() override;
870 : };
871 :
872 : //! @endcond
873 :
874 : #endif /* OGR_FEATURESTYLE_INCLUDE */
|