1 /**************************************************************************\
2  * Copyright (c) Kongsberg Oil & Gas Technologies AS
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  *
12  * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 \**************************************************************************/
32 
33 /*!
34   \class SoCubeDetail SoCubeDetail.h Inventor/details/SoCubeDetail.h
35   \brief The SoCubeDetail class contains information about the parts of a SoCube shape.
36 
37   \ingroup details
38 
39   Instances of this class are used for storing information about hit
40   points on cone geometry after pick operations, and for storing
41   information returned to tessellation callbacks.
42 
43   The part indices are ordered from 0 to 5 as [ front, back, left,
44   right, top, bottom ].
45 
46   \sa SoCube, SoRayPickAction, SoCallbackAction
47 */
48 
49 /*!
50   \var int SoCubeDetail::part
51   \COININTERNAL
52 */
53 
54 #include <Inventor/details/SoCubeDetail.h>
55 #include <Inventor/SbName.h>
56 
57 SO_DETAIL_SOURCE(SoCubeDetail);
58 
59 /*!
60   Constructor.
61  */
SoCubeDetail(void)62 SoCubeDetail::SoCubeDetail(void)
63   : part(0)
64 {
65 }
66 
67 /*!
68   Destructor.
69  */
~SoCubeDetail()70 SoCubeDetail::~SoCubeDetail()
71 {
72 }
73 
74 // doc in super
75 void
initClass(void)76 SoCubeDetail::initClass(void)
77 {
78   SO_DETAIL_INIT_CLASS(SoCubeDetail, SoDetail);
79 }
80 
81 // doc in super
82 SoDetail *
copy(void) const83 SoCubeDetail::copy(void) const
84 {
85   SoCubeDetail * copy = new SoCubeDetail;
86   copy->part = this->part;
87   return copy;
88 }
89 
90 /*!
91   Set the part of a cube which was selected. A cube has of course six
92   different conceptual parts -- it's sides.
93   */
94 void
setPart(const int partarg)95 SoCubeDetail::setPart(const int partarg)
96 {
97   this->part = partarg;
98 }
99 
100 /*!
101   Returns selected cube part.
102  */
103 int
getPart(void) const104 SoCubeDetail::getPart(void) const
105 {
106   return this->part;
107 }
108