diff --git a/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.cxx b/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.cxx index 194e061846c567bb3ffae8a9bb02a1ae800cb97f..499311950fd9af56cbb2863fc6a86d03ce6ede42 100644 --- a/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.cxx +++ b/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.cxx @@ -66,8 +66,38 @@ InputVectorDataParameter::SetFromFileName(const std::string& filename) VectorDataType* -InputVectorDataParameter::GetVectorData() const +InputVectorDataParameter::GetVectorData() { + // 2 cases : the user sets a filename vs. the user sets a vector data + //////////////////////// Filename case: + if (!m_FileName.empty()) + { + //typedef otb::ImageFileReader<TOutputImage> ReaderType; + //typename ReaderType::Pointer reader = ReaderType::New(); + m_Reader = VectorDataFileReaderType::New(); + m_Reader->SetFileName(m_FileName); + try + { + // Update the viewer here to load the file => no streaming for VectorData + m_Reader->Update(); + } + catch (itk::ExceptionObject & err) + { + this->ClearValue(); + } + + m_VectorData = m_Reader->GetOutput(); + } + //////////////////////// VectorData case: + else + { + if (m_VectorData.IsNull()) + { + // Else : error + itkExceptionMacro("No input vector data or filename detected..."); + } + } + return m_VectorData; } diff --git a/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h b/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h index 2db731ac6c5210563b4ff973519edc40dbbceaf5..e6df4fc684d837d023b1c6bb9745130e5ceabb6e 100644 --- a/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h +++ b/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h @@ -52,7 +52,7 @@ public: bool SetFromFileName(const std::string& filename); itkGetConstMacro(FileName, std::string); - VectorDataType* GetVectorData() const; + VectorDataType* GetVectorData(); void SetVectorData(VectorDataType* vectorData); diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx index 6fe0f86f9342b5dbc4bbc52ceb8149491f2da69d..4fa51bbfcc2453c56b2306ce15138d4130d64741 100644 --- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx +++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx @@ -38,6 +38,7 @@ #include "otbWrapperQtWidgetDirectoryParameter.h" #include "otbWrapperQtWidgetParameterGroup.h" #include "otbWrapperQtWidgetInputVectorDataListParameter.h" +#include "otbWrapperQtWidgetInputVectorDataParameter.h" #include "otbWrapperQtWidgetRAMParameter.h" namespace otb @@ -101,6 +102,7 @@ QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model CREATEWIDGET(ComplexOutputImageParameter, QtWidgetComplexOutputImageParameter) CREATEWIDGET(InputImageListParameter, QtWidgetInputImageListParameter) CREATEWIDGET(InputVectorDataListParameter, QtWidgetInputVectorDataListParameter) + CREATEWIDGET(InputVectorDataParameter, QtWidgetInputVectorDataParameter) CREATEWIDGET(OutputImageParameter, QtWidgetOutputImageParameter) CREATEWIDGET(OutputVectorDataParameter, QtWidgetOutputVectorDataParameter) CREATEWIDGET(EmptyParameter, QtWidgetEmptyParameter)