ParaView
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 "vtkPVVTKExtensionsRenderingModule.h" // needed for export macro
25 
26 class vtkAxis;
27 
28 class VTKPVVTKEXTENSIONSRENDERING_EXPORT vtkMultiSliceContextItem : public vtkContextItem
29 {
30 public:
31  static vtkMultiSliceContextItem* New();
32  vtkTypeMacro(vtkMultiSliceContextItem, vtkContextItem);
33  virtual void PrintSelf(ostream& os, vtkIndent indent);
34 
40  virtual bool Paint(vtkContext2D* painter);
41 
47  vtkAxis* GetAxis();
48 
53  void SetActiveSize(int size);
54 
58  void SetEdgeMargin(int margin);
59 
64  int GetActiveSliceIndex();
65 
69  virtual bool Hit(const vtkContextMouseEvent& mouse);
70 
76  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse);
77 
83  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse);
84 
90  virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse);
91 
97  virtual bool MouseMoveEvent(const vtkContextMouseEvent& mouse);
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  virtual ~vtkMultiSliceContextItem();
141 
142 private:
143  vtkMultiSliceContextItem(const vtkMultiSliceContextItem&) VTK_DELETE_FUNCTION;
144  void operator=(const vtkMultiSliceContextItem&) VTK_DELETE_FUNCTION;
145 
146  struct vtkInternal;
147  vtkInternal* Internal;
148 };
149 
150 #endif