/src/gdal/ogr/ogr_featurestyle.h
Line  | Count  | Source (jump to first uncovered line)  | 
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  |  |  | 
20  |  | class OGRFeature;  | 
21  |  |  | 
22  |  | /**  | 
23  |  |  * \file ogr_featurestyle.h  | 
24  |  |  *  | 
25  |  |  * Simple feature style classes.  | 
26  |  |  */  | 
27  |  |  | 
28  |  | /*  | 
29  |  |  * All OGRStyleTool param lists are defined in ogr_core.h.  | 
30  |  |  */  | 
31  |  |  | 
32  |  | /** OGR Style type */  | 
33  |  | typedef enum ogr_style_type  | 
34  |  | { | 
35  |  |     OGRSTypeUnused = -1,  | 
36  |  |     OGRSTypeString,  | 
37  |  |     OGRSTypeDouble,  | 
38  |  |     OGRSTypeInteger,  | 
39  |  |     OGRSTypeBoolean  | 
40  |  | } OGRSType;  | 
41  |  |  | 
42  |  | //! @cond Doxygen_Suppress  | 
43  |  | typedef struct ogr_style_param  | 
44  |  | { | 
45  |  |     int eParam;  | 
46  |  |     const char *pszToken;  | 
47  |  |     GBool bGeoref;  | 
48  |  |     OGRSType eType;  | 
49  |  | } OGRStyleParamId;  | 
50  |  |  | 
51  |  | typedef 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  |  |  | 
60  |  | //! @endcond  | 
61  |  |  | 
62  |  | // Every time a pszStyleString given in parameter is NULL,  | 
63  |  | // the StyleString defined in the Mgr will be use.  | 
64  |  |  | 
65  |  | /**  | 
66  |  |  * This class represents a style table  | 
67  |  |  */  | 
68  |  | class 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();  | 
93  |  |     void ResetStyleStringReading();  | 
94  |  |     const char *GetNextStyle();  | 
95  |  |     const char *GetLastStyleName();  | 
96  |  | };  | 
97  |  |  | 
98  |  | class OGRStyleTool;  | 
99  |  |  | 
100  |  | /**  | 
101  |  |  * This class represents a style manager  | 
102  |  |  */  | 
103  |  | class CPL_DLL OGRStyleMgr  | 
104  |  | { | 
105  |  |   private:  | 
106  |  |     OGRStyleTable *m_poDataSetStyleTable = nullptr;  | 
107  |  |     char *m_pszStyleString = nullptr;  | 
108  |  |  | 
109  |  |     CPL_DISALLOW_COPY_ASSIGN(OGRStyleMgr)  | 
110  |  |  | 
111  |  |   public:  | 
112  |  |     explicit OGRStyleMgr(OGRStyleTable *poDataSetStyleTable = nullptr);  | 
113  |  |     ~OGRStyleMgr();  | 
114  |  |  | 
115  |  |     GBool SetFeatureStyleString(OGRFeature *,  | 
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  |  |  | 
133  |  |     GBool AddPart(OGRStyleTool *);  | 
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. */  | 
141  |  |     //! @cond Doxygen_Suppress  | 
142  |  |     OGRStyleTable *GetDataSetStyleTable()  | 
143  | 0  |     { | 
144  | 0  |         return m_poDataSetStyleTable;  | 
145  | 0  |     }  | 
146  |  |  | 
147  |  |     static OGRStyleTool *  | 
148  |  |     CreateStyleToolFromStyleString(const char *pszStyleString);  | 
149  |  |     //! @endcond  | 
150  |  | };  | 
151  |  |  | 
152  |  | /**  | 
153  |  |  * This class represents a style tool  | 
154  |  |  */  | 
155  |  | class 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  | 0  |     { | 
181  | 0  |     }  | 
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  | 0  |     { | 
193  | 0  |         return m_bModified;  | 
194  | 0  |     }  | 
195  |  |  | 
196  |  |     void StyleModified()  | 
197  | 0  |     { | 
198  | 0  |         m_bModified = TRUE;  | 
199  | 0  |     }  | 
200  |  |  | 
201  |  |     GBool IsStyleParsed()  | 
202  | 0  |     { | 
203  | 0  |         return m_bParsed;  | 
204  | 0  |     }  | 
205  |  |  | 
206  |  |     void StyleParsed()  | 
207  | 0  |     { | 
208  | 0  |         m_bParsed = TRUE;  | 
209  | 0  |     }  | 
210  |  | #endif  | 
211  |  |  | 
212  |  |     OGRSTClassId GetType();  | 
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  |  |  | 
223  |  |     OGRSTUnitId GetUnit()  | 
224  | 0  |     { | 
225  | 0  |         return m_eUnit;  | 
226  | 0  |     }  | 
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  |  |     void SetParamStr(const OGRStyleParamId &sStyleParam,  | 
248  |  |                      OGRStyleValue &sStyleValue, const char *pszParamString);  | 
249  |  |  | 
250  |  |     void SetParamNum(const OGRStyleParamId &sStyleParam,  | 
251  |  |                      OGRStyleValue &sStyleValue, int nParam);  | 
252  |  |  | 
253  |  |     void SetParamDbl(const OGRStyleParamId &sStyleParam,  | 
254  |  |                      OGRStyleValue &sStyleValue, double dfParam);  | 
255  |  | #ifndef DOXYGEN_SKIP  | 
256  |  |     double ComputeWithUnit(double, OGRSTUnitId);  | 
257  |  |     int ComputeWithUnit(int, OGRSTUnitId);  | 
258  |  | #endif  | 
259  |  | };  | 
260  |  |  | 
261  |  | //! @cond Doxygen_Suppress  | 
262  |  |  | 
263  |  | /**  | 
264  |  |  * This class represents a style pen  | 
265  |  |  */  | 
266  |  | class CPL_DLL OGRStylePen : public OGRStyleTool  | 
267  |  | { | 
268  |  |   private:  | 
269  |  |     OGRStyleValue *m_pasStyleValue;  | 
270  |  |  | 
271  |  |     GBool Parse() override;  | 
272  |  |  | 
273  |  |     CPL_DISALLOW_COPY_ASSIGN(OGRStylePen)  | 
274  |  |  | 
275  |  |   public:  | 
276  |  |     OGRStylePen();  | 
277  |  |     ~OGRStylePen() override;  | 
278  |  |  | 
279  |  |     /**********************************************************************/  | 
280  |  |     /* Explicit fct for all parameters defined in the Drawing tools  Pen  */  | 
281  |  |     /**********************************************************************/  | 
282  |  |  | 
283  |  |     const char *Color(GBool &bDefault)  | 
284  | 0  |     { | 
285  | 0  |         return GetParamStr(OGRSTPenColor, bDefault);  | 
286  | 0  |     }  | 
287  |  |  | 
288  |  |     void SetColor(const char *pszColor)  | 
289  | 0  |     { | 
290  | 0  |         SetParamStr(OGRSTPenColor, pszColor);  | 
291  | 0  |     }  | 
292  |  |  | 
293  |  |     double Width(GBool &bDefault)  | 
294  | 0  |     { | 
295  | 0  |         return GetParamDbl(OGRSTPenWidth, bDefault);  | 
296  | 0  |     }  | 
297  |  |  | 
298  |  |     void SetWidth(double dfWidth)  | 
299  | 0  |     { | 
300  | 0  |         SetParamDbl(OGRSTPenWidth, dfWidth);  | 
301  | 0  |     }  | 
302  |  |  | 
303  |  |     const char *Pattern(GBool &bDefault)  | 
304  | 0  |     { | 
305  | 0  |         return GetParamStr(OGRSTPenPattern, bDefault);  | 
306  | 0  |     }  | 
307  |  |  | 
308  |  |     void SetPattern(const char *pszPattern)  | 
309  | 0  |     { | 
310  | 0  |         SetParamStr(OGRSTPenPattern, pszPattern);  | 
311  | 0  |     }  | 
312  |  |  | 
313  |  |     const char *Id(GBool &bDefault)  | 
314  | 0  |     { | 
315  | 0  |         return GetParamStr(OGRSTPenId, bDefault);  | 
316  | 0  |     }  | 
317  |  |  | 
318  |  |     void SetId(const char *pszId)  | 
319  | 0  |     { | 
320  | 0  |         SetParamStr(OGRSTPenId, pszId);  | 
321  | 0  |     }  | 
322  |  |  | 
323  |  |     double PerpendicularOffset(GBool &bDefault)  | 
324  | 0  |     { | 
325  | 0  |         return GetParamDbl(OGRSTPenPerOffset, bDefault);  | 
326  | 0  |     }  | 
327  |  |  | 
328  |  |     void SetPerpendicularOffset(double dfPerp)  | 
329  | 0  |     { | 
330  | 0  |         SetParamDbl(OGRSTPenPerOffset, dfPerp);  | 
331  | 0  |     }  | 
332  |  |  | 
333  |  |     const char *Cap(GBool &bDefault)  | 
334  | 0  |     { | 
335  | 0  |         return GetParamStr(OGRSTPenCap, bDefault);  | 
336  | 0  |     }  | 
337  |  |  | 
338  |  |     void SetCap(const char *pszCap)  | 
339  | 0  |     { | 
340  | 0  |         SetParamStr(OGRSTPenCap, pszCap);  | 
341  | 0  |     }  | 
342  |  |  | 
343  |  |     const char *Join(GBool &bDefault)  | 
344  | 0  |     { | 
345  | 0  |         return GetParamStr(OGRSTPenJoin, bDefault);  | 
346  | 0  |     }  | 
347  |  |  | 
348  |  |     void SetJoin(const char *pszJoin)  | 
349  | 0  |     { | 
350  | 0  |         SetParamStr(OGRSTPenJoin, pszJoin);  | 
351  | 0  |     }  | 
352  |  |  | 
353  |  |     int Priority(GBool &bDefault)  | 
354  | 0  |     { | 
355  | 0  |         return GetParamNum(OGRSTPenPriority, bDefault);  | 
356  | 0  |     }  | 
357  |  |  | 
358  |  |     void SetPriority(int nPriority)  | 
359  | 0  |     { | 
360  | 0  |         SetParamNum(OGRSTPenPriority, nPriority);  | 
361  | 0  |     }  | 
362  |  |  | 
363  |  |     /*****************************************************************/  | 
364  |  |  | 
365  |  |     const char *GetParamStr(OGRSTPenParam eParam, GBool &bValueIsNull);  | 
366  |  |     int GetParamNum(OGRSTPenParam eParam, GBool &bValueIsNull);  | 
367  |  |     double GetParamDbl(OGRSTPenParam eParam, GBool &bValueIsNull);  | 
368  |  |     void SetParamStr(OGRSTPenParam eParam, const char *pszParamString);  | 
369  |  |     void SetParamNum(OGRSTPenParam eParam, int nParam);  | 
370  |  |     void SetParamDbl(OGRSTPenParam eParam, double dfParam);  | 
371  |  |     const char *GetStyleString() override;  | 
372  |  | };  | 
373  |  |  | 
374  |  | /**  | 
375  |  |  * This class represents a style brush  | 
376  |  |  */  | 
377  |  | class CPL_DLL OGRStyleBrush : public OGRStyleTool  | 
378  |  | { | 
379  |  |   private:  | 
380  |  |     OGRStyleValue *m_pasStyleValue;  | 
381  |  |  | 
382  |  |     GBool Parse() override;  | 
383  |  |  | 
384  |  |     CPL_DISALLOW_COPY_ASSIGN(OGRStyleBrush)  | 
385  |  |  | 
386  |  |   public:  | 
387  |  |     OGRStyleBrush();  | 
388  |  |     ~OGRStyleBrush() override;  | 
389  |  |  | 
390  |  |     /* Explicit fct for all parameters defined in the Drawing tools Brush */  | 
391  |  |  | 
392  |  |     const char *ForeColor(GBool &bDefault)  | 
393  | 0  |     { | 
394  | 0  |         return GetParamStr(OGRSTBrushFColor, bDefault);  | 
395  | 0  |     }  | 
396  |  |  | 
397  |  |     void SetForeColor(const char *pszColor)  | 
398  | 0  |     { | 
399  | 0  |         SetParamStr(OGRSTBrushFColor, pszColor);  | 
400  | 0  |     }  | 
401  |  |  | 
402  |  |     const char *BackColor(GBool &bDefault)  | 
403  | 0  |     { | 
404  | 0  |         return GetParamStr(OGRSTBrushBColor, bDefault);  | 
405  | 0  |     }  | 
406  |  |  | 
407  |  |     void SetBackColor(const char *pszColor)  | 
408  | 0  |     { | 
409  | 0  |         SetParamStr(OGRSTBrushBColor, pszColor);  | 
410  | 0  |     }  | 
411  |  |  | 
412  |  |     const char *Id(GBool &bDefault)  | 
413  | 0  |     { | 
414  | 0  |         return GetParamStr(OGRSTBrushId, bDefault);  | 
415  | 0  |     }  | 
416  |  |  | 
417  |  |     void SetId(const char *pszId)  | 
418  | 0  |     { | 
419  | 0  |         SetParamStr(OGRSTBrushId, pszId);  | 
420  | 0  |     }  | 
421  |  |  | 
422  |  |     double Angle(GBool &bDefault)  | 
423  | 0  |     { | 
424  | 0  |         return GetParamDbl(OGRSTBrushAngle, bDefault);  | 
425  | 0  |     }  | 
426  |  |  | 
427  |  |     void SetAngle(double dfAngle)  | 
428  | 0  |     { | 
429  | 0  |         SetParamDbl(OGRSTBrushAngle, dfAngle);  | 
430  | 0  |     }  | 
431  |  |  | 
432  |  |     double Size(GBool &bDefault)  | 
433  | 0  |     { | 
434  | 0  |         return GetParamDbl(OGRSTBrushSize, bDefault);  | 
435  | 0  |     }  | 
436  |  |  | 
437  |  |     void SetSize(double dfSize)  | 
438  | 0  |     { | 
439  | 0  |         SetParamDbl(OGRSTBrushSize, dfSize);  | 
440  | 0  |     }  | 
441  |  |  | 
442  |  |     double SpacingX(GBool &bDefault)  | 
443  | 0  |     { | 
444  | 0  |         return GetParamDbl(OGRSTBrushDx, bDefault);  | 
445  | 0  |     }  | 
446  |  |  | 
447  |  |     void SetSpacingX(double dfX)  | 
448  | 0  |     { | 
449  | 0  |         SetParamDbl(OGRSTBrushDx, dfX);  | 
450  | 0  |     }  | 
451  |  |  | 
452  |  |     double SpacingY(GBool &bDefault)  | 
453  | 0  |     { | 
454  | 0  |         return GetParamDbl(OGRSTBrushDy, bDefault);  | 
455  | 0  |     }  | 
456  |  |  | 
457  |  |     void SetSpacingY(double dfY)  | 
458  | 0  |     { | 
459  | 0  |         SetParamDbl(OGRSTBrushDy, dfY);  | 
460  | 0  |     }  | 
461  |  |  | 
462  |  |     int Priority(GBool &bDefault)  | 
463  | 0  |     { | 
464  | 0  |         return GetParamNum(OGRSTBrushPriority, bDefault);  | 
465  | 0  |     }  | 
466  |  |  | 
467  |  |     void SetPriority(int nPriority)  | 
468  | 0  |     { | 
469  | 0  |         SetParamNum(OGRSTBrushPriority, nPriority);  | 
470  | 0  |     }  | 
471  |  |  | 
472  |  |     /*****************************************************************/  | 
473  |  |  | 
474  |  |     const char *GetParamStr(OGRSTBrushParam eParam, GBool &bValueIsNull);  | 
475  |  |     int GetParamNum(OGRSTBrushParam eParam, GBool &bValueIsNull);  | 
476  |  |     double GetParamDbl(OGRSTBrushParam eParam, GBool &bValueIsNull);  | 
477  |  |     void SetParamStr(OGRSTBrushParam eParam, const char *pszParamString);  | 
478  |  |     void SetParamNum(OGRSTBrushParam eParam, int nParam);  | 
479  |  |     void SetParamDbl(OGRSTBrushParam eParam, double dfParam);  | 
480  |  |     const char *GetStyleString() override;  | 
481  |  | };  | 
482  |  |  | 
483  |  | /**  | 
484  |  |  * This class represents a style symbol  | 
485  |  |  */  | 
486  |  | class CPL_DLL OGRStyleSymbol : public OGRStyleTool  | 
487  |  | { | 
488  |  |   private:  | 
489  |  |     OGRStyleValue *m_pasStyleValue;  | 
490  |  |  | 
491  |  |     GBool Parse() override;  | 
492  |  |  | 
493  |  |     CPL_DISALLOW_COPY_ASSIGN(OGRStyleSymbol)  | 
494  |  |  | 
495  |  |   public:  | 
496  |  |     OGRStyleSymbol();  | 
497  |  |     ~OGRStyleSymbol() override;  | 
498  |  |  | 
499  |  |     /*****************************************************************/  | 
500  |  |     /* Explicit fct for all parameters defined in the Drawing tools  */  | 
501  |  |     /*****************************************************************/  | 
502  |  |  | 
503  |  |     const char *Id(GBool &bDefault)  | 
504  | 0  |     { | 
505  | 0  |         return GetParamStr(OGRSTSymbolId, bDefault);  | 
506  | 0  |     }  | 
507  |  |  | 
508  |  |     void SetId(const char *pszId)  | 
509  | 0  |     { | 
510  | 0  |         SetParamStr(OGRSTSymbolId, pszId);  | 
511  | 0  |     }  | 
512  |  |  | 
513  |  |     double Angle(GBool &bDefault)  | 
514  | 0  |     { | 
515  | 0  |         return GetParamDbl(OGRSTSymbolAngle, bDefault);  | 
516  | 0  |     }  | 
517  |  |  | 
518  |  |     void SetAngle(double dfAngle)  | 
519  | 0  |     { | 
520  | 0  |         SetParamDbl(OGRSTSymbolAngle, dfAngle);  | 
521  | 0  |     }  | 
522  |  |  | 
523  |  |     const char *Color(GBool &bDefault)  | 
524  | 0  |     { | 
525  | 0  |         return GetParamStr(OGRSTSymbolColor, bDefault);  | 
526  | 0  |     }  | 
527  |  |  | 
528  |  |     void SetColor(const char *pszColor)  | 
529  | 0  |     { | 
530  | 0  |         SetParamStr(OGRSTSymbolColor, pszColor);  | 
531  | 0  |     }  | 
532  |  |  | 
533  |  |     double Size(GBool &bDefault)  | 
534  | 0  |     { | 
535  | 0  |         return GetParamDbl(OGRSTSymbolSize, bDefault);  | 
536  | 0  |     }  | 
537  |  |  | 
538  |  |     void SetSize(double dfSize)  | 
539  | 0  |     { | 
540  | 0  |         SetParamDbl(OGRSTSymbolSize, dfSize);  | 
541  | 0  |     }  | 
542  |  |  | 
543  |  |     double SpacingX(GBool &bDefault)  | 
544  | 0  |     { | 
545  | 0  |         return GetParamDbl(OGRSTSymbolDx, bDefault);  | 
546  | 0  |     }  | 
547  |  |  | 
548  |  |     void SetSpacingX(double dfX)  | 
549  | 0  |     { | 
550  | 0  |         SetParamDbl(OGRSTSymbolDx, dfX);  | 
551  | 0  |     }  | 
552  |  |  | 
553  |  |     double SpacingY(GBool &bDefault)  | 
554  | 0  |     { | 
555  | 0  |         return GetParamDbl(OGRSTSymbolDy, bDefault);  | 
556  | 0  |     }  | 
557  |  |  | 
558  |  |     void SetSpacingY(double dfY)  | 
559  | 0  |     { | 
560  | 0  |         SetParamDbl(OGRSTSymbolDy, dfY);  | 
561  | 0  |     }  | 
562  |  |  | 
563  |  |     double Step(GBool &bDefault)  | 
564  | 0  |     { | 
565  | 0  |         return GetParamDbl(OGRSTSymbolStep, bDefault);  | 
566  | 0  |     }  | 
567  |  |  | 
568  |  |     void SetStep(double dfStep)  | 
569  | 0  |     { | 
570  | 0  |         SetParamDbl(OGRSTSymbolStep, dfStep);  | 
571  | 0  |     }  | 
572  |  |  | 
573  |  |     double Offset(GBool &bDefault)  | 
574  | 0  |     { | 
575  | 0  |         return GetParamDbl(OGRSTSymbolOffset, bDefault);  | 
576  | 0  |     }  | 
577  |  |  | 
578  |  |     void SetOffset(double dfOffset)  | 
579  | 0  |     { | 
580  | 0  |         SetParamDbl(OGRSTSymbolOffset, dfOffset);  | 
581  | 0  |     }  | 
582  |  |  | 
583  |  |     double Perp(GBool &bDefault)  | 
584  | 0  |     { | 
585  | 0  |         return GetParamDbl(OGRSTSymbolPerp, bDefault);  | 
586  | 0  |     }  | 
587  |  |  | 
588  |  |     void SetPerp(double dfPerp)  | 
589  | 0  |     { | 
590  | 0  |         SetParamDbl(OGRSTSymbolPerp, dfPerp);  | 
591  | 0  |     }  | 
592  |  |  | 
593  |  |     int Priority(GBool &bDefault)  | 
594  | 0  |     { | 
595  | 0  |         return GetParamNum(OGRSTSymbolPriority, bDefault);  | 
596  | 0  |     }  | 
597  |  |  | 
598  |  |     void SetPriority(int nPriority)  | 
599  | 0  |     { | 
600  | 0  |         SetParamNum(OGRSTSymbolPriority, nPriority);  | 
601  | 0  |     }  | 
602  |  |  | 
603  |  |     const char *FontName(GBool &bDefault)  | 
604  | 0  |     { | 
605  | 0  |         return GetParamStr(OGRSTSymbolFontName, bDefault);  | 
606  | 0  |     }  | 
607  |  |  | 
608  |  |     void SetFontName(const char *pszFontName)  | 
609  | 0  |     { | 
610  | 0  |         SetParamStr(OGRSTSymbolFontName, pszFontName);  | 
611  | 0  |     }  | 
612  |  |  | 
613  |  |     const char *OColor(GBool &bDefault)  | 
614  | 0  |     { | 
615  | 0  |         return GetParamStr(OGRSTSymbolOColor, bDefault);  | 
616  | 0  |     }  | 
617  |  |  | 
618  |  |     void SetOColor(const char *pszColor)  | 
619  | 0  |     { | 
620  | 0  |         SetParamStr(OGRSTSymbolOColor, pszColor);  | 
621  | 0  |     }  | 
622  |  |  | 
623  |  |     /*****************************************************************/  | 
624  |  |  | 
625  |  |     const char *GetParamStr(OGRSTSymbolParam eParam, GBool &bValueIsNull);  | 
626  |  |     int GetParamNum(OGRSTSymbolParam eParam, GBool &bValueIsNull);  | 
627  |  |     double GetParamDbl(OGRSTSymbolParam eParam, GBool &bValueIsNull);  | 
628  |  |     void SetParamStr(OGRSTSymbolParam eParam, const char *pszParamString);  | 
629  |  |     void SetParamNum(OGRSTSymbolParam eParam, int nParam);  | 
630  |  |     void SetParamDbl(OGRSTSymbolParam eParam, double dfParam);  | 
631  |  |     const char *GetStyleString() override;  | 
632  |  | };  | 
633  |  |  | 
634  |  | /**  | 
635  |  |  * This class represents a style label  | 
636  |  |  */  | 
637  |  | class CPL_DLL OGRStyleLabel : public OGRStyleTool  | 
638  |  | { | 
639  |  |   private:  | 
640  |  |     OGRStyleValue *m_pasStyleValue;  | 
641  |  |  | 
642  |  |     GBool Parse() override;  | 
643  |  |  | 
644  |  |     CPL_DISALLOW_COPY_ASSIGN(OGRStyleLabel)  | 
645  |  |  | 
646  |  |   public:  | 
647  |  |     OGRStyleLabel();  | 
648  |  |     ~OGRStyleLabel() override;  | 
649  |  |  | 
650  |  |     /*****************************************************************/  | 
651  |  |     /* Explicit fct for all parameters defined in the Drawing tools  */  | 
652  |  |     /*****************************************************************/  | 
653  |  |  | 
654  |  |     const char *FontName(GBool &bDefault)  | 
655  | 0  |     { | 
656  | 0  |         return GetParamStr(OGRSTLabelFontName, bDefault);  | 
657  | 0  |     }  | 
658  |  |  | 
659  |  |     void SetFontName(const char *pszFontName)  | 
660  | 0  |     { | 
661  | 0  |         SetParamStr(OGRSTLabelFontName, pszFontName);  | 
662  | 0  |     }  | 
663  |  |  | 
664  |  |     double Size(GBool &bDefault)  | 
665  | 0  |     { | 
666  | 0  |         return GetParamDbl(OGRSTLabelSize, bDefault);  | 
667  | 0  |     }  | 
668  |  |  | 
669  |  |     void SetSize(double dfSize)  | 
670  | 0  |     { | 
671  | 0  |         SetParamDbl(OGRSTLabelSize, dfSize);  | 
672  | 0  |     }  | 
673  |  |  | 
674  |  |     const char *TextString(GBool &bDefault)  | 
675  | 0  |     { | 
676  | 0  |         return GetParamStr(OGRSTLabelTextString, bDefault);  | 
677  | 0  |     }  | 
678  |  |  | 
679  |  |     void SetTextString(const char *pszTextString)  | 
680  | 0  |     { | 
681  | 0  |         SetParamStr(OGRSTLabelTextString, pszTextString);  | 
682  | 0  |     }  | 
683  |  |  | 
684  |  |     double Angle(GBool &bDefault)  | 
685  | 0  |     { | 
686  | 0  |         return GetParamDbl(OGRSTLabelAngle, bDefault);  | 
687  | 0  |     }  | 
688  |  |  | 
689  |  |     void SetAngle(double dfAngle)  | 
690  | 0  |     { | 
691  | 0  |         SetParamDbl(OGRSTLabelAngle, dfAngle);  | 
692  | 0  |     }  | 
693  |  |  | 
694  |  |     const char *ForeColor(GBool &bDefault)  | 
695  | 0  |     { | 
696  | 0  |         return GetParamStr(OGRSTLabelFColor, bDefault);  | 
697  | 0  |     }  | 
698  |  |  | 
699  |  |     void SetForColor(const char *pszForColor)  | 
700  | 0  |     { | 
701  | 0  |         SetParamStr(OGRSTLabelFColor, pszForColor);  | 
702  | 0  |     }  | 
703  |  |  | 
704  |  |     const char *BackColor(GBool &bDefault)  | 
705  | 0  |     { | 
706  | 0  |         return GetParamStr(OGRSTLabelBColor, bDefault);  | 
707  | 0  |     }  | 
708  |  |  | 
709  |  |     void SetBackColor(const char *pszBackColor)  | 
710  | 0  |     { | 
711  | 0  |         SetParamStr(OGRSTLabelBColor, pszBackColor);  | 
712  | 0  |     }  | 
713  |  |  | 
714  |  |     const char *Placement(GBool &bDefault)  | 
715  | 0  |     { | 
716  | 0  |         return GetParamStr(OGRSTLabelPlacement, bDefault);  | 
717  | 0  |     }  | 
718  |  |  | 
719  |  |     void SetPlacement(const char *pszPlacement)  | 
720  | 0  |     { | 
721  | 0  |         SetParamStr(OGRSTLabelPlacement, pszPlacement);  | 
722  | 0  |     }  | 
723  |  |  | 
724  |  |     int Anchor(GBool &bDefault)  | 
725  | 0  |     { | 
726  | 0  |         return GetParamNum(OGRSTLabelAnchor, bDefault);  | 
727  | 0  |     }  | 
728  |  |  | 
729  |  |     void SetAnchor(int nAnchor)  | 
730  | 0  |     { | 
731  | 0  |         SetParamNum(OGRSTLabelAnchor, nAnchor);  | 
732  | 0  |     }  | 
733  |  |  | 
734  |  |     double SpacingX(GBool &bDefault)  | 
735  | 0  |     { | 
736  | 0  |         return GetParamDbl(OGRSTLabelDx, bDefault);  | 
737  | 0  |     }  | 
738  |  |  | 
739  |  |     void SetSpacingX(double dfX)  | 
740  | 0  |     { | 
741  | 0  |         SetParamDbl(OGRSTLabelDx, dfX);  | 
742  | 0  |     }  | 
743  |  |  | 
744  |  |     double SpacingY(GBool &bDefault)  | 
745  | 0  |     { | 
746  | 0  |         return GetParamDbl(OGRSTLabelDy, bDefault);  | 
747  | 0  |     }  | 
748  |  |  | 
749  |  |     void SetSpacingY(double dfY)  | 
750  | 0  |     { | 
751  | 0  |         SetParamDbl(OGRSTLabelDy, dfY);  | 
752  | 0  |     }  | 
753  |  |  | 
754  |  |     double Perp(GBool &bDefault)  | 
755  | 0  |     { | 
756  | 0  |         return GetParamDbl(OGRSTLabelPerp, bDefault);  | 
757  | 0  |     }  | 
758  |  |  | 
759  |  |     void SetPerp(double dfPerp)  | 
760  | 0  |     { | 
761  | 0  |         SetParamDbl(OGRSTLabelPerp, dfPerp);  | 
762  | 0  |     }  | 
763  |  |  | 
764  |  |     GBool Bold(GBool &bDefault)  | 
765  | 0  |     { | 
766  | 0  |         return GetParamNum(OGRSTLabelBold, bDefault);  | 
767  | 0  |     }  | 
768  |  |  | 
769  |  |     void SetBold(GBool bBold)  | 
770  | 0  |     { | 
771  | 0  |         SetParamNum(OGRSTLabelBold, bBold);  | 
772  | 0  |     }  | 
773  |  |  | 
774  |  |     GBool Italic(GBool &bDefault)  | 
775  | 0  |     { | 
776  | 0  |         return GetParamNum(OGRSTLabelItalic, bDefault);  | 
777  | 0  |     }  | 
778  |  |  | 
779  |  |     void SetItalic(GBool bItalic)  | 
780  | 0  |     { | 
781  | 0  |         SetParamNum(OGRSTLabelItalic, bItalic);  | 
782  | 0  |     }  | 
783  |  |  | 
784  |  |     GBool Underline(GBool &bDefault)  | 
785  | 0  |     { | 
786  | 0  |         return GetParamNum(OGRSTLabelUnderline, bDefault);  | 
787  | 0  |     }  | 
788  |  |  | 
789  |  |     void SetUnderline(GBool bUnderline)  | 
790  | 0  |     { | 
791  | 0  |         SetParamNum(OGRSTLabelUnderline, bUnderline);  | 
792  | 0  |     }  | 
793  |  |  | 
794  |  |     int Priority(GBool &bDefault)  | 
795  | 0  |     { | 
796  | 0  |         return GetParamNum(OGRSTLabelPriority, bDefault);  | 
797  | 0  |     }  | 
798  |  |  | 
799  |  |     void SetPriority(int nPriority)  | 
800  | 0  |     { | 
801  | 0  |         SetParamNum(OGRSTLabelPriority, nPriority);  | 
802  | 0  |     }  | 
803  |  |  | 
804  |  |     GBool Strikeout(GBool &bDefault)  | 
805  | 0  |     { | 
806  | 0  |         return GetParamNum(OGRSTLabelStrikeout, bDefault);  | 
807  | 0  |     }  | 
808  |  |  | 
809  |  |     void SetStrikeout(GBool bStrikeout)  | 
810  | 0  |     { | 
811  | 0  |         SetParamNum(OGRSTLabelStrikeout, bStrikeout);  | 
812  | 0  |     }  | 
813  |  |  | 
814  |  |     double Stretch(GBool &bDefault)  | 
815  | 0  |     { | 
816  | 0  |         return GetParamDbl(OGRSTLabelStretch, bDefault);  | 
817  | 0  |     }  | 
818  |  |  | 
819  |  |     void SetStretch(double dfStretch)  | 
820  | 0  |     { | 
821  | 0  |         SetParamDbl(OGRSTLabelStretch, dfStretch);  | 
822  | 0  |     }  | 
823  |  |  | 
824  |  |     const char *ShadowColor(GBool &bDefault)  | 
825  | 0  |     { | 
826  | 0  |         return GetParamStr(OGRSTLabelHColor, bDefault);  | 
827  | 0  |     }  | 
828  |  |  | 
829  |  |     void SetShadowColor(const char *pszShadowColor)  | 
830  | 0  |     { | 
831  | 0  |         SetParamStr(OGRSTLabelHColor, pszShadowColor);  | 
832  | 0  |     }  | 
833  |  |  | 
834  |  |     const char *OutlineColor(GBool &bDefault)  | 
835  | 0  |     { | 
836  | 0  |         return GetParamStr(OGRSTLabelOColor, bDefault);  | 
837  | 0  |     }  | 
838  |  |  | 
839  |  |     void SetOutlineColor(const char *pszOutlineColor)  | 
840  | 0  |     { | 
841  | 0  |         SetParamStr(OGRSTLabelOColor, pszOutlineColor);  | 
842  | 0  |     }  | 
843  |  |  | 
844  |  |     /*****************************************************************/  | 
845  |  |  | 
846  |  |     const char *GetParamStr(OGRSTLabelParam eParam, GBool &bValueIsNull);  | 
847  |  |     int GetParamNum(OGRSTLabelParam eParam, GBool &bValueIsNull);  | 
848  |  |     double GetParamDbl(OGRSTLabelParam eParam, GBool &bValueIsNull);  | 
849  |  |     void SetParamStr(OGRSTLabelParam eParam, const char *pszParamString);  | 
850  |  |     void SetParamNum(OGRSTLabelParam eParam, int nParam);  | 
851  |  |     void SetParamDbl(OGRSTLabelParam eParam, double dfParam);  | 
852  |  |     const char *GetStyleString() override;  | 
853  |  | };  | 
854  |  |  | 
855  |  | //! @endcond  | 
856  |  |  | 
857  |  | #endif /* OGR_FEATURESTYLE_INCLUDE */  |