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

#include <ossimStatePlaneProjectionInfo.h>

Public Member Functions

 ossimStatePlaneProjectionInfo (const std::string &name, int pcsCode, const std::string &projCode, const std::string &param1, const std::string &param2, const std::string &param3, const std::string &param4, double falseEast, double falseNorth, const std::string &units, const std::string &datumName)
 
int code () const
 
const ossimStringname () const
 
const ossimStringprojName () const
 
double originLat () const
 
double originLon () const
 
const ossimDatumdatum () const
 
ossimGpt origin () const
 
double parallel1 () const
 
double parallel2 () const
 
double falseEasting () const
 
double falseNorthing () const
 
double falseEastingInMeters () const
 
double falseNorthingInMeters () const
 
double scaleFactor () const
 
ossimString units () const
 Not stored as string; hence, returned by value. More...
 
ossimUnitType getUnitType () const
 
bool matchesProjection (const ossimMapProjection *proj) const
 Checks parameters of projection against this. More...
 
bool isSameCode (int Code) const
 
void populateProjectionKeywords (ossimKeywordlist &kwl, const char *prefix=0) const
 

Private Attributes

int thePcsCode
 
ossimString theName
 
ossimString theProjectionName
 
const ossimDatumtheDatum
 
ossimDms theOriginLat
 
ossimDms theOriginLon
 
ossimGpt theOrigin
 
double theParameter3
 
double theParameter4
 
double theFalseEasting
 
double theFalseNorthing
 
double theScaleFactor
 
ossimUnitType theUnits
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &, const ossimStatePlaneProjectionInfo &)
 

Detailed Description

Definition at line 21 of file ossimStatePlaneProjectionInfo.h.

Constructor & Destructor Documentation

◆ ossimStatePlaneProjectionInfo()

ossimStatePlaneProjectionInfo::ossimStatePlaneProjectionInfo ( const std::string &  name,
int  pcsCode,
const std::string &  projCode,
const std::string &  param1,
const std::string &  param2,
const std::string &  param3,
const std::string &  param4,
double  falseEast,
double  falseNorth,
const std::string &  units,
const std::string &  datumName 
)

Definition at line 19 of file ossimStatePlaneProjectionInfo.cpp.

References ossimString::c_str(), ossimDatumFactoryRegistry::create(), FLT_EPSILON, ossimDms::getDegrees(), ossimUnitTypeLut::getEntryNumber(), ossimUnitTypeLut::instance(), ossimDatumFactoryRegistry::instance(), OSSIM_FEET, OSSIM_METERS, OSSIM_US_SURVEY_FEET, ossimNotify(), ossimNotifyLevel_WARN, projName(), theDatum, theOrigin, theOriginLat, theOriginLon, theParameter3, theParameter4, theProjectionName, theScaleFactor, theUnits, ossimString::toDouble(), and units().

31  :
32  thePcsCode (pcsCode),
33  theName (name),
35  theDatum (0),
36  theOriginLat (param1),
37  theOriginLon (param2),
38  theOrigin (),
39  theParameter3 (0.0),
40  theParameter4 (0.0),
41  theFalseEasting (falseEast),
42  theFalseNorthing (falseNorth),
43  theScaleFactor (0.0),
45 
46 {
47  //---
48  // If the projection name is abreviated, expand to be ossim class name.
49  //---
50  if (projName == "tm")
51  {
52  theProjectionName = "ossimTransMercatorProjection";
53  }
54  else if (projName == "lcc")
55  {
56  theProjectionName = "ossimLambertConformalConicProjection";
57  }
58 
59  // Set the projection specific stuff.
60  if (theProjectionName == "ossimTransMercatorProjection")
61  {
63  if(fabs(theParameter3) > FLT_EPSILON)
64  {
65  theScaleFactor = 1.0 - (1.0 / theParameter3);
66  }
67  else
68  {
69  theScaleFactor = 1.0;
70  }
71  }
72  else if (theProjectionName == "ossimLambertConformalConicProjection")
73  {
74  theParameter3 = ossimDms(param3).getDegrees();
75  theParameter4 = ossimDms(param4).getDegrees();
76  }
77  else
78  {
80  << "ossimStatePlaneProjectionInfo unhandled projection type: "
81  << projName << std::endl;
82  }
83 
85  if (!theDatum)
86  {
88  << "ossimStatePlaneProjectionInfo unhandled datum type: "
89  << datumName << std::endl;
90  }
91 
94  0,
95  theDatum);
96 
97  theUnits = static_cast<ossimUnitType>(
99 
100  // Currently only handle meters and us_survey_feet.
101  if ( (theUnits != OSSIM_METERS) &&
103  (theUnits != OSSIM_FEET) )
104  {
106  << "ossimStatePlaneProjectionInfo unhandled unit type: "
107  << units.c_str()
108  << std::endl;
109  }
110 }
ossimUnitType
static ossimDatumFactoryRegistry * instance()
instance method
ossimString units() const
Not stored as string; hence, returned by value.
virtual ossim_int32 getEntryNumber(const char *entry_string, bool case_insensitive=true) const
#define FLT_EPSILON
virtual const ossimDatum * create(const ossimString &code) const
create method
double toDouble() const
double getDegrees() const
Definition: ossimDms.h:71
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 ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Function Documentation

◆ code()

int ossimStatePlaneProjectionInfo::code ( ) const

Definition at line 112 of file ossimStatePlaneProjectionInfo.cpp.

References thePcsCode.

Referenced by operator<<().

◆ datum()

const ossimDatum * ossimStatePlaneProjectionInfo::datum ( ) const

Definition at line 137 of file ossimStatePlaneProjectionInfo.cpp.

References theDatum.

138 {
139  return theDatum;
140 }

◆ falseEasting()

double ossimStatePlaneProjectionInfo::falseEasting ( ) const

Definition at line 157 of file ossimStatePlaneProjectionInfo.cpp.

References theFalseEasting.

Referenced by operator<<().

158 {
159  return theFalseEasting;
160 }

◆ falseEastingInMeters()

double ossimStatePlaneProjectionInfo::falseEastingInMeters ( ) const

Definition at line 187 of file ossimStatePlaneProjectionInfo.cpp.

References MTRS_PER_FT, OSSIM_FEET, OSSIM_US_SURVEY_FEET, theFalseEasting, theUnits, and US_METERS_PER_FT.

Referenced by matchesProjection().

188 {
189  double result = theFalseEasting;
190  switch (theUnits)
191  {
193  result *= US_METERS_PER_FT;
194  break;
195  case OSSIM_FEET:
196  result *= MTRS_PER_FT;
197  break;
198  default:
199  break;
200  }
201  return result;
202 }
#define US_METERS_PER_FT
#define MTRS_PER_FT

◆ falseNorthing()

double ossimStatePlaneProjectionInfo::falseNorthing ( ) const

Definition at line 162 of file ossimStatePlaneProjectionInfo.cpp.

References theFalseNorthing.

Referenced by operator<<().

163 {
164  return theFalseNorthing;
165 }

◆ falseNorthingInMeters()

double ossimStatePlaneProjectionInfo::falseNorthingInMeters ( ) const

Definition at line 204 of file ossimStatePlaneProjectionInfo.cpp.

References MTRS_PER_FT, OSSIM_FEET, OSSIM_US_SURVEY_FEET, theFalseNorthing, theUnits, and US_METERS_PER_FT.

Referenced by matchesProjection().

205 {
206  double result = theFalseNorthing;
207  switch (theUnits)
208  {
210  result *= US_METERS_PER_FT;
211  break;
212  case OSSIM_FEET:
213  result *= MTRS_PER_FT;
214  break;
215  default:
216  break;
217  }
218  return result;
219 }
#define US_METERS_PER_FT
#define MTRS_PER_FT

◆ getUnitType()

ossimUnitType ossimStatePlaneProjectionInfo::getUnitType ( ) const
Returns
ossimUnitType

Definition at line 285 of file ossimStatePlaneProjectionInfo.cpp.

