previous   next  contents

BS Contact J Specification

Annex D -
IDL Interface Definition


This Addendum provides a language and platform independent description of the Core X3D API and class hierarchy. It uses the Interface Definition Language (IDL) from the Object Management Group (OMG). The OMG IDL is neutral with respect to platform and has mappings to many standard languages. It is recommended that implementations use this IDL as a reference for development.

IDL Specification

typedef sequence<boolean> booleanarray;
typedef sequence<double> doublearray;
typedef sequence<float> floatarray;
typedef sequence<long> longarray;
typedef sequence<string> stringarray;
typedef sequence<floatarray> floatdoublearray;
module x3d {
/* Exceptions */

	exception X3DException{};

/* End Exceptions */

/* Forward References */

	interface Browser;
	interface Node;
	interface Field;
	interface EventObserver;
	interface PickInfo;

/* End Forward References */

/* Browser */

	interface Browser(
		const string PROPERTY_NAME            = "Name";
		const string PROPERTY_VERSION         = "Version";
		const string PROPERTY_PROFILE         = "Profile";
		const string PROPERTY_HEADLIGHT       = "Headlight";
		const string PROPERTY_BOUNDVIEWPOINT  = "BoundViewpoint";
		const string PROPERTY_BOUNDBACKGROUND = "BoundBackground";
		const string PROPERTY_BOUNDNAVIGATIONINFO  = "BoundNavigationinfo";

		Object getProperty(in string name);
		floatarray getCamera() raises (CoreX3DException);
		string getWorldURL(in nodearray nodes) raises (CoreX3DException);
		void replaceWorld(in string name) 
			raises (IllegalArgumentException, CoreX3DException);
		nodearray getWorld() raises (CoreX3DException);
		void loadURL(in string url) 
			raises (IllegalArgumentException, CoreX3DException);
		nodearray createX3DFromString(in string x3dString) 
			raises (IllegalArgumentException, CoreX3DException);
		void createX3DFromURL(in string url, 
				in EventObserver observer, in Object userData) 
			raises (IllegalArgumentException, CoreX3DException);
		nodearray void addRoute(in Node fromNode, in string fromEventOut,
					in Node toNode,   in string toEventIn) 
			raises (IllegalArgumentException);
		nodearray void deleteRoute( in Node fromNode, in string fromEventOut,
					in Node toNode,   in string toEventIn) 
			raises (IllegalArgumentException);
		Node getNode(in string name) 
			raises (IllegalArgumentException, CoreX3DException);
		void bindNode(in Node node) 
			raises (IllegalArgumentException, CoreX3DException);
		boolean setNodeField(in string node, in string event, in string value);
		string getNodeField(in string node, in string event);
		void beginUpdate() raises (CoreX3DException);
		void endUpdate() raises (CoreX3DException);
		PickInfo pick(in long info, in floatarray from, in floatarray direction) 
			raises (IllegalArgumentException);
		PickInfo pick(in long info, in floatarray mouse)
			raises (IllegalArgumentException);
		void addBrowserObserver(in EventObserver observer) raises (CoreX3DException);
		void removeBrowserObserver(in EventObserver observer) raises (CoreX3DException);
		void addAWTObserver(in EventObserver observer) raises (CoreX3DException);
		void removeAWTObserver(in EventObserver observer) raises (CoreX3DException);

/* End Browser */

/* Node */

	interface Node{
		string getType() raises (CoreX3DException);
		string getName() raises (CoreX3DException);
		string getField(in string name) raises (CoreX3DException);

/* End Node */
    	typedef sequence<Node> nodearray;

/* Field */
	interface Field{
		const long SFBool       = 1;
		const long SFColor      = 2;
		const long SFFloat      = 3;
		const long SFImage      = 4;
		const long SFInt32      = 5;
		const long SFNode       = 6;
		const long SFRotation   = 7;
		const long SFString     = 8;
		const long SFTime       = 9;
		const long SFVec2f      = 10;
		const long SFVec3f      = 11;
		const long MFColor      = 12;
		const long MFFloat      = 13;
		const long MFInt32      = 14;
		const long MFNode       = 15;
		const long MFRotation   = 16;
		const long MFString     = 17;
		const long MFTime       = 18;
		const long MFVec2f      = 19;
		const long MFVec3f      = 20;
		const long UNKNOWN_FIELD= -1;

		const long EVENTIN      = 1;
		const long EVENTOUT     = 2;
		const long EXPOSEDFIELD = 3;
		long getType();
		long getAccessType();
		string getName();
		void addObserver(in EventObserver observer, in Object userData);
		void removeObserver(in EventObserver observer, in Object userData);
		long getLength();
		boolean getValueBool()   raises (IllegalArgumentException);
		double  getValueDouble() raises (IllegalArgumentException);
		long    getValueInt()    raises (IllegalArgumentException);
		float   getValueFloat()  raises (IllegalArgumentException);
		string  getValueString() raises (IllegalArgumentException);
		Node    getValueNode()   raises (IllegalArgumentException);
		doublearray getValueDoubleArray(in long start, in long count) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		longarray getValueIntArray(in long start, in long count) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		stringarray getValueStringArray(in long start, in long count) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		floatarray getValueFloatArray(in long start, in long count) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		nodearray getValueNodeArray(in long start, in long count) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);

		void setValueBool(in boolean value) raises (IllegalArgumentException);
		void setValueDouble(in double  value) raises (IllegalArgumentException);
		void setValueInt(in long    value) raises (IllegalArgumentException);
		void setValueFloat(in float   value) raises (IllegalArgumentException);
		void setValueString(in string  value) raises (IllegalArgumentException);
		void setValueNode(in node    value) raises (IllegalArgumentException);
		void setValueDoubleArray(in long start, in long count, in doublearray value) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		void setValueIntArray(in long start, in long count, in longarray value)
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		void setValueStringArray(in long start, in long count, in stringarray value) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		void setValueFloatArray(in long start, in long count, in floatarray value) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);
		void setValueNodeArray(in long start, in long count, in nodearray value) 
			raises (IllegalArgumentException, ArrayIndexOutOfBoundsException);

/* End Field */
/* EventObserver */

	interface EventObserver{
		const long INITIALIZED		= 0;
		const long SHUTDOWN		= 1;
		const long URL_ERROR		= 2;
		const long URL_LOADED		= 3;
		const long FIELD_CHANGED	= 4;
		const long ANCHOR_CLICKED	= 5;
		const long LAST_IDENTIFIER	= 100;

		boolean onEvent(in long type, in Object object, in Object userData);
		boolean onEvent(in java:awt:Event event);

/* End EventObserver */

/* PickInfo */

	interface PickInfo{
		const long PICK_NODE	= 0x01;
		const long PICK_PATH	= 0x02;
		const long PICK_MATRIX	= 0x10;
		const long PICK_RAY	= 0x100;
		const long PICK_MOUSE	= 0x200;
		attribute	long			info		value;
		attribute	floatarray		hitLocal	value;
		attribute	floatarray		hitGlobal	value;
		attribute	floatdoublearray	matrix		value;
		attribute	nodearray		nodePath	value;

/* End PickInfo */