30 #ifndef OGR_FEATURESTYLE_INCLUDE 31 #define OGR_FEATURESTYLE_INCLUDE 60 typedef struct ogr_style_param
68 typedef struct ogr_style_value
87 char **m_papszStyleTable =
nullptr;
97 GBool AddStyle(
const char *pszName,
const char *pszStyleString);
98 GBool RemoveStyle(
const char *pszName);
99 GBool ModifyStyle(
const char *pszName,
const char *pszStyleString);
101 GBool SaveStyleTable(
const char *pszFilename);
102 GBool LoadStyleTable(
const char *pszFilename);
103 const char *Find(
const char *pszStyleString);
104 GBool IsExist(
const char *pszName);
105 const char *GetStyleName(
const char *pszName);
106 void Print(FILE *fpOut);
109 void ResetStyleStringReading();
110 const char *GetNextStyle();
111 const char *GetLastStyleName();
123 char *m_pszStyleString =
nullptr;
131 GBool SetFeatureStyleString(
OGRFeature *,
const char *pszStyleString=
nullptr,
132 GBool bNoMatching = FALSE);
138 GBool InitStyleString(
const char *pszStyleString =
nullptr);
140 const char *GetStyleName(
const char *pszStyleString=
nullptr);
141 const char *GetStyleByName(
const char *pszStyleName);
143 GBool AddStyle(
const char *pszStyleName,
const char *pszStyleString=
nullptr);
145 const char *GetStyleString(
OGRFeature * =
nullptr);
148 GBool AddPart(
const char *);
150 int GetPartCount(
const char *pszStyleString =
nullptr);
151 OGRStyleTool *GetPart(
int hPartId,
const char *pszStyleString =
nullptr);
156 OGRStyleTable *GetDataSetStyleTable(){
return m_poDataSetStyleTable;}
158 OGRStyleTool *CreateStyleToolFromStyleString(
const char *pszStyleString);
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)
199 static GBool GetRGBFromString(
const char *pszColor,
int &nRed,
int &nGreen,
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);
226 virtual const char *GetStyleString() = 0;
227 void SetStyleString(
const char *pszStyleString);
228 const char *GetStyleString(
const OGRStyleParamId *pasStyleParam ,
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;
Dy.
Definition: ogr_core.h:871
Outline color.
Definition: ogr_core.h:908
Id.
Definition: ogr_core.h:866
Dx.
Definition: ogr_core.h:852
Font name.
Definition: ogr_core.h:888
enum ogr_style_tool_param_symbol_id OGRSTSymbolParam
List of parameters for use with OGRStyleSymbol.
Highlight color.
Definition: ogr_core.h:907
Foreground color.
Definition: ogr_core.h:847
Color.
Definition: ogr_core.h:829
Background color.
Definition: ogr_core.h:848
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:223
Anchor.
Definition: ogr_core.h:895
Size.
Definition: ogr_core.h:869
Priority.
Definition: ogr_core.h:854
Offset.
Definition: ogr_core.h:874
Angle.
Definition: ogr_core.h:891
Join.
Definition: ogr_core.h:835
Color.
Definition: ogr_core.h:868
Underline.
Definition: ogr_core.h:901
enum ogr_style_tool_param_brush_id OGRSTBrushParam
List of parameters for use with OGRStyleBrush.
Dy.
Definition: ogr_core.h:853
enum ogr_style_tool_param_label_id OGRSTLabelParam
List of parameters for use with OGRStyleLabel.
Bold.
Definition: ogr_core.h:899
Ground unit.
Definition: ogr_core.h:816
Id.
Definition: ogr_core.h:849
Cap.
Definition: ogr_core.h:834
Perpendicular.
Definition: ogr_core.h:873
Convenient string class based on std::string.
Definition: cpl_string.h:329
Perpendicular offset.
Definition: ogr_core.h:833
Dx.
Definition: ogr_core.h:896
This class represents a style manager.
Definition: ogr_featurestyle.h:119
Angle.
Definition: ogr_core.h:850
Size.
Definition: ogr_core.h:889
Various convenience functions for working with strings and string lists.
enum ogr_style_tool_class_id OGRSTClassId
OGRStyleTool derived class types (returned by GetType()).
Outline color.
Definition: ogr_core.h:877
Id.
Definition: ogr_core.h:832
enum ogr_style_tool_param_pen_id OGRSTPenParam
List of parameters for use with OGRStylePen.
enum ogr_style_tool_units_id OGRSTUnitId
List of units supported by OGRStyleTools.
Step.
Definition: ogr_core.h:872
Priority.
Definition: ogr_core.h:875
Size.
Definition: ogr_core.h:851
Pattern.
Definition: ogr_core.h:831
Priority.
Definition: ogr_core.h:836
Core portability services for cross-platform OGR code.
Strike out.
Definition: ogr_core.h:903
Stretch.
Definition: ogr_core.h:904
Placement.
Definition: ogr_core.h:894
Various convenience functions for CPL.
Text string.
Definition: ogr_core.h:890
Foreground color.
Definition: ogr_core.h:892
Dx.
Definition: ogr_core.h:870
Perpendicular.
Definition: ogr_core.h:898
Italic.
Definition: ogr_core.h:900
Width.
Definition: ogr_core.h:830
Angle.
Definition: ogr_core.h:867
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:354
This class represents a style table.
Definition: ogr_featurestyle.h:84
Background color.
Definition: ogr_core.h:893
Font name.
Definition: ogr_core.h:876
None.
Definition: ogr_core.h:803
Dy.
Definition: ogr_core.h:897
ogr_style_type
OGR Style type.
Definition: ogr_featurestyle.h:50
Millimeter.
Definition: ogr_core.h:819
enum ogr_style_type OGRSType
OGR Style type.
Priority.
Definition: ogr_core.h:902
#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:989