LCOV - code coverage report
Current view: top level - ogr - ogr_featurestyle.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 107 107 100.0 %
Date: 2025-10-20 18:43:00 Functions: 47 47 100.0 %

          Line data    Source code
       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             :     {
     144             :         return m_poDataSetStyleTable;
     145             :     }
     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             :     {
     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         686 :     GBool IsStyleModified()
     192             :     {
     193         686 :         return m_bModified;
     194             :     }
     195             : 
     196        1705 :     void StyleModified()
     197             :     {
     198        1705 :         m_bModified = TRUE;
     199        1705 :     }
     200             : 
     201        2782 :     GBool IsStyleParsed()
     202             :     {
     203        2782 :         return m_bParsed;
     204             :     }
     205             : 
     206         621 :     void StyleParsed()
     207             :     {
     208         621 :         m_bParsed = TRUE;
     209         621 :     }
     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        1906 :     OGRSTUnitId GetUnit()
     224             :     {
     225        1906 :         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             : 
     265             : //! @cond Doxygen_Suppress
     266             : 
     267             : /**
     268             :  * This class represents a style pen
     269             :  */
     270             : class 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          44 :     const char *Color(GBool &bDefault)
     288             :     {
     289          44 :         return GetParamStr(OGRSTPenColor, bDefault);
     290             :     }
     291             : 
     292          53 :     void SetColor(const char *pszColor)
     293             :     {
     294          53 :         SetParamStr(OGRSTPenColor, pszColor);
     295          53 :     }
     296             : 
     297          10 :     double Width(GBool &bDefault)
     298             :     {
     299          10 :         return GetParamDbl(OGRSTPenWidth, bDefault);
     300             :     }
     301             : 
     302          32 :     double RawWidth(OGRSTUnitId &eRawUnit, GBool &bDefault)
     303             :     {
     304          32 :         return GetRawParamDbl(OGRSTPenWidth, eRawUnit, bDefault);
     305             :     }
     306             : 
     307          83 :     void SetWidth(double dfWidth)
     308             :     {
     309          83 :         SetParamDbl(OGRSTPenWidth, dfWidth);
     310          83 :     }
     311             : 
     312           9 :     const char *Pattern(GBool &bDefault)
     313             :     {
     314           9 :         return GetParamStr(OGRSTPenPattern, bDefault);
     315             :     }
     316             : 
     317             :     void SetPattern(const char *pszPattern)
     318             :     {
     319             :         SetParamStr(OGRSTPenPattern, pszPattern);
     320             :     }
     321             : 
     322          32 :     const char *Id(GBool &bDefault)
     323             :     {
     324          32 :         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             : 
     385             : /**
     386             :  * This class represents a style brush
     387             :  */
     388             : class 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          33 :     const char *ForeColor(GBool &bDefault)
     404             :     {
     405          33 :         return GetParamStr(OGRSTBrushFColor, bDefault);
     406             :     }
     407             : 
     408          83 :     void SetForeColor(const char *pszColor)
     409             :     {
     410          83 :         SetParamStr(OGRSTBrushFColor, pszColor);
     411          83 :     }
     412             : 
     413          28 :     const char *BackColor(GBool &bDefault)
     414             :     {
     415          28 :         return GetParamStr(OGRSTBrushBColor, bDefault);
     416             :     }
     417             : 
     418             :     void SetBackColor(const char *pszColor)
     419             :     {
     420             :         SetParamStr(OGRSTBrushBColor, pszColor);
     421             :     }
     422             : 
     423          29 :     const char *Id(GBool &bDefault)
     424             :     {
     425          29 :         return GetParamStr(OGRSTBrushId, bDefault);
     426             :     }
     427             : 
     428             :     void SetId(const char *pszId)
     429             :     {
     430             :         SetParamStr(OGRSTBrushId, pszId);
     431             :     }
     432             : 
     433          10 :     double Angle(GBool &bDefault)
     434             :     {
     435          10 :         return GetParamDbl(OGRSTBrushAngle, bDefault);
     436             :     }
     437             : 
     438             :     void SetAngle(double dfAngle)
     439             :     {
     440             :         SetParamDbl(OGRSTBrushAngle, dfAngle);
     441             :     }
     442             : 
     443          10 :     double Size(GBool &bDefault)
     444             :     {
     445          10 :         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             : 
     494             : /**
     495             :  * This class represents a style symbol
     496             :  */
     497             : class 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         230 :     const char *Id(GBool &bDefault)
     515             :     {
     516         230 :         return GetParamStr(OGRSTSymbolId, bDefault);
     517             :     }
     518             : 
     519          52 :     void SetId(const char *pszId)
     520             :     {
     521          52 :         SetParamStr(OGRSTSymbolId, pszId);
     522          52 :     }
     523             : 
     524           8 :     double Angle(GBool &bDefault)
     525             :     {
     526           8 :         return GetParamDbl(OGRSTSymbolAngle, bDefault);
     527             :     }
     528             : 
     529           3 :     void SetAngle(double dfAngle)
     530             :     {
     531           3 :         SetParamDbl(OGRSTSymbolAngle, dfAngle);
     532           3 :     }
     533             : 
     534         117 :     const char *Color(GBool &bDefault)
     535             :     {
     536         117 :         return GetParamStr(OGRSTSymbolColor, bDefault);
     537             :     }
     538             : 
     539          11 :     void SetColor(const char *pszColor)
     540             :     {
     541          11 :         SetParamStr(OGRSTSymbolColor, pszColor);
     542          11 :     }
     543             : 
     544         117 :     double Size(GBool &bDefault)
     545             :     {
     546         117 :         return GetParamDbl(OGRSTSymbolSize, bDefault);
     547             :     }
     548             : 
     549           3 :     void SetSize(double dfSize)
     550             :     {
     551           3 :         SetParamDbl(OGRSTSymbolSize, dfSize);
     552           3 :     }
     553             : 
     554           8 :     double SpacingX(GBool &bDefault)
     555             :     {
     556           8 :         return GetParamDbl(OGRSTSymbolDx, bDefault);
     557             :     }
     558             : 
     559           2 :     void SetSpacingX(double dfX)
     560             :     {
     561           2 :         SetParamDbl(OGRSTSymbolDx, dfX);
     562           2 :     }
     563             : 
     564           8 :     double SpacingY(GBool &bDefault)
     565             :     {
     566           8 :         return GetParamDbl(OGRSTSymbolDy, bDefault);
     567             :     }
     568             : 
     569           2 :     void SetSpacingY(double dfY)
     570             :     {
     571           2 :         SetParamDbl(OGRSTSymbolDy, dfY);
     572           2 :     }
     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           2 :     const char *FontName(GBool &bDefault)
     615             :     {
     616           2 :         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             : 
     645             : /**
     646             :  * This class represents a style label
     647             :  */
     648             : class 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           6 :     const char *FontName(GBool &bDefault)
     666             :     {
     667           6 :         return GetParamStr(OGRSTLabelFontName, bDefault);
     668             :     }
     669             : 
     670             :     void SetFontName(const char *pszFontName)
     671             :     {
     672             :         SetParamStr(OGRSTLabelFontName, pszFontName);
     673             :     }
     674             : 
     675           6 :     double Size(GBool &bDefault)
     676             :     {
     677           6 :         return GetParamDbl(OGRSTLabelSize, bDefault);
     678             :     }
     679             : 
     680             :     void SetSize(double dfSize)
     681             :     {
     682             :         SetParamDbl(OGRSTLabelSize, dfSize);
     683             :     }
     684             : 
     685          10 :     const char *TextString(GBool &bDefault)
     686             :     {
     687          10 :         return GetParamStr(OGRSTLabelTextString, bDefault);
     688             :     }
     689             : 
     690             :     void SetTextString(const char *pszTextString)
     691             :     {
     692             :         SetParamStr(OGRSTLabelTextString, pszTextString);
     693             :     }
     694             : 
     695           9 :     double Angle(GBool &bDefault)
     696             :     {
     697           9 :         return GetParamDbl(OGRSTLabelAngle, bDefault);
     698             :     }
     699             : 
     700             :     void SetAngle(double dfAngle)
     701             :     {
     702             :         SetParamDbl(OGRSTLabelAngle, dfAngle);
     703             :     }
     704             : 
     705           8 :     const char *ForeColor(GBool &bDefault)
     706             :     {
     707           8 :         return GetParamStr(OGRSTLabelFColor, bDefault);
     708             :     }
     709             : 
     710           5 :     void SetForColor(const char *pszForColor)
     711             :     {
     712           5 :         SetParamStr(OGRSTLabelFColor, pszForColor);
     713           5 :     }
     714             : 
     715           4 :     const char *BackColor(GBool &bDefault)
     716             :     {
     717           4 :         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           5 :     int Anchor(GBool &bDefault)
     736             :     {
     737           5 :         return GetParamNum(OGRSTLabelAnchor, bDefault);
     738             :     }
     739             : 
     740             :     void SetAnchor(int nAnchor)
     741             :     {
     742             :         SetParamNum(OGRSTLabelAnchor, nAnchor);
     743             :     }
     744             : 
     745           4 :     double SpacingX(GBool &bDefault)
     746             :     {
     747           4 :         return GetParamDbl(OGRSTLabelDx, bDefault);
     748             :     }
     749             : 
     750             :     void SetSpacingX(double dfX)
     751             :     {
     752             :         SetParamDbl(OGRSTLabelDx, dfX);
     753             :     }
     754             : 
     755           4 :     double SpacingY(GBool &bDefault)
     756             :     {
     757           4 :         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           5 :     GBool Bold(GBool &bDefault)
     776             :     {
     777           5 :         return GetParamNum(OGRSTLabelBold, bDefault);
     778             :     }
     779             : 
     780             :     void SetBold(GBool bBold)
     781             :     {
     782             :         SetParamNum(OGRSTLabelBold, bBold);
     783             :     }
     784             : 
     785           5 :     GBool Italic(GBool &bDefault)
     786             :     {
     787           5 :         return GetParamNum(OGRSTLabelItalic, bDefault);
     788             :     }
     789             : 
     790             :     void SetItalic(GBool bItalic)
     791             :     {
     792             :         SetParamNum(OGRSTLabelItalic, bItalic);
     793             :     }
     794             : 
     795           4 :     GBool Underline(GBool &bDefault)
     796             :     {
     797           4 :         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           4 :     double Stretch(GBool &bDefault)
     826             :     {
     827           4 :         return GetParamDbl(OGRSTLabelStretch, bDefault);
     828             :     }
     829             : 
     830           5 :     void SetStretch(double dfStretch)
     831             :     {
     832           5 :         SetParamDbl(OGRSTLabelStretch, dfStretch);
     833           5 :     }
     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           4 :     const char *OutlineColor(GBool &bDefault)
     846             :     {
     847           4 :         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             : 
     866             : //! @endcond
     867             : 
     868             : #endif /* OGR_FEATURESTYLE_INCLUDE */

Generated by: LCOV version 1.14