7 #include "Tuto14MeshGenerator/SMeshModifier.hpp" 9 #include <fwCom/Signal.hxx> 11 #include <fwData/Mesh.hpp> 13 #include <fwDataTools/Mesh.hpp> 15 #include <fwGui/dialog/MessageDialog.hpp> 17 #include <fwServices/macros.hpp> 42 std::vector < ConfigurationType > vectConfig =
m_configuration->find(
"config");
44 SLM_ASSERT(
"There must be one (and only one) <config functor=... /> element.", vectConfig.size() == 1 );
45 ::fwRuntime::ConfigurationElement::sptr configElement = vectConfig.at(0);
47 SLM_ASSERT(
"There must be a functor attribute in the <config> xml element.",
48 configElement->hasAttribute(
"functor") );
49 m_functor = configElement->getExistingAttributeValue(
"functor");
50 OSLM_ASSERT(
"Wrong functor name "<<m_functor <<
" (required GenTriangle, GenQuad or GenTriangleQuad)",
51 m_functor ==
"ShakeMeshPoint" 52 || m_functor ==
"ColorizeMeshPoints" 53 || m_functor ==
"ColorizeMeshCells" 54 || m_functor ==
"ComputePointNormals" 55 || m_functor ==
"ComputeCellNormals" 56 || m_functor ==
"ShakePointNormals" 57 || m_functor ==
"ShakeCellNormals" 58 || m_functor ==
"MeshDeformation" 85 ::fwData::Mesh::sptr mesh = this->getInOut< ::fwData::Mesh >(
"mesh");
89 if(m_functor ==
"ShakeMeshPoint")
93 ::fwData::Mesh::VertexModifiedSignalType::sptr sig;
97 else if(m_functor ==
"ColorizeMeshCells")
101 ::fwData::Mesh::CellColorsModifiedSignalType::sptr sig;
106 else if(m_functor ==
"ColorizeMeshPoints")
110 ::fwData::Mesh::PointColorsModifiedSignalType::sptr sig;
115 else if(m_functor ==
"ComputeCellNormals")
119 ::fwData::Mesh::CellNormalsModifiedSignalType::sptr sig;
124 else if(m_functor ==
"ComputePointNormals")
128 ::fwData::Mesh::PointNormalsModifiedSignalType::sptr sig;
133 else if(m_functor ==
"ShakeCellNormals")
137 ::fwData::Mesh::CellNormalsModifiedSignalType::sptr sig;
142 else if(m_functor ==
"ShakePointNormals")
146 ::fwData::Mesh::PointNormalsModifiedSignalType::sptr sig;
151 else if(m_functor ==
"MeshDeformation")
154 ::fwData::Object::ModifiedSignalType::sptr sig;
162 catch (
const std::exception& e)
164 std::stringstream ss;
165 ss <<
"Warning during generating : " << e.what();
170 ::fwGui::dialog::IMessageDialog::WARNING);
178 _sstream <<
"MeshGenerator Action" << std::endl;
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
virtual TUTO14MESHGENERATOR_API void configuring() override
Configure the service before starting. Apply the configuration to service.
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
Class allowing to block a Connection.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_NORMALS_MODIFIED_SIG
Key in m_signals map of signal m_sigPointNormalsModified.
static FWGUI_API IMessageDialog::Buttons showMessageDialog(const std::string &title, const std::string &message,::fwGui::dialog::IMessageDialog::Icons icon=INFO)
virtual TUTO14MESHGENERATOR_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_COLORS_MODIFIED_SIG
Key in m_signals map of signal m_sigCellColorsModified.
Defines the service interface managing the menu items.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CELL_NORMALS_MODIFIED_SIG
Key in m_signals map of signal m_sigCellNormalsModified.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
TUTO14MESHGENERATOR_API SMeshModifier() noexcept
Constructor. Do nothing.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWGUI_API void initialize()
Initialize the action.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
virtual TUTO14MESHGENERATOR_API void info(std::ostream &_sstream) override
This method gives information about the class.
virtual TUTO14MESHGENERATOR_API void updating() override
Process the action: modifies the mesh using the selected functor.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_VERTEX_MODIFIED_SIG
Key in m_signals map of signal m_sigVertexModified.
virtual TUTO14MESHGENERATOR_API void starting() override
Initialize the service activity.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
virtual TUTO14MESHGENERATOR_API ~SMeshModifier() noexcept
Destructor. Do nothing.
This action modifies a mesh using specified functor in configuration. The purpose is to test all poss...
Data holding a geometric structure composed of points, lines, triangles, quads or polygons...
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINT_COLORS_MODIFIED_SIG
Key in m_signals map of signal m_sigPointColorsModified.