public class ConfigContainer extends Object
Clients can construct the view side of a scene graph by retrieving these objects using the accessor methods provided by this class. This could involve as little as just attaching ViewingPlatforms to a Locale, depending upon how completely the viewing configuration is specified in the file. The ConfiguredUniverse class is an example of a ConfigContainer client and how it can be used.
ConfigContainer can be useful for clients other than ConfiguredUniverse.
InputDevice and ViewPlatformBehavior configuration is fully supported, so a
given Java 3D installation can provide configuration files to an
application that will allow it to fully utilize whatever site-specific
devices and behaviors are available. The configuration mechanism can be
extended for any target object through the use of the
NewObject
and ObjectProperty
configuration
commands.
ConfiguredUniverse
,
The Java 3D Configuration File,
Example Configuration FilesConstructor and Description |
---|
ConfigContainer(URL userConfig)
Creates a new ConfigContainer and loads the configuration file at the
specified URL.
|
ConfigContainer(URL userConfig,
boolean setVisible,
int transformCount)
Creates a new ConfigContainer and loads the configuration file at the
specified URL.
|
ConfigContainer(URL userConfig,
boolean setVisible,
int transformCount,
ClassLoader classLoader)
Creates a new ConfigContainer and loads the configuration file at the
specified URL.
|
ConfigContainer(URL userConfig,
ClassLoader classLoader)
Creates a new ConfigContainer and loads the configuration file at the
specified URL.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Release memory references used by this ConfigContainer.
|
static URL |
getConfigURL()
Returns the config file URL based on system properties.
|
static URL |
getConfigURL(String defaultURLString)
Returns the config file URL based on system properties.
|
Set |
getGenericObjects()
Returns a read-only Set of all generic configuration object
instances in the order they were defined in the configuration file.
|
Set |
getInputDevices()
Returns a read-only Set of all configured InputDevice instances in the
order they were defined in the configuration file.
|
Map |
getNamedCanvases(String viewName)
Returns a read-only Map containing the named Canvas3D instances used by
the specified Viewer.
|
Map |
getNamedGenericObjects()
Returns a read-only Map that maps generic object names to
instances.
|
Map |
getNamedInputDevices()
Returns a read-only Map that maps InputDevice names to instances.
|
Map |
getNamedPhysicalBodies()
Returns a read-only Map that maps PhysicalBody names to instances.
|
Map |
getNamedPhysicalEnvironments()
Returns a read-only Map that maps PhysicalEnvironment names to
instances.
|
Map |
getNamedSensors()
Returns a read-only Map that maps Sensor names to instances.
|
Map |
getNamedViewers()
Returns a read-only Map that maps Viewer names to instances.
|
Map |
getNamedViewingPlatforms()
Returns a read-only Map that maps ViewingPlatform names to instances.
|
Map |
getNamedViewPlatformBehaviors()
Returns a read-only Map that maps ViewPlatformBehavior names to
instances.
|
Set |
getPhysicalBodies()
Returns a read-only Set of all configured PhysicalBody instances in the
order they were defined in the configuration file.
|
Set |
getPhysicalEnvironments()
Returns a read-only Set of all configured PhysicalEnvironment instances
in the order they were defined in the configuration file.
|
Set |
getSensors()
Returns a read-only Set of all configured Sensor instances in the order
they were defined in the configuration file.
|
Set |
getViewers()
Returns a read-only Set of all configured Viewer instances in the order
they were defined in the configuration file.
|
boolean |
getViewerVisibility()
Returns whether Viewers should be created with their AWT components
initially visible or invisible.
|
Set |
getViewingPlatforms()
Returns a read-only Set of all configured ViewingPlatform instances in
the order they were defined in the configuration file.
|
Set |
getViewPlatformBehaviors()
Returns a read-only Set of all configured ViewPlatformBehavior
instances in the order they were defined in the configuration file.
|
int |
getViewPlatformTransformCount()
Returns the number of TransformGroups with which ViewingPlatforms
should be created.
|
public ConfigContainer(URL userConfig)
userConfig
- URL of the configuration file to loadpublic ConfigContainer(URL userConfig, ClassLoader classLoader)
userConfig
- URL of the configuration file to loadclassLoader
- the class loader to use to load classes specified
in the config file.public ConfigContainer(URL userConfig, boolean setVisible, int transformCount)
setVisible
flag.userConfig
- URL of the configuration file to loadsetVisible
- if true, setVisible(true)
is called on
all ViewerstransformCount
- number of transforms to be included in any
ViewingPlatform created; must be greater than 0public ConfigContainer(URL userConfig, boolean setVisible, int transformCount, ClassLoader classLoader)
setVisible
flag.userConfig
- URL of the configuration file to loadsetVisible
- if true, setVisible(true)
is called on
all ViewerstransformCount
- number of transforms to be included in any
ViewingPlatform created; must be greater than 0classLoader
- the class loader to use to load classes specified
in the config file.public Set getPhysicalBodies()
(NewPhysicalBody <instance name> [Alias <alias name>])The PhysicalBody is configured through the following command:
(PhysicalBodyProperty <instance name> <property name> <property value>)
public Map getNamedPhysicalBodies()
public Set getPhysicalEnvironments()
PhysicalEnvironment instances are created with the following command:
(NewPhysicalEnvironment <instance name> [Alias <alias name>])The PhysicalEnvironment is configured through the following command:
(PhysicalEnvironmentProperty <instance name> <property name> <property value>)
public Map getNamedPhysicalEnvironments()
public Set getViewers()
Viewer instances are created with the following command:
(NewView <instance name> [Alias <alias name>])The Viewer is configured through the following command:
(ViewProperty <instance name> <property name> <property value>)
public Map getNamedViewers()
public Set getInputDevices()
InputDevice instances are created with the following command:
(NewDevice <instanceName> <className> [Alias <alias name>])className must be the fully-qualified name of a class that implements the InputDevice interface. The implementation must provide a parameterless constructor.
The InputDevice is configured through the DeviceProperty command:
(DeviceProperty <instanceName> <propertyName> <arg0> ... <argn>)propertyName 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 arg0 through argn 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.
public Map getNamedInputDevices()
getInputDevices()
public Set getSensors()
Sensor instances are named with the following command:
(NewSensor <instance name> <device name> <sensor index> [Alias <alias name>])device name is the instance name of a previously defined InputDevice, and sensor index is the index of the Sensor to be bound to instance name. The InputDevice implementation is responsible for creating its own Sensor objects, so this command does not create any new instances.
The Sensor is configured through the SensorProperty command:
(SensorProperty <instance name> <property name> <property value>)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.
public Map getNamedSensors()
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.
public Set getViewingPlatforms()
(NewViewPlatform <instance name> [Alias <alias name>])The ViewingPlatform is configured through the following command:
(ViewPlatformProperty <instance name> <property name> <property value>)
public Map getNamedViewingPlatforms()
public Set getViewPlatformBehaviors()
The behaviors are attached to any ViewingPlatforms that specified them;
that is, the setViewPlatformBehavior
and
setViewingPlatform
methods of ViewingPlatform and
ViewPlatformBehavior have been called if appropriate. However, a
behavior's initialize
method is not called until the
ViewingPlatform to which it is attached is made live.
ViewPlatformBehavior instances are created by the following command:
(NewViewPlatformBehavior <instanceName> <className>)className must be the fully qualified name of a concrete class that extends the abstract ViewPlatformBehavior class. The implementation must provide a parameterless constructor.
The behavior is configured using ViewPlatformBehaviorProperty:
(ViewPlatformBehaviorProperty <instanceName> <propertyName> <arg0> ... <argn>)ViewPlatformBehavior subclasses inherit a number of pre-defined properties that can be directly specified with the propertyName string; see the configuration file documentation for details.
Concrete ViewPlatformBehavior instances can also define their own unique properties. In those cases, propertyName must be the name of a behavior method that takes an array of Objects as its only parameter; the array is populated with the values of arg0 through argn when the method is invoked to set the property. These additional requirements for configurable behaviors can usually be fulfilled by extending or wrapping available ViewPlatformBehavior subclasses.
public Map getNamedViewPlatformBehaviors()
The behaviors are attached to any ViewingPlatforms that specified them;
that is, the setViewPlatformBehavior
and
setViewingPlatform
methods of ViewingPlatform and
ViewPlatformBehavior have been called if appropriate. However, a
behavior's initialize
method is not called until the
ViewingPlatform to which it is attached is made live.
getViewPlatformBehaviors()
public Map getNamedCanvases(String viewName)
A named Canvas3D is created and added to a Viewer whenever any of the following configuration commands are used:
(ViewProperty <view> Screen <screenName>)view is the name of a Viewer created with the NewView command. The screenName and windowName parameters of the above commands are the keys to use when looking up the associated Canvas3D instances in the Map returned by this method. Note: the NewScreen and NewWindow commands do not create Canvas3D instances themselves; they are created only by the above configuration commands.
(ViewProperty <view> Window <windowName>)
viewName
- the name of the Viewerpublic Set getGenericObjects()
Generic object instances are created with the following command:
(NewObject <instanceName> <className>)className must be the fully-qualified name of a class that provides a parameterless constructor.
The object is configured through the ObjectProperty command:
(ObjectProperty <instanceName> <propertyName> <arg0> ... <argn>)propertyName must be the name of a method provided by object instanceName. It must take an array of Objects as its only parameter; the array is populated with the values of arg0 through argn when the method is invoked to set the property. These additional requirements for configurable objects can usually be fulfilled by extending or wrapping available object classes.
public Map getNamedGenericObjects()
getGenericObjects()
public int getViewPlatformTransformCount()
public boolean getViewerVisibility()
public void clear()
public static URL getConfigURL()
java -Dj3d.configURL=file:j3dconfig ...
public static URL getConfigURL(String defaultURLString)
java -Dj3d.configURL=file:j3dconfig ...
defaultURLString
- the default string used to construct
the URL if the appropriate system properties are not definedCopyright © 2016–2022 SciJava. All rights reserved.