31 #include <vtkAssembly.h>
32 #include <vtkProp3DCollection.h>
33 #include <vtkTubeFilter.h>
35 #include <vtkConeSource.h>
36 #include <vtkCubeSource.h>
37 #include <vtkCylinderSource.h>
38 #include <vtkPolyDataMapper.h>
39 #include <vtkProperty.h>
40 #include <vtkSphereSource.h>
41 #include <vtkTransformPolyDataFilter.h>
43 #include <vtkPolyDataAlgorithm.h>
61 return m_PropAssembly;
67 m_ContourSource->Delete();
68 m_PropAssembly->Delete();
89 int timestep = this->GetTimestep();
95 assert(points->Size() == pointData->Size());
101 for (ActorMap::iterator it = m_PointActors.begin(); it != m_PointActors.end();)
104 if (!points->IndexExists(
id))
106 this->RemoveEntryFromSourceMaps(
id);
107 m_PropAssembly->GetParts()->RemoveItem(it->second.first);
108 if (it->second.first != NULL)
109 it->second.first->Delete();
110 ActorMap::iterator er = it;
120 for (pIt = points->Begin(), pdIt = pointData->Begin(); pIt != itkPointSet->GetPoints()->End(); ++pIt, ++pdIt)
123 assert(pointID == pdIt->Index());
127 ActorMap::iterator aIt = m_PointActors.find(pointID);
131 bool newPoint = (aIt == m_PointActors.end());
132 bool specChanged = (!newPoint && data.pointSpec != aIt->second.second);
140 aIt = m_PointActors.insert(std::make_pair(pointID, std::make_pair(a, data.pointSpec)))
142 m_PropAssembly->AddPart(a);
146 a = aIt->second.first;
149 this->RemoveEntryFromSourceMaps(pointID);
152 if (newPoint || specChanged)
154 vtkPolyDataAlgorithm *source = NULL;
155 switch (data.pointSpec)
159 source = m_CubeSources[pointID];
163 source = m_ConeSources[pointID];
167 source = m_CylinderSources[pointID];
173 source = m_SphereSources[pointID];
176 vtkPolyDataMapper *m =
dynamic_cast<vtkPolyDataMapper *
>(a->GetMapper());
178 m->SetInputConnection(source->GetOutputPort());
179 aIt->second.second = data.pointSpec;
187 this->UpdateVtkObjects();
192 int timestep = this->GetTimestep();
196 assert(points->Size() == pointData->Size());
202 for (pIt = points->Begin(), pdIt = pointData->Begin(); pIt != itkPointSet->GetPoints()->End();
206 assert(pointID == pdIt->Index());
210 ActorMap::iterator aIt = m_PointActors.find(pointID);
211 assert(aIt != m_PointActors.end());
213 vtkActor *a = aIt->second.first;
216 SetVtkMapperImmediateModeRendering(a->GetMapper());
220 bool pointVisibility =
true;
221 bool visValueFound =
false;
224 if (visLTProp != NULL)
232 visValueFound =
true;
239 if (visValueFound ==
false)
241 pointVisibility = n->
IsVisible(renderer,
"show points");
243 a->SetVisibility(pointVisibility);
247 bool opValueFound =
false;
250 if (opLTProp != NULL)
265 if (opValueFound ==
false)
269 a->GetProperty()->SetOpacity(opacity);
273 float pointSize = 1.0;
275 switch (data.pointSpec)
278 m_CubeSources[pointID]->SetXLength(pointSize);
279 m_CubeSources[pointID]->SetYLength(pointSize);
280 m_CubeSources[pointID]->SetZLength(pointSize);
284 m_ConeSources[pointID]->SetRadius(pointSize / 2);
285 m_ConeSources[pointID]->SetHeight(pointSize);
286 m_ConeSources[pointID]->SetResolution(2);
290 m_CylinderSources[pointID]->SetRadius(pointSize / 2);
291 m_CylinderSources[pointID]->SetHeight(pointSize);
292 m_CylinderSources[pointID]->CappingOn();
293 m_CylinderSources[pointID]->SetResolution(6);
299 m_SphereSources[pointID]->SetRadius(pointSize / 2);
300 m_SphereSources[pointID]->SetThetaResolution(10);
301 m_SphereSources[pointID]->SetPhiResolution(10);
308 aIt->second.first->SetPosition(pos[0], pos[1], pos[2]);
314 if (!n->
GetColor(color, renderer,
"selectedcolor"))
324 vtkLookupTable *d = c->GetVtkLookupTable();
325 double *e = d->GetTableValue(pointID);
332 if (!n->
GetColor(color, renderer,
"unselectedcolor"))
338 a->GetProperty()->SetColor(color[0], color[1], color[2]);
354 BaseLocalStorage *ls = m_LSH.GetLocalStorage(renderer);
355 bool needGenerateData = ls->IsGenerateDataRequired(renderer,
this, GetDataNode());
357 if (needGenerateData)
359 ls->UpdateGenerateDataTime();
360 this->UpdateVtkObjects();
363 ApplyColorAndOpacityProperties(renderer, NULL);
396 Superclass::SetDefaultProperties(node, renderer, overwrite);
407 ActorMap::iterator aIt = m_PointActors.find(pointID);
408 if (aIt == m_PointActors.end())
411 switch (aIt->second.second)
414 m_CubeSources[pointID]->Delete();
415 m_CubeSources.erase(pointID);
419 m_ConeSources[pointID]->Delete();
420 m_ConeSources.erase(pointID);
424 m_CylinderSources[pointID]->Delete();
425 m_CylinderSources.erase(pointID);
431 m_SphereSources[pointID]->Delete();
432 m_SphereSources.erase(pointID);
DataType::PointsContainerIterator PointsIterator
DataType::PointDataContainer PointDataContainer
Organizes the rendering process.
struct for data of a point
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
EnhancedPointSetVtkMapper3D()
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
ValueType GetTableValue(IdentifierType id) const
virtual vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Generate the data needed for rendering into renderer.
DataType::PointIdentifier PointIdentifier
bool IsVisible(const mitk::BaseRenderer *renderer, const char *propertyKey="visible", bool defaultIsOn=true) const
Convenience access method for visibility properties (instances of BoolProperty). Return value is the ...
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=NULL, bool overwrite=false)
Abstract base class for properties.
void AddProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
Add the property (instance of BaseProperty) if it does not exist (or always ifoverwrite istrue) with ...
bool GetOpacity(float &opacity, const mitk::BaseRenderer *renderer, const char *propertyKey="opacity") const
Convenience access method for opacity properties (instances of FloatProperty)
The LookupTableProperty class Property to associate mitk::LookupTable to an mitk::DataNode.
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual DataType::Pointer GetPointSet(int t=0) const
returns the pointset
mitk::PointSet::PointIdentifier PointIdentifier
void RemoveEntryFromSourceMaps(mitk::PointSet::PointIdentifier pointID)
bool GetFloatProperty(const char *propertyKey, float &floatValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for float properties (instances of FloatProperty)
virtual LookupTable * GetLookupTable()
virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor *actor) override
Apply color and opacity properties read from the PropertyList. Called by mapper subclasses.
DataType::PointsContainer PointsContainer
virtual const mitk::PointSet * GetInput()
specializations of GenericLookupTable
DataType::PointDataContainerIterator PointDataIterator
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
Class for nodes of the DataTree.
void DeleteVtkObject(vtkObject *o)
virtual ~EnhancedPointSetVtkMapper3D()
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override
Set the vtkTransform of the m_Prop3D for the current time step of renderer.
virtual T GetValue() const
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.