Ejemplo n.º 1
0
  void printField(VRMLNode node, String fieldName, int indentLevel) {
    String indentStr;

    indentStr = X3DParser.getIndentSpace(indentLevel + 1);
    System.out.print(indentStr);

    int i = node.getFieldIndex(fieldName);
    VRMLFieldData data = ((VRMLNodeType) node).getFieldValue(i);

    if (data.dataType == VRMLFieldData.NODE_DATA) {
      System.out.println("[ " + fieldName + " ]");

      VRMLNode child = data.nodeValue;
      if (child != null) {
        printNodeSub(child, indentLevel + 2);
      }
    } else if (data.dataType == VRMLFieldData.NODE_ARRAY_DATA) {
      System.out.println("[ " + fieldName + " ]");

      VRMLNode[] children = data.nodeArrayValue;
      for (int ind = 0; ind < children.length; ind++) {
        VRMLNode child = children[ind];
        if (child != null) {
          printNodeSub(child, indentLevel + 2);
        }
      }
    } else {
      String dataString = MyX3DUtil.VRMLFieldDataToString(data);

      System.out.println("[ " + fieldName + " ] : " + dataString);
    }
  }
Ejemplo n.º 2
0
  // ---------------------------------------------
  //  check if specified field is MFNode
  // ---------------------------------------------
  public boolean isMFNodeField(VRMLNode node, String fieldName) {
    int i = node.getFieldIndex(fieldName);
    VRMLFieldData data = ((VRMLNodeType) node).getFieldValue(i);

    return (data.dataType == VRMLFieldData.NODE_ARRAY_DATA);
  }
Ejemplo n.º 3
0
 // ---------------------------------------------
 //  get field value of node
 // ---------------------------------------------
 public VRMLFieldData getFieldValue(VRMLNode node, String fieldName) {
   int i = node.getFieldIndex(fieldName);
   VRMLFieldData data = ((VRMLNodeType) node).getFieldValue(i);
   return data;
 }