FreeWRL / FreeX3D 4.3.0
MFRotation.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 MFRotation extends MField {
11 public MFRotation() {
12 }
13
14 public MFRotation(float[] rotations) {
15 this(rotations.length, rotations);
16 }
17
18 public MFRotation(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 MFRotation(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 void setValue(float[] rotations) {
58 setValue(rotations.length, rotations);
59 }
60
61 public void setValue(int size, float[] rotations) {
62 __vect.clear();
63 for (int i = 0; i < size; i += 4)
64 __vect.addElement(new ConstSFRotation(rotations[i], rotations[i+1], rotations[i+2], rotations[i+3]));
65 __updateWrite();
66 }
67
68 public void set1Value(int index, float axisX, float axisY, float axisZ, float angle) {
69 __set1Value(index, new ConstSFRotation(axisX, axisY, axisZ, angle));
70 }
71
72 public void set1Value(int index, SFRotation sfRotation) {
73 sfRotation.__updateRead();
74 __set1Value(index, new ConstSFRotation(sfRotation.axisX, sfRotation.axisY, sfRotation.axisZ, sfRotation.angle));
75 }
76
77 public void set1Value(int index, ConstSFRotation sfRotation) {
78 __set1Value(index, sfRotation);
79 }
80
81 public void addValue(float axisX, float axisY, float axisZ, float angle) {
82 __addValue(new ConstSFRotation(axisX, axisY, axisZ, angle));
83 }
84
85 public void addValue(SFRotation sfRotation) {
86 sfRotation.__updateRead();
87 __addValue(new ConstSFRotation(sfRotation.axisX, sfRotation.axisY, sfRotation.axisZ, sfRotation.angle));
88 }
89
90 public void addValue(ConstSFRotation sfRotation) {
91 __addValue(sfRotation);
92 }
93
94 public void insertValue(int index, float axisX, float axisY, float axisZ, float angle) {
95 __insertValue(index, new ConstSFRotation(axisX, axisY, axisZ, angle));
96 }
97
98 public void insertValue(int index, SFRotation sfRotation) {
99 sfRotation.__updateRead();
100 __insertValue(index, new ConstSFRotation(sfRotation.axisX, sfRotation.axisY, sfRotation.axisZ, sfRotation.angle));
101 }
102
103 public void insertValue(int index, ConstSFRotation sfRotation) {
104 __insertValue(index, sfRotation);
105 }
106
107 public String toString() {
108 __updateRead();
109 StringBuffer sb = new StringBuffer("[");
110 int size = __vect.size();
111 for (int i = 0; i < size; i++) {
112 if (i > 0) sb.append(", ");
113 sb.append(__vect.elementAt(i));
114 }
115 return sb.append("]").toString();
116 }
117
118 public void __fromPerl(BufferedReader in) throws IOException {
119 __vect.clear();
120 String lenline = in.readLine();
121 //System.out.println ("__fromPerl, read in length as " + lenline);
122 //int len = Integer.parseInt(in.readLine());
123 int len = Integer.parseInt(lenline);
124 for (int i = 0; i < len; i++) {
126 sf.__fromPerl(in);
127 __vect.addElement(sf);
128 }
129 }
130
131 public void __toPerl(PrintWriter out) throws IOException {
132 StringBuffer sb = new StringBuffer("");
133 int size = __vect.size();
134 //out.print(size);
135 for (int i = 0; i < size; i++) {
136 ((ConstSFRotation) __vect.elementAt(i)).__toPerl(out);
137 if (i != (size-1)) out.print (", ");
138 }
139 //out.println();
140 }
141 //public void setOffset(String offs) { this.offset = offs; } //JAS2
142 //public String getOffset() { return this.offset; } //JAS2
143}