25 #include <vtkCamera.h>
26 #include <vtkInteractorStyle.h>
27 #include <vtkPointData.h>
28 #include <vtkPolyData.h>
29 #include <vtkRenderWindowInteractor.h>
33 m_SecondLastPickedTube(
TubeGraph::ErrorId),
34 m_ActivationMode(None),
35 m_ActionMode(AttributationMode)
56 if (GetDataNode() !=
nullptr)
58 if (GetDataNode()->
GetData() != NULL)
60 m_TubeGraph =
dynamic_cast<TubeGraph *
>(GetDataNode()->GetData());
62 m_TubeGraph->GetProperty(
"Tube Graph.Visualization Information").GetPointer());
63 if (m_TubeGraphProperty.IsNull())
64 MITK_ERROR <<
"Something went wrong! No tube graph property!";
76 if (positionEvent == NULL)
86 m_SecondLastPickedTube = m_LastPickedTube;
87 m_LastPickedTube = tubeDescriptor;
96 if (m_TubeGraph.IsNull())
99 this->SelectTubesByActivationModus();
103 if (m_ActivationMode != None)
106 std::stringstream displayText;
107 displayText <<
"Picked tube: ID [" << m_LastPickedTube.first <<
"," << m_LastPickedTube.second <<
"]";
115 if (m_TubeGraph.IsNull())
118 if ((m_ActivationMode != Multiple) && (m_ActivationMode != Points))
120 m_TubeGraphProperty->DeactivateAllTubes();
130 m_ActivationMode = activationMode;
131 if (m_TubeGraph.IsNotNull())
133 this->UpdateActivation();
138 return m_ActivationMode;
143 m_ActionMode = actionMode;
155 this->UpdateActivation();
161 if (m_ActionMode == RootMode)
163 m_TubeGraphProperty->DeactivateAllTubes();
164 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
true);
172 m_TubeGraph->SetRootTube(m_LastPickedTube);
174 m_TubeGraphProperty->DeactivateAllTubes();
179 switch (m_ActivationMode)
183 m_TubeGraphProperty->DeactivateAllTubes();
189 m_TubeGraphProperty->DeactivateAllTubes();
190 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
true);
197 if (m_TubeGraphProperty->IsTubeActive(m_LastPickedTube))
198 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
false);
200 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
true);
206 m_TubeGraphProperty->DeactivateAllTubes();
207 std::vector<TubeGraph::TubeDescriptorType> activeTubes = this->GetTubesToRoot();
208 m_TubeGraphProperty->SetTubesActive(activeTubes);
213 m_TubeGraphProperty->DeactivateAllTubes();
214 std::vector<TubeGraph::TubeDescriptorType> activeTubes = this->GetPathToPeriphery();
215 m_TubeGraphProperty->SetTubesActive(activeTubes);
221 m_TubeGraphProperty->DeactivateAllTubes();
222 std::vector<TubeGraph::TubeDescriptorType> activeTubes = this->GetTubesBetweenPoints();
223 m_TubeGraphProperty->SetTubesActive(activeTubes);
228 MITK_WARN <<
"Unknown tube graph interaction mode!";
234 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetTubesToRoot()
239 root = m_TubeGraph->GetThickestTube();
240 m_TubeGraph->SetRootTube(root);
243 return this->GetPathBetweenTubes(m_LastPickedTube, root);
246 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetTubesBetweenPoints()
248 return this->GetPathBetweenTubes(m_LastPickedTube, m_SecondLastPickedTube);
251 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetPathBetweenTubes(
254 std::vector<mitk::TubeGraph::TubeDescriptorType> solutionPath;
258 solutionPath = m_TubeGraph->SearchAllPathBetweenVertices(start, end);
260 solutionPath.push_back(start);
266 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetPathToPeriphery()
268 std::vector<mitk::TubeGraph::TubeDescriptorType> solutionPath;
271 solutionPath = m_TubeGraph->SearchPathToPeriphery(m_LastPickedTube);
void SetTubeGraph(const TubeGraph *tubeGraph)
ActivationMode GetActivationMode()
Super class for all position events.
BaseRenderer * GetSender() const
static const TubeDescriptorType ErrorId
virtual void SelectTube(StateMachineAction *, InteractionEvent *)
virtual void DeselectTube(StateMachineAction *, InteractionEvent *)
Point3D GetPositionInWorld() const
Base Class for Tube Graphs.
Constants for most interaction classes, due to the generic StateMachines.
std::pair< mitk::TubeGraph::TubeDescriptorType, mitk::TubeElement * > GetPickedTube(const Point3D pickedPosition)
void SetActionMode(const ActionMode &actionMode)
T::Pointer GetData(const std::string &name)
virtual ~TubeGraphDataInteractor()
virtual mitk::RenderingManager * GetRenderingManager() const
Setter for the RenderingManager that handles this instance of BaseRenderer.
std::pair< VertexDescriptorType, VertexDescriptorType > TubeDescriptorType
Property for tube graphs.
static RenderingManager * GetInstance()
void DisplayText(const char *t)
Send a string to the applications StatusBar.
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
virtual void DataNodeChanged() override
static StatusBar * GetInstance()
static method to get the GUI dependent StatusBar-instance so the methods DisplayText, etc. can be called No reference counting, cause of decentral static use!
ActionMode GetActionMode()
#define CONNECT_CONDITION(a, f)
void SelectTubesByActivationModus()
TubeGraphDataInteractor()
virtual bool CheckOverTube(const InteractionEvent *)
#define CONNECT_FUNCTION(a, f)
void SetActivationMode(const ActivationMode &activationMode)
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
virtual void ConnectActionsAndFunctions() override