vtkMultiSliceContextItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMultiSliceContextItem.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
19 #ifndef vtkMultiSliceContextItem_h
20 #define vtkMultiSliceContextItem_h
21 
22 #include "vtkCommand.h" // needed for vtkCommand::UserEvent.
23 #include "vtkContextItem.h"
24 #include "vtkRemotingViewsModule.h" // needed for export macro
25 
26 class vtkAxis;
27 
29 {
30 public:
31  static vtkMultiSliceContextItem* New();
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
40  bool Paint(vtkContext2D* painter) override;
41 
47  vtkAxis* GetAxis();
48 
53  void SetActiveSize(int size);
54 
58  void SetEdgeMargin(int margin);
59 
64  int GetActiveSliceIndex();
65 
69  bool Hit(const vtkContextMouseEvent& mouse) override;
70 
76  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
77 
83  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
84 
90  bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse) override;
91 
97  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
98 
103  const double* GetVisibleSlices(int& nbSlices) const;
104 
108  const double* GetSlices(int& nbSlices) const;
109 
114  void SetSlices(double* values, bool* visibility, int numberOfSlices);
115 
119  double GetSliceValue(int sliceIndex);
120 
124  int GetNumberOfSlices();
125 
126  // Events files when slices are modified by interaction.
127  enum
128  {
129  AddSliceEvent = vtkCommand::UserEvent + 1,
130  RemoveSliceEvent = vtkCommand::UserEvent + 2,
131  ModifySliceEvent = vtkCommand::UserEvent + 3
132  };
133 
134 protected:
135  double ScreenToRange(float position);
136  double ComputeEpsilon(int numberOfPixel = 5);
137  void forceRender();
138 
140  ~vtkMultiSliceContextItem() override;
141 
142 private:
144  void operator=(const vtkMultiSliceContextItem&) = delete;
145 
146  struct vtkInternal;
147  vtkInternal* Internal;
148 };
149 
150 #endif
#define VTKREMOTINGVIEWS_EXPORT
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
virtual bool Paint(vtkContext2D *painter)
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
virtual bool Hit(const vtkContextMouseEvent &mouse)
virtual void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
void operator=(const vtkObjectBase &)