30#ifndef OGR_FEATURESTYLE_INCLUDE
31#define OGR_FEATURESTYLE_INCLUDE
60typedef struct ogr_style_param
68typedef struct ogr_style_value
84class CPL_DLL OGRStyleTable
87 char **m_papszStyleTable =
nullptr;
97 GBool AddStyle(
const char *pszName,
const char *pszStyleString);
103 const char *
Find(
const char *pszStyleString);
106 void Print(FILE *fpOut);
108 OGRStyleTable *
Clone();
123 char *m_pszStyleString =
nullptr;
132 GBool bNoMatching = FALSE);
140 const char *
GetStyleName(
const char *pszStyleString=
nullptr);
143 GBool AddStyle(
const char *pszStyleName,
const char *pszStyleString=
nullptr);
156 OGRStyleTable *GetDataSetStyleTable(){
return m_poDataSetStyleTable;}
158 OGRStyleTool *CreateStyleToolFromStyleString(
const char *pszStyleString);
165class CPL_DLL OGRStyleTool
168 GBool m_bModified =
false;
169 GBool m_bParsed =
false;
170 double m_dfScale = 1.0;
173 char *m_pszStyleString =
nullptr;
175 virtual GBool Parse() = 0;
181 GBool Parse(
const OGRStyleParamId* pasStyle,
182 OGRStyleValue* pasValue,
194 m_pszStyleString(
nullptr)
197 virtual ~OGRStyleTool();
200 int &nBlue,
int &nTransparence);
201 static int GetSpecificId(
const char *pszId,
const char *pszWanted);
204 GBool IsStyleModified() {
return m_bModified;}
205 void StyleModified() {m_bModified = TRUE;}
207 GBool IsStyleParsed() {
return m_bParsed;}
208 void StyleParsed() {m_bParsed = TRUE;}
214 void SetInternalInputUnitFromParam(
char *pszString);
229 OGRStyleValue *pasStyleValue,
int nSize);
231 const char *
GetParamStr(
const OGRStyleParamId &sStyleParam ,
232 OGRStyleValue &sStyleValue,
233 GBool &bValueIsNull);
235 int GetParamNum(
const OGRStyleParamId &sStyleParam ,
236 OGRStyleValue &sStyleValue,
237 GBool &bValueIsNull);
239 double GetParamDbl(
const OGRStyleParamId &sStyleParam ,
240 OGRStyleValue &sStyleValue,
241 GBool &bValueIsNull);
243 void SetParamStr(
const OGRStyleParamId &sStyleParam ,
244 OGRStyleValue &sStyleValue,
245 const char *pszParamString);
247 void SetParamNum(
const OGRStyleParamId &sStyleParam ,
248 OGRStyleValue &sStyleValue,
251 void SetParamDbl(
const OGRStyleParamId &sStyleParam ,
252 OGRStyleValue &sStyleValue,
269 OGRStyleValue *m_pasStyleValue;
271 GBool Parse()
override;
278 ~OGRStylePen()
override;
285 void SetColor(
const char *pszColor){SetParamStr(
OGRSTPenColor,pszColor);}
287 void SetWidth(
double dfWidth){SetParamDbl(
OGRSTPenWidth,dfWidth);}
289 void SetPattern(
const char *pszPattern){SetParamStr(
OGRSTPenPattern,pszPattern);}
290 const char *Id(
GBool &bDefault){
return GetParamStr(
OGRSTPenId,bDefault);}
291 void SetId(
const char *pszId){SetParamStr(
OGRSTPenId,pszId);}
293 void SetPerpendicularOffset(
double dfPerp){SetParamDbl(
OGRSTPenPerOffset,dfPerp);}
295 void SetCap(
const char *pszCap){SetParamStr(
OGRSTPenCap,pszCap);}
297 void SetJoin(
const char *pszJoin){SetParamStr(
OGRSTPenJoin,pszJoin);}
306 void SetParamStr(
OGRSTPenParam eParam,
const char *pszParamString);
309 const char *GetStyleString()
override;
319 OGRStyleValue *m_pasStyleValue;
321 GBool Parse()
override;
328 ~OGRStyleBrush()
override;
333 void SetForeColor(
const char *pszColor){SetParamStr(
OGRSTBrushFColor,pszColor);}
335 void SetBackColor(
const char *pszColor){SetParamStr(
OGRSTBrushBColor,pszColor);}
337 void SetId(
const char *pszId){SetParamStr(
OGRSTBrushId,pszId);}
343 void SetSpacingX(
double dfX){SetParamDbl(
OGRSTBrushDx,dfX );}
345 void SetSpacingY(
double dfY){SetParamDbl(
OGRSTBrushDy,dfY );}
357 const char *GetStyleString()
override;
367 OGRStyleValue *m_pasStyleValue;
369 GBool Parse()
override;
376 ~OGRStyleSymbol()
override;
383 void SetId(
const char *pszId){ SetParamStr(
OGRSTSymbolId,pszId);}
387 void SetColor(
const char *pszColor){SetParamStr(
OGRSTSymbolColor,pszColor);}
391 void SetSpacingX(
double dfX){SetParamDbl(
OGRSTSymbolDx,dfX );}
393 void SetSpacingY(
double dfY){SetParamDbl(
OGRSTSymbolDy,dfY );}
402 const char *FontName(
GBool &bDefault)
404 void SetFontName(
const char *pszFontName)
417 const char *GetStyleString()
override;
427 OGRStyleValue *m_pasStyleValue;
429 GBool Parse()
override;
436 ~OGRStyleLabel()
override;
443 void SetFontName(
const char *pszFontName){SetParamStr(
OGRSTLabelFontName,pszFontName);}
451 void SetForColor(
const char *pszForColor){SetParamStr(
OGRSTLabelFColor,pszForColor);}
453 void SetBackColor(
const char *pszBackColor){SetParamStr(
OGRSTLabelBColor,pszBackColor);}
455 void SetPlacement(
const char *pszPlacement){SetParamStr(
OGRSTLabelPlacement,pszPlacement);}
459 void SetSpacingX(
double dfX){SetParamDbl(
OGRSTLabelDx,dfX);}
461 void SetSpacingY(
double dfY){SetParamDbl(
OGRSTLabelDy,dfY);}
477 void SetShadowColor(
const char *pszShadowColor){SetParamStr(
OGRSTLabelHColor,pszShadowColor);}
479 void SetOutlineColor(
const char *pszOutlineColor){SetParamStr(
OGRSTLabelOColor,pszOutlineColor);}
489 const char *GetStyleString()
override;
Convenient string class based on std::string.
Definition cpl_string.h:333
A simple feature, including geometry and attributes.
Definition ogr_feature.h:371
GBool InitStyleString(const char *pszStyleString=nullptr)
Initialize style manager from the style string.
Definition ogrfeaturestyle.cpp:305
GBool AddPart(OGRStyleTool *)
Add a part (style tool) to the current style.
Definition ogrfeaturestyle.cpp:526
GBool SetFeatureStyleString(OGRFeature *, const char *pszStyleString=nullptr, GBool bNoMatching=FALSE)
Set a style in a feature.
Definition ogrfeaturestyle.cpp:214
OGRStyleTool * GetPart(int hPartId, const char *pszStyleString=nullptr)
Fetch a part (style tool) from the current style.
Definition ogrfeaturestyle.cpp:661
const char * GetStyleString(OGRFeature *=nullptr)
Get the style string from the style manager.
Definition ogrfeaturestyle.cpp:469
int GetPartCount(const char *pszStyleString=nullptr)
Get the number of parts in a style.
Definition ogrfeaturestyle.cpp:593
const char * GetStyleByName(const char *pszStyleName)
find a style in the current style table.
Definition ogrfeaturestyle.cpp:385
const char * GetStyleName(const char *pszStyleString=nullptr)
Get the name of a style from the style table.
Definition ogrfeaturestyle.cpp:358
const char * InitFromFeature(OGRFeature *)
Initialize style manager from the style string of a feature.
Definition ogrfeaturestyle.cpp:251
GBool AddStyle(const char *pszStyleName, const char *pszStyleString=nullptr)
Add a style to the current style table.
Definition ogrfeaturestyle.cpp:412
OGRStyleMgr(OGRStyleTable *poDataSetStyleTable=nullptr)
Constructor.
Definition ogrfeaturestyle.cpp:137
This class represents a style table.
Definition ogr_featurestyle.h:85
GBool LoadStyleTable(const char *pszFilename)
Load a style table from a file.
Definition ogrfeaturestyle.cpp:1048
OGRStyleTable * Clone()
Duplicate style table.
Definition ogrfeaturestyle.cpp:1208
void Clear()
Clear a style table.
Definition ogrfeaturestyle.cpp:801
const char * GetNextStyle()
Get the next style string from the table.
Definition ogrfeaturestyle.cpp:1260
GBool SaveStyleTable(const char *pszFilename)
Save a style table to a file.
Definition ogrfeaturestyle.cpp:997
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:972
const char * GetLastStyleName()
Get the style name of the last style string fetched with OGR_STBL_GetNextStyle.
Definition ogrfeaturestyle.cpp:1314
GBool RemoveStyle(const char *pszName)
Remove a style in the table by its name.
Definition ogrfeaturestyle.cpp:944
const char * Find(const char *pszStyleString)
Get a style string by name.
Definition ogrfeaturestyle.cpp:1100
void Print(FILE *fpOut)
Print a style table to a FILE pointer.
Definition ogrfeaturestyle.cpp:1151
GBool IsExist(const char *pszName)
Get the index of a style in the table by its name.
Definition ogrfeaturestyle.cpp:1176
void ResetStyleStringReading()
Reset the next style pointer to 0.
Definition ogrfeaturestyle.cpp:1223
const char * GetStyleName(const char *pszName)
Get style name by style string.
Definition ogrfeaturestyle.cpp:846
GBool AddStyle(const char *pszName, const char *pszStyleString)
Add a new style in the table.
Definition ogrfeaturestyle.cpp:888
Various convenience functions for CPL.
int GBool
Type for boolean values (alias to int)
Definition cpl_port.h:223
#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:955
Various convenience functions for working with strings and string lists.
Core portability services for cross-platform OGR code.
@ OGRSTSymbolDy
Dy.
Definition ogr_core.h:951
@ OGRSTSymbolId
Id.
Definition ogr_core.h:946
@ OGRSTSymbolSize
Size.
Definition ogr_core.h:949
@ OGRSTSymbolFontName
Font name.
Definition ogr_core.h:956
@ OGRSTSymbolColor
Color.
Definition ogr_core.h:948
@ OGRSTSymbolDx
Dx.
Definition ogr_core.h:950
@ OGRSTSymbolPerp
Perpendicular.
Definition ogr_core.h:953
@ OGRSTSymbolAngle
Angle.
Definition ogr_core.h:947
@ OGRSTSymbolOColor
Outline color.
Definition ogr_core.h:957
@ OGRSTSymbolPriority
Priority.
Definition ogr_core.h:955
@ OGRSTSymbolStep
Step.
Definition ogr_core.h:952
@ OGRSTSymbolOffset
Offset.
Definition ogr_core.h:954
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:981
@ OGRSTLabelPriority
Priority.
Definition ogr_core.h:982
@ OGRSTLabelBold
Bold.
Definition ogr_core.h:979
@ OGRSTLabelStrikeout
Strike out.
Definition ogr_core.h:983
@ OGRSTLabelBColor
Background color.
Definition ogr_core.h:973
@ OGRSTLabelPlacement
Placement.
Definition ogr_core.h:974
@ OGRSTLabelPerp
Perpendicular.
Definition ogr_core.h:978
@ OGRSTLabelOColor
Outline color.
Definition ogr_core.h:988
@ OGRSTLabelDx
Dx.
Definition ogr_core.h:976
@ OGRSTLabelHColor
Highlight color.
Definition ogr_core.h:987
@ OGRSTLabelItalic
Italic.
Definition ogr_core.h:980
@ OGRSTLabelTextString
Text string.
Definition ogr_core.h:970
@ OGRSTLabelSize
Size.
Definition ogr_core.h:969
@ OGRSTLabelAngle
Angle.
Definition ogr_core.h:971
@ OGRSTLabelFColor
Foreground color.
Definition ogr_core.h:972
@ OGRSTLabelDy
Dy.
Definition ogr_core.h:977
@ OGRSTLabelFontName
Font name.
Definition ogr_core.h:968
@ OGRSTLabelStretch
Stretch.
Definition ogr_core.h:984
@ OGRSTLabelAnchor
Anchor.
Definition ogr_core.h:975
@ OGRSTUGround
Ground unit.
Definition ogr_core.h:896
@ OGRSTUMM
Millimeter.
Definition ogr_core.h:899
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:930
@ OGRSTBrushId
Id.
Definition ogr_core.h:929
@ OGRSTBrushPriority
Priority.
Definition ogr_core.h:934
@ OGRSTBrushBColor
Background color.
Definition ogr_core.h:928
@ OGRSTBrushSize
Size.
Definition ogr_core.h:931
@ OGRSTBrushDy
Dy.
Definition ogr_core.h:933
@ OGRSTBrushFColor
Foreground color.
Definition ogr_core.h:927
@ OGRSTBrushDx
Dx.
Definition ogr_core.h:932
@ OGRSTCNone
None.
Definition ogr_core.h:883
@ OGRSTPenId
Id.
Definition ogr_core.h:912
@ OGRSTPenCap
Cap.
Definition ogr_core.h:914
@ OGRSTPenPerOffset
Perpendicular offset.
Definition ogr_core.h:913
@ OGRSTPenWidth
Width.
Definition ogr_core.h:910
@ OGRSTPenColor
Color.
Definition ogr_core.h:909
@ OGRSTPenJoin
Join.
Definition ogr_core.h:915
@ OGRSTPenPriority
Priority.
Definition ogr_core.h:916
@ OGRSTPenPattern
Pattern.
Definition ogr_core.h:911
ogr_style_type
OGR Style type.
Definition ogr_featurestyle.h:51
enum ogr_style_type OGRSType
OGR Style type.