Commit 7569e93f authored by Julien Michel's avatar Julien Michel
Browse files

Ajout de la classe de base SpatialObjectSource en vue de l'intégration du DXF reader.

parent b99ba2b5
/*=========================================================================
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.
=========================================================================*/
#ifndef _otbSpatialObjectSource_h
#define _otbSpatialObjectSource_h
#include "itkProcessObject.h"
namespace otb
{
/**
* \class SpatialObjectSource
* \brief Base class for filters producing a SpatialObject as output.
* \ingroup DataSources
*/
template <class TSpatialObject>
class ITK_EXPORT SpatialObjectSource
: public itk::ProcessObject
{
public:
/** Standard typedefs */
typedef SpatialObjectSource Self;
typedef itk::ProcessObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Creation througth the object factory */
itkNewMacro(Self);
/** Runtime information */
itkTypeMacro(SpatialObjectSource,ProcessObject);
/** Template parameters typedefs */
typedef TSpatialObject SpatialObjectType;
typedef typename SpatialObjectType::Pointer SpatialObjectPointerType;
/** Data object pointer */
typedef itk::DataObject::Pointer DataObjectPointer;
/**
* Get the output spatial object.
* \return The outptu spatial object.
*/
virtual SpatialObjectType * GetOutput(void);
protected:
/** Constructor */
SpatialObjectSource();
/** Destructor */
~SpatialObjectSource() {}
/** PrintSelf method */
void PrintSelf(std::ostream& os, itk::Indent indent) const;
private:
SpatialObjectSource(const Self&);//purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbSpatialObjectSource.txx"
#endif
#endif
/*=========================================================================
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.
=========================================================================*/
#ifndef _otbSpatialObjectSource_txx
#define _otbSpatialObjectSource_txx
#include "otbSpatialObjectSource.h"
namespace otb
{
/**
* Constructor.
*/
template <class TSpatialObject>
SpatialObjectSource<TSpatialObject>
::SpatialObjectSource()
{
this->Superclass::SetNumberOfRequiredOutputs(1);
this->Superclass::SetNthOutput(0,SpatialObjectType::New().GetPointer());
}
/**
* Get the output image list
* \return The image list produced.
*/
template <class TSpatialObject>
typename SpatialObjectSource<TSpatialObject>::SpatialObjectType *
SpatialObjectSource<TSpatialObject>
::GetOutput(void)
{
if(this->GetNumberOfOutputs()<1)
{
return 0;
}
return static_cast<SpatialObjectType *> (this->ProcessObject::GetOutput(0));
}
/**
* PrintSelf Method
*/
template<class TSpatialObject>
void
SpatialObjectSource<TSpatialObject>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os,indent);
}
}// end namespace otb
#endif
......@@ -307,7 +307,10 @@ ADD_TEST(coTvImageToVectorImageCastFilter ${COMMON_TESTS}
ADD_TEST(coTuImageToPathFilterNew ${COMMON_TESTS}
otbImageToPathFilterNew)
# ------- otb::SpatialObjectSource -------------------------------------------
ADD_TEST(coTuSpatialObjectSourceNew ${COMMON_TESTS}
otbSpatialObjectSourceNew)
# ------- Fichiers sources CXX -----------------------------------
SET(BasicCommon_SRCS
otbSystemTest.cxx
......@@ -346,6 +349,7 @@ otbConcatenateVectorImageFilter.cxx
otbImageToVectorImageCastFilterNew.cxx
otbImageToVectorImageCastFilter.cxx
otbImageToPathFilterNew.cxx
otbSpatialObjectSourceNew.cxx
)
......
......@@ -62,4 +62,5 @@ REGISTER_TEST(otbConcatenateVectorImageFilter);
REGISTER_TEST(otbImageToVectorImageCastFilterNew);
REGISTER_TEST(otbImageToVectorImageCastFilter);
REGISTER_TEST(otbImageToPathFilterNew);
REGISTER_TEST(otbSpatialObjectSourceNew);
}
/*=========================================================================
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 "itkExceptionObject.h"
#include "otbSpatialObjectSource.h"
#include "itkGroupSpatialObject.h"
int otbSpatialObjectSourceNew(int argc, char* argv[])
{
try
{
const unsigned int Dimension = 2;
typedef itk::GroupSpatialObject<Dimension> SpatialObjectType;
typedef otb::SpatialObjectSource<SpatialObjectType> SpatialObjectSourceType;
// Instantiation
SpatialObjectSourceType::Pointer source = SpatialObjectSourceType::New();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject thrown !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Unknown exception thrown !" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -4,7 +4,7 @@ IF(NOT OTB_USE_EXTERNAL_ITK)
SUBDIRS( ITK )
ENDIF(NOT OTB_USE_EXTERNAL_ITK)
SUBDIRS( BGL otbsvm)
SUBDIRS(BGL otbsvm dxflib)
OPTION(OTB_OSSIM_COMPILATION "EXPERIMENTAL: Compile OSSIM library embedded within OTB" OFF)
MARK_AS_ADVANCED(OTB_OSSIM_COMPILATION)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment