41 #ifndef vtkSlicerMarkupsRepresentation_h 42 #define vtkSlicerMarkupsRepresentation_h 44 #include "vtkSlicerMarkupsModuleVTKWidgetsExport.h" 50 #include "vtkActor2D.h" 51 #include "vtkAppendPolyData.h" 52 #include "vtkArcSource.h" 53 #include "vtkArrowSource.h" 54 #include "vtkGlyph3D.h" 55 #include "vtkLookupTable.h" 57 #include "vtkPointPlacer.h" 58 #include "vtkPointSetToLabelHierarchy.h" 59 #include "vtkPolyDataMapper2D.h" 60 #include "vtkProperty2D.h" 61 #include "vtkSmartPointer.h" 62 #include "vtkSphereSource.h" 63 #include "vtkTextActor.h" 64 #include "vtkTextProperty.h" 65 #include "vtkTensorGlyph.h" 66 #include "vtkTransform.h" 67 #include "vtkTransformPolyDataFilter.h" 68 #include "vtkTubeFilter.h" 82 NumberOfControlPointTypes
87 void PrintSelf(ostream& os, vtkIndent indent)
override;
93 void GetActors(vtkPropCollection*)
override;
101 virtual int GetNumberOfControlPoints();
106 virtual int GetNthControlPointDisplayPosition(
int n,
double pos[2]);
117 virtual void UpdateCenterOfRotation();
120 virtual bool GetTransformationReferencePoint(
double referencePointWorld[3]);
126 int &foundComponentType,
int &foundComponentIndex,
double &closestDistance2);
128 virtual int FindClosestPointOnWidget(
const int displayPos[2],
double worldPos[3],
int *idx);
130 virtual vtkPointPlacer* GetPointPlacer();
134 virtual vtkPolyData* GetControlPointsPolyData(
int controlPointType);
137 virtual vtkPolyData* GetLabelControlPointsPolyData(
int pipeline);
140 virtual vtkStringArray* GetLabels(
int pipeline);
147 bool IsDisplayable();
151 virtual void GetInteractionHandleAxisWorld(
int type,
int index,
double axis[3]);
153 virtual void GetInteractionHandleOriginWorld(
double origin[3]);
155 virtual void GetInteractionHandlePositionWorld(
int type,
int index,
double position[3]);
162 static int GetGlyphTypeSourceFromDisplay(
int glyphTypeDisplay);
217 vtkSmartPointer<vtkAppendPolyData>
Append;
221 vtkSmartPointer<vtkPolyDataMapper2D>
Mapper;
225 double StartFadeAngle{30};
226 double EndFadeAngle{20};
227 double InteractionHandleSize{1.0};
229 virtual void InitializePipeline();
230 virtual void CreateRotationHandles();
231 virtual void CreateTranslationHandles();
232 virtual void CreateScaleHandles();
233 virtual void UpdateHandleVisibility();
234 virtual void UpdateHandleColors();
237 virtual void SetWidgetScale(
double scale);
240 virtual void GetHandleColor(
int type,
int index,
double color[4]);
242 virtual double GetHandleOpacity(
int type,
int index);
245 virtual void GetViewPlaneNormal(
double normal[3]);
249 virtual void GetInteractionHandlePositionWorld(
int type,
int index,
double position[3]);
252 virtual void GetInteractionHandleAxis(
int type,
int index,
double axis[3]);
254 virtual void GetInteractionHandleAxisWorld(
int type,
int index,
double axis[3]);
256 virtual void GetInteractionHandleOriginWorld(
double origin[3]);
260 HandleInfo(
int index,
int componentType,
double positionWorld[3],
double positionLocal[3],
double color[4])
262 , ComponentType(componentType)
264 for (
int i = 0; i < 3; ++i)
266 this->PositionWorld[i] = positionWorld[i];
268 this->PositionWorld[3] = 1.0;
269 for (
int i = 0; i < 3; ++i)
271 this->PositionLocal[i] = positionLocal[i];
273 this->PositionLocal[3] = 1.0;
274 for (
int i = 0; i < 4; ++i)
276 this->Color[i] = color[i];
281 double PositionLocal[4];
282 double PositionWorld[4];
286 double epsilon = 0.001;
287 return this->Color[3] > epsilon;
292 virtual std::vector<HandleInfo> GetHandleInfoList();
297 virtual void UpdateViewScaleFactor() = 0;
299 virtual void UpdateControlPointSize() = 0;
302 virtual void UpdateInteractionHandleSize();
325 virtual bool GetAllControlPointsVisible();
328 bool GetAllControlPointsSelected();
334 void BuildLine(vtkPolyData* linePolyData,
bool displayPosition);
338 double* GetWidgetColor(
int controlPointType);
342 virtual void SetupInteractionPipeline();
346 virtual void UpdateInteractionPipeline();
Abstract Superclass for all specific types of MRML nodes.