7 #include "ioData/STrianMeshReader.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 11 #include <fwCom/Signals.hpp> 13 #include <fwData/location/Folder.hpp> 14 #include <fwData/location/SingleFile.hpp> 15 #include <fwData/Mesh.hpp> 17 #include <fwDataIO/reader/MeshReader.hpp> 19 #include <fwGui/dialog/LocationDialog.hpp> 20 #include <fwGui/dialog/MessageDialog.hpp> 22 #include <fwIO/IReader.hpp> 24 #include <fwServices/macros.hpp> 26 #include <boost/filesystem/operations.hpp> 41 _sstream << std::endl <<
"Trian file reader";
48 std::vector< std::string > extensions;
49 extensions.push_back(
".trian");
72 static ::boost::filesystem::path _sDefaultPath;
77 dialogFile.
addFilter(
"Trian file",
"*.trian");
78 dialogFile.
setOption(::fwGui::dialog::ILocationDialog::READ);
80 ::fwData::location::SingleFile::sptr result;
81 result = ::fwData::location::SingleFile::dynamicCast( dialogFile.
show() );
84 _sDefaultPath = result->getPath().parent_path();
86 this->
setFile(result->getPath());
102 ::fwData::Mesh::sptr mesh = this->getInOut< ::fwData::Mesh >(::fwIO::s_DATA_KEY);
105 ::fwDataIO::reader::MeshReader::sptr reader = ::fwDataIO::reader::MeshReader::New();
106 reader->setObject( mesh );
107 reader->setFile(this->
getFile());
114 ::fwData::Object::ModifiedSignalType::sptr sig;
121 catch (
const std::exception& e)
123 std::stringstream ss;
124 ss <<
"Warning during loading : " << e.what();
129 ::fwGui::dialog::IMessageDialog::WARNING);
135 "Warning during loading.",
136 ::fwGui::dialog::IMessageDialog::WARNING);
std::string m_windowTitle
Title of the window that will open when the configureWithIHM slot is called.
Class allowing to block a Connection.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
IODATA_API void configureWithIHM() override
Configure the mesh path.
FWIO_API bool hasLocationDefined() const
Returns if a location has been defined ( by the configuration process or directly by user ) ...
virtual FWIO_API void configuring() override
This method proposes to parse xml configuration to retrieve file/files/folder paths.
static FWGUI_API IMessageDialog::Buttons showMessageDialog(const std::string &title, const std::string &message,::fwGui::dialog::IMessageDialog::Icons icon=INFO)
virtual IODATA_API std::vector< std::string > getSupportedExtensions() override
returns (filename) extension
virtual FWGUI_API void setDefaultLocation(::fwData::location::ILocation::sptr loc) override
Set the initial location for the dialog.
FWGUI_API::fwGui::dialog::ILocationDialog & setOption(::fwGui::dialog::ILocationDialog::Options option) override
allow to set option to the file dialog mode=READ/WRITE, check=FILE_MUST_EXIST
FWGUI_API::fwData::location::ILocation::sptr show() override
Display the dialog.
FWGUI_API void addFilter(const std::string &filterName, const std::string &wildcardList) override
specify some filtering when browsing files:
FWIO_APIconst::boost::filesystem::path & getFile() const
Returns the file path set by the user or set during service configuration.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
IODATA_API void updating() override
Updating method. This method is called by update() from base service ( fwServices::IService ) ...
FWIO_API void setFile(const ::boost::filesystem::path &file)
Sets file path.
Reader service API. It manages extension points definition and extension configuration.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual IODATA_API void configuring() override
Configuring method : calls implementation from io::IReader
virtual IODATA_API::fwIO::IOPathType getIOPathType() const override
Return path type managed by the service, here FILE.
IOPathType
IOPathType defines different type of paths used by service readers/writers.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
FWGUI_API void setTitle(const std::string &title) override
Set the title for the dialog.
Defines the generic file/folder selector dialog for IHM.
virtual IODATA_API void info(std::ostream &_sstream) override
Info method.
The namespace ioData contains reader and writer services for basic fwData::Object which doesn't need ...
Data holding a geometric structure composed of points, lines, triangles, quads or polygons...
FWIO_API void clearLocations()
Clear any location set by the setFile/setFiles/setFolder setter.
FWGUI_API void saveDefaultLocation(::fwData::location::ILocation::sptr loc) override
Save the specified default location for the dialog in preferences (if available)
virtual FWSERVICES_API void info(std::ostream &_sstream)
Write information in a stream.