diff --git a/Testing/Code/Common/CMakeLists.txt b/Testing/Code/Common/CMakeLists.txt index 7170f7c439d2956f659d76a4d5828355f0292537..e033f6c331210ff22eb18f880a2f4d68116838b6 100644 --- a/Testing/Code/Common/CMakeLists.txt +++ b/Testing/Code/Common/CMakeLists.txt @@ -503,7 +503,20 @@ ADD_TEST(coTvUnaryFunctorNeighborhoodImageFilter ${COMMON_TESTS6} 3 ) +#--------------------otb::Rectangle +ADD_TEST(coTuRectangleNew ${COMMON_TESTS6} + otbRectangleNew) +ADD_TEST(coTvRectangle ${COMMON_TESTS6} +--compare-ascii ${EPS} + ${BASELINE_FILES}/otbRectangleTest.txt + ${TEMP}/otbRectangleTest.txt + otbRectangle + ${TEMP}/otbRectangleTest.txt + 2.12 2.35 12.54 2.45 3. 0.15 1. 1. + + +) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests7 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -663,6 +676,8 @@ otbPolygonNew.cxx otbPolygon.cxx otbUnaryFunctorNeighborhoodImageFilterNew.cxx otbUnaryFunctorNeighborhoodImageFilter.cxx +otbRectangleNew.cxx +otbRectangle.cxx ) SET(BasicCommon_SRCS7 diff --git a/Testing/Code/Common/otbCommonTests6.cxx b/Testing/Code/Common/otbCommonTests6.cxx index 41ebe6c6c90f806ca7acbaf2ab669d040667c98d..cf321e7878af74e3ed8e9e7e5d8731f03087adab 100644 --- a/Testing/Code/Common/otbCommonTests6.cxx +++ b/Testing/Code/Common/otbCommonTests6.cxx @@ -37,4 +37,6 @@ void RegisterTests() REGISTER_TEST(otbPolygon); REGISTER_TEST(otbUnaryFunctorNeighborhoodImageFilterNew); REGISTER_TEST(otbUnaryFunctorNeighborhoodImageFilter); + REGISTER_TEST(otbRectangleNew); + REGISTER_TEST(otbRectangle); } diff --git a/Testing/Code/Common/otbRectangle.cxx b/Testing/Code/Common/otbRectangle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2d633e31631f93ef592ca33a241b450425f725e6 --- /dev/null +++ b/Testing/Code/Common/otbRectangle.cxx @@ -0,0 +1,72 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#include "otbRectangle.h" + +#include <iostream> +#include <fstream> + +int otbRectangle(int argc, char * argv[]) +{ + const char * outfname = argv[1]; + + typedef otb::Rectangle<> RectangleType; + typedef RectangleType::ContinuousIndexType ContinuousIndexType; + typedef RectangleType::VertexListType VertexListType; + typedef VertexListType::ConstIterator IteratorType; + + // Instantiating object + RectangleType::Pointer rectangle1 = RectangleType::New(); + + ContinuousIndexType newVertex; + + newVertex[0]=atof(argv[2]); + newVertex[1]=atof(argv[3]); + rectangle1->AddVertex(newVertex); + + newVertex[0]=atof(argv[4]); + newVertex[1]=atof(argv[5]); + rectangle1->AddVertex(newVertex); + + rectangle1->SetWidth(atof(argv[6])); + rectangle1->SetOrientation(atof(argv[7])); + + + /** Inside the rectangle test*/ + ContinuousIndexType InsideVertex; + InsideVertex[0] = atof(argv[8]); + InsideVertex[1] = atof(argv[9]); + + + std::ofstream outfile(outfname); + + if(rectangle1->IsInside(InsideVertex)) + outfile <<"The point " << InsideVertex << " Is Inside the rectangle" << std::endl; + else + outfile <<"The point " << InsideVertex << " Is Outside the rectangle" << std::endl; + + + + outfile<< "region Size" << rectangle1->GetBoundingRegion().GetSize()<<std::endl; + outfile<< "region Origin" << rectangle1->GetBoundingRegion().GetIndex()<<std::endl; + + + outfile.close(); + + + return EXIT_SUCCESS; +} diff --git a/Testing/Code/Common/otbRectangleNew.cxx b/Testing/Code/Common/otbRectangleNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a94cb60e92c4a487f38f80712893181a59f4d679 --- /dev/null +++ b/Testing/Code/Common/otbRectangleNew.cxx @@ -0,0 +1,29 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + +#include "otbRectangle.h" + +int otbRectangleNew(int argc, char * argv[]) +{ + typedef otb::Rectangle<> RectangleType; + + //Instantiating object + RectangleType::Pointer polygon = RectangleType::New(); + + return EXIT_SUCCESS; +}