References theUnits.

286 {
287  return theUnits;
288 }

◆ isSameCode()

bool ossimStatePlaneProjectionInfo::isSameCode ( int  Code) const

Definition at line 177 of file ossimStatePlaneProjectionInfo.cpp.

References thePcsCode.

178 {
179  if(pcsCode == thePcsCode)
180  {
181  return true;
182  }
183 
184  return false;
185 }

◆ matchesProjection()

bool ossimStatePlaneProjectionInfo::matchesProjection ( const ossimMapProjection proj) const

Checks parameters of projection against this.

Returns
true if projection parameters match this, false if not.

Definition at line 290 of file ossimStatePlaneProjectionInfo.cpp.

References ossimDatum::code(), falseEastingInMeters(), falseNorthingInMeters(), ossimObject::getClassName(), ossimMapProjection::getFalseEasting(), ossimMapProjection::getFalseNorthing(), ossimTransMercatorProjection::getScaleFactor(), ossimLambertConformalConicProjection::getStandardParallel1(), ossimLambertConformalConicProjection::getStandardParallel2(), ossimMapProjection::origin(), parallel1(), parallel2(), PTR_CAST, theDatum, theOrigin, theProjectionName, and theScaleFactor.

292 {
293  if (!proj)
294  {
295  return false;
296  }
297 
298 #if 0
299  cout << "\ntheProjectionName: " << theProjectionName
300  << "\nclassName: " << proj->getClassName()
301  << "\ntheOrigin: " << theOrigin
302  << "\nproj->origin(): "<< proj->origin()
303  << "\nfalseEastingInMeters(): "<< falseEastingInMeters()
304  << "\nproj->getFalseEasting(): " << proj->getFalseEasting()
305  << "\nfalseNorthingInMeters(): " << falseNorthingInMeters()
306  << "\nproj->getFalseNorthing(): " << proj->getFalseNorthing()
307  << "\ndatum: " << theDatum->code()
308  << endl;
309 #endif
310 
311  if ( (theProjectionName != proj->getClassName()) ||
312  ( (theOrigin == proj->origin()) == false) ||
313  (falseEastingInMeters() != proj->getFalseEasting()) ||
314  (falseNorthingInMeters() != proj->getFalseNorthing()) )
315  {
316  return false;
317  }
318 
319  //---
320  // NOTE: Going from double to strings, radians to degrees and back is
321  // causing a wiggle in the floating point values; hence the
322  // ALLOWABLE_VARIANCE.
323  //---
324  const double ALLOWABLE_VARIANCE = 0.00000000000001;
325 
326  if (theProjectionName == "ossimTransMercatorProjection")
327  {
329  proj);
330  if (!tm)
331  {
332  return false;
333  }
334  double d1 = fabs(theScaleFactor - tm->getScaleFactor());
335  if (d1 < ALLOWABLE_VARIANCE)
336  {
337  return true;
338  }
339  }
340  else // Lambert.
341  {
344  if (!lam)
345  {
346  return false;
347  }
348  double d1 = fabs(parallel1() - lam->getStandardParallel1());
349  double d2 = fabs(parallel2() - lam->getStandardParallel2());
350  if ( (d1 < ALLOWABLE_VARIANCE) && (d2 < ALLOWABLE_VARIANCE) )
351  {
352  return true;
353  }
354  }
355 
356  return false;
357 }
virtual double getFalseNorthing() const
virtual const ossimString & code() const
Definition: ossimDatum.h:57
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
virtual ossimGpt origin() const
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual double getFalseEasting() const

◆ name()

const ossimString & ossimStatePlaneProjectionInfo::name ( ) const

Definition at line 117 of file ossimStatePlaneProjectionInfo.cpp.

References theName.

Referenced by operator<<().

118 {
119  return theName;
120 }

◆ origin()

ossimGpt ossimStatePlaneProjectionInfo::origin ( ) const

Definition at line 142 of file ossimStatePlaneProjectionInfo.cpp.

References theOrigin.

Referenced by operator<<(), and populateProjectionKeywords().

