23 #include <sofa/helper/system/gl.h>
24 #include <vtkObjectFactory.h>
25 #include <vtkRenderer.h>
26 #include <vtkRenderWindow.h>
33 mitk::vtkSimulationPolyDataMapper2D::vtkSimulationPolyDataMapper2D()
38 mitk::vtkSimulationPolyDataMapper2D::~vtkSimulationPolyDataMapper2D()
47 vtkRenderWindow* renderWindow = renderer->GetRenderWindow();
49 if (renderWindow->CheckAbortStatus() == 1)
52 if (renderWindow->SupportsOpenGL() == 0)
55 if (m_Simulation.IsNull())
58 if (!renderWindow->IsCurrent())
59 renderWindow->MakeCurrent();
63 if (mitkRenderer == NULL)
68 if (sliceNavigationController == NULL)
73 if (planeGeometry == NULL)
76 renderer->GetRenderWindow()->MakeCurrent();
78 m_SimulationService->SetActiveSimulation(m_Simulation);
81 m_Simulation->GetRootNode()->executeVisitor(&planeIntersectionVisitor);
83 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
84 glEnable(GL_COLOR_MATERIAL);
86 const std::vector<Intersection>& intersections = planeIntersectionVisitor.GetIntersections();
87 std::vector<Intersection>::const_iterator intersectionsEnd = intersections.end();
89 for (std::vector<Intersection>::const_iterator intersectionIt = intersections.begin(); intersectionIt != intersectionsEnd; ++intersectionIt)
91 const std::vector<Edge>& edges = intersectionIt->edges;
92 std::vector<Edge>::const_iterator edgesEnd = edges.end();
94 glColor4fv(intersectionIt->color);
97 for (std::vector<Edge>::const_iterator edgeIt = edges.begin(); edgeIt != edgesEnd; ++edgeIt)
99 glVertex3dv(edgeIt->v0.GetDataPointer());
100 glVertex3dv(edgeIt->v1.GetDataPointer());
106 glDisable(GL_COLOR_MATERIAL);
115 m_Simulation = simulation;
120 if (m_Simulation.IsNull())
121 return Superclass::GetBounds();
123 sofa::simulation::Node::SPtr rootNode = m_Simulation->GetRootNode();
125 const sofa::defaulttype::Vector3&
min = bbox.minBBox();
126 const sofa::defaulttype::Vector3&
max = bbox.maxBBox();
const Point3D GetOrigin() const
Get the origin, e.g. the upper-left corner of the plane.
double * GetBounds() override
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
Controls the selection of the slice the associated BaseRenderer will display.
Vector3D GetNormal() const
Normal of the plane.
void RenderPiece(vtkRenderer *, vtkActor *) override
const mitk::PlaneGeometry * GetCurrentPlaneGeometry()
Returns the currently selected Plane in the current BaseGeometry (if existent).
MITKSIMULATION_EXPORT ISimulationService * GetSimulationService(us::ModuleContext *moduleContext=us::GetModuleContext())
vtkStandardNewMacro(AnatomicalStructureColorPresets)
void SetSimulation(mitk::Simulation::Pointer simulation)
itk::BoundingBox< unsigned long, 3, mitk::ScalarType > BoundingBox
virtual SliceNavigationController * GetSliceNavigationController()
Describes a two-dimensional, rectangular plane.
void Render(vtkRenderer *renderer, vtkActor *actor) override