diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToReaderOptions.h b/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToReaderOptions.h new file mode 100644 index 0000000000000000000000000000000000000000..4aa7b78b315f807717e13c9de0acd0fbd298a049 --- /dev/null +++ b/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToReaderOptions.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otbOGRExtendedFilenameToReaderOptions_h +#define otbOGRExtendedFilenameToReaderOptions_h + +#include <set> +#include "otbExtendedFilenameHelper.h" + +namespace otb +{ + +/** \class OGRExtendedFilenameToReaderOptions + */ + +class ITK_EXPORT OGRExtendedFilenameToReaderOptions : public ExtendedFilenameHelper +{ +public: + /** Standard class typedefs. */ + typedef OGRExtendedFilenameToReaderOptions Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + typedef ExtendedFilenameHelper Superclass; + + typedef Superclass::OptionMapType OptionMapType; + typedef OptionMapType::iterator MapIteratorType; + + itkTypeMacro(OGRExtendedFilenameToReaderOptions, otb::ExtendedFilenameHelper); + itkNewMacro(Self); + + /** The creation option structure. */ + struct OptionType + { + std::pair< bool , std::string > simpleFileName; + std::pair< bool , std::string > encoding; + std::set< std::string > availableOptions; + }; + + /* Set Methods */ + void SetExtendedFileName(const char * extFname) override; + +protected: + OGRExtendedFilenameToReaderOptions(); + ~OGRExtendedFilenameToReaderOptions() override {}; + +private: + OGRExtendedFilenameToReaderOptions(const Self &) = delete ; + void operator =(const Self&) = delete ; + + OptionType m_Options; +}; + +} //end namespace otb + +#endif // otbOGRExtendedFilenameToReaderOptions_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToWriterOptions.h b/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToWriterOptions.h new file mode 100644 index 0000000000000000000000000000000000000000..8c8422166fceedc5a12c01a8fc1d98f4ef1771dd --- /dev/null +++ b/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToWriterOptions.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otbOGRExtendedFilenameToWriterOptions_h +#define otbOGRExtendedFilenameToWriterOptions_h + +#include "otbExtendedFilenameHelper.h" + +namespace otb +{ + +/** \class OGRExtendedFilenameToWriterOptions + */ + +class ITK_EXPORT OGRExtendedFilenameToWriterOptions : public ExtendedFilenameHelper +{ +public: +}; + +} //end namespace otb + +#endif // otbOGRExtendedFilenameToWriterOptions_h \ No newline at end of file diff --git a/Modules/Adapters/GdalAdapters/src/CMakeLists.txt b/Modules/Adapters/GdalAdapters/src/CMakeLists.txt index 4ba50ff1e286f05842703510931bffec1d5f0f21..0cfe725108b158293cba3b56c91e4d7b1f72b2e9 100644 --- a/Modules/Adapters/GdalAdapters/src/CMakeLists.txt +++ b/Modules/Adapters/GdalAdapters/src/CMakeLists.txt @@ -29,6 +29,8 @@ set(OTBGdalAdapters_SRC otbGeometriesToGeometriesFilter.cxx otbOGRDataSourceWrapper.cxx otbOGRVersionProxy.cxx + otbOGRExtendedFilenameToReaderOptions.cxx + otbOGRExtendedFilenameToWriterOptions.cxx ) add_library(OTBGdalAdapters ${OTBGdalAdapters_SRC}) diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToReaderOptions.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToReaderOptions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..73fb4b311cc39f276b2b18664816d098db97ebac --- /dev/null +++ b/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToReaderOptions.cxx @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbOGRExtendedFilenameToReaderOptions.h" + +namespace otb +{ + +OGRExtendedFilenameToReaderOptions:: +OGRExtendedFilenameToReaderOptions() +{ + m_Options.simpleFileName.first = false; + m_Options.simpleFileName.second = ""; + + m_Options.encoding.first = false; + m_Options.encoding.second = ""; + + m_Options.availableOptions.insert("encoding"); +} + +void +OGRExtendedFilenameToReaderOptions:: +SetExtendedFileName(const char *extFname) +{ + Superclass::SetExtendedFileName(extFname); + OptionMapType map = GetOptionMap(); + + m_Options.simpleFileName.first = true; + m_Options.simpleFileName.second = this->GetSimpleFileName(); + + +} + + +} //end namespace otb diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToWriterOptions.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToWriterOptions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dc491e3680eaedcbc67909c992feb634c33e0038 --- /dev/null +++ b/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToWriterOptions.cxx @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbOGRExtendedFilenameToReaderOptions.h" + +namespace otb +{ + + +} //end namespace otb \ No newline at end of file diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h b/Modules/Core/Common/include/otbExtendedFilenameHelper.h similarity index 96% rename from Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h rename to Modules/Core/Common/include/otbExtendedFilenameHelper.h index b6d29171cd0ef81fd67ad3822c06366c417f2544..018647b821db79081eac853d9813f61ad1ea2fba 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h +++ b/Modules/Core/Common/include/otbExtendedFilenameHelper.h @@ -23,6 +23,7 @@ #include "itkObject.h" #include "itkObjectFactory.h" +#include "OTBCommonExport.h" namespace otb { @@ -35,7 +36,7 @@ namespace otb * \ingroup OTBExtendedFilename */ -class ITK_EXPORT ExtendedFilenameHelper : public itk::Object +class OTBCommon_EXPORT ExtendedFilenameHelper : public itk::Object { public: /** Standard class typedefs. */ diff --git a/Modules/Core/Common/otb-module.cmake b/Modules/Core/Common/otb-module.cmake index 97ba992dd7ca4a88b6ce1ac6475678f27eb1368b..b3276d69422b566872290eba6a5d817cb2b45be1 100644 --- a/Modules/Core/Common/otb-module.cmake +++ b/Modules/Core/Common/otb-module.cmake @@ -27,6 +27,8 @@ ENABLE_SHARED OTBITK #Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h OTBGDAL + #Add dependency for extended filename helper class + OTBBoostAdapters TEST_DEPENDS OTBImageBase diff --git a/Modules/Core/Common/src/CMakeLists.txt b/Modules/Core/Common/src/CMakeLists.txt index 02ff6250e794704244acbe370fc7c562a13524c3..9f7cbe71dbaf60db2976cc24ff102cea84f9d620 100644 --- a/Modules/Core/Common/src/CMakeLists.txt +++ b/Modules/Core/Common/src/CMakeLists.txt @@ -29,12 +29,12 @@ set(OTBCommon_SRC otbWriterWatcherBase.cxx otbStopwatch.cxx otbStringToHTML.cxx + otbExtendedFilenameHelper.cxx ) add_library(OTBCommon ${OTBCommon_SRC}) target_link_libraries(OTBCommon ${OTBITK_LIBRARIES} - ) otb_module_target(OTBCommon) diff --git a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx b/Modules/Core/Common/src/otbExtendedFilenameHelper.cxx similarity index 100% rename from Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx rename to Modules/Core/Common/src/otbExtendedFilenameHelper.cxx diff --git a/Modules/IO/ExtendedFilename/otb-module.cmake b/Modules/IO/ExtendedFilename/otb-module.cmake index cf194a8edde1a755df8dd5343ffaeefbb56b65c9..1e46b70a5bfefcc72cda05d38d35e428fba5d6f5 100644 --- a/Modules/IO/ExtendedFilename/otb-module.cmake +++ b/Modules/IO/ExtendedFilename/otb-module.cmake @@ -26,8 +26,8 @@ product by skipping either geographic or sensor-model information.") otb_module(OTBExtendedFilename DEPENDS + OTBCommon OTBIOGDAL - OTBBoostAdapters OTBITK TEST_DEPENDS diff --git a/Modules/IO/ExtendedFilename/src/CMakeLists.txt b/Modules/IO/ExtendedFilename/src/CMakeLists.txt index 033f0db2d93dfe762ed49684cdbf8cba0eed68b8..35ec302ad43392100078862ecc954abce105eeaa 100644 --- a/Modules/IO/ExtendedFilename/src/CMakeLists.txt +++ b/Modules/IO/ExtendedFilename/src/CMakeLists.txt @@ -20,15 +20,13 @@ set(OTBExtendedFilename_SRC otbExtendedFilenameToReaderOptions.cxx - otbExtendedFilenameHelper.cxx otbExtendedFilenameToWriterOptions.cxx ) add_library(OTBExtendedFilename ${OTBExtendedFilename_SRC}) target_link_libraries(OTBExtendedFilename + ${OTBCommon_LIBRARIES} ${OTBIOGDAL_LIBRARIES} - ${OTBBoost_LIBRARIES} - ) otb_module_target(OTBExtendedFilename)