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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
|
/*=========================================================================
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 vtkVVSelectionFrame - Selection Frame
// .SECTION Description
// The selection frame is what contains a render widget.
#ifndef __vtkVVSelectionFrame_h
#define __vtkVVSelectionFrame_h
#include "vtkKWSelectionFrame.h"
#include "XML/vtkXMLIOBaseMacros.h" // Needed for XML reader/writer macros
class vtkKWRenderWidget;
class vtkVVDataItem;
class vtkVVSelectionFrameInternals;
class vtkAbstractWidget;
class vtkKWContourWidget;
class VTK_EXPORT vtkVVSelectionFrame : public vtkKWSelectionFrame
{
public:
static vtkVVSelectionFrame* New();
vtkTypeRevisionMacro(vtkVVSelectionFrame, vtkKWSelectionFrame);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
vtkKWGetXMLReaderWriterObjectsMacro();
//ETX
// Description:
// Set/Get the render widget this selection frame is associated to.
// It is ref counted.
virtual void SetRenderWidget(vtkKWRenderWidget *widget);
vtkGetObjectMacro(RenderWidget, vtkKWRenderWidget);
// Description:
// Select/Deselect the window
vtkSetMacro(BindRenderWidgetOnlyWhenSelected, int);
vtkGetMacro(BindRenderWidgetOnlyWhenSelected, int);
vtkBooleanMacro(BindRenderWidgetOnlyWhenSelected, int);
// Description:
// Set/Get the data item this selection frame is associated to.
// It is ref counted.
virtual void SetDataItem(vtkVVDataItem *data);
vtkGetObjectMacro(DataItem, vtkVVDataItem);
// Description:
// Manage the interactor widget (ref counted).
// Return 1 on success, 0 otherwise
virtual int AddInteractorWidget(vtkAbstractWidget*);
virtual int GetNumberOfInteractorWidgets();
virtual int HasInteractorWidget(vtkAbstractWidget *data);
virtual vtkAbstractWidget* GetNthInteractorWidget(int i);
virtual void RemoveInteractorWidget(vtkAbstractWidget*);
virtual void RemoveAllInteractorWidgets();
static void AddInteractorWidgetObservers(vtkKWObject *, vtkAbstractWidget*);
static void RemoveInteractorWidgetObservers(vtkKWObject *, vtkAbstractWidget*);
virtual int GetNumberOfPaintbrushWidgets();
// Description:
// Show/Hide (enable/disable) an interactor widget.
virtual void SetInteractorWidgetVisibility(vtkAbstractWidget*, int);
virtual int GetInteractorWidgetVisibility(vtkAbstractWidget*);
// Description:
// Lock/unlock an interactor widget. If supported by the RenderWidget
// locking will make sure the interactor is stuck to a given view of
// the renderwidget. For example, locking an interactor for a 2D image
// widget will make sure the interactor is bound/linked to the specific
// slice it was created on (i.e. only visible at that location).
// See SetInteractorWidgetOriginalSlice.
// The GoToInteractorWidget will make sure the interactor is visible,
// possibly by automatically going to the slice it was created on.
// GetInteractorWidgetLock will return -1 if lock is not supported,
// 0 if supported and not locked, 1 if supported and locked.
virtual void SetInteractorWidgetLock(vtkAbstractWidget*, int);
virtual int GetInteractorWidgetLock(vtkAbstractWidget*);
virtual void GoToInteractorWidget(vtkAbstractWidget*);
// Description:
// Set/Get the original slice an interactor widget was defined on, if
// supported by RenderWidget.
// Return -1 if not defined.
virtual void SetInteractorWidgetOriginalSlice(vtkAbstractWidget*, int);
virtual int GetInteractorWidgetOriginalSlice(vtkAbstractWidget*);
// Description:
// Convenience method to check if a default interactor widget type is
// supported, and add the corresponding type.
// Add*Widget() will return a new instance of the specific widget (i.e.
// AddDistanceWidget will return an instance of vtkKWDistanceWidget) and
// initialize it.
// Add*Widget(vtkAbstractWidget*) will do the same thing but not create
// a new instance, using the one passed as parameter instead.
virtual int DistanceWidgetIsSupported();
virtual vtkAbstractWidget* AddDistanceWidget();
virtual int AddDistanceWidget(vtkAbstractWidget*);
virtual int BiDimensionalWidgetIsSupported();
virtual vtkAbstractWidget* AddBiDimensionalWidget();
virtual int AddBiDimensionalWidget(vtkAbstractWidget*);
virtual int AngleWidgetIsSupported();
virtual vtkAbstractWidget* AddAngleWidget();
virtual int AddAngleWidget(vtkAbstractWidget*);
virtual int ContourWidgetIsSupported();
virtual vtkAbstractWidget* AddContourWidget();
virtual int AddContourWidget(vtkAbstractWidget*);
virtual int Label2DWidgetIsSupported();
virtual vtkAbstractWidget* AddLabel2DWidget();
virtual int AddLabel2DWidget(vtkAbstractWidget*);
virtual int HandleWidgetIsSupported();
virtual vtkAbstractWidget* AddHandleWidget();
virtual int AddHandleWidget(vtkAbstractWidget*);
virtual int PaintbrushWidgetIsSupported();
virtual vtkAbstractWidget* AddPaintbrushWidget();
virtual int AddPaintbrushWidget(vtkAbstractWidget*);
// Description:
// Close the selection frame. It can be re-implemented by
// subclasses to add more functionalities, release resources, etc.
// The only thing it does in this implementation is invoking the
// CloseCommand.
virtual void Close();
// Description:
// Select/Deselect the window.
// Override superclass to automatically focus on the render widget.
virtual void SetSelected(int);
// Description:
// Add all the default observers needed by that object, or remove
// all the observers that were added through AddCallbackCommandObserver.
// Subclasses can override these methods to add/remove their own default
// observers, but should call the superclass too.
virtual void AddCallbackCommandObservers();
virtual void RemoveCallbackCommandObservers();
// Description:
// Update the "enable" state of the object and its internal parts.
// Depending on different Ivars (this->Enabled, the application's
// Limited Edition Mode, etc.), the "enable" state of the object is updated
// and propagated to its internal parts/subwidgets. This will, for example,
// enable/disable parts of the widget UI, enable/disable the visibility
// of 3D widgets, etc.
virtual void UpdateEnableState();
protected:
vtkVVSelectionFrame();
~vtkVVSelectionFrame();
// Description:
// Create the widget.
virtual void CreateWidget();
// Description:
// The render widget
vtkKWRenderWidget *RenderWidget;
// Description:
// The data item
vtkVVDataItem *DataItem;
// Description:
// Create the render widget (if needed)
virtual void CreateRenderWidget();
// PIMPL Encapsulation for STL containers
vtkVVSelectionFrameInternals *Internals;
int BindRenderWidgetOnlyWhenSelected;
// Description:
// Pack
virtual void Pack();
// Description:
// Add/Remove bindings
virtual void Bind();
virtual void UnBind();
virtual void BindRenderWidget();
virtual void UnBindRenderWidget();
// Description:
// Processes the events that are passed through CallbackCommand (or others).
// Subclasses can oberride this method to process their own events, but
// should call the superclass too.
virtual void ProcessCallbackCommandEvents(
vtkObject *caller, unsigned long event, void *calldata);
// Description:
// Sets up the representation and properties for contours drawn on the image
// widgets (axial/ coronal/ sagittal/ oblique) and attaches the representation
// the interactor.
virtual void AddImageWidgetContourRepresentation(
vtkKWContourWidget *interactor);
// Description:
// Sets up the representation and properties for contours drawn on the volume
// widget and attaches the representation the interactor.
virtual void AddVolumeWidgetContourRepresentation(
vtkKWContourWidget *interactor);
// Description:
// Update the enabled state of interactor widget(s) given its lock and
// visibility status.
virtual void UpdateInteractorWidgetEnabledState(
vtkAbstractWidget*, int visibility, int lock, int orig_slice);
virtual void UpdateInteractorWidgetsEnabledState();
// Description:
// Update window interactor state.
virtual void UpdateRenderWindowInteractorState();
private:
vtkVVSelectionFrame(const vtkVVSelectionFrame&); // Not implemented
void operator=(const vtkVVSelectionFrame&); // Not implemented
};
#endif
|