Skip to content
Snippets Groups Projects
Commit 841d4d6e authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

TEST : Add tests for otb::Rectangle class

parent daf5b5ec
Branches
Tags
No related merge requests found
...@@ -503,7 +503,20 @@ ADD_TEST(coTvUnaryFunctorNeighborhoodImageFilter ${COMMON_TESTS6} ...@@ -503,7 +503,20 @@ ADD_TEST(coTvUnaryFunctorNeighborhoodImageFilter ${COMMON_TESTS6}
3 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests7 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -663,6 +676,8 @@ otbPolygonNew.cxx ...@@ -663,6 +676,8 @@ otbPolygonNew.cxx
otbPolygon.cxx otbPolygon.cxx
otbUnaryFunctorNeighborhoodImageFilterNew.cxx otbUnaryFunctorNeighborhoodImageFilterNew.cxx
otbUnaryFunctorNeighborhoodImageFilter.cxx otbUnaryFunctorNeighborhoodImageFilter.cxx
otbRectangleNew.cxx
otbRectangle.cxx
) )
SET(BasicCommon_SRCS7 SET(BasicCommon_SRCS7
......
...@@ -37,4 +37,6 @@ void RegisterTests() ...@@ -37,4 +37,6 @@ void RegisterTests()
REGISTER_TEST(otbPolygon); REGISTER_TEST(otbPolygon);
REGISTER_TEST(otbUnaryFunctorNeighborhoodImageFilterNew); REGISTER_TEST(otbUnaryFunctorNeighborhoodImageFilterNew);
REGISTER_TEST(otbUnaryFunctorNeighborhoodImageFilter); REGISTER_TEST(otbUnaryFunctorNeighborhoodImageFilter);
REGISTER_TEST(otbRectangleNew);
REGISTER_TEST(otbRectangle);
} }
/*=========================================================================
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;
}
/*=========================================================================
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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment