From bbcbe542c2f9186bb9e2be60b896c89091550243 Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org> Date: Wed, 25 Jun 2008 13:25:56 +0000 Subject: [PATCH] Nettoyage de code --- Code/Projections/otbForwardSensorModel.h | 100 ++++++++++----------- Code/Projections/otbForwardSensorModel.txx | 96 ++++++++++---------- Code/Projections/otbInverseSensorModel.h | 94 +++++++++---------- Code/Projections/otbSensorModelBase.txx | 98 ++++++++++---------- 4 files changed, 194 insertions(+), 194 deletions(-) diff --git a/Code/Projections/otbForwardSensorModel.h b/Code/Projections/otbForwardSensorModel.h index ae62d3c040..b5f6372711 100644 --- a/Code/Projections/otbForwardSensorModel.h +++ b/Code/Projections/otbForwardSensorModel.h @@ -29,70 +29,70 @@ namespace otb /** \class ForwardSensorModel - * \brief Class for direct sensor models - * - * Based on ossimProjectionFactoryRegistry and ossimProjection methods. - * It takes as input an index and computes the world coordinates. - * (i,j,h) -> (lon,lat). - * Notice that the elevation h is optional. - * - * \ingroup Transform - */ + * \brief Class for direct sensor models + * + * Based on ossimProjectionFactoryRegistry and ossimProjection methods. + * It takes as input an index and computes the world coordinates. + * (i,j,h) -> (lon,lat). + * Notice that the elevation h is optional. + * + * \ingroup Transform + */ template <class TScalarType, - unsigned int NInputDimensions=2, - unsigned int NOutputDimensions=2, - unsigned int NParametersDimensions=3> - class ITK_EXPORT ForwardSensorModel : public SensorModelBase<TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions> - { + unsigned int NInputDimensions=2, + unsigned int NOutputDimensions=2, + unsigned int NParametersDimensions=3> + class ITK_EXPORT ForwardSensorModel : public SensorModelBase<TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions> + { - public : - /** Standard class typedefs. */ - typedef ForwardSensorModel Self; - typedef SensorModelBase< TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + public : + /** Standard class typedefs. */ + typedef ForwardSensorModel Self; + typedef SensorModelBase< TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; + typedef typename Superclass::InputPointType InputPointType; + typedef typename Superclass::OutputPointType OutputPointType; - /** Method for creation through the object factory. */ - itkNewMacro( Self ); + /** Method for creation through the object factory. */ + itkNewMacro( Self ); - /** Run-time type information (and related methods). */ - itkTypeMacro( ForwardSensorModel, SensorModelBase ); + /** Run-time type information (and related methods). */ + itkTypeMacro( ForwardSensorModel, SensorModelBase ); - itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); - itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); - itkStaticConstMacro(ParametersDimension, unsigned int, NParametersDimensions); //A voir!! + itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); + itkStaticConstMacro(ParametersDimension, unsigned int, NParametersDimensions); //A voir!! - /** Compute the world coordinates. */ - OutputPointType TransformPoint(const InputPointType &point) const; + /** Compute the world coordinates. */ + OutputPointType TransformPoint(const InputPointType &point) const; - protected: - ForwardSensorModel(); - virtual ~ForwardSensorModel(); + protected: + ForwardSensorModel(); + virtual ~ForwardSensorModel(); - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + /** PrintSelf method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const; - private : + private : - ForwardSensorModel(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + ForwardSensorModel(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented - /** Difference between consecutives heights in iterative transform point with DEM */ - double m_Epsilon; + /** Difference between consecutives heights in iterative transform point with DEM */ + double m_Epsilon; - /** Number of iterations in iterative transform point with DEM */ - double m_NbIter; - }; + /** Number of iterations in iterative transform point with DEM */ + double m_NbIter; + }; } // namespace otb diff --git a/Code/Projections/otbForwardSensorModel.txx b/Code/Projections/otbForwardSensorModel.txx index 4e957f736b..5349d3078a 100644 --- a/Code/Projections/otbForwardSensorModel.txx +++ b/Code/Projections/otbForwardSensorModel.txx @@ -57,17 +57,17 @@ template < class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, unsigned int NParametersDimensions > -typename ForwardSensorModel< TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions>::OutputPointType -ForwardSensorModel< TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions> -::TransformPoint(const InputPointType &point) const + typename ForwardSensorModel< TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions>::OutputPointType + ForwardSensorModel< TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions> + ::TransformPoint(const InputPointType &point) const { - otbMsgDevMacro(<< "Point in sensor geometry: (" << point[0] << "," << point[1] << ")"); + otbMsgDevMacro(<< "Point in sensor geometry: (" << point[0] << "," << point[1] << ")"); // "itk::point" to "ossim::ossimDpt" transformation ossimDpt ossimPoint(point[0], point[1]); @@ -84,55 +84,55 @@ ForwardSensorModel< TScalarType, if ((this->m_UseDEM) || (this->m_AverageElevation != -10000)) - { - ossimGpt ossimGPointRef = ossimGPoint; - double height, heightTmp ; - double diffHeight = 100; // arbitrary value - itk::Point<double, 2> point; - int nbIter = 0; + { + ossimGpt ossimGPointRef = ossimGPoint; + double height, heightTmp ; + double diffHeight = 100; // arbitrary value + itk::Point<double, 2> point; + int nbIter = 0; - otbMsgDevMacro(<< "USING DEM ! ") ; + otbMsgDevMacro(<< "USING DEM ! ") ; - while ((diffHeight > m_Epsilon) && (nbIter < m_NbIter)) - { - otbMsgDevMacro(<< "Iter " << nbIter); + while ((diffHeight > m_Epsilon) && (nbIter < m_NbIter)) + { + otbMsgDevMacro(<< "Iter " << nbIter); - if (nbIter != 0) - height = heightTmp; + if (nbIter != 0) + height = heightTmp; - otbMsgDevMacro(<< "PointG Before iter : (" << ossimGPointRef.lat << "," << ossimGPointRef.lon <<")"); + otbMsgDevMacro(<< "PointG Before iter : (" << ossimGPointRef.lat << "," << ossimGPointRef.lon <<")"); - point[0] = ossimGPointRef.lon; - point[1] = ossimGPointRef.lat; + point[0] = ossimGPointRef.lon; + point[1] = ossimGPointRef.lat; // otbMsgDevMacro(<< "PointP Before iter : (" << point[1] << "," << point[0] <<")"); - if (this->m_UseDEM) - { - heightTmp = this->m_DEMHandler->GetHeightAboveMSL(point); - } - else - { - heightTmp = this->m_AverageElevation; - } - otbMsgDevMacro(<< "height : " << heightTmp) ; + if (this->m_UseDEM) + { + heightTmp = this->m_DEMHandler->GetHeightAboveMSL(point); + } + else + { + heightTmp = this->m_AverageElevation; + } + otbMsgDevMacro(<< "height : " << heightTmp) ; - this->m_Model->lineSampleHeightToWorld(ossimPoint, heightTmp, ossimGPointRef); - otbMsgDevMacro(<< "Point After iter : (" << ossimGPointRef.lat << "," << ossimGPointRef.lon << ")"); + this->m_Model->lineSampleHeightToWorld(ossimPoint, heightTmp, ossimGPointRef); + otbMsgDevMacro(<< "Point After iter : (" << ossimGPointRef.lat << "," << ossimGPointRef.lon << ")"); - diffHeight = fabs(heightTmp - height); + diffHeight = fabs(heightTmp - height); - nbIter++; - } + nbIter++; + } - ossimGPoint = ossimGPointRef; - } + ossimGPoint = ossimGPointRef; + } // "OutputPointType" storage. OutputPointType outputPoint; outputPoint[0]=ossimGPoint.lon; outputPoint[1]=ossimGPoint.lat; - otbMsgDevMacro(<< "Geographic point lon/lat : (" << outputPoint[1] << "," << outputPoint[0] << ")"); + otbMsgDevMacro(<< "Geographic point lon/lat : (" << outputPoint[1] << "," << outputPoint[0] << ")"); return outputPoint; } @@ -141,12 +141,12 @@ template < class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, unsigned int NParametersDimensions > -void -ForwardSensorModel< TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions> -::PrintSelf(std::ostream& os, itk::Indent indent) const + void + ForwardSensorModel< TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions> + ::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os,indent); } diff --git a/Code/Projections/otbInverseSensorModel.h b/Code/Projections/otbInverseSensorModel.h index 39c53258da..275d7cb2ab 100644 --- a/Code/Projections/otbInverseSensorModel.h +++ b/Code/Projections/otbInverseSensorModel.h @@ -29,69 +29,69 @@ namespace otb { /** \class InverseSensorModel - - * \brief Class for inverse sensor models - * - * Based on ossimProjectionFactoryRegistry and ossimProjection methods. - * It takes as input a world point and computes the index position of the - * corresponding point in the input image. - * (lon,lat,h) -> (i,j). - * Notice that the elevation h is optional. - * - * \ingroup Transform - */ + * + * \brief Class for inverse sensor models + * + * Based on ossimProjectionFactoryRegistry and ossimProjection methods. + * It takes as input a world point and computes the index position of the + * corresponding point in the input image. + * (lon,lat,h) -> (i,j). + * Notice that the elevation h is optional. + * + * \ingroup Transform + */ template <class TScalarType, - unsigned int NInputDimensions=2, - unsigned int NOutputDimensions=2, - unsigned int NParametersDimensions=3> - class ITK_EXPORT InverseSensorModel : public SensorModelBase<TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions> - { + unsigned int NInputDimensions=2, + unsigned int NOutputDimensions=2, + unsigned int NParametersDimensions=3> + class ITK_EXPORT InverseSensorModel : public SensorModelBase<TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions> + { - public : - /** Standard class typedefs. */ - typedef InverseSensorModel Self; - typedef SensorModelBase< TScalarType, - NInputDimensions, - NOutputDimensions, - NParametersDimensions > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + public : + /** Standard class typedefs. */ + typedef InverseSensorModel Self; + typedef SensorModelBase< TScalarType, + NInputDimensions, + NOutputDimensions, + NParametersDimensions > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; - typedef typename Superclass::InputPointType InputPointType; - typedef typename Superclass::OutputPointType OutputPointType; + typedef typename Superclass::InputPointType InputPointType; + typedef typename Superclass::OutputPointType OutputPointType; - /** Method for creation through the object factory. */ - itkNewMacro( Self ); + /** Method for creation through the object factory. */ + itkNewMacro( Self ); - /** Run-time type information (and related methods). */ - itkTypeMacro( InverseSensorModel, SensorModelBase ); + /** Run-time type information (and related methods). */ + itkTypeMacro( InverseSensorModel, SensorModelBase ); - itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); - itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); - itkStaticConstMacro(ParametersDimension, unsigned int, NParametersDimensions); //A voir!! + itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); + itkStaticConstMacro(ParametersDimension, unsigned int, NParametersDimensions); //A voir!! // Transform of geographic point in image sensor index - virtual OutputPointType TransformPoint(const InputPointType &point) const; + virtual OutputPointType TransformPoint(const InputPointType &point) const; // Transform of geographic point in image sensor index -- Backward Compatibility // OutputPointType TransformPoint(const InputPointType &point, double height) const; - protected: - InverseSensorModel(); - virtual ~InverseSensorModel(); + protected: + InverseSensorModel(); + virtual ~InverseSensorModel(); - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + /** PrintSelf method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const; - private : + private : - InverseSensorModel(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + InverseSensorModel(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented - }; + }; } // namespace otb diff --git a/Code/Projections/otbSensorModelBase.txx b/Code/Projections/otbSensorModelBase.txx index 082085445c..76e478f66a 100755 --- a/Code/Projections/otbSensorModelBase.txx +++ b/Code/Projections/otbSensorModelBase.txx @@ -33,10 +33,10 @@ namespace otb { template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::SensorModelBase(): Superclass(OutputSpaceDimension, ParametersDimension) { m_Model = NULL; @@ -49,27 +49,27 @@ namespace otb template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::~SensorModelBase() { if( m_Model != NULL) { - delete m_Model; - m_Model = NULL; + delete m_Model; + m_Model = NULL; } } /// Get the Geometry Keyword list template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - ImageKeywordlist - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + ImageKeywordlist + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::GetImageGeometryKeywordlist(void)const { return m_ImageKeywordlist; @@ -77,11 +77,11 @@ namespace otb /// Get the Geometry Keyword list template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - ossimKeywordlist - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + ossimKeywordlist + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::GetOssimKeywordlist(void) { ossimKeywordlist geom; @@ -92,37 +92,37 @@ namespace otb /// Get the ossim model template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - ossimProjection* - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + ossimProjection* + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::GetOssimModel(void) { return m_Model; } - /* Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ + /** Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - void - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + void + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::SetImageGeometry(const ImageKeywordlist image_kwl) { m_ImageKeywordlist = image_kwl; CreateProjection(m_ImageKeywordlist); } - /* Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ + /** Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - void - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + void + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::SetImageGeometry(const ossimKeywordlist & geom_kwl) { m_ImageKeywordlist.Clear(); @@ -131,13 +131,13 @@ namespace otb } - ///Instatiate the sensor model from metadata. + /** Instatiate the sensor model from metadata. */ template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - void - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + void + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::CreateProjection(const ImageKeywordlist & image_kwl) { ossimKeywordlist geom; @@ -147,7 +147,7 @@ namespace otb m_Model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); if( m_Model == NULL) { - itkExceptionMacro(<<"Invalid Model pointer m_Model == NULL !\n The ossim keywordlist is bad!"); + itkExceptionMacro(<<"Invalid Model pointer m_Model == NULL !\n The ossim keywordlist is bad!"); } } @@ -155,11 +155,11 @@ namespace otb * PrintSelf method */ template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > - void - SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + void + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> ::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os,indent); -- GitLab