Esempio n. 1
0
  /**
   * Send a routed value from this node to the given destination node. The route should use the
   * appropriate setValue() method of the destination node. It should not attempt to cast the node
   * up to a higher level. Routing should also follow the standard rules for the loop breaking and
   * other appropriate rules for the specification.
   *
   * @param time The time that this route occurred (not necessarily epoch time. Should be treated as
   *     a relative value only)
   * @param srcIndex The index of the field in this node that the value should be sent from
   * @param destNode The node reference that we will be sending the value to
   * @param destIndex The index of the field in the destination node that the value should be sent
   *     to.
   */
  public void sendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) {

    // Simple impl for now.  ignores time and looping

    try {
      switch (srcIndex) {
        case FIELD_CENTER:
          destNode.setValue(destIndex, vfCenter, 3);
          break;
        case FIELD_ROTATION:
          destNode.setValue(destIndex, vfRotation, 4);
          break;
        case FIELD_SCALE:
          destNode.setValue(destIndex, vfScale, 3);
          break;
        case FIELD_SCALE_ORIENTATION:
          destNode.setValue(destIndex, vfScaleOrientation, 4);
          break;
        case FIELD_TRANSLATION:
          destNode.setValue(destIndex, vfTranslation, 3);
          break;
        default:
          super.sendRoute(time, srcIndex, destNode, destIndex);
      }
    } catch (InvalidFieldException ife) {
      System.err.println("sendRoute: No field!" + ife.getFieldName());
    } catch (InvalidFieldValueException ifve) {
      System.err.println("sendRoute: Invalid fieldValue: " + ifve.getMessage());
    }
  }