FreeWRL/FreeX3D  3.0.0
EventOutMFVec3f.java
1 // read in a multi float value from the FreeWRL browser.
2 
3 package vrml.external.field;
6 import java.util.*;
7 
8 public class EventOutMFVec3f extends EventOutMField {
9  public EventOutMFVec3f() { EventType = FieldTypes.MFVEC3F; }
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 = 3;
29 
30  tokens = new StringTokenizer (rep);
31 
32  //System.out.println ("DEBUG: EventOutMFVec3f 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][3];
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  // for getSize call
45  sizeof = lines;
46  return rval;
47  }
48 
49 
50  public float[] get1Value(int index) {
51  float all[][] = getValue();
52 
53  return all[index];
54  }
55 }