From 28d3d592a24da5f94a96b6e9a5387fc6cfb8a9a0 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Thu, 25 Oct 2007 13:46:46 +0000 Subject: [PATCH] Suppression des commentaires francias restant. --- Code/Projections/otbMapProjection.txx | 631 +++++++++--------- Code/Projections/otbMapToMapProjection.h | 160 +++-- Code/Projections/otbMapToMapProjection.txx | 152 +++-- Code/Projections/otbMollweidMapProjection.cxx | 134 ++-- Code/Projections/otbMollweidMapProjection.h | 101 ++- .../Projections/otbOrthoRectificationFilter.h | 227 +++---- .../otbOrthoRectificationFilter.txx | 166 +++-- Code/Projections/otbSensorModelBase.h | 142 ++-- Code/Projections/otbSensorModelBase.txx | 250 +++---- .../otbSinusoidalMapProjection.cxx | 136 ++-- Code/Projections/otbSinusoidalMapProjection.h | 98 ++- .../otbTransMercatorMapProjection.cxx | 196 +++--- .../otbTransMercatorMapProjection.h | 102 ++- Code/Projections/otbUtmMapProjection.cxx | 132 ++-- Code/Projections/otbUtmMapProjection.h | 97 ++- 15 files changed, 1371 insertions(+), 1353 deletions(-) diff --git a/Code/Projections/otbMapProjection.txx b/Code/Projections/otbMapProjection.txx index 98b5a7a67b..0df15ccd72 100644 --- a/Code/Projections/otbMapProjection.txx +++ b/Code/Projections/otbMapProjection.txx @@ -1,18 +1,18 @@ /*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbMapProjection_txx @@ -23,96 +23,94 @@ namespace otb { - -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::MapProjection() : Superclass(SpaceDimension,ParametersDimension) -{ - m_MapProjection = new OssimMapProjectionType(); -} - -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::~MapProjection() -{ - delete m_MapProjection; -} - - -/// Method to set the projection ellipsoid -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetEllipsoid() -{ - ossimEllipsoid ellipsoid=ossimEllipsoid(); - m_MapProjection->setEllipsoid(ellipsoid); -} -/// Method to set the projection ellipsoid by copy -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetEllipsoid(const ossimEllipsoid &ellipsoid) -{ - m_MapProjection->setEllipsoid(ellipsoid); -} - -///// Method to set the projection ellipsoid by knowing its code -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetEllipsoid(std::string code) -{ - const ossimEllipsoid *ellipsoid = ossimEllipsoidFactory::instance()->create(ossimString(code)); - double a=ellipsoid->getA(); - //std::cout <<a<< std::endl; - double b=ellipsoid->getB(); - //std::cout <<b<< std::endl; - //ossimString codes=ellipsoid->name(); - //std::cout <<codes<< std::endl; - ossimEllipsoid ellipse(a,b); - - delete m_MapProjection; - m_MapProjection= new OssimMapProjectionType(ellipse); -} - -///// Method to set the projection ellipsoid by knowing its axis -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetEllipsoid(const double &major_axis, const double &minor_axis) -{ - ossimEllipsoid ellipse(major_axis,minor_axis); - - delete m_MapProjection; - m_MapProjection= new OssimMapProjectionType(ellipse); -} - -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::OutputPointType -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::TransformPoint(const InputPointType & point) const -{ - OutputPointType outputPoint; - - switch(DirectionOfMapping) - { - case INVERSE: - { - otbGenericMsgDebugMacro(<< "Cartographic coordinates: (" << point[0] << "," << point[1] << ")"); - - //from "itk::point" to "ossim::ossimDpt" - ossimDpt ossimDPoint(point[0], point[1]); - - //map projection - ossimGpt ossimGPoint; - ossimGPoint=m_MapProjection->inverse(ossimDPoint); - - outputPoint[0]=ossimGPoint.lon; - outputPoint[1]=ossimGPoint.lat; - otbGenericMsgDebugMacro(<< "Geographic coordinates (long/lat) : (" << outputPoint[0] << "," << outputPoint[1] << ")"); - break; - } - case FORWARD: + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::MapProjection() : Superclass(SpaceDimension,ParametersDimension) + { + m_MapProjection = new OssimMapProjectionType(); + } + + + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::~MapProjection() + { + delete m_MapProjection; + } + + + /// Method to set the projection ellipsoid + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetEllipsoid() + { + ossimEllipsoid ellipsoid=ossimEllipsoid(); + m_MapProjection->setEllipsoid(ellipsoid); + } + /// Method to set the projection ellipsoid by copy + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetEllipsoid(const ossimEllipsoid &ellipsoid) + { + m_MapProjection->setEllipsoid(ellipsoid); + } + + ///// Method to set the projection ellipsoid by knowing its code + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetEllipsoid(std::string code) + { + const ossimEllipsoid *ellipsoid = ossimEllipsoidFactory::instance()->create(ossimString(code)); + double a=ellipsoid->getA(); + //std::cout <<a<< std::endl; + double b=ellipsoid->getB(); + //std::cout <<b<< std::endl; + //ossimString codes=ellipsoid->name(); + //std::cout <<codes<< std::endl; + ossimEllipsoid ellipse(a,b); + delete m_MapProjection; + m_MapProjection= new OssimMapProjectionType(ellipse); + } + + ///// Method to set the projection ellipsoid by knowing its axis + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetEllipsoid(const double &major_axis, const double &minor_axis) + { + ossimEllipsoid ellipse(major_axis,minor_axis); + delete m_MapProjection; + m_MapProjection= new OssimMapProjectionType(ellipse); + } + + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::OutputPointType + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::TransformPoint(const InputPointType & point) const + { + OutputPointType outputPoint; + + switch(DirectionOfMapping) + { + case INVERSE: + { + otbMsgDevMacro(<< "Cartographic coordinates: (" << point[0] << "," << point[1] << ")"); + + //from "itk::point" to "ossim::ossimDpt" + ossimDpt ossimDPoint(point[0], point[1]); + + //map projection + ossimGpt ossimGPoint; + ossimGPoint=m_MapProjection->inverse(ossimDPoint); + + outputPoint[0]=ossimGPoint.lon; + outputPoint[1]=ossimGPoint.lat; + otbMsgDevMacro(<< "Geographic coordinates (long/lat) : (" << outputPoint[0] << "," << outputPoint[1] << ")"); + break; + } + case FORWARD: { - //from "itk::point" to "ossim::ossimGpt" + //from "itk::point" to "ossim::ossimGpt" ossimGpt ossimGPoint(point[1], point[0]); //map projection @@ -123,231 +121,230 @@ MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensi outputPoint[1]=ossimDPoint.y; break; } - default: - { - itkExceptionMacro(<<"Model is INVERSE or FORWARD only !!"); - break; - } - } + default: + { + itkExceptionMacro(<<"Model is INVERSE or FORWARD only !!"); + break; + } + } + + return outputPoint; + } - return outputPoint; -} - - + + + ///\return The geographic point corresponding to (0,0) + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::InputPointType + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::Origin() + { + ossimGpt ossimOrigin=m_MapProjection->origin(); + InputPointType otbOrigin; + otbOrigin[0]= ossimOrigin.lat; + otbOrigin[1]= ossimOrigin.lon; -///\return The geographic point corresponding to (0,0) -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::InputPointType -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::Origin() -{ - ossimGpt ossimOrigin=m_MapProjection->origin(); - InputPointType otbOrigin; - - otbOrigin[0]= ossimOrigin.lat; - otbOrigin[1]= ossimOrigin.lon; - - return otbOrigin; -} - -///\return The False Northing(avoid negative coordinates) -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetFalseNorthing() const -{ - double falseNorthing=m_MapProjection->getFalseNorthing(); - - return falseNorthing; -} - -///\return The FalseEasting(avoid negative coordinates) -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetFalseEasting() const -{ - double falseEasting=m_MapProjection->getFalseEasting(); - - return falseEasting; -} - -///\return The StandardParallel1(depends on the projection type) -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetStandardParallel1() const -{ - double standardParallel1=m_MapProjection->getStandardParallel1(); - - return standardParallel1; -} - -///\return The StandardParallel2(depends on the projection type) -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetStandardParallel2() const -{ - double standardParallel2=m_MapProjection->getStandardParallel2(); - - return standardParallel2; -} - -///\return The projection name -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -std::string -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetProjectionName() const -{ - std::string projectionName; - projectionName=m_MapProjection->getProjectionName(); - - return projectionName; -} - -///Check if the projection is geographic -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -bool -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::IsGeographic() const -{ - return (m_MapProjection->isGeographic()); -} - -///\return the major axis of the ellipsoid -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetA() const -{ - double majorAxis=m_MapProjection->getA(); - - return majorAxis; -} - -///\return the minor axis of the ellipsoid -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetB() const -{ - double minorAxis=m_MapProjection->getB(); - - return minorAxis; -} - -///\return the flatening of the ellipsoid -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -double -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetF() const -{ - double flattening=m_MapProjection->getF(); - - return flattening; -} - -///\return The resolution in meters -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::OutputPointType -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetMetersPerPixel() const -{ - ossimDpt ossimMetersPerPixels=m_MapProjection->getMetersPerPixel(); - OutputPointType metersPerPixels; + return otbOrigin; + } - metersPerPixels[0]=ossimMetersPerPixels.x; - metersPerPixels[1]=ossimMetersPerPixels.y; + ///\return The False Northing(avoid negative coordinates) + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetFalseNorthing() const + { + double falseNorthing=m_MapProjection->getFalseNorthing(); + + return falseNorthing; + } - return metersPerPixels; -} - -///\return The resolution in degree -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::OutputPointType -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::GetDecimalDegreesPerPixel() const -{ - ossimDpt ossimDecimalDegreesPerPixels=m_MapProjection->getDecimalDegreesPerPixel(); - OutputPointType DecimalDegreesPerPixels; + ///\return The FalseEasting(avoid negative coordinates) + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetFalseEasting() const + { + double falseEasting=m_MapProjection->getFalseEasting(); + + return falseEasting; + } - DecimalDegreesPerPixels[0]=ossimDecimalDegreesPerPixels.x; - DecimalDegreesPerPixels[1]=ossimDecimalDegreesPerPixels.y; + ///\return The StandardParallel1(depends on the projection type) + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetStandardParallel1() const + { + double standardParallel1=m_MapProjection->getStandardParallel1(); + + return standardParallel1; + } - return DecimalDegreesPerPixels; -} - -///Set the ellipsoid axis -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetAB(double a, double b) -{ - m_MapProjection->setAB(a,b); -} - -///Set the origin -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetOrigin(const InputPointType &origin) -{ - ossimGpt ossimOrigin(origin[0], origin[1]); - m_MapProjection->setOrigin(ossimOrigin); -} - -///Set the map resolution in meters -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetMetersPerPixel(const OutputPointType &point) -{ossimDpt ossimDPoint(point[0], point[1]); -m_MapProjection->setMetersPerPixel(ossimDPoint); -} - -///Set the map resolution in degree -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::SetDecimalDegreesPerPixel(const OutputPointType &point) -{ - ossimDpt ossimDPoint(point[0], point[1]); - m_MapProjection->setDecimalDegreesPerPixel(ossimDPoint); -} - -///\return an approximation of the resolution in degree -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::ComputeDegreesPerPixel(const InputPointType &ground, const OutputPointType &metersPerPixel, double &deltaLat, double &deltaLon) -{ - ossimDpt ossimMetersPerPixel(metersPerPixel[0], metersPerPixel[1]); - ossimGpt ossimGround(ground[0],ground[1]); - - m_MapProjection->computeDegreesPerPixel(ossimGround,ossimMetersPerPixel,deltaLat,deltaLon); -} - -///\return an approximation of the resolution in meters -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::ComputeMetersPerPixel(const InputPointType ¢er, double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel) -{ - //Correction - ossimGpt ossimCenter(center[0],center[1]); - ossimDpt ossimMetersPerPixel; - m_MapProjection->computeMetersPerPixel(ossimCenter,deltaDegreesPerPixelLat, deltaDegreesPerPixelLon,ossimMetersPerPixel); - metersPerPixel[0]=ossimMetersPerPixel.x; - metersPerPixel[1]=ossimMetersPerPixel.y; -} - -///\return an approximation of the resolution in meters -template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> -void -MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> -::ComputeMetersPerPixel(double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel) -{ - ossimDpt ossimMetersPerPixel; - m_MapProjection->computeMetersPerPixel(deltaDegreesPerPixelLat, deltaDegreesPerPixelLon,ossimMetersPerPixel); - metersPerPixel[0]=ossimMetersPerPixel.x; - metersPerPixel[1]=ossimMetersPerPixel.y; -} + ///\return The StandardParallel2(depends on the projection type) + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetStandardParallel2() const + { + double standardParallel2=m_MapProjection->getStandardParallel2(); + + return standardParallel2; + } + + ///\return The projection name + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + std::string + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetProjectionName() const + { + std::string projectionName; + projectionName=m_MapProjection->getProjectionName(); + + return projectionName; + } + + ///Check if the projection is geographic + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + bool + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::IsGeographic() const + { + return (m_MapProjection->isGeographic()); + } + + ///\return the major axis of the ellipsoid + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetA() const + { + double majorAxis=m_MapProjection->getA(); + + return majorAxis; + } + + ///\return the minor axis of the ellipsoid + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetB() const + { + double minorAxis=m_MapProjection->getB(); + + return minorAxis; + } + + ///\return the flatening of the ellipsoid + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + double + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetF() const + { + double flattening=m_MapProjection->getF(); + + return flattening; + } + + ///\return The resolution in meters + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::OutputPointType + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetMetersPerPixel() const + { + ossimDpt ossimMetersPerPixels=m_MapProjection->getMetersPerPixel(); + OutputPointType metersPerPixels; + + metersPerPixels[0]=ossimMetersPerPixels.x; + metersPerPixels[1]=ossimMetersPerPixels.y; + + return metersPerPixels; + } + + ///\return The resolution in degree + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + typename MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform>::OutputPointType + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::GetDecimalDegreesPerPixel() const + { + ossimDpt ossimDecimalDegreesPerPixels=m_MapProjection->getDecimalDegreesPerPixel(); + OutputPointType DecimalDegreesPerPixels; + + DecimalDegreesPerPixels[0]=ossimDecimalDegreesPerPixels.x; + DecimalDegreesPerPixels[1]=ossimDecimalDegreesPerPixels.y; + + return DecimalDegreesPerPixels; + } + + ///Set the ellipsoid axis + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetAB(double a, double b) + { + m_MapProjection->setAB(a,b); + } + + ///Set the origin + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetOrigin(const InputPointType &origin) + { + ossimGpt ossimOrigin(origin[0], origin[1]); + m_MapProjection->setOrigin(ossimOrigin); + } + + ///Set the map resolution in meters + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetMetersPerPixel(const OutputPointType &point) + { + ossimDpt ossimDPoint(point[0], point[1]); + m_MapProjection->setMetersPerPixel(ossimDPoint); + } + + ///Set the map resolution in degree + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::SetDecimalDegreesPerPixel(const OutputPointType &point) + { + ossimDpt ossimDPoint(point[0], point[1]); + m_MapProjection->setDecimalDegreesPerPixel(ossimDPoint); + } + + ///\return an approximation of the resolution in degree + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::ComputeDegreesPerPixel(const InputPointType &ground, const OutputPointType &metersPerPixel, double &deltaLat, double &deltaLon) + { + ossimDpt ossimMetersPerPixel(metersPerPixel[0], metersPerPixel[1]); + ossimGpt ossimGround(ground[0],ground[1]); + m_MapProjection->computeDegreesPerPixel(ossimGround,ossimMetersPerPixel,deltaLat,deltaLon); + } + + ///\return an approximation of the resolution in meters + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::ComputeMetersPerPixel(const InputPointType ¢er, double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel) + { + //Correction + ossimGpt ossimCenter(center[0],center[1]); + ossimDpt ossimMetersPerPixel; + m_MapProjection->computeMetersPerPixel(ossimCenter,deltaDegreesPerPixelLat, deltaDegreesPerPixelLon,ossimMetersPerPixel); + metersPerPixel[0]=ossimMetersPerPixel.x; + metersPerPixel[1]=ossimMetersPerPixel.y; + } + + ///\return an approximation of the resolution in meters + template<class TOssimMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions, InverseOrForwardTransformationEnum Transform> + void + MapProjection<TOssimMapProjection, TScalarType, NInputDimensions, NOutputDimensions, Transform> + ::ComputeMetersPerPixel(double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel) + { + ossimDpt ossimMetersPerPixel; + m_MapProjection->computeMetersPerPixel(deltaDegreesPerPixelLat, deltaDegreesPerPixelLon,ossimMetersPerPixel); + metersPerPixel[0]=ossimMetersPerPixel.x; + metersPerPixel[1]=ossimMetersPerPixel.y; + } } // namespace otb #endif diff --git a/Code/Projections/otbMapToMapProjection.h b/Code/Projections/otbMapToMapProjection.h index 899700d5e3..2bcb218f63 100644 --- a/Code/Projections/otbMapToMapProjection.h +++ b/Code/Projections/otbMapToMapProjection.h @@ -1,18 +1,18 @@ /*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbMapToMapProjection_h @@ -27,79 +27,75 @@ namespace otb { - - -/** \class MapToMapProjection - - * \brief Class for switching from a Map Projection coordinates to other Map Projection coordinates. - * It converts MapProjection1 coordinates to MapProjection2 coordinates by using MapProjection methods. - * It takes a point in input. - * (X_1, Y_1) -> (lat, lon) -> (X_2, Y_2) - * \ingroup Transform - */ -template <class TInputMapProjection, - class TOutputMapProjection, - class TScalarType=double, - unsigned int NInputDimensions=2, - unsigned int NOutputDimensions=2> -class ITK_EXPORT MapToMapProjection: public itk::Transform<TScalarType, // Data type for scalars - NInputDimensions, // Number of dimensions in the input space - NOutputDimensions> // Number of dimensions in the output space -{ -public : - - /** Standard class typedefs */ - typedef itk::Transform< TScalarType, - NInputDimensions, - NOutputDimensions > Superclass; - typedef MapToMapProjection Self; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef TInputMapProjection InputMapProjectionType; - typedef TOutputMapProjection OutputMapProjectionType; - typedef itk::Point<TScalarType,NInputDimensions > InputPointType; - typedef itk::Point<TScalarType,NOutputDimensions > OutputPointType; - - - - /** Method for creation through the object factory. */ - itkNewMacro( Self ); - - /** Run-time type information (and related methods). */ - itkTypeMacro( MapToMapProjection, itk::Transform ); - - itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); - itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); - itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions); - itkStaticConstMacro(ParametersDimension, unsigned int,NInputDimensions*(NInputDimensions+1)); - - /** Set MapProjection1. */ - itkSetObjectMacro(InputMapProjection,InputMapProjectionType); - - /** Set MapProjection2. */ - itkSetObjectMacro(OutputMapProjection,OutputMapProjectionType); - - /** Compute MapProjection1 coordinates to MapProjection2 coordinates. */ - OutputPointType ComputeProjection1ToProjection2(const InputPointType &point1); - - /** Compute MapProjection1 coordinates to MapProjection2 coordinates. */ - InputPointType ComputeProjection2ToProjection1(const OutputPointType &point2); - -protected: - MapToMapProjection(); - ~MapToMapProjection(); - - TInputMapProjection* m_InputMapProjection; - TOutputMapProjection* m_OutputMapProjection; - -private: - MapToMapProjection(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - -}; - + + /** \class MapToMapProjection + + * \brief Class for switching from a Map Projection coordinates to other Map Projection coordinates. + * It converts MapProjection1 coordinates to MapProjection2 coordinates by using MapProjection methods. + * It takes a point in input. + * (X_1, Y_1) -> (lat, lon) -> (X_2, Y_2) + * \ingroup Transform + */ + template <class TInputMapProjection, + class TOutputMapProjection, + class TScalarType=double, + unsigned int NInputDimensions=2, + unsigned int NOutputDimensions=2> + class ITK_EXPORT MapToMapProjection: public itk::Transform<TScalarType, // Data type for scalars + NInputDimensions, // Number of dimensions in the input space + NOutputDimensions> // Number of dimensions in the output space + { + public : + /** Standard class typedefs */ + typedef itk::Transform< TScalarType, + NInputDimensions, + NOutputDimensions > Superclass; + typedef MapToMapProjection Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef TInputMapProjection InputMapProjectionType; + typedef TOutputMapProjection OutputMapProjectionType; + typedef itk::Point<TScalarType,NInputDimensions > InputPointType; + typedef itk::Point<TScalarType,NOutputDimensions > OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( MapToMapProjection, itk::Transform ); + + itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); + itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions*(NInputDimensions+1)); + + /** Set MapProjection1. */ + itkSetObjectMacro(InputMapProjection,InputMapProjectionType); + + /** Set MapProjection2. */ + itkSetObjectMacro(OutputMapProjection,OutputMapProjectionType); + + /** Compute MapProjection1 coordinates to MapProjection2 coordinates. */ + OutputPointType ComputeProjection1ToProjection2(const InputPointType &point1); + + /** Compute MapProjection1 coordinates to MapProjection2 coordinates. */ + InputPointType ComputeProjection2ToProjection1(const OutputPointType &point2); + + protected: + MapToMapProjection(); + ~MapToMapProjection(); + + TInputMapProjection* m_InputMapProjection; + TOutputMapProjection* m_OutputMapProjection; + + private: + MapToMapProjection(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + }; + } // namespace otb #ifndef OTB_MANUAL_INSTANTIATION diff --git a/Code/Projections/otbMapToMapProjection.txx b/Code/Projections/otbMapToMapProjection.txx index f0a299aab6..7a2edb8171 100644 --- a/Code/Projections/otbMapToMapProjection.txx +++ b/Code/Projections/otbMapToMapProjection.txx @@ -1,18 +1,18 @@ /*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbMapToMapProjection_txx @@ -22,53 +22,93 @@ namespace otb { - -template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions> -::MapToMapProjection() -: Superclass(SpaceDimension,ParametersDimension) -{ -} -template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions> -::~MapToMapProjection() -{ -} - -///Pass from projection 1 to projection 2 -template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -typename MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType -MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::ComputeProjection1ToProjection2(const InputPointType &point1) -{ - InputPointType geopoint; - OutputPointType point2; - - //(lat,lon) projection - geopoint=m_InputMapProjection->Inverse(point1); - //map projection - point2=m_OutputMapProjection->Forward(geopoint); - - return point2; -} - -///Pass from projection 2 to projection 1 -template<class TInputMapProjection, class TOutputMapProjection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> -typename MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::InputPointType -MapToMapProjection<TInputMapProjection, TOutputMapProjection, TScalarType, NInputDimensions, NOutputDimensions>::ComputeProjection2ToProjection1(const OutputPointType &point2) -{ - - OutputPointType geopoint; - InputPointType point1; - - //(lat,lon) projection - geopoint=m_OutputMapProjection->Inverse(point2); - //map projection - point1=m_InputMapProjection->Forward(geopoint); - - return point1; -} - + template<class TInputMapProjection, + class TOutputMapProjection, + class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions> + MapToMapProjection<TInputMapProjection, + TOutputMapProjection, + TScalarType, + NInputDimensions, + NOutputDimensions> + ::MapToMapProjection() + : Superclass(SpaceDimension,ParametersDimension) + { + } + + template<class TInputMapProjection, + class TOutputMapProjection, + class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions> + MapToMapProjection<TInputMapProjection, + TOutputMapProjection, + TScalarType, + NInputDimensions, + NOutputDimensions> + ::~MapToMapProjection() + { + } + + ///Pass from projection 1 to projection 2 + template<class TInputMapProjection, + class TOutputMapProjection, + class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions> + typename MapToMapProjection<TInputMapProjection, + TOutputMapProjection, + TScalarType, + NInputDimensions, + NOutputDimensions>::OutputPointType + MapToMapProjection<TInputMapProjection, + TOutputMapProjection, + TScalarType, + NInputDimensions, + NOutputDimensions>::ComputeProjection1ToProjection2(const InputPointType &point1) + { + InputPointType geopoint; + OutputPointType point2; + + //(lat,lon) projection + geopoint=m_InputMapProjection->Inverse(point1); + //map projection + point2=m_OutputMapProjection->Forward(geopoint); + + return point2; + } + + ///Pass from projection 2 to projection 1 + template<class TInputMapProjection, + class TOutputMapProjection, + class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions> + typename MapToMapProjection<TInputMapProjection, + TOutputMapProjection, + TScalarType, + NInputDimensions, + NOutputDimensions>::InputPointType + MapToMapProjection<TInputMapProjection, + TOutputMapProjection, + TScalarType, + NInputDimensions, + NOutputDimensions>::ComputeProjection2ToProjection1(const OutputPointType &point2) + { + + OutputPointType geopoint; + InputPointType point1; + + //(lat,lon) projection + geopoint=m_OutputMapProjection->Inverse(point2); + //map projection + point1=m_InputMapProjection->Forward(geopoint); + + return point1; + } + } // namespace otb #endif diff --git a/Code/Projections/otbMollweidMapProjection.cxx b/Code/Projections/otbMollweidMapProjection.cxx index 15b4ae12ea..e252198e05 100644 --- a/Code/Projections/otbMollweidMapProjection.cxx +++ b/Code/Projections/otbMollweidMapProjection.cxx @@ -1,18 +1,18 @@ /*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -20,63 +20,63 @@ namespace otb { - -MollweidMapProjection -::MollweidMapProjection() -{ - m_MollweidProjection = new ossimMollweidProjection(); + + MollweidMapProjection + ::MollweidMapProjection() + { + m_MollweidProjection = new ossimMollweidProjection(); + } + + MollweidMapProjection + ::~MollweidMapProjection() + { + delete m_MollweidProjection; + } + + ///Set the false easting + void MollweidMapProjection + ::SetFalseEasting(double falseEasting) + { + m_MollweidProjection->setFalseEasting(falseEasting); + } + + ///Set the false Northing + void MollweidMapProjection + ::SetFalseNorthing(double falseNorthing) + { + m_MollweidProjection->setFalseNorthing(falseNorthing); + } + + ///Set the default parameters + void MollweidMapProjection + ::SetDefaults() + { + m_MollweidProjection->setDefaults(); + } + + ///\return the false northing (avoid negative coordinates) + double MollweidMapProjection + ::GetFalseNorthing() const + { + double falseNorthing=m_MollweidProjection->getFalseNorthing(); + + return falseNorthing; + } + + ///\return the false easting (avoid negative coordinates) + double MollweidMapProjection + ::GetFalseEasting() const + { + double falseEasting=m_MollweidProjection->getFalseEasting(); + + return falseEasting; } - -MollweidMapProjection -::~MollweidMapProjection() -{ - delete m_MollweidProjection; -} - -///Set the false easting -void MollweidMapProjection -::SetFalseEasting(double falseEasting) -{ - m_MollweidProjection->setFalseEasting(falseEasting); -} - -///Set the false Northing -void MollweidMapProjection -::SetFalseNorthing(double falseNorthing) -{ - m_MollweidProjection->setFalseNorthing(falseNorthing); -} - -///Set the default parameters -void MollweidMapProjection -::SetDefaults() -{ - m_MollweidProjection->setDefaults(); -} - -///\return the false northing (avoid negative coordinates) -double MollweidMapProjection -::GetFalseNorthing() const -{ - double falseNorthing=m_MollweidProjection->getFalseNorthing(); - - return falseNorthing; -} - -///\return the false easting (avoid negative coordinates) -double MollweidMapProjection -::GetFalseEasting() const -{ - double falseEasting=m_MollweidProjection->getFalseEasting(); - - return falseEasting; -} - -void MollweidMapProjection -::SetParameters(double falseEasting,double falseNorthing) -{ - m_MollweidProjection->setFalseEastingNorthing(falseEasting,falseNorthing); -} - + + void MollweidMapProjection + ::SetParameters(double falseEasting,double falseNorthing) + { + m_MollweidProjection->setFalseEastingNorthing(falseEasting,falseNorthing); + } + } // namespace otb diff --git a/Code/Projections/otbMollweidMapProjection.h b/Code/Projections/otbMollweidMapProjection.h index c76008c205..a823be02ac 100644 --- a/Code/Projections/otbMollweidMapProjection.h +++ b/Code/Projections/otbMollweidMapProjection.h @@ -1,18 +1,18 @@ /*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbMollweidMapProjection_h @@ -28,52 +28,43 @@ namespace otb * \brief This class implements the Mollweid map projection. * It converts coordinates in longitude,latitude to Mollweid map coordinates. */ -class ITK_EXPORT MollweidMapProjection : public MapProjection<ossimMollweidProjection> -{ + class ITK_EXPORT MollweidMapProjection : public MapProjection<ossimMollweidProjection> + { public : - - /** Standard class typedefs. */ - typedef MollweidMapProjection Self; - typedef MapProjection<ossimMollweidProjection> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef Superclass::ScalarType ScalarType; - typedef itk::Point<ScalarType,2 > InputPointType; - typedef itk::Point<ScalarType,2 > OutputPointType; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro( MollweidMapProjection, MapProjection ); - - virtual void SetFalseEasting(double falseEasting); - - virtual void SetFalseNorthing(double falseNorthing); - - virtual double GetFalseNorthing() const; - - virtual double GetFalseEasting() const; - - virtual void SetParameters(double falseEasting,double falseNorthing); - - virtual void SetDefaults(); - -protected: - - MollweidMapProjection(); - virtual ~MollweidMapProjection(); - - ossimMollweidProjection* m_MollweidProjection; - -private : - - MollweidMapProjection(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - -}; - + /** Standard class typedefs. */ + typedef MollweidMapProjection Self; + typedef MapProjection<ossimMollweidProjection> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef Superclass::ScalarType ScalarType; + typedef itk::Point<ScalarType,2 > InputPointType; + typedef itk::Point<ScalarType,2 > OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro( MollweidMapProjection, MapProjection ); + virtual void SetFalseEasting(double falseEasting); + virtual void SetFalseNorthing(double falseNorthing); + virtual double GetFalseNorthing() const; + virtual double GetFalseEasting() const; + virtual void SetParameters(double falseEasting,double falseNorthing); + virtual void SetDefaults(); + + protected: + MollweidMapProjection(); + virtual ~MollweidMapProjection(); + + ossimMollweidProjection* m_MollweidProjection; + + private : + MollweidMapProjection(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + }; + } // namespace otb diff --git a/Code/Projections/otbOrthoRectificationFilter.h b/Code/Projections/otbOrthoRectificationFilter.h index 00eb78b65d..47a7bcc38d 100644 --- a/Code/Projections/otbOrthoRectificationFilter.h +++ b/Code/Projections/otbOrthoRectificationFilter.h @@ -1,18 +1,18 @@ /*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbOrthoRectificationFilter_h @@ -30,118 +30,113 @@ namespace otb { - - - -/** \class OrthoRectificationFilter -* -* \brief Class for Orthorectifying an image -* -* This class is used to apply map projection and sensor model transformation -* to orthorectify an image, with or without DEM. -* -*/ - -template <class TInputImage, - class TOutputImage, - class TMapProjection, - class TInterpolatorPrecision=double> -class ITK_EXPORT OrthoRectificationFilter : public StreamingResampleImageFilter<TInputImage, TOutputImage,TInterpolatorPrecision> -{ -public : + /** \class OrthoRectificationFilter + * + * \brief Class for Orthorectifying an image + * + * This class is used to apply map projection and sensor model transformation + * to orthorectify an image, with or without DEM. + * + */ - /** Standard class typedefs */ - typedef StreamingResampleImageFilter<TInputImage, TOutputImage,TInterpolatorPrecision> Superclass; - typedef OrthoRectificationFilter Self; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef typename TInputImage::IndexType IndexType; - typedef typename TInputImage::SizeType SizeType; - typedef typename TInputImage::SpacingType SpacingType; - typedef typename TInputImage::PointType PointType; - typedef typename TInputImage::RegionType RegionType; - - typedef typename TOutputImage::PixelType OutputPixelType; - - typedef TMapProjection MapProjectionType; - typedef typename TMapProjection::Pointer MapProjectionPointerType; - - typedef InverseSensorModel<double> SensorModelType; - typedef typename SensorModelType::Pointer SensorModelPointerType; - - typedef CompositeTransform< MapProjectionType,SensorModelType> CompositeTransformType; - typedef typename CompositeTransformType::Pointer CompositeTransformPointerType; - - /** Method for creation through the object factory. */ - itkNewMacro( Self ); - - /** Run-time type information (and related methods). */ - itkTypeMacro( OrthoRectificationFilter, StreamingResampleImageFilter ); - - /** Accessors */ - virtual void SetMapProjection (MapProjectionType* _arg) - { - if (this->m_MapProjection != _arg) + template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision=double> + class ITK_EXPORT OrthoRectificationFilter : public StreamingResampleImageFilter<TInputImage, + TOutputImage, + TInterpolatorPrecision> + { + public : + /** Standard class typedefs */ + typedef StreamingResampleImageFilter<TInputImage, + TOutputImage, + TInterpolatorPrecision> Superclass; + typedef OrthoRectificationFilter Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef typename TInputImage::IndexType IndexType; + typedef typename TInputImage::SizeType SizeType; + typedef typename TInputImage::SpacingType SpacingType; + typedef typename TInputImage::PointType PointType; + typedef typename TInputImage::RegionType RegionType; + + typedef typename TOutputImage::PixelType OutputPixelType; + + typedef TMapProjection MapProjectionType; + typedef typename TMapProjection::Pointer MapProjectionPointerType; + + typedef InverseSensorModel<double> SensorModelType; + typedef typename SensorModelType::Pointer SensorModelPointerType; + + typedef CompositeTransform< MapProjectionType,SensorModelType> CompositeTransformType; + typedef typename CompositeTransformType::Pointer CompositeTransformPointerType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( OrthoRectificationFilter, StreamingResampleImageFilter ); + + /** Accessors */ + virtual void SetMapProjection (MapProjectionType* _arg) { - this->m_MapProjection = _arg; - m_CompositeTransform->SetFirstTransform(_arg); - m_IsComputed = false; - this->Modified(); + if (this->m_MapProjection != _arg) + { + this->m_MapProjection = _arg; + m_CompositeTransform->SetFirstTransform(_arg); + m_IsComputed = false; + this->Modified(); + } } - } - - itkGetObjectMacro(MapProjection, MapProjectionType); + + itkGetObjectMacro(MapProjection, MapProjectionType); + + /** Specify where are DEM files, and load useful ones */ + virtual bool SetDEMDirectory(const std::string& directory) + { + bool b = m_SensorModel->SetDEMDirectory(directory); + this->Modified(); - /** Specify where are DEM files, and load useful ones */ - virtual bool SetDEMDirectory(const std::string& directory) - { - bool b = m_SensorModel->SetDEMDirectory(directory); - this->Modified(); - - return b; - } + return b; + } + + /** Method to decide to use DEM */ + virtual void UseDEM(bool b) + { + m_SensorModel->UseDEM(b); + } + + protected: + OrthoRectificationFilter(); + ~OrthoRectificationFilter(); + void PrintSelf(std::ostream& os, itk::Indent indent) const; + + virtual void GenerateInputRequestedRegion(); + + + private: + OrthoRectificationFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + /** Calculate transformation model from sensor model & map projection composition */ + void ComputeResampleTransformationModel(); + + /** Boolean used to know if transformation model computation is needed */ + bool m_IsComputed; - /** Method to decide to use DEM */ - virtual void UseDEM(bool b) - { - m_SensorModel->UseDEM(b); - } - -protected: - OrthoRectificationFilter(); - ~OrthoRectificationFilter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; - - virtual void GenerateInputRequestedRegion(); - - -private: - - OrthoRectificationFilter(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - - /** Calculate transformation model from sensor model & map projection composition */ - void ComputeResampleTransformationModel(); - - /** Boolean used to know if transformation model computation is needed */ - bool m_IsComputed; - - /** Sensor Model used to transform geographic coordinates in image sensor index */ - SensorModelPointerType m_SensorModel; - - /** Map Projection used to transform cartographic coordinates in geographic coordinates */ + /** Sensor Model used to transform geographic coordinates in image sensor index */ + SensorModelPointerType m_SensorModel; + + /** Map Projection used to transform cartographic coordinates in geographic coordinates */ MapProjectionPointerType m_MapProjection; - - /** Composite Transform of Sensor Model and Map Projection, used for Resampler */ - CompositeTransformPointerType m_CompositeTransform; - -}; - - - - - + + /** Composite Transform of Sensor Model and Map Projection, used for Resampler */ + CompositeTransformPointerType m_CompositeTransform; + + }; + } // namespace otb #ifndef OTB_MANUAL_INSTANTIATION diff --git a/Code/Projections/otbOrthoRectificationFilter.txx b/Code/Projections/otbOrthoRectificationFilter.txx index f800ec0ac7..036257e287 100644 --- a/Code/Projections/otbOrthoRectificationFilter.txx +++ b/Code/Projections/otbOrthoRectificationFilter.txx @@ -1,18 +1,18 @@ /*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _otbOrthoRectificationFilter_txx @@ -22,67 +22,95 @@ namespace otb -{ - - -template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> -OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> -::OrthoRectificationFilter() : otb::StreamingResampleImageFilter<TInputImage, TOutputImage,TInterpolatorPrecision>() -{ - m_SensorModel = SensorModelType::New(); - m_MapProjection = MapProjectionType::New(); - m_CompositeTransform = CompositeTransformType::New(); - m_IsComputed = false; -} - -template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> -OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> -::~OrthoRectificationFilter() -{ -} - -template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> -void OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> +{ + + template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision> + OrthoRectificationFilter<TInputImage, + TOutputImage, + TMapProjection, + TInterpolatorPrecision> + ::OrthoRectificationFilter() : otb::StreamingResampleImageFilter<TInputImage, + TOutputImage, + TInterpolatorPrecision>() + { + m_SensorModel = SensorModelType::New(); + m_MapProjection = MapProjectionType::New(); + m_CompositeTransform = CompositeTransformType::New(); + m_IsComputed = false; + } + + template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision> + OrthoRectificationFilter<TInputImage, + TOutputImage, + TMapProjection, + TInterpolatorPrecision> + ::~OrthoRectificationFilter() + { + } + + template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision> + void OrthoRectificationFilter<TInputImage, + TOutputImage, + TMapProjection, + TInterpolatorPrecision> ::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - - os << indent << "OrthoRectification" << "\n"; -} - - -template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> -void -OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> -::GenerateInputRequestedRegion() -{ - this->ComputeResampleTransformationModel(); + { + Superclass::PrintSelf(os, indent); + + os << indent << "OrthoRectification" << "\n"; + } + + + template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision> + void + OrthoRectificationFilter<TInputImage, + TOutputImage, + TMapProjection, + TInterpolatorPrecision> + ::GenerateInputRequestedRegion() + { + this->ComputeResampleTransformationModel(); + + Superclass::GenerateInputRequestedRegion(); + } + + template <class TInputImage, + class TOutputImage, + class TMapProjection, + class TInterpolatorPrecision> + void + OrthoRectificationFilter<TInputImage, + TOutputImage, + TMapProjection, + TInterpolatorPrecision> + ::ComputeResampleTransformationModel() + { + if (m_IsComputed == false) + { + otbMsgDevMacro(<< "COMPUTE RESAMPLE TRANSFORMATION MODEL"); + typename TOutputImage::Pointer output = this->GetOutput(); - Superclass::GenerateInputRequestedRegion(); -} - -template <class TInputImage, class TOutputImage, class TMapProjection, class TInterpolatorPrecision> -void -OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolatorPrecision> -::ComputeResampleTransformationModel() -{ - if (m_IsComputed == false) - { - otbMsgDevMacro(<< "COMPUTE RESAMPLE TRANSFORMATION MODEL"); - typename TOutputImage::Pointer output = this->GetOutput(); - - // Get OSSIM sensor model from image keywordlist - m_SensorModel->SetImageGeometry(output->GetImageKeywordlist()); - - m_CompositeTransform->SetFirstTransform(m_MapProjection); - m_CompositeTransform->SetSecondTransform(m_SensorModel); - - this->SetTransform(m_CompositeTransform); - - m_IsComputed = true; - } -} - + // Get OSSIM sensor model from image keywordlist + m_SensorModel->SetImageGeometry(output->GetImageKeywordlist()); + m_CompositeTransform->SetFirstTransform(m_MapProjection); + m_CompositeTransform->SetSecondTransform(m_SensorModel); + this->SetTransform(m_CompositeTransform); + m_IsComputed = true; + } + } + } //namespace otb #endif diff --git a/Code/Projections/otbSensorModelBase.h b/Code/Projections/otbSensorModelBase.h index 4802946575..d43d531715 100755 --- a/Code/Projections/otbSensorModelBase.h +++ b/Code/Projections/otbSensorModelBase.h @@ -1,18 +1,18 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbSensorModelBase_h @@ -34,69 +34,67 @@ namespace otb * This class allows to transform a geographic point in (lat,long) to a point in the sensor geometry. * (lat,lon) -> (i,j) ou (lat,lon,h) -> (i,j) */ -template <class TScalarType, - unsigned int NInputDimensions=3, - unsigned int NOutputDimensions=2, - unsigned int NParametersDimensions=3> -class ITK_EXPORT SensorModelBase : public itk::Transform<TScalarType, - NInputDimensions, - NOutputDimensions> -{ -public : - /** Standard class typedefs. */ - typedef SensorModelBase Self; - typedef itk::Transform< TScalarType, - NInputDimensions, - NOutputDimensions > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef itk::Point<TScalarType, NInputDimensions > InputPointType; - typedef itk::Point<TScalarType, NOutputDimensions > OutputPointType; - - /** Method for creation through the object factory. */ - itkNewMacro( Self ); - - /** Run-time type information (and related methods). */ - itkTypeMacro( SensorModelBase, Transform ); - - itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); - itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); - itkStaticConstMacro(ParametersDimension, unsigned int, NParametersDimensions); //A voir!! - - /* Get the ImageKeywordlist */ - ImageKeywordlist & GetImageGeometryKeywordlist(void) const; - /* Get an ossimKeywordlist */ - ossimKeywordlist GetOssimKeywordlist(void); - - /* Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ - virtual void SetImageGeometry(ImageKeywordlist image_kwl); - - /* Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ - virtual void SetImageGeometry(ossimKeywordlist &geom_kwl); - -protected: - - SensorModelBase(); - virtual ~SensorModelBase(); - - /** Create the projection ( m_Model). Called by the SetImageGeometry methods */ - void CreateProjection(const ImageKeywordlist & image_kwl); - - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; - - /** ImageKeywordlist */ - ImageKeywordlist m_ImageKeywordlist; - /** Pointer on an ossim projection (created with the keywordlist) */ - ossimProjection * m_Model; - -private : - - SensorModelBase(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - -}; + template <class TScalarType, + unsigned int NInputDimensions=3, + unsigned int NOutputDimensions=2, + unsigned int NParametersDimensions=3> + class ITK_EXPORT SensorModelBase : public itk::Transform<TScalarType, + NInputDimensions, + NOutputDimensions> + { + public : + /** Standard class typedefs. */ + typedef SensorModelBase Self; + typedef itk::Transform< TScalarType, + NInputDimensions, + NOutputDimensions > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef itk::Point<TScalarType, NInputDimensions > InputPointType; + typedef itk::Point<TScalarType, NOutputDimensions > OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( SensorModelBase, Transform ); + + itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); + itkStaticConstMacro(ParametersDimension, unsigned int, NParametersDimensions); //A voir!! + + /* Get the ImageKeywordlist */ + ImageKeywordlist & GetImageGeometryKeywordlist(void) const; + /* Get an ossimKeywordlist */ + ossimKeywordlist GetOssimKeywordlist(void); + + /* Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ + virtual void SetImageGeometry(ImageKeywordlist image_kwl); + + /* Set the Imagekeywordlist and affect the ossim projection ( m_Model) */ + virtual void SetImageGeometry(ossimKeywordlist &geom_kwl); + + protected: + SensorModelBase(); + virtual ~SensorModelBase(); + + /** Create the projection ( m_Model). Called by the SetImageGeometry methods */ + void CreateProjection(const ImageKeywordlist & image_kwl); + + /** PrintSelf method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const; + + /** ImageKeywordlist */ + ImageKeywordlist m_ImageKeywordlist; + /** Pointer on an ossim projection (created with the keywordlist) */ + ossimProjection * m_Model; + + private : + SensorModelBase(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 b2684be9d0..0c9257f538 100755 --- a/Code/Projections/otbSensorModelBase.txx +++ b/Code/Projections/otbSensorModelBase.txx @@ -1,18 +1,18 @@ /*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbSensorModelBase_txx @@ -31,124 +31,124 @@ namespace otb { - -template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > -SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> -::SensorModelBase(): Superclass(OutputSpaceDimension, ParametersDimension) -{ + + template < class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + ::SensorModelBase(): Superclass(OutputSpaceDimension, ParametersDimension) + { + m_Model = NULL; + } + + + template < class TScalarType, + 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; -} - - -template < class TScalarType, - 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; - } -} - - -/// Get the Geometry Keyword list -template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > -ImageKeywordlist & -SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> -::GetImageGeometryKeywordlist(void)const -{ - return m_ImageKeywordlist; -} - -/// Get the Geometry Keyword list -template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > -ossimKeywordlist -SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> -::GetOssimKeywordlist(void) -{ - ossimKeywordlist geom; - m_ImageKeywordlist.convertToOSSIMKeywordlist(geom); + } + } - return geom; -} - -/* 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> -::SetImageGeometry(ImageKeywordlist image_kwl) -{ - m_ImageKeywordlist = image_kwl; - CreateProjection(m_ImageKeywordlist); -} - -/* 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> -::SetImageGeometry(ossimKeywordlist & geom_kwl) -{ - m_ImageKeywordlist.Clear(); - m_ImageKeywordlist.SetKeywordlist(geom_kwl); - CreateProjection(m_ImageKeywordlist); -} - - -///Instatiate the sensor model from metadata. -template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, - unsigned int NParametersDimensions > -void -SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> -::CreateProjection(const ImageKeywordlist & image_kwl) -{ - ossimKeywordlist geom; - - otbMsgDevMacro(<<"CreateProjection(): ossimKeywordlist: "<<geom); - image_kwl.convertToOSSIMKeywordlist(geom); - m_Model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); - if( m_Model == NULL) - { - itkExceptionMacro(<<"Invalid Model pointer m_Model == NULL !\n The ossim keywordlist is bad!"); - } -} - -/** - * PrintSelf method - */ -template < class TScalarType, - unsigned int NInputDimensions, - unsigned int NOutputDimensions, + + /// Get the Geometry Keyword list + template < class TScalarType, + 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); - os << indent << "Model: " << m_Model << std::endl; - os << indent << "Keywordlist: " << m_ImageKeywordlist << std::endl; -} - + ImageKeywordlist & + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + ::GetImageGeometryKeywordlist(void)const + { + return m_ImageKeywordlist; + } + + /// Get the Geometry Keyword list + template < class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + ossimKeywordlist + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + ::GetOssimKeywordlist(void) + { + ossimKeywordlist geom; + m_ImageKeywordlist.convertToOSSIMKeywordlist(geom); + + return geom; + } + + /* 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> + ::SetImageGeometry(ImageKeywordlist image_kwl) + { + m_ImageKeywordlist = image_kwl; + CreateProjection(m_ImageKeywordlist); + } + + /* 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> + ::SetImageGeometry(ossimKeywordlist & geom_kwl) + { + m_ImageKeywordlist.Clear(); + m_ImageKeywordlist.SetKeywordlist(geom_kwl); + CreateProjection(m_ImageKeywordlist); + } + + + ///Instatiate the sensor model from metadata. + template < class TScalarType, + unsigned int NInputDimensions, + unsigned int NOutputDimensions, + unsigned int NParametersDimensions > + void + SensorModelBase< TScalarType,NInputDimensions,NOutputDimensions,NParametersDimensions> + ::CreateProjection(const ImageKeywordlist & image_kwl) + { + ossimKeywordlist geom; + + otbMsgDevMacro(<<"CreateProjection(): ossimKeywordlist: "<<geom); + image_kwl.convertToOSSIMKeywordlist(geom); + m_Model = ossimProjectionFactoryRegistry::instance()->createProjection(geom); + if( m_Model == NULL) + { + itkExceptionMacro(<<"Invalid Model pointer m_Model == NULL !\n The ossim keywordlist is bad!"); + } + } + + /** + * PrintSelf method + */ + template < class TScalarType, + 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); + os << indent << "Model: " << m_Model << std::endl; + os << indent << "Keywordlist: " << m_ImageKeywordlist << std::endl; + } + } // namespace otb #endif diff --git a/Code/Projections/otbSinusoidalMapProjection.cxx b/Code/Projections/otbSinusoidalMapProjection.cxx index e2d4b127af..0013060591 100644 --- a/Code/Projections/otbSinusoidalMapProjection.cxx +++ b/Code/Projections/otbSinusoidalMapProjection.cxx @@ -1,18 +1,18 @@ /*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -20,65 +20,65 @@ namespace otb { - -SinusoidalMapProjection -::SinusoidalMapProjection() -{ - m_SinusoidalProjection = new ossimSinusoidalProjection(); -} - - -SinusoidalMapProjection -::~SinusoidalMapProjection() -{ - delete m_SinusoidalProjection; -} - -///Set the false easting -void SinusoidalMapProjection -::SetFalseEasting(double falseEasting) -{ - m_SinusoidalProjection->setFalseEasting(falseEasting); -} - -///Set the False Northing -void SinusoidalMapProjection -::SetFalseNorthing(double falseNorthing) -{ - m_SinusoidalProjection->setFalseNorthing(falseNorthing); -} - -///Set the default parameter -void SinusoidalMapProjection -::SetDefaults() -{ + + SinusoidalMapProjection + ::SinusoidalMapProjection() + { + m_SinusoidalProjection = new ossimSinusoidalProjection(); + } + + + SinusoidalMapProjection + ::~SinusoidalMapProjection() + { + delete m_SinusoidalProjection; + } + + ///Set the false Easting + void SinusoidalMapProjection + ::SetFalseEasting(double falseEasting) + { + m_SinusoidalProjection->setFalseEasting(falseEasting); + } + + ///Set the False Northing + void SinusoidalMapProjection + ::SetFalseNorthing(double falseNorthing) + { + m_SinusoidalProjection->setFalseNorthing(falseNorthing); + } + + ///Set the default parameter + void SinusoidalMapProjection + ::SetDefaults() + { m_SinusoidalProjection->setDefaults(); -} - -///\return the False Northing (avoid negative coordinates) -double SinusoidalMapProjection -::GetFalseNorthing() const -{ - double falseNorthing=m_SinusoidalProjection->getFalseNorthing(); - - return falseNorthing; -} - -///\return the False Easting (avoid negative coordinates) -double SinusoidalMapProjection -::GetFalseEasting() const -{ - double falseEasting=m_SinusoidalProjection->getFalseEasting(); - - return falseEasting; -} - -void SinusoidalMapProjection + } + + ///\return the False Northing (avoid negative coordinates) + double SinusoidalMapProjection + ::GetFalseNorthing() const + { + double falseNorthing=m_SinusoidalProjection->getFalseNorthing(); + + return falseNorthing; + } + + ///\return the False Easting (avoid negative coordinates) + double SinusoidalMapProjection + ::GetFalseEasting() const + { + double falseEasting=m_SinusoidalProjection->getFalseEasting(); + + return falseEasting; + } + + void SinusoidalMapProjection ::SetParameters(double falseEasting,double falseNorthing) -{ - m_SinusoidalProjection->setFalseEastingNorthing(falseEasting,falseNorthing); -} - - + { + m_SinusoidalProjection->setFalseEastingNorthing(falseEasting,falseNorthing); + } + + } // namespace otb diff --git a/Code/Projections/otbSinusoidalMapProjection.h b/Code/Projections/otbSinusoidalMapProjection.h index 9e292c4df1..577ed10467 100644 --- a/Code/Projections/otbSinusoidalMapProjection.h +++ b/Code/Projections/otbSinusoidalMapProjection.h @@ -1,18 +1,18 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbSinusoidalMapProjection_h @@ -29,51 +29,43 @@ namespace otb * \brief This class implements the Sinusoidal map projection. * It converts coordinates in longitude,latitude to Sinusoidal map coordinates. */ -class ITK_EXPORT SinusoidalMapProjection : public otb::MapProjection<ossimSinusoidalProjection> -{ -public : - - /** Standard class typedefs. */ - typedef SinusoidalMapProjection Self; - typedef otb::MapProjection<ossimSinusoidalProjection> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef Superclass::ScalarType ScalarType; - typedef itk::Point<ScalarType,2> InputPointType; - typedef itk::Point<ScalarType,2> OutputPointType; - - /** Method for creation through the object factory. */ - itkNewMacro( Self ); - - /** Run-time type information (and related methods). */ - itkTypeMacro( SinusoidalMapProjection, MapProjection ); - - virtual void SetFalseEasting(double falseEasting); - - virtual void SetFalseNorthing(double falseNorthing); - - virtual double GetFalseNorthing() const; - - virtual double GetFalseEasting() const; - - virtual void SetParameters(double falseEasting,double falseNorthing); - - virtual void SetDefaults(); - -protected: - - SinusoidalMapProjection(); - virtual ~SinusoidalMapProjection(); - - ossimSinusoidalProjection* m_SinusoidalProjection; + class ITK_EXPORT SinusoidalMapProjection : public otb::MapProjection<ossimSinusoidalProjection> + { + public : -private : - - SinusoidalMapProjection(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - -}; + /** Standard class typedefs. */ + typedef SinusoidalMapProjection Self; + typedef otb::MapProjection<ossimSinusoidalProjection> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef Superclass::ScalarType ScalarType; + typedef itk::Point<ScalarType,2> InputPointType; + typedef itk::Point<ScalarType,2> OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( SinusoidalMapProjection, MapProjection ); + + virtual void SetFalseEasting(double falseEasting); + virtual void SetFalseNorthing(double falseNorthing); + virtual double GetFalseNorthing() const; + virtual double GetFalseEasting() const; + virtual void SetParameters(double falseEasting,double falseNorthing); + virtual void SetDefaults(); + + protected: + SinusoidalMapProjection(); + virtual ~SinusoidalMapProjection(); + ossimSinusoidalProjection* m_SinusoidalProjection; + + private : + SinusoidalMapProjection(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + }; } // namespace otb diff --git a/Code/Projections/otbTransMercatorMapProjection.cxx b/Code/Projections/otbTransMercatorMapProjection.cxx index 227035b2d7..4e09d774c3 100644 --- a/Code/Projections/otbTransMercatorMapProjection.cxx +++ b/Code/Projections/otbTransMercatorMapProjection.cxx @@ -1,18 +1,18 @@ /*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -20,93 +20,93 @@ namespace otb { - -TransMercatorMapProjection -::TransMercatorMapProjection() -{ - m_TransMercatorProjection = new ossimTransMercatorProjection(); -} - -/// Desctructor - TransMercatorMapProjection - ::~TransMercatorMapProjection() -{ - delete m_TransMercatorProjection; -} - -///Set the default ellipsoid -void TransMercatorMapProjection -::SetEllipsoid() -{ - ossimEllipsoid ellipse(6378137.0,6356752.3142); - ossimGpt origin(49.83,6.16); - - delete m_TransMercatorProjection; - m_TransMercatorProjection = new ossimTransMercatorProjection(ellipse,origin,80000.0,100000.0,1.0); -} - -///Set the false easting -void TransMercatorMapProjection -::SetFalseEasting(double falseEasting) -{ - m_TransMercatorProjection->setFalseEasting(falseEasting); -} - -///Set the False Northing -void TransMercatorMapProjection -::SetFalseNorthing(double falseNorthing) -{ - m_TransMercatorProjection->setFalseNorthing(falseNorthing); -} - -///Set the scale factor -void TransMercatorMapProjection -::SetScaleFactor(double scaleFactor) -{ - m_TransMercatorProjection->setScaleFactor(scaleFactor); -} - -///Set the parameters -void TransMercatorMapProjection -::SetParameters(double falseEasting,double falseNorthing,double scaleFactor) -{ - m_TransMercatorProjection->setParameters(falseEasting, falseNorthing, scaleFactor); -} - -///Set the default parameters -void TransMercatorMapProjection -::SetDefaults() -{ - m_TransMercatorProjection->setDefaults(); -} - -///\return the scale factor -double TransMercatorMapProjection -::GetScaleFactor() const -{ - double scaleFactor; - scaleFactor=m_TransMercatorProjection->getScaleFactor(); - - return scaleFactor; -} - -///\return the false northing (avoid negative coordinates) -double TransMercatorMapProjection -::GetFalseNorthing() const -{ - double falseNorthing=m_TransMercatorProjection->getFalseNorthing(); - - return falseNorthing; -} - -///\return the false easting (avoid negative coordinates) -double TransMercatorMapProjection -::GetFalseEasting() const -{ - double falseEasting=m_TransMercatorProjection->getFalseEasting(); - - return falseEasting; -} - + + TransMercatorMapProjection + ::TransMercatorMapProjection() + { + m_TransMercatorProjection = new ossimTransMercatorProjection(); + } + + /// Desctructor + TransMercatorMapProjection + ::~TransMercatorMapProjection() + { + delete m_TransMercatorProjection; + } + + ///Set the default ellipsoid + void TransMercatorMapProjection + ::SetEllipsoid() + { + ossimEllipsoid ellipse(6378137.0,6356752.3142); + ossimGpt origin(49.83,6.16); + + delete m_TransMercatorProjection; + m_TransMercatorProjection = new ossimTransMercatorProjection(ellipse,origin,80000.0,100000.0,1.0); + } + + ///Set the false Easting + void TransMercatorMapProjection + ::SetFalseEasting(double falseEasting) + { + m_TransMercatorProjection->setFalseEasting(falseEasting); + } + + ///Set the False Northing + void TransMercatorMapProjection + ::SetFalseNorthing(double falseNorthing) + { + m_TransMercatorProjection->setFalseNorthing(falseNorthing); + } + + ///Set the scale factor + void TransMercatorMapProjection + ::SetScaleFactor(double scaleFactor) + { + m_TransMercatorProjection->setScaleFactor(scaleFactor); + } + + ///Set the parameters + void TransMercatorMapProjection + ::SetParameters(double falseEasting,double falseNorthing,double scaleFactor) + { + m_TransMercatorProjection->setParameters(falseEasting, falseNorthing, scaleFactor); + } + + ///Set the default parameters + void TransMercatorMapProjection + ::SetDefaults() + { + m_TransMercatorProjection->setDefaults(); + } + + ///\return the scale factor + double TransMercatorMapProjection + ::GetScaleFactor() const + { + double scaleFactor; + scaleFactor=m_TransMercatorProjection->getScaleFactor(); + + return scaleFactor; + } + + ///\return the false northing (avoid negative coordinates) + double TransMercatorMapProjection + ::GetFalseNorthing() const + { + double falseNorthing=m_TransMercatorProjection->getFalseNorthing(); + + return falseNorthing; + } + + ///\return the false easting (avoid negative coordinates) + double TransMercatorMapProjection + ::GetFalseEasting() const + { + double falseEasting=m_TransMercatorProjection->getFalseEasting(); + + return falseEasting; + } + } // namespace otb diff --git a/Code/Projections/otbTransMercatorMapProjection.h b/Code/Projections/otbTransMercatorMapProjection.h index 72636d415d..92ccac34a5 100644 --- a/Code/Projections/otbTransMercatorMapProjection.h +++ b/Code/Projections/otbTransMercatorMapProjection.h @@ -1,18 +1,18 @@ /*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbTransMercatorMapProjection_h @@ -29,55 +29,43 @@ namespace otb * It converts coordinates in longitude,latitude to TransMercator map coordinates. * */ -class ITK_EXPORT TransMercatorMapProjection : public MapProjection<ossimTransMercatorProjection> -{ -public : - - /** Standard class typedefs. */ - typedef TransMercatorMapProjection Self; - typedef MapProjection<ossimTransMercatorProjection> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef Superclass::ScalarType ScalarType; - typedef itk::Point<ScalarType,2> InputPointType; - typedef itk::Point<ScalarType,2> OutputPointType; - - /** Method for creation through the object factory. */ - itkNewMacro( Self ); - - /** Run-time type information (and related methods). */ - itkTypeMacro( TransMercatorMapProjection, MapProjection ); + class ITK_EXPORT TransMercatorMapProjection : public MapProjection<ossimTransMercatorProjection> + { + public : - virtual void SetEllipsoid(); - - virtual void SetFalseEasting(double falseEasting); - - virtual void SetFalseNorthing(double falseNorthing); - - virtual void SetScaleFactor(double scaleFactor); - - virtual void SetParameters(double falseEasting,double falseNorthing, double scaleFactor); - - virtual void SetDefaults(); - - virtual double GetFalseNorthing() const; - - virtual double GetFalseEasting() const; - - virtual double GetScaleFactor() const; - -protected: - - TransMercatorMapProjection(); - virtual ~TransMercatorMapProjection(); - - ossimTransMercatorProjection* m_TransMercatorProjection; + /** Standard class typedefs. */ + typedef TransMercatorMapProjection Self; + typedef MapProjection<ossimTransMercatorProjection> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef Superclass::ScalarType ScalarType; + typedef itk::Point<ScalarType,2> InputPointType; + typedef itk::Point<ScalarType,2> OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( TransMercatorMapProjection, MapProjection ); + virtual void SetEllipsoid(); + virtual void SetFalseEasting(double falseEasting); + virtual void SetFalseNorthing(double falseNorthing); + virtual void SetScaleFactor(double scaleFactor); + virtual void SetParameters(double falseEasting,double falseNorthing, double scaleFactor); + virtual void SetDefaults(); + virtual double GetFalseNorthing() const; + virtual double GetFalseEasting() const; + virtual double GetScaleFactor() const; + + protected: + TransMercatorMapProjection(); + virtual ~TransMercatorMapProjection(); + ossimTransMercatorProjection* m_TransMercatorProjection; -private : - - TransMercatorMapProjection(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + private : + TransMercatorMapProjection(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented }; diff --git a/Code/Projections/otbUtmMapProjection.cxx b/Code/Projections/otbUtmMapProjection.cxx index 94d2555ee2..ace07d6106 100644 --- a/Code/Projections/otbUtmMapProjection.cxx +++ b/Code/Projections/otbUtmMapProjection.cxx @@ -1,81 +1,81 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "otbUtmMapProjection.h" namespace otb { - -UtmMapProjection -::UtmMapProjection() -{ - m_utmprojection = new ossimUtmProjection(); -} - -UtmMapProjection -::~UtmMapProjection() -{ - delete m_utmprojection; -} - -///Set the zone -void UtmMapProjection -::SetZone(long zone) -{ - delete m_utmprojection; - m_utmprojection= new ossimUtmProjection(zone); -} - -///Set the zone -void UtmMapProjection -::SetZone(const InputPointType &ground) -{ - ossimGpt ossimGround; - ossimGround.lon=ground[0]; - ossimGround.lat=ground[1]; - m_utmprojection->setZone(ossimGround); -} - -///Set the hemisphere -void UtmMapProjection -::SetHemisphere(char hemisphere) -{ - m_utmprojection->setHemisphere(hemisphere); -} - -///\return the zone -long UtmMapProjection -::GetZone() -{ - long zone; - zone=m_utmprojection->getZone(); - - return zone; -} - -///\return the hemisphere -const char UtmMapProjection -::GetHemisphere() const -{ - char hemisphere=0; - hemisphere=m_utmprojection->getHemisphere(); + + UtmMapProjection + ::UtmMapProjection() + { + m_utmprojection = new ossimUtmProjection(); + } + + UtmMapProjection + ::~UtmMapProjection() + { + delete m_utmprojection; + } + + ///Set the zone + void UtmMapProjection + ::SetZone(long zone) + { + delete m_utmprojection; + m_utmprojection= new ossimUtmProjection(zone); + } + + ///Set the zone + void UtmMapProjection + ::SetZone(const InputPointType &ground) + { + ossimGpt ossimGround; + ossimGround.lon=ground[0]; + ossimGround.lat=ground[1]; + m_utmprojection->setZone(ossimGround); + } + + ///Set the hemisphere + void UtmMapProjection + ::SetHemisphere(char hemisphere) + { + m_utmprojection->setHemisphere(hemisphere); + } + + ///\return the zone + long UtmMapProjection + ::GetZone() + { + long zone; + zone=m_utmprojection->getZone(); + + return zone; + } + + ///\return the hemisphere + const char UtmMapProjection + ::GetHemisphere() const + { + char hemisphere=0; + hemisphere=m_utmprojection->getHemisphere(); - return hemisphere; -} - + return hemisphere; + } + } // namespace otb diff --git a/Code/Projections/otbUtmMapProjection.h b/Code/Projections/otbUtmMapProjection.h index f248b313a8..0c6d1286b0 100644 --- a/Code/Projections/otbUtmMapProjection.h +++ b/Code/Projections/otbUtmMapProjection.h @@ -1,18 +1,18 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __otbUtmMapProjection_h @@ -24,53 +24,46 @@ namespace otb { -/** \class UtmMapProjection + /** \class UtmMapProjection * \brief This class implements the UTM map projection. * It converts coordinates in longitude,latitude to UTM map coordinates. */ -class ITK_EXPORT UtmMapProjection : public MapProjection<ossimUtmProjection> -{ -public : - - /** Standard class typedefs. */ - typedef UtmMapProjection Self; - typedef MapProjection<ossimUtmProjection> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - typedef Superclass::ScalarType ScalarType; - typedef itk::Point<ScalarType,2> InputPointType; - typedef itk::Point<ScalarType,2> OutputPointType; - - /** Method for creation through the object factory. */ - itkNewMacro( Self ); - - /** Run-time type information (and related methods). */ - itkTypeMacro( UtmMapProjection, MapProjection ); - - void SetZone(long zone); - - void SetZone(const InputPointType &ground); - - void SetHemisphere(char hemisphere); - - long GetZone(); - - const char GetHemisphere() const; - -protected: - - UtmMapProjection(); - virtual ~UtmMapProjection(); - - ossimUtmProjection* m_utmprojection; - -private: + class ITK_EXPORT UtmMapProjection : public MapProjection<ossimUtmProjection> + { + public : - UtmMapProjection(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - -}; + /** Standard class typedefs. */ + typedef UtmMapProjection Self; + typedef MapProjection<ossimUtmProjection> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef Superclass::ScalarType ScalarType; + typedef itk::Point<ScalarType,2> InputPointType; + typedef itk::Point<ScalarType,2> OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( UtmMapProjection, MapProjection ); + + void SetZone(long zone); + void SetZone(const InputPointType &ground); + void SetHemisphere(char hemisphere); + long GetZone(); + const char GetHemisphere() const; + + protected: + UtmMapProjection(); + virtual ~UtmMapProjection(); + ossimUtmProjection* m_utmprojection; + + private: + UtmMapProjection(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + }; } // namespace otb -- GitLab