13#ifndef OGR_FEATURESTYLE_INCLUDE
14#define OGR_FEATURESTYLE_INCLUDE
43typedef struct ogr_style_param
51typedef struct ogr_style_value
68class CPL_DLL OGRStyleTable
71 char **m_papszStyleTable =
nullptr;
81 GBool AddStyle(
const char *pszName,
const char *pszStyleString);
87 const char *
Find(
const char *pszStyleString);
90 void Print(FILE *fpOut);
92 OGRStyleTable *
Clone();
107 char *m_pszStyleString =
nullptr;
116 const char *pszStyleString =
nullptr,
117 GBool bNoMatching = FALSE);
125 const char *
GetStyleName(
const char *pszStyleString =
nullptr);
129 const char *pszStyleString =
nullptr);
144 return m_poDataSetStyleTable;
148 CreateStyleToolFromStyleString(
const char *pszStyleString);
155class CPL_DLL OGRStyleTool
158 GBool m_bModified =
false;
159 GBool m_bParsed =
false;
160 double m_dfScale = 1.0;
163 char *m_pszStyleString =
nullptr;
165 virtual GBool Parse() = 0;
171 GBool Parse(
const OGRStyleParamId *pasStyle, OGRStyleValue *pasValue,
177 : m_bModified(FALSE), m_bParsed(FALSE), m_dfScale(0.0),
179 m_pszStyleString(
nullptr)
184 virtual ~OGRStyleTool();
187 int &nBlue,
int &nTransparence);
188 static int GetSpecificId(
const char *pszId,
const char *pszWanted);
191 GBool IsStyleModified()
201 GBool IsStyleParsed()
215 void SetInternalInputUnitFromParam(
char *pszString);
219 double dfScale = 1.0);
235 OGRStyleValue *pasStyleValue,
int nSize);
237 const char *
GetParamStr(
const OGRStyleParamId &sStyleParam,
238 const OGRStyleValue &sStyleValue,
239 GBool &bValueIsNull);
241 int GetParamNum(
const OGRStyleParamId &sStyleParam,
242 const OGRStyleValue &sStyleValue,
GBool &bValueIsNull);
244 double GetParamDbl(
const OGRStyleParamId &sStyleParam,
245 const OGRStyleValue &sStyleValue,
GBool &bValueIsNull);
248 const OGRStyleValue &sStyleValue,
251 void SetParamStr(
const OGRStyleParamId &sStyleParam,
252 OGRStyleValue &sStyleValue,
const char *pszParamString);
254 void SetParamNum(
const OGRStyleParamId &sStyleParam,
255 OGRStyleValue &sStyleValue,
int nParam);
257 void SetParamDbl(
const OGRStyleParamId &sStyleParam,
258 OGRStyleValue &sStyleValue,
double dfParam);
273 OGRStyleValue *m_pasStyleValue;
275 GBool Parse()
override;
281 ~OGRStylePen()
override;
287 const char *Color(
GBool &bDefault)
292 void SetColor(
const char *pszColor)
297 double Width(
GBool &bDefault)
307 void SetWidth(
double dfWidth)
312 const char *Pattern(
GBool &bDefault)
317 void SetPattern(
const char *pszPattern)
322 const char *Id(
GBool &bDefault)
327 void SetId(
const char *pszId)
332 double PerpendicularOffset(
GBool &bDefault)
337 void SetPerpendicularOffset(
double dfPerp)
342 const char *Cap(
GBool &bDefault)
347 void SetCap(
const char *pszCap)
352 const char *Join(
GBool &bDefault)
357 void SetJoin(
const char *pszJoin)
362 int Priority(
GBool &bDefault)
367 void SetPriority(
int nPriority)
378 GBool &bValueIsNull);
379 void SetParamStr(
OGRSTPenParam eParam,
const char *pszParamString);
382 const char *GetStyleString()
override;
391 OGRStyleValue *m_pasStyleValue;
393 GBool Parse()
override;
399 ~OGRStyleBrush()
override;
403 const char *ForeColor(
GBool &bDefault)
408 void SetForeColor(
const char *pszColor)
413 const char *BackColor(
GBool &bDefault)
418 void SetBackColor(
const char *pszColor)
423 const char *Id(
GBool &bDefault)
428 void SetId(
const char *pszId)
433 double Angle(
GBool &bDefault)
438 void SetAngle(
double dfAngle)
443 double Size(
GBool &bDefault)
448 void SetSize(
double dfSize)
453 double SpacingX(
GBool &bDefault)
458 void SetSpacingX(
double dfX)
463 double SpacingY(
GBool &bDefault)
468 void SetSpacingY(
double dfY)
473 int Priority(
GBool &bDefault)
478 void SetPriority(
int nPriority)
491 const char *GetStyleString()
override;
500 OGRStyleValue *m_pasStyleValue;
502 GBool Parse()
override;
508 ~OGRStyleSymbol()
override;
514 const char *Id(
GBool &bDefault)
519 void SetId(
const char *pszId)
524 double Angle(
GBool &bDefault)
529 void SetAngle(
double dfAngle)
534 const char *Color(
GBool &bDefault)
539 void SetColor(
const char *pszColor)
544 double Size(
GBool &bDefault)
549 void SetSize(
double dfSize)
554 double SpacingX(
GBool &bDefault)
559 void SetSpacingX(
double dfX)
564 double SpacingY(
GBool &bDefault)
569 void SetSpacingY(
double dfY)
574 double Step(
GBool &bDefault)
579 void SetStep(
double dfStep)
584 double Offset(
GBool &bDefault)
589 void SetOffset(
double dfOffset)
594 double Perp(
GBool &bDefault)
599 void SetPerp(
double dfPerp)
604 int Priority(
GBool &bDefault)
609 void SetPriority(
int nPriority)
614 const char *FontName(
GBool &bDefault)
619 void SetFontName(
const char *pszFontName)
624 const char *OColor(
GBool &bDefault)
629 void SetOColor(
const char *pszColor)
642 const char *GetStyleString()
override;
651 OGRStyleValue *m_pasStyleValue;
653 GBool Parse()
override;
659 ~OGRStyleLabel()
override;
665 const char *FontName(
GBool &bDefault)
670 void SetFontName(
const char *pszFontName)
675 double Size(
GBool &bDefault)
680 void SetSize(
double dfSize)
685 const char *TextString(
GBool &bDefault)
690 void SetTextString(
const char *pszTextString)
695 double Angle(
GBool &bDefault)
700 void SetAngle(
double dfAngle)
705 const char *ForeColor(
GBool &bDefault)
710 void SetForColor(
const char *pszForColor)
715 const char *BackColor(
GBool &bDefault)
720 void SetBackColor(
const char *pszBackColor)
725 const char *Placement(
GBool &bDefault)
730 void SetPlacement(
const char *pszPlacement)
735 int Anchor(
GBool &bDefault)
740 void SetAnchor(
int nAnchor)
745 double SpacingX(
GBool &bDefault)
750 void SetSpacingX(
double dfX)
755 double SpacingY(
GBool &bDefault)
760 void SetSpacingY(
double dfY)
765 double Perp(
GBool &bDefault)
770 void SetPerp(
double dfPerp)
780 void SetBold(
GBool bBold)
790 void SetItalic(
GBool bItalic)
800 void SetUnderline(
GBool bUnderline)
805 int Priority(
GBool &bDefault)
810 void SetPriority(
int nPriority)
820 void SetStrikeout(
GBool bStrikeout)
825 double Stretch(
GBool &bDefault)
830 void SetStretch(
double dfStretch)
835 const char *ShadowColor(
GBool &bDefault)
840 void SetShadowColor(
const char *pszShadowColor)
845 const char *OutlineColor(
GBool &bDefault)
850 void SetOutlineColor(
const char *pszOutlineColor)
863 const char *GetStyleString()
override;
Convenient string class based on std::string.
Definition cpl_string.h:320
A simple feature, including geometry and attributes.
Definition ogr_feature.h:934
GBool InitStyleString(const char *pszStyleString=nullptr)
Initialize style manager from the style string.
Definition ogrfeaturestyle.cpp:283
GBool AddPart(OGRStyleTool *)
Add a part (style tool) to the current style.
Definition ogrfeaturestyle.cpp:511
GBool SetFeatureStyleString(OGRFeature *, const char *pszStyleString=nullptr, GBool bNoMatching=FALSE)
Set a style in a feature.
Definition ogrfeaturestyle.cpp:188
OGRStyleTool * GetPart(int hPartId, const char *pszStyleString=nullptr)
Fetch a part (style tool) from the current style.
Definition ogrfeaturestyle.cpp:643
const char * GetStyleString(OGRFeature *=nullptr)
Get the style string from the style manager.
Definition ogrfeaturestyle.cpp:454
int GetPartCount(const char *pszStyleString=nullptr)
Get the number of parts in a style.
Definition ogrfeaturestyle.cpp:576
const char * GetStyleByName(const char *pszStyleName)
find a style in the current style table.
Definition ogrfeaturestyle.cpp:370
const char * GetStyleName(const char *pszStyleString=nullptr)
Get the name of a style from the style table.
Definition ogrfeaturestyle.cpp:342
const char * InitFromFeature(OGRFeature *)
Initialize style manager from the style string of a feature.
Definition ogrfeaturestyle.cpp:225
GBool AddStyle(const char *pszStyleName, const char *pszStyleString=nullptr)
Add a style to the current style table.
Definition ogrfeaturestyle.cpp:397
OGRStyleMgr(OGRStyleTable *poDataSetStyleTable=nullptr)
Constructor.
Definition ogrfeaturestyle.cpp:111
This class represents a style table.
Definition ogr_featurestyle.h:69
GBool LoadStyleTable(const char *pszFilename)
Load a style table from a file.
Definition ogrfeaturestyle.cpp:1023
OGRStyleTable * Clone()
Duplicate style table.
Definition ogrfeaturestyle.cpp:1182
void Clear()
Clear a style table.
Definition ogrfeaturestyle.cpp:778
const char * GetNextStyle()
Get the next style string from the table.
Definition ogrfeaturestyle.cpp:1234
GBool SaveStyleTable(const char *pszFilename)
Save a style table to a file.
Definition ogrfeaturestyle.cpp:973
GBool ModifyStyle(const char *pszName, const char *pszStyleString)
Modify a style in the table by its name If the style does not exist, it will be added.
Definition ogrfeaturestyle.cpp:948
const char * GetLastStyleName()
Get the style name of the last style string fetched with OGR_STBL_GetNextStyle.
Definition ogrfeaturestyle.cpp:1288
GBool RemoveStyle(const char *pszName)
Remove a style in the table by its name.
Definition ogrfeaturestyle.cpp:920
const char * Find(const char *pszStyleString)
Get a style string by name.
Definition ogrfeaturestyle.cpp:1074
void Print(FILE *fpOut)
Print a style table to a FILE pointer.
Definition ogrfeaturestyle.cpp:1125
GBool IsExist(const char *pszName)
Get the index of a style in the table by its name.
Definition ogrfeaturestyle.cpp:1150
void ResetStyleStringReading()
Reset the next style pointer to 0.
Definition ogrfeaturestyle.cpp:1197
const char * GetStyleName(const char *pszName)
Get style name by style string.
Definition ogrfeaturestyle.cpp:823
GBool AddStyle(const char *pszName, const char *pszStyleString)
Add a new style in the table.
Definition ogrfeaturestyle.cpp:864
Various convenience functions for CPL.
int GBool
Type for boolean values (alias to int).
Definition cpl_port.h:186
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition cpl_port.h:936
Various convenience functions for working with strings and string lists.
Core portability services for cross-platform OGR code.
@ OGRSTSymbolDy
Dy.
Definition ogr_core.h:1151
@ OGRSTSymbolId
Id.
Definition ogr_core.h:1146
@ OGRSTSymbolSize
Size.
Definition ogr_core.h:1149
@ OGRSTSymbolFontName
Font name.
Definition ogr_core.h:1156
@ OGRSTSymbolColor
Color.
Definition ogr_core.h:1148
@ OGRSTSymbolDx
Dx.
Definition ogr_core.h:1150
@ OGRSTSymbolPerp
Perpendicular.
Definition ogr_core.h:1153
@ OGRSTSymbolAngle
Angle.
Definition ogr_core.h:1147
@ OGRSTSymbolOColor
Outline color.
Definition ogr_core.h:1157
@ OGRSTSymbolPriority
Priority.
Definition ogr_core.h:1155
@ OGRSTSymbolStep
Step.
Definition ogr_core.h:1152
@ OGRSTSymbolOffset
Offset.
Definition ogr_core.h:1154
enum ogr_style_tool_param_symbol_id OGRSTSymbolParam
List of parameters for use with OGRStyleSymbol.
enum ogr_style_tool_param_pen_id OGRSTPenParam
List of parameters for use with OGRStylePen.
@ OGRSTLabelUnderline
Underline.
Definition ogr_core.h:1181
@ OGRSTLabelPriority
Priority.
Definition ogr_core.h:1182
@ OGRSTLabelBold
Bold.
Definition ogr_core.h:1179
@ OGRSTLabelStrikeout
Strike out.
Definition ogr_core.h:1183
@ OGRSTLabelBColor
Background color.
Definition ogr_core.h:1173
@ OGRSTLabelPlacement
Placement.
Definition ogr_core.h:1174
@ OGRSTLabelPerp
Perpendicular.
Definition ogr_core.h:1178
@ OGRSTLabelOColor
Outline color.
Definition ogr_core.h:1188
@ OGRSTLabelDx
Dx.
Definition ogr_core.h:1176
@ OGRSTLabelHColor
Highlight color.
Definition ogr_core.h:1187
@ OGRSTLabelItalic
Italic.
Definition ogr_core.h:1180
@ OGRSTLabelTextString
Text string.
Definition ogr_core.h:1170
@ OGRSTLabelSize
Size.
Definition ogr_core.h:1169
@ OGRSTLabelAngle
Angle.
Definition ogr_core.h:1171
@ OGRSTLabelFColor
Foreground color.
Definition ogr_core.h:1172
@ OGRSTLabelDy
Dy.
Definition ogr_core.h:1177
@ OGRSTLabelFontName
Font name.
Definition ogr_core.h:1168
@ OGRSTLabelStretch
Stretch.
Definition ogr_core.h:1184
@ OGRSTLabelAnchor
Anchor.
Definition ogr_core.h:1175
@ OGRSTUGround
Ground unit.
Definition ogr_core.h:1096
@ OGRSTUMM
Millimeter.
Definition ogr_core.h:1099
enum ogr_style_tool_class_id OGRSTClassId
OGRStyleTool derived class types (returned by GetType()).
enum ogr_style_tool_units_id OGRSTUnitId
List of units supported by OGRStyleTools.
enum ogr_style_tool_param_brush_id OGRSTBrushParam
List of parameters for use with OGRStyleBrush.
enum ogr_style_tool_param_label_id OGRSTLabelParam
List of parameters for use with OGRStyleLabel.
@ OGRSTBrushAngle
Angle.
Definition ogr_core.h:1130
@ OGRSTBrushId
Id.
Definition ogr_core.h:1129
@ OGRSTBrushPriority
Priority.
Definition ogr_core.h:1134
@ OGRSTBrushBColor
Background color.
Definition ogr_core.h:1128
@ OGRSTBrushSize
Size.
Definition ogr_core.h:1131
@ OGRSTBrushDy
Dy.
Definition ogr_core.h:1133
@ OGRSTBrushFColor
Foreground color.
Definition ogr_core.h:1127
@ OGRSTBrushDx
Dx.
Definition ogr_core.h:1132
@ OGRSTCNone
None.
Definition ogr_core.h:1083
@ OGRSTPenId
Id.
Definition ogr_core.h:1112
@ OGRSTPenCap
Cap.
Definition ogr_core.h:1114
@ OGRSTPenPerOffset
Perpendicular offset.
Definition ogr_core.h:1113
@ OGRSTPenWidth
Width.
Definition ogr_core.h:1110
@ OGRSTPenColor
Color.
Definition ogr_core.h:1109
@ OGRSTPenJoin
Join.
Definition ogr_core.h:1115
@ OGRSTPenPriority
Priority.
Definition ogr_core.h:1116
@ OGRSTPenPattern
Pattern.
Definition ogr_core.h:1111
ogr_style_type
OGR Style type.
Definition ogr_featurestyle.h:34
enum ogr_style_type OGRSType
OGR Style type.