From 3c15acb3ae8c8c18085b896f4c2d52df9f403be7 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Mon, 14 Nov 2011 17:22:23 +0100 Subject: [PATCH] WRG: fix warning issue --- Code/BasicFilters/otbFastICAImageFilter.txx | 20 +++--- Code/BasicFilters/otbMNFImageFilter.txx | 22 +++---- Code/BasicFilters/otbPCAImageFilter.txx | 69 ++++++++++----------- 3 files changed, 55 insertions(+), 56 deletions(-) diff --git a/Code/BasicFilters/otbFastICAImageFilter.txx b/Code/BasicFilters/otbFastICAImageFilter.txx index 242aabcfea..06540a8d66 100644 --- a/Code/BasicFilters/otbFastICAImageFilter.txx +++ b/Code/BasicFilters/otbFastICAImageFilter.txx @@ -65,9 +65,9 @@ FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation > { Superclass::GenerateOutputInformation(); - switch ( DirectionOfTransformation ) + switch ( static_cast<int>(DirectionOfTransformation) ) { - case Transform::FORWARD: + case static_cast<int>(Transform::FORWARD): { if ( m_NumberOfPrincipalComponentsRequired == 0 || m_NumberOfPrincipalComponentsRequired @@ -81,7 +81,7 @@ FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation > m_NumberOfPrincipalComponentsRequired ); break; } - case Transform::INVERSE: + case static_cast<int>(Transform::INVERSE): { unsigned int theOutputDimension = 0; if ( m_GivenTransformationMatrix ) @@ -113,17 +113,17 @@ void FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation > ::GenerateData () { - switch ( DirectionOfTransformation ) - { - case Transform::FORWARD: + switch ( static_cast<int>(DirectionOfTransformation) ) + { + case static_cast<int>(Transform::FORWARD): return ForwardGenerateData(); - case Transform::INVERSE: + case static_cast<int>(Transform::INVERSE): return ReverseGenerateData(); default: throw itk::ExceptionObject(__FILE__, __LINE__, - "Class should be templated with FORWARD or INVERSE only...", - ITK_LOCATION ); - } + "Class should be templated with FORWARD or INVERSE only...", + ITK_LOCATION ); + } } template < class TInputImage, class TOutputImage, diff --git a/Code/BasicFilters/otbMNFImageFilter.txx b/Code/BasicFilters/otbMNFImageFilter.txx index 07b3fd668e..69d6028b0d 100644 --- a/Code/BasicFilters/otbMNFImageFilter.txx +++ b/Code/BasicFilters/otbMNFImageFilter.txx @@ -65,9 +65,9 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf { Superclass::GenerateOutputInformation(); - switch ( DirectionOfTransformation ) + switch ( static_cast<int>(DirectionOfTransformation) ) { - case Transform::FORWARD: + case static_cast<int>(Transform::FORWARD): { if ( m_NumberOfPrincipalComponentsRequired == 0 || m_NumberOfPrincipalComponentsRequired @@ -81,7 +81,7 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf m_NumberOfPrincipalComponentsRequired ); break; } - case Transform::INVERSE: + case static_cast<int>(Transform::INVERSE): { unsigned int theOutputDimension = 0; if ( m_GivenTransformationMatrix ) @@ -122,14 +122,14 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf { switch ( DirectionOfTransformation ) { - case Transform::FORWARD: - return ForwardGenerateData(); - case Transform::INVERSE: - return ReverseGenerateData(); - default: // should not go so far - throw itk::ExceptionObject(__FILE__, __LINE__, - "Class should be templated with FORWARD or INVERSE only...", - ITK_LOCATION ); + case static_cast<int>(Transform::FORWARD): + return ForwardGenerateData(); + case static_cast<int>(Transform::INVERSE): + return ReverseGenerateData(); + default: // should not go so far + throw itk::ExceptionObject(__FILE__, __LINE__, + "Class should be templated with FORWARD or INVERSE only...", + ITK_LOCATION ); } } diff --git a/Code/BasicFilters/otbPCAImageFilter.txx b/Code/BasicFilters/otbPCAImageFilter.txx index b5b9bea865..05060c3026 100644 --- a/Code/BasicFilters/otbPCAImageFilter.txx +++ b/Code/BasicFilters/otbPCAImageFilter.txx @@ -57,55 +57,54 @@ template < class TInputImage, class TOutputImage, void PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation > ::GenerateOutputInformation() -// throw itk::ExceptionObject { Superclass::GenerateOutputInformation(); - switch ( DirectionOfTransformation ) - { - case Transform::FORWARD: + switch ( static_cast<int>(DirectionOfTransformation) ) + { + case static_cast<int>(Transform::FORWARD): { - if ( m_NumberOfPrincipalComponentsRequired == 0 - || m_NumberOfPrincipalComponentsRequired - > this->GetInput()->GetNumberOfComponentsPerPixel() ) + if ( m_NumberOfPrincipalComponentsRequired == 0 + || m_NumberOfPrincipalComponentsRequired + > this->GetInput()->GetNumberOfComponentsPerPixel() ) { - m_NumberOfPrincipalComponentsRequired = - this->GetInput()->GetNumberOfComponentsPerPixel(); + m_NumberOfPrincipalComponentsRequired = + this->GetInput()->GetNumberOfComponentsPerPixel(); } - - this->GetOutput()->SetNumberOfComponentsPerPixel( - m_NumberOfPrincipalComponentsRequired ); - break; + + this->GetOutput()->SetNumberOfComponentsPerPixel( + m_NumberOfPrincipalComponentsRequired ); + break; } - case Transform::INVERSE: + case static_cast<int>(Transform::INVERSE): { - unsigned int theOutputDimension = 0; - if ( m_GivenTransformationMatrix ) + unsigned int theOutputDimension = 0; + if ( m_GivenTransformationMatrix ) { - theOutputDimension = m_TransformationMatrix.Rows() >= m_TransformationMatrix.Cols() ? - m_TransformationMatrix.Rows() : m_TransformationMatrix.Cols(); + theOutputDimension = m_TransformationMatrix.Rows() >= m_TransformationMatrix.Cols() ? + m_TransformationMatrix.Rows() : m_TransformationMatrix.Cols(); } - else if ( m_GivenCovarianceMatrix ) + else if ( m_GivenCovarianceMatrix ) { - theOutputDimension = m_CovarianceMatrix.Rows() >= m_CovarianceMatrix.Cols() ? - m_CovarianceMatrix.Rows() : m_CovarianceMatrix.Cols(); + theOutputDimension = m_CovarianceMatrix.Rows() >= m_CovarianceMatrix.Cols() ? + m_CovarianceMatrix.Rows() : m_CovarianceMatrix.Cols(); } - else + else { - throw itk::ExceptionObject(__FILE__, __LINE__, - "Covariance or transformation matrix required to know the output size", - ITK_LOCATION); + throw itk::ExceptionObject(__FILE__, __LINE__, + "Covariance or transformation matrix required to know the output size", + ITK_LOCATION); } - - this->GetOutput()->SetNumberOfComponentsPerPixel( theOutputDimension ); - - break; + + this->GetOutput()->SetNumberOfComponentsPerPixel( theOutputDimension ); + + break; } default: throw itk::ExceptionObject(__FILE__, __LINE__, - "Class should be templeted with FORWARD or INVERSE only...", - ITK_LOCATION ); - } + "Class should be templeted with FORWARD or INVERSE only...", + ITK_LOCATION ); + } } template < class TInputImage, class TOutputImage, @@ -114,11 +113,11 @@ void PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation > ::GenerateData () { - switch ( DirectionOfTransformation ) + switch ( static_cast<int>(DirectionOfTransformation) ) { - case Transform::FORWARD: + case static_cast<int>(Transform::FORWARD): return ForwardGenerateData(); - case Transform::INVERSE: + case static_cast<int>(Transform::INVERSE): return ReverseGenerateData(); default: throw itk::ExceptionObject(__FILE__, __LINE__, -- GitLab