Class SoFieldContainer
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
SoAnalysisResult
,SoDataMeasure
,SoDataMeasureAttributes
,SoEngine
,SoImageDataAdapter
,SoLDMDataTransform
,SoLDMResourceParameters
,SoMorphoLut2D
,SoMorphoLut3D
,SoNode
,SoRegistrationResult
,SoSegmentChain
,SoVolumeReader
,SoVolumeWriter
public class SoFieldContainer extends SoBase
Abstract base class for objects that contain fields.SoFieldContainer
is the base class for engines and nodes. It contains methods for finding out what fields an object has, controlling notification, and for dealing with all of the fields of an object at once.The fields of an engine are its inputs. Note that even though an engine's output corresponds to a specific type of field, an engine output is not a field.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyFieldValues(SoFieldContainer fc)
Calls copyFieldValues(fc, false).void
copyFieldValues(SoFieldContainer fc, boolean copyConnections)
Copies the contents of fc's fields into this object's fields.boolean
enableNotify(boolean flag)
Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false).boolean
fieldsAreEqual(SoFieldContainer fc)
Returns true if this object's fields are exactly equal to fc's fields.java.lang.String
get()
Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.SoField[]
getAllFields()
Returns the fields contained by this container.SoField
getEventIn(java.lang.String fieldName)
Returns a the eventIn with the given name.SoField
getEventOut(java.lang.String fieldName)
Returns the eventOut with the given name.SoField
getField(java.lang.String fieldName)
Returns a the field of this object whose name is fieldName.java.lang.String
getFieldName(SoField field)
Returns the name of the given field in the fieldName argument.boolean
hasDefaultValues()
Returns true if all of the object's fields have their default values.boolean
isNotifyEnabled()
Notification is the process of telling interested objects that this object has changed.boolean
set(java.lang.String fieldDataString)
Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.void
setToDefaults()
Sets all fields in this object to their default values.-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Method Detail
-
getAllFields
public SoField[] getAllFields()
Returns the fields contained by this container.
-
copyFieldValues
public void copyFieldValues(SoFieldContainer fc)
Calls copyFieldValues(fc, false).
-
fieldsAreEqual
public boolean fieldsAreEqual(SoFieldContainer fc)
Returns true if this object's fields are exactly equal to fc's fields. If fc is not exactly same type as this object, false is returned.
-
copyFieldValues
public void copyFieldValues(SoFieldContainer fc, boolean copyConnections)
Copies the contents of fc's fields into this object's fields. fc must be the same type as this object. If copyConnections is true, then if any of fc's fields are connected then this object's fields will also be connected to the same source.
-
set
public boolean set(java.lang.String fieldDataString)
Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. true is returned if the string was valid Open Inventor file format.For example, you could set the fields of an
SoCube
by doing:SoCube cube = new SoCube(); cube.set( "width 1.0 height 2.0 depth 3.2" );
-
getEventIn
public SoField getEventIn(java.lang.String fieldName)
Returns a the eventIn with the given name. If no such eventIn exists, NULL is returned.
-
hasDefaultValues
public boolean hasDefaultValues()
Returns true if all of the object's fields have their default values. This will return true even if a field's isDefault() method returns false - for example, if a field's default value is 0.0 and you setValue(0.0) that field, the default flag will be set to false (because it would be too slow to compare the field against its default value every time setValue is called). However,hasDefaultValues()
would return true in this case.
-
setToDefaults
public void setToDefaults()
Sets all fields in this object to their default values.
-
getField
public SoField getField(java.lang.String fieldName)
Returns a the field of this object whose name is fieldName. Returns NULL if there is no field with the given name.
-
enableNotify
public boolean enableNotify(boolean flag)
Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). The returned Boolean value indicates whether notification was enabled immediately prior to applying this method.
-
getEventOut
public SoField getEventOut(java.lang.String fieldName)
Returns the eventOut with the given name. If no such eventOut exists, NULL is returned.
-
isNotifyEnabled
public boolean isNotifyEnabled()
Notification is the process of telling interested objects that this object has changed. Notification is needed to make engines and sensors function, is used to keep SoPaths up to date when the scene graph's topology changes, and is also used to invalidate rendering or bounding box caches.Notification is normally enabled, but can be disabled on a node by node (or engine by engine) basis. If you are making extensive changes to a large part of the scene graph then disabling notification can increase performance, at the expense of increased responsibility for making sure that any interested engines, sensors or paths are kept up to date.
For example, if you will be making a lot of changes to a small part of your scene graph and you know that there are no engines or sensors attached to nodes in that part of the scene graph, you might disable notification on the nodes you are changing, modify them, re-enable notification, and then
touch()
one of the nodes to cause a redraw.However, you should profile your application and make sure that notification is taking a significant amount of time before going to the trouble of manually controlling notification.
-
get
public java.lang.String get()
Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. Fields whose isDefault() bit is set will not be part of the string. You can use theSoField.get()
method to get a field's value as a string even if has its default value.
-
getFieldName
public java.lang.String getFieldName(SoField field)
Returns the name of the given field in the fieldName argument. Returns false if field is not a member of this object.
-
-