File: vtkVVHandleWidget.h

package info (click to toggle)
volview 3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 25,204 kB
  • sloc: cpp: 132,585; ansic: 11,612; tcl: 236; sh: 64; makefile: 25; xml: 8
file content (169 lines) | stat: -rw-r--r-- 5,354 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*=========================================================================

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkVVHandleWidget
// .SECTION Description

#ifndef __vtkVVHandleWidget_h
#define __vtkVVHandleWidget_h

#include "vtkHandleWidget.h"
#include "XML/vtkXMLIOBaseMacros.h" // Needed for XML reader/writer macros
#include <vtkstd/string>

class vtkVVSelectionFrame;
class vtkVVDataItem;
class vtkVVHandleWidgetCommand;

class VTK_EXPORT vtkVVHandleWidget : public vtkHandleWidget
{
public:
  static vtkVVHandleWidget* New();
  vtkTypeRevisionMacro(vtkVVHandleWidget, vtkHandleWidget);
  void PrintSelf(ostream& os, vtkIndent indent);
  //BTX
  vtkKWGetXMLReaderWriterObjectsMacro();
  //ETX
  
  // Description:
  // Override superclass method to enable all the widgets in the group
  virtual void SetEnabled(int e);

  // Description:
  // Override superclass method to set the flag on all the widgets in the group
  virtual void SetProcessEvents(int e);

  // Description:
  // Query/Set the state of the widget to "defined" (in case its representation
  // was created programmatically)
  virtual void WidgetIsDefined();
  virtual int IsWidgetDefined();

  // Description:
  // INTERNAL - DO NOT USE.
  // Handle widgets exist on all the renderwindows/views for the selected 
  // dataitem. The corresponding widgets on multiple views are 
  // synchronized through events. To uniquely identify the set of widgets
  // that represent the same seed, the handle widgets have an ID. 
  vtkGetMacro( ID, int );
  virtual void SetID( int );

  // Description:
  // Get a new unique ID for this selection frame. This is equal to the largest
  // ID of all handles in this selection frame + 1
  static int GetNewUniqueID( vtkVVSelectionFrame * );

  // Description:
  // Set a name for the widget. You may use this to give the handle a textual 
  // description. It will be propagated to all the widgets in the group.
  void SetDescription( const char * );
  const char * GetDescription();

  // Description:
  // Set the selection frame
  virtual void SetSelectionFrame( vtkVVSelectionFrame * );
  vtkGetObjectMacro( SelectionFrame, vtkVVSelectionFrame );

  // Description:
  // Set whether the widget is the master or the slave. Default slave.
  vtkSetMacro( PlaceInteractively, int );
  vtkGetMacro( PlaceInteractively, int );
  vtkBooleanMacro( PlaceInteractively, int );

  // Description:
  // Get the number of seeds in this group.
  int GetNumberOfHandlesInGroup();

  // Description:
  // Get the nth seed in this group.
  vtkVVHandleWidget *GetNthHandleInGroup( int i );

  // Description:
  // Get the number of handle groups in a volume
  static int GetNumberOfHandlesInDataItem( vtkVVDataItem * );

  // Description:
  // Get the nth handle in the dataitem. Handles are sorted by their ID
  static vtkVVHandleWidget *GetNthHandleInDataItem(
                   vtkVVDataItem *data_item, int n);

  // Description:
  // Sync with other handle widgets in the same group
  virtual void Sync();

  // Description:
  // Get the position of the handle
  void GetWorldPosition(double pos[3]);
  
  // Description:
  // Get the position of the handle. Returns 0 if outside the volume, 
  // 1 if inside
  int GetPixelPosition(int pos[3]);

  // Description:
  // If the handle is displayed on a 2D render widget, this will return the
  // slice the handle exists. (See sliceorientations in vtkKW2DRenderWidget)
  int GetSlice( vtkVVSelectionFrame *, int sliceOrientation );

  // Description:
  // If the handle is displayed on a 2D render widget, this will set the
  // DisplayForAllSlices flag for all the representations in the group
  virtual void SetDisplayForAllSlices(int e);
  virtual int GetDisplayForAllSlices();

  // Description:
  // Raise all slices displaying this render widget.
  void Show();

  // Description:
  // Invokes Render for all the widgets in group.
  void RenderAllWidgetsInGroup();

  // Description:
  // Get annotations as strings.
  //BTX
  vtkstd::string GetWorldPositionAsString();
  vtkstd::string GetPixelPositionAsString();
  vtkstd::string GetPixelValueAsString();
  //ETX

  // Description:
  // INTERNAL DO NOT USE
  vtkSetMacro( WidgetState, int );

  // Description:
  // Set the color for the representation of all widgets in this group.
  virtual void SetColor( double rgb[3] );
  virtual void SetColor( double r, double g, double b );

protected:
  vtkVVHandleWidget();
  ~vtkVVHandleWidget();

  // Callback interface to capture events when
  // placing the widget.
  static void AddPointAction( vtkAbstractWidget* );

  int                        ID;
  int                        PlaceInteractively;
  vtkVVSelectionFrame      * SelectionFrame;
  vtkVVHandleWidgetCommand * HandleCommand;

  //BTX  
  vtkstd::string             Description;
  //ETX

private:
  vtkVVHandleWidget(const vtkVVHandleWidget&);  // Not implemented
  void operator=(const vtkVVHandleWidget&);  // Not implemented
};

#endif