From 8e9a889f824558758a1f45885d816230be49dde1 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Wed, 14 Sep 2011 11:55:16 +0200
Subject: [PATCH] ENH: reorganize the applications in subdirs

---
 Applications/CMakeLists.txt                   |  14 +-
 Applications/Hyperspectral/CMakeLists.txt     |   3 +
 .../otbHyperspectralUnmixing.cxx              |   0
 Applications/Test/CMakeLists.txt              |   7 +
 Applications/{ => Test}/otbAddition.cxx       |   0
 Applications/{ => Test}/otbAllocateOutput.cxx |   0
 Applications/{ => Test}/otbCopyInput.cxx      |   0
 Applications/{ => Test}/otbInternalReader.cxx |   0
 .../{ => Test}/otbTestApplication.cxx         |   0
 Applications/Util/CMakeLists.txt              |   5 +
 Applications/{ => Util}/otbExtractROI.cxx     |   0
 Applications/{ => Util}/otbRescale.cxx        |   0
 Applications/{ => Util}/otbSmoothing.cxx      |   0
 Applications/VectorImageFactory.cxx           | 136 ------------------
 14 files changed, 18 insertions(+), 147 deletions(-)
 create mode 100644 Applications/Hyperspectral/CMakeLists.txt
 rename Applications/{ => Hyperspectral}/otbHyperspectralUnmixing.cxx (100%)
 create mode 100644 Applications/Test/CMakeLists.txt
 rename Applications/{ => Test}/otbAddition.cxx (100%)
 rename Applications/{ => Test}/otbAllocateOutput.cxx (100%)
 rename Applications/{ => Test}/otbCopyInput.cxx (100%)
 rename Applications/{ => Test}/otbInternalReader.cxx (100%)
 rename Applications/{ => Test}/otbTestApplication.cxx (100%)
 create mode 100644 Applications/Util/CMakeLists.txt
 rename Applications/{ => Util}/otbExtractROI.cxx (100%)
 rename Applications/{ => Util}/otbRescale.cxx (100%)
 rename Applications/{ => Util}/otbSmoothing.cxx (100%)
 delete mode 100644 Applications/VectorImageFactory.cxx

diff --git a/Applications/CMakeLists.txt b/Applications/CMakeLists.txt
index 1060b53dff..c37914160f 100644
--- a/Applications/CMakeLists.txt
+++ b/Applications/CMakeLists.txt
@@ -1,13 +1,5 @@
-include(WrapperMacros)
 
-#OTB_CREATE_APPLICATION(NAME VectorImageFactory SOURCES VectorImageFactory.cxx)
+add_subdirectory(Hyperspectral)
+add_subdirectory(Util)
 
