Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

ogr_featurestyle.h

00001 /****************************************************************************** 00002 * $Id: ogr_featurestyle.h,v 1.6 2002/06/25 14:47:31 warmerda Exp $ 00003 * 00004 * Project: OpenGIS Simple Features Reference Implementation 00005 * Purpose: Define of Feature Representation 00006 * Author: Stephane Villeneuve, stephane.v@videtron.ca 00007 * 00008 ****************************************************************************** 00009 * Copyright (c) 1999, Frank Warmerdam 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining a 00012 * copy of this software and associated documentation files (the "Software"), 00013 * to deal in the Software without restriction, including without limitation 00014 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00015 * and/or sell copies of the Software, and to permit persons to whom the 00016 * Software is furnished to do so, subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be included 00019 * in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00022 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00024 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00026 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00027 * DEALINGS IN THE SOFTWARE. 00028 ****************************************************************************** 00029 * 00030 * $Log: ogr_featurestyle.h,v $ 00031 * Revision 1.6 2002/06/25 14:47:31 warmerda 00032 * CPL_DLL export style api 00033 * 00034 * Revision 1.5 2001/03/17 01:43:53 warmerda 00035 * Don't leave in trailing comma in enum (as submitted by Dale). 00036 * 00037 * Revision 1.4 2001/01/19 21:10:47 warmerda 00038 * replaced tabs 00039 * 00040 * Revision 1.3 2000/12/07 03:42:37 danmo 00041 * REmoved stray comma in OGRSType enum defn 00042 * 00043 * Revision 1.2 2000/08/28 20:26:18 svillene 00044 * Add missing virtual ~() 00045 * 00046 * Revision 1.1 2000/08/18 21:26:01 svillene 00047 * OGR Representation 00048 * 00049 * 00050 */ 00051 00052 #ifndef OGR_FEATURESTYLE_INCLUDE 00053 #define OGR_FEATURESTYLE_INCLUDE 00054 00055 #include "cpl_conv.h" 00056 00057 class OGRFeature; 00058 00059 typedef enum ogr_style_tool_class_id 00060 { 00061 OGRSTCNone, 00062 OGRSTCPen, 00063 OGRSTCBrush, 00064 OGRSTCSymbol, 00065 OGRSTCLabel 00066 } OGRSTClassId; 00067 00068 typedef enum ogr_style_tool_units_id 00069 { 00070 OGRSTUGround, 00071 OGRSTUPixel, 00072 OGRSTUPoints, 00073 OGRSTUMM, 00074 OGRSTUCM, 00075 OGRSTUInches 00076 } OGRSTUnitId; 00077 00078 typedef enum ogr_style_tool_param_pen_id 00079 { 00080 OGRSTPenColor = 0, 00081 OGRSTPenWidth, 00082 OGRSTPenPattern, 00083 OGRSTPenId, 00084 OGRSTPenPerOffset, 00085 OGRSTPenCap, 00086 OGRSTPenJoin, 00087 OGRSTPenPriority, 00088 OGRSTPenLast 00089 00090 } OGRSTPenParam; 00091 00092 typedef enum ogr_style_tool_param_brush_id 00093 { 00094 OGRSTBrushFColor = 0, 00095 OGRSTBrushBColor, 00096 OGRSTBrushId, 00097 OGRSTBrushAngle, 00098 OGRSTBrushSize, 00099 OGRSTBrushDx, 00100 OGRSTBrushDy, 00101 OGRSTBrushPriority, 00102 OGRSTBrushLast 00103 00104 } OGRSTBrushParam; 00105 00106 00107 00108 typedef enum ogr_style_tool_param_symbol_id 00109 { 00110 OGRSTSymbolId = 0, 00111 OGRSTSymbolAngle, 00112 OGRSTSymbolColor, 00113 OGRSTSymbolSize, 00114 OGRSTSymbolDx, 00115 OGRSTSymbolDy, 00116 OGRSTSymbolStep, 00117 OGRSTSymbolPerp, 00118 OGRSTSymbolOffset, 00119 OGRSTSymbolPriority, 00120 OGRSTSymbolLast 00121 00122 } OGRSTSymbolParam; 00123 00124 typedef enum ogr_style_tool_param_label_id 00125 { 00126 OGRSTLabelFontName = 0, 00127 OGRSTLabelSize, 00128 OGRSTLabelTextString, 00129 OGRSTLabelAngle, 00130 OGRSTLabelFColor, 00131 OGRSTLabelBColor, 00132 OGRSTLabelPlacement, 00133 OGRSTLabelAnchor, 00134 OGRSTLabelDx, 00135 OGRSTLabelDy, 00136 OGRSTLabelPerp, 00137 OGRSTLabelBold, 00138 OGRSTLabelItalic, 00139 OGRSTLabelUnderline, 00140 OGRSTLabelPriority, 00141 OGRSTLabelLast 00142 00143 } OGRSTLabelParam; 00144 00145 typedef enum ogr_style_type 00146 { 00147 OGRSTypeString, 00148 OGRSTypeDouble, 00149 OGRSTypeInteger 00150 } OGRSType; 00151 00152 typedef struct ogr_style_param 00153 { 00154 int eParam; 00155 char *pszToken; 00156 GBool bGeoref; 00157 OGRSType eType; 00158 }OGRStyleParamId; 00159 00160 00161 typedef struct ogr_style_value 00162 { 00163 char *pszValue; 00164 double dfValue; 00165 int nValue; 00166 GBool bValid; 00167 OGRSTUnitId eUnit; 00168 }OGRStyleValue; 00169 00170 00171 //Everytime a pszStyleString gived in parameter is NULL, 00172 // the StyleString defined in the Mgr will be use. 00173 00174 class CPL_DLL OGRStyleTable 00175 { 00176 public: 00177 char **m_papszStyleTable; 00178 00179 OGRStyleTable(); 00180 ~OGRStyleTable(); 00181 GBool AddStyle(const char *pszName,const char *pszStyleString); 00182 GBool RemoveStyle(const char *pszName); 00183 GBool ModifyStyle(const char *pszName, const char *pszStyleString); 00184 00185 GBool SaveStyleTable(const char *pszFilename); 00186 GBool LoadStyleTable(const char *pszFilename); 00187 const char *Find(const char *pszStyleString); 00188 GBool IsExist(const char *pszName); 00189 const char *GetStyleName(const char *pszName); 00190 void Print(FILE *fpOut); 00191 void Clear(); 00192 }; 00193 00194 00195 class OGRStyleTool; 00196 00197 class CPL_DLL OGRStyleMgr 00198 { 00199 public: 00200 char *m_pszStyleString; 00201 OGRStyleTable *m_poDataSetStyleTable; 00202 00203 OGRStyleMgr(OGRStyleTable *poDataSetStyleTable =NULL); 00204 00205 ~OGRStyleMgr(); 00206 GBool SetFeatureStyleString(OGRFeature *,const char *pszStyleString=NULL, 00207 GBool bNoMatching = FALSE); 00208 /*it will set in the gived feature the pszStyleString with 00209 the style or will set the style name found in 00210 dataset StyleTable (if bNoMatching == FALSE)*/ 00211 00212 const char *InitFromFeature(OGRFeature *); 00213 GBool InitStyleString(const char *pszStyleString = NULL); 00214 00215 const char *GetStyleName(const char *pszStyleString= NULL); 00216 const char *GetStyleByName(const char *pszStyleName); 00217 00218 GBool AddStyle(const char *pszStyleName, const char *pszStyleString=NULL); 00219 00220 const char *GetStyleString(OGRFeature * = NULL); 00221 00222 GBool AddPart(OGRStyleTool *); 00223 GBool AddPart(const char *); 00224 00225 int GetPartCount(const char *pszStyleString = NULL); 00226 OGRStyleTool *GetPart(int hPartId, const char *pszStyleString = NULL); 00227 00228 /*It could have a reference counting processus for the OGRStyleTable, if 00229 needed */ 00230 00231 OGRStyleTable *GetDataSetStyleTable(){return m_poDataSetStyleTable;} 00232 00233 OGRStyleTool *CreateStyleToolFromStyleString(const char *pszStyleString); 00234 00235 }; 00236 00237 class CPL_DLL OGRStyleTool 00238 { 00239 public: 00240 00241 GBool m_bModified; 00242 GBool m_bParsed; 00243 double m_dfScale; 00244 OGRSTUnitId m_eUnit; 00245 OGRSTClassId m_eClassId; 00246 OGRStyleTool(){} 00247 OGRStyleTool(OGRSTClassId eClassId); 00248 virtual ~OGRStyleTool(); 00249 00250 GBool GetRGBFromString(const char *pszColor, int &nRed, int &nGreen, 00251 int &nBlue, int &nTransparence); 00252 int GetSpecificId(const char *pszId, const char *pszWanted); 00253 00254 GBool IsStyleModified() {return m_bModified;} 00255 void StyleModified() {m_bModified = TRUE;} 00256 00257 GBool IsStyleParsed() {return m_bParsed;} 00258 void StyleParsed() {m_bParsed = TRUE;} 00259 00260 char *m_pszStyleString; 00261 00262 OGRSTClassId GetType(); 00263 00264 void SetInternalInputUnitFromParam(char *pszString); 00265 00266 void SetUnit(OGRSTUnitId,double dfScale = 1.0); //the dfScale will be 00267 //used if we are working with Ground Unit ( ground = paper * scale); 00268 00269 OGRSTUnitId GetUnit(){return m_eUnit;} 00270 00271 /* It's existe two way to set the parameters in the Style, with generic 00272 methodes (using a defined enumeration) or with the reel method specific 00273 for Each style tools.*/ 00274 00275 virtual const char *GetStyleString() = 0; 00276 void SetStyleString(const char *pszStyleString); 00277 const char *GetStyleString(OGRStyleParamId *pasStyleParam , 00278 OGRStyleValue *pasStyleValue, int nSize); 00279 00280 const char *GetParamStr(OGRStyleParamId &sStyleParam , 00281 OGRStyleValue &sStyleValue, 00282 GBool &bValueIsNull); 00283 00284 int GetParamNum(OGRStyleParamId &sStyleParam , 00285 OGRStyleValue &sStyleValue, 00286 GBool &bValueIsNull); 00287 00288 double GetParamDbl(OGRStyleParamId &sStyleParam , 00289 OGRStyleValue &sStyleValue, 00290 GBool &bValueIsNull); 00291 00292 void SetParamStr(OGRStyleParamId &sStyleParam , 00293 OGRStyleValue &sStyleValue, 00294 const char *pszParamString); 00295 00296 void SetParamNum(OGRStyleParamId &sStyleParam , 00297 OGRStyleValue &sStyleValue, 00298 int nParam); 00299 00300 void SetParamDbl(OGRStyleParamId &sStyleParam , 00301 OGRStyleValue &sStyleValue, 00302 double dfParam); 00303 00304 virtual GBool Parse() = 0; 00305 GBool Parse(OGRStyleParamId* pasStyle, 00306 OGRStyleValue* pasValue, 00307 int nCount); 00308 00309 double ComputeWithUnit(double, OGRSTUnitId); 00310 int ComputeWithUnit(int , OGRSTUnitId); 00311 00312 }; 00313 00314 extern OGRStyleParamId CPL_DLL asStylePen[]; 00315 00316 class CPL_DLL OGRStylePen : public OGRStyleTool 00317 { 00318 public: 00319 00320 OGRStyleValue *m_pasStyleValue; 00321 00322 OGRStylePen(); 00323 virtual ~OGRStylePen(); 00324 00325 /**********************************************************************/ 00326 /* Explicite fct for all parameters defined in the Drawing tools Pen */ 00327 /**********************************************************************/ 00328 00329 const char *Color(GBool &bDefault){return GetParamStr(OGRSTPenColor,bDefault);} 00330 void SetColor(const char *pszColor){SetParamStr(OGRSTPenColor,pszColor);} 00331 double Width(GBool &bDefault){return GetParamDbl(OGRSTPenWidth,bDefault);} 00332 void SetWidth(double dfWidth){SetParamDbl(OGRSTPenWidth,dfWidth);} 00333 const char *Pattern(GBool &bDefault){return (char *)GetParamStr(OGRSTPenPattern,bDefault);} 00334 void SetPattern(const char *pszPattern){SetParamStr(OGRSTPenPattern,pszPattern);} 00335 const char *Id(GBool &bDefault){return GetParamStr(OGRSTPenId,bDefault);} 00336 void SetId(const char *pszId){SetParamStr(OGRSTPenId,pszId);} 00337 double PerpendicularOffset(GBool &bDefault){return GetParamDbl(OGRSTPenPerOffset,bDefault);} 00338 void SetPerpendicularOffset(double dfPerp){SetParamDbl(OGRSTPenPerOffset,dfPerp);} 00339 const char *Cap(GBool &bDefault){return GetParamStr(OGRSTPenCap,bDefault);} 00340 void SetCap(const char *pszCap){SetParamStr(OGRSTPenCap,pszCap);} 00341 const char *Join(GBool &bDefault){return GetParamStr(OGRSTPenJoin,bDefault);} 00342 void SetJoin(const char *pszJoin){SetParamStr(OGRSTPenJoin,pszJoin);} 00343 int Priority(GBool &bDefault){return GetParamNum(OGRSTPenPriority,bDefault);} 00344 void SetPriority(int nPriority){SetParamNum(OGRSTPenPriority,nPriority);} 00345 00346 /*****************************************************************/ 00347 00348 inline GBool Parse() 00349 { return OGRStyleTool::Parse(asStylePen,m_pasStyleValue,(int)OGRSTPenLast); 00350 } 00351 00352 inline const char *GetParamStr(OGRSTPenParam eParam, GBool &bValueIsNull) 00353 { return OGRStyleTool::GetParamStr(asStylePen[eParam], 00354 m_pasStyleValue[eParam], 00355 bValueIsNull); 00356 } 00357 inline int GetParamNum(OGRSTPenParam eParam,GBool &bValueIsNull) 00358 { return OGRStyleTool::GetParamNum(asStylePen[eParam], 00359 m_pasStyleValue[eParam],bValueIsNull); 00360 } 00361 inline double GetParamDbl(OGRSTPenParam eParam,GBool &bValueIsNull) 00362 { return OGRStyleTool::GetParamDbl(asStylePen[eParam], 00363 m_pasStyleValue[eParam],bValueIsNull); 00364 } 00365 inline void SetParamStr(OGRSTPenParam eParam, const char *pszParamString) 00366 { OGRStyleTool::SetParamStr(asStylePen[eParam],m_pasStyleValue[eParam], 00367 pszParamString); 00368 } 00369 inline void SetParamNum(OGRSTPenParam eParam, int nParam) 00370 { OGRStyleTool::SetParamNum(asStylePen[eParam], 00371 m_pasStyleValue[eParam],nParam); 00372 } 00373 00374 inline void SetParamDbl(OGRSTPenParam eParam, double dfParam) 00375 { OGRStyleTool::SetParamDbl(asStylePen[eParam], 00376 m_pasStyleValue[eParam],dfParam); 00377 } 00378 inline const char *GetStyleString() 00379 { return OGRStyleTool::GetStyleString(asStylePen,m_pasStyleValue, 00380 (int)OGRSTPenLast); 00381 } 00382 00383 }; 00384 00385 extern OGRStyleParamId CPL_DLL asStyleBrush[]; 00386 00387 class CPL_DLL OGRStyleBrush : public OGRStyleTool 00388 { 00389 public: 00390 00391 OGRStyleValue *m_pasStyleValue; 00392 00393 OGRStyleBrush(); 00394 virtual ~OGRStyleBrush(); 00395 00396 /*a Explicite fct for all parameters defined in the Drawing tools Brush */ 00397 00398 const char *ForeColor(GBool &bDefault){return GetParamStr(OGRSTBrushFColor,bDefault);} 00399 void SetForeColor(const char *pszColor){SetParamStr(OGRSTBrushFColor,pszColor);} 00400 const char *BackColor(GBool &bDefault){return GetParamStr(OGRSTBrushBColor,bDefault);} 00401 void SetBackColor(const char *pszColor){SetParamStr(OGRSTBrushBColor,pszColor);} 00402 const char *Id(GBool &bDefault){ return GetParamStr(OGRSTBrushId,bDefault);} 00403 void SetId(const char *pszId){SetParamStr(OGRSTBrushId,pszId);} 00404 double Angle(GBool &bDefault){return GetParamDbl(OGRSTBrushAngle,bDefault);} 00405 void SetAngle(double dfAngle){SetParamDbl(OGRSTBrushAngle,dfAngle );} 00406 double Size(GBool &bDefault){return GetParamDbl(OGRSTBrushSize,bDefault);} 00407 void SetSize(double dfSize){SetParamDbl(OGRSTBrushSize,dfSize );} 00408 double SpacingX(GBool &bDefault){return GetParamDbl(OGRSTBrushDx,bDefault);} 00409 void SetSpacingX(double dfX){SetParamDbl(OGRSTBrushDx,dfX );} 00410 double SpacingY(GBool &bDefault){return GetParamDbl(OGRSTBrushDy,bDefault);} 00411 void SetSpacingY(double dfY){SetParamDbl(OGRSTBrushDy,dfY );} 00412 int Priority(GBool &bDefault){ return GetParamNum(OGRSTBrushPriority,bDefault);} 00413 void SetPriority(int nPriority){ SetParamNum(OGRSTBrushPriority,nPriority);} 00414 00415 00416 /*****************************************************************/ 00417 00418 inline GBool Parse() 00419 { return OGRStyleTool::Parse(asStyleBrush,m_pasStyleValue, 00420 (int)OGRSTBrushLast); 00421 } 00422 00423 inline const char *GetParamStr(OGRSTBrushParam eParam, GBool &bValueIsNull) 00424 { return OGRStyleTool::GetParamStr(asStyleBrush[eParam], 00425 m_pasStyleValue[eParam], 00426 bValueIsNull); 00427 } 00428 inline int GetParamNum(OGRSTBrushParam eParam,GBool &bValueIsNull) 00429 { return OGRStyleTool::GetParamNum(asStyleBrush[eParam], 00430 m_pasStyleValue[eParam],bValueIsNull); 00431 } 00432 inline double GetParamDbl(OGRSTBrushParam eParam,GBool &bValueIsNull) 00433 { return OGRStyleTool::GetParamDbl(asStyleBrush[eParam], 00434 m_pasStyleValue[eParam],bValueIsNull); 00435 } 00436 inline void SetParamStr(OGRSTBrushParam eParam, const char *pszParamString) 00437 { OGRStyleTool::SetParamStr(asStyleBrush[eParam],m_pasStyleValue[eParam], 00438 pszParamString); 00439 } 00440 inline void SetParamNum(OGRSTBrushParam eParam, int nParam) 00441 { OGRStyleTool::SetParamNum(asStyleBrush[eParam], 00442 m_pasStyleValue[eParam],nParam); 00443 } 00444 00445 inline void SetParamDbl(OGRSTBrushParam eParam, double dfParam) 00446 { OGRStyleTool::SetParamDbl(asStyleBrush[eParam], 00447 m_pasStyleValue[eParam],dfParam); 00448 } 00449 inline const char *GetStyleString() 00450 { return OGRStyleTool::GetStyleString(asStyleBrush,m_pasStyleValue, 00451 (int)OGRSTBrushLast); 00452 } 00453 00454 }; 00455 00456 extern OGRStyleParamId CPL_DLL asStyleSymbol[]; 00457 00458 class CPL_DLL OGRStyleSymbol : public OGRStyleTool 00459 { 00460 public: 00461 00462 OGRStyleValue *m_pasStyleValue; 00463 00464 OGRStyleSymbol(); 00465 virtual ~OGRStyleSymbol(); 00466 00467 /*****************************************************************/ 00468 /* Explicite fct for all parameters defined in the Drawing tools */ 00469 /*****************************************************************/ 00470 00471 const char *Id(GBool &bDefault){return GetParamStr(OGRSTSymbolId,bDefault);} 00472 void SetId(const char *pszId){ SetParamStr(OGRSTSymbolId,pszId);} 00473 double Angle(GBool &bDefault){ return GetParamDbl(OGRSTSymbolAngle,bDefault);} 00474 void SetAngle(double dfAngle){SetParamDbl(OGRSTSymbolAngle,dfAngle );} 00475 const char *Color(GBool &bDefault){return GetParamStr(OGRSTSymbolColor,bDefault);} 00476 void SetColor(const char *pszColor){SetParamStr(OGRSTSymbolColor,pszColor);} 00477 double Size(GBool &bDefault){ return GetParamDbl(OGRSTSymbolSize,bDefault);} 00478 void SetSize(double dfSize){ SetParamDbl(OGRSTSymbolSize,dfSize );} 00479 double SpacingX(GBool &bDefault){return GetParamDbl(OGRSTSymbolDx,bDefault);} 00480 void SetSpacingX(double dfX){SetParamDbl(OGRSTSymbolDx,dfX );} 00481 double SpacingY(GBool &bDefault){return GetParamDbl(OGRSTSymbolDy,bDefault);} 00482 void SetSpacingY(double dfY){SetParamDbl(OGRSTSymbolDy,dfY );} 00483 double Step(GBool &bDefault){return GetParamDbl(OGRSTSymbolStep,bDefault);} 00484 void SetStep(double dfStep){SetParamDbl(OGRSTSymbolStep,dfStep );} 00485 double Offset(GBool &bDefault){return GetParamDbl(OGRSTSymbolOffset,bDefault);} 00486 void SetOffset(double dfOffset){SetParamDbl(OGRSTSymbolOffset,dfOffset );} 00487 double Perp(GBool &bDefault){return GetParamDbl(OGRSTSymbolPerp,bDefault);} 00488 void SetPerp(double dfPerp){SetParamDbl(OGRSTSymbolPerp,dfPerp );} 00489 int Priority(GBool &bDefault){return GetParamNum(OGRSTSymbolPriority,bDefault);} 00490 void SetPriority(int nPriority){SetParamNum(OGRSTSymbolPriority,nPriority);} 00491 00492 00493 00494 /*****************************************************************/ 00495 00496 inline GBool Parse() 00497 { return OGRStyleTool::Parse(asStyleSymbol,m_pasStyleValue, 00498 (int)OGRSTSymbolLast); 00499 } 00500 00501 inline const char *GetParamStr(OGRSTSymbolParam eParam, GBool &bValueIsNull) 00502 { return OGRStyleTool::GetParamStr(asStyleSymbol[eParam], 00503 m_pasStyleValue[eParam], 00504 bValueIsNull); 00505 } 00506 inline int GetParamNum(OGRSTSymbolParam eParam,GBool &bValueIsNull) 00507 { return OGRStyleTool::GetParamNum(asStyleSymbol[eParam], 00508 m_pasStyleValue[eParam],bValueIsNull); 00509 } 00510 inline double GetParamDbl(OGRSTSymbolParam eParam,GBool &bValueIsNull) 00511 { return OGRStyleTool::GetParamDbl(asStyleSymbol[eParam], 00512 m_pasStyleValue[eParam],bValueIsNull); 00513 } 00514 inline void SetParamStr(OGRSTSymbolParam eParam, const char *pszParamString) 00515 { OGRStyleTool::SetParamStr(asStyleSymbol[eParam],m_pasStyleValue[eParam], 00516 pszParamString); 00517 } 00518 inline void SetParamNum(OGRSTSymbolParam eParam, int nParam) 00519 { OGRStyleTool::SetParamNum(asStyleSymbol[eParam], 00520 m_pasStyleValue[eParam],nParam); 00521 } 00522 00523 inline void SetParamDbl(OGRSTSymbolParam eParam, double dfParam) 00524 { OGRStyleTool::SetParamDbl(asStyleSymbol[eParam], 00525 m_pasStyleValue[eParam],dfParam); 00526 } 00527 inline const char *GetStyleString() 00528 { return OGRStyleTool::GetStyleString(asStyleSymbol,m_pasStyleValue, 00529 (int)OGRSTSymbolLast); 00530 } 00531 00532 }; 00533 00534 extern OGRStyleParamId CPL_DLL asStyleLabel[]; 00535 00536 class CPL_DLL OGRStyleLabel : public OGRStyleTool 00537 { 00538 public: 00539 00540 OGRStyleValue *m_pasStyleValue; 00541 00542 OGRStyleLabel(); 00543 virtual ~OGRStyleLabel(); 00544 00545 /*****************************************************************/ 00546 /* Explicite fct for all parameters defined in the Drawing tools */ 00547 /*****************************************************************/ 00548 00549 const char *FontName(GBool &bDefault){return GetParamStr(OGRSTLabelFontName,bDefault);} 00550 void SetFontName(const char *pszFontName){SetParamStr(OGRSTLabelFontName,pszFontName);} 00551 double Size(GBool &bDefault){return GetParamDbl(OGRSTLabelSize,bDefault);} 00552 void SetSize(double dfSize){SetParamDbl(OGRSTLabelSize,dfSize);} 00553 const char *TextString(GBool &bDefault){return GetParamStr(OGRSTLabelTextString,bDefault);} 00554 void SetTextString(const char *pszTextString){SetParamStr(OGRSTLabelTextString,pszTextString);} 00555 double Angle(GBool &bDefault){return GetParamDbl(OGRSTLabelAngle,bDefault);} 00556 void SetAngle(double dfAngle){SetParamDbl(OGRSTLabelAngle,dfAngle);} 00557 const char *ForeColor(GBool &bDefault){return GetParamStr(OGRSTLabelFColor,bDefault);} 00558 void SetForColor(const char *pszForColor){SetParamStr(OGRSTLabelFColor,pszForColor);} 00559 const char *BackColor(GBool &bDefault){return GetParamStr(OGRSTLabelBColor,bDefault);} 00560 void SetBackColor(const char *pszBackColor){SetParamStr(OGRSTLabelBColor,pszBackColor);} 00561 const char *Placement(GBool &bDefault){return GetParamStr(OGRSTLabelPlacement,bDefault);} 00562 void SetPlacement(const char *pszPlacement){SetParamStr(OGRSTLabelPlacement,pszPlacement);} 00563 int Anchor(GBool &bDefault){return GetParamNum(OGRSTLabelAnchor,bDefault);} 00564 void SetAnchor(int nAnchor){SetParamNum(OGRSTLabelAnchor,nAnchor);} 00565 double SpacingX(GBool &bDefault){return GetParamDbl(OGRSTLabelDx,bDefault);} 00566 void SetSpacingX(double dfX){SetParamDbl(OGRSTLabelDx,dfX);} 00567 double SpacingY(GBool &bDefault){return GetParamDbl(OGRSTLabelDy,bDefault);} 00568 void SetSpacingY(double dfY){SetParamDbl(OGRSTLabelDy,dfY);} 00569 double Perp(GBool &bDefault){return GetParamDbl(OGRSTLabelPerp,bDefault);} 00570 void SetPerp(double dfPerp){SetParamDbl(OGRSTLabelPerp,dfPerp);} 00571 GBool Bold(GBool &bDefault){return GetParamNum(OGRSTLabelBold,bDefault);} 00572 void SetBold(GBool bBold){SetParamNum(OGRSTLabelBold,bBold);} 00573 GBool Italic(GBool &bDefault){return GetParamNum(OGRSTLabelItalic,bDefault);} 00574 void SetItalic(GBool bItalic){SetParamNum(OGRSTLabelItalic,bItalic);} 00575 GBool Underline(GBool &bDefault){return GetParamNum(OGRSTLabelUnderline,bDefault);} 00576 void SetUnderline(GBool bUnderline){SetParamNum(OGRSTLabelUnderline,bUnderline);} 00577 int Priority(GBool &bDefault){return GetParamNum(OGRSTLabelPriority,bDefault);} 00578 void SetPriority(int nPriority){SetParamNum(OGRSTLabelPriority,nPriority);} 00579 00580 /*****************************************************************/ 00581 00582 inline GBool Parse() 00583 { return OGRStyleTool::Parse(asStyleLabel,m_pasStyleValue, 00584 (int)OGRSTLabelLast); 00585 } 00586 00587 inline const char *GetParamStr(OGRSTLabelParam eParam, GBool &bValueIsNull) 00588 { return OGRStyleTool::GetParamStr(asStyleLabel[eParam], 00589 m_pasStyleValue[eParam], 00590 bValueIsNull); 00591 } 00592 inline int GetParamNum(OGRSTLabelParam eParam,GBool &bValueIsNull) 00593 { return OGRStyleTool::GetParamNum(asStyleLabel[eParam], 00594 m_pasStyleValue[eParam],bValueIsNull); 00595 } 00596 inline double GetParamDbl(OGRSTLabelParam eParam,GBool &bValueIsNull) 00597 { return OGRStyleTool::GetParamDbl(asStyleLabel[eParam], 00598 m_pasStyleValue[eParam],bValueIsNull); 00599 } 00600 inline void SetParamStr(OGRSTLabelParam eParam, const char *pszParamString) 00601 { OGRStyleTool::SetParamStr(asStyleLabel[eParam],m_pasStyleValue[eParam], 00602 pszParamString); 00603 } 00604 inline void SetParamNum(OGRSTLabelParam eParam, int nParam) 00605 { OGRStyleTool::SetParamNum(asStyleLabel[eParam], 00606 m_pasStyleValue[eParam],nParam); 00607 } 00608 00609 inline void SetParamDbl(OGRSTLabelParam eParam, double dfParam) 00610 { OGRStyleTool::SetParamDbl(asStyleLabel[eParam], 00611 m_pasStyleValue[eParam],dfParam); 00612 } 00613 inline const char *GetStyleString() 00614 { return OGRStyleTool::GetStyleString(asStyleLabel,m_pasStyleValue, 00615 (int)OGRSTLabelLast); 00616 } 00617 00618 }; 00619 00620 #endif 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634

Generated on Thu Jul 29 19:47:50 2004 for OGR by doxygen 1.3.7