diff --git a/CMake/FindPqxx.cmake b/CMake/FindPqxx.cmake deleted file mode 100644 index 066053b9985fbd8f724222baf9bf44889dd9fdcf..0000000000000000000000000000000000000000 --- a/CMake/FindPqxx.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# - Find PQXX -# Find the native PQXX includes and library -# -# PQXX_FOUND - True if PQXX found. -# PQXX_INCLUDE_DIRS - where to find tinyxml.h, etc. -# PQXX_LIBRARIES - List of libraries when using PQXX. -# - -if( PQXX_INCLUDE_DIR ) - # Already in cache, be silent - set( PQXX_FIND_QUIETLY TRUE ) -endif() - -find_path( PQXX_INCLUDE_DIR pqxx/pqxx ) - -find_library( PQXX_LIBRARY - NAMES pqxx - PATH_SUFFIXES pqxx ) - -# handle the QUIETLY and REQUIRED arguments and set PQXX_FOUND to TRUE if -# all listed variables are TRUE -include( FindPackageHandleStandardArgs ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( PQXX DEFAULT_MSG PQXX_LIBRARY PQXX_INCLUDE_DIR ) - -mark_as_advanced( PQXX_INCLUDE_DIR PQXX_LIBRARY ) - -if(PQXX_FOUND) - set(PQXX_INCLUDE_DIRS ${PQXX_INCLUDE_DIR}) - set(PQXX_LIBRARIES ${PQXX_LIBRARY}) -else() - set(PQXX_INCLUDE_DIRS) - set(PQXX_LIBRARIES) -endif() - diff --git a/CMake/ImportPqxx.cmake b/CMake/ImportPqxx.cmake deleted file mode 100644 index 089789cce060815f7936008bc4b106410261839e..0000000000000000000000000000000000000000 --- a/CMake/ImportPqxx.cmake +++ /dev/null @@ -1,17 +0,0 @@ -message(STATUS "Importing Pqxx...") - -option(OTB_USE_PQXX "Use pqxx library (EXPERIMENTAL)." OFF) -mark_as_advanced(OTB_USE_PQXX) - -if(OTB_USE_PQXX) - find_package(Pqxx) - if(PQXX_FOUND) - message(STATUS "Activating Pqxx support") - else() - # Generate an error if no external Pqxx is available - message(FATAL_ERROR "Pqxx required but not found. " - "Turn OTB_USE_PQXX to OFF") - endif() -else() - message(STATUS "Disabling Pqxx support") -endif() diff --git a/CMake/OTBConfig.cmake.in b/CMake/OTBConfig.cmake.in index 90cfc437e55926ecd2c2d70025135dcee743a2c4..f04f4c8fa77d0e2170e1fe51934f3757d6dfa502 100644 --- a/CMake/OTBConfig.cmake.in +++ b/CMake/OTBConfig.cmake.in @@ -78,7 +78,6 @@ set(GETTEXT_MSGMERGE_EXECUTABLE "@GETTEXT_MSGMERGE_EXECUTABLE@") set(GETTEXT_INCLUDE_DIR "@GETTEXT_INCLUDE_DIR@") set(GETTEXT_LIBRARY "@GETTEXT_LIBRARY@") set(GETTEXT_INTL_LIBRARY "@GETTEXT_INTL_LIBRARY@") -set(OTB_USE_PQXX "@OTB_USE_PQXX@") set(OTB_USE_PATENTED "@OTB_USE_PATENTED@") set(OTB_USE_LIBLAS "@OTB_USE_LIBLAS@") set(OTB_USE_EXTERNAL_LIBLAS "@OTB_USE_EXTERNAL_LIBLAS@") diff --git a/CMake/UseOTB.cmake.in b/CMake/UseOTB.cmake.in index 063dffee7ab8ad08aef90e199ba06137fe108d80..e895218784c24b8161cb74c3fe1bf81d7a74dd0a 100644 --- a/CMake/UseOTB.cmake.in +++ b/CMake/UseOTB.cmake.in @@ -106,11 +106,6 @@ if(OTB_USE_LIBLAS AND OTB_USE_EXTERNAL_LIBLAS) include_directories(${LIBLAS_INCLUDE_DIRS}) endif() -if(OTB_USE_PQXX) - find_package(Pqxx REQUIRED) - include_directories(${PQXX_INCLUDE_DIRS}) -endif() - if(OTB_USE_EXTERNAL_LIBKML) find_package(LibKML REQUIRED) include_directories(${LIBKML_INCLUDE_DIRS}) diff --git a/CMake/otbIncludeDirectories.cmake b/CMake/otbIncludeDirectories.cmake index a06790d1f2bf47a4ea2f4dbd3294fa5a514a117e..ad59053a62f99921e5723f7ca47c1e3e1de758c2 100644 --- a/CMake/otbIncludeDirectories.cmake +++ b/CMake/otbIncludeDirectories.cmake @@ -78,11 +78,6 @@ if(WIN32) ${OTB_SOURCE_DIR}/Utilities/otbmsinttypes ) endif() -if(OTB_USE_PQXX) - set(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} - ${OTB_SOURCE_DIR}/Code/GeospatialAnalysis ${PQXX_INCLUDE_DIR}) -endif() - if(OTB_USE_SIFTFAST) set(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/otbsiftfast) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03699ec8833b8ce183c4bf961b2d17b73588910a..5659098e4c8a8277e038bc812a173ddb95d5dd4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,7 +210,6 @@ include(ImportITK) include(ImportJPEG2000) include(ImportFLTK) # depends on ImportGdal include(ImportCurl) -include(ImportPqxx) include(ImportBoost) include(ImportMapnik) # depends on ImportBoost include(ImportOpenThreads) @@ -391,7 +390,6 @@ if(NOT OTB_INSTALL_NO_DEVELOPMENT) ${OTB_SOURCE_DIR}/CMake/FindMercurial.cmake ${OTB_SOURCE_DIR}/CMake/FindMuParser.cmake ${OTB_SOURCE_DIR}/CMake/FindOpenThreads.cmake - ${OTB_SOURCE_DIR}/CMake/FindPqxx.cmake ${OTB_SOURCE_DIR}/CMake/FindTinyXML.cmake DESTINATION ${OTB_INSTALL_CMAKEMODULE_DIR} COMPONENT Development) diff --git a/Code/CMakeLists.txt b/Code/CMakeLists.txt index e2cfcfc0a0a826b2fdf1e9352d90ef922738e885..e816f3aca3507e64b393c72d534c27fef70ba9cf 100644 --- a/Code/CMakeLists.txt +++ b/Code/CMakeLists.txt @@ -28,10 +28,6 @@ if(OTB_USE_VISU_GUI) add_subdirectory(Visualization) endif() -if(OTB_USE_PQXX) - add_subdirectory(GeospatialAnalysis) -endif() - if(BUILD_APPLICATIONS) add_subdirectory(ApplicationEngine) add_subdirectory(Wrappers) diff --git a/Code/Common/CMakeLists.txt b/Code/Common/CMakeLists.txt index 88c4596d1e095b5967962fa2084d784d0d60b4a6..1a0e51747bf5eb081c49903b3d42d4cd4e3065d7 100644 --- a/Code/Common/CMakeLists.txt +++ b/Code/Common/CMakeLists.txt @@ -6,10 +6,6 @@ if( NOT OTB_USE_MAPNIK ) list(REMOVE_ITEM OTBCommon_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/otbVectorDataStyle.cxx" ) endif() -if( NOT OTB_USE_PQXX ) - list(REMOVE_ITEM OTBCommon_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/otbPostGISConnectionImplementation.cxx" ) -endif() - add_library(OTBCommon ${OTBCommon_SRCS}) #Apparently not supported by opensolaris at least #set_target_properties(OTBCommon @@ -21,10 +17,6 @@ if(OTB_USE_MAPNIK) target_link_libraries(OTBCommon ${MAPNIK_LIBRARY} ${ICUUC_LIBRARY}) endif() -if(OTB_USE_PQXX) - target_link_libraries(OTBCommon ${PQXX_LIBRARY}) -endif() - if(OTB_I18N) target_link_libraries(OTBCommon ${GETTEXT_LIBRARY}) if(APPLE OR WIN32) diff --git a/Code/Common/otbPostGISConnectionImplementation.cxx b/Code/Common/otbPostGISConnectionImplementation.cxx deleted file mode 100644 index 8d81de00f4873d13e2788d4609e842f504d5433b..0000000000000000000000000000000000000000 --- a/Code/Common/otbPostGISConnectionImplementation.cxx +++ /dev/null @@ -1,79 +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 "otbPostGISConnectionImplementation.h" -#include <sstream> -#include <sstream> -#include <assert.h> - -namespace otb -{ -PostGISConnectionImplementation::PostGISConnectionImplementation() -{ - m_Host = "localhost"; - m_DBName = ""; - m_User = "postgres"; - m_Password = ""; - m_Port = "5432"; - m_Options = ""; - -} - -PostGISConnectionImplementation::~PostGISConnectionImplementation() -{ - -} - -void PostGISConnectionImplementation::ConnectToDB() -{ - std::stringstream connstring; - - connstring << "host=" << m_Host << " dbname=" << m_DBName << " user=" << m_User; - - if (m_Password != "") connstring << " password=" << m_Password; - - if (m_Port != "") connstring << " port=" << m_Port; - - if (m_Options != "") connstring << " options=" << m_Options; - - if (!m_PostGISConnection) delete m_PostGISConnection; - - m_PostGISConnection = new BasicConnectionType(connstring.str().c_str()); - -} - -void PostGISConnectionImplementation::PerformTransaction(const TransactorType& theTransaction) const -{ - //assert(0); //do not use this method yet - //m_PostGISConnection->perform( theTransaction ); -} - -PostGISConnectionImplementation::BasicConnectionType* PostGISConnectionImplementation::GetConnection() const -{ - return m_PostGISConnection; -} - -void PostGISConnectionImplementation::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - os << std::endl; - - os << "DB name: " << m_DBName << std::endl; - -} - -} // end namespace otb diff --git a/Code/Common/otbPostGISConnectionImplementation.h b/Code/Common/otbPostGISConnectionImplementation.h deleted file mode 100644 index 43dce1156e71c84794d3c0ee2cb5fe50ca425967..0000000000000000000000000000000000000000 --- a/Code/Common/otbPostGISConnectionImplementation.h +++ /dev/null @@ -1,103 +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. - -=========================================================================*/ -#ifndef __otbPostGISConnectionImplementation_h -#define __otbPostGISConnectionImplementation_h - -#include "otbGISConnectionImplementation.h" -#include <pqxx/pqxx> - -namespace otb -{ -/** \class PostGISConnectionImplementation - * \brief this class represents a connection to a PostGIS data base. - * - * - * - */ - -class ITK_EXPORT PostGISConnectionImplementation - : public GISConnectionImplementation<pqxx::transactor<pqxx::nontransaction> > -{ -public: - /** Standard class typedefs */ - typedef PostGISConnectionImplementation Self; - typedef pqxx::transactor<pqxx::nontransaction> PQXXTransactorType; - typedef GISConnectionImplementation<PQXXTransactorType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Standard macros */ - itkNewMacro(Self); - itkTypeMacro(PostGISConnectionImplementation, GISConnectionImplementation); - - /** Typedefs */ - typedef pqxx::basic_connection<pqxx::connect_direct> BasicConnectionType; - typedef PQXXTransactorType TransactorType; - - /** Acessors */ - itkGetMacro(Host, std::string); - itkSetMacro(Host, std::string); - - itkGetMacro(DBName, std::string); - itkSetMacro(DBName, std::string); - - itkGetMacro(User, std::string); - itkSetMacro(User, std::string); - - itkGetMacro(Password, std::string); - itkSetMacro(Password, std::string); - - itkGetMacro(Port, std::string); - itkSetMacro(Port, std::string); - - itkGetMacro(Options, std::string); - itkSetMacro(Options, std::string); - - /** Using the connection */ - - void ConnectToDB(); - - void PerformTransaction(const TransactorType& theTransaction) const; - - BasicConnectionType* GetConnection() const; - -protected: - /** Constructor */ - PostGISConnectionImplementation(); - /** Destructor */ - virtual ~PostGISConnectionImplementation(); - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - PostGISConnectionImplementation(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - - std::string m_Host; - std::string m_DBName; - std::string m_User; - std::string m_Password; - std::string m_Port; - std::string m_Options; - - BasicConnectionType* m_PostGISConnection; - -}; -} // end namespace otb - -#endif diff --git a/Code/Common/otbPostGISTable.h b/Code/Common/otbPostGISTable.h deleted file mode 100644 index 2654de0b92c2fa3b34ed3e2cbebb0f3a501b51d8..0000000000000000000000000000000000000000 --- a/Code/Common/otbPostGISTable.h +++ /dev/null @@ -1,137 +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. - -=========================================================================*/ -#ifndef __otbPostGISTable_h -#define __otbPostGISTable_h - -#include "otbGISTable.h" -#include "otbCorrectPolygonFunctor.h" - -namespace otb -{ -/** \class PostGISTable - * \brief this class represents a table of a geospatial database (PostGIS). - * - * - * \sa GISTableFileReader - * \sa GISTableFileWriter - * - */ -template <class TConnectionImplementation, class TPrecision = double, unsigned int TSpatialDimension = 2> -class ITK_EXPORT PostGISTable - : public GISTable <TConnectionImplementation, TPrecision, TSpatialDimension> -{ -public: - /** Standard class typedefs */ - typedef PostGISTable Self; - typedef GISTable <TConnectionImplementation, TPrecision, TSpatialDimension> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Standard macros */ - itkNewMacro(Self); - itkTypeMacro(PostGISTable, GISTable); - itkStaticConstMacro(Dimension, unsigned int, TSpatialDimension); - - /** Some convenient typedefs */ - typedef TConnectionImplementation ConnectionType; - typedef typename ConnectionType::Pointer ConnectionPointerType; - typedef itk::Point<TPrecision, TSpatialDimension> PointType; - typedef PolyLineParametricPathWithValue <TPrecision, TSpatialDimension> LineType; - typedef typename LineType::Pointer LinePointerType; - typedef Polygon <TPrecision> PolygonType; - typedef typename PolygonType::Pointer PolygonPointerType; - typedef typename PolygonType::ConstPointer PolygonConstPointerType; - typedef ObjectList<PolygonType> PolygonListType; - typedef typename PolygonListType::Pointer PolygonListPointerType; - typedef typename PolygonListType::ConstPointer PolygonListConstPointerType; - - /** typedefs for correct polygon */ - typedef otb::CorrectPolygonFunctor<PolygonType> CorrectFunctorType; - - /** Acessors */ - - itkGetConstMacro(TableName, std::string); - itkSetMacro(TableName, std::string); - - //itkGetConstObjectMacro(Connection, ConnectionType); - itkGetObjectMacro(Connection, ConnectionType); - itkSetObjectMacro(Connection, ConnectionType); - - /** Clear the table not implemented yet*/ - bool Clear(); - - /** Get attributes of the Table*/ //TODO implement - - /** Get srid of the geometric column*/ //TODO implement - //virtual - /** Init basic SQL command*/ - void InsertBegin(std::stringstream& sqlCmd); - /** Add Point content to the GIS Table*/ - void InsertPoint(const PointType& pt, const std::string& attribute = 0); - //void InsertMultiPoint(); - /** Add Polygons to the GIS Table (exterior and interior ring)*/ - void InsertPolygons(PolygonConstPointerType polygonExtRing, - PolygonListConstPointerType polygonListInteriorRing = 0, - const std::string& attribute = 0); - /** Add Line to the GIS Table*/ - void InsertLineString(LinePointerType l, const std::string& attribute = 0); - - /** Execute the sqlCmd which add geometric rows to the gis table*/ - void InsertGeometries(const std::string& sqlCmd); - /** Clean up SQL command*/ - void EraseLastChar(std::stringstream& sqlCmd); - /** Effective Creation of the table*/ - void CreateTable(bool dropExistingGISTable); - /** Get geometry column type Not implemented yet in progress */ - void getGeometryType(); - - /** Get string connection usable by OGR library*/ - std::string GetOGRStrConnection() const; - - /** Get const string connection methos temp*/ - //ConnectionPointerType GetConstConnection() const; - - /** Add an alpha numeric column to the table */ -// const std::string AddVarCharColumn(unsigned int size); - - /** Insert Alpha Numeric Data in the Car char column */ -// void AddStrDataToVarCharColumn(std::string data); -protected: - - /** Constructor */ - PostGISTable(); - /** Destructor */ - virtual ~PostGISTable() {} - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - PostGISTable(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - - std::string m_TableName; - ConnectionPointerType m_Connection; - -}; -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbPostGISTable.txx" -#endif - -#endif diff --git a/Code/Common/otbPostGISTable.txx b/Code/Common/otbPostGISTable.txx deleted file mode 100644 index 247db098becd292cb847adad2d385c726ec95984..0000000000000000000000000000000000000000 --- a/Code/Common/otbPostGISTable.txx +++ /dev/null @@ -1,320 +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. - -=========================================================================*/ -#ifndef __otbPostGISTable_txx -#define __otbPostGISTable_txx - -#include "otbPostGISTable.h" -#include "itkPreOrderTreeIterator.h" -#include "otbMetaDataKey.h" - -#include <iostream> -#include <sstream> -#include <string> - -#include "otbPostGISFromStringTransactor.h" -#include "otbPostGISConnectionImplementation.h" -#include "otbPostGISCreateTableTransactor.h" - -namespace otb -{ - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::PostGISTable() -{ - m_Connection = ConnectionType::New(); - this->SetSrid(-1); -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - os << std::endl; - - os << "Table name: " << m_TableName << std::endl; - -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -bool -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::Clear() -{ //TODO implementation - return true; -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::InsertBegin(std::stringstream& sqlCmd) -{ - sqlCmd.str(""); - sqlCmd << "INSERT INTO \"" << this->GetTableName() << "\" ( \"the_geom\" , \"genre\" ) VALUES ("; - sqlCmd << "GeometryFromText('"; -} -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::InsertPoint(const PointType& pt, const std::string& attribute) -{ - std::stringstream sqlCmd; - this->InsertBegin(sqlCmd); - sqlCmd << "POINT( "; - for (unsigned int i = 0; i < TSpatialDimension; ++i) - { - sqlCmd << pt[i] << " "; - } - - //int this->GetSrid()=-1; - sqlCmd << ")'," << this->GetSrid() << ") ,'" << attribute << "');" << std::endl; - - //Execute the query - this->InsertGeometries(sqlCmd.str()); -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::InsertLineString(LinePointerType l, const std::string& attribute) -{ - std::stringstream sqlCmd; - this->InsertBegin (sqlCmd); - sqlCmd << "LINESTRING( "; - - typedef typename LineType::VertexListConstIteratorType VertexIterator; - VertexIterator itVertex = l->GetVertexList()->Begin(); - while (itVertex != l->GetVertexList()->End()) - { - for (unsigned int i = 0; i < TSpatialDimension; ++i) - { - sqlCmd << itVertex.Value()[i] << " "; - ++itVertex; - } - sqlCmd << ","; - } - //Erase the last ',' - EraseLastChar (sqlCmd); - - //int this->GetSrid()=-1; - - sqlCmd << ")'," << this->GetSrid() << ") ,'" << attribute << "');" << std::endl; - //Execute the query - this->InsertGeometries(sqlCmd.str()); - - /* Invalid (MULTI)Linestring */ - -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::InsertPolygons(PolygonConstPointerType polygonExtRing, - PolygonListConstPointerType polygonListInteriorRing, - const std::string& attribute) -{ - - /** correct polygon exterior ring */ - CorrectFunctorType correct; - PolygonPointerType correctPolygonExtRing = correct(polygonExtRing); - - std::stringstream sqlCmd; - this->InsertBegin (sqlCmd); - sqlCmd << "POLYGON( ( "; - //std::cout << "sqlcmd: " << sqlCmd.str() << std::endl; - typedef typename PolygonType::VertexListConstIteratorType VertexIterator; - VertexIterator itVertex = correctPolygonExtRing->GetVertexList()->Begin(); - //std::cout << "sizeof ext poly: " << polygonExtRing->GetVertexList()->Size()<< std::endl; - while (itVertex != correctPolygonExtRing->GetVertexList()->End()) - { - //polygon->line_to(itVertex.Value()[0], m_SensorModelFlip*itVertex.Value()[1]); - //std::cout << "vertex: " << itVertex.Value()<< std::endl; - for (unsigned int i = 0; i < TSpatialDimension; ++i) - { - sqlCmd << itVertex.Value()[i] << " "; - //++itVertex; - } - sqlCmd << ","; - ++itVertex; - } - //Erase the last ',' - //std::cout << "avt erase : " << sqlCmd.str() << std::endl; - EraseLastChar (sqlCmd); - //std::cout << "apres arase " << sqlCmd.str() << std::endl; - sqlCmd << "),"; - //std::cout << "ext polygon: " << sqlCmd.str() << std::endl; - //Add interior polygons - if (!polygonListInteriorRing.IsNull()) - { - - //get holes - //sqlCmd << ","; - typedef typename PolygonListType::ConstIterator PolygonListConstIteratorType; - for (PolygonListConstIteratorType itPolygonList = polygonListInteriorRing->Begin(); - itPolygonList != polygonListInteriorRing->End(); - ++itPolygonList) - { - /** correct current polygon interior ring */ - CorrectFunctorType correctCurrentInt; - PolygonPointerType correctCurrentPolygonIntRing = correctCurrentInt(itPolygonList.Get()); - - sqlCmd << "("; - - itVertex = correctCurrentPolygonIntRing->GetVertexList()->Begin(); - while (itVertex != correctCurrentPolygonIntRing->GetVertexList()->End()) - { - //polygon->line_to(itVertex.Value()[0], m_SensorModelFlip*itVertex.Value()[1]); - for (unsigned int i = 0; i < TSpatialDimension; ++i) - { - sqlCmd << itVertex.Value()[i] << " "; - ++itVertex; - } - sqlCmd << ","; - ++itVertex; - } - //Erase the last ',' - EraseLastChar (sqlCmd); - - sqlCmd << "),"; - } - //std::cout << "int polygon: " << sqlCmd.str() << std::endl; - - } - //Erase the last ',' - EraseLastChar (sqlCmd); - - //int this->GetSrid()=-1; - - sqlCmd << ")'," << this->GetSrid() << ") ,'" << attribute << "');" << std::endl; - //std::cout << "sqlcmd polygon: " << sqlCmd.str() << std::endl; - //Insert the geometry - this->InsertGeometries(sqlCmd.str()); - //std::cout << "geometries!!" << std::endl; -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::InsertGeometries(const std::string& sqlCmd) -{ - typedef otb::PostGISFromStringTransactor TransactorType; - TransactorType myStringTransactor; - //std::cout << "transactor string" << sqlCmd<< std::endl; - myStringTransactor.SetTransactionString(sqlCmd); - //this->GetConnection()->ConnectToDB(); - this->GetConnection()->GetConnection()->perform(myStringTransactor); -// this->GetConnection()->PerformTransaction( myStringTransactor ); -//myStringTransactor ( *( this->GetConnection()->GetConnection() ) ); -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::EraseLastChar(std::stringstream& sqlCmd) -{ - std::string EraseCmd = sqlCmd.str(); - EraseCmd.erase(EraseCmd.length() - 1); - sqlCmd.str(""); - sqlCmd << EraseCmd; - -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::CreateTable(bool dropExistingGISTable) -{ - typedef otb::PostGISCreateTableTransactor TransactorType; - - //Instantiation - TransactorType myTransactor; - - myTransactor.SetDimension(TSpatialDimension); - - //std::string name = "mytable"; - myTransactor.SetTableName(this->GetTableName()); - - //int this->GetSrid() = -1; - myTransactor.SetSRID(this->GetSrid()); - - myTransactor.SetRemoveExistingTable(dropExistingGISTable); - - this->GetConnection()->GetConnection()->perform(myTransactor); -//this->GetConnection()->PerformTransaction( myTransactor ); -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -void -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::getGeometryType() -{ - //the geomtric column name is the_geom - std::string query = "SELECT DISTINCT geometrytype(\"the_geom\") " - "FROM \"" + this->GetTableName() + "\" WHERE NOT geometrytype(\"the_geom\") IS NULL"; - - typedef otb::PostGISFromStringTransactor TransactorType; - TransactorType myStringTransactor; - //std::cout << "transactor string" << sqlCmd<< std::endl; - myStringTransactor.SetTransactionString(query); - //this->GetConnection()->ConnectToDB(); - - //typedef pqxx::result ResultType; - //ResultType R = this->GetConnection()->GetConnection()->perform( myStringTransactor ); - -} - -template <class TConnectionImplementation, class TPrecision, unsigned int TSpatialDimension> -std::string -PostGISTable<TConnectionImplementation, TPrecision, TSpatialDimension> -::GetOGRStrConnection() const -{ - //std::cout << "getOGR: " << m_Connection << std::endl; - std::string connectionSTR = ""; - connectionSTR += "PG:"; - - connectionSTR += "dbname='"; - connectionSTR += m_Connection->GetDBName(); - connectionSTR += "' "; - connectionSTR += "host='"; - connectionSTR += m_Connection->GetHost(); - connectionSTR += "' "; - connectionSTR += "port='"; - connectionSTR += m_Connection->GetPort(); - connectionSTR += "' "; - connectionSTR += "user='"; - connectionSTR += m_Connection->GetUser(); - connectionSTR += "' "; - connectionSTR += "password='"; - connectionSTR += m_Connection->GetPassword(); - connectionSTR += "' "; - if (!m_TableName.empty()) - { - connectionSTR += "tables="; - connectionSTR += m_TableName; -// connectionSTR += "' "; - } - - otbGenericMsgDebugMacro(<< "OGR connection string " << connectionSTR); - - return connectionSTR; -} -} // end namespace otb - -#endif diff --git a/Code/GeospatialAnalysis/CMakeLists.txt b/Code/GeospatialAnalysis/CMakeLists.txt deleted file mode 100644 index b217c42413a3dcd458905fff90d263ac6ff98edd..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Sources of non-templated classes. - -file(GLOB OTBGeospatialAnalysis_SRCS "*.cxx" ) - - -add_library(OTBGeospatialAnalysis ${OTBGeospatialAnalysis_SRCS}) -target_link_libraries(OTBGeospatialAnalysis OTBCommon ${PQXX_LIBRARY}) -if(OTB_LIBRARY_PROPERTIES) - set_target_properties(OTBGeospatialAnalysis PROPERTIES ${OTB_LIBRARY_PROPERTIES}) -endif() - -if(NOT OTB_INSTALL_NO_LIBRARIES) - install(TARGETS OTBGeospatialAnalysis - RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries - LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries - ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development) -endif() - -if(NOT OTB_INSTALL_NO_DEVELOPMENT) - file(GLOB __files1 "${CMAKE_CURRENT_SOURCE_DIR}/*.h") - file(GLOB __files2 "${CMAKE_CURRENT_SOURCE_DIR}/*.txx") - install(FILES ${__files1} ${__files2} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR}/GeospatialAnalysis - COMPONENT Development) -endif() diff --git a/Code/GeospatialAnalysis/foo.cxx b/Code/GeospatialAnalysis/foo.cxx deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/foo.cxx +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Code/GeospatialAnalysis/otbGISTableFunction.h b/Code/GeospatialAnalysis/otbGISTableFunction.h deleted file mode 100644 index f8094ce8b2d9dc5ae70eb4f5919ba4945cee1790..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbGISTableFunction.h +++ /dev/null @@ -1,108 +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. - -=========================================================================*/ -#ifndef __otbGISTableFunction_h -#define __otbGISTableFunction_h - -#include "itkFunctionBase.h" -#include "otbGISTable.h" - -namespace otb -{ - -/** \class GISTableFunction - * \brief Evaluates a const transaction on a GISTable - * - * GISTableFunction is a baseclass for all objects that evaluate - * a const transaction on a GISTable. - * - * The input table is set via method SetInputTable(). - * - * - * \sa GISTable - * \sa GISConnection - * - * \ingroup GISTableFunctions - */ -template < - class TInputTable, - class TOutput - > -class ITK_EXPORT GISTableFunction : - public FunctionBase<TInputTable, - TOutput> -{ -public: - /** Dimension underlying input table. */ - itkStaticConstMacro(TableDimension, unsigned int, - TInputTable::TSpatialDimension); - - /** Standard class typedefs. */ - typedef GISTableFunction Self; - typedef FunctionBase< - TInputTable, - TOutput> Superclass; - typedef SmartPointer<Self> Pointer; - typedef SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(GISTableFunction, FunctionBase); - - /** InputTableType typedef support. */ - typedef TInputTable InputTableType; - - /** Connection typedef support */ - typedef typename InputTableType::ConnectionType ConnectionType; - - /** InputTablePointer typedef support */ - typedef typename InputTableType::ConstPointer InputTableConstPointer; - - /** OutputType typedef support. */ - typedef TOutput OutputType; - - /** Set the input table. */ - virtual void SetInputTable(const InputTableType* ptr); - - /** Get the input Table. */ - const InputTableType * GetInputTable() const - { return m_Table.GetPointer(); } - - /** Evaluate the function. - * Subclasses must provide this method. */ - virtual TOutput Evaluate() const = 0; - -protected: - GISTableFunction(); - virtual ~GISTableFunction() {} - void PrintSelf(std::ostream& os, Indent indent) const; - - /** Const pointer to the input table. */ - InputTableConstPointer m_Table; - -private: - GISTableFunction(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - -}; - -} // end namespace otb - -#if OTB_MANUAL_INSTANTIATION -# include "itkGISTableFunction.txx" -#endif - -#endif diff --git a/Code/GeospatialAnalysis/otbGISTableFunction.txx b/Code/GeospatialAnalysis/otbGISTableFunction.txx deleted file mode 100644 index d0e9764bfddd29c7fa88f10e809bddd93bd0b14e..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbGISTableFunction.txx +++ /dev/null @@ -1,67 +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. - -=========================================================================*/ -#ifndef __otbGISTableFunction_txx -#define __otbGISTableFunction_txx - -#include "otbGISTableFunction.h" - -namespace otb -{ - -/** - * Constructor - */ -template <class TInputTable, class TOutput> -GISTableFunction<TInputTable, TOutput> -::GISTableFunction() -{ - m_Table = NULL; -} - -/** - * Standard "PrintSelf" method - */ -template <class TInputTable, class TOutput> -void -GISTableFunction<TInputTable, TOutput> -::PrintSelf( - std::ostream& os, - Indent indent) const -{ - Superclass::PrintSelf(os, indent); - os << indent << "InputTable: " << m_Table.GetPointer() << std::endl; - -} - -/** - * Initialize by setting the input table - */ -template <class TInputTable, class TOutput> -void -GISTableFunction<TInputTable, TOutput> -::SetInputTable( - const InputTableType* ptr) -{ - // set the input table - m_Table = ptr; - -} - -} // end namespace itk - -#endif diff --git a/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx b/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx deleted file mode 100644 index 7ccaa1955a14b44c33600c1ded517b5bd7a427fd..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.cxx +++ /dev/null @@ -1,158 +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 "otbPostGISCreateTableTransactor.h" -#include <sstream> -#include <cassert> - -#include "otbMacro.h" - -namespace otb -{ - -PostGISCreateTableTransactor::PostGISCreateTableTransactor() : PostGISCreateTableTransactor::Superclass("CreateTable") -{ - m_RemoveExistingTable = false; -} - -PostGISCreateTableTransactor::PostGISCreateTableTransactor(const PostGISCreateTableTransactor& pgt) - : PostGISCreateTableTransactor::Superclass("CreateTable") -{ - m_TableName = pgt.GetTableName(); - m_SRID = pgt.GetSRID(); - m_Dimension = pgt.GetDimension(); - m_RemoveExistingTable = pgt.GetRemoveExistingTable(); -} - -PostGISCreateTableTransactor & PostGISCreateTableTransactor::operator =(const PostGISCreateTableTransactor& pgt) -throw() -{ - m_TableName = pgt.GetTableName(); - m_SRID = pgt.GetSRID(); - m_Dimension = pgt.GetDimension(); - m_RemoveExistingTable = pgt.GetRemoveExistingTable(); - return *this; -} - -void PostGISCreateTableTransactor::operator ()(pqxx::nontransaction& T) -{ - - if (m_RemoveExistingTable) - { - std::stringstream dropCommand; - - //dropCommand << "DROP TABLE " << m_TableName; - dropCommand << "DROP TABLE IF EXISTS " << m_TableName << " CASCADE"; - - otbGenericMsgDebugMacro(<< "Drop Command " << dropCommand.str()); - - m_Result = T.exec(dropCommand.str()); - } - - std::stringstream createCommand; - - createCommand << "CREATE TABLE " << m_TableName - << " (id serial PRIMARY KEY, genre TEXT);"; - - otbGenericMsgDebugMacro(<< "Create Command " << createCommand.str()); - m_Result = T.exec(createCommand.str()); - - std::stringstream addGeometryCommand; - - addGeometryCommand << "SELECT AddGeometryColumn( '" << m_TableName << - "', 'the_geom', " << m_SRID << ", 'GEOMETRY'," << m_Dimension << " );"; - - m_Result = T.exec(addGeometryCommand.str()); - - - /** creation index GIST */ - //FIXME not working yet -// std::stringstream addGISTIndexCommand; -// -// addGISTIndexCommand << "CREATE INDEX idx_" << m_TableName << "_the_geom ON " << m_TableName << -// " USING gist( the_geom );"; -// -// otbGenericMsgDebugMacro(<< "Create Command " << addGISTIndexCommand.str()); -// -// m_Result = T.exec(addGISTIndexCommand.str()); -} - -void PostGISCreateTableTransactor::on_commit() -{ - otbMsgDevMacro( "\t Table is created \t" ); - //T.exec -} - -std::string PostGISCreateTableTransactor::GetTableName() const -{ - return m_TableName; -} - -void PostGISCreateTableTransactor::SetTableName(const std::string& aName) -{ - m_TableName = aName; -} - -int PostGISCreateTableTransactor::GetSRID() const -{ - return m_SRID; -} - -void PostGISCreateTableTransactor::SetSRID(int aSRID) -{ - m_SRID = aSRID; -} - -unsigned short PostGISCreateTableTransactor::GetDimension() const -{ - return m_Dimension; -} - -void PostGISCreateTableTransactor::SetDimension(unsigned short aDim) -{ - m_Dimension = aDim; -} - -void PostGISCreateTableTransactor::SetRemoveExistingTable(bool val) -{ - m_RemoveExistingTable = val; -} - -bool PostGISCreateTableTransactor::GetRemoveExistingTable() const -{ - return m_RemoveExistingTable; -} - -PostGISCreateTableTransactor::ResultType PostGISCreateTableTransactor::GetResult() const -{ - return m_Result; -} - -void PostGISCreateTableTransactor::CreateGISTIndex(pqxx::nontransaction& T) -{ - /* - std::stringstream addGISTIndexCmd; - - addGISTIndexCmd << "CREATE INDEX idx_" << m_TableName << "_the_geom ON " << m_TableName << " USING gist( the_geom );"; - - otbGenericMsgDebugMacro(<<"Create Command " << addGISTIndexCmd.str()); - T.exec(addGISTIndexCmd.str()); - */ - assert(0); -} - -} // end namespace otb diff --git a/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.h b/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.h deleted file mode 100644 index 2010f383d6b54562bd9de8235c1f28f82efc2966..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbPostGISCreateTableTransactor.h +++ /dev/null @@ -1,91 +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. - -=========================================================================*/ -#ifndef __otbPostGISCreateTableTransactor_h -#define __otbPostGISCreateTableTransactor_h - -#include <pqxx/pqxx> -#include <string> - -namespace otb -{ - -/** \class PostGISCreateTableTransactor - * \brief PQXX-based transactor for creating PostGIS tables - * - * - * The copy constructor and the "=" operator have to be defined for - * deep copy, so that libpqxx is able to get the values set for the - * class variables. - * - * - * \ingroup GISTransactors - */ - -class PostGISCreateTableTransactor : - public pqxx::transactor<pqxx::nontransaction> -{ - -public: - - typedef pqxx::result ResultType; - - typedef pqxx::transactor<pqxx::nontransaction> Superclass; - - PostGISCreateTableTransactor(); - - PostGISCreateTableTransactor(const PostGISCreateTableTransactor& pgt); - - PostGISCreateTableTransactor& operator =(const PostGISCreateTableTransactor& pgt) - throw(); - - void operator ()(pqxx::nontransaction& T); - - void on_commit(); - - std::string GetTableName() const; - - void SetTableName(const std::string& aName); - - int GetSRID() const; - - void SetSRID(int aSRID); - - unsigned short GetDimension() const; - - void SetDimension(unsigned short aDim); - - void SetRemoveExistingTable(bool val); - - bool GetRemoveExistingTable() const; - - ResultType GetResult() const; - - void CreateGISTIndex(pqxx::nontransaction& T); - -protected: - - ResultType m_Result; - std::string m_TableName; - int m_SRID; - unsigned short m_Dimension; - bool m_RemoveExistingTable; -}; - -} // end namespace otb - -#endif diff --git a/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx b/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx deleted file mode 100644 index 107357da642ebe3dab6c104ff3240eabf0a72383..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.cxx +++ /dev/null @@ -1,77 +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 "otbPostGISFromStringTransactor.h" -#include <sstream> -#include "otbMacro.h" - -namespace otb -{ - -PostGISFromStringTransactor::PostGISFromStringTransactor() : PostGISFromStringTransactor::Superclass( - "FromStringTransactor") -{ - m_TransactionString = ""; -} - -PostGISFromStringTransactor::PostGISFromStringTransactor(const PostGISFromStringTransactor& pgt) - : PostGISFromStringTransactor::Superclass("FromStringTransactor") -{ - m_TransactionString = pgt.GetTransactionString(); -} - -PostGISFromStringTransactor & PostGISFromStringTransactor::operator =(const PostGISFromStringTransactor& pgt) -throw() -{ - m_TransactionString = pgt.GetTransactionString(); - return *this; -} - -void PostGISFromStringTransactor::operator ()(pqxx::nontransaction& T) -{ - - if (m_TransactionString != "") - { - - otbGenericMsgDebugMacro(<< "Transaction Command " << m_TransactionString); - - m_Result = T.exec(m_TransactionString); - } - -} - -void PostGISFromStringTransactor::on_commit() -{ - otbMsgDevMacro( "\t Transaction \t\n\t" << m_TransactionString ); -} - -std::string PostGISFromStringTransactor::GetTransactionString() const -{ - return m_TransactionString; -} - -void PostGISFromStringTransactor::SetTransactionString(const std::string& aName) -{ - m_TransactionString = aName; -} - -PostGISFromStringTransactor::ResultType PostGISFromStringTransactor::GetResult() const -{ - return m_Result; -} - -} // end namespace otb diff --git a/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.h b/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.h deleted file mode 100644 index 06480e6c5a331074eeb4b45bc9e5e4a84e281dc5..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbPostGISFromStringTransactor.h +++ /dev/null @@ -1,74 +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. - -=========================================================================*/ -#ifndef __otbPostGISFromStringTransactor_h -#define __otbPostGISFromStringTransactor_h - -#include <pqxx/pqxx> -#include <string> - -namespace otb -{ - -/** \class PostGISFromStringTransactor - * \brief PQXX-based transactor for executing PostGIS queries. - * - * - * The copy constructor and the "=" operator have to be defined for - * deep copy, so that libpqxx is able to get the values set for the - * class variables. - * - * - * \ingroup GISTransactors - */ - -class PostGISFromStringTransactor : - public pqxx::transactor<pqxx::nontransaction> -{ - -public: - - typedef pqxx::result ResultType; - - typedef pqxx::transactor<pqxx::nontransaction> Superclass; - - PostGISFromStringTransactor(); - - PostGISFromStringTransactor(const PostGISFromStringTransactor& pgt); - - PostGISFromStringTransactor& operator =(const PostGISFromStringTransactor& pgt) - throw(); - - void operator ()(pqxx::nontransaction& T); - - void on_commit(); - - std::string GetTransactionString() const; - - void SetTransactionString(const std::string& trans); - - ResultType GetResult() const; - -protected: - - ResultType m_Result; - std::string m_TransactionString; -}; - -} // end namespace otb - -#endif diff --git a/Code/GeospatialAnalysis/otbPostGISQueryTransactor.cxx b/Code/GeospatialAnalysis/otbPostGISQueryTransactor.cxx deleted file mode 100644 index c6f964dedd3ebcf1d4e65f1d55f72d897cd68713..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbPostGISQueryTransactor.cxx +++ /dev/null @@ -1,132 +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 "otbPostGISQueryTransactor.h" -#include <sstream> -#include "otbMacro.h" - -namespace otb -{ - -PostGISQueryTransactor::PostGISQueryTransactor() : PostGISQueryTransactor::Superclass() -{ - m_ViewName = "default_view"; -} - -PostGISQueryTransactor::PostGISQueryTransactor(const PostGISQueryTransactor& pgt) - : PostGISQueryTransactor::Superclass() -{ - m_TransactionString = pgt.GetTransactionString(); - m_ViewName = pgt.GetViewName(); -} - -PostGISQueryTransactor & PostGISQueryTransactor::operator =(const PostGISQueryTransactor& pgt) -throw() -{ - m_TransactionString = pgt.GetTransactionString(); - m_ViewName = pgt.GetViewName(); - return *this; -} - -void PostGISQueryTransactor::operator ()(pqxx::nontransaction& T) -{ - - if (m_RemoveExistingView) - { - std::stringstream dropCommand; - - //dropCommand << "DROP TABLE " << m_ViewName; - dropCommand << "DROP VIEW IF EXISTS " << m_ViewName; - - otbGenericMsgDebugMacro(<< "Drop Command " << dropCommand.str()); - - m_Result = T.exec(dropCommand.str()); - } - - std::stringstream createCommand; - - createCommand << "CREATE VIEW " << m_ViewName - << " AS " << m_TransactionString; - - otbGenericMsgDebugMacro(<< "Create Command " << createCommand.str()); - m_Result = T.exec(createCommand.str()); - -} - -/* -void PostGISQueryTransactor::on_commit() -{ - std::cout << "\t Transaction \t" << std::endl; - std::cout << "\t "<< m_TransactionString << std::endl; - -} - -std::string PostGISQueryTransactor::GetTransactionString() const -{ - return m_TransactionString; -} - -void PostGISQueryTransactor::SetTransactionString(const std::string& aName) -{ - m_TransactionString = aName; -} -*/ -std::string PostGISQueryTransactor::GetViewName() const -{ - return m_ViewName; -} - -void PostGISQueryTransactor::SetRemoveExistingView(bool val) -{ - m_RemoveExistingView = val; -} - -bool PostGISQueryTransactor::GetRemoveExistingView() const -{ - return m_RemoveExistingView; -} - -void PostGISQueryTransactor::SetViewName(const std::string& aName) -{ - m_ViewName = aName; -} -/* -void PostGISQueryTransactor::CreateView(pqxx::nontransaction &T) -{ - if(m_RemoveExistingView) - { - std::stringstream dropCommand; - - //dropCommand << "DROP TABLE " << m_ViewName; - dropCommand << "DROP VIEW IF EXISTS " << m_ViewName; - - otbGenericMsgDebugMacro(<<"Drop Command " << dropCommand.str()); - - m_Result = T.exec(dropCommand.str()); - } - - std::stringstream createCommand; - - createCommand << "CREATE VIEW "<< m_ViewName - <<" AS " << m_TransactionString; - - otbGenericMsgDebugMacro(<<"Create Command " << createCommand.str()); - m_Result = T.exec(createCommand.str()); - -} -*/ -} // end namespace otb diff --git a/Code/GeospatialAnalysis/otbPostGISQueryTransactor.h b/Code/GeospatialAnalysis/otbPostGISQueryTransactor.h deleted file mode 100644 index 4912104acd0c7996f1ce74abf0ea6eddf13e124d..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbPostGISQueryTransactor.h +++ /dev/null @@ -1,76 +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. - -=========================================================================*/ -#ifndef __otbPostGISQueryTransactor_h -#define __otbPostGISQueryTransactor_h - -//#include <pqxx/pqxx> -#include <string> - -#include "otbPostGISFromStringTransactor.h" - -namespace otb -{ - -/** \class PostGISQueryTransactor - * \brief PQXX-based transactor for executing PostGIS queries. - * - * - * The copy constructor and the "=" operator have to be defined for - * deep copy, so that libpqxx is able to get the values set for the - * class variables. - * - * - * \ingroup GISTransactors - */ - -class PostGISQueryTransactor : - public otb::PostGISFromStringTransactor -{ - -public: - - typedef PostGISFromStringTransactor Superclass; - //typedef pqxx::transactor<pqxx::nontransaction> Superclass; - //typedef pqxx::result ResultType; - PostGISQueryTransactor(); - - PostGISQueryTransactor(const PostGISQueryTransactor& pgt); - - PostGISQueryTransactor& operator =(const PostGISQueryTransactor& pgt) - throw(); - - void operator ()(pqxx::nontransaction& T); - - void SetRemoveExistingView(bool val); - - bool GetRemoveExistingView() const; - - void SetViewName(const std::string& aName); - - std::string GetViewName() const; - - //void CreateView(pqxx::nontransaction &T); - -protected: - std::string m_ViewName; - bool m_RemoveExistingView; -}; - -} // end namespace otb - -#endif diff --git a/Code/GeospatialAnalysis/otbTransactorGISTableFunction.h b/Code/GeospatialAnalysis/otbTransactorGISTableFunction.h deleted file mode 100644 index 7a4bbd4dd6aec848af8c651a528521fca0742031..0000000000000000000000000000000000000000 --- a/Code/GeospatialAnalysis/otbTransactorGISTableFunction.h +++ /dev/null @@ -1,94 +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. - -=========================================================================*/ -#ifndef __otbTransactorGISTableFunction_h -#define __otbTransactorGISTableFunction_h - -#include "otbGISTableFunction.h" - -namespace otb -{ - -/** \class TransactorGISTableFunction - * \brief Evaluates a const transaction on a GISTable using a transactor - * - * TransactorGISTableFunction is a baseclass for all objects that evaluate - * a const transaction on a GISTable using an external transactor. - * - * - * - * - * \ingroup TransactorGISTableFunctions - */ -template < - class TInputTable, - class TOutput, class TTransactor - > -class ITK_EXPORT TransactorGISTableFunction : - public GISTableFunction<TInputTable, - TOutput> -{ -public: - /** Dimension underlying input table. */ - itkStaticConstMacro(TableDimension, unsigned int, - TInputTable::TSpatialDimension); - - /** Standard class typedefs. */ - typedef TransactorGISTableFunction Self; - typedef GISTableFunction<TInputTable, TOutput> Superclass; - typedef SmartPointer<Self> Pointer; - typedef SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(TransactorGISTableFunction, GISTableFunction); - - /** InputTableType typedef support. */ - typedef TInputTable InputTableType; - typedef TTransactor TransactorType; - - /** Connection typedef support */ - typedef typename InputTableType::ConnectionType ConnectionType; - - /** InputTablePointer typedef support */ - typedef typename InputTableType::ConstPointer InputTableConstPointer; - - /** OutputType typedef support. */ - typedef TOutput OutputType; - - /** Evaluate the function using the transactor. */ - virtual TOutput Evaluate() - { - m_Table->GetConnection()->PerformTransaction(TransactorType()); - } - -protected: - TransactorGISTableFunction(); - virtual ~TransactorGISTableFunction() {} - void PrintSelf(std::ostream& os, Indent indent) const; - - /** Const pointer to the input Table. */ - InputTableConstPointer m_Table; - -private: - TransactorGISTableFunction(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - -}; - -} // end namespace otb - -#endif diff --git a/Code/OBIA/CMakeLists.txt b/Code/OBIA/CMakeLists.txt index f4df6d20ad0504506bed00a8c9b6218ba9f1c45a..b4189d0e79e87642793bd341ea19ef657021a946 100644 --- a/Code/OBIA/CMakeLists.txt +++ b/Code/OBIA/CMakeLists.txt @@ -14,10 +14,6 @@ if(OTB_USE_MAPNIK) target_link_libraries(OTBOBIA ${MAPNIK_LIBRARY} ${ICUUC_LIBRARY}) endif() -if(OTB_USE_PQXX) - target_link_libraries(OTBOBIA ${PQXX_LIBRARY}) -endif() - if(OTB_I18N) target_link_libraries(OTBOBIA ${GETTEXT_LIBRARY}) if(APPLE OR WIN32) diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index d110519fc9c751a470a7d590ea6835e632bb6471..3090b7feb3937a652b1a0dd676becfcc4bf614ee 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -42,10 +42,6 @@ if(OTB_USE_PATENTED) add_subdirectory( Patented ) endif() -if(OTB_USE_PQXX) - add_subdirectory(GeospatialAnalysis) -endif() - #Recopie du fichier README.txt dans l'arborescence BINARY if( EXISTS ${OTB_BINARY_DIR}/Examples/README.txt ) else() @@ -107,10 +103,6 @@ else() if(OTB_USE_PATENTED) add_subdirectory(Patented) endif() - - if(OTB_USE_PQXX) - add_subdirectory(GeospatialAnalysis) - endif() else() message("OTB not found. Please set OTB_DIR") endif() diff --git a/Examples/GeospatialAnalysis/CMakeLists.txt b/Examples/GeospatialAnalysis/CMakeLists.txt deleted file mode 100644 index b3ee45c47c5cf97d128c35504165165f579ed721..0000000000000000000000000000000000000000 --- a/Examples/GeospatialAnalysis/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -project(GeospatialAnalysisExamples) -include_regular_expression("^.*$") - -add_executable(PostGISCreateTable PostGISCreateTable.cxx ) -target_link_libraries(PostGISCreateTable OTBCommon OTBIO OTBGeospatialAnalysis) - - - -if( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) - -set(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/GeospatialAnalysis) - -set(INPUTDATA ${OTB_DATA_ROOT}/Examples) -#Remote sensing images (large images ) -if(OTB_DATA_USE_LARGEINPUT) - set(INPUTLARGEDATA ${OTB_DATA_LARGEINPUT_ROOT} ) -endif() - -set(TEMP ${OTB_BINARY_DIR}/Testing/Temporary) - -set(EXE_TESTS ${CXX_TEST_PATH}/otbGeospatialAnalysisExamplesTests) - -set(TOL 0.0) -set(EPS 0.001) - -add_test( trTeGeospatialAnalysisPostGISCreateTableTest ${EXE_TESTS} - - GeospatialAnalysisPostGISCreateTableTest - localhost - orfeotoolbox_test - orfeotoolbox_test_user - Bidfeud0 - ) - - - -include_directories(${OTB_SOURCE_DIR}/Testing/Code) -add_executable(otbGeospatialAnalysisExamplesTests otbGeospatialAnalysisExamplesTests.cxx) -target_link_libraries(otbGeospatialAnalysisExamplesTests OTBCommon OTBIO OTBGeospatialAnalysis OTBTesting) - -endif() diff --git a/Examples/GeospatialAnalysis/PostGISCreateTable.cxx b/Examples/GeospatialAnalysis/PostGISCreateTable.cxx deleted file mode 100644 index f88647018af7abe89ecf74da622e5da6af5c68a7..0000000000000000000000000000000000000000 --- a/Examples/GeospatialAnalysis/PostGISCreateTable.cxx +++ /dev/null @@ -1,107 +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. - -=========================================================================*/ - -// Software Guide : BeginLatex -// -// This example uses a transactor to create a table. The transactor -// needs to have a copy constructor, so the initialization is done -// correctly for the class variables which are set before the transaction. -// Let's look at the minimal code required to use this algorithm. First, the -// following header defining the \doxygen{otb}{PostGISCreateTableTransactor} class -// must be included. -// Software Guide : EndLatex - -#include "otbMacro.h" - -// Software Guide : BeginCodeSnippet -#include "otbPostGISCreateTableTransactor.h" -#include "otbPostGISConnectionImplementation.h" -// Software Guide : EndCodeSnippet - -int main(int argc, char * argv[]) -{ - - // Software Guide : BeginLatex - // - // We use a PostGIS (PQXX-based) transactor - // for creating PostGIS tables. - // Software Guide : EndLatex - - // Software Guide : BeginCodeSnippet - typedef otb::PostGISCreateTableTransactor TransactorType; - - TransactorType myTransactor; - // Software Guide : EndCodeSnippet - - // Software Guide : BeginLatex - // - // We set arguments of the transactor. - - // Software Guide : EndLatex - - // Software Guide : BeginCodeSnippet - unsigned short dimension = 2; - myTransactor.SetDimension(dimension); - - std::string name = "mytable"; - myTransactor.SetTableName(name); - - int srid = -1; - myTransactor.SetSRID(srid); - - myTransactor.SetRemoveExistingTable(true); - // Software Guide : EndCodeSnippet - - // Software Guide : BeginLatex - // - // After defining the transcator, we need to create the - // connection interface to the PostgreSQL database. - // This is done by the \doxygen{otb}{PostGISConnectionImplementation}. - // - // Software Guide : EndLatex - - // Software Guide : BeginCodeSnippet - const std::string hostName = argv[1]; - const std::string dbName = argv[2]; - const std::string userName = argv[3]; - const std::string userPassword = argv[4]; - - typedef otb::PostGISConnectionImplementation GISConnectionType; - - GISConnectionType::Pointer connection = GISConnectionType::New(); - - connection->SetHost(hostName); - connection->SetDBName(dbName); - connection->SetUser(userName); - connection->SetPassword(userPassword); - // Software Guide : EndCodeSnippet - - // Software Guide : BeginLatex - // - // Let's now connect to the database and perform the transaction - // with the method \code{PerformTransaction}. - // - // Software Guide : EndLatex - - // Software Guide : BeginCodeSnippet - connection->ConnectToDB(); - - connection->PerformTransaction(myTransactor); - // Software Guide : EndCodeSnippet - return EXIT_SUCCESS; -} diff --git a/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx b/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx deleted file mode 100644 index 64ed4826ade60d3407e32bf5b0c43795cdd99494..0000000000000000000000000000000000000000 --- a/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx +++ /dev/null @@ -1,32 +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. - -=========================================================================*/ - -// this file defines the otbMultiScaleTest for the test driver -// and all it expects is that you have a function called RegisterTests - -#include <iostream> -#include "otbTestMain.h" - -void RegisterTests() -{ - REGISTER_TEST(GeospatialAnalysisPostGISCreateTableTest); -} - -#undef main -#define main GeospatialAnalysisPostGISCreateTableTest -#include "PostGISCreateTable.cxx" diff --git a/Testing/Code/CMakeLists.txt b/Testing/Code/CMakeLists.txt index dc1e9ba032a97f975b48423fa9d5c86a48a67799..34ce3abc062443cd7891fb39aa743cb7005974f5 100644 --- a/Testing/Code/CMakeLists.txt +++ b/Testing/Code/CMakeLists.txt @@ -30,10 +30,6 @@ if(OTB_USE_VISU_GUI) add_subdirectory(Visualization) endif() -if(OTB_USE_PQXX) - add_subdirectory(GeospatialAnalysis) -endif() - if(BUILD_APPLICATIONS) add_subdirectory(ApplicationEngine) add_subdirectory(Wrappers) diff --git a/Testing/Code/Common/CMakeLists.txt b/Testing/Code/Common/CMakeLists.txt index bd7d66caef4c2bc55a2749caf1e68cdb315bc596..f49c57442a88d808b71be9f2e6ec0eba6bda23a1 100644 --- a/Testing/Code/Common/CMakeLists.txt +++ b/Testing/Code/Common/CMakeLists.txt @@ -12,9 +12,6 @@ set(COMMON_TESTS8 ${CXX_TEST_PATH}/otbCommonTests8) if(OTB_USE_MAPNIK) set(COMMON_TESTS9 ${CXX_TEST_PATH}/otbCommonTests9) endif() -if(OTB_USE_PQXX) - set(COMMON_TESTS10 ${CXX_TEST_PATH}/otbCommonTests10) -endif() set(COMMON_TESTS11 ${CXX_TEST_PATH}/otbCommonTests11) set(COMMON_TESTS12 ${CXX_TEST_PATH}/otbCommonTests12) set(COMMON_TESTS13 ${CXX_TEST_PATH}/otbCommonTests13) @@ -913,86 +910,6 @@ add_test(coTvVectorDataToMapFilterWorld ${COMMON_TESTS9} endif() - - -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests10 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# ---------------- PostGIS Interface ---------------------# -if(OTB_USE_PQXX) - -add_test(coTuPostGISConnectionImplementationNew ${COMMON_TESTS10} - otbPostGISConnectionImplementationNew -) - -#This test need a runing PostGIS server on the localhost with trusted potgres user and an ecisting testgis base -add_test(coTvPostGISConnectionImplementationConnectToDB ${COMMON_TESTS10} - otbPostGISConnectionImplementationConnectToDB - localhost - orfeotoolbox_test - orfeotoolbox_test_user - Bidfeud0 -) - -add_test(coTvPostGISConnectionImplementationPerformTransaction ${COMMON_TESTS10} - otbPostGISConnectionImplementationPerformTransaction - localhost - orfeotoolbox_test - orfeotoolbox_test_user - Bidfeud0 -) - - -add_test(coTuGISTableNew ${COMMON_TESTS10} - otbGISTableNew -) - -add_test(coTuPostGISTableNew ${COMMON_TESTS10} - otbPostGISTableNew -) - -add_test(coTuVectorDataToGISTableFilterNew ${COMMON_TESTS10} - otbVectorDataToGISTableFilterNew -) - - -# add_test(coTuVectorDataToGISTableFilter ${COMMON_TESTS10} -# otbVectorDataToGISTableFilter -# ${INPUTDATA}/ToulousePoints-examples.shp -# test -# postgres -# postgres -# ) - -add_test(coTuGISTableToGISTableFilterNew ${COMMON_TESTS10} - otbGISTableToGISTableFilterNew -) - - -add_test(coTuGISTableToVectorDataFilterNew ${COMMON_TESTS10} - otbGISTableToVectorDataFilterNew -) - -#need gdal 1.6 for POSTGIS tables connection via OGR string -add_test(coTvGISTableToVectorDataFilter ${COMMON_TESTS10} -otbGISTableToVectorDataFilter -${TEMP}/gistabletovectordatafilter.shp -orfeotoolbox_test -labelmaptogis_test_table -orfeotoolbox_test_user -Bidfeud0 -) - - -# ---------------- otbGISTableSource ---------------------# -add_test(coTuGISTableSourceNew ${COMMON_TESTS10} -otbGISTableSourceNew -) - - -endif() - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests11 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1408,24 +1325,6 @@ otbVectorDataToImageFilter.cxx ) endif() -if(OTB_USE_PQXX) -set(BasicCommon_SRCS10 -otbCommonTests10.cxx -otbPostGISConnectionImplementationNew.cxx -otbPostGISConnectionImplementationConnectToDB.cxx -otbPostGISConnectionImplementationPerformTransaction.cxx -otbGISTableNew.cxx -otbPostGISTableNew.cxx -otbVectorDataToGISTableFilterNew.cxx -# otbVectorDataToGISTableFilter.cxx -otbGISTableToGISTableFilterNew.cxx -otbGISTableToVectorDataFilterNew.cxx -otbGISTableToVectorDataFilter.cxx -otbGISTableSourceNew.cxx -) -endif() - - set(BasicCommon_SRCS11 otbUnaryFunctorWithIndexImageFilterNew.cxx otbUnaryFunctorWithIndexImageFilter.cxx @@ -1472,11 +1371,6 @@ OTB_ADD_EXECUTABLE(otbCommonTests8 "${BasicCommon_SRCS8}" "OTBIO;OTBTesting") if(OTB_USE_MAPNIK) OTB_ADD_EXECUTABLE(otbCommonTests9 "${BasicCommon_SRCS9}" "OTBIO;OTBTesting;${MAPNIK_LIBRARY};${ICUUC_LIBRARY}") endif() -if(OTB_USE_PQXX) - #TODO this line should be refined when we will like to have this capability with windows -OTB_ADD_EXECUTABLE(otbCommonTests10 "${BasicCommon_SRCS10}" "OTBIO;OTBTesting") -target_link_libraries(otbCommonTests10 OTBIO OTBTesting OTBGeospatialAnalysis pq pqxx) -endif() add_executable(otbCommonTests11 otbCommonTests11.cxx ${BasicCommon_SRCS11}) target_link_libraries(otbCommonTests11 OTBIO OTBTesting itkvcl) diff --git a/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx b/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx deleted file mode 100644 index 819ee0263d96af67e6d2e1920e6fc03683b682bd..0000000000000000000000000000000000000000 --- a/Testing/Code/Common/otbPostGISConnectionImplementationConnectToDB.cxx +++ /dev/null @@ -1,44 +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 "otbMacro.h" - -#include "otbPostGISConnectionImplementation.h" - -int otbPostGISConnectionImplementationConnectToDB(int argc, char * argv[]) -{ - - const std::string hostName = argv[1]; - const std::string dbName = argv[2]; - const std::string userName = argv[3]; - const std::string userPassword = argv[4]; - - typedef otb::PostGISConnectionImplementation GISConnectionType; - - //Instantiation - GISConnectionType::Pointer connection = GISConnectionType::New(); - - connection->SetHost(hostName); - connection->SetDBName(dbName); - connection->SetUser(userName); - connection->SetPassword(userPassword); - - connection->ConnectToDB(); - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/Common/otbPostGISConnectionImplementationNew.cxx b/Testing/Code/Common/otbPostGISConnectionImplementationNew.cxx deleted file mode 100644 index 80bfbb3f81745338a9a22c79da9886b23695372a..0000000000000000000000000000000000000000 --- a/Testing/Code/Common/otbPostGISConnectionImplementationNew.cxx +++ /dev/null @@ -1,34 +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 "otbMacro.h" - -#include "otbPostGISConnectionImplementation.h" - -int otbPostGISConnectionImplementationNew(int argc, char * argv[]) -{ - - typedef otb::PostGISConnectionImplementation GISConnectionType; - - //Instantiation - GISConnectionType::Pointer data = GISConnectionType::New(); - - std::cout << data << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx b/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx deleted file mode 100644 index dfe6703d715117e31a1cae876ba0c9cbc0aa3abf..0000000000000000000000000000000000000000 --- a/Testing/Code/Common/otbPostGISConnectionImplementationPerformTransaction.cxx +++ /dev/null @@ -1,68 +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 "otbMacro.h" -#include "otbPostGISConnectionImplementation.h" - -class ReadTables : public pqxx::transactor<pqxx::nontransaction> -{ - pqxx::result m_Result; -public: - ReadTables() : pqxx::transactor<pqxx::nontransaction>("ReadTables") {} - - void operator ()(argument_type& T) - { - m_Result = T.exec("SELECT * FROM pg_tables"); - } - - void on_commit() - { - for (pqxx::result::const_iterator c = m_Result.begin(); c != m_Result.end(); ++c) - { - std::string N; - c[0].to(N); - - std::cout << '\t' << c.num() << '\t' << N << std::endl; - } - } -}; - -int otbPostGISConnectionImplementationPerformTransaction(int argc, char * argv[]) -{ - - const std::string hostName = argv[1]; - const std::string dbName = argv[2]; - const std::string userName = argv[3]; - const std::string userPassword = argv[4]; - - typedef otb::PostGISConnectionImplementation GISConnectionType; - - //Instantiation - GISConnectionType::Pointer connection = GISConnectionType::New(); - - connection->SetHost(hostName); - connection->SetDBName(dbName); - connection->SetUser(userName); - connection->SetPassword(userPassword); - - connection->ConnectToDB(); - - connection->GetConnection()->perform(ReadTables()); - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/GeospatialAnalysis/CMakeLists.txt b/Testing/Code/GeospatialAnalysis/CMakeLists.txt deleted file mode 100644 index 49705ee76e3852afaffc2dd04fa0ca6c52b36f0c..0000000000000000000000000000000000000000 --- a/Testing/Code/GeospatialAnalysis/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ - -if( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) - - -set(GEOSPATIALANALYSIS_TESTS ${CXX_TEST_PATH}/otbGeospatialAnalysisTests) - -# ------------- Transactors ---------------------------- - -add_test(gfTuPostGISCreateTableTransactorNew ${GEOSPATIALANALYSIS_TESTS} - otbPostGISCreateTableTransactorNew - ) - -add_test(gfTuPostGISCreateTableTransactorAccessors ${GEOSPATIALANALYSIS_TESTS} - otbPostGISCreateTableTransactorAccessors - ) - -add_test(gfTuPostGISCreateTableTransactorCreate ${GEOSPATIALANALYSIS_TESTS} - otbPostGISCreateTableTransactorCreate - localhost - orfeotoolbox_test - orfeotoolbox_test_user - Bidfeud0 - ) - -add_test(gfTuPostGISFromStringTransactorNew ${GEOSPATIALANALYSIS_TESTS} - otbPostGISFromStringTransactorNew - ) - - -# ------- CXX source files ----------------------------------- -set(GEOSPATIALANALYSIS_SRCS -otbGeospatialAnalysisTests.cxx -otbPostGISCreateTableTransactorNew.cxx -otbPostGISCreateTableTransactorAccessors.cxx -otbPostGISCreateTableTransactorCreate.cxx -otbPostGISFromStringTransactorNew.cxx -) - -OTB_ADD_EXECUTABLE(otbGeospatialAnalysisTests "${GEOSPATIALANALYSIS_SRCS}" "OTBGeospatialAnalysis;OTBTesting;OTBCommon;pq;pqxx") - -endif() diff --git a/Testing/Code/GeospatialAnalysis/otbGeospatialAnalysisTests.cxx b/Testing/Code/GeospatialAnalysis/otbGeospatialAnalysisTests.cxx deleted file mode 100644 index 481dded3a3550ffa0f704a34dfb8b2f92a3fa63b..0000000000000000000000000000000000000000 --- a/Testing/Code/GeospatialAnalysis/otbGeospatialAnalysisTests.cxx +++ /dev/null @@ -1,31 +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. - -=========================================================================*/ - -// this file defines the otbGISFiltersTest for the test driver -// and all it expects is that you have a function called RegisterTests - - -#include "otbTestMain.h" - -void RegisterTests() -{ - REGISTER_TEST(otbPostGISCreateTableTransactorNew); - REGISTER_TEST(otbPostGISCreateTableTransactorAccessors); - REGISTER_TEST(otbPostGISCreateTableTransactorCreate); - REGISTER_TEST(otbPostGISFromStringTransactorNew); -} diff --git a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx deleted file mode 100644 index 88ce4f1225810050602161329f6ba2812dde3bc2..0000000000000000000000000000000000000000 --- a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorAccessors.cxx +++ /dev/null @@ -1,50 +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 "otbMacro.h" - -#include "otbPostGISCreateTableTransactor.h" - -int otbPostGISCreateTableTransactorAccessors(int argc, char * argv[]) -{ - typedef otb::PostGISCreateTableTransactor TransactorType; - - //Instantiation - TransactorType myTransactor; - - unsigned short dimension = 2; - - myTransactor.SetDimension(dimension); - - if (dimension != myTransactor.GetDimension()) return EXIT_FAILURE; - - std::string name = "mytable"; - - myTransactor.SetTableName(name); - - if (name != myTransactor.GetTableName()) return EXIT_FAILURE; - - int srid = -1; - - myTransactor.SetSRID(srid); - - if (srid != myTransactor.GetSRID()) return EXIT_FAILURE; - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx deleted file mode 100644 index ea5a0a355237057c06d3c79d52a220119a5bbf83..0000000000000000000000000000000000000000 --- a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorCreate.cxx +++ /dev/null @@ -1,67 +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 "otbMacro.h" - -#include "otbPostGISCreateTableTransactor.h" -#include "otbPostGISConnectionImplementation.h" - -/** This test uses a transactor to create a table. The transactor -needs to have a copy constructor, so the initialization is done -correctly for the class variables which are set before the transaction -*/ - -int otbPostGISCreateTableTransactorCreate(int argc, char * argv[]) -{ - typedef otb::PostGISCreateTableTransactor TransactorType; - - //Instantiation - TransactorType myTransactor; - - unsigned short dimension = 2; - myTransactor.SetDimension(dimension); - - std::string name = "mytable"; - myTransactor.SetTableName(name); - - int srid = -1; - myTransactor.SetSRID(srid); - - myTransactor.SetRemoveExistingTable(true); - - const std::string hostName = argv[1]; - const std::string dbName = argv[2]; - const std::string userName = argv[3]; - const std::string userPassword = argv[4]; - - typedef otb::PostGISConnectionImplementation GISConnectionType; - - //Instantiation - GISConnectionType::Pointer connection = GISConnectionType::New(); - - connection->SetHost(hostName); - connection->SetDBName(dbName); - connection->SetUser(userName); - connection->SetPassword(userPassword); - - connection->ConnectToDB(); - - connection->PerformTransaction(myTransactor); - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorNew.cxx b/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorNew.cxx deleted file mode 100644 index e643bcd57249215392f44378a5229eeee6919ac2..0000000000000000000000000000000000000000 --- a/Testing/Code/GeospatialAnalysis/otbPostGISCreateTableTransactorNew.cxx +++ /dev/null @@ -1,31 +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 "otbMacro.h" - -#include "otbPostGISCreateTableTransactor.h" - -int otbPostGISCreateTableTransactorNew(int argc, char * argv[]) -{ - typedef otb::PostGISCreateTableTransactor TransactorType; - - //Instantiation - TransactorType myTransactor(); - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/GeospatialAnalysis/otbPostGISFromStringTransactorNew.cxx b/Testing/Code/GeospatialAnalysis/otbPostGISFromStringTransactorNew.cxx deleted file mode 100644 index 7fa5887c840433a403ba564e1506829c607b73ae..0000000000000000000000000000000000000000 --- a/Testing/Code/GeospatialAnalysis/otbPostGISFromStringTransactorNew.cxx +++ /dev/null @@ -1,31 +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 "otbMacro.h" - -#include "otbPostGISFromStringTransactor.h" - -int otbPostGISFromStringTransactorNew(int argc, char * argv[]) -{ - typedef otb::PostGISFromStringTransactor TransactorType; - - //Instantiation - TransactorType myTransactor(); - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index fd51d4c80944c551961ceb6b95d68a4b88809fb0..7d079087d0a9c4c5b3108d9d2bceed3a8ec53dd7 100644 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -2566,16 +2566,6 @@ add_test(ioTuOGRVectorDataIOTestCanReadMapInfo ${IO_TESTS15} otbOGRVectorDataIOTestCanRead ${INPUTDATA}/LOCALITY_POLYGON.tab) -# CanRead OGR PostGIS() -if(OTB_USE_PQXX) -#The original string is PG:"dbname='orfeotoolbox_test' host='localhost' port='5432' user='orfeotoolbox_test_user' password='Bidfeud0'" -#but we need to work with cmake/ctest escaping -set(CONNSTRING "PG:dbname=orfeotoolbox_test\ host=localhost\ port=5432\ user=orfeotoolbox_test_user\ password=Bidfeud0") -add_test(ioTuOGRVectorDataIOTestCanReadPostGIS ${IO_TESTS15} - otbOGRVectorDataIOTestCanRead - ${CONNSTRING}) -endif() - # CanWrite OGR GML() add_test(ioTuOGRVectorDataIOCanWriteGML ${IO_TESTS15} otbOGRVectorDataIOCanWrite @@ -2586,13 +2576,6 @@ add_test(ioTuOGRVectorDataIOCanWriteMapInfo ${IO_TESTS15} otbOGRVectorDataIOCanWrite ${INPUTDATA}/LOCALITY_POLYGON.tab) -# Canwrite OGR PostGIS() -if(OTB_USE_PQXX) -add_test(ioTuOGRVectorDataIOCanWritePostGIS ${IO_TESTS15} - otbOGRVectorDataIOCanWrite - PG:"dbname='orfeotoolbox_test' host='localhost' port='5432' user='orfeotoolbox_test_user' password='Bidfeud0'") -endif() - add_test(ioTuKMLVectorDataIO ${IO_TESTS15} otbKMLVectorDataIONew ) diff --git a/Testing/Code/OBIA/CMakeLists.txt b/Testing/Code/OBIA/CMakeLists.txt index c21d648d1edd595add0deef1ba8f1c3efefb668b..7f87493661bb6f6b57ff5c6d00c11a10b66ffae0 100644 --- a/Testing/Code/OBIA/CMakeLists.txt +++ b/Testing/Code/OBIA/CMakeLists.txt @@ -196,24 +196,6 @@ add_test(obTuLabelMapToAttributeImageFilterNew ${OBIA_TESTS1} otbLabelMapToAttributeImageFilterNew) -# OBIATests2 (need PQXX) -if(OTB_USE_PQXX) -add_test(obTuLabelMapToGISTableFilterNew ${OBIA_TESTS2} - otbLabelMapToGISTableFilterNew) - -add_test(obTuGISTableToLabelMapFilterNew ${OBIA_TESTS2} - otbGISTableToLabelMapFilterNew) - -add_test(obTvLabelMapToGISTableFilter ${OBIA_TESTS2} - otbLabelMapToGISTableFilter - ${INPUTDATA}/rcc8_mire1.png - orfeotoolbox_test - labelmaptogis_test_table - orfeotoolbox_test_user - Bidfeud0) -endif() - - # OBIATests3 (need Learning) add_test(obTuLabelMapSVMClassifierNew ${OBIA_TESTS3} otbLabelMapSVMClassifierNew) @@ -254,16 +236,6 @@ otbMeanShiftConnectedComponentSegmentationFilterTest.cxx otbLabelMapToAttributeImageFilterNew.cxx ) - - -if(OTB_USE_PQXX) -set(BasicOBIA_SRCS2 -otbLabelMapToGISTableFilterNew.cxx -otbGISTableToLabelMapFilterNew.cxx -otbLabelMapToGISTableFilter.cxx -) -endif() - set(BasicOBIA_SRCS3 otbLabelMapSVMClassifier.cxx otbLabelImageToLabelMapWithAdjacencyFilter.cxx @@ -272,11 +244,6 @@ otbLabelImageToLabelMapWithAdjacencyFilter.cxx add_executable(otbOBIATests1 otbOBIATests1.cxx ${BasicOBIA_SRCS1}) target_link_libraries(otbOBIATests1 OTBIO OTBOBIA OTBTesting OTBOGRAdapters) -if(OTB_USE_PQXX) -add_executable(otbOBIATests2 otbOBIATests2.cxx ${BasicOBIA_SRCS2}) -target_link_libraries(otbOBIATests2 OTBIO OTBOBIA OTBTesting OTBGeospatialAnalysis pq pqxx) -endif() - add_executable(otbOBIATests3 otbOBIATests3.cxx ${BasicOBIA_SRCS3}) target_link_libraries(otbOBIATests3 OTBIO OTBOBIA OTBLearning OTBTesting)