Commit 4cebcaac authored by Will Schroeder's avatar Will Schroeder Committed by David Partyka
Browse files

Hierarchy of button widgets added

parent 31857c7e
......@@ -80,7 +80,7 @@
// vtkInteractorStyleRubberBand2D::SELECT_UNION or
// vtkInteractorStyleRubberBand2D::SELECT_NORMAL
// - vtkCommand::AnnotationChangedEvent
// - GUISupport/Qt/vtkQtAnnotationView returns a pointer to a
// - GUISupport/Qt/vtkQtAnnotationView returns a pointer to a
// vtkAnnotationLayers
// - vtkCommand::PlacePointEvent
// - Widgets/vtkSeedWidget returns a pointer to an int, being the current
......@@ -216,9 +216,9 @@ public:
// the same effect as invoking Delete() (i.e., it reduces the reference
// count by 1).
void UnRegister();
virtual void UnRegister(vtkObjectBase *)
virtual void UnRegister(vtkObjectBase *)
{ this->UnRegister(); }
// Description:
// All derived classes of vtkCommand must implement this
// method. This is the method that actually does the work of the
......@@ -230,7 +230,7 @@ public:
// but the user can package data and pass it this
// way. Alternatively, a derived class of vtkCommand can be used to
// pass data.)
virtual void Execute(vtkObject *caller, unsigned long eventId,
virtual void Execute(vtkObject *caller, unsigned long eventId,
void *callData) = 0;
// Description:
......@@ -242,29 +242,29 @@ public:
// Description:
// Set/Get the abort flag. If this is set to true no further
// commands are executed.
void SetAbortFlag(int f)
void SetAbortFlag(int f)
{ this->AbortFlag = f; }
int GetAbortFlag()
int GetAbortFlag()
{ return this->AbortFlag; }
void AbortFlagOn()
void AbortFlagOn()
{ this->SetAbortFlag(1); }
void AbortFlagOff()
void AbortFlagOff()
{ this->SetAbortFlag(0); }
// Description:
// Set/Get the passive observer flag. If this is set to true, this
// indicates that this command does not change the state of the
// system in any way. Passive observers are processed first, and
// are not called even when another command has focus.
void SetPassiveObserver(int f)
void SetPassiveObserver(int f)
{ this->PassiveObserver = f; }
int GetPassiveObserver()
int GetPassiveObserver()
{ return this->PassiveObserver; }
void PassiveObserverOn()
void PassiveObserverOn()
{ this->SetPassiveObserver(1); }
void PassiveObserverOff()
void PassiveObserverOff()
{ this->SetPassiveObserver(0); }
//BTX
// Description:
// All the currently defined events are listed here. Developers can
......@@ -338,7 +338,7 @@ public:
WidgetModifiedEvent,
WidgetValueChangedEvent,
WidgetActivateEvent,
ConnectionCreatedEvent,
ConnectionCreatedEvent,
ConnectionClosedEvent,
DomainModifiedEvent,
PropertyModifiedEvent,
......@@ -363,6 +363,7 @@ public:
WindowMakeCurrentEvent,
WindowIsCurrentEvent,
WindowFrameEvent,
HighlightEvent,
UserEvent = 1000
};
//ETX
......@@ -382,4 +383,4 @@ protected:
};
#endif /* __vtkCommand_h */
......@@ -141,6 +141,7 @@ SET( Kit_SRCS
vtkPrimitivePainter.cxx
vtkProp3DCollection.cxx
vtkProp3D.cxx
vtkProp3DFollower.cxx
vtkProperty.cxx
vtkPropPicker.cxx
vtkQuadricLODActor.cxx
......@@ -206,7 +207,7 @@ ENDIF (NOT VTK_LEGACY_REMOVE)
IF(VTK_USE_GL2PS)
SET(Kit_SRCS ${Kit_SRCS} vtkGL2PSExporter.cxx)
IF(VTK_USE_SYSTEM_GL2PS)
ELSE(VTK_USE_SYSTEM_GL2PS)
SET(Kit_GL2PS_SRCS ${VTK_SOURCE_DIR}/Utilities/vtkgl2ps/gl2ps.c)
......@@ -216,7 +217,7 @@ IF(VTK_USE_GL2PS)
ENDIF(VTK_USE_GL2PS)
IF(VTK_USE_CG_SHADERS)
SET(Kit_SRCS ${Kit_SRCS}
SET(Kit_SRCS ${Kit_SRCS}
vtkCgShader.cxx
vtkCgShaderDeviceAdapter.cxx
vtkCgShaderProgram.cxx
......@@ -354,7 +355,7 @@ SET_SOURCE_FILES_PROPERTIES(
vtkFreeTypeUtilities
WRAP_EXCLUDE)
SET(Kit_FT_SRCS
SET(Kit_FT_SRCS
fonts/face_arial.cxx
fonts/face_arial_bold.cxx
fonts/face_arial_bold_italic.cxx
......@@ -379,7 +380,7 @@ IF(VTK_USE_X)
OPTION(VTK_USE_TDX "Use 3Dconnexion device" OFF)
MARK_AS_ADVANCED(VTK_USE_TDX)
IF(VTK_USE_TDX)
SET(VTK_TDX_INCLUDE_PATH CACHE PATH "Directory path to xdrvlib.h for 3DConnexion device")
SET(VTK_TDX_OBJECT_PATH CACHE FILEPATH "File path to xdrvlib.a for 3DConnexion device")
SET(Kit_SRCS ${Kit_SRCS} vtkTDxDevice.cxx vtkTDxUnixDevice.cxx)
......@@ -420,7 +421,7 @@ ENDIF()
CONFIGURE_FILE(${VTK_SOURCE_DIR}/Rendering/vtkTDxConfigure.h.in
${VTK_BINARY_DIR}/Rendering/vtkTDxConfigure.h @ONLY IMMEDIATE)
IF(VTK_USE_QT)
IF(VTK_USE_QT)
SET(QT_DONT_USE_QTGUI)
INCLUDE(${QT_USE_FILE})
......@@ -505,8 +506,8 @@ ADD_CUSTOM_COMMAND(
SET_SOURCE_FILES_PROPERTIES(vtkOpenGLExtensionManager.cxx
PROPERTIES OBJECT_DEPENDS ${VTK_BINARY_DIR}/Rendering/vtkgl.cxx)
SET(KitOpenGL_SRCS ${KitOpenGL_SRCS}
${VTK_BINARY_DIR}/Rendering/vtkgl.cxx
SET(KitOpenGL_SRCS ${KitOpenGL_SRCS}
${VTK_BINARY_DIR}/Rendering/vtkgl.cxx
)
SET_SOURCE_FILES_PROPERTIES(
......@@ -606,7 +607,7 @@ IF (WIN32)
IF (OPENGL_gl_LIBRARY)
SET(KitOpenGL_SRCS ${KitOpenGL_SRCS} vtkXOpenGLRenderWindow.cxx)
SET(KIT_LIBS ${KIT_LIBS} ${OPENGL_gl_LIBRARY} )
ENDIF (OPENGL_gl_LIBRARY)
ENDIF (OPENGL_gl_LIBRARY)
ELSE(VTK_USE_X)
SET(KitOpenGL_SRCS ${KitOpenGL_SRCS}
vtkWin32OpenGLRenderWindow.cxx
......@@ -620,13 +621,13 @@ ELSE (WIN32)
vtkCocoaRenderWindowInteractor.mm
vtkCocoaRenderWindow.mm
vtkCocoaGLView.mm)
# The objective-c++ classes might need their own flags.
# Set them if specified.
IF(VTK_REQUIRED_OBJCXX_FLAGS)
SET_SOURCE_FILES_PROPERTIES(vtkCocoaRenderWindowInteractor.mm
vtkCocoaRenderWindow.mm
SET_SOURCE_FILES_PROPERTIES(vtkCocoaRenderWindowInteractor.mm
vtkCocoaRenderWindow.mm
vtkCocoaGLView.mm
PROPERTIES COMPILE_FLAGS "${VTK_REQUIRED_OBJCXX_FLAGS}")
......@@ -674,7 +675,7 @@ ENDIF(VTK_USE_CG_SHADERS)
if(DirectX_FOUND)
# d3d9.lib for symbol Direct3DCreate9
# symbol CLSID_WbemLocator IID_IWbemLocator: wbemuuid.lib
# symbol CLSID_WbemLocator IID_IWbemLocator: wbemuuid.lib
# wbemuuid.lib is *NOT A FILE* (you cannot find it), it is probably an
# embedded library added by the linker itself.
set(KIT_LIBS ${KIT_LIBS} ${DirectX_LIBRARY} wbemuuid)
......@@ -788,8 +789,8 @@ IF (VTK_WRAP_TCL AND VTK_USE_TK)
IF(VTK_USE_CARBON)
SET(KIT_TCL_LIBS ${KIT_TCL_LIBS} "-framework Carbon")
ENDIF(VTK_USE_CARBON)
SET(Kit_TCL_EXTRA_CMDS
vtkTkRenderWidget
SET(Kit_TCL_EXTRA_CMDS
vtkTkRenderWidget
vtkTkImageViewerWidget)
ENDIF (VTK_WRAP_TCL AND VTK_USE_TK)
......@@ -841,7 +842,7 @@ IF (VTK_WRAP_PYTHON AND VTK_USE_TK AND TK_FOUND)
IF(VTK_USE_CARBON)
SET(VTK_PYTHONTK_LIBRARIES ${VTK_PYTHONTK_LIBRARIES} "-framework Carbon")
ENDIF(VTK_USE_CARBON)
TARGET_LINK_LIBRARIES (vtkRenderingPythonTkWidgets
vtk${KIT}
${VTK_PYTHONTK_LIBRARIES})
......@@ -864,9 +865,9 @@ ENDIF (VTK_WRAP_PYTHON AND VTK_USE_TK AND TK_FOUND)
IF(VTK_USE_X)
SET(X11_LIB_SEARCH_PATH
/usr/X11R6/lib
/usr/local/lib
/usr/openwin/lib
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/lib
)
FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH})
MARK_AS_ADVANCED(X11_Xt_LIB)
......
......@@ -22,6 +22,7 @@ IF(VTK_USE_DISPLAY)
TestBlurAndSobelPasses.cxx
TestDynamic2DLabelMapper.cxx
TestFBO.cxx
TestFollowerPicking.cxx
TestGaussianBlurPass.cxx
TestGlyph3DMapper.cxx
TestGlyph3DMapperMasking.cxx
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestHandleWidget.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.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.
=========================================================================*/
//
// This example tests picking a vtkFollower and vtkProp3DFollower
//
#include "vtkJPEGReader.h"
#include "vtkImageActor.h"
#include "vtkPlaneSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkFollower.h"
#include "vtkProp3DFollower.h"
#include "vtkPropPicker.h"
#include "vtkCellPicker.h"
#include "vtkStructuredPointsReader.h"
#include "vtkPiecewiseFunction.h"
#include "vtkColorTransferFunction.h"
#include "vtkProperty.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCommand.h"
#include "vtkInteractorEventRecorder.h"
#include "vtkSmartPointer.h"
#include "vtkTestUtilities.h"
#include "vtkSphereSource.h"
#include "vtkRegressionTestImage.h"
#define VTK_CREATE(type, name) \
vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
// -----------------------------------------------------------------------
// This does the actual work: updates the vtkPline implicit function.
// This in turn causes the pipeline to update and clip the object.
// Callback for the interaction
class vtkPickFollowerCallback : public vtkCommand
{
public:
static vtkPickFollowerCallback *New()
{ return new vtkPickFollowerCallback; }
virtual void Execute(vtkObject *caller, unsigned long, void*)
{
// vtkPropPicker *picker = reinterpret_cast<vtkPropPicker*>(caller);
vtkCellPicker *picker = reinterpret_cast<vtkCellPicker*>(caller);
if ( picker->GetViewProp() != NULL )
{
cout << "Picked\n";
}
}
vtkPickFollowerCallback() {}
};
// -----------------------------------------------------------------------
char PickFollowerLog[] =
"# StreamVersion 1\n"
"RenderEvent 0 0 0 0 0 0 0\n"
"EnterEvent 285 289 0 0 0 0 0\n"
"MouseMoveEvent 285 289 0 0 0 0 0\n"
"MouseMoveEvent 271 294 0 0 0 0 0\n"
"LeaveEvent 271 294 0 0 0 0 0\n"
"EnterEvent 136 299 0 0 0 0 0\n"
"MouseMoveEvent 136 299 0 0 0 0 0\n"
"MouseMoveEvent 136 294 0 0 0 0 0\n"
"MouseMoveEvent 136 291 0 0 0 0 0\n"
"MouseMoveEvent 136 286 0 0 0 0 0\n"
"MouseMoveEvent 136 280 0 0 0 0 0\n"
"MouseMoveEvent 136 277 0 0 0 0 0\n"
"MouseMoveEvent 136 274 0 0 0 0 0\n"
"MouseMoveEvent 136 271 0 0 0 0 0\n"
"MouseMoveEvent 136 268 0 0 0 0 0\n"
"MouseMoveEvent 136 262 0 0 0 0 0\n"
"MouseMoveEvent 136 260 0 0 0 0 0\n"
"MouseMoveEvent 136 256 0 0 0 0 0\n"
"MouseMoveEvent 136 253 0 0 0 0 0\n"
"MouseMoveEvent 136 251 0 0 0 0 0\n"
"MouseMoveEvent 136 249 0 0 0 0 0\n"
"MouseMoveEvent 136 247 0 0 0 0 0\n"
"MouseMoveEvent 136 246 0 0 0 0 0\n"
"MouseMoveEvent 136 245 0 0 0 0 0\n"
"MouseMoveEvent 136 243 0 0 0 0 0\n"
"MouseMoveEvent 137 241 0 0 0 0 0\n"
"MouseMoveEvent 137 240 0 0 0 0 0\n"
"MouseMoveEvent 137 238 0 0 0 0 0\n"
"MouseMoveEvent 137 237 0 0 0 0 0\n"
"MouseMoveEvent 137 236 0 0 0 0 0\n"
"MouseMoveEvent 137 234 0 0 0 0 0\n"
"MouseMoveEvent 138 231 0 0 0 0 0\n"
"MouseMoveEvent 138 230 0 0 0 0 0\n"
"MouseMoveEvent 138 229 0 0 0 0 0\n"
"MouseMoveEvent 138 227 0 0 0 0 0\n"
"MouseMoveEvent 139 227 0 0 0 0 0\n"
"MouseMoveEvent 139 226 0 0 0 0 0\n"
"MouseMoveEvent 139 225 0 0 0 0 0\n"
"MouseMoveEvent 139 224 0 0 0 0 0\n"
"KeyPressEvent 139 224 0 0 114 1 r\n"
"CharEvent 139 224 0 0 114 1 r\n"
"RenderEvent 139 224 0 0 114 1 r\n"
"MouseMoveEvent 140 223 0 0 0 0 r\n"
"MouseMoveEvent 141 223 0 0 0 0 r\n"
"KeyReleaseEvent 141 223 0 0 114 1 r\n"
"MouseMoveEvent 142 223 0 0 0 0 r\n"
"MouseMoveEvent 143 223 0 0 0 0 r\n"
"MouseMoveEvent 144 223 0 0 0 0 r\n"
"MouseMoveEvent 145 223 0 0 0 0 r\n"
"MouseMoveEvent 146 223 0 0 0 0 r\n"
"MouseMoveEvent 146 222 0 0 0 0 r\n"
"MouseMoveEvent 146 221 0 0 0 0 r\n"
"MouseMoveEvent 146 220 0 0 0 0 r\n"
"MouseMoveEvent 146 219 0 0 0 0 r\n"
"MouseMoveEvent 146 218 0 0 0 0 r\n"
"MouseMoveEvent 146 217 0 0 0 0 r\n"
"MouseMoveEvent 146 216 0 0 0 0 r\n"
"MouseMoveEvent 146 215 0 0 0 0 r\n"
"MouseMoveEvent 146 213 0 0 0 0 r\n"
"MouseMoveEvent 146 212 0 0 0 0 r\n"
"MouseWheelBackwardEvent 146 212 0 0 0 0 r\n"
"StartInteractionEvent 146 212 0 0 0 0 r\n"
"RenderEvent 146 212 0 0 0 0 r\n"
"EndInteractionEvent 146 212 0 0 0 0 r\n"
"RenderEvent 146 212 0 0 0 0 r\n"
"MouseWheelBackwardEvent 146 212 0 0 0 0 r\n"
"StartInteractionEvent 146 212 0 0 0 0 r\n"
"RenderEvent 146 212 0 0 0 0 r\n"
"EndInteractionEvent 146 212 0 0 0 0 r\n"
"RenderEvent 146 212 0 0 0 0 r\n"
"MouseWheelBackwardEvent 146 212 0 0 0 0 r\n"
"StartInteractionEvent 146 212 0 0 0 0 r\n"
"RenderEvent 146 212 0 0 0 0 r\n"
"EndInteractionEvent 146 212 0 0 0 0 r\n"
"RenderEvent 146 212 0 0 0 0 r\n"
"MouseMoveEvent 146 209 0 0 0 0 r\n"
"MouseMoveEvent 146 205 0 0 0 0 r\n"
"MouseMoveEvent 146 202 0 0 0 0 r\n"
"MouseMoveEvent 146 199 0 0 0 0 r\n"
"MouseMoveEvent 146 197 0 0 0 0 r\n"
"MouseMoveEvent 146 196 0 0 0 0 r\n"
"MouseMoveEvent 146 194 0 0 0 0 r\n"
"MouseMoveEvent 147 193 0 0 0 0 r\n"
"MouseMoveEvent 147 191 0 0 0 0 r\n"
"MouseMoveEvent 148 190 0 0 0 0 r\n"
"MouseMoveEvent 149 189 0 0 0 0 r\n"
"MouseMoveEvent 149 186 0 0 0 0 r\n"
"MouseMoveEvent 149 185 0 0 0 0 r\n"
"MouseMoveEvent 149 184 0 0 0 0 r\n"
"MouseMoveEvent 149 183 0 0 0 0 r\n"
"MouseMoveEvent 149 182 0 0 0 0 r\n"
"MouseMoveEvent 149 181 0 0 0 0 r\n"
"MouseMoveEvent 149 180 0 0 0 0 r\n"
"MouseMoveEvent 149 179 0 0 0 0 r\n"
"MouseMoveEvent 149 178 0 0 0 0 r\n"
"MouseMoveEvent 149 177 0 0 0 0 r\n"
"MouseMoveEvent 149 176 0 0 0 0 r\n"
"MouseMoveEvent 149 175 0 0 0 0 r\n"
"MouseMoveEvent 149 174 0 0 0 0 r\n"
"MouseMoveEvent 149 173 0 0 0 0 r\n"
"MouseMoveEvent 149 172 0 0 0 0 r\n"
"MouseMoveEvent 149 171 0 0 0 0 r\n"
"KeyPressEvent 149 171 0 0 112 1 p\n"
"CharEvent 149 171 0 0 112 1 p\n"
"StartPickEvent 149 171 0 0 112 1 p\n"
"RenderEvent 149 171 0 0 112 1 p\n"
"EndPickEvent 149 171 0 0 112 1 p\n"
"KeyReleaseEvent 149 171 0 0 112 1 p\n"
"MouseMoveEvent 151 169 0 0 0 0 p\n"
"MouseMoveEvent 154 169 0 0 0 0 p\n"
"MouseMoveEvent 164 166 0 0 0 0 p\n"
"MouseMoveEvent 174 166 0 0 0 0 p\n"
"MouseMoveEvent 182 165 0 0 0 0 p\n"
"MouseMoveEvent 190 165 0 0 0 0 p\n"
"MouseMoveEvent 194 165 0 0 0 0 p\n"
"MouseMoveEvent 200 165 0 0 0 0 p\n"
"MouseMoveEvent 204 164 0 0 0 0 p\n"
"MouseMoveEvent 208 164 0 0 0 0 p\n"
"MouseMoveEvent 215 163 0 0 0 0 p\n"
"MouseMoveEvent 218 163 0 0 0 0 p\n"
"MouseMoveEvent 221 163 0 0 0 0 p\n"
"MouseMoveEvent 226 163 0 0 0 0 p\n"
"MouseMoveEvent 230 163 0 0 0 0 p\n"
"MouseMoveEvent 233 163 0 0 0 0 p\n"
"MouseMoveEvent 234 163 0 0 0 0 p\n"
"MouseMoveEvent 236 163 0 0 0 0 p\n"
"MouseMoveEvent 237 163 0 0 0 0 p\n"
"MouseMoveEvent 238 163 0 0 0 0 p\n"
"MouseMoveEvent 239 163 0 0 0 0 p\n"
"MouseMoveEvent 240 163 0 0 0 0 p\n"
"MouseMoveEvent 242 163 0 0 0 0 p\n"
"MouseMoveEvent 244 163 0 0 0 0 p\n"
"MouseMoveEvent 245 163 0 0 0 0 p\n"
"MouseMoveEvent 246 163 0 0 0 0 p\n"
"MouseMoveEvent 247 163 0 0 0 0 p\n"
"MouseMoveEvent 248 163 0 0 0 0 p\n"
"KeyPressEvent 248 163 0 0 112 1 p\n"
"CharEvent 248 163 0 0 112 1 p\n"
"StartPickEvent 248 163 0 0 112 1 p\n"
"RenderEvent 248 163 0 0 112 1 p\n"
"EndPickEvent 248 163 0 0 112 1 p\n"
"KeyReleaseEvent 248 163 0 0 112 1 p\n"
"MouseMoveEvent 246 163 0 0 0 0 p\n"
"MouseMoveEvent 243 163 0 0 0 0 p\n"
"MouseMoveEvent 241 163 0 0 0 0 p\n"
"MouseMoveEvent 238 163 0 0 0 0 p\n"
"MouseMoveEvent 234 164 0 0 0 0 p\n"
"MouseMoveEvent 229 164 0 0 0 0 p\n"
"MouseMoveEvent 222 165 0 0 0 0 p\n"
"MouseMoveEvent 215 165 0 0 0 0 p\n"
"MouseMoveEvent 206 165 0 0 0 0 p\n"
"MouseMoveEvent 200 165 0 0 0 0 p\n"
"MouseMoveEvent 194 164 0 0 0 0 p\n"
"MouseMoveEvent 192 163 0 0 0 0 p\n"
"MouseMoveEvent 192 162 0 0 0 0 p\n"
"MouseMoveEvent 191 162 0 0 0 0 p\n"
"MouseMoveEvent 190 162 0 0 0 0 p\n"
"MouseMoveEvent 189 162 0 0 0 0 p\n"
"MouseMoveEvent 188 162 0 0 0 0 p\n"
"MouseMoveEvent 186 162 0 0 0 0 p\n"
"MouseMoveEvent 185 162 0 0 0 0 p\n"
"MouseMoveEvent 183 162 0 0 0 0 p\n"
"MouseMoveEvent 182 162 0 0 0 0 p\n"
"MouseMoveEvent 180 162 0 0 0 0 p\n"
"MouseMoveEvent 179 162 0 0 0 0 p\n"
"MouseMoveEvent 178 162 0 0 0 0 p\n"
"MouseMoveEvent 176 162 0 0 0 0 p\n"
"MouseMoveEvent 175 162 0 0 0 0 p\n"
"MouseMoveEvent 173 162 0 0 0 0 p\n"
"KeyPressEvent 173 162 0 0 112 1 p\n"
"CharEvent 173 162 0 0 112 1 p\n"
"StartPickEvent 173 162 0 0 112 1 p\n"
"RenderEvent 173 162 0 0 112 1 p\n"
"EndPickEvent 173 162 0 0 112 1 p\n"
"KeyReleaseEvent 173 162 0 0 112 1 p\n"
;
// -----------------------------------------------------------------------
int TestFollowerPicking( int argc, char* argv[] )
{
// Create some simple actors
//
VTK_CREATE(vtkPlaneSource, plane);
VTK_CREATE(vtkPolyDataMapper, mapper);
mapper->SetInputConnection(plane->GetOutputPort());
VTK_CREATE(vtkFollower, follower);
follower->SetMapper( mapper);
follower->SetPosition(1,2,3);
// Mark the origin
VTK_CREATE(vtkSphereSource,ss);
VTK_CREATE(vtkPolyDataMapper,m);
m->SetInputConnection(ss->GetOutputPort());
VTK_CREATE(vtkActor,a);
a->SetMapper(m);
// Create a more complex follower
char *fname =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/beach.jpg");
VTK_CREATE(vtkJPEGReader, pnmReader);
pnmReader->SetFileName(fname);
delete[] fname;
VTK_CREATE(vtkImageActor,ia);
ia->SetInput(pnmReader->GetOutput());
ia->SetScale(0.01,0.01,0.01);
VTK_CREATE(vtkProp3DFollower,p3dFollower);
p3dFollower->SetProp(ia);
// Debugging code
VTK_CREATE(vtkPlaneSource, plane2);
VTK_CREATE(vtkPolyDataMapper, mapper2);
mapper2->SetInputConnection(plane2->GetOutputPort());
VTK_CREATE(vtkActor, actor);
actor->SetMapper( mapper2);
actor->AddPosition(1,2,3);
actor->GetProperty()->SetRepresentationToWireframe();
actor->GetProperty()->SetColor(0,1,0);
// Picking callback
VTK_CREATE(vtkPickFollowerCallback, myCallback);
// VTK_CREATE(vtkPropPicker,picker);
VTK_CREATE(vtkCellPicker,picker);
picker->AddObserver(vtkCommand::EndPickEvent,myCallback);
// Create the rendering machinary
//
VTK_CREATE(vtkRenderer, ren1);
follower->SetCamera(ren1->GetActiveCamera());
p3dFollower->SetCamera(ren1->GetActiveCamera());
VTK_CREATE(vtkRenderWindow, renWin);
renWin->AddRenderer(ren1);
VTK_CREATE(vtkRenderWindowInteractor, iren);
iren->SetRenderWindow(renWin);
iren->SetPicker(picker);
// ren1->AddActor(follower);
ren1->AddActor(p3dFollower);
// ren1->AddActor(a);
// ren1->AddActor(actor);
// record events
VTK_CREATE(vtkInteractorEventRecorder, recorder);
recorder->SetInteractor(iren);
recorder->SetFileName("record.log");
// recorder->Record();
recorder->ReadFromInputStringOn();
recorder->SetInputString(PickFollowerLog);
recorder->EnabledOn();
ren1->SetBackground(0.1, 0.2, 0.4);
renWin->SetSize(300, 300);
ren1->ResetCamera();
iren->Initialize();
renWin->Render();
recorder->Play();
recorder->Off();
int retVal = vtkRegressionTestImageThreshold( renWin, 10 );
if ( retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
return !retVal;
}
......@@ -30,125 +30,136 @@ vtkStandardNewMacro(vtkFollower);
vtkCxxSetObjectMacro(vtkFollower,Camera,vtkCamera);
//----------------------------------------------------------------------
// Creates a follower with no camera set
vtkFollower::vtkFollower()
{
this->Camera = NULL;
this->Device = vtkActor::New();
this->InternalMatrix = vtkMatrix4x4::New();
}
//----------------------------------------------------------------------
vtkFollower::~vtkFollower()
{
if (this->Camera)
{
this->Camera->UnRegister(this);
}
this->Device->Delete();
this->InternalMatrix->Delete();
}
// Copy the follower's composite 4x4 matrix into the matrix provided.
void vtkFollower::GetMatrix(vtkMatrix4x4 *result)
//----------------------------------------------------------------------------
void vtkFollower::ComputeMatrix()
{
double *pos, *vup;
double Rx[3], Ry[3], Rz[3], p1[3];
vtkMatrix4x4 *matrix = vtkMatrix4x4::New();
int i;
double distance;
this->GetOrientation();
this->Transform->Push();
this->Transform->PostMultiply();
this->Transform->Identity();
// apply user defined matrix last if there is one
if (this->UserMatrix)
// check whether or not need to rebuild the matrix
if ( this->GetMTime() > this->MatrixMTime ||
(this->Camera && this->Camera->GetMTime() > this->MatrixMTime) )
{
this->Transform->Concatenate(this->UserMatrix);
}
this->GetOrientation();