Skip to content
Commits on Source (6)
### Description
Describe what happens and why you think it is a bug
### Steps to reproduce
Describe as precisely as possible how to reproduce the bug. Try to isolate a minimal number of steps. Also describe reproducibility (always, random ...).
### Configuration information
OS, OTB version or tag, information related to build (binaries, superbuild, system libs ...)
/label ~bug
### Target documentation ressources
Can be a combination of Software guide, cookbook, doxygen, blog, applications doc, websites
### Change requested
Describe precisely the changes that are required.
Short summary of the requested feature
/label ~feature
### What changes will be made and why they would make a better Orfeo ToolBox?
#### High level description
#### Risks and benefits
#### Alternatives for implementations
### Who will be developing the proposed changes?
### Summary
Gives a short summary of the changes.
### Rationale
Explain the rationale for the changes (possible link to a Request For Comments or to an issue).
### Implementation Details
#### Classes and files
Give an overview of the implementation: main changes made to classes, files and modules. Do not paste complete diff, as it is available in the merge request already.
#### Applications
Describe any changes made to existing applications, or new applications that have been added.
#### Tests
Describe the testing strategy for new features.
### Documentation
List or link documentation modifications that were made (doxygen, example, Software Guide, application documentation, CookBook).
### Additional notes
List remaining open issues if any, and additional notes.
### Copyright
The copyright owner is *COPYRIGHT OWNER (OR OWNER'S AGENT)* and has signed the ORFEO ToolBox Contributor License Agreement
......@@ -97,25 +97,43 @@ if(SHARK_CONFIG_FILE)
"${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH}")
endif()
set(SHARK_USE_OPENMP_matched)
#define SHARK_USE_OPENMP
# Check if Shark was built with OpenMP, CBLAS, DYNLIB, ...
file(STRINGS "${SHARK_INCLUDE_DIR}/shark/Core/Shark.h" SHARK_H_CONTENTS)
string(REGEX MATCH
"#define.SHARK_USE_OPENMP"
SHARK_USE_OPENMP_matched "${SHARK_H_CONTENTS}")
if(SHARK_USE_OPENMP_matched)
if(NOT OTB_USE_OPENMP)
message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.")
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_OPENMP")
set(SHARK_USE_OPENMP 1)
else()
set(SHARK_USE_OPENMP 0)
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_CBLAS")
set(SHARK_USE_CBLAS 1)
else()
set(SHARK_USE_CBLAS 0)
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_DYNLIB")
set(SHARK_USE_DYNLIB 1)
else()
set(SHARK_USE_DYNLIB 0)
endif()
if(SHARK_USE_CBLAS AND SHARK_USE_DYNLIB)
set(REQUIRED_CBLAS_LIB CBLAS_LIBRARY)
find_library(CBLAS_LIBRARY NAMES cblas)
else()
set(REQUIRED_CBLAS_LIB)
endif()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Shark
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR ${REQUIRED_CBLAS_LIB}
VERSION_VAR SHARK_VERSION_STRING)
if(SHARK_FOUND)
set(SHARK_INCLUDE_DIRS ${SHARK_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
set(SHARK_LIBRARIES ${SHARK_LIBRARY} ${Boost_LIBRARIES} )
if(REQUIRED_CBLAS_LIB)
set(SHARK_LIBRARIES ${SHARK_LIBRARIES} ${CBLAS_LIBRARY})
endif()
endif()
......@@ -277,6 +277,12 @@ macro(otb_module_test)
foreach(dep IN LISTS OTB_MODULE_${otb-module-test}_DEPENDS)
list(APPEND ${otb-module-test}_LIBRARIES "${${dep}_LIBRARIES}")
endforeach()
# make sure the test can link with optional libs
foreach(dep IN LISTS OTB_MODULE_${otb-module}_OPTIONAL_DEPENDS)
if (${dep}_ENABLED)
list(APPEND ${otb-module-test}_LIBRARIES "${${dep}_LIBRARIES}")
endif()
endforeach()
endmacro()
macro(otb_module_warnings_disable)
......
......@@ -20,7 +20,7 @@
#
# Reset Qt I18N source files cache variable.
macro( reset_qt4_i18n_sources )
macro( reset_qt_i18n_sources )
set( OTB_QT_I18N_INCLUDE_PATH "" CACHE INTERNAL "" FORCE )
set( OTB_QT_I18N_HEADER_FILES "" CACHE INTERNAL "" FORCE )
set( OTB_QT_I18N_SOURCE_FILES "" CACHE INTERNAL "" FORCE )
......@@ -33,7 +33,7 @@ endmacro()
#
# Func
function( add_to_qt4_i18n_files RESULT )
function( add_to_qt_i18n_files RESULT )
foreach( F ${ARGN} )
#message( "${F}" )
......@@ -45,13 +45,13 @@ endfunction()
#
#
macro( add_to_qt4_i18n_include_path DIRECTORY )
macro( add_to_qt_i18n_include_path DIRECTORY )
set(OTB_I18N_INCLUDE_PATH ${OTB_I18N_INCLUDE_PATH} ${DIRECTORY} CACHE INTERNAL "")
endmacro()
#
#
macro( add_to_qt4_i18n_headers INCLUDE_DIR )
macro( add_to_qt_i18n_headers INCLUDE_DIR )
get_filename_component( ABS_INCLUDE_DIR ${INCLUDE_DIR} ABSOLUTE )
......@@ -68,20 +68,20 @@ endmacro()
#
# Add source files to Qt I18n translation build.
macro( add_to_qt4_i18n_sources )
add_to_qt4_i18n_files( OTB_QT_I18N_SOURCE_FILES ${ARGN} )
macro( add_to_qt_i18n_sources )
add_to_qt_i18n_files( OTB_QT_I18N_SOURCE_FILES ${ARGN} )
endmacro()
#
# Add source files to Qt I18n translation build.
macro( add_to_qt4_i18n_forms )
add_to_qt4_i18n_files( OTB_QT_I18N_FORM_FILES ${ARGN} )
macro( add_to_qt_i18n_forms )
add_to_qt_i18n_files( OTB_QT_I18N_FORM_FILES ${ARGN} )
endmacro()
#
#
macro( generate_qt4_project FILENAME )
message( STATUS "Generating Qt4 '${FILENAME}' project file for I18N." )
macro( generate_qt_project FILENAME )
message( STATUS "Generating Qt5 '${FILENAME}' project file for I18N." )
unset(_OTB_QT_I18N_INCLUDE_PATH_PRO)
unset(_OTB_QT_I18N_HEADER_PRO)
......
......@@ -100,9 +100,9 @@ include(PreventInBuildInstalls)
include(OTBModuleMacros)
include(OTBModuleRemote)
include(OTBModuleTest)
include( i18n_qt4 )
include( i18n_qt )
reset_qt4_i18n_sources()
reset_qt_i18n_sources()
repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE)
......@@ -123,7 +123,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
#-----------------------------------------------------------------------------
# OTB version number.
set(OTB_VERSION_MAJOR "6")
set(OTB_VERSION_MINOR "4")
set(OTB_VERSION_MINOR "6")
set(OTB_VERSION_PATCH "0")
set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
......@@ -174,6 +174,10 @@ if(NOT OTB_INSTALL_PACKAGE_DIR)
set(OTB_INSTALL_PACKAGE_DIR "${OTB_INSTALL_LIBRARY_DIR}/cmake/OTB-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
endif()
if(NOT OTB_INSTALL_DESCR_DIR)
set (OTB_INSTALL_DESCR_DIR "share/otb/description")
endif()
#convert path to native for reconfiguring otbcli.bat.in
file(TO_NATIVE_PATH "${OTB_INSTALL_APP_DIR}" OTB_INSTALL_APP_DIR_NATIVE)
......@@ -231,10 +235,6 @@ mark_as_advanced(OTB_USE_DEPRECATED)
option(OTB_USE_OPENMP "Add openmp compiler and linker flags" OFF)
option(OTB_USE_SSE_FLAGS "Enable SIMD optimizations (hardware dependent)." ON)
#-----------------------------------------------------------------------------
# SHOW_ALL_MSG_DEBUG option
option(OTB_SHOW_ALL_MSG_DEBUG "Show all debug messages (very verbose)" OFF)
#mark_as_advanced(OTB_SHOW_ALL_MSG_DEBUG)
include(OTBSetStandardCompilerFlags)
#---------------------------------------------------------------
......@@ -535,7 +535,7 @@ endforeach()
# message("OTB_MODULES_ENABLED = ${modules_list_for_summary}")
# unset(modules_list_for_summary)
list(REMOVE_ITEM option_list "OTB_USE_6S" "OTB_USE_SIFTFAST" "OTB_USE_QT4")
list(REMOVE_ITEM option_list "OTB_USE_6S" "OTB_USE_SIFTFAST" "OTB_USE_QT")
foreach(item ${option_list})
if(NOT ${item})
list(REMOVE_ITEM option_list "${item}" )
......@@ -554,7 +554,7 @@ list(APPEND option_list TINYXML)
#Q: Why these two guys here? we already have option_list
#A: Because cmake case sensitivity with variables.
if(OTB_USE_QT4)
if(OTB_USE_QT)
list(APPEND option_list QT)
endif()
#sort again!
......
# How to contribute to Orfeo ToolBox ?
Thank you for taking the time to contribute to OTB! This document will guide you
through the workflow and best practices you need to know to send your
contribution.
There are many ways to contribute to OTB:
* [Reporting a bug](#reporting-bugs)
* [Making a feature request](#feature-requests-and-discussions)
* [Improving documentation](#documentation-improvements)
* [Contributing code (C++, Python, CMake, etc.)](#code-contribution)
* [Publishing a remote module](#remote-modules)
Our main workflow uses GitLab for source control, issues and task tracking. We
use a self-hosted GitLab instance:
[`https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb`](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb)
Remember to check out also our [developers mailing list](https://groups.google.com/forum/?hl=fr#!forum/otb-developers/join),
where we discuss some features, improvements and high level project planning.
You are welcome to ask questions there as a beginner or future OTB contributor!
## Reporting bugs
If you have found a bug, you can first [search the existing issues](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues?label_name%5B%5D=bug)
to see if it has already been reported.
If it's a new bug, please [open a new issue on GitLab](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues/new).
The 'Bug' issue template will help you provide all important information and
help fixing the bug quicker. Remember to add as much information as possible!
## Feature requests and discussions
Feature requests are welcome! Generally you are welcome to simply [open an issue](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues)
and discuss your idea there. For more complex requests there is an issue
template for in depth description called 'Request for Comments'.
## Documentation improvements
The two main OTB documentations are the [Software Guide](https://www.orfeo-toolbox.org/SoftwareGuide/index.html)
and the [CookBook](https://www.orfeo-toolbox.org/CookBook/). Their sources are
hosted in the main OTB repository in the `Documentation/` directory. Then, to
contribute documentation use the same workflow as for code contributions (see
below).
See also the [Compiling documentation](https://wiki.orfeo-toolbox.org/index.php/Compiling_documentation)
wiki page for help on building the Sphinx and Latex source.
## Code contribution
The OTB workflow is based on GitLab [Merge Requests](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html).
Clone the repository, create a feature branch, commit your changes, push the
feature branch to a fork (or the main repository if you are a core developer),
then send a merge request.
Note that we also accept PRs on our [GitHub mirror](https://github.com/orfeotoolbox/OTB)
which we will manually merge.
Feature branches are tested on multiple platforms on the OTB test infrastructure (a.k.a the [Dashboard](https://dash.orfeo-toolbox.org/)). They appear in the FeatureBranches section.
Caveat: even if the Dashboard build on develop branch is broken, it is not
allowed to push fixes directly on develop. The developer trying to fix the
build should create a merge request and submit it for review. Direct push to
develop without review must be avoided.
### Commit message
On your feature branch, write a good [commit message](https://xkcd.com/1296/):
short and descriptive. If fixing an issue or bug, put the issue number in the
commit message so that GitLab can [cross-link it](https://docs.gitlab.com/ce/user/project/issues/crosslinking_issues.html).
You can prefix your commit message with an indicating flag (DOC, BUG, PKG,
TEST, SuperBuild, etc.).
Standard prefixes for OTB commit messages:
BUG: Fix for runtime crash or incorrect result
COMP: Compiler error or warning fix
DOC: Documentation change
ENH: New functionality
PERF: Performance improvement
STYLE: No logic impact (indentation, comments)
WIP: Work In Progress not ready for merge
For example, here are some good commit messages:
BUG: #1701 Warn users if parameter string is unset
DOC: Fix typo in Monteverdi French translation
COMP: Allow GeoTIFF and TIFF to be disabled when no 3rd party drags them
### Merge request
Your contribution is ready to be added to the main OTB repository? Send a Merge
Request against the `develop` branch on GitLab using the merge request
template. The merge request will then be discussed by the community and the core
OTB team.
* Merge requests can not be merged until all discussions have been resolved (this is enforced by GitLab)
* Merge requests **must receive at least 2 positives votes from core developers** (members of Main Repositories group in Gitlab with at least "Developer" level; this includes PSC members) before being merged
* The merger is responsible for checking that the branch is up-to-date with develop
* Merge requests can be merged by anyone (not just PSC or RM) with push access to develop
* Merge requests can be merged once the dashboard is proven green for this branch.
This condition is mandatory unless reviewers and authors explicitely agree that
it can be skipped (for instance in case of documentation merges or compilation
fixes on develop). Branches of that sort can be identified with the ~patch label,
which tells the reviewer that the author would like to merge without dashboard testing.
Branches can be registered for dashboard testing by adding one line in `Config/feature_branches.txt` in [otb-devutils repository](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-devutils.git).
For branches in the main repository, the syntax is the following:
```
branch_name [otb-data_branch_name]
```
The second branch name is optional. It can be set if you need to modify [otb-data](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data.git) according to your changes.
For branches in forks, the syntax is the following:
```
user/branch_name [user/otb-data_branch_name]
```
Again, the second branch name is optional.
For users without push access to [otb-devutils repository](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-devutils.git), the modification can be asked through a merge requests to this repository.
Once the feature branch is registered for testing, it should appear in the *FeatureBranches* section of the [OTB dashboard](https://dash.orfeo-toolbox.org/index.php?project=OTB) next day (remember tests are run on a nightly basis).
Do not forget to remove the feature branch for testing once it has been merged.
### Contribution license agreement
OTB requires that contributors sign out a [Contributor License
Agreement](https://en.wikipedia.org/wiki/Contributor_License_Agreement). The
purpose of this CLA is to ensure that the project has the necessary ownership or
grants of rights over all contributions to allow them to distribute under the
chosen license (Apache License Version 2.0)
To accept your contribution, we need you to complete, sign and email to *cla [at]
orfeo-toolbox [dot] org* an [Individual Contributor Licensing
Agreement](https://www.orfeo-toolbox.org/cla/icla-en.doc) (ICLA) form and a
[Corporate Contributor Licensing
Agreement](https://www.orfeo-toolbox.org/cla/ccla-en.doc) (CCLA) form if you are
contributing on behalf of your company or another entity which retains copyright
for your contribution.
The copyright owner (or owner's agent) must be mentioned in headers of all
modified source files and also added to the [NOTICE
file](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/raw/develop/NOTICE).
## Remote modules
[Remote Modules](https://wiki.orfeo-toolbox.org/index.php/Remote_Modules) are
the preferred way if you wish to make your apps and filters available to the
community while keeping control and maintenance of their sources. Remote
modules are just like regular modules, except they are not distributed inside
OTB source code. Under some conditions (dependencies, official acceptance
process, etc.), we are also able to distribute your remote module in the
official standalone binaries. See [the wiki](https://wiki.orfeo-toolbox.org/index.php/Remote_Modules)
for more information.
## GitLab guidelines
In order to organize the issues in our GitLab instance, we use both labels and
milestones.
The [milestones](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/milestones) should be used to track in which release a feature is merged.
GitLab can then provide a summary of all features and bugs added to a given release
version.
Regarding labels, we use the following set:
* ~story: significant feature to be implemented with a detailed work plan, it can
correspond to a Request for Comments that has turned into a development action
* ~bug: Bug, crash or unexpected behavior, reported by a user or a developer
* ~feature: Feature request expressed by an OTB user/developer
* ~patch: A small patch fixing build warnings, compilation errors, typos in logs or documentation
* ~"To Do": action is planned
* ~Doing: work in progress
* ~api ~app ~documentation ~monteverdi ~packaging ~qgis: optional context information
......@@ -144,7 +144,7 @@ private:
// Software Guide : BeginLatex
// Application parameters declaration is done using \code{AddParameter()} method.
// \code{AddParameter()} requires the input parameter type
// (ParameterType_InputImage, ParameterType_Int, ParameterType_Float), its name and description.
// (ParameterType\_InputImage, ParameterType\_Int, ParameterType\_Float), its name and description.
// \subdoxygen{otb}{Wrapper}{Application} class contains methods to set parameters characteristics.
// Software Guide : EndLatex
......
......@@ -48,19 +48,19 @@ public:
itkTypeMacro(CurlHelper, CurlHelperInterface);
itkNewMacro(Self);
bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE;
bool TestUrlAvailability(const std::string& url) const override;
bool IsCurlReturnHttpError(const std::string& url) const;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const override;
int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE;
int RetrieveFile(const std::string& urlString, std::string filename) const override;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const override;
int RetrieveFileMulti(const std::vector<std::string>& listURLs,
const std::vector<std::string>& listFiles,
int maxConnect) const ITK_OVERRIDE;
int maxConnect) const override;
itkGetMacro(Timeout,long int);
......@@ -71,7 +71,7 @@ protected:
m_Browser("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) "
"Gecko/20071127 Firefox/2.0.0.11"),
m_Timeout(10) {}
~CurlHelper() ITK_OVERRIDE {}
~CurlHelper() override {}
private:
CurlHelper(const Self &); //purposely not implemented
......
......@@ -66,7 +66,7 @@ public:
protected:
CurlHelperInterface() {}
~CurlHelperInterface() ITK_OVERRIDE {}
~CurlHelperInterface() override {}
private:
CurlHelperInterface(const Self &); //purposely not implemented
......
......@@ -47,20 +47,20 @@ public:
itkNewMacro(Self);
bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE;
bool TestUrlAvailability(const std::string& url) const override;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const override;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const override;
int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE;
int RetrieveFile(const std::string& urlString, std::string filename) const override;
int RetrieveFileMulti(const std::vector<std::string>& listURLs,
const std::vector<std::string>& listFiles,
int maxConnect) const ITK_OVERRIDE;
int maxConnect) const override;
protected:
CurlHelperStub() {}
~CurlHelperStub() ITK_OVERRIDE {}
~CurlHelperStub() override {}
private:
CurlHelperStub(const Self &); //purposely not implemented
......
......@@ -94,7 +94,7 @@ protected:
}
}
~CurlResource() ITK_OVERRIDE
~CurlResource() override
{
curl_easy_cleanup(m_Curl);
}
......@@ -140,7 +140,7 @@ protected:
}
}
~CurlMultiResource() ITK_OVERRIDE
~CurlMultiResource() override
{
curl_multi_cleanup(m_Curl);
}
......@@ -187,7 +187,7 @@ public:
protected:
CurlFileDescriptorResource(){}
~CurlFileDescriptorResource() ITK_OVERRIDE
~CurlFileDescriptorResource() override
{
fclose(m_File);
}
......
......@@ -159,10 +159,10 @@ protected:
GeometriesSet(ogr::Layer layer);
/** Destructor. */
~GeometriesSet() ITK_OVERRIDE;
~GeometriesSet() override;
/** Prints self to stream. */
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
typedef boost::variant<ogr::DataSource::Pointer, ogr::Layer> AnyGeometriesSetType;
AnyGeometriesSetType m_GeometriesSet;
......
......@@ -119,7 +119,7 @@ public:
* initializing them.
* \post <tt>GetOutput() != NULL</tt>
*/
void PrepareOutputs() ITK_OVERRIDE;
void PrepareOutputs() override;
protected:
/** Default constructor.
......@@ -129,7 +129,7 @@ protected:
/** Destructor.
* Does nothing.
*/
~GeometriesSource() ITK_OVERRIDE;
~GeometriesSource() override;
/** Ensures that the output geometries are allocated before processing.
* If the output hasn't been set, at this point, the default output geometries
......
......@@ -91,13 +91,13 @@ protected:
/** Destructor.
* Does nothing.
*/
~GeometriesToGeometriesFilter() ITK_OVERRIDE;
~GeometriesToGeometriesFilter() override;
/** Processes the input to fill the output.
* This is the main processing function. It either works \em in-place or by
* \em copying the transformed input \c Feature s into the output.
*/
void GenerateData(void) ITK_OVERRIDE;
void GenerateData(void) override;
private:
/** \e In-place processing function.
......@@ -364,7 +364,7 @@ protected:
/** Default constructor. */
DefaultGeometriesToGeometriesFilter();
/** Destructor. */
~DefaultGeometriesToGeometriesFilter() ITK_OVERRIDE;
~DefaultGeometriesToGeometriesFilter() override;
/**
* Hook that actually filters an OGR \c Layer.
......@@ -376,7 +376,7 @@ protected:
* \note When <tt>source == destination</tt>, it means this is an \em in-place
* filter.
*/
void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const ITK_OVERRIDE;
void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const override;
/**
* Hook used to define the fields of the new layer.
* \param[in] source source \c Layer -- for reference
......@@ -385,7 +385,7 @@ protected:
* Just forwards the fields definition to the \c FieldTransformationPolicy
* inherited from the \c TransformationFunctorDispatcherType.
*/
void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const ITK_OVERRIDE
void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const override
{
this->DefineFields(source, dest);
}
......
......@@ -46,6 +46,7 @@
#include "otbOGRLayerWrapper.h"
#include "otbOGRVersionProxy.h"
#include "otbOGRExtendedFilenameToOptions.h"
class OGRLayer;
class OGRSpatialReference;
......@@ -88,6 +89,7 @@ public:
typedef itk::SmartPointer<const Self> ConstPointer;
//@}
typedef OGRExtendedFilenameToOptions FileNameHelperType;
/**\name Standard macros */
//@{
/** Default builder.
......@@ -162,7 +164,7 @@ public:
* \note No condition is assumed on the non-nullity of \c source.
* \see \c DataSource(GDALDataset *)
*/
static Pointer New(ogr::version_proxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read);
static Pointer New(ogr::version_proxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read , const std::vector< std::string > & layerOptions = std::vector< std::string >() );
//@}
/**\name Projection Reference property */
......@@ -291,7 +293,7 @@ public:
* meta information of another data source and use the same underlying \c
* GDALDataset.
*/
void Graft(const itk::DataObject *data) ITK_OVERRIDE;
void Graft(const itk::DataObject *data) override;
/**
* Resets current data source with the one in parameter.
......@@ -368,7 +370,7 @@ public:
Layer CopyLayer(
Layer & srcLayer,
std::string const& newName,
char ** papszOptions = ITK_NULLPTR);
std::vector<std::string> const& papszOptions = std::vector<std::string>() );
//@}
/**\name Layers access
......@@ -497,6 +499,10 @@ public:
*/
ogr::version_proxy::GDALDatasetType & ogr();
void SetLayerCreationOptions( const std::vector< std::string > & options );
void AddLayerCreationOptions( std::vector< std::string > options );
const std::vector< std::string > & GetLayerCreationOptions() const ;
protected:
/** Default constructor.
* The actual \c GDALDataset is using the <em>in-memory</em> \c
......@@ -511,16 +517,16 @@ protected:
/** Init constructor.
* \post The newly constructed object owns the \c source parameter.
*/
DataSource(ogr::version_proxy::GDALDatasetType * source, Modes::type mode);
DataSource(ogr::version_proxy::GDALDatasetType * source, Modes::type mode , const std::vector< std::string > & layerOption = std::vector< std::string >() );
/** Destructor.
* \post The \c GDALDataset owned is released (if not null).
*/
~DataSource() ITK_OVERRIDE;
~DataSource() override;
static Pointer OpenDataSource(std::string const& datasourceName, Modes::type mode);
/** Prints self into stream. */
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
/**
......@@ -549,6 +555,7 @@ private:
private:
ogr::version_proxy::GDALDatasetType *m_DataSource;
std::vector< std::string > m_LayerOptions;
Modes::type m_OpenMode;
int m_FirstModifiableLayerID;
}; // end class DataSource
......
/*
* 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 otbOGRExtendedFilenameToOptions_h
#define otbOGRExtendedFilenameToOptions_h
#include <unordered_map>
#include "otbExtendedFilenameHelper.h"
namespace otb
{
/** \class OGRExtendedFilenameToOptions
* \brief This class aim at processing GDAL option that can be pass through
* extended filename.
* \ingroup OTBExtendedFilename
* \ingroup OTBGdalAdapters
*
*/
#include "OTBGdalAdaptersExport.h"
class OTBGdalAdapters_EXPORT OGRExtendedFilenameToOptions : public ExtendedFilenameHelper
{
public:
/** Standard class typedefs. */
typedef OGRExtendedFilenameToOptions Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef ExtendedFilenameHelper Superclass;
typedef Superclass::OptionMapType OptionMapType;
typedef OptionMapType::const_iterator ConstMapIteratorType;
typedef std::vector<std::string> GDALOptionType;
itkTypeMacro(OGRExtendedFilenameToOptions, otb::ExtendedFilenameHelper);
itkNewMacro(Self);
/** The creation option structure. */
struct OpenOptionType
{
GDALOptionType gdalOptions;
// std::unordered_map< std::string , bool > availableOptions;
};
struct CreationOptionType
{
GDALOptionType gdalOptions;
// std::unordered_map< std::string , bool > availableOptions;
};
struct LayerOptionType
{
std::unordered_map< std::string , std::string > gdalOptions;
};
/** Set extended filename */
void SetExtendedFileName(const char * extFname) override;
/** Get the GDAL option for type operation */
GDALOptionType GetGDALOptions( const std::string & type ) const ;
/** Get the deffierent GDAL options*/
GDALOptionType GetGDALOpenOptions() const ;
GDALOptionType GetGDALCreationOptions() const ;
GDALOptionType GetGDALLayerOptions() const ;
bool SimpleFileNameIsSet() const;
bool HasGDALLayerOption() const;
/** Set GDAL layer option through a vector of string */
void SetGDALLayerOptions( const GDALOptionType & options );
/** Add GDAL layer option to existing one */
void AddGDALLayerOptions( const GDALOptionType & options );
/** Constructor that return a pointer to an OGRExtendedFilename with
* GDAL layer option as options
*/
static Pointer GetGDALLayerOptionsHelper( const GDALOptionType & options );
protected:
OGRExtendedFilenameToOptions();
OGRExtendedFilenameToOptions( const GDALOptionType & options );
~OGRExtendedFilenameToOptions() override {};
private:
OGRExtendedFilenameToOptions(const Self &) = delete ;
void operator =(const Self&) = delete ;
OpenOptionType m_OpenOptions;
CreationOptionType m_CreationOptions;
LayerOptionType m_LayerOptions;
bool m_HasFileName;
};
} //end namespace otb
#endif // otbOGRExtendedFilenameToOptions_h