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 SoDecimationTypeElement Inventor/elements/SoDecimationTypeElement.h
35   \brief The SoDecimationTypeElement class is yet to be documented.
36 
37   \ingroup elements
38 
39   FIXME: write doc.
40 */
41 
42 #include <Inventor/elements/SoDecimationTypeElement.h>
43 #include <cassert>
44 
45 /*!
46   \fn SoDecimationTypeElement::Type
47 
48   FIXME: write doc.
49 */
50 
51 SO_ELEMENT_SOURCE(SoDecimationTypeElement);
52 
53 /*!
54   This static method initializes static data for the
55   SoDecimationTypeElement class.
56 */
57 
58 void
initClass(void)59 SoDecimationTypeElement::initClass(void)
60 {
61   SO_ELEMENT_INIT_CLASS(SoDecimationTypeElement, inherited);
62 }
63 
64 /*!
65   The destructor.
66 */
67 
~SoDecimationTypeElement(void)68 SoDecimationTypeElement::~SoDecimationTypeElement(void)
69 {
70 }
71 
72 //! FIXME: write doc.
73 
74 void
set(SoState * const state,SoNode * const node,const Type type)75 SoDecimationTypeElement::set(SoState * const state,
76                              SoNode * const node,
77                              const Type type)
78 {
79   assert(
80         static_cast<int>(type) >= static_cast<int>(AUTOMATIC)
81         &&
82         static_cast<int>(type) <= static_cast<int>(PERCENTAGE)
83         );
84   SoInt32Element::set(classStackIndex, state, node, type);
85 }
86 
87 //! FIXME: write doc.
88 
89 void
init(SoState * state)90 SoDecimationTypeElement::init(SoState * state)
91 {
92     inherited::init(state);
93     this->data = getDefault();
94 }
95 
96 //! FIXME: write doc.
97 
98 //$ EXPORT INLINE
99 void
set(SoState * const state,const Type type)100 SoDecimationTypeElement::set(SoState * const state, const Type type)
101 {
102   set(state, NULL, type);
103 }
104 
105 //! FIXME: write doc.
106 
107 //$ EXPORT INLINE
108 SoDecimationTypeElement::Type
get(SoState * const state)109 SoDecimationTypeElement::get(SoState * const state)
110 {
111   return static_cast<Type>(SoInt32Element::get(classStackIndex, state));
112 }
113 
114 //! FIXME: write doc.
115 
116 //$ EXPORT INLINE
117 SoDecimationTypeElement::Type
getDefault()118 SoDecimationTypeElement::getDefault()
119 {
120   return AUTOMATIC;
121 }
122