/** * Set the fields of the sensor node that has the fields set based on the fields of the passed in * node. This will not copy any children nodes, only the local fields. * * @param node The sensor node to copy info from */ protected void copy(VRMLPickingSensorNodeType node) { super.copy(node); try { int index = node.getFieldIndex("sortOrder"); VRMLFieldData field = node.getFieldValue(index); vfSortOrder = field.stringValue; Integer i = (Integer) sortTypeMap.get(vfSortOrder); sortType = i.intValue(); index = node.getFieldIndex("sortOrder"); field = node.getFieldValue(index); vfIntersectionType = field.stringValue; i = (Integer) sortTypeMap.get(vfIntersectionType); intersectionType = i.intValue(); index = node.getFieldIndex("objectType"); field = node.getFieldValue(index); if (field.numElements != 0) { vfObjectType = new String[field.numElements]; System.arraycopy(field.stringArrayValue, 0, vfObjectType, 0, field.numElements); } } catch (VRMLException ve) { throw new IllegalArgumentException(ve.getMessage()); } }
/** * Set the list of picking targets that this object corresponds to. These can be an array of * strings. * * @param types The list of object type strings to use * @param numValid The number of valid values to read from the array */ public void setObjectType(String[] types, int numValid) { if (vfObjectType.length != numValid) vfObjectType = new String[numValid]; System.arraycopy(types, 0, vfObjectType, 0, numValid); if (!inSetup) { hasChanged[FIELD_OBJECT_TYPE] = true; fireFieldChanged(FIELD_OBJECT_TYPE); } }
/** * Process the picked geometry output. * * @param numPicks The number of items picked in the array * @param geom The geometry that was picked */ private void processPickedGeometry(int numPicks, VRMLNodeType[] geom) { if ((vfPickedGeometry == null) || (vfPickedGeometry.length < numPicks)) vfPickedGeometry = new VRMLNodeType[numPicks]; System.arraycopy(geom, 0, vfPickedGeometry, 0, numPicks); numPickedGeometry = numPicks; hasChanged[FIELD_PICKED_GEOMETRY] = true; fireFieldChanged(FIELD_PICKED_GEOMETRY); }
/** * Construct a new instance of this node based on the details from the given node. If the node is * not the same type, an exception will be thrown. * * @param node The node to copy * @throws IllegalArgumentException Incorrect Node Type */ protected BaseMultiTexture(VRMLNodeType node) { this(); checkNodeType(node); try { int index = node.getFieldIndex("mode"); VRMLFieldData field = node.getFieldValue(index); if (field.numElements != 0) { vfMode = new String[field.numElements]; System.arraycopy(field.stringArrayValue, 0, vfMode, 0, field.numElements); } index = node.getFieldIndex("function"); field = node.getFieldValue(index); if (field.numElements != 0) { vfFunction = new String[field.numElements]; System.arraycopy(field.stringArrayValue, 0, vfFunction, 0, field.numElements); } index = node.getFieldIndex("source"); field = node.getFieldValue(index); if (field.numElements != 0) { vfSource = new String[field.numElements]; System.arraycopy(field.stringArrayValue, 0, vfSource, 0, field.numElements); } index = node.getFieldIndex("color"); field = node.getFieldValue(index); vfColor[0] = field.floatArrayValue[0]; vfColor[1] = field.floatArrayValue[1]; vfColor[2] = field.floatArrayValue[2]; index = node.getFieldIndex("alpha"); field = node.getFieldValue(index); vfAlpha = field.floatValue; } catch (VRMLException ve) { throw new IllegalArgumentException(ve.getMessage()); } }
/** * Fetch the number of object type values in use currently. * * @param val An array to copy the values to */ public void getObjectType(String[] val) { System.arraycopy(vfObjectType, 0, val, 0, vfObjectType.length); }