Commit 00a0c273 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

ENH: allow configurable field type

parent d9ba6122
......@@ -128,6 +128,12 @@ public:
/** Get the OGR layer creation options */
const std::vector<std::string> & GetOGRLayerCreationOptions(void);
/** Set the field type for class label */
itkSetMacro(FieldType,OGRFieldType);
/** Get the field type for class label */
itkGetMacro(FieldType,OGRFieldType);
protected:
PersistentImageToOGRDataFilter();
virtual ~PersistentImageToOGRDataFilter();
......@@ -148,6 +154,7 @@ private:
OGRwkbGeometryType m_GeometryType;
SizeType m_StreamSize;
std::vector<std::string> m_OGRLayerCreationOptions;
OGRFieldType m_FieldType;
}; // end of class
} // end namespace otb
......
......@@ -33,7 +33,11 @@ namespace otb
template<class TImage>
PersistentImageToOGRDataFilter<TImage>
::PersistentImageToOGRDataFilter() : m_FieldName("DN"), m_LayerName("Layer"), m_GeometryType(wkbMultiPolygon)
::PersistentImageToOGRDataFilter()
: m_FieldName("DN")
, m_LayerName("Layer")
, m_GeometryType(wkbMultiPolygon)
, m_FieldType(OFTInteger)
{
this->SetNumberOfRequiredInputs(2);
this->SetNumberOfRequiredInputs(2);
......@@ -137,7 +141,7 @@ PersistentImageToOGRDataFilter<TImage>
OGRDataSourcePointerType ogrDS = this->GetOGRDataSource();
ogrDS->CreateLayer(m_LayerName, oSRS ,m_GeometryType, m_OGRLayerCreationOptions);
OGRFieldDefn field(m_FieldName.c_str(),OFTInteger);
OGRFieldDefn field(m_FieldName.c_str(),m_FieldType);
//Handle the case of shapefile. A shapefile is a layer and not a datasource.
//The layer name in a shapefile is the shapefile's name.
......
Supports Markdown
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