From 9e1630302e6c411f9a394781761b951dc67a9bcc Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Wed, 5 Aug 2009 16:34:59 +0800
Subject: [PATCH] ENH: better templates in Transforms

---
 Code/IO/otbPointSetFileReader.txx          |  1 -
 Code/Projections/otbCompositeTransform.h   | 18 +++++++++---------
 Code/Projections/otbCompositeTransform.txx |  2 +-
 Code/Projections/otbGenericRSTransform.txx |  2 ++
 Code/Projections/otbInverseSensorModel.txx |  5 ++++-
 Code/Projections/otbSensorModelBase.txx    |  2 +-
 6 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/Code/IO/otbPointSetFileReader.txx b/Code/IO/otbPointSetFileReader.txx
index 0c04e45193..7361501617 100644
--- a/Code/IO/otbPointSetFileReader.txx
+++ b/Code/IO/otbPointSetFileReader.txx
@@ -172,7 +172,6 @@ void PointSetFileReader<TOutputPointSet>
       point[1] = p.GetY();
       point[2] = p.GetZ();
 
-
       unsigned long i = output->GetNumberOfPoints();
       output->SetPoint( i, point );
 
diff --git a/Code/Projections/otbCompositeTransform.h b/Code/Projections/otbCompositeTransform.h
index 06e97cbd79..601786b260 100644
--- a/Code/Projections/otbCompositeTransform.h
+++ b/Code/Projections/otbCompositeTransform.h
@@ -39,15 +39,15 @@ namespace otb
 * \ingroup Transform
 */
 
-typedef enum
-{
-  PROJDEFAULT=0,
-  PROJIDENTITY=1,
-  PROJMAPFORWARD=2,
-  PROJMAPINVERSE=3,
-  PROJSENSORFORWARD=4,
-  PROJSENSORINVERSE=5
-} ProjectionTypeEnum;
+//typedef enum
+//{
+//  PROJDEFAULT=0,
+//  PROJIDENTITY=1,
+//  PROJMAPFORWARD=2,
+//  PROJMAPINVERSE=3,
+//  PROJSENSORFORWARD=4,
+//  PROJSENSORINVERSE=5
+//} ProjectionTypeEnum;
 
 template <class TFirstTransform,
 class TSecondTransform,
diff --git a/Code/Projections/otbCompositeTransform.txx b/Code/Projections/otbCompositeTransform.txx
index 9ddf5c53de..4bdd5026c2 100644
--- a/Code/Projections/otbCompositeTransform.txx
+++ b/Code/Projections/otbCompositeTransform.txx
@@ -82,7 +82,7 @@ NOutputDimensions>
   SecondTransformOutputPointType outputPoint;
   outputPoint=m_SecondTransform->TransformPoint(geoPoint);
 
-//       otbMsgDevMacro(<< "Converting: " << point1 << " -> " <<  geoPoint<< " -> " << outputPoint);
+//  otbMsgDevMacro(<< std::setprecision(15) << "Converting: " << point1 << " -> " <<  geoPoint<< " -> " << outputPoint);
 
   return outputPoint;
 }
diff --git a/Code/Projections/otbGenericRSTransform.txx b/Code/Projections/otbGenericRSTransform.txx
index 19843d07ce..7ec3532d15 100644
--- a/Code/Projections/otbGenericRSTransform.txx
+++ b/Code/Projections/otbGenericRSTransform.txx
@@ -265,6 +265,8 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
   outputPoint[0] = (outputPoint[0] - m_OutputOrigin[0]) / m_OutputSpacing[0];
   outputPoint[1] = (outputPoint[1] - m_OutputOrigin[1]) / m_OutputSpacing[1];
 
+//  otbMsgDevMacro("GenericRSTransform: " << point << " -> " << outputPoint);
+
   return outputPoint;
 }
 
diff --git a/Code/Projections/otbInverseSensorModel.txx b/Code/Projections/otbInverseSensorModel.txx
index 4e1fdc1e7c..6dbcaf2146 100644
--- a/Code/Projections/otbInverseSensorModel.txx
+++ b/Code/Projections/otbInverseSensorModel.txx
@@ -86,7 +86,10 @@ InverseSensorModel< TScalarType, NInputDimensions, NOutputDimensions>
 
   outputPoint[0]=ossimDPoint.x;
   outputPoint[1]=ossimDPoint.y;
-
+  if (OutputPointType::PointDimension == 3)
+    {
+      outputPoint[2] = ossimGPoint.height();
+    }
 //     otbMsgDevMacro(<< "Point in sensor geometry: (" << outputPoint[0] << "," <<  outputPoint[1] << ")");
 
   return outputPoint;
diff --git a/Code/Projections/otbSensorModelBase.txx b/Code/Projections/otbSensorModelBase.txx
index 9c57378307..03fccd1699 100644
--- a/Code/Projections/otbSensorModelBase.txx
+++ b/Code/Projections/otbSensorModelBase.txx
@@ -37,7 +37,7 @@ template < class TScalarType,
 unsigned int NInputDimensions,
 unsigned int NOutputDimensions >
 SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions>
-::SensorModelBase()
+::SensorModelBase(): Superclass(OutputSpaceDimension, 0)
 {
   m_Model = NULL;
   m_DEMHandler = DEMHandlerType::New();
-- 
GitLab