/** * 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()); } }