示例#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());
    }
  }
  /**
   * 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());
    }
  }
  /**
   * 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. Note that for a
    // couple of the fields, if the array size is greater than the number
    // of components in it, we create a temporary array to send. This is
    // a negative hit, but it is very rare that someone will route out of
    // these fields, so we don't consider it to be a major impact compared
    // to the performance of having to reallocate the arrays every time
    // someone sets the values, which will happen much, much more often.

    try {
      switch (srcIndex) {
        case FIELD_BOUNDARY_COLOR:
          destNode.setValue(destIndex, vfBoundaryColor, 4);
          break;

        case FIELD_BOUNDARY_WIDTH:
          destNode.setValue(destIndex, vfBoundaryWidth);
          break;

        case FIELD_BOUNDARY_MODE_S:
          destNode.setValue(destIndex, vfBoundaryModeS);
          break;

        case FIELD_BOUNDARY_MODE_T:
          destNode.setValue(destIndex, vfBoundaryModeT);
          break;

        case FIELD_MAGNIFICATION_FILTER:
          destNode.setValue(destIndex, vfMagnificationFilter);
          break;

        case FIELD_MINIFICATION_FILTER:
          destNode.setValue(destIndex, vfMinificationFilter);
          break;

        case FIELD_GENERATE_MIPMAPS:
          destNode.setValue(destIndex, vfGenerateMipMaps);
          break;

        case FIELD_ANISOTROPIC_MODE:
          destNode.setValue(destIndex, vfAnisotropicMode);
          break;

        case FIELD_ANISOTROPIC_FILTER_DEGREE:
          destNode.setValue(destIndex, vfAnisotropicFilterDegree);
          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 field Value: " + ifve.getMessage());
    }
  }
  /**
   * 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_TEXTURE_PROPERTIES:
          if (pTextureProperties != null) destNode.setValue(destIndex, pTextureProperties);
          else destNode.setValue(destIndex, vfTextureProperties);
          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 field Value: " + ifve.getMessage());
    }
  }
  /**
   * 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_MODE:
          destNode.setValue(destIndex, vfMode, vfMode.length);
          break;

        case FIELD_FUNCTION:
          destNode.setValue(destIndex, vfFunction, vfFunction.length);
          break;

        case FIELD_SOURCE:
          destNode.setValue(destIndex, vfSource, vfSource.length);
          break;

        case FIELD_COLOR:
          destNode.setValue(destIndex, vfColor, 3);
          break;

        case FIELD_TEXTURE:
          VRMLNodeType kids[] = new VRMLNodeType[vfTexture.size()];
          vfTexture.toArray(kids);
          destNode.setValue(destIndex, kids, kids.length);
          break;

        case FIELD_ALPHA:
          destNode.setValue(destIndex, vfAlpha);
          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 field Value: " + ifve.getMessage());
    }
  }
示例#6
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_NAME:
          destNode.setValue(destIndex, vfName);
          break;
        case FIELD_SHAPE:
          if (pShape != null) destNode.setValue(destIndex, pShape);
          else destNode.setValue(destIndex, vfShape);
          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());
    }
  }
  /**
   * 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());
    }
  }