143 {
144  return theOrigin;
145 }

◆ originLat()

double ossimStatePlaneProjectionInfo::originLat ( ) const

Definition at line 127 of file ossimStatePlaneProjectionInfo.cpp.

References ossimDms::getDegrees(), and theOriginLat.

128 {
129  return theOriginLat.getDegrees();
130 }
double getDegrees() const
Definition: ossimDms.h:71

◆ originLon()

double ossimStatePlaneProjectionInfo::originLon ( ) const

Definition at line 132 of file ossimStatePlaneProjectionInfo.cpp.

References ossimDms::getDegrees(), and theOriginLon.

133 {
134  return theOriginLon.getDegrees();
135 }
double getDegrees() const
Definition: ossimDms.h:71

◆ parallel1()

double ossimStatePlaneProjectionInfo::parallel1 ( ) const

◆ parallel2()

double ossimStatePlaneProjectionInfo::parallel2 ( ) const

◆ populateProjectionKeywords()

void ossimStatePlaneProjectionInfo::populateProjectionKeywords ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const

Definition at line 221 of file ossimStatePlaneProjectionInfo.cpp.

References ossimKeywordlist::add(), ossimString::c_str(), ossimKeywordNames::CENTRAL_MERIDIAN_KW, ossimDatum::code(), ossimKeywordNames::DATUM_KW, ossimKeywordNames::FALSE_EASTING_NORTHING_KW, ossimKeywordNames::FALSE_EASTING_NORTHING_UNITS_KW, ossimUnitTypeLut::instance(), origin(), ossimKeywordNames::ORIGIN_LATITUDE_KW, parallel1(), parallel2(), ossimKeywordNames::PCS_CODE_KW, projName(), ossimKeywordNames::SCALE_FACTOR_KW, STATIC_TYPE_NAME, ossimKeywordNames::STD_PARALLEL_1_KW, ossimKeywordNames::STD_PARALLEL_2_KW, theDatum, theFalseEasting, theFalseNorthing, thePcsCode, theScaleFactor, theUnits, ossimDpt::toString(), and ossimKeywordNames::TYPE_KW.

223 {
224  kwl.add(prefix,
226  thePcsCode,
227  true);
228 
229  kwl.add(prefix,
231  (ossimUnitTypeLut::instance()->getEntryString(theUnits)),
232  true);
233 
235 
236  kwl.add(prefix,
238  pt.toString().c_str(),
239  true);
240 
241  kwl.add(prefix,
243  origin().latd(),
244  true);
245 
246  kwl.add(prefix,
248  origin().lond(),
249  true);
250 
251  kwl.add(prefix,
253  projName(),
254  true);
255 
256  if(theDatum)
257  {
258 
259  kwl.add(prefix,
261  theDatum->code(),
262  true);
263  }
264 
266  {
267  kwl.add(prefix,
269  parallel1(),
270  true);
271  kwl.add(prefix,
273  parallel2(),
274  true);
275  }
276  else
277  {
278  kwl.add(prefix,
281  true);
282  }
283 }
static const char * DATUM_KW
static const char * FALSE_EASTING_NORTHING_UNITS_KW
static const char * CENTRAL_MERIDIAN_KW
virtual const ossimString & code() const
Definition: ossimDatum.h:57
static const char * TYPE_KW
#define STATIC_TYPE_NAME(T)
Definition: ossimRtti.h:325
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * STD_PARALLEL_1_KW
static const char * FALSE_EASTING_NORTHING_KW
static const char * ORIGIN_LATITUDE_KW
static const char * PCS_CODE_KW
static const char * SCALE_FACTOR_KW
static const char * STD_PARALLEL_2_KW
static ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.

◆ projName()

const ossimString & ossimStatePlaneProjectionInfo::projName ( ) const

◆ scaleFactor()

double ossimStatePlaneProjectionInfo::scaleFactor ( ) const

Definition at line 167 of file ossimStatePlaneProjectionInfo.cpp.

References theScaleFactor.

Referenced by operator<<().

