OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
ossimFontInformation Class Reference

#include <ossimFontInformation.h>

Public Member Functions

 ossimFontInformation ()
 
 ossimFontInformation (const ossimString &family, const ossimString &style, const ossimIpt &pointSize, bool fixedFlag, const ossimDpt &scale=ossimDpt(1.0, 1.0), double rotation=0.0, const ossimDpt &shear=ossimDpt(0.0, 0.0))
 
 ossimFontInformation (const ossimFontInformation &rhs)
 
bool isFixed () const
 
bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Saves the current state of this object. More...
 
bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
bool operator== (const ossimFontInformation &rhs) const
 
bool operator!= (const ossimFontInformation &rhs) const
 
const ossimFontInformationoperator= (const ossimFontInformation &rhs)
 

Public Attributes

ossimString theFamilyName
 
ossimString theStyleName
 
ossimIpt thePointSize
 
bool theFixedFlag
 
ossimDpt theScale
 
double theRotation
 
ossimDpt theShear
 

Static Public Attributes

static const char * FAMILY_NAME_KW = "family_name"
 
static const char * STYLE_NAME_KW = "style_name"
 
static const char * POINT_SIZE_KW = "point_size"
 
static const char * POINT_SIZE_X_KW = "point_size_x"
 
static const char * POINT_SIZE_Y_KW = "point_size_y"
 
static const char * FIXED_FLAG_KW = "fixed_flag"
 
static const char * SHEAR_KW = "shear"
 
static const char * SHEAR_X_KW = "shear_x"
 
static const char * SHEAR_Y_KW = "shear_y"
 
static const char * SCALE_KW = "scale"
 
static const char * SCALE_X_KW = "scale_x"
 
static const char * SCALE_Y_KW = "scale_y"
 
static const char * ROTATION_KW = "rotation"
 

Friends

OSSIMDLLEXPORT std::ostream & operator<< (std::ostream &out, const ossimFontInformation &rhs)
 

Detailed Description

Definition at line 19 of file ossimFontInformation.h.

Constructor & Destructor Documentation

◆ ossimFontInformation() [1/3]

ossimFontInformation::ossimFontInformation ( )

Definition at line 42 of file ossimFontInformation.cpp.

43  :theFamilyName(""),
44  theStyleName(""),
45  thePointSize(0,0),
46  theFixedFlag(false),
47  theScale(1.0,1.0),
48  theRotation(0.0),
49  theShear(0.0,0.0)
50 {
51 }

◆ ossimFontInformation() [2/3]

ossimFontInformation::ossimFontInformation ( const ossimString family,
const ossimString style,
const ossimIpt pointSize,
bool  fixedFlag,
const ossimDpt scale = ossimDpt(1.0,1.0),
double  rotation = 0.0,
const ossimDpt shear = ossimDpt(0.0, 0.0) 
)

Definition at line 53 of file ossimFontInformation.cpp.

60  :theFamilyName(family),
61  theStyleName(style),
62  thePointSize(pointSize),
63  theFixedFlag(fixedFlag),
64  theScale(scale),
65  theRotation(rotation),
66  theShear(shear)
67 {}

◆ ossimFontInformation() [3/3]

ossimFontInformation::ossimFontInformation ( const ossimFontInformation rhs)

Member Function Documentation

◆ isFixed()

bool ossimFontInformation::isFixed ( ) const

Definition at line 80 of file ossimFontInformation.cpp.

References theFixedFlag.

81 {
82  return theFixedFlag;
83 }

◆ loadState()

bool ossimFontInformation::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Keywords:

family_name: style_name: fixed_flag: point_size: ( x, y ) scale: ( x, y ) shear: ( x, y ) rotation:

point_size_x: (deprecated) point_size_y: (deprecated) scale_x: (deprecated) scale_y: (deprecated) shear_x: (deprecated) shear_y: (deprecated)

Definition at line 152 of file ossimFontInformation.cpp.

