Skip to content
Snippets Groups Projects
Commit 6b2ec616 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

TEST: add validation test for otbGeocentricTransform

parent 87504577
No related branches found
No related tags found
No related merge requests found
......@@ -438,6 +438,14 @@ ADD_TEST(prTvVectorDataProjectionFilterFromMapToGeo ${PROJECTIONS_TESTS3}
ADD_TEST(prTuGeocentricTransformNew ${PROJECTIONS_TESTS3} otbGeocentricTransformNew )
ADD_TEST(prTuGeocentricTransform ${PROJECTIONS_TESTS3}
--compare-ascii ${EPSILON} ${BASELINE_FILES}/prTvGeocentricTransform.txt
${TEMP}/prTvGeocentricTransform.txt
otbGeocentricTransform
${TEMP}/prTvGeocentricTransform.txt
)
#=======================================================================================
SET(Projections_SRCS1
otbProjectionBaseNew.cxx
......@@ -468,6 +476,7 @@ otbVectorDataProjectionFilter.cxx
otbVectorDataProjectionFilterFromMapToSensor.cxx
otbVectorDataProjectionFilterFromMapToGeo.cxx
otbGeocentricTransformNew.cxx
otbGeocentricTransform.cxx
)
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbMacro.h"
#include "otbImage.h"
#include "otbGeocentricTransform.h"
int otbGeocentricTransform( int argc, char* argv[] )
{
const char * outFileName = argv[1];
std::ofstream file;
file.open(outFileName);
typedef otb::GeocentricTransform<otb::FORWARD> ProjectionType;
ProjectionType::Pointer projection = ProjectionType::New();
file << std::setprecision(15);
file << "Forward projection: " << std::endl;
itk::Point<double,3> point;
point[0]=0;//lon
point[1]=0;//lat
point[2]=0;//elev
file << point << " -> ";
file << projection->TransformPoint(point);
file << std::endl << std::endl;
// itk::Point<double,3> point;
point[0]=1.4835345f;//lon
point[1]=43.559682611111107f;//lat
point[2]=192.15;//elev
file << point << " -> ";
file << projection->TransformPoint(point);
file << std::endl << std::endl;
typedef otb::GeocentricTransform<otb::INVERSE> InverseProjectionType;
InverseProjectionType::Pointer inverseProjection = InverseProjectionType::New();
file << "Inverse projection: " << std::endl;
point[0]=3771793.97;//X
point[1]=140253.34;//Y
point[2]=5124421.30;//Z
file << point << " -> ";
file << inverseProjection->TransformPoint(point);
file << std::endl << std::endl;
file.close();
return EXIT_SUCCESS;
}
......@@ -36,4 +36,5 @@ void RegisterTests()
REGISTER_TEST(otbVectorDataProjectionFilterFromMapToSensor);
REGISTER_TEST(otbVectorDataProjectionFilterFromMapToGeo);
REGISTER_TEST(otbGeocentricTransformNew);
REGISTER_TEST(otbGeocentricTransform);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment