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: 2026-02-23 15:56:29 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        1927 :     void StyleModified()
     197             :     {
     198        1927 :         m_bModified = TRUE;
     199        1927 :     }
     200             : 
     201        3166 :     GBool IsStyleParsed()
     202             :     {
     203        3166 :         return m_bParsed;
     204             :     }
     205             : 
     206         675 :     void StyleParsed()
     207             :     {
     208         675 :         m_bParsed = TRUE;
     209         675 :     }
     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             : 
     221             :     // used if we are working with Ground
     222             :     // Unit ( ground = paper * scale);
     223             : 
     224        2128 :     OGRSTUnitId GetUnit()
     225             :     {
     226        2128 :         return m_eUnit;
     227             :     }
     228             : 
     229             :     // There are two way to set the parameters in the Style, with generic
     230             :     // methods (using a defined enumeration) or with the reel method specific
     231             :     // for Each style tools.
     232             : 
     233             :     virtual const char *GetStyleString() = 0;
     234             :     void SetStyleString(const char *pszStyleString);
     235             :     const char *GetStyleString(const OGRStyleParamId *pasStyleParam,
     236             :                                OGRStyleValue *pasStyleValue, int nSize);
     237             : 
     238             :     const char *GetParamStr(const OGRStyleParamId &sStyleParam,
     239             :                             const OGRStyleValue &sStyleValue,
     240             :                             GBool &bValueIsNull);
     241             : 
     242             :     int GetParamNum(const OGRStyleParamId &sStyleParam,
     243             :                     const OGRStyleValue &sStyleValue, GBool &bValueIsNull);
     244             : 
     245             :     double GetParamDbl(const OGRStyleParamId &sStyleParam,
     246             :                        const OGRStyleValue &sStyleValue, GBool &bValueIsNull);
     247             : 
     248             :     double GetRawParamDbl(const OGRStyleParamId &sStyleParam,
     249             :                           const OGRStyleValue &sStyleValue,
     250             :                           OGRSTUnitId &eRawUnit, GBool &bValueIsNull);
     251             : 
     252             :     void SetParamStr(const OGRStyleParamId &sStyleParam,
     253             :                      OGRStyleValue &sStyleValue, const char *pszParamString);
     254             : 
     255             :     void SetParamNum(const OGRStyleParamId &sStyleParam,
     256             :                      OGRStyleValue &sStyleValue, int nParam);
     257             : 
     258             :     void SetParamDbl(const OGRStyleParamId &sStyleParam,
     259             :                      OGRStyleValue &sStyleValue, double dfParam);
     260             : #ifndef DOXYGEN_SKIP
     261             :     double ComputeWithUnit(double, OGRSTUnitId);
     262             :     int ComputeWithUnit(int, OGRSTUnitId);
     263             : #endif
     264             : };
     265             : 
     266             : //! @cond Doxygen_Suppress
     267             : 
     268             : /**
     269             :  * This class represents a style pen
     270             :  */
     271             : class CPL_DLL OGRStylePen : public OGRStyleTool
     272             : {
     273             :   private:
     274             :     OGRStyleValue *m_pasStyleValue;
     275             : 
     276             :     GBool Parse() override;
     277             : 
     278             :     CPL_DISALLOW_COPY_ASSIGN(OGRStylePen)
     279             : 
     280             :   public:
     281             :     OGRStylePen();
     282             :     ~OGRStylePen() override;
     283             : 
     284             :     /**********************************************************************/
     285             :     /* Explicit fct for all parameters defined in the Drawing tools  Pen  */
     286             :     /**********************************************************************/
     287             : 
     288          74 :     const char *Color(GBool &bDefault)
     289             :     {
     290          74 :         return GetParamStr(OGRSTPenColor, bDefault);
     291             :     }
     292             : 
     293          53 :     void SetColor(const char *pszColor)
     294             :     {
     295          53 :         SetParamStr(OGRSTPenColor, pszColor);
     296          53 :     }
     297             : 
     298          10 :     double Width(GBool &bDefault)
     299             :     {
     300          10 :         return GetParamDbl(OGRSTPenWidth, bDefault);
     301             :     }
     302             : 
     303          62 :     double RawWidth(OGRSTUnitId &eRawUnit, GBool &bDefault)
     304             :     {
     305          62 :         return GetRawParamDbl(OGRSTPenWidth, eRawUnit, bDefault);
     306             :     }
     307             : 
     308          83 :     void SetWidth(double dfWidth)
     309             :     {
     310          83 :         SetParamDbl(OGRSTPenWidth, dfWidth);
     311          83 :     }
     312             : 
     313           9 :     const char *Pattern(GBool &bDefault)
     314             :     {
     315           9 :         return GetParamStr(OGRSTPenPattern, bDefault);
     316             :     }
     317             : 
     318             :     void SetPattern(const char *pszPattern)
     319             :     {
     320             :         SetParamStr(OGRSTPenPattern, pszPattern);
     321             :     }
     322             : 
     323          62 :     const char *Id(GBool &bDefault)
     324             :     {
     325          62 :         return GetParamStr(OGRSTPenId, bDefault);
     326             :     }
     327             : 
     328             :     void SetId(const char *pszId)
     329             :     {
     330             :         SetParamStr(OGRSTPenId, pszId);
     331             :     }
     332             : 
     333             :     double PerpendicularOffset(GBool &bDefault)
     334             :     {
     335             :         return GetParamDbl(OGRSTPenPerOffset, bDefault);
     336             :     }
     337             : 
     338             :     void SetPerpendicularOffset(double dfPerp)
     339             :     {
     340             :         SetParamDbl(OGRSTPenPerOffset, dfPerp);
     341             :     }
     342             : 
     343             :     const char *Cap(GBool &bDefault)
     344             :     {
     345             :         return GetParamStr(OGRSTPenCap, bDefault);
     346             :     }
     347             : 
     348             :     void SetCap(const char *pszCap)
     349             :     {
     350             :         SetParamStr(OGRSTPenCap, pszCap);
     351             :     }
     352             : 
     353             :     const char *Join(GBool &bDefault)
     354             :     {
     355             :         return GetParamStr(OGRSTPenJoin, bDefault);
     356             :     }
     357             : 
     358             :     void SetJoin(const char *pszJoin)
     359             :     {
     360             :         SetParamStr(OGRSTPenJoin, pszJoin);
     361             :     }
     362             : 
     363             :     int Priority(GBool &bDefault)
     364             :     {
     365             :         return GetParamNum(OGRSTPenPriority, bDefault);
     366             :     }
     367             : 
     368             :     void SetPriority(int nPriority)
     369             :     {
     370             :         SetParamNum(OGRSTPenPriority, nPriority);
     371             :     }
     372             : 
     373             :     /*****************************************************************/
     374             : 
     375             :     const char *GetParamStr(OGRSTPenParam eParam, GBool &bValueIsNull);
     376             :     int GetParamNum(OGRSTPenParam eParam, GBool &bValueIsNull);
     377             :     double GetParamDbl(OGRSTPenParam eParam, GBool &bValueIsNull);
     378             :     double GetRawParamDbl(OGRSTPenParam eParam, OGRSTUnitId &eRawUnit,
     379             :                           GBool &bValueIsNull);
     380             :     void SetParamStr(OGRSTPenParam eParam, const char *pszParamString);
     381             :     void SetParamNum(OGRSTPenParam eParam, int nParam);
     382             :     void SetParamDbl(OGRSTPenParam eParam, double dfParam);
     383             :     const char *GetStyleString() override;
     384             : };
     385             : 
     386             : /**
     387             :  * This class represents a style brush
     388             :  */
     389             : class CPL_DLL OGRStyleBrush : public OGRStyleTool
     390             : {
     391             :   private:
     392             :     OGRStyleValue *m_pasStyleValue;
     393             : 
     394             :     GBool Parse() override;
     395             : 
     396             :     CPL_DISALLOW_COPY_ASSIGN(OGRStyleBrush)
     397             : 
     398             :   public:
     399             :     OGRStyleBrush();
     400             :     ~OGRStyleBrush() override;
     401             : 
     402             :     /* Explicit fct for all parameters defined in the Drawing tools Brush */
     403             : 
     404          57 :     const char *ForeColor(GBool &bDefault)
     405             :     {
     406          57 :         return GetParamStr(OGRSTBrushFColor, bDefault);
     407             :     }
     408             : 
     409          83 :     void SetForeColor(const char *pszColor)
     410             :     {
     411          83 :         SetParamStr(OGRSTBrushFColor, pszColor);
     412          83 :     }
     413             : 
     414          52 :     const char *BackColor(GBool &bDefault)
     415             :     {
     416          52 :         return GetParamStr(OGRSTBrushBColor, bDefault);
     417             :     }
     418             : 
     419             :     void SetBackColor(const char *pszColor)
     420             :     {
     421             :         SetParamStr(OGRSTBrushBColor, pszColor);
     422             :     }
     423             : 
     424          53 :     const char *Id(GBool &bDefault)
     425             :     {
     426          53 :         return GetParamStr(OGRSTBrushId, bDefault);
     427             :     }
     428             : 
     429             :     void SetId(const char *pszId)
     430             :     {
     431             :         SetParamStr(OGRSTBrushId, pszId);
     432             :     }
     433             : 
     434          10 :     double Angle(GBool &bDefault)
     435             :     {
     436          10 :         return GetParamDbl(OGRSTBrushAngle, bDefault);
     437             :     }
     438             : 
     439             :     void SetAngle(double dfAngle)
     440             :     {
     441             :         SetParamDbl(OGRSTBrushAngle, dfAngle);
     442             :     }
     443             : 
     444          10 :     double Size(GBool &bDefault)
     445             :     {
     446          10 :         return GetParamDbl(OGRSTBrushSize, bDefault);
     447             :     }
     448             : 
     449             :     void SetSize(double dfSize)
     450             :     {
     451             :         SetParamDbl(OGRSTBrushSize, dfSize);
     452             :     }
     453             : 
     454             :     double SpacingX(GBool &bDefault)
     455             :     {
     456             :         return GetParamDbl(OGRSTBrushDx, bDefault);
     457             :     }
     458             : 
     459             :     void SetSpacingX(double dfX)
     460             :     {
     461             :         SetParamDbl(OGRSTBrushDx, dfX);
     462             :     }
     463             : 
     464             :     double SpacingY(GBool &bDefault)
     465             :     {
     466             :         return GetParamDbl(OGRSTBrushDy, bDefault);
     467             :     }
     468             : 
     469             :     void SetSpacingY(double dfY)
     470             :     {
     471             :         SetParamDbl(OGRSTBrushDy, dfY);
     472             :     }
     473             : 
     474             :     int Priority(GBool &bDefault)
     475             :     {
     476             :         return GetParamNum(OGRSTBrushPriority, bDefault);
     477             :     }
     478             : 
     479             :     void SetPriority(int nPriority)
     480             :     {
     481             :         SetParamNum(OGRSTBrushPriority, nPriority);
     482             :     }
     483             : 
     484             :     /*****************************************************************/
     485             : 
     486             :     const char *GetParamStr(OGRSTBrushParam eParam, GBool &bValueIsNull);
     487             :     int GetParamNum(OGRSTBrushParam eParam, GBool &bValueIsNull);
     488             :     double GetParamDbl(OGRSTBrushParam eParam, GBool &bValueIsNull);
     489             :     void SetParamStr(OGRSTBrushParam eParam, const char *pszParamString);
     490             :     void SetParamNum(OGRSTBrushParam eParam, int nParam);
     491             :     void SetParamDbl(OGRSTBrushParam eParam, double dfParam);
     492             :     const char *GetStyleString() override;
     493             : };
     494             : 
     495             : /**
     496             :  * This class represents a style symbol
     497             :  */
     498             : class CPL_DLL OGRStyleSymbol : public OGRStyleTool
     499             : {
     500             :   private:
     501             :     OGRStyleValue *m_pasStyleValue;
     502             : 
     503             :     GBool Parse() override;
     504             : 
     505             :     CPL_DISALLOW_COPY_ASSIGN(OGRStyleSymbol)
     506             : 
     507             :   public:
     508             :     OGRStyleSymbol();
     509             :     ~OGRStyleSymbol() override;
     510             : 
     511             :     /*****************************************************************/
     512             :     /* Explicit fct for all parameters defined in the Drawing tools  */
     513             :     /*****************************************************************/
     514             : 
     515         230 :     const char *Id(GBool &bDefault)
     516             :     {
     517         230 :         return GetParamStr(OGRSTSymbolId, bDefault);
     518             :     }
     519             : 
     520          52 :     void SetId(const char *pszId)
     521             :     {
     522          52 :         SetParamStr(OGRSTSymbolId, pszId);
     523          52 :     }
     524             : 
     525           8 :     double Angle(GBool &bDefault)
     526             :     {
     527           8 :         return GetParamDbl(OGRSTSymbolAngle, bDefault);
     528             :     }
     529             : 
     530           3 :     void SetAngle(double dfAngle)
     531             :     {
     532           3 :         SetParamDbl(OGRSTSymbolAngle, dfAngle);
     533           3 :     }
     534             : 
     535         117 :     const char *Color(GBool &bDefault)
     536             :     {
     537         117 :         return GetParamStr(OGRSTSymbolColor, bDefault);
     538             :     }
     539             : 
     540          11 :     void SetColor(const char *pszColor)
     541             :     {
     542          11 :         SetParamStr(OGRSTSymbolColor, pszColor);
     543          11 :     }
     544             : 
     545         117 :     double Size(GBool &bDefault)
     546             :     {
     547         117 :         return GetParamDbl(OGRSTSymbolSize, bDefault);
     548             :     }
     549             : 
     550           3 :     void SetSize(double dfSize)
     551             :     {
     552           3 :         SetParamDbl(OGRSTSymbolSize, dfSize);
     553           3 :     }
     554             : 
     555           8 :     double SpacingX(GBool &bDefault)
     556             :     {
     557           8 :         return GetParamDbl(OGRSTSymbolDx, bDefault);
     558             :     }
     559             : 
     560           2 :     void SetSpacingX(double dfX)
     561             :     {
     562           2 :         SetParamDbl(OGRSTSymbolDx, dfX);
     563           2 :     }
     564             : 
     565           8 :     double SpacingY(GBool &bDefault)
     566             :     {
     567           8 :         return GetParamDbl(OGRSTSymbolDy, bDefault);
     568             :     }
     569             : 
     570           2 :     void SetSpacingY(double dfY)
     571             :     {
     572           2 :         SetParamDbl(OGRSTSymbolDy, dfY);
     573           2 :     }
     574             : 
     575             :     double Step(GBool &bDefault)
     576             :     {
     577             :         return GetParamDbl(OGRSTSymbolStep, bDefault);
     578             :     }
     579             : 
     580             :     void SetStep(double dfStep)
     581             :     {
     582             :         SetParamDbl(OGRSTSymbolStep, dfStep);
     583             :     }
     584             : 
     585             :     double Offset(GBool &bDefault)
     586             :     {
     587             :         return GetParamDbl(OGRSTSymbolOffset, bDefault);
     588             :     }
     589             : 
     590             :     void SetOffset(double dfOffset)
     591             :     {
     592             :         SetParamDbl(OGRSTSymbolOffset, dfOffset);
     593             :     }
     594             : 
     595             :     double Perp(GBool &bDefault)
     596             :     {
     597             :         return GetParamDbl(OGRSTSymbolPerp, bDefault);
     598             :     }
     599             : 
     600             :     void SetPerp(double dfPerp)
     601             :     {
     602             :         SetParamDbl(OGRSTSymbolPerp, dfPerp);
     603             :     }
     604             : 
     605             :     int Priority(GBool &bDefault)
     606             :     {
     607             :         return GetParamNum(OGRSTSymbolPriority, bDefault);
     608             :     }
     609             : 
     610             :     void SetPriority(int nPriority)
     611             :     {
     612             :         SetParamNum(OGRSTSymbolPriority, nPriority);
     613             :     }
     614             : 
     615           2 :     const char *FontName(GBool &bDefault)
     616             :     {
     617           2 :         return GetParamStr(OGRSTSymbolFontName, bDefault);
     618             :     }
     619             : 
     620             :     void SetFontName(const char *pszFontName)
     621             :     {
     622             :         SetParamStr(OGRSTSymbolFontName, pszFontName);
     623             :     }
     624             : 
     625             :     const char *OColor(GBool &bDefault)
     626             :     {
     627             :         return GetParamStr(OGRSTSymbolOColor, bDefault);
     628             :     }
     629             : 
     630             :     void SetOColor(const char *pszColor)
     631             :     {
     632             :         SetParamStr(OGRSTSymbolOColor, pszColor);
     633             :     }
     634             : 
     635             :     /*****************************************************************/
     636             : 
     637             :     const char *GetParamStr(OGRSTSymbolParam eParam, GBool &bValueIsNull);
     638             :     int GetParamNum(OGRSTSymbolParam eParam, GBool &bValueIsNull);
     639             :     double GetParamDbl(OGRSTSymbolParam eParam, GBool &bValueIsNull);
     640             :     void SetParamStr(OGRSTSymbolParam eParam, const char *pszParamString);
     641             :     void SetParamNum(OGRSTSymbolParam eParam, int nParam);
     642             :     void SetParamDbl(OGRSTSymbolParam eParam, double dfParam);
     643             :     const char *GetStyleString() override;
     644             : };
     645             : 
     646             : /**
     647             :  * This class represents a style label
     648             :  */
     649             : class CPL_DLL OGRStyleLabel : public OGRStyleTool
     650             : {
     651             :   private:
     652             :     OGRStyleValue *m_pasStyleValue;
     653             : 
     654             :     GBool Parse() override;
     655             : 
     656             :     CPL_DISALLOW_COPY_ASSIGN(OGRStyleLabel)
     657             : 
     658             :   public:
     659             :     OGRStyleLabel();
     660             :     ~OGRStyleLabel() override;
     661             : 
     662             :     /*****************************************************************/
     663             :     /* Explicit fct for all parameters defined in the Drawing tools  */
     664             :     /*****************************************************************/
     665             : 
     666           6 :     const char *FontName(GBool &bDefault)
     667             :     {
     668           6 :         return GetParamStr(OGRSTLabelFontName, bDefault);
     669             :     }
     670             : 
     671             :     void SetFontName(const char *pszFontName)
     672             :     {
     673             :         SetParamStr(OGRSTLabelFontName, pszFontName);
     674             :     }
     675             : 
     676           6 :     double Size(GBool &bDefault)
     677             :     {
     678           6 :         return GetParamDbl(OGRSTLabelSize, bDefault);
     679             :     }
     680             : 
     681             :     void SetSize(double dfSize)
     682             :     {
     683             :         SetParamDbl(OGRSTLabelSize, dfSize);
     684             :     }
     685             : 
     686          10 :     const char *TextString(GBool &bDefault)
     687             :     {
     688          10 :         return GetParamStr(OGRSTLabelTextString, bDefault);
     689             :     }
     690             : 
     691             :     void SetTextString(const char *pszTextString)
     692             :     {
     693             :         SetParamStr(OGRSTLabelTextString, pszTextString);
     694             :     }
     695             : 
     696           9 :     double Angle(GBool &bDefault)
     697             :     {
     698           9 :         return GetParamDbl(OGRSTLabelAngle, bDefault);
     699             :     }
     700             : 
     701             :     void SetAngle(double dfAngle)
     702             :     {
     703             :         SetParamDbl(OGRSTLabelAngle, dfAngle);
     704             :     }
     705             : 
     706           8 :     const char *ForeColor(GBool &bDefault)
     707             :     {
     708           8 :         return GetParamStr(OGRSTLabelFColor, bDefault);
     709             :     }
     710             : 
     711           5 :     void SetForColor(const char *pszForColor)
     712             :     {
     713           5 :         SetParamStr(OGRSTLabelFColor, pszForColor);
     714           5 :     }
     715             : 
     716           4 :     const char *BackColor(GBool &bDefault)
     717             :     {
     718           4 :         return GetParamStr(OGRSTLabelBColor, bDefault);
     719             :     }
     720             : 
     721             :     void SetBackColor(const char *pszBackColor)
     722             :     {
     723             :         SetParamStr(OGRSTLabelBColor, pszBackColor);
     724             :     }
     725             : 
     726             :     const char *Placement(GBool &bDefault)
     727             :     {
     728             :         return GetParamStr(OGRSTLabelPlacement, bDefault);
     729             :     }
     730             : 
     731             :     void SetPlacement(const char *pszPlacement)
     732             :     {
     733             :         SetParamStr(OGRSTLabelPlacement, pszPlacement);
     734             :     }
     735             : 
     736           5 :     int Anchor(GBool &bDefault)
     737             :     {
     738           5 :         return GetParamNum(OGRSTLabelAnchor, bDefault);
     739             :     }
     740             : 
     741             :     void SetAnchor(int nAnchor)
     742             :     {
     743             :         SetParamNum(OGRSTLabelAnchor, nAnchor);
     744             :     }
     745             : 
     746           4 :     double SpacingX(GBool &bDefault)
     747             :     {
     748           4 :         return GetParamDbl(OGRSTLabelDx, bDefault);
     749             :     }
     750             : 
     751             :     void SetSpacingX(double dfX)
     752             :     {
     753             :         SetParamDbl(OGRSTLabelDx, dfX);
     754             :     }
     755             : 
     756           4 :     double SpacingY(GBool &bDefault)
     757             :     {
     758           4 :         return GetParamDbl(OGRSTLabelDy, bDefault);
     759             :     }
     760             : 
     761             :     void SetSpacingY(double dfY)
     762             :     {
     763             :         SetParamDbl(OGRSTLabelDy, dfY);
     764             :     }
     765             : 
     766             :     double Perp(GBool &bDefault)
     767             :     {
     768             :         return GetParamDbl(OGRSTLabelPerp, bDefault);
     769             :     }
     770             : 
     771             :     void SetPerp(double dfPerp)
     772             :     {
     773             :         SetParamDbl(OGRSTLabelPerp, dfPerp);
     774             :     }
     775             : 
     776           5 :     GBool Bold(GBool &bDefault)
     777             :     {
     778           5 :         return GetParamNum(OGRSTLabelBold, bDefault);
     779             :     }
     780             : 
     781             :     void SetBold(GBool bBold)
     782             :     {
     783             :         SetParamNum(OGRSTLabelBold, bBold);
     784             :     }
     785             : 
     786           5 :     GBool Italic(GBool &bDefault)
     787             :     {
     788           5 :         return GetParamNum(OGRSTLabelItalic, bDefault);
     789             :     }
     790             : 
     791             :     void SetItalic(GBool bItalic)
     792             :     {
     793             :         SetParamNum(OGRSTLabelItalic, bItalic);
     794             :     }
     795             : 
     796           4 :     GBool Underline(GBool &bDefault)
     797             :     {
     798           4 :         return GetParamNum(OGRSTLabelUnderline, bDefault);
     799             :     }
     800             : 
     801             :     void SetUnderline(GBool bUnderline)
     802             :     {
     803             :         SetParamNum(OGRSTLabelUnderline, bUnderline);
     804             :     }
     805             : 
     806             :     int Priority(GBool &bDefault)
     807             :     {
     808             :         return GetParamNum(OGRSTLabelPriority, bDefault);
     809             :     }
     810             : 
     811             :     void SetPriority(int nPriority)
     812             :     {
     813             :         SetParamNum(OGRSTLabelPriority, nPriority);
     814             :     }
     815             : 
     816             :     GBool Strikeout(GBool &bDefault)
     817             :     {
     818             :         return GetParamNum(OGRSTLabelStrikeout, bDefault);
     819             :     }
     820             : 
     821             :     void SetStrikeout(GBool bStrikeout)
     822             :     {
     823             :         SetParamNum(OGRSTLabelStrikeout, bStrikeout);
     824             :     }
     825             : 
     826           4 :     double Stretch(GBool &bDefault)
     827             :     {
     828           4 :         return GetParamDbl(OGRSTLabelStretch, bDefault);
     829             :     }
     830             : 
     831           5 :     void SetStretch(double dfStretch)
     832             :     {
     833           5 :         SetParamDbl(OGRSTLabelStretch, dfStretch);
     834           5 :     }
     835             : 
     836             :     const char *ShadowColor(GBool &bDefault)
     837             :     {
     838             :         return GetParamStr(OGRSTLabelHColor, bDefault);
     839             :     }
     840             : 
     841             :     void SetShadowColor(const char *pszShadowColor)
     842             :     {
     843             :         SetParamStr(OGRSTLabelHColor, pszShadowColor);
     844             :     }
     845             : 
     846           4 :     const char *OutlineColor(GBool &bDefault)
     847             :     {
     848           4 :         return GetParamStr(OGRSTLabelOColor, bDefault);
     849             :     }
     850             : 
     851             :     void SetOutlineColor(const char *pszOutlineColor)
     852             :     {
     853             :         SetParamStr(OGRSTLabelOColor, pszOutlineColor);
     854             :     }
     855             : 
     856             :     /*****************************************************************/
     857             : 
     858             :     const char *GetParamStr(OGRSTLabelParam eParam, GBool &bValueIsNull);
     859             :     int GetParamNum(OGRSTLabelParam eParam, GBool &bValueIsNull);
     860             :     double GetParamDbl(OGRSTLabelParam eParam, GBool &bValueIsNull);
     861             :     void SetParamStr(OGRSTLabelParam eParam, const char *pszParamString);
     862             :     void SetParamNum(OGRSTLabelParam eParam, int nParam);
     863             :     void SetParamDbl(OGRSTLabelParam eParam, double dfParam);
     864             :     const char *GetStyleString() override;
     865             : };
     866             : 
     867             : //! @endcond
     868             : 
     869             : #endif /* OGR_FEATURESTYLE_INCLUDE */

Generated by: LCOV version 1.14