예제 #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_PICKING_GEOMETRY:
          destNode.setValue(destIndex, vfPickingGeometry);
          break;

        case FIELD_PICK_TARGET:
          destNode.setValue(destIndex, vfPickTarget, vfPickTarget.length);
          break;

        case FIELD_PICKED_GEOMETRY:
          destNode.setValue(destIndex, vfPickedGeometry, numPickedGeometry);
          break;

        case FIELD_OBJECT_TYPE:
          destNode.setValue(destIndex, vfObjectType, vfObjectType.length);
          break;

        default:
          super.sendRoute(time, srcIndex, destNode, destIndex);
      }
    } catch (InvalidFieldException ife) {
      System.err.println("BasePickingNode.sendRoute: No field! " + srcIndex);
      ife.printStackTrace();
    } catch (InvalidFieldValueException ifve) {
      System.err.println("BasePickingNode.sendRoute: Invalid field value: " + ifve.getMessage());
    }
  }
예제 #2
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_ROTATION_CHANGED:
          destNode.setValue(destIndex, vfRotationChanged, 4);
          break;

        case FIELD_OFFSET:
          destNode.setValue(destIndex, vfOffset, 4);
          break;

        default:
          super.sendRoute(time, srcIndex, destNode, destIndex);
      }
    } catch (InvalidFieldException ife) {
      System.err.println("BaseSphereSensor.sendRoute: No field! " + srcIndex);
      ife.printStackTrace();
    } catch (InvalidFieldValueException ifve) {
      System.err.println("BaseSphereSensor.sendRoute: Invalid field value: " + ifve.getMessage());
    }
  }