30 #ifndef OGR_FEATURESTYLE_INCLUDE
31 #define OGR_FEATURESTYLE_INCLUDE
60 typedef struct ogr_style_param
68 typedef struct ogr_style_value
88 char **m_papszStyleTable =
nullptr;
98 GBool AddStyle(
const char *pszName,
const char *pszStyleString);
99 GBool RemoveStyle(
const char *pszName);
100 GBool ModifyStyle(
const char *pszName,
const char *pszStyleString);
102 GBool SaveStyleTable(
const char *pszFilename);
103 GBool LoadStyleTable(
const char *pszFilename);
104 const char *Find(
const char *pszStyleString);
105 GBool IsExist(
const char *pszName);
106 const char *GetStyleName(
const char *pszName);
107 void Print(FILE *fpOut);
110 void ResetStyleStringReading();
111 const char *GetNextStyle();
112 const char *GetLastStyleName();
124 char *m_pszStyleString =
nullptr;
133 const char *pszStyleString =
nullptr,
134 GBool bNoMatching = FALSE);
140 GBool InitStyleString(
const char *pszStyleString =
nullptr);
142 const char *GetStyleName(
const char *pszStyleString =
nullptr);
143 const char *GetStyleByName(
const char *pszStyleName);
145 GBool AddStyle(
const char *pszStyleName,
146 const char *pszStyleString =
nullptr);
148 const char *GetStyleString(
OGRFeature * =
nullptr);
151 GBool AddPart(
const char *);
153 int GetPartCount(
const char *pszStyleString =
nullptr);
154 OGRStyleTool *GetPart(
int hPartId,
const char *pszStyleString =
nullptr);
161 return m_poDataSetStyleTable;
165 CreateStyleToolFromStyleString(
const char *pszStyleString);
175 GBool m_bModified =
false;
176 GBool m_bParsed =
false;
177 double m_dfScale = 1.0;
180 char *m_pszStyleString =
nullptr;
182 virtual GBool Parse() = 0;
188 GBool Parse(
const OGRStyleParamId *pasStyle, OGRStyleValue *pasValue,
194 : m_bModified(FALSE), m_bParsed(FALSE), m_dfScale(0.0),
196 m_pszStyleString(
nullptr)
203 static GBool GetRGBFromString(
const char *pszColor,
int &nRed,
int &nGreen,
204 int &nBlue,
int &nTransparence);
205 static int GetSpecificId(
const char *pszId,
const char *pszWanted);
208 GBool IsStyleModified()
218 GBool IsStyleParsed()
232 void SetInternalInputUnitFromParam(
char *pszString);
236 double dfScale = 1.0);
250 void SetStyleString(
const char *pszStyleString);
251 const char *GetStyleString(
const OGRStyleParamId *pasStyleParam,
252 OGRStyleValue *pasStyleValue,
int nSize);
254 const char *GetParamStr(
const OGRStyleParamId &sStyleParam,
255 const OGRStyleValue &sStyleValue,
256 GBool &bValueIsNull);
258 int GetParamNum(
const OGRStyleParamId &sStyleParam,
259 const OGRStyleValue &sStyleValue,
GBool &bValueIsNull);
261 double GetParamDbl(
const OGRStyleParamId &sStyleParam,
262 const OGRStyleValue &sStyleValue,
GBool &bValueIsNull);
264 void SetParamStr(
const OGRStyleParamId &sStyleParam,
265 OGRStyleValue &sStyleValue,
const char *pszParamString);
267 void SetParamNum(
const OGRStyleParamId &sStyleParam,
268 OGRStyleValue &sStyleValue,
int nParam);
270 void SetParamDbl(
const OGRStyleParamId &sStyleParam,
271 OGRStyleValue &sStyleValue,
double dfParam);
286 OGRStyleValue *m_pasStyleValue;
288 GBool Parse()
override;
294 ~OGRStylePen()
override;
300 const char *Color(
GBool &bDefault)
305 void SetColor(
const char *pszColor)
310 double Width(
GBool &bDefault)
315 void SetWidth(
double dfWidth)
320 const char *Pattern(
GBool &bDefault)
325 void SetPattern(
const char *pszPattern)
330 const char *Id(
GBool &bDefault)
335 void SetId(
const char *pszId)
340 double PerpendicularOffset(
GBool &bDefault)
345 void SetPerpendicularOffset(
double dfPerp)
350 const char *Cap(
GBool &bDefault)
355 void SetCap(
const char *pszCap)
360 const char *Join(
GBool &bDefault)
365 void SetJoin(
const char *pszJoin)
370 int Priority(
GBool &bDefault)
375 void SetPriority(
int nPriority)
385 void SetParamStr(
OGRSTPenParam eParam,
const char *pszParamString);
388 const char *GetStyleString()
override;
397 OGRStyleValue *m_pasStyleValue;
399 GBool Parse()
override;
405 ~OGRStyleBrush()
override;
409 const char *ForeColor(
GBool &bDefault)
414 void SetForeColor(
const char *pszColor)
419 const char *BackColor(
GBool &bDefault)
424 void SetBackColor(
const char *pszColor)
429 const char *Id(
GBool &bDefault)
434 void SetId(
const char *pszId)
439 double Angle(
GBool &bDefault)
444 void SetAngle(
double dfAngle)
449 double Size(
GBool &bDefault)
454 void SetSize(
double dfSize)
459 double SpacingX(
GBool &bDefault)
464 void SetSpacingX(
double dfX)
469 double SpacingY(
GBool &bDefault)
474 void SetSpacingY(
double dfY)
479 int Priority(
GBool &bDefault)
484 void SetPriority(
int nPriority)
497 const char *GetStyleString()
override;
506 OGRStyleValue *m_pasStyleValue;
508 GBool Parse()
override;
514 ~OGRStyleSymbol()
override;
520 const char *Id(
GBool &bDefault)
525 void SetId(
const char *pszId)
530 double Angle(
GBool &bDefault)
535 void SetAngle(
double dfAngle)
540 const char *Color(
GBool &bDefault)
545 void SetColor(
const char *pszColor)
550 double Size(
GBool &bDefault)
555 void SetSize(
double dfSize)
560 double SpacingX(
GBool &bDefault)
565 void SetSpacingX(
double dfX)
570 double SpacingY(
GBool &bDefault)
575 void SetSpacingY(
double dfY)
580 double Step(
GBool &bDefault)
585 void SetStep(
double dfStep)
590 double Offset(
GBool &bDefault)
595 void SetOffset(
double dfOffset)
600 double Perp(
GBool &bDefault)
605 void SetPerp(
double dfPerp)
610 int Priority(
GBool &bDefault)
615 void SetPriority(
int nPriority)
620 const char *FontName(
GBool &bDefault)
625 void SetFontName(
const char *pszFontName)
630 const char *OColor(
GBool &bDefault)
635 void SetOColor(
const char *pszColor)
648 const char *GetStyleString()
override;
657 OGRStyleValue *m_pasStyleValue;
659 GBool Parse()
override;
665 ~OGRStyleLabel()
override;
671 const char *FontName(
GBool &bDefault)
676 void SetFontName(
const char *pszFontName)
681 double Size(
GBool &bDefault)
686 void SetSize(
double dfSize)
691 const char *TextString(
GBool &bDefault)
696 void SetTextString(
const char *pszTextString)
701 double Angle(
GBool &bDefault)
706 void SetAngle(
double dfAngle)
711 const char *ForeColor(
GBool &bDefault)
716 void SetForColor(
const char *pszForColor)
721 const char *BackColor(
GBool &bDefault)
726 void SetBackColor(
const char *pszBackColor)
731 const char *Placement(
GBool &bDefault)
736 void SetPlacement(
const char *pszPlacement)
741 int Anchor(
GBool &bDefault)
746 void SetAnchor(
int nAnchor)
751 double SpacingX(
GBool &bDefault)
756 void SetSpacingX(
double dfX)
761 double SpacingY(
GBool &bDefault)
766 void SetSpacingY(
double dfY)
771 double Perp(
GBool &bDefault)
776 void SetPerp(
double dfPerp)
786 void SetBold(
GBool bBold)
796 void SetItalic(
GBool bItalic)
806 void SetUnderline(
GBool bUnderline)
811 int Priority(
GBool &bDefault)
816 void SetPriority(
int nPriority)
826 void SetStrikeout(
GBool bStrikeout)
831 double Stretch(
GBool &bDefault)
836 void SetStretch(
double dfStretch)
841 const char *ShadowColor(
GBool &bDefault)
846 void SetShadowColor(
const char *pszShadowColor)
851 const char *OutlineColor(
GBool &bDefault)
856 void SetOutlineColor(
const char *pszOutlineColor)
869 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:893
This class represents a style manager.
Definition: ogr_featurestyle.h:121
This class represents a style table.
Definition: ogr_featurestyle.h:86
Various convenience functions for CPL.
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:196
#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:1042
Various convenience functions for working with strings and string lists.
Core portability services for cross-platform OGR code.
@ OGRSTSymbolDy
Dy.
Definition: ogr_core.h:1188
@ OGRSTSymbolId
Id.
Definition: ogr_core.h:1183
@ OGRSTSymbolSize
Size.
Definition: ogr_core.h:1186
@ OGRSTSymbolFontName
Font name.
Definition: ogr_core.h:1193
@ OGRSTSymbolColor
Color.
Definition: ogr_core.h:1185
@ OGRSTSymbolDx
Dx.
Definition: ogr_core.h:1187
@ OGRSTSymbolPerp
Perpendicular.
Definition: ogr_core.h:1190
@ OGRSTSymbolAngle
Angle.
Definition: ogr_core.h:1184
@ OGRSTSymbolOColor
Outline color.
Definition: ogr_core.h:1194
@ OGRSTSymbolPriority
Priority.
Definition: ogr_core.h:1192
@ OGRSTSymbolStep
Step.
Definition: ogr_core.h:1189
@ OGRSTSymbolOffset
Offset.
Definition: ogr_core.h:1191
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:1218
@ OGRSTLabelPriority
Priority.
Definition: ogr_core.h:1219
@ OGRSTLabelBold
Bold.
Definition: ogr_core.h:1216
@ OGRSTLabelStrikeout
Strike out.
Definition: ogr_core.h:1220
@ OGRSTLabelBColor
Background color.
Definition: ogr_core.h:1210
@ OGRSTLabelPlacement
Placement.
Definition: ogr_core.h:1211
@ OGRSTLabelPerp
Perpendicular.
Definition: ogr_core.h:1215
@ OGRSTLabelOColor
Outline color.
Definition: ogr_core.h:1225
@ OGRSTLabelDx
Dx.
Definition: ogr_core.h:1213
@ OGRSTLabelHColor
Highlight color.
Definition: ogr_core.h:1224
@ OGRSTLabelItalic
Italic.
Definition: ogr_core.h:1217
@ OGRSTLabelTextString
Text string.
Definition: ogr_core.h:1207
@ OGRSTLabelSize
Size.
Definition: ogr_core.h:1206
@ OGRSTLabelAngle
Angle.
Definition: ogr_core.h:1208
@ OGRSTLabelFColor
Foreground color.
Definition: ogr_core.h:1209
@ OGRSTLabelDy
Dy.
Definition: ogr_core.h:1214
@ OGRSTLabelFontName
Font name.
Definition: ogr_core.h:1205
@ OGRSTLabelStretch
Stretch.
Definition: ogr_core.h:1221
@ OGRSTLabelAnchor
Anchor.
Definition: ogr_core.h:1212
@ OGRSTUGround
Ground unit.
Definition: ogr_core.h:1133
@ OGRSTUMM
Millimeter.
Definition: ogr_core.h:1136
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:1167
@ OGRSTBrushId
Id.
Definition: ogr_core.h:1166
@ OGRSTBrushPriority
Priority.
Definition: ogr_core.h:1171
@ OGRSTBrushBColor
Background color.
Definition: ogr_core.h:1165
@ OGRSTBrushSize
Size.
Definition: ogr_core.h:1168
@ OGRSTBrushDy
Dy.
Definition: ogr_core.h:1170
@ OGRSTBrushFColor
Foreground color.
Definition: ogr_core.h:1164
@ OGRSTBrushDx
Dx.
Definition: ogr_core.h:1169
@ OGRSTCNone
None.
Definition: ogr_core.h:1120
@ OGRSTPenId
Id.
Definition: ogr_core.h:1149
@ OGRSTPenCap
Cap.
Definition: ogr_core.h:1151
@ OGRSTPenPerOffset
Perpendicular offset.
Definition: ogr_core.h:1150
@ OGRSTPenWidth
Width.
Definition: ogr_core.h:1147
@ OGRSTPenColor
Color.
Definition: ogr_core.h:1146
@ OGRSTPenJoin
Join.
Definition: ogr_core.h:1152
@ OGRSTPenPriority
Priority.
Definition: ogr_core.h:1153
@ OGRSTPenPattern
Pattern.
Definition: ogr_core.h:1148
ogr_style_type
OGR Style type.
Definition: ogr_featurestyle.h:51
enum ogr_style_type OGRSType
OGR Style type.