FreeWRL / FreeX3D 4.3.0
ConstMFRotation.java
1//AUTOMATICALLY GENERATED BY genfields.pl.
2//DO NOT EDIT!!!!
3
4package vrml.field;
5import vrml.*;
6import java.io.BufferedReader;
7import java.io.PrintWriter;
8import java.io.IOException;
9
10public class ConstMFRotation extends ConstMField {
11 public ConstMFRotation() {
12 }
13
14 public ConstMFRotation(float[] rotations) {
15 this(rotations.length, rotations);
16 }
17
18 public ConstMFRotation(int size, float[] rotations) {
19 for (int i = 0; i < size; i += 4)
20 __vect.addElement(new ConstSFRotation(rotations[i], rotations[i+1], rotations[i+2], rotations[i+3]));
21 }
22
23 public ConstMFRotation(float[][] rotations) {
24 for (int i = 0; i < rotations.length; i++)
25 __vect.addElement(new ConstSFRotation(rotations[i][0], rotations[i][1], rotations[i][2], rotations[i][3]));
26 }
27
28 public void getValue(float[] rotations) {
29 __updateRead();
30 int size = __vect.size();
31 for (int i = 0; i < size; i++) {
32 ConstSFRotation sfRotation = (ConstSFRotation) __vect.elementAt(i);
33 rotations[4*i+0] = sfRotation.axisX;
34 rotations[4*i+1] = sfRotation.axisY;
35 rotations[4*i+2] = sfRotation.axisZ;
36 rotations[4*i+3] = sfRotation.angle;
37 }
38 }
39
40 public void getValue(float[][] rotations) {
41 __updateRead();
42 int size = __vect.size();
43 for (int i = 0; i < size; i++)
44 ((ConstSFRotation) __vect.elementAt(i)).getValue(rotations[i]);
45 }
46
47 public void get1Value(int index, float[] rotations) {
48 __update1Read(index);
49 ((ConstSFRotation) __vect.elementAt(index)).getValue(rotations);
50 }
51
52 public void get1Value(int index, SFRotation sfRotation) {
53 __update1Read(index);
54 sfRotation.setValue((ConstSFRotation) __vect.elementAt(index));
55 }
56
57 public String toString() {
58 __updateRead();
59 StringBuffer sb = new StringBuffer("[");
60 int size = __vect.size();
61 for (int i = 0; i < size; i++) {
62 if (i > 0) sb.append(", ");
63 sb.append(__vect.elementAt(i));
64 }
65 return sb.append("]").toString();
66 }
67
68 public void __fromPerl(BufferedReader in) throws IOException {
69 __vect.clear();
70 String lenline = in.readLine();
71 //System.out.println ("__fromPerl, read in length as " + lenline);
72 //int len = Integer.parseInt(in.readLine());
73 int len = Integer.parseInt(lenline);
74 for (int i = 0; i < len; i++) {
76 sf.__fromPerl(in);
77 __vect.addElement(sf);
78 }
79 }
80
81 public void __toPerl(PrintWriter out) throws IOException {
82 StringBuffer sb = new StringBuffer("");
83 int size = __vect.size();
84 //out.print(size);
85 for (int i = 0; i < size; i++) {
86 ((ConstSFRotation) __vect.elementAt(i)).__toPerl(out);
87 if (i != (size-1)) out.print (", ");
88 }
89 //out.println();
90 }
91 //public void setOffset(String offs) { this.offset = offs; } //JAS2
92 //public String getOffset() { return this.offset; } //JAS2
93}