168 {
169  return theScaleFactor;
170 }

◆ units()

ossimString ossimStatePlaneProjectionInfo::units ( ) const

Not stored as string; hence, returned by value.

Definition at line 172 of file ossimStatePlaneProjectionInfo.cpp.

References ossimLookUpTable::getEntryString(), ossimUnitTypeLut::instance(), and theUnits.

Referenced by ossimStatePlaneProjectionInfo().

173 {
175 }
virtual ossimString getEntryString(ossim_int32 entry_number) const
static ossimUnitTypeLut * instance()
Returns the static instance of an ossimUnitTypeLut object.

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  os,
const ossimStatePlaneProjectionInfo thePlane 
)
friend

Definition at line 359 of file ossimStatePlaneProjectionInfo.cpp.

361 {
363  {
364  return os << "ossimStatePlaneProjection: "
365  << "\nName: " << thePlane.name()
366  << "\nPcsCode: " << thePlane.code()
367  << "\norigin: " << thePlane.origin()
368  << "\nscale factor: " << setprecision(12)
369  << thePlane.scaleFactor()
370  << "\nfalseEasting: " << thePlane.falseEasting()
371  << "\nfalseNorthing: " << thePlane.falseNorthing()
372  << endl;
373  }
374  else // Lambert
375  {
376  return os << "ossimStatePlaneProjection: "
377  << "\nName: " << thePlane.name()
378  << "\nPcsCode: " << thePlane.code()
379  << "\norigin: " << thePlane.origin()
380  << "\nphi1: "
381  << setprecision(12) << thePlane.parallel1()
382  << "\nphi2: "
383  << setprecision(12) << thePlane.parallel2()
384  << "\nfalseEasting: " << thePlane.falseEasting()
385  << "\nfalseNorthing: " << thePlane.falseNorthing()
386  << endl;
387  }
388 }
#define STATIC_TYPE_NAME(T)
Definition: ossimRtti.h:325

Member Data Documentation

◆ theDatum

const ossimDatum* ossimStatePlaneProjectionInfo::theDatum
private

◆ theFalseEasting

double ossimStatePlaneProjectionInfo::theFalseEasting
private

◆ theFalseNorthing

double ossimStatePlaneProjectionInfo::theFalseNorthing
private

◆ theName

ossimString ossimStatePlaneProjectionInfo::theName
private

Definition at line 78 of file ossimStatePlaneProjectionInfo.h.

Referenced by name().

◆ theOrigin

ossimGpt ossimStatePlaneProjectionInfo::theOrigin
private

◆ theOriginLat

ossimDms ossimStatePlaneProjectionInfo::theOriginLat
private

Definition at line 88 of file ossimStatePlaneProjectionInfo.h.

Referenced by originLat(), and ossimStatePlaneProjectionInfo().

◆ theOriginLon

ossimDms ossimStatePlaneProjectionInfo::theOriginLon
private

Definition at line 89 of file ossimStatePlaneProjectionInfo.h.

Referenced by originLon(), and ossimStatePlaneProjectionInfo().

◆ theParameter3

double ossimStatePlaneProjectionInfo::theParameter3
private

Definition at line 92 of file ossimStatePlaneProjectionInfo.h.

Referenced by ossimStatePlaneProjectionInfo(), and parallel1().

◆ theParameter4

double ossimStatePlaneProjectionInfo::theParameter4
private

Definition at line 93 of file ossimStatePlaneProjectionInfo.h.

Referenced by ossimStatePlaneProjectionInfo(), and parallel2().

◆ thePcsCode

int ossimStatePlaneProjectionInfo::thePcsCode
private

Definition at line 77 of file ossimStatePlaneProjectionInfo.h.

Referenced by code(), isSameCode(), and populateProjectionKeywords().

◆ theProjectionName

ossimString ossimStatePlaneProjectionInfo::theProjectionName
private

◆ theScaleFactor

double ossimStatePlaneProjectionInfo::theScaleFactor
private

◆ theUnits

ossimUnitType ossimStatePlaneProjectionInfo::theUnits
private

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