References FAMILY_NAME_KW, ossimKeywordlist::find(), FIXED_FLAG_KW, POINT_SIZE_KW, POINT_SIZE_X_KW, POINT_SIZE_Y_KW, ROTATION_KW, SCALE_KW, SCALE_X_KW, SCALE_Y_KW, SHEAR_KW, SHEAR_X_KW, SHEAR_Y_KW, STYLE_NAME_KW, theFamilyName, theFixedFlag, thePointSize, theRotation, theScale, theShear, theStyleName, ossimString::toBool(), ossimString::toDouble(), ossimDpt::x, and ossimDpt::y.

Referenced by ossimGeoAnnotationFontObject::loadState(), ossimVpfAnnotationFeatureInfo::loadState(), and ossimFontProperty::setValue().

154 {
155  bool result = true;
156 
157  const char* family_name = kwl.find(prefix, FAMILY_NAME_KW);
158  const char* style_name = kwl.find(prefix, STYLE_NAME_KW);
159  const char* fixed = kwl.find(prefix, FIXED_FLAG_KW);
160  const char* rotation = kwl.find(prefix, ROTATION_KW);
161 
162  if(family_name)
163  {
164  theFamilyName = family_name;
165  }
166  else
167  {
168  result = false;
169  }
170 
171  if(style_name)
172  {
173  theStyleName = style_name;
174  }
175  else
176  {
177  result = false;
178  }
179 
180  // Look for point_size:
181  const char* lookup;
182  lookup = kwl.find(prefix, POINT_SIZE_KW);
183  if (lookup)
184  {
185  std::istringstream is(lookup);
186  is >> thePointSize;
187  }
188  else // backwards compat...
189  {
190  const char* point_x = kwl.find(prefix, POINT_SIZE_X_KW);
191  const char* point_y = kwl.find(prefix, POINT_SIZE_Y_KW);
192  if((point_x)&&(point_y))
193  {
194  thePointSize = ossimIpt(ossimString(point_x).toLong(),
195  ossimString(point_y).toLong());
196  }
197  else
198  {
199  result = false;
200  }
201  }
202 
203  // Look for shear:
204  lookup = kwl.find(prefix, SHEAR_KW);
205  if (lookup)
206  {
207  std::istringstream is(lookup);
208  is >> theShear;
209  }
210  else
211  {
212  const char* shear_x = kwl.find(prefix, SHEAR_X_KW);
213  if(shear_x)
214  {
215  theShear.x = ossimString(shear_x).toDouble();
216  }
217  else
218  {
219  result = false;
220  }
221  const char* shear_y = kwl.find(prefix, SHEAR_Y_KW);
222  if(shear_y)
223  {
224  theShear.y = ossimString(shear_y).toDouble();
225  }
226  else
227  {
228  result = false;
229  }
230  }
231 
232  // Look for scale:
233  lookup = kwl.find(prefix, SCALE_KW);
234  if (lookup)
235  {
236  std::istringstream is(lookup);
237  is >> theScale;
238  }
239  else
240  {
241  const char* scale_x = kwl.find(prefix, SCALE_X_KW);
242  if(scale_x)
243  {
244  theScale.x = ossimString(scale_x).toDouble();
245  }
246  else
247  {
248  result = false;
249  }
250  const char* scale_y = kwl.find(prefix, SCALE_Y_KW);
251  if(scale_y)
252  {
253  theScale.y = ossimString(scale_y).toDouble();
254  }
255  else
256  {
257  result = false;
258  }
259  }
260 
261  if(fixed)
262  {
263  theFixedFlag = ossimString(fixed).toBool();
264  }
265 
266  if(rotation)
267  {
268  theRotation = ossimString(rotation).toDouble();
269  }
270  else
271  {
272  result = false;
273  }
274 
275  return result;
276 }
static const char * SHEAR_KW
static const char * FAMILY_NAME_KW
static const char * FIXED_FLAG_KW
static const char * SCALE_KW
const char * find(const char *key) const
double y
Definition: ossimDpt.h:165
static const char * SHEAR_X_KW
static const char * SCALE_Y_KW
static const char * POINT_SIZE_X_KW
bool toBool() const
String to numeric methods.
static const char * ROTATION_KW
double toDouble() const
static const char * STYLE_NAME_KW
static const char * SHEAR_Y_KW
double x
Definition: ossimDpt.h:164
static const char * POINT_SIZE_Y_KW
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
static const char * SCALE_X_KW
static const char * POINT_SIZE_KW