-OTB_CREATE_APPLICATION(NAME Addition        SOURCES otbAddition.cxx)
-OTB_CREATE_APPLICATION(NAME Smoothing       SOURCES otbSmoothing.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME Rescale         SOURCES otbRescale.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME AllocateOutput  SOURCES otbAllocateOutput.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME CopyInput       SOURCES otbCopyInput.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME InternalReader  SOURCES otbInternalReader.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME TestApplication SOURCES otbTestApplication.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME HyperspectralUnmixing SOURCES otbHyperspectralUnmixing.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
-OTB_CREATE_APPLICATION(NAME ExtractROI SOURCES otbExtractROI.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
+add_subdirectory(Test)
\ No newline at end of file
diff --git a/Applications/Hyperspectral/CMakeLists.txt b/Applications/Hyperspectral/CMakeLists.txt
new file mode 100644
index 0000000000..ca64f51a6c
--- /dev/null
+++ b/Applications/Hyperspectral/CMakeLists.txt
@@ -0,0 +1,3 @@
+include(WrapperMacros)
+
+OTB_CREATE_APPLICATION(NAME HyperspectralUnmixing SOURCES otbHyperspectralUnmixing.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
diff --git a/Applications/otbHyperspectralUnmixing.cxx b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
similarity index 100%
rename from Applications/otbHyperspectralUnmixing.cxx
rename to Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
diff --git a/Applications/Test/CMakeLists.txt b/Applications/Test/CMakeLists.txt
new file mode 100644
index 0000000000..dc718cb0c6
--- /dev/null
+++ b/Applications/Test/CMakeLists.txt
@@ -0,0 +1,7 @@
+include(WrapperMacros)
+
+OTB_CREATE_APPLICATION(NAME Addition        SOURCES otbAddition.cxx)
+OTB_CREATE_APPLICATION(NAME AllocateOutput  SOURCES otbAllocateOutput.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
+OTB_CREATE_APPLICATION(NAME CopyInput       SOURCES otbCopyInput.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
+OTB_CREATE_APPLICATION(NAME InternalReader  SOURCES otbInternalReader.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
+OTB_CREATE_APPLICATION(NAME TestApplication SOURCES otbTestApplication.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
diff --git a/Applications/otbAddition.cxx b/Applications/Test/otbAddition.cxx
similarity index 100%
rename from Applications/otbAddition.cxx
rename to Applications/Test/otbAddition.cxx
diff --git a/Applications/otbAllocateOutput.cxx b/Applications/Test/otbAllocateOutput.cxx
similarity index 100%
rename from Applications/otbAllocateOutput.cxx
rename to Applications/Test/otbAllocateOutput.cxx
diff --git a/Applications/otbCopyInput.cxx b/Applications/Test/otbCopyInput.cxx
similarity index 100%
rename from Applications/otbCopyInput.cxx
rename to Applications/Test/otbCopyInput.cxx
diff --git a/Applications/otbInternalReader.cxx b/Applications/Test/otbInternalReader.cxx
similarity index 100%
rename from Applications/otbInternalReader.cxx
rename to Applications/Test/otbInternalReader.cxx
diff --git a/Applications/otbTestApplication.cxx b/Applications/Test/otbTestApplication.cxx
similarity index 100%
rename from Applications/otbTestApplication.cxx
rename to Applications/Test/otbTestApplication.cxx
diff --git a/Applications/Util/CMakeLists.txt b/Applications/Util/CMakeLists.txt
new file mode 100644
index 0000000000..18d5243d35
--- /dev/null
+++ b/Applications/Util/CMakeLists.txt
@@ -0,0 +1,5 @@
+include(WrapperMacros)
+
+OTB_CREATE_APPLICATION(NAME ExtractROI SOURCES otbExtractROI.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
+OTB_CREATE_APPLICATION(NAME Rescale         SOURCES otbRescale.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
+OTB_CREATE_APPLICATION(NAME Smoothing       SOURCES otbSmoothing.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
diff --git a/Applications/otbExtractROI.cxx b/Applications/Util/otbExtractROI.cxx
similarity index 100%
rename from Applications/otbExtractROI.cxx
rename to Applications/Util/otbExtractROI.cxx
diff --git a/Applications/otbRescale.cxx b/Applications/Util/otbRescale.cxx
similarity index 100%
rename from Applications/otbRescale.cxx
rename to Applications/Util/otbRescale.cxx
diff --git a/Applications/otbSmoothing.cxx b/Applications/Util/otbSmoothing.cxx
similarity index 100%
rename from Applications/otbSmoothing.cxx
rename to Applications/Util/otbSmoothing.cxx
diff --git a/Applications/VectorImageFactory.cxx b/Applications/VectorImageFactory.cxx
deleted file mode 100644
index 2882b097b0..0000000000
--- a/Applications/VectorImageFactory.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/*=========================================================================
-
- 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 "itkObjectFactory.h"
-#include "itkVersion.h"
-#include "otbWrapperTypes.h"
-
-
-//template <class TPixel, unsigned int VImageDimension = 2>
-class ITK_EXPORT MyVectorImage : public otb::VectorImage<float, 2>
-{
-public:
-  /** Standard class typedefs. */
-  typedef MyVectorImage                       Self;
-//  typedef otb::VectorImage<TPixel, VImageDimension> Superclass;
-  typedef otb::VectorImage<float, 2>          Superclass;
-  typedef itk::SmartPointer<Self>             Pointer;
-  typedef itk::SmartPointer<const Self>       ConstPointer;
-  typedef itk::WeakPointer<const Self>        ConstWeakPointer;
-
-  /** Method for creation through the object factory. */
-  itkNewMacro(Self);
-
-  /** Run-time type information (and related methods). */
-  itkTypeMacro(MyVectorImage, otb::VectorImage);
-
-};
-
-namespace otb
-{
-namespace Wrapper
-{
-
-class ImageFactory : public itk::ObjectFactoryBase
-{
-public:
-  /** Standard class typedefs. */
-  typedef ImageFactory                  Self;
-  typedef itk::ObjectFactoryBase        Superclass;
-  typedef itk::SmartPointer<Self>       Pointer;
-  typedef itk::SmartPointer<const Self> ConstPointer;
-
-  /** Class methods used to interface with the registered factories. */
-  virtual const char* GetITKSourceVersion(void) const
-    {
-    return ITK_SOURCE_VERSION;
-    }
-
-  virtual const char* GetDescription(void) const
-    {
-    return "ImageFactory";
-    }
-
-  /** Method for class instantiation. */
-  itkFactorylessNewMacro(Self);
-
-  /** Run-time type information (and related methods). */
-  itkTypeMacro(ApplicationFactory, itk::ObjectFactoryBase);
-
-protected:
-  ImageFactory()
-  {
-  }
-
-  virtual ~ImageFactory()
-  {
-  }
-
-  /** This method is provided by sub-classes of ObjectFactoryBase.
-   * It should create the named itk object or return 0 if that object
-   * is not supported by the factory implementation. */
-  virtual LightObject::Pointer CreateObject(const char* itkclassname )
-  {
-    std::cout << "CreateObject Testing " << itkclassname << std::endl;
-
-    VectorImageType::Pointer image;
-    if ( std::string( typeid(VectorImageType).name() ) == itkclassname )
-      {
-      std::cout << "HIT" << std::endl;
-      image = MyVectorImage::New().GetPointer();
-      }
-
-    return image.GetPointer();
-  }
-
-  /** This method creates all the objects with the class overide of
-   * itkclass name, which are provide by this object
-   */
-  virtual std::list<LightObject::Pointer>
-  CreateAllObject(const char* itkclassname)
-  {
-    std::list<LightObject::Pointer> list;
-    std::cout << "CreateAllObject Testing " << itkclassname << std::endl;
-
-    return list;
-  }
-
-private:
-  ImageFactory(const Self &); //purposely not implemented
-  void operator =(const Self&); //purposely not implemented
-};
-
-} // end namespace Wrapper
-} //end namespace otb
-
-#if (defined(WIN32) || defined(_WIN32))
-#  define OTB_APP_EXPORT __declspec(dllexport)
-#else
-#  define OTB_APP_EXPORT
-#endif
-
-typedef otb::Wrapper::ImageFactory ImageFactoryType;
-static ImageFactoryType::Pointer staticFactory;
-
-extern "C"
-  {
-    OTB_APP_EXPORT itk::ObjectFactoryBase* itkLoad()
-    {
-      staticFactory = ImageFactoryType::New();
-      return staticFactory;
-    }
-  }
-- 
GitLab