From 910a9a43a8856fb67d7b28b58915c7f69a1d3363 Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org>
Date: Wed, 14 Dec 2011 15:52:27 +0100
Subject: [PATCH] BUG:remove useless m_Transform attribute from
 GroundSpacingImageFunction

---
 Code/Projections/otbGroundSpacingImageFunction.h   | 7 ++-----
 Code/Projections/otbGroundSpacingImageFunction.txx | 2 +-
 Code/Visualization/otbImageLayer.txx               | 4 +---
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/Code/Projections/otbGroundSpacingImageFunction.h b/Code/Projections/otbGroundSpacingImageFunction.h
index 30e706e252..42426b5a1b 100644
--- a/Code/Projections/otbGroundSpacingImageFunction.h
+++ b/Code/Projections/otbGroundSpacingImageFunction.h
@@ -86,6 +86,7 @@ public:
     this->ConvertPointToNearestIndex(point, index);
     return this->EvaluateAtIndex(index);
   }
+
   virtual FloatType EvaluateAtContinuousIndex(
     const ContinuousIndexType& cindex) const
   {
@@ -94,11 +95,8 @@ public:
     return this->EvaluateAtIndex(index);
   }
 
-  /** Get/Set the transformation definition of the input image **/
-  itkSetObjectMacro(Transform, TransformType);
-  itkGetObjectMacro(Transform, TransformType);
-
   PointType GetPixelLocation(const IndexType& index) const;
+
 protected:
   GroundSpacingImageFunction();
   virtual ~GroundSpacingImageFunction(){}
@@ -108,7 +106,6 @@ private:
   GroundSpacingImageFunction(const Self &);  //purposely not implemented
   void operator =(const Self&);  //purposely not implemented
 
-  TransformType::Pointer m_Transform;
   ValueType              m_R;
   ValueType              m_deg2radCoef;
 };
diff --git a/Code/Projections/otbGroundSpacingImageFunction.txx b/Code/Projections/otbGroundSpacingImageFunction.txx
index e0311e4710..bbd1aa05cc 100644
--- a/Code/Projections/otbGroundSpacingImageFunction.txx
+++ b/Code/Projections/otbGroundSpacingImageFunction.txx
@@ -39,7 +39,6 @@ GroundSpacingImageFunction<TInputImage, TCoordRep>
 {
   m_R = 6371000;
   m_deg2radCoef = CONST_PI / 180;
-  m_Transform = TransformType::New();
 }
 
 /**
@@ -120,6 +119,7 @@ GroundSpacingImageFunction<TInputImage, TCoordRep>
   PointType inputPoint;
   inputPoint[0] = index[0];
   inputPoint[1] = index[1];
+
   if (!this->GetInputImage())
     {
     itkExceptionMacro(<< "No input image!");
diff --git a/Code/Visualization/otbImageLayer.txx b/Code/Visualization/otbImageLayer.txx
index e73b51cfdb..00f3af9eba 100644
--- a/Code/Visualization/otbImageLayer.txx
+++ b/Code/Visualization/otbImageLayer.txx
@@ -284,7 +284,7 @@ ImageLayer<TImage, TOutputImage>
     {
     if (m_Transform->GetTransformAccuracy() != Projection::UNKNOWN)
       {
-      PointType point = m_GroundSpacing->GetPixelLocation (index);
+      PointType point = this->GetPixelLocation (index);
 
       oss << setiosflags(std::ios::fixed) << std::setprecision(2) << "Ground spacing(in m): " << m_ApproxGroundSpacing.first << " " << m_ApproxGroundSpacing.second <<
       std::endl;
@@ -343,8 +343,6 @@ ImageLayer<TImage, TOutputImage>
 
   //Set parameters of the ground spacing image calculators
   m_GroundSpacing->SetInputImage(m_Image);
-  m_GroundSpacing->SetTransform(m_Transform);
-
 }
 
 template <class TImage, class TOutputImage>
-- 
GitLab