◆ operator!=()

bool ossimFontInformation::operator!= ( const ossimFontInformation rhs) const

Definition at line 289 of file ossimFontInformation.cpp.

References theFamilyName, theFixedFlag, thePointSize, theRotation, theScale, theShear, and theStyleName.

290 {
291  return ( (theFamilyName != rhs.theFamilyName)||
292  (theStyleName != rhs.theStyleName)||
293  (thePointSize != rhs.thePointSize)||
294  (theFixedFlag != rhs.theFixedFlag)||
295  (theScale != rhs.theScale)||
296  (theRotation != rhs.theRotation)||
297  (theShear != rhs.theShear));
298 }

◆ operator=()

const ossimFontInformation & ossimFontInformation::operator= ( const ossimFontInformation rhs)

◆ operator==()

bool ossimFontInformation::operator== ( const ossimFontInformation rhs) const

Definition at line 278 of file ossimFontInformation.cpp.

References theFamilyName, theFixedFlag, thePointSize, theRotation, theScale, theShear, and theStyleName.

279 {
280  return ( (theFamilyName == rhs.theFamilyName)&&
281  (theStyleName == rhs.theStyleName)&&
282  (thePointSize == rhs.thePointSize)&&
283  (theFixedFlag == rhs.theFixedFlag)&&
284  (theScale == rhs.theScale)&&
285  (theRotation == rhs.theRotation)&&
286  (theShear == rhs.theShear));
287 }

◆ saveState()

bool ossimFontInformation::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const

Saves the current state of this object.

For keywords see loadState:

Definition at line 85 of file ossimFontInformation.cpp.

References ossimKeywordlist::add(), ossimString::c_str(), FAMILY_NAME_KW, FIXED_FLAG_KW, POINT_SIZE_KW, POINT_SIZE_X_KW, POINT_SIZE_Y_KW, ROTATION_KW, SCALE_KW, SCALE_X_KW, SCALE_Y_KW, SHEAR_KW, SHEAR_Y_KW, STYLE_NAME_KW, theFamilyName, theFixedFlag, thePointSize, theRotation, theScale, theShear, theStyleName, ossimIpt::toString(), ossimDpt::toString(), ossimIpt::x, ossimDpt::x, ossimIpt::y, and ossimDpt::y.

Referenced by ossimGeoAnnotationFontObject::saveState(), ossimVpfAnnotationFeatureInfo::saveState(), and ossimFontProperty::valueToString().

87 {
88  kwl.add(prefix,
91  true);
92  kwl.add(prefix,
95  true);
96 
97  kwl.add(prefix,
100  true);
101 
102  kwl.add(prefix,
103  SHEAR_KW,
104  theShear.toString().c_str(),
105  true);
106 
107  kwl.add(prefix,
108  SCALE_KW,
109  theScale.toString().c_str(),
110  true);
111 
112 #if 0
113  kwl.add(prefix,
115  thePointSize.x,
116  true);
117  kwl.add(prefix,
119  thePointSize.y,
120  true);
121  kwl.add(prefix,
122  SHEAR_Y_KW,
123  theShear.y,
124  true);
125  kwl.add(prefix,
126  SCALE_X_KW,
127  theScale.x,
128  true);
129  kwl.add(prefix,
130  SCALE_X_KW,
131  theScale.x,
132  true);
133  kwl.add(prefix,
134  SCALE_Y_KW,
135  theScale.y,
136  true);
137 #endif
138 
139  kwl.add(prefix,
141  (int)theFixedFlag,
142  true);
143  kwl.add(prefix,
144  ROTATION_KW,
145  theRotation,
146  true);
147 
148 
149  return true;
150 }
ossimString toString() const
Definition: ossimIpt.cpp:139
static const char * SHEAR_KW
static const char * FAMILY_NAME_KW
static const char * FIXED_FLAG_KW
static const char * SCALE_KW
double y
Definition: ossimDpt.h:165
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * SCALE_Y_KW
static const char * POINT_SIZE_X_KW
static const char * ROTATION_KW
static const char * STYLE_NAME_KW
static const char * SHEAR_Y_KW
ossimString toString(ossim_uint32 precision=15) const
Definition: ossimDpt.cpp:160
ossim_int32 y
Definition: ossimIpt.h:142
double x
Definition: ossimDpt.h:164
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
static const char * POINT_SIZE_Y_KW
ossim_int32 x
Definition: ossimIpt.h:141
static const char * SCALE_X_KW
static const char * POINT_SIZE_KW

