~ubuntu-branches/ubuntu/oneiric/soqt/oneiric

« back to all changes in this revision

Viewing changes to build/msvc8/src/Inventor/Qt/nodes/Position.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-03-01 11:41:00 UTC
  • mfrom: (1.1.4 upstream) (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090301114100-f4zz3n1oasa52fgk
Tags: 1.4.2~svn20090224-2
* Upload upstream SVN head version containing fixes to build with Coin 3
  (Closes: #515729, #515736, #515742).  Upstream indicated to me that
  SVN is stable enough to release.

* control: Update Standards-Version to 3.8.0; no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************\
2
 
 *
3
 
 *  This file is part of the Coin 3D visualization library.
4
 
 *  Copyright (C) 1998-2005 by Systems in Motion.  All rights reserved.
5
 
 *
6
 
 *  This library is free software; you can redistribute it and/or
7
 
 *  modify it under the terms of the GNU General Public License
8
 
 *  ("GPL") version 2 as published by the Free Software Foundation.
9
 
 *  See the file LICENSE.GPL at the root directory of this source
10
 
 *  distribution for additional information about the GNU GPL.
11
 
 *
12
 
 *  For using Coin with software that can not be combined with the GNU
13
 
 *  GPL, and for taking advantage of the additional benefits of our
14
 
 *  support services, please contact Systems in Motion about acquiring
15
 
 *  a Coin Professional Edition License.
16
 
 *
17
 
 *  See <URL:http://www.coin3d.org/> for more information.
18
 
 *
19
 
 *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
20
 
 *  <URL:http://www.sim.no/>.
21
 
 *
22
 
\**************************************************************************/
23
 
 
24
 
#include <assert.h>
25
 
 
26
 
#include <Inventor/errors/SoDebugError.h>
27
 
#include <Inventor/actions/SoGLRenderAction.h>
28
 
#include <Inventor/actions/SoPickAction.h>
29
 
#include <Inventor/actions/SoRayPickAction.h>
30
 
#include <Inventor/actions/SoGetMatrixAction.h>
31
 
#include <Inventor/elements/SoModelMatrixElement.h>
32
 
#include <Inventor/SoPath.h>
33
 
 
34
 
#include <Inventor/Qt/nodes/SoGuiPane.h>
35
 
#include <Inventor/Qt/nodes/SoGuiPosition.h>
36
 
 
37
 
// *************************************************************************
38
 
 
39
 
SO_NODE_SOURCE(SoGuiPosition);
40
 
 
41
 
void
42
 
SoGuiPosition::initClass(void)
43
 
{
44
 
  SO_NODE_INIT_CLASS(SoGuiPosition, SoTransformation, "Transformation");
45
 
}
46
 
 
47
 
SoGuiPosition::SoGuiPosition(void)
48
 
{
49
 
  SO_NODE_CONSTRUCTOR(SoGuiPosition);
50
 
  SO_NODE_ADD_FIELD(position, (SbVec3f(0.0f, 0.0f, 0.0f)));
51
 
}
52
 
 
53
 
SoGuiPosition::~SoGuiPosition(void)
54
 
{
55
 
}
56
 
 
57
 
void
58
 
SoGuiPosition::doAction(SoAction * action)
59
 
{
60
 
  int i;
61
 
  // SoDebugError::postInfo("SoGuiPosition::doAction", "invoked by %s", action->getTypeId().getName().getString());
62
 
  SoGuiPane * pane = NULL;
63
 
  const SoFullPath * path = (const SoFullPath *) action->getCurPath();
64
 
  for ( i = path->getLength() - 1; (i >= 0) && (pane == NULL); i-- ) {
65
 
    SoNode * node = path->getNode(i);
66
 
    assert(node);
67
 
    if ( node->isOfType(SoGuiPane::getClassTypeId()) ) pane = (SoGuiPane *) node;
68
 
  }
69
 
  if ( pane == NULL ) {
70
 
    SoDebugError::postInfo("SoGuiPosition::GLRender", "SoGuiPosition only works below an SoGuiPane node");
71
 
    return;
72
 
  }
73
 
  pane->moveTo(action->getState(), this->position.getValue());
74
 
}
75
 
 
76
 
void
77
 
SoGuiPosition::GLRender(SoGLRenderAction * action)
78
 
{
79
 
  this->doAction(action);
80
 
}
81
 
 
82
 
void
83
 
SoGuiPosition::pick(SoPickAction * action)
84
 
{
85
 
  this->doAction(action);
86
 
}
87
 
 
88
 
void
89
 
SoGuiPosition::rayPick(SoRayPickAction * action)
90
 
{
91
 
  this->doAction(action);
92
 
}
93
 
 
94
 
void
95
 
SoGuiPosition::getMatrix(SoGetMatrixAction * action)
96
 
{
97
 
  SoDebugError::postInfo("SoGuiPosition::getMatrix", "invoked");
98
 
  int i;
99
 
  SoGuiPane * pane = NULL;
100
 
  const SoFullPath * path = (const SoFullPath *) action->getCurPath();
101
 
  for ( i = path->getLength() - 1; (i >= 0) && (pane == NULL); i-- ) {
102
 
    SoNode * node = path->getNode(i);
103
 
    assert(node);
104
 
    if ( node->isOfType(SoGuiPane::getClassTypeId()) ) pane = (SoGuiPane *) node;
105
 
  }
106
 
  if ( pane == NULL ) {
107
 
    SoDebugError::postInfo("SoGuiPosition::getMatrix", "SoGuiPosition only works below an SoGuiPane node");
108
 
    return;
109
 
  }
110
 
  pane->applyMoveTo(action, this->position.getValue());
111
 
}
112