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 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkRenderWindowInteractor.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.
=========================================================================*/
#include "vtkRenderWindowInteractor.h"
#include "vtkCamera.h"
#include "vtkCommand.h"
#include "vtkGraphicsFactory.h"
#include "vtkInteractorStyleSwitchBase.h"
#include "vtkMath.h"
#include "vtkPropPicker.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkRendererCollection.h"
#include "vtkDebugLeaks.h"
#include "vtkObserverMediator.h"
#include "vtkPickingManager.h"
#include <map>
// PIMPL'd class to keep track of timers. It maps the ids returned by CreateTimer()
// to the platform-specific representation for timer ids.
struct vtkTimerStruct
{
int Id;
int Type;
unsigned long Duration;
vtkTimerStruct() : Id(0),Type(vtkRenderWindowInteractor::OneShotTimer),Duration(10) {}
vtkTimerStruct(int platformTimerId, int timerType, unsigned long duration)
{
this->Id = platformTimerId;
this->Type = timerType;
this->Duration = duration;
}
};
class vtkTimerIdMap : public std::map<int,vtkTimerStruct> {};
typedef std::map<int,vtkTimerStruct>::iterator vtkTimerIdMapIterator;
// Initialize static variable that keeps track of timer ids for
// render window interactors.
static int vtkTimerId = 1;
//----------------------------------------------------------------------------
vtkCxxSetObjectMacro(vtkRenderWindowInteractor,Picker,vtkAbstractPicker);
//----------------------------------------------------------------------
// Construct object so that light follows camera motion.
vtkRenderWindowInteractor::vtkRenderWindowInteractor()
{
this->RenderWindow = NULL;
// Here we are using base, and relying on the graphics factory or standard
// object factory logic to create the correct instance, which should be the
// vtkInteractorStyleSwitch when linked to the interactor styles, or
// vtkInteractorStyleSwitchBase if the style module is not linked.
this->InteractorStyle = NULL;
this->SetInteractorStyle(vtkInteractorStyleSwitchBase::New());
this->InteractorStyle->Delete();
this->LightFollowCamera = 1;
this->Initialized = 0;
this->Enabled = 0;
this->EnableRender = true;
this->DesiredUpdateRate = 15;
// default limit is 3 hours per frame
this->StillUpdateRate = 0.0001;
this->Picker = this->CreateDefaultPicker();
this->Picker->Register(this);
this->Picker->Delete();
this->PickingManager = 0;
vtkPickingManager* pm = this->CreateDefaultPickingManager();
this->SetPickingManager(pm);
pm->Delete();
this->EventPosition[0] = this->LastEventPosition[0] = 0;
this->EventPosition[1] = this->LastEventPosition[1] = 0;
for (int i = 0; i < VTKI_MAX_POINTERS; ++i)
{
this->EventPositions[i][0] = this->LastEventPositions[i][0] = 0;
this->EventPositions[i][1] = this->LastEventPositions[i][1] = 0;
}
this->PointerIndex = 0;
this->EventSize[0] = 0;
this->EventSize[1] = 0;
this->Size[0] = 0;
this->Size[1] = 0;
this->NumberOfFlyFrames = 15;
this->Dolly = 0.30;
this->AltKey = 0;
this->ControlKey = 0;
this->ShiftKey = 0;
this->KeyCode = 0;
this->RepeatCount = 0;
this->KeySym = 0;
this->TimerEventId = 0;
this->TimerEventType = 0;
this->TimerEventDuration = 0;
this->TimerEventPlatformId = 0;
this->TimerMap = new vtkTimerIdMap;
this->TimerDuration = 10;
this->ObserverMediator = 0;
this->HandleEventLoop = false;
this->UseTDx=false; // 3DConnexion device.
}
//----------------------------------------------------------------------
vtkRenderWindowInteractor::~vtkRenderWindowInteractor()
{
if (this->InteractorStyle != NULL)
{
this->InteractorStyle->UnRegister(this);
}
if ( this->Picker)
{
this->Picker->UnRegister(this);
}
delete [] this->KeySym;
if ( this->ObserverMediator)
{
this->ObserverMediator->Delete();
}
delete this->TimerMap;
this->SetPickingManager(0);
this->SetRenderWindow(0);
}
//----------------------------------------------------------------------
vtkRenderWindowInteractor *vtkRenderWindowInteractor::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret =
vtkGraphicsFactory::CreateInstance("vtkRenderWindowInteractor");
if ( ret )
{
return static_cast<vtkRenderWindowInteractor *>(ret);
}
#ifdef VTK_DEBUG_LEAKS
vtkDebugLeaks::ConstructClass("vtkRenderWindowInteractor");
#endif
return new vtkRenderWindowInteractor;
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::Render()
{
if (this->RenderWindow && this->Enabled && this->EnableRender)
{
this->RenderWindow->Render();
}
// outside the above test so that third-party code can redirect
// the render to the appropriate class
this->InvokeEvent(vtkCommand::RenderEvent, NULL);
}
//----------------------------------------------------------------------
// treat renderWindow and interactor as one object.
// it might be easier if the GetReference count method were redefined.
void vtkRenderWindowInteractor::UnRegister(vtkObjectBase *o)
{
if (this->RenderWindow && this->RenderWindow->GetInteractor() == this &&
this->RenderWindow != o)
{
if (this->GetReferenceCount()+this->RenderWindow->GetReferenceCount() == 3)
{
this->RenderWindow->SetInteractor(NULL);
this->SetRenderWindow(NULL);
}
}
this->vtkObject::UnRegister(o);
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::Start()
{
// Let the compositing handle the event loop if it wants to.
if (this->HasObserver(vtkCommand::StartEvent) && !this->HandleEventLoop)
{
this->InvokeEvent(vtkCommand::StartEvent,NULL);
return;
}
// As a convenience, initialize if we aren't initialized yet.
if (!this->Initialized)
{
this->Initialize();
if (!this->Initialized)
{
return;
}
}
// Pass execution to the subclass which will run the event loop,
// this will not return until TerminateApp is called.
this->StartEventLoop();
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::SetRenderWindow(vtkRenderWindow *aren)
{
if (this->RenderWindow != aren)
{
// to avoid destructor recursion
vtkRenderWindow *temp = this->RenderWindow;
this->RenderWindow = aren;
if (temp != NULL)
{
temp->UnRegister(this);
}
if (this->RenderWindow != NULL)
{
this->RenderWindow->Register(this);
if (this->RenderWindow->GetInteractor() != this)
{
this->RenderWindow->SetInteractor(this);
}
}
}
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *style)
{
if (this->InteractorStyle != style)
{
// to avoid destructor recursion
vtkInteractorObserver *temp = this->InteractorStyle;
this->InteractorStyle = style;
if (temp != NULL)
{
temp->SetInteractor(0);
temp->UnRegister(this);
}
if (this->InteractorStyle != NULL)
{
this->InteractorStyle->Register(this);
if (this->InteractorStyle->GetInteractor() != this)
{
this->InteractorStyle->SetInteractor(this);
}
}
}
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::UpdateSize(int x,int y)
{
// if the size changed send this on to the RenderWindow
if ((x != this->Size[0])||(y != this->Size[1]))
{
this->Size[0] = this->EventSize[0] = x;
this->Size[1] = this->EventSize[1] = y;
this->RenderWindow->SetSize(x,y);
}
}
//----------------------------------------------------------------------
// Creates an instance of vtkPropPicker by default
vtkAbstractPropPicker *vtkRenderWindowInteractor::CreateDefaultPicker()
{
return vtkPropPicker::New();
}
//----------------------------------------------------------------------
// Creates an instance of vtkPickingManager by default
vtkPickingManager* vtkRenderWindowInteractor::CreateDefaultPickingManager()
{
return vtkPickingManager::New();
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::SetPickingManager(vtkPickingManager* pm)
{
if(this->PickingManager == pm)
{
return;
}
vtkPickingManager* tempPickingManager = this->PickingManager;
this->PickingManager = pm;
if (this->PickingManager)
{
this->PickingManager->Register(this);
this->PickingManager->SetInteractor(this);
}
if(tempPickingManager)
{
tempPickingManager->SetInteractor(0);
tempPickingManager->UnRegister(this);
}
this->Modified();
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::ExitCallback()
{
if (this->HasObserver(vtkCommand::ExitEvent))
{
this->InvokeEvent(vtkCommand::ExitEvent,NULL);
}
else
{
this->TerminateApp();
}
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::UserCallback()
{
this->InvokeEvent(vtkCommand::UserEvent,NULL);
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::StartPickCallback()
{
this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::EndPickCallback()
{
this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::FlyTo(vtkRenderer *ren, double x, double y, double z)
{
double flyFrom[3], flyTo[3];
double d[3], focalPt[3];
int i, j;
flyTo[0]=x; flyTo[1]=y; flyTo[2]=z;
ren->GetActiveCamera()->GetFocalPoint(flyFrom);
for (i=0; i<3; i++)
{
d[i] = flyTo[i] - flyFrom[i];
}
double distance = vtkMath::Normalize(d);
double delta = distance/this->NumberOfFlyFrames;
for (i=1; i<=NumberOfFlyFrames; i++)
{
for (j=0; j<3; j++)
{
focalPt[j] = flyFrom[j] + d[j]*i*delta;
}
ren->GetActiveCamera()->SetFocalPoint(focalPt);
ren->GetActiveCamera()->Dolly(this->Dolly/this->NumberOfFlyFrames + 1.0);
ren->GetActiveCamera()->OrthogonalizeViewUp();
ren->ResetCameraClippingRange();
this->Render();
}
}
//----------------------------------------------------------------------
void vtkRenderWindowInteractor::FlyToImage(vtkRenderer *ren, double x, double y)
{
double flyFrom[3], flyTo[3];
double d[3], focalPt[3], position[3], positionFrom[3];
int i, j;
flyTo[0]=x; flyTo[1]=y;
ren->GetActiveCamera()->GetFocalPoint(flyFrom); flyTo[2] = flyFrom[2];
ren->GetActiveCamera()->GetPosition(positionFrom);
for (i=0; i<2; i++)
{
d[i] = flyTo[i] - flyFrom[i];
}
d[2] = 0.0;
double distance = vtkMath::Normalize(d);
double delta = distance/this->NumberOfFlyFrames;
for (i=1; i<=NumberOfFlyFrames; i++)
{
for (j=0; j<3; j++)
{
focalPt[j] = flyFrom[j] + d[j]*i*delta;
position[j] = positionFrom[j] + d[j]*i*delta;
}
ren->GetActiveCamera()->SetFocalPoint(focalPt);
ren->GetActiveCamera()->SetPosition(position);
ren->GetActiveCamera()->Dolly(this->Dolly/this->NumberOfFlyFrames + 1.0);
ren->ResetCameraClippingRange();
this->Render();
}
}
//----------------------------------------------------------------------------
vtkRenderer* vtkRenderWindowInteractor::FindPokedRenderer(int x,int y)
{
vtkRendererCollection *rc;
vtkRenderer *aren;
vtkRenderer *currentRenderer=NULL, *interactiveren=NULL, *viewportren=NULL;
int numRens, i;
rc = this->RenderWindow->GetRenderers();
numRens = rc->GetNumberOfItems();
for (i = numRens -1; (i >= 0) && !currentRenderer; i--)
{
aren = static_cast<vtkRenderer *>(rc->GetItemAsObject(i));
if (aren->IsInViewport(x,y) && aren->GetInteractive())
{
currentRenderer = aren;
}
if (interactiveren == NULL && aren->GetInteractive())
{
// Save this renderer in case we can't find one in the viewport that
// is interactive.
interactiveren = aren;
}
if (viewportren == NULL && aren->IsInViewport(x, y))
{
// Save this renderer in case we can't find one in the viewport that
// is interactive.
viewportren = aren;
}
}//for all renderers
// We must have a value. If we found an interactive renderer before, that's
// better than a non-interactive renderer.
if ( currentRenderer == NULL )
{
currentRenderer = interactiveren;
}
// We must have a value. If we found a renderer that is in the viewport,
// that is better than any old viewport (but not as good as an interactive
// one).
if ( currentRenderer == NULL )
{
currentRenderer = viewportren;
}
// We must have a value - take anything.
if ( currentRenderer == NULL)
{
aren = rc->GetFirstRenderer();
currentRenderer = aren;
}
return currentRenderer;
}
// Timer methods. There are two basic groups of methods, those for backward
// compatibility (group #1) and those that operate on specific timers (i.e.,
// use timer ids). The first group of methods implicitly assume that there is
// only one timer at a time running. This was okay in the old days of VTK when
// only the interactors used timers. However with the introduction of new 3D
// widgets into VTK multiple timers often run simultaneously.
//
//old-style group #1
int vtkRenderWindowInteractor::CreateTimer(int timerType)
{
int platformTimerId, timerId;
if ( timerType == VTKI_TIMER_FIRST )
{
unsigned long duration = this->TimerDuration;
timerId = vtkTimerId; //just use current id, assume we don't have mutliple timers
platformTimerId = this->InternalCreateTimer(timerId,RepeatingTimer,duration);
if ( 0 == platformTimerId )
{
return 0;
}
(*this->TimerMap)[timerId] = vtkTimerStruct(platformTimerId,RepeatingTimer,duration);
return timerId;
}
else //VTKI_TIMER_UPDATE is just updating last created timer
{
return 1; //do nothing because repeating timer has been created
}
}
//old-style group #1
//just destroy last one created
int vtkRenderWindowInteractor::DestroyTimer()
{
int timerId = vtkTimerId;
vtkTimerIdMapIterator iter = this->TimerMap->find(timerId);
if ( iter != this->TimerMap->end() )
{
this->InternalDestroyTimer((*iter).second.Id);
this->TimerMap->erase(iter);
return 1;
}
return 0;
}
//new-style group #2 returns timer id
int vtkRenderWindowInteractor::CreateRepeatingTimer(unsigned long duration)
{
int timerId = ++vtkTimerId;
int platformTimerId = this->InternalCreateTimer(timerId,RepeatingTimer,duration);
if ( 0 == platformTimerId )
{
return 0;
}
(*this->TimerMap)[timerId] = vtkTimerStruct(platformTimerId,RepeatingTimer,duration);
return timerId;
}
//new-style group #2 returns timer id
int vtkRenderWindowInteractor::CreateOneShotTimer(unsigned long duration)
{
int timerId = ++vtkTimerId;
int platformTimerId = this->InternalCreateTimer(timerId,OneShotTimer,duration);
if ( 0 == platformTimerId )
{
return 0;
}
(*this->TimerMap)[timerId] = vtkTimerStruct(platformTimerId,OneShotTimer,duration);
return timerId;
}
//new-style group #2 returns type (non-zero unless bad timerId)
int vtkRenderWindowInteractor::IsOneShotTimer(int timerId)
{
vtkTimerIdMapIterator iter = this->TimerMap->find(timerId);
if ( iter != this->TimerMap->end() )
{
return ((*iter).second.Type == OneShotTimer);
}
return 0;
}
//new-style group #2 returns duration (non-zero unless bad timerId)
unsigned long vtkRenderWindowInteractor::GetTimerDuration(int timerId)
{
vtkTimerIdMapIterator iter = this->TimerMap->find(timerId);
if ( iter != this->TimerMap->end() )
{
return (*iter).second.Duration;
}
return 0;
}
//new-style group #2 returns non-zero if timer reset
int vtkRenderWindowInteractor::ResetTimer(int timerId)
{
vtkTimerIdMapIterator iter = this->TimerMap->find(timerId);
if ( iter != this->TimerMap->end() )
{
this->InternalDestroyTimer((*iter).second.Id);
int platformTimerId = this->InternalCreateTimer(timerId, (*iter).second.Type,
(*iter).second.Duration);
if ( platformTimerId != 0 )
{
(*iter).second.Id = platformTimerId;
return 1;
}
else
{
this->TimerMap->erase(iter);
}
}
return 0;
}
//new-style group #2 returns non-zero if timer destroyed
int vtkRenderWindowInteractor::DestroyTimer(int timerId)
{
vtkTimerIdMapIterator iter = this->TimerMap->find(timerId);
if ( iter != this->TimerMap->end() )
{
this->InternalDestroyTimer((*iter).second.Id);
this->TimerMap->erase(iter);
return 1;
}
return 0;
}
// Stubbed out dummys
int vtkRenderWindowInteractor::InternalCreateTimer(int vtkNotUsed(timerId), int vtkNotUsed(timerType),
unsigned long vtkNotUsed(duration))
{
return 0;
}
int vtkRenderWindowInteractor::InternalDestroyTimer(int vtkNotUsed(platformTimerId))
{
return 0;
}
// Translate from platformTimerId to the corresponding (VTK) timerId.
// Returns 0 (invalid VTK timerId) if platformTimerId is not found in the map.
// This first stab at an implementation just iterates the map until it finds
// the sought platformTimerId. If performance becomes an issue (lots of timers,
// all firing frequently...) we could speed this up by making a reverse map so
// this method is a quick map lookup.
int vtkRenderWindowInteractor::GetVTKTimerId(int platformTimerId)
{
int timerId = 0;
vtkTimerIdMapIterator iter = this->TimerMap->begin();
for ( ; iter != this->TimerMap->end(); ++iter )
{
if ((*iter).second.Id == platformTimerId)
{
timerId = (*iter).first;
break;
}
}
return timerId;
}
// Access to the static variable
int vtkRenderWindowInteractor::GetCurrentTimerId()
{
return vtkTimerId;
}
//----------------------------------------------------------------------------
void vtkRenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
os << indent << "InteractorStyle: " << this->InteractorStyle << "\n";
os << indent << "RenderWindow: " << this->RenderWindow << "\n";
if ( this->Picker )
{
os << indent << "Picker: " << this->Picker << "\n";
}
else
{
os << indent << "Picker: (none)\n";
}
if ( this->ObserverMediator )
{
os << indent << "Observer Mediator: " << this->ObserverMediator << "\n";
}
else
{
os << indent << "Observer Mediator: (none)\n";
}
os << indent << "LightFollowCamera: " << (this->LightFollowCamera ? "On\n" : "Off\n");
os << indent << "DesiredUpdateRate: " << this->DesiredUpdateRate << "\n";
os << indent << "StillUpdateRate: " << this->StillUpdateRate << "\n";
os << indent << "Initialized: " << this->Initialized << "\n";
os << indent << "Enabled: " << this->Enabled << "\n";
os << indent << "EnableRender: " << this->EnableRender << "\n";
os << indent << "EventPosition: " << "( " << this->EventPosition[0] <<
", " << this->EventPosition[1] << " )\n";
os << indent << "LastEventPosition: " << "( " << this->LastEventPosition[0]
<< ", " << this->LastEventPosition[1] << " )\n";
os << indent << "EventSize: " << "( " << this->EventSize[0] <<
", " << this->EventSize[1] << " )\n";
os << indent << "Viewport Size: " << "( " << this->Size[0] <<
", " << this->Size[1] << " )\n";
os << indent << "Number of Fly Frames: " << this->NumberOfFlyFrames <<"\n";
os << indent << "Dolly: " << this->Dolly <<"\n";
os << indent << "ControlKey: " << this->ControlKey << "\n";
os << indent << "AltKey: " << this->AltKey << "\n";
os << indent << "ShiftKey: " << this->ShiftKey << "\n";
os << indent << "KeyCode: " << this->KeyCode << "\n";
os << indent << "KeySym: " << (this->KeySym ? this->KeySym : "(null)")
<< "\n";
os << indent << "RepeatCount: " << this->RepeatCount << "\n";
os << indent << "Timer Duration: " << this->TimerDuration << "\n";
os << indent << "TimerEventId: " << this->TimerEventId << "\n";
os << indent << "TimerEventType: " << this->TimerEventType << "\n";
os << indent << "TimerEventDuration: " << this->TimerEventDuration << "\n";
os << indent << "TimerEventPlatformId: " << this->TimerEventPlatformId << "\n";
os << indent << "UseTDx: " << this->UseTDx << endl;
}
//----------------------------------------------------------------------------
void vtkRenderWindowInteractor::Initialize()
{
this->Initialized=1;
this->Enable();
this->Render();
}
//----------------------------------------------------------------------------
void vtkRenderWindowInteractor::HideCursor()
{
this->RenderWindow->HideCursor();
}
//----------------------------------------------------------------------------
void vtkRenderWindowInteractor::ShowCursor()
{
this->RenderWindow->ShowCursor();
}
//----------------------------------------------------------------------------
vtkObserverMediator *vtkRenderWindowInteractor::GetObserverMediator()
{
if ( !this->ObserverMediator )
{
this->ObserverMediator = vtkObserverMediator::New();
this->ObserverMediator->SetInteractor(this);
}
return this->ObserverMediator;
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::MouseMoveEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::MouseMoveEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::RightButtonPressEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::RightButtonPressEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::RightButtonReleaseEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::RightButtonReleaseEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::LeftButtonPressEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::LeftButtonPressEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::LeftButtonReleaseEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::LeftButtonReleaseEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::MiddleButtonPressEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::MiddleButtonPressEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::MiddleButtonReleaseEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::MiddleButtonReleaseEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::MouseWheelForwardEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::MouseWheelBackwardEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::ExposeEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::ExposeEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::ConfigureEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::ConfigureEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::EnterEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::EnterEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::LeaveEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::LeaveEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::KeyPressEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::KeyPressEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::KeyReleaseEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::KeyReleaseEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::CharEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::CharEvent, NULL);
}
//------------------------------------------------------------------
void vtkRenderWindowInteractor::ExitEvent()
{
if (!this->Enabled)
{
return;
}
this->InvokeEvent(vtkCommand::ExitEvent, NULL);
}
|