1377 SoCamera *cam = getCamera();
1378 const SoType type(ev->getTypeId());
1380 if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
1381 SoMouseButtonEvent * me = (SoMouseButtonEvent *) ev;
1383 if (currentState == ANIMATION || currentState == REVERSED_ANIMATION
1384 || currentState == PAUSED_ANIMATION) {
1385 switch (me->getButton()) {
1386 case SoMouseButtonEvent::BUTTON4:
1387 if (me->getState() == SoButtonEvent::DOWN) {
1388 if (cam->isOfType(SoPerspectiveCamera::getClassTypeId())) {
1390 ((SoPerspectiveCamera *) cam)->heightAngle.getValue();
1391 ((SoPerspectiveCamera *) cam)->heightAngle = hAngle
1394 }
else if (cam->isOfType(
1395 SoOrthographicCamera::getClassTypeId())) {
1397 ((SoOrthographicCamera *) cam)->height.getValue();
1398 ((SoOrthographicCamera *) cam)->height = height + 5;
1403 case SoMouseButtonEvent::BUTTON5:
1404 if (me->getState() == SoButtonEvent::DOWN) {
1405 if (cam->isOfType(SoPerspectiveCamera::getClassTypeId())) {
1407 ((SoPerspectiveCamera *) cam)->heightAngle.getValue();
1409 ((SoPerspectiveCamera *) cam)->heightAngle = hAngle
1412 }
else if (cam->isOfType(
1413 SoOrthographicCamera::getClassTypeId())) {
1415 ((SoOrthographicCamera *) cam)->height.getValue();
1417 ((SoOrthographicCamera *) cam)->height = height - 5;
1426 if (currentState == GENERAL) {
1431 if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
1432 SoKeyboardEvent * ke = (SoKeyboardEvent *) ev;
1434 if (SoKeyboardEvent::isKeyPressEvent(ev, ke->getKey())) {
1435 switch (ke->getKey()) {
1436 case SoKeyboardEvent::LEFT_SHIFT:
1437 this->lshiftdown =
true;
1439 case SoKeyboardEvent::RIGHT_SHIFT:
1440 this->rshiftdown =
true;
1442 case SoKeyboardEvent::LEFT_CONTROL:
1443 this->lctrldown =
true;
1445 case SoKeyboardEvent::RIGHT_CONTROL:
1446 this->rctrldown =
true;
1448 case SoKeyboardEvent::SPACE:
1449 if (currentState == ANIMATION
1450 || currentState == REVERSED_ANIMATION) {
1451 beforePausing = currentState;
1452 currentState = PAUSED_ANIMATION;
1453 if (animateSensor->isScheduled())
1454 animateSensor->unschedule();
1456 }
else if (currentState == PAUSED_ANIMATION) {
1458 if ((beforePausing == ANIMATION
1460 < (
int) refParticleTrajectory.size() - 1)
1461 || (beforePausing == REVERSED_ANIMATION
1462 && refParticleIdx > 0)) {
1463 currentState = beforePausing;
1464 animateRefParticle();
1470 case SoKeyboardEvent::ESCAPE:
1471 if (currentState == ANIMATION
1472 || currentState == REVERSED_ANIMATION
1473 || currentState == PAUSED_ANIMATION) {
1475 if (animateSensor->isScheduled())
1476 animateSensor->unschedule();
1477 currentState = prevState;
1478 refParticleIdx = prevRefIdx;
1479 setSuperimpositionEnabled(superimposition,
FALSE);
1484 if (currentState == VIEWPOINT) {
1485 setSuperimpositionEnabled(superimposition,
TRUE);
1486 axisSwitch->whichChild.setValue(SO_SWITCH_NONE);
1487 animSpeedOutlineSwitch->whichChild.setValue(
1489 animSpeedSwitch->whichChild.setValue(SO_SWITCH_NONE);
1497 case SoKeyboardEvent::DELETE:
1498 if (viewPtList.size()
1499 && (currentState != ANIMATION
1500 || currentState != REVERSED_ANIMATION
1501 || currentState != PAUSED_ANIMATION)) {
1502 String dialogName = (
char *)
"Delete Viewpoint";
1503 std::string msg =
"Are you sure you want to delete current viewpoint?";
1508 case SoKeyboardEvent::LEFT_ARROW:
1509 switch (currentState) {
1511 if ((this->lshiftdown) || (this->rshiftdown)){
1512 refParticleIdx -= step;
1515 else if ((this->lctrldown) || (this->rctrldown)){
1516 if (SoXtExaminerViewer::isAnimating())
1518 prevState = currentState;
1519 currentState = ROTATING;
1520 animateBtwPtsPeriod = 0.08f;
1532 if (SoXtExaminerViewer::isAnimating())
1534 prevState = currentState;
1535 currentState = ROTATING;
1536 animateBtwPtsPeriod = 0.08f;
1551 case REVERSED_ANIMATION:
1554 case PAUSED_ANIMATION:
1556 setStartingPtForAnimation();
1557 cam->position = myCam->position;
1561 if ((!this->lshiftdown) && (!this->rshiftdown)) {
1564 this->bottomWheelMotion(
1565 this->getBottomWheelValue() + 0.1f);
1575 SoDebugError::post(
"G4OpenInventorXtExaminerViewer::processSoEvent",
1576 "Unhandled viewer state");
1581 case SoKeyboardEvent::RIGHT_ARROW:
1582 switch(currentState){
1584 if ((this->lshiftdown) || (this->rshiftdown)){
1585 refParticleIdx += step;
1588 else if ((this->lctrldown) || (this->rctrldown)){
1589 if (SoXtExaminerViewer::isAnimating())
1591 prevState = currentState;
1592 currentState = ROTATING;
1593 animateBtwPtsPeriod = 0.08f;
1603 if (SoXtExaminerViewer::isAnimating())
1605 prevState = currentState;
1606 currentState = ROTATING;
1607 animateBtwPtsPeriod = 0.08f;
1619 case REVERSED_ANIMATION:
1622 case PAUSED_ANIMATION:
1624 setStartingPtForAnimation();
1625 cam->position = myCam->position;
1629 if ((!this->lshiftdown) && (!this->rshiftdown)) {
1632 this->bottomWheelMotion(
1633 this->getBottomWheelValue() - 0.1f);
1642 SoDebugError::post(
"G4OpenInventorXtExaminerViewer::processSoEvent",
1643 "Unhandled viewer state");
1648 case SoKeyboardEvent::DOWN_ARROW:
1649 switch(currentState){
1652 if ((this->lshiftdown) || (this->rshiftdown)){
1653 refParticleIdx -= step;
1657 if (SoXtExaminerViewer::isAnimating())
1659 prevState = currentState;
1660 currentState = ROTATING;
1661 animateBtwPtsPeriod = 0.08f;
1674 case REVERSED_ANIMATION:
1677 case PAUSED_ANIMATION:
1679 setStartingPtForAnimation();
1680 cam->position = myCam->position;
1686 if ((!this->lshiftdown) && (!this->rshiftdown)) {
1687 this->leftWheelMotion(this->getLeftWheelValue() - 0.1f);
1696 SoDebugError::post(
"G4OpenInventorXtExaminerViewer::processSoEvent",
1697 "Unhandled viewer state");
1702 case SoKeyboardEvent::UP_ARROW:
1703 switch(currentState){
1705 if ((this->lshiftdown) || (this->rshiftdown)){
1706 refParticleIdx -= step;
1710 if (SoXtExaminerViewer::isAnimating())
1712 prevState = currentState;
1713 currentState = ROTATING;
1714 animateBtwPtsPeriod = 0.08f;
1727 case REVERSED_ANIMATION:
1730 case PAUSED_ANIMATION:
1732 setStartingPtForAnimation();
1733 cam->position = myCam->position;
1739 if ((!this->lshiftdown) && (!this->rshiftdown)) {
1740 this->leftWheelMotion(this->getLeftWheelValue() + 0.1f);
1749 SoDebugError::post(
"G4OpenInventorXtExaminerViewer::processSoEvent",
1750 "Unhandled viewer state");
1755 case SoKeyboardEvent::PAGE_UP:
1756 switch(currentState){
1758 if (step < (
int) refParticleTrajectory.size() / 5)
1769 case REVERSED_ANIMATION:
1770 if(!animateSensor->isScheduled()){
1771 currentState = ANIMATION;
1773 < (
int) refParticleTrajectory.size() - 1) {
1777 animateRefParticle();
1786 case PAUSED_ANIMATION:
1791 if (beforePausing == ANIMATION) {
1796 beforePausing = ANIMATION;
1806 case SoKeyboardEvent::PAGE_DOWN:
1807 switch(currentState){
1813 if(!animateSensor->isScheduled()){
1814 currentState = REVERSED_ANIMATION;
1815 if (refParticleIdx > 1) {
1819 animateRefParticle();
1828 case REVERSED_ANIMATION:
1831 if (maxSpeed < -0.8)
1835 case PAUSED_ANIMATION:
1837 if (maxSpeed < -0.8)
1839 if (beforePausing == REVERSED_ANIMATION) {
1844 beforePausing = REVERSED_ANIMATION;
1854 case SoKeyboardEvent::E:
1855 this->escapeCallback(this->examinerObject);
1862 if (SoKeyboardEvent::isKeyReleaseEvent(ev, ke->getKey())) {
1863 switch (ke->getKey()) {
1864 case SoKeyboardEvent::LEFT_SHIFT:
1865 this->lshiftdown =
false;
1867 case SoKeyboardEvent::RIGHT_SHIFT:
1868 this->rshiftdown =
false;
1870 case SoKeyboardEvent::LEFT_CONTROL:
1871 this->lctrldown =
false;
1873 case SoKeyboardEvent::RIGHT_CONTROL:
1874 this->rctrldown =
false;
1882 if (currentState == ANIMATION || currentState == REVERSED_ANIMATION
1883 || currentState == ROTATING)
1886 return SoXtExaminerViewer::processSoEvent(ev);
#define SPEED_INDICATOR_STEP
void moveCamera(float dist=0, bool lookdown=false)
void warningMsgDialog(std::string, String, XtCallbackProc)
#define MAX_SPEED_INDICATOR