OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimMapProjection.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 //
7 // Description:
8 //
9 // Base class for all map projections.
10 //
11 //*******************************************************************
12 // $Id: ossimMapProjection.h 22938 2014-11-01 11:43:35Z okramer $
13 
14 #ifndef ossimMapProjection_HEADER
15 #define ossimMapProjection_HEADER 1
16 
19 #include <ossim/base/ossimGpt.h>
21 #include <ossim/base/ossimString.h>
23 #include <ossim/base/ossimDatum.h>
24 #include <ossim/base/ossimDrect.h>
25 #include <iostream>
26 
28 
29 class ossimKeywordlist;
30 
32 {
33 public:
35  const ossimGpt& origin=ossimGpt());
36 
38 
39  virtual ossimGpt origin()const;
40 
45  virtual ossimDpt forward(const ossimGpt &worldPoint) const = 0;
46 
50  virtual ossimGpt inverse(const ossimDpt &projectedPoint)const = 0;
51 
52  virtual ossimDpt worldToLineSample(const ossimGpt &worldPoint)const;
53  virtual void worldToLineSample(const ossimGpt &worldPoint,
54  ossimDpt& lineSample)const;
55 
56  virtual ossimGpt lineSampleToWorld(const ossimDpt &projectedPoint)const;
57  virtual void lineSampleToWorld(const ossimDpt &projectedPoint,
58  ossimGpt& gpt)const;
64  virtual void lineSampleHeightToWorld(const ossimDpt& lineSampPt,
65  const double& heightAboveEllipsoid,
66  ossimGpt& worldPt) const;
67 
68  virtual void lineSampleToEastingNorthing(const ossimDpt& liineSample,
69  ossimDpt& eastingNorthing)const;
70 
71  virtual void eastingNorthingToLineSample(const ossimDpt& eastingNorthing,
72  ossimDpt& lineSample)const;
73 
74  virtual void eastingNorthingToWorld(const ossimDpt& eastingNorthing,
75  ossimGpt& worldPt)const;
76 
77 
79  virtual double getFalseEasting() const;
80 
82  virtual double getFalseNorthing() const;
83 
90  virtual double getStandardParallel1() const;
91 
98  virtual double getStandardParallel2() const;
99 
100  virtual void update();
101 
102  virtual void setPcsCode(ossim_uint32 pcsCode);
103 
105  virtual ossim_uint32 getPcsCode()const;
106 
110  virtual ossimString getProjectionName() const;
111 
115  virtual double getA() const;
116  virtual double getB() const;
117  virtual double getF() const;
118 
119  virtual ossimDpt getMetersPerPixel() const;
120 
125  virtual const ossimDpt& getDecimalDegreesPerPixel() const;
126 
127  virtual const ossimDpt& getUlEastingNorthing() const;
128  virtual const ossimGpt& getUlGpt() const;
129  virtual const ossimDatum* getDatum() const;
130  const ossimEllipsoid& getEllipsoid() const { return theEllipsoid; }
131  const ossimGpt& getOrigin() const;
132  virtual bool isGeographic()const;
133 
147  virtual void applyScale(const ossimDpt& scale, bool recenterTiePoint);
148 
152  virtual void setEllipsoid(const ossimEllipsoid& ellipsoid);
153  virtual void setAB(double a, double b);
154 
160  virtual void setDatum(const ossimDatum* datum);
161 
170  virtual void setOrigin(const ossimGpt& origin);
171 
172  virtual void setMetersPerPixel(const ossimDpt& gsd);
173  virtual void setDecimalDegreesPerPixel(const ossimDpt& gsd);
174  virtual void setUlTiePoints(const ossimGpt& gpt);
175  virtual void setUlTiePoints(const ossimDpt& eastingNorthing);
176  virtual void setUlEastingNorthing(const ossimDpt& ulEastingNorthing);
177  virtual void setUlGpt(const ossimGpt& ulGpt);
178  virtual void assign( const ossimProjection &aProjection);
179 
184  virtual bool saveState(ossimKeywordlist& kwl,
185  const char* prefix=0) const;
186 
191  virtual bool loadState(const ossimKeywordlist& kwl,
192  const char* prefix=0);
193 
197  virtual std::ostream& print(std::ostream& out) const;
198 
203  virtual bool operator==(const ossimProjection& projection) const;
204 
206  virtual void computeDegreesPerPixel();
207 
208 
214  virtual void computeMetersPerPixel();
215 
216  void setMatrix(double rotation,
217  const ossimDpt& scale,
218  const ossimDpt& translation);
219 
220  void setMatrixScale(const ossimDpt& scale);
221 
222  void setMatrixRotation(double rotation);
223 
224  void setMatrixTranslation(const ossimDpt& translation);
225 
250  void snapTiePointTo(ossim_float64 multiple, ossimUnitType unitType);
251  void snapTiePointToOrigin();
252 
253  void setElevationLookupFlag(bool flag);
254  bool getElevationLookupFlag()const;
256  {
257  return theModelTransformUnitType;
258  }
260  {
261  theModelTransformUnitType = unit;
262  }
263  bool hasModelTransform()const
264  {
265  return (theModelTransformUnitType != OSSIM_UNIT_UNKNOWN);
266  }
267 
273  virtual bool isAffectedByElevation() const { return false; }
274 
275  void setProjectionUnits(ossimUnitType units) { theProjectionUnits = units; }
276 
286  ossimUnitType getProjectionUnits() const { return theProjectionUnits; }
287 
288  virtual bool isEqualTo(const ossimObject& obj, ossimCompareType compareType = OSSIM_COMPARE_FULL)const;
289 
290 
291 protected:
292 
293  virtual ~ossimMapProjection();
294 
295  //---
296  // If theModelTransform is set this updates:
297  // theDegreesPerPixel
298  // theMetersPerPixel
299  // theUlEastingNorthing
300  // theUlGpt
301  //---
302  void updateFromTransform();
303 
310  //bool verifyPcsCodeMatches() const;
311 
314 
319 
326 
333 
336 
343 
350 
356 
358 
359  // Will always be a 4x4 matrix.
360  // note: only the first 2 dimensions will be used.
361  // if the size is 0 then it will not be used
362  //
363  ossimMatrix4x4 theModelTransform; // goes from image to model
364  ossimMatrix4x4 theInverseModelTransform; //goes from model back to image
365 
366  // Output Units of the transform
367  //
369 
372 
373 TYPE_DATA
374 };
375 
376 
377 #endif
ossimMatrix4x4 theModelTransform
ossimUnitType getModelTransformUnitType() const
#define OSSIMDLLEXPORT
ossimUnitType
Represents serializable keyword/value map.
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
ossimDpt theUlEastingNorthing
Hold tie point as easting northing.
virtual ossimGpt inverse(const ossimDpt &pp) const
ossimCompareType
ossimGpt theUlGpt
Hold tie point in decimal degrees.
ossimMatrix4x4 theInverseModelTransform
virtual bool isEqualTo(const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
double ossim_float64
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual bool operator==(const ossimProjection &projection) const =0
ossimDpt theMetersPerPixel
Holds the number of meters per pixel.
bool hasModelTransform() const
ossimUnitType theModelTransformUnitType
#define TYPE_DATA
Definition: ossimRtti.h:339
virtual ossimDpt getMetersPerPixel() const =0
virtual void lineSampleHeightToWorld(const ossimDpt &lineSampPt, const double &heightAboveEllipsoid, ossimGpt &worldPt) const =0
unsigned int ossim_uint32
ossimUnitType theProjectionUnits
Linear units of the projection as indicated in the projection&#39;s specification:
const ossimEllipsoid & getEllipsoid() const
ossim_uint32 thePcsCode
Projection Coordinate System(PCS) code.
ossimUnitType getProjectionUnits() const
OSSIM considers all map projection coordinates (including false eastings and northings) to be in mete...
virtual ossimGpt origin() const =0
virtual ossimDpt forward(const ossimGpt &wp) const
ossimDpt theDegreesPerPixel
Hold the decimal degrees per pixel.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
void setModelTransformUnitType(ossimUnitType unit)
ossimEllipsoid theEllipsoid
This method verifies that the projection parameters match the current pcs code.
ossimDpt theFalseEastingNorthing
Hold the false easting northing.
virtual void lineSampleToWorld(const ossimDpt &lineSampPt, ossimGpt &worldPt) const =0
void setProjectionUnits(ossimUnitType units)
virtual void worldToLineSample(const ossimGpt &worldPoint, ossimDpt &lineSampPt) const =0
virtual bool isAffectedByElevation() const
Implementation of pure virtual ossimProjection::isAffectedByElevation method.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
const ossimDatum * theDatum
This is only set if we want to have built in datum shifting.