FreeWRL / FreeX3D 4.3.0
EventOutMFRotation.java
1// read in a multi float value from the FreeWRL browser.
2
3package vrml.external.field;
4import vrml.external.Browser;
5import vrml.external.field.FieldTypes;
6import java.util.*;
7
8public class EventOutMFRotation extends EventOutMField {
9 public EventOutMFRotation() { EventType = FieldTypes.MFROTATION; }
10
11 public float[][] getValue() {
12 float [] fvals;
13 float [][] rval;
14 int lines;
15 int rows;
16 int count1;
17 int count2;
18 StringTokenizer tokens;
19 String rep;
20
21 if (RLreturn == null) {
22 rep = Browser.SendEventOut (nodeptr, offset, datasize, datatype, command);
23 } else {
24 rep = RLreturn;
25 }
26 // get the number of lines of code to come back.
27
28 rows = 4;
29
30 tokens = new StringTokenizer (rep);
31
32 //System.out.println ("DEBUG: EventOutMFRotation getValue - rep = " + rep);
33 lines = Integer.valueOf(tokens.nextToken()).intValue();
34 //System.out.println ("DEBUG: read in as a token " + lines);
35
36 rval = new float [lines][rows];
37
38 // now, read in the lines.
39 for (count1=0; count1<lines; count1++) {
40 for (count2=0; count2<rows; count2++) {
41 rval[count1][count2] = Float.valueOf(tokens.nextToken()).floatValue();
42 }
43 }
44
45 // for getSize call
46 sizeof = lines;
47
48 return rval;
49 }
50
51
52 public float[] get1Value(int index) {
53 float all[][] = getValue();
54
55 return all[index];
56 }
57}