8 #ifndef cvConstrainedLineRepresentation_h
9 #define cvConstrainedLineRepresentation_h
11 #include <vtkLineRepresentation.h>
12 #include <vtkPointHandleRepresentation3D.h>
34 void PrintSelf(ostream& os, vtkIndent indent)
override;
114 template <
typename T>
117 double p1[3] = {0, 0, 0};
118 double p2[3] = {0, 0, 0};
119 if (this->Point1Representation) {
120 this->Point1Representation->GetWorldPosition(p1);
122 if (this->Point2Representation) {
123 this->Point2Representation->GetWorldPosition(p2);
127 T* prototype = T::New();
130 if (this->Point1Representation) {
131 this->Point1Representation->Delete();
133 this->Point1Representation = T::New();
134 this->Point1Representation->ShallowCopy(prototype);
135 this->Point1Representation->SetWorldPosition(p1);
138 if (this->Point2Representation) {
139 this->Point2Representation->Delete();
141 this->Point2Representation = T::New();
142 this->Point2Representation->ShallowCopy(prototype);
143 this->Point2Representation->SetWorldPosition(p2);
146 if (this->LineHandleRepresentation) {
147 this->LineHandleRepresentation->Delete();
149 this->LineHandleRepresentation = T::New();
150 this->LineHandleRepresentation->ShallowCopy(prototype);
Extended LineRepresentation with distance display and ruler features.
vtkSetStringMacro(LabelSuffix)
Set/Get distance label suffix (e.g., " #1", " #2")
vtkGetMacro(NumberOfRulerTicks, int)
static cvConstrainedLineRepresentation * New()
vtkBooleanMacro(RulerMode, vtkTypeBool)
vtkGetMacro(RulerMode, vtkTypeBool)
vtkGetMacro(RulerDistance, double)
vtkBooleanMacro(ShowLabel, vtkTypeBool)
vtkGetMacro(ShowLabel, vtkTypeBool)
vtkAxisActor2D * AxisActor
vtkSetClampMacro(RulerDistance, double, 0, VTK_FLOAT_MAX)
Set/Get Ruler distance (tick spacing)
vtkGetMacro(Scale, double)
vtkGetStringMacro(LabelSuffix)
vtkGetStringMacro(LabelFormat)
void ReplaceHandleRepresentations(vtkPointHandleRepresentation3D *handle)
Replace handle representations with custom types (runtime version)
vtkSetMacro(RulerMode, vtkTypeBool)
Set/Get Ruler mode Ruler mode displays tick marks.
vtkProperty2D * AxisProperty
cvConstrainedLineRepresentation()
void BuildRepresentation() override
Override BuildRepresentation to update distance display.
void SetScale(double scale)
Set/Get scale factor.
vtkTypeMacro(cvConstrainedLineRepresentation, vtkLineRepresentation)
~cvConstrainedLineRepresentation() override
virtual double GetDistance()
Get distance between the two points.
vtkSetMacro(ShowLabel, vtkTypeBool)
Show/Hide distance label.
int RenderOpaqueGeometry(vtkViewport *viewport) override
int RenderOverlay(vtkViewport *viewport) override
Override to render distance label and ticks.
void ReplaceHandleRepresentationsTyped()
Replace handle representations with custom types This is needed because vtkLineRepresentation's const...
vtkSetStringMacro(LabelFormat)
Set/Get distance label format.
void PrintSelf(ostream &os, vtkIndent indent) override
vtkGetObjectMacro(AxisProperty, vtkProperty2D)
Get axis property (ParaView way)
vtkSetClampMacro(NumberOfRulerTicks, int, 1, VTK_INT_MAX)
Set/Get number of ruler ticks.
vtkGetObjectMacro(AxisActor, vtkAxisActor2D)
Get Axis Actor (for tick display)