USGS

Isis 3.0 Developer's Reference (API)

Home

ProjectionFactory.h

Go to the documentation of this file.
00001 #ifndef ProjectionFactory_h
00002 #define ProjectionFactory_h
00003 
00025 #include "Plugin.h"
00026 #include "WorldMapper.h"
00027 
00028 namespace Isis {
00029   class Camera;
00030   class Cube;
00031   class Projection;
00032 
00078   class ProjectionFactory {
00079     public:
00080       static Isis::Projection *Create(Isis::Pvl &label, bool allowDefaults = false);
00081       static Isis::Projection *CreateFromCube(Isis::Cube &cube);
00082       static Isis::Projection *CreateFromCube(Isis::Pvl &label); // Load Method in cm
00083       static Isis::Projection *CreateForCube(Isis::Pvl &label, int &ns, int &nl,
00084                                              bool sizeMatch = true); // Create method in cm
00085       static Isis::Projection *CreateForCube(Isis::Pvl &label,
00086                                              int &samples, int &lines,
00087                                              Camera &cam);
00088 
00089     private:
00094       ProjectionFactory() {};
00095 
00097       ~ProjectionFactory() {};
00098       
00099       static Plugin m_projPlugin;
00100   };
00101 
00102 
00108   class PFPixelMapper : public Isis::WorldMapper {
00109     public:
00117       PFPixelMapper(double pixelResolution, double upperLeftX, double upperLeftY) {
00118         p_pixelResolution = pixelResolution;
00119         p_upperLeftX = upperLeftX;
00120         p_upperLeftY = upperLeftY;
00121       };
00122 
00129       double WorldX(const double projX) const {
00130         return (projX - p_upperLeftX) / p_pixelResolution + 0.5;
00131       };
00132 
00139       double WorldY(const double projY) const {
00140         return (p_upperLeftY - projY) / p_pixelResolution + 0.5;
00141       };
00142 
00149       double ProjectionX(const double sample) const {
00150         return (sample - 0.5) * p_pixelResolution + p_upperLeftX;
00151       };
00152 
00159       double ProjectionY(const double line) const {
00160         return p_upperLeftY - (line - 0.5) * p_pixelResolution;
00161       };
00162 
00164       double Resolution() const {
00165         return p_pixelResolution;
00166       }
00167 
00168     private:
00169       double p_pixelResolution;
00170       double p_upperLeftX;
00171       double p_upperLeftY;
00172   };
00174 };
00175 
00176 #endif
00177