ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkScalarBarActorCustom.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <vector> // For ivars
11 
12 #include "qPCL.h"
13 #include "vtkNew.h" // For ivars
14 #include "vtkScalarBarActor.h"
15 #include "vtkSmartPointer.h" // For ivars
16 
17 class vtkAxis;
18 class vtkContextScene;
19 
20 class QPCL_ENGINE_LIB_API vtkScalarBarActorCustom : public vtkScalarBarActor {
21 public:
23  void PrintSelf(ostream& os, vtkIndent indent) override;
25 
27 
31  vtkGetMacro(AspectRatio, double);
32  vtkSetMacro(AspectRatio, double);
34 
36 
41  vtkGetMacro(AutomaticLabelFormat, int);
42  vtkSetMacro(AutomaticLabelFormat, int);
43  vtkBooleanMacro(AutomaticLabelFormat, int);
45 
47 
50  vtkGetMacro(DrawTickMarks, int);
51  vtkSetMacro(DrawTickMarks, int);
52  vtkBooleanMacro(DrawTickMarks, int);
54 
56 
59  vtkGetMacro(DrawSubTickMarks, int);
60  vtkSetMacro(DrawSubTickMarks, int);
61  vtkBooleanMacro(DrawSubTickMarks, int);
63 
65 
69  vtkGetMacro(AddRangeLabels, int);
70  vtkSetMacro(AddRangeLabels, int);
71  vtkBooleanMacro(AddRangeLabels, int);
73 
75 
79  vtkSetMacro(AutomaticAnnotations, int);
80  vtkGetMacro(AutomaticAnnotations, int);
81  vtkBooleanMacro(AutomaticAnnotations, int);
83 
85 
88  vtkGetStringMacro(RangeLabelFormat);
89  vtkSetStringMacro(RangeLabelFormat);
91 
95  virtual void AddValueLabelIfUnoccluded(double value,
96  double pos,
97  double diff);
98 
100 
104  vtkGetMacro(TitleJustification, int);
105  vtkSetClampMacro(TitleJustification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
107 
109 
113  vtkGetMacro(AddRangeAnnotations, int);
114  vtkSetMacro(AddRangeAnnotations, int);
115  vtkBooleanMacro(AddRangeAnnotations, int);
117 
123  void ReleaseGraphicsResources(vtkWindow*) override;
124 
128  int RenderOpaqueGeometry(vtkViewport* viewport) override;
129 
133  int RenderOverlay(vtkViewport* viewport) override;
134 
135 protected:
137  ~vtkScalarBarActorCustom() override;
138 
140 
143  void PrepareTitleText() override;
144  void ComputeScalarBarThickness() override;
145  void LayoutTitle() override;
146  void ComputeScalarBarLength() override;
147  void LayoutTicks() override;
148  void ConfigureAnnotations() override;
149  void ConfigureTitle() override;
150  void ConfigureTicks() override;
152 
158  void EditAnnotations() override;
159 
170  virtual void BuildScalarBarTexture();
171 
177  virtual int CreateLabel(double value,
178  int minDigits,
179  int targetWidth,
180  int targetHeight,
181  vtkViewport* viewport);
182 
183  double AspectRatio;
188 
193 
195 
196  vtkTexture* ScalarBarTexture;
197  vtkPolyData* TickMarks;
198  vtkPolyDataMapper2D* TickMarksMapper;
199  vtkActor2D* TickMarksActor;
200 
202 
205  vtkNew<vtkAxis> TickLayoutHelper;
206  vtkNew<vtkContextScene> TickLayoutHelperScene;
208 
214 
219 
224 
225 private:
227  void operator=(const vtkScalarBarActorCustom&) = delete;
228 };
vtkSetClampMacro(TitleJustification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT)
vtkGetMacro(AutomaticAnnotations, int)
vtkBooleanMacro(AddRangeLabels, int)
vtkBooleanMacro(AddRangeAnnotations, int)
vtkGetMacro(AddRangeAnnotations, int)
vtkSetStringMacro(RangeLabelFormat)
vtkNew< vtkContextScene > TickLayoutHelperScene
vtkSetMacro(DrawTickMarks, int)
vtkSetMacro(AutomaticLabelFormat, int)
vtkGetMacro(DrawSubTickMarks, int)
vtkSetMacro(AddRangeLabels, int)
vtkGetMacro(AutomaticLabelFormat, int)
vtkSetMacro(AddRangeAnnotations, int)
vtkSetMacro(DrawSubTickMarks, int)
vtkSetMacro(AspectRatio, double)
vtkGetStringMacro(RangeLabelFormat)
vtkGetMacro(DrawTickMarks, int)
vtkBooleanMacro(AutomaticLabelFormat, int)
vtkBooleanMacro(DrawSubTickMarks, int)
vtkTypeMacro(vtkScalarBarActorCustom, vtkScalarBarActor)
static vtkScalarBarActorCustom * New()
vtkGetMacro(TitleJustification, int)
vtkBooleanMacro(AutomaticAnnotations, int)
vtkPolyDataMapper2D * TickMarksMapper
vtkBooleanMacro(DrawTickMarks, int)
vtkGetMacro(AspectRatio, double)
vtkSetMacro(AutomaticAnnotations, int)
vtkGetMacro(AddRangeLabels, int)
static cc2DLabel * CreateLabel(cc2DLabel *label, ccPointCloud *cloud, unsigned pointIndex, QString pointName)
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15