Commit b36ef1e8 authored by Antoine Regimbeau's avatar Antoine Regimbeau

ENH: add manipulation layer in datasource

parent fdd50297
......@@ -499,6 +499,10 @@ public:
*/
ogr::version_proxy::GDALDatasetType & ogr();
void SetLayerCreationOptions( std::vector< std::string > options );
void AddLayerCreationOptions( std::vector< std::string > options );
std::vector< std::string > GetLayerCreationOptions();
protected:
/** Default constructor.
* The actual \c GDALDataset is using the <em>in-memory</em> \c
......
......@@ -567,7 +567,33 @@ otb::ogr::Layer otb::ogr::DataSource::ExecuteSQL(
return otb::ogr::Layer(layer_ptr, *m_DataSource, modifiable);
}
void
otb::ogr::DataSource::
SetLayerCreationOptions( std::vector< std::string > options )
{
FileNameHelperType::Pointer helper = FileNameHelperType::New();
helper->SetGDALLayerOptions( options );
m_LayerOptions = helper->GetGDALLayerOptions();
// perf : do we move code from helper->SetGDALLayerOptions in here?
}
void
otb::ogr::DataSource::
AddLayerCreationOptions( std::vector< std::string > options )
{
FileNameHelperType::Pointer helper = FileNameHelperType::New();
helper->SetGDALLayerOptions( m_LayerOptions );
helper->AddGDALLayerOptions( options );
m_LayerOptions = helper->GetGDALLayerOptions();
// perf : do we move code from helper->AddGDALLayerOptions in here?
}
std::vector< std::string >
otb::ogr::DataSource::
GetLayerCreationOptions()
{
return m_LayerOptions;
}
/*===========================================================================*/
/*===============================[ features ]================================*/
/*===========================================================================*/
......
......@@ -117,6 +117,8 @@ SetGDALLayerOptions( const OGRExtendedFilenameToOptions::GDALOptionType & option
for ( const auto & option : options )
{
boost::split(tmp, option , boost::is_any_of(":"), boost::token_compress_on);
if ( tmp.size()<2 )
boost::split(tmp, option , boost::is_any_of("="), boost::token_compress_on);
m_LayerOptions.gdalOptions[ tmp[0] ] = tmp[1] ;
}
}
......@@ -129,6 +131,8 @@ AddGDALLayerOptions( const OGRExtendedFilenameToOptions::GDALOptionType & option
for ( const auto & option : options )
{
boost::split(tmp, option , boost::is_any_of(":"), boost::token_compress_on);
if ( tmp.size()<2 )
boost::split(tmp, option , boost::is_any_of("="), boost::token_compress_on);
m_LayerOptions.gdalOptions[ tmp[0] ] = tmp[1] ;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment