| 1 |
NAME SoFieldContainer SoFldCont "" { |
| 2 |
abstract base class for objects that contain fields |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE fields/SoFieldContainer.h |
| 6 |
|
| 7 |
DESC { |
| 8 |
\cSoFieldContainer\. is the abstract base class for engines and nodes. |
| 9 |
It contains methods for finding out what fields an object has, |
| 10 |
controlling notification, and for dealing with all of the fields of an |
| 11 |
object at once. |
| 12 |
\p |
| 13 |
The fields of an engine are its inputs. Note that even though an |
| 14 |
engine's output corresponds to a specific type of field, an engine |
| 15 |
output is not a field. |
| 16 |
} |
| 17 |
METHOD "" static SoType getClassTypeId() { |
| 18 |
Returns the type of this class. |
| 19 |
} |
| 20 |
METHOD setToDflts void setToDefaults() { |
| 21 |
Sets all fields in this object to their default values. |
| 22 |
} |
| 23 |
METHOD hasDfltVals SbBool hasDefaultValues() const { |
| 24 |
Returns TRUE if all of the object's fields have their default values. |
| 25 |
This will return TRUE even if a field's \misDefault()\. method returns |
| 26 |
FALSE \(em for example, if a field's default value is 0.0 and you |
| 27 |
\m\+setValue(0.0)\.\-SetValue(0.0)\.\. that field, the default flag |
| 28 |
will be set to FALSE (because it would be too slow to compare the |
| 29 |
field against its default value every time \msetValue\. is called). |
| 30 |
However, \m\+hasDefaultValues()\.\-HasDfltVals()\.\. would return TRUE |
| 31 |
in this case. |
| 32 |
} |
| 33 |
METHOD fldsAreEq SbBool fieldsAreEqual(const SoFieldContainer *fc) const { |
| 34 |
Returns TRUE if this object's fields are exactly equal to \afc\.'s fields. |
| 35 |
If \afc\. is not exactly same type as this object, FALSE is returned. |
| 36 |
} |
| 37 |
METHOD copyFieldVals void copyFieldValues(const SoFieldContainer *fc, |
| 38 |
SbBool copyConnections = FALSE) { |
| 39 |
Copies the contents of \afc\.'s fields into this object's fields. \afc\. must |
| 40 |
be the same type as this object. If \acopyConnections\. is TRUE, then if |
| 41 |
any of \afc\.'s fields are connected then this object's fields will also |
| 42 |
be connected to the same source. |
| 43 |
} |
| 44 |
METHOD "" SbBool set(const char *fieldDataString) { |
| 45 |
Sets one or more fields in this object to the values specified in the |
| 46 |
given string, which should be a string in the Inventor file format. |
| 47 |
TRUE is returned if the string was valid Inventor file format. For |
| 48 |
example, you could set the fields of an \cSoCube\. by doing: |
| 49 |
\b |
| 50 |
SoCube *cube = .... |
| 51 |
cube->set("width 1.0 height 2.0 depth 3.2"); |
| 52 |
\. |
| 53 |
} |
| 54 |
METHOD "" void get(SbString &fieldDataString) { |
| 55 |
Returns the values of the fields of this object in the Inventor ASCII |
| 56 |
file format in the given string. Fields whose |
| 57 |
\m\+isDefault()\.\-IsDflt()\.\. bit is set |
| 58 |
will not be part of the string. You can use the |
| 59 |
\m\+field->get()\.\-SoFieldGet()\.\. method to get a field's value |
| 60 |
as a string even if has its default value. |
| 61 |
} |
| 62 |
METHOD "" virtual int getFields(SoFieldList &resultList) const { |
| 63 |
Appends pointers to all of this object's fields to resultList, and |
| 64 |
returns the number of fields appended. The types of the fields can be |
| 65 |
determined using \m\+field->isOfType()\.\-SoFldIsOfType\.\. |
| 66 |
and \m\+field->getTypeId()\.\-SoFldGetTypeId()\.\., and their |
| 67 |
names can be determined by passing the field pointers to the |
| 68 |
\m\+getFieldName()\.\-GetFieldName()\.\. method (see below). |
| 69 |
} |
| 70 |
METHOD "" virtual SoField *getField(const SbName &fieldName) const { |
| 71 |
Returns a pointer to the field of this object whose name is \afieldName\.. |
| 72 |
Returns NULL if there is no field with the given name. |
| 73 |
} |
| 74 |
METHOD "" SbBool getFieldName(const SoField *field, |
| 75 |
SbName &fieldName) const { |
| 76 |
Returns the name of the given field in the \afieldName\. argument. |
| 77 |
Returns FALSE if field is not a member of this object. |
| 78 |
} |
| 79 |
|
| 80 |
METHOD "" SbBool isNotifyEnabled() const { |
| 81 |
Notification is the process of telling interested objects that this |
| 82 |
object has changed. Notification is needed to make engines and |
| 83 |
sensors function, is used to keep \cSoPaths\. up to date when the |
| 84 |
scene graph's topology changes, and is also used to invalidate |
| 85 |
rendering or bounding box caches. |
| 86 |
\p |
| 87 |
Notification is normally enabled, but can be disabled on a node by |
| 88 |
node (or engine by engine) basis. If you are making extensive changes |
| 89 |
to a large part of the scene graph then disabling notification can |
| 90 |
increase performance, at the expense of increased |
| 91 |
responsibility for making sure that any interested engines, sensors or |
| 92 |
paths are kept up to date. |
| 93 |
\p |
| 94 |
For example, if you will be making a lot of changes to a small part of |
| 95 |
your scene graph and you know that there are no engines or sensors |
| 96 |
attached to nodes in that part of the scene graph, you might disable |
| 97 |
notification on the nodes you are changing, modify them, re-enable |
| 98 |
notification, and then touch() one of the nodes to cause a redraw. |
| 99 |
\p |
| 100 |
However, you should profile your application and make sure that |
| 101 |
notification is taking a significant amount of time before going to |
| 102 |
the trouble of manually controlling notification. |
| 103 |
} |
| 104 |
METHOD "" SbBool enableNotify(SbBool flag) { |
| 105 |
Notification at this Field Container is enabled (if flag == TRUE) or |
| 106 |
disabled (if flag == FALSE). The returned boolean value indicates |
| 107 |
whether notification was enabled immediately prior to applying this method. |
| 108 |
} |
| 109 |
ALSO { SoSField, SoMField, SoNode, SoDB } |