Debian Codegraph @

lib/database/src/so/fields/SoMFVec2f.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990,91 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Classes:
46 | SoMFVec2f
47 |
48 | Author(s) : Paul S. Strauss
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #include <Inventor/fields/SoMFVec2f.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoMFVec2f.h`/
55 #include <cstdlib>
56
57 //////////////////////////////////////////////////////////////////////////////
58 //
59 // SoMFVec2f class
60 //
61 //////////////////////////////////////////////////////////////////////////////
62
63 // Use standard definitions of all basic methods
64 SO_MFIELD_SOURCE_MALLOCcxx . . $ `lib/database/include/Inventor/fields/SoSubField.h:779:9`!(SoMFVec2f, SbVec2f, const SbVec2f &);
65
66 ////////////////////////////////////////////////////////////////////////
67 //
68 // Description:
69 // Sets values from array of arrays of 2 floats. This can be useful
70 // in some applications that have vectors stored in this manner and
71 // want to keep them that way for efficiency.
72 //
73 // Use: public
74
75 void
76 SoMFVec2fcxx . . $ SoMFVec2f#::setValuescxx . . $ SoMFVec2f#setValues(d739a7f2038be755).(int start, // Starting index
77 int num, // Number of values to set
78 const float xy[][2]) // Array of vector values
79 //
80 ////////////////////////////////////////////////////////////////////////
81 {
82 int newNum = start + num;
83 int i;
84
85 if (newNum > getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).())
86 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(newNum);
87
88 for (i = 0; i < num; i++)
89 valuescxx . . $ SoMFVec2f#values.[start + i].setValuecxx . . $ SbVec2f#setValue(69f5e3594d3b70e6).(xy[i]);
90
91 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).();
92 }
93
94 ////////////////////////////////////////////////////////////////////////
95 //
96 // Description:
97 // Sets one vector value from 2 separate floats. (Convenience function)
98 //
99 // Use: public
100
101 void
102 SoMFVec2fcxx . . $ SoMFVec2f#::set1Valuecxx . . $ SoMFVec2f#set1Value(3b3943b4e4191a93).(int index, float x, float y)
103 //
104 ////////////////////////////////////////////////////////////////////////
105 {
106 set1Valuecxx . . $ SoMFVec2f#set1Value(5a3dc9e58b01b916).(index, SbVec2fcxx . . $ SbVec2f#SbVec2f(5102ef758adc0ae7).(x, y));
107 }
108
109 ////////////////////////////////////////////////////////////////////////
110 //
111 // Description:
112 // Sets one vector value from an array of 2 floats. (Convenience function)
113 //
114 // Use: public
115
116 void
117 SoMFVec2fcxx . . $ SoMFVec2f#::set1Valuecxx . . $ SoMFVec2f#set1Value(cec8aedf3e6a9b90).(int index, const float xy[2])
118 //
119 ////////////////////////////////////////////////////////////////////////
120 {
121 set1Valuecxx . . $ SoMFVec2f#set1Value(5a3dc9e58b01b916).(index, SbVec2fcxx . . $ SbVec2f#SbVec2f(de58861cad56015a).(xy));
122 }
123
124 ////////////////////////////////////////////////////////////////////////
125 //
126 // Description:
127 // Sets to one vector value from 2 separate floats. (Convenience function)
128 //
129 // Use: public
130
131 void
132 SoMFVec2fcxx . . $ SoMFVec2f#::setValuecxx . . $ SoMFVec2f#setValue(5102ef758adc0ae7).(float x, float y)
133 //
134 ////////////////////////////////////////////////////////////////////////
135 {
136 setValuecxx . . $ SoMFVec2f#setValue(fd202e5153a1464e).(SbVec2fcxx . . $ SbVec2f#SbVec2f(5102ef758adc0ae7).(x, y));
137 }
138
139 ////////////////////////////////////////////////////////////////////////
140 //
141 // Description:
142 // Sets to one vector value from array of 2 floats. (Convenience function)
143 //
144 // Use: public
145
146 void
147 SoMFVec2fcxx . . $ SoMFVec2f#::setValuecxx . . $ SoMFVec2f#setValue(de58861cad56015a).(const float xy[2])
148 //
149 ////////////////////////////////////////////////////////////////////////
150 {
151 setValuecxx . . $ SoMFVec2f#setValue(fd202e5153a1464e).(SbVec2fcxx . . $ SbVec2f#SbVec2f(de58861cad56015a).(xy));
152 }
153
154 ////////////////////////////////////////////////////////////////////////
155 //
156 // Description:
157 // Reads one (indexed) value from file. Returns FALSE on error.
158 //
159 // Use: private
160
161 SbBoolcxx . . $ SbBool#
162 SoMFVec2fcxx . . $ SoMFVec2f#::read1Valuecxx . . $ SoMFVec2f#read1Value(b57125c54eeea43).(SoInputcxx . . $ SoInput# *in, int index)
163 //
164 ////////////////////////////////////////////////////////////////////////
165 {
166 return (in->readcxx . . $ SoInput#read(5ae595678d7a9e77).(valuescxx . . $ SoMFVec2f#values.[index][cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0]) &&
167 in->readcxx . . $ SoInput#read(5ae595678d7a9e77).(valuescxx . . $ SoMFVec2f#values.[index][cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1]));
168 }
169
170 ////////////////////////////////////////////////////////////////////////
171 //
172 // Description:
173 // Writes one (indexed) value to file.
174 //
175 // Use: private
176
177 void
178 SoMFVec2fcxx . . $ SoMFVec2f#::write1Valuecxx . . $ SoMFVec2f#write1Value(73cc401f7e0a390c).(SoOutputcxx . . $ SoOutput# *out, int index) const
179 //
180 ////////////////////////////////////////////////////////////////////////
181 {
182 out->writecxx . . $ SoOutput#write(9364e6e7bff7660).(valuescxx . . $ SoMFVec2f#values.[index][cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).0]);
183
184 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).())
185 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
186
187 out->writecxx . . $ SoOutput#write(9364e6e7bff7660).(valuescxx . . $ SoMFVec2f#values.[index][cxx . . $ SbVec2f#`operator[]`(5dbdaf238659ae67).1]);
188 }
189
190 ////////////////////////////////////////////////////////////////////////
191 //
192 // Description:
193 // Writes array of binary values to file as one chunk.
194 //
195 // Use: private
196
197 void
198 SoMFVec2fcxx . . $ SoMFVec2f#::writeBinaryValuescxx . . $ SoMFVec2f#writeBinaryValues(58762e0f79576b7c).(SoOutputcxx . . $ SoOutput# *out) const
199
200 //
201 ////////////////////////////////////////////////////////////////////////
202 {
203 out->writeBinaryArraycxx . . $ SoOutput#writeBinaryArray(119c4c84b133c40b).((float *) valuescxx . . $ SoMFVec2f#values., 2 * numcxx . . $ SoMField#num.);
204 }
205
206
207 ////////////////////////////////////////////////////////////////////////
208 //
209 // Description:
210 // Reads array of binary values from file as one chunk.
211 //
212 // Use: private
213
214 SbBoolcxx . . $ SbBool#
215 SoMFVec2fcxx . . $ SoMFVec2f#::readBinaryValuescxx . . $ SoMFVec2f#readBinaryValues(b57125c54eeea43).(SoInputcxx . . $ SoInput# *in, int numToRead)
216 //
217 ////////////////////////////////////////////////////////////////////////
218 {
219 return (in->readBinaryArraycxx . . $ SoInput#readBinaryArray(6ff0db6c2eaac5cf).((float *) valuescxx . . $ SoMFVec2f#values., 2 * numToRead));
220 }