Friends And Related Function Documentation

◆ operator<<

OSSIMDLLEXPORT std::ostream& operator<< ( std::ostream &  out,
const ossimFontInformation rhs 
)
friend

Definition at line 30 of file ossimFontInformation.cpp.

32 {
33  out << "Family name: " << rhs.theFamilyName
34  << "\nStyle name: " << rhs.theStyleName
35  << "\nPoint size: " << rhs.thePointSize
36  << "\nFixed flag: " << (rhs.theFixedFlag?"true":"false")
37  << std::endl;
38 
39  return out;
40 }

Member Data Documentation

◆ FAMILY_NAME_KW

const char * ossimFontInformation::FAMILY_NAME_KW = "family_name"
static

Definition at line 76 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ FIXED_FLAG_KW

const char * ossimFontInformation::FIXED_FLAG_KW = "fixed_flag"
static

Definition at line 81 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ POINT_SIZE_KW

const char * ossimFontInformation::POINT_SIZE_KW = "point_size"
static

Definition at line 78 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ POINT_SIZE_X_KW

const char * ossimFontInformation::POINT_SIZE_X_KW = "point_size_x"
static

Definition at line 79 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ POINT_SIZE_Y_KW

const char * ossimFontInformation::POINT_SIZE_Y_KW = "point_size_y"
static

Definition at line 80 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ ROTATION_KW

const char * ossimFontInformation::ROTATION_KW = "rotation"
static

Definition at line 88 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ SCALE_KW

const char * ossimFontInformation::SCALE_KW = "scale"
static

Definition at line 85 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ SCALE_X_KW

const char * ossimFontInformation::SCALE_X_KW = "scale_x"
static

Definition at line 86 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ SCALE_Y_KW

const char * ossimFontInformation::SCALE_Y_KW = "scale_y"
static

Definition at line 87 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ SHEAR_KW

const char * ossimFontInformation::SHEAR_KW = "shear"
static

Definition at line 82 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ SHEAR_X_KW

const char * ossimFontInformation::SHEAR_X_KW = "shear_x"
static

Definition at line 83 of file ossimFontInformation.h.

Referenced by loadState().

◆ SHEAR_Y_KW

const char * ossimFontInformation::SHEAR_Y_KW = "shear_y"
static

Definition at line 84 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ STYLE_NAME_KW

const char * ossimFontInformation::STYLE_NAME_KW = "style_name"
static

Definition at line 77 of file ossimFontInformation.h.

Referenced by loadState(), and saveState().

◆ theFamilyName

ossimString ossimFontInformation::theFamilyName

◆ theFixedFlag

bool ossimFontInformation::theFixedFlag

◆ thePointSize

ossimIpt ossimFontInformation::thePointSize

◆ theRotation

double ossimFontInformation::theRotation

◆ theScale

ossimDpt ossimFontInformation::theScale

◆ theShear

ossimDpt ossimFontInformation::theShear

◆ theStyleName

ossimString ossimFontInformation::theStyleName

The documentation for this class was generated from the following files: