⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configcontainer.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
		cs.targetObject = cs.j3dSensor ;	    }	}	// Iterate through the PhysicalEnvironments and process the devices.	if (p != null) {	    i = p.iterator() ;	    while (i.hasNext())		((ConfigPhysicalEnvironment)i.next()).processDevices() ;	}    }    // Process config view platforms into Java 3D viewing platforms.    private void processViewPlatforms(Collection c, int numTransforms) {	Iterator i = c.iterator() ;	while (i.hasNext()) {	    ConfigViewPlatform cvp = (ConfigViewPlatform)i.next() ;	    cvp.targetObject = cvp.createViewingPlatform(numTransforms) ;	}    }    // Process the configured view platform behaviors.    private void processViewPlatformBehaviors(Collection behaviors,					      Collection viewPlatforms,					      boolean attach) {	Iterator i = behaviors.iterator() ;	while (i.hasNext()) {	    ConfigViewPlatformBehavior b =		(ConfigViewPlatformBehavior)i.next() ;	    b.targetObject = b.createViewPlatformBehavior() ;	}	// Process properties only after all behaviors are instantiated.	i = behaviors.iterator() ;	while (i.hasNext())	    ((ConfigViewPlatformBehavior)i.next()).processProperties() ;	// Attach behaviors to platforms after properties processed.	if (attach && viewPlatforms != null) {	    i = viewPlatforms.iterator() ;	    while (i.hasNext())		((ConfigViewPlatform)i.next()).processBehavior() ;	}    }    // Process generic objects.     private void processGenericObjects(Collection objects) {	Iterator i = objects.iterator() ;	while (i.hasNext()) {	    ConfigObject o = (ConfigObject)i.next() ;	    o.targetObject = o.createTargetObject() ;	}	// Process properties only after all target objects are instantiated.	i = objects.iterator() ;	while (i.hasNext()) ((ConfigObject)i.next()).processProperties() ;    }    // Returns a read-only Set containing all unique Java 3D objects of the    // specified base class.    private ReadOnlySet createSet(String baseName) {	Collection c = findConfigObjects(baseName, true) ;	if (c == null || c.size() == 0)	    return null ;	Iterator i = c.iterator() ;	ArrayList l = new ArrayList() ;	while (i.hasNext()) l.add(((ConfigObject)i.next()).targetObject) ;	return new ReadOnlySet(l) ;    }    // Returns a read-only Map that maps all names in the specified base    // class, including aliases, to their corresponding Java 3D objects.    private ReadOnlyMap createMap(String baseName) {	Collection c = findConfigObjects(baseName, false) ;	if (c == null || c.size() == 0)	    return null ;	Iterator i = c.iterator() ;	HashMap m = new HashMap() ;	while (i.hasNext()) {	    ConfigObject co = (ConfigObject)i.next() ;	    if (co.isAlias)		m.put(co.instanceName, co.original.targetObject) ;	    else		m.put(co.instanceName, co.targetObject) ;	}	return new ReadOnlyMap(m) ;    }    /**     * Returns a read-only Set of all configured PhysicalBody instances in the     * order they were defined in the configuration file.     *     * PhysicalBody instances are created with the following command:<p>     * <blockquote>     * (NewPhysicalBody <i>&lt;instance name&gt;</i>     * [Alias <i>&lt;alias name&gt;</i>])     * </blockquote>     *      * The PhysicalBody is configured through the following command:<p>     * <blockquote>     * (PhysicalBodyProperty <i>&lt;instance name&gt;     * &lt;property name&gt; &lt;property value&gt;</i>)     * </blockquote>     *      * @return read-only Set of all unique instances, or null     */    public Set getPhysicalBodies() {	if (bodies != null) return bodies ;	bodies = createSet("PhysicalBody") ;	return bodies ;    }    /**     * Returns a read-only Map that maps PhysicalBody names to instances.     * Names may be aliases and if so will map to the original instances.     *      * @return read-only Map from names to PhysicalBody instances, or null if     *  no instances     */    public Map getNamedPhysicalBodies() {	if (bodyMap != null) return bodyMap ;	bodyMap = createMap("PhysicalBody") ;	return bodyMap ;    }    /**     * Returns a read-only Set of all configured PhysicalEnvironment instances     * in the order they were defined in the configuration file.<p>     *      * PhysicalEnvironment instances are created with the following command:<p>     * <blockquote>     * (NewPhysicalEnvironment <i>&lt;instance name&gt;</i>     * [Alias <i>&lt;alias name&gt;</i>])     * </blockquote>     *      * The PhysicalEnvironment is configured through the following command:<p>     * <blockquote>     * (PhysicalEnvironmentProperty <i>&lt;instance name&gt;     * &lt;property name&gt; &lt;property value&gt;</i>)     * </blockquote>     *      * @return read-only Set of all unique instances, or null     */    public Set getPhysicalEnvironments() {	if (environments != null) return environments ;	environments = createSet("PhysicalEnvironment") ;	return environments ;    }    /**     * Returns a read-only Map that maps PhysicalEnvironment names to     * instances.  Names may be aliases and if so will map to the original     * instances.     *      * @return read-only Map from names to PhysicalEnvironment instances, or     *  null if no instances     */    public Map getNamedPhysicalEnvironments() {	if (environmentMap != null) return environmentMap ;	environmentMap = createMap("PhysicalEnvironment") ;	return environmentMap ;    }    /**     * Returns a read-only Set of all configured Viewer instances in the order     * they were defined in the configuration file.  The Viewers will have     * incorporated any PhysicalEnvironment and PhysicalBody objects specfied     * for them in the configuration file, and will be attached to any     * ViewingPlatforms specified for them.<p>     *      * Viewer instances are created with the following command:<p>     * <blockquote>     * (NewView <i>&lt;instance name&gt;</i> [Alias <i>&lt;alias name&gt;</i>])     * </blockquote>     *      * The Viewer is configured through the following command:<p>     * <blockquote>     * (ViewProperty <i>&lt;instance name&gt;     * &lt;property name&gt; &lt;property value&gt;</i>)     * </blockquote>     *     * @return read-only Set of all unique instances, or null     */    public Set getViewers() {	if (viewers != null) return viewers ;	viewers = createSet("View") ;	return viewers ;    }    /**     * Returns a read-only Map that maps Viewer names to instances.     * Names may be aliases and if so will map to the original instances.     * The Viewers will have incorporated any PhysicalEnvironment and     * PhysicalBody objects specfied for them in the configuration file, and     * will be attached to any ViewingPlatforms specified for them.<p>     *      * @return read-only Map from names to Viewer instances, or     *  null if no instances     */    public Map getNamedViewers() {	if (viewerMap != null) return viewerMap ;	viewerMap = createMap("View") ;	return viewerMap ;    }    /**     * Returns a read-only Set of all configured InputDevice instances in the     * order they were defined in the configuration file.  All InputDevice     * instances in the set are initialized and registered with any     * PhysicalEnvironments that reference them.<p>     *     * InputDevice instances are created with the following command:<p>     * <blockquote>     * (NewDevice <i>&lt;instanceName&gt; &lt;className&gt;</i>     * [Alias <i>&lt;alias name&gt;</i>])     * </blockquote>     *      * <i>className</i> must be the fully-qualified name of a class that     * implements the InputDevice interface.  The implementation     * must provide a parameterless constructor.<p>     *     * The InputDevice is configured through the DeviceProperty command:<p>     * <blockquote>     * (DeviceProperty <i>&lt;instanceName&gt; &lt;propertyName&gt;     *  &lt;arg0&gt; ... &lt;argn&gt;</i>)     * </blockquote>     *      * <i>propertyName</i> must be the name of a input device method that     * takes an array of Objects as its only parameter; the array is populated     * with the values of <i>arg0</i> through <i>argn</i> when the method is     * invoked to set the property.  These additional requirements for     * configurable input devices can usually be fulfilled by extending or     * wrapping available InputDevice implementations.     *      * @return read-only Set of all unique instances, or null     */    public Set getInputDevices() {	if (devices != null) return devices ;	devices = createSet("Device") ;	return devices ;    }    /**     * Returns a read-only Map that maps InputDevice names to instances.     * Names may be aliases and if so will map to the original instances.  All     * InputDevice instances in the map are initialized and registered with     * any PhysicalEnvironments that reference them.     *      * @return read-only Map from names to InputDevice instances, or     *  null if no instances     * @see #getInputDevices     */    public Map getNamedInputDevices() {	if (deviceMap != null) return deviceMap ;	deviceMap = createMap("Device") ;	return deviceMap ;    }    /**     * Returns a read-only Set of all configured Sensor instances in the order     * they were defined in the configuration file.  The associated     * InputDevices are all initialized and registered with any     * PhysicalEnvironments that reference them.<p>     *      * Sensor instances are named with the following command:<p>     * <blockquote>     * (NewSensor <i>&lt;instance name&gt; &lt;device name&gt;      * &lt;sensor index&gt;</i> [Alias <i>&lt;alias name&gt;</i>])     * </blockquote>     *      * <i>device name</i> is the instance name of a previously defined     * InputDevice, and <i>sensor index</i> is the index of the Sensor to be     * bound to <i>instance name</i>.  The InputDevice implementation is     * responsible for creating its own Sensor objects, so this command does     * not create any new instances.<p>     *     * The Sensor is configured through the SensorProperty command:<p>     * <blockquote>     * (SensorProperty <i>&lt;instance name&gt; &lt;property name&gt;      * &lt;property value&gt;</i>)     * </blockquote>     *      * With the sole exception of the Sensor assigned to the head tracker,     * none of the Sensors defined in the configuration file are placed into     * the Sensor array maintained by a PhysicalEnvironment.       *     * @return read-only Set of all unique instances, or null     */    public Set getSensors() {	if (sensors != null) return sensors ;	sensors = createSet("Sensor") ;	return sensors ;    }    /**     * Returns a read-only Map that maps Sensor names to instances.  Names may     * be aliases and if so will map to the original instances.  The     * associated InputDevices are all initialized and registered with any     * PhysicalEnvironments that reference them.<p>     *      * With the sole exception of the Sensor assigned to the head tracker,     * none of the Sensors defined in the configuration file are placed into     * the Sensor array maintained by a PhysicalEnvironment.       *      * @return read-only Map from names to Sensor instances, or     *  null if no instances     */    public Map getNamedSensors() {	if (sensorMap != null) return sensorMap ;	sensorMap = createMap("Sensor") ;	return sensorMap ;    }    /**     * Returns a read-only Set of all configured ViewingPlatform instances in     * the order they were defined in the configuration file.  The     * ConfigContainer class itself does not attach the ViewingPlatform     * instances to any scengraph components or universe Locales; they are not     * "live" until made so by a separate client such as ConfiguredUniverse.     *     * ViewingPlatform instances are created with the following command:<p>     * <blockquote>     * (NewViewPlatform <i>&lt;instance name&gt;</i>     * [Alias <i>&lt;alias name&gt;</i>])     * </blockquote>     *      * The ViewingPlatform is configured through the following command:<p>     * <blockquote>     * (ViewPlatformProperty <i>&lt;instance name&gt; &lt;property name&gt;     * &lt;property value&gt;</i>)     * </blockquote>     *     * @return read-only Set of all unique instances, or null     */    public Set getViewingPlatforms() {	if (platforms != null) return platforms ;	platforms = createSet("ViewPlatform") ;	return platforms ;    }    /**     * Returns a read-only Map that maps ViewingPlatform names to instances.     * Names may be aliases and if so will map to the original instances.  The     * ConfigContainer class itself does not attach the ViewingPlatform     * instances to any scengraph components or universe Locales; they are not     * "live" until made so by a separate client such as ConfiguredUniverse.     *      * @return read-only Map from names to ViewingPlatform instances, or     *  null if no instances     */    public Map getNamedViewingPlatforms() {	if (platformMap != null) return platformMap ;	platformMap = createMap("ViewPlatform") ;	return platformMap ;    }    /**     * Returns a read-only Set of all configured ViewPlatformBehavior     * instances in the order they were defined in the configuration file.<p>     *      * The behaviors are attached to any ViewingPlatforms that specified them;     * that is, the <code>setViewPlatformBehavior</code> and     * <code>setViewingPlatform</code> methods of ViewingPlatform and     * ViewPlatformBehavior have been called if appropriate.  However, a     * behavior's <code>initialize</code> method is not called until the     * ViewingPlatform to which it is attached is made live.<p>     *     * ViewPlatformBehavior instances are created by the following command:<p>     * <blockquote>     * (NewViewPlatformBehavior <i>&lt;instanceName&gt; &lt;className&gt;</i>)     * </blockquote>     *      * <i>className</i> must be the fully qualified name of a concrete class     * that extends the abstract ViewPlatformBehavior class.  The     * implementation must provide a parameterless constructor.<p>     *     * The behavior is configured using ViewPlatformBehaviorProperty:<p>     * <blockquote>     * (ViewPlatformBehaviorProperty <i>&lt;instanceName&gt;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -