Package com.openinventor.inventor.fields
Class SoMFColor
java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.inventor.fields.SoField
com.openinventor.inventor.fields.SoMField
com.openinventor.inventor.fields.SoMFColor
Multiple-value field containing any number of RGB colors stored as three floats.
A multiple-value field that contains any number of RGB colors, stored as instances of
SbColor. Values may be set in either RGB (red, green, blue) or HSV (hue, saturation, value) color spaces.
SoMFColors are written to file as one or more RGB triples of floating point numbers in standard scientific notation. When more than one value is present, all of the values are enclosed in square brackets and separated by commas. For example:
represents the three colors red, green, and blue.[ 1.0 0.0 0.0, 0 1 0, 0 0 1 ]
Data copying:
SoMF fields are a kind of "smart container", automatically expanding as necessary to hold the data provided by the application. This is very convenient, but for large blocks of data it may be desireable to avoid making a copy of the application data. The setValuesBuffer() methods allow Open Inventor to directly use an array of values supplied by the application. The application data is not copied. Please see SoMFVec3f for more information and example code.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.fields.SoField
SoField.FieldTypesNested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand -
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle -
Constructor Summary
ConstructorsConstructorDescriptionSoMFColor(SoFieldContainer fieldContainer, String fieldName, SoField.FieldTypes fieldType) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidTemporary disable value deleting.booleanintCalls find(targetValue, false).intFinds the given targetValue in the array and returns the index of that value.voidIndicates that batch edits have finished.getDirectValues(int start) Returns a pointer into the array of values in the field, starting at index start.getValueAt(int i) SbColor[]getValues(int start) Returns a pointer into the array of values in the field, starting at index start.voidset1HSVValue(int index, float[] hsv) Sets one of N HSV colors from an array of 3 floats.voidset1HSVValue(int index, float h, float s, float v) Sets one of N HSV colors from 3 floats.voidset1Value(int index, float[] rgb) Sets one of N RGB colors from an array of 3 floats.voidset1Value(int index, float r, float g, float b) Sets one of N RGB colors from 3 floats.voidSets the index'th value in the array to newValue.voidSets one of N RGB colors fromSbVec3f.voidsetHSVValue(float[] hsv) Sets the field to contain one and only one value, the given color (expressed as an array of HSV floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.voidsetHSVValue(float h, float s, float v) Sets the field to contain one and only one value, the given color (expressed as HSV floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.voidsetValue(float[] rgb) Sets the field to contain one and only one value, the given color (expressed as an array of RGB floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.voidsetValue(float r, float g, float b) Sets the field to contain one and only one value, the given color (expressed as RGB floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.voidSets the first value in the array to newValue, and deletes.voidSets the field to contain one and only one value, the given color (expressed as RGB floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.voidsetValues(int start, float[] rgb) Sets RGB values from the specified array of floats.voidsetValues(int start, float[][] rgb) Sets values starting at index start to the colors in rgb.voidsetValues(int start, int num, float[] rgb) Deprecated.voidSets num values starting at index start to the values.voidsetValuesBuffer(ByteBuffer userData) Sets the field to contain the values stored in userData.Returns a pointer to the internally maintained array that can be modified.Methods inherited from class com.openinventor.inventor.fields.SoMField
deleteValues, deleteValues, get1, getNum, insertSpace, set1, setNumMethods inherited from class com.openinventor.inventor.fields.SoField
appendConnection, appendConnection, connectFrom, connectFrom, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getContainer, getNumConnections, getValueSize, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touchMethods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoMFColor
Default constructor.
-
-
Method Details
-
setValues
public void setValues(int start, float[][] rgb) Sets values starting at index start to the colors in rgb.- Parameters:
rgb- array of array of 3 floats- See Also:
-
setValues
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])instead.Sets num RGB values from an array of arrays of 3 floats. Each float should be in the range 0.0 to 1.0, and there must be 3* num floats in the array. -
find
Calls find(targetValue, false). -
finishEditing
public void finishEditing()Indicates that batch edits have finished. SeestartEditing(). -
setValuesBuffer
Sets the field to contain the values stored in userData. This data will not be copied into the field: it will be directly used by the field. -
getValueAt
-
startEditing
Returns a pointer to the internally maintained array that can be modified. The values in the array may be changed, but values cannot be added or removed. It is illegal to call any other editing methods betweenstartEditing()andfinishEditing()(e.g.set1Value(),setValue(), etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed untilfinishEditing()is called. CallingfinishEditing()always sets theisDefault()flag to false and informs engines and sensors that the field changed, even if none of the values actually were changed. -
getDirectValues
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()/finishEditing() methods for a way of modifying values in place. -
getValues
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()/finishEditing() methods for a way of modifying values in place. -
setHSVValue
public void setHSVValue(float h, float s, float v) Sets the field to contain one and only one value, the given color (expressed as HSV floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
setValue
public void setValue(float[] rgb) Sets the field to contain one and only one value, the given color (expressed as an array of RGB floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
equals
-
setHSVValue
public void setHSVValue(float[] hsv) Sets the field to contain one and only one value, the given color (expressed as an array of HSV floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
setValue
Sets the field to contain one and only one value, the given color (expressed as RGB floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
setValues
public void setValues(int start, float[] rgb) Sets RGB values from the specified array of floats. Each float should be in the range 0.0 to 1.0, and size of the array must be a multiple of 3. -
disableDeleteValues
public void disableDeleteValues()Temporary disable value deleting. -
setValue
public void setValue(float r, float g, float b) Sets the field to contain one and only one value, the given color (expressed as RGB floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
set1Value
Sets one of N RGB colors fromSbVec3f. The array will be expanded and filled with zeros as necessary. -
setValues
Sets num values starting at index start to the values. in newValues. The array will automatically be made larger to accommodate the new values, if necessary. In that case, if field's values are stored in an user data array, this array is no more used. -
set1HSVValue
public void set1HSVValue(int index, float h, float s, float v) Sets one of N HSV colors from 3 floats. The array will be expanded and filled with zeros as necessary. -
find
Finds the given targetValue in the array and returns the index of that value. in the array. If the value is not found, -1 is returned. If addIfNotFound is set, then targetValue is added to the end of the array (but -1 is still returned). -
set1HSVValue
public void set1HSVValue(int index, float[] hsv) Sets one of N HSV colors from an array of 3 floats. The array will be expanded and filled with zeros as necessary. -
setValue
Sets the first value in the array to newValue, and deletes. the second and subsequent values. If field's values are stored in an user data array, this array is no more used. -
set1Value
public void set1Value(int index, float r, float g, float b) Sets one of N RGB colors from 3 floats. The array will be expanded and filled with zeros as necessary. -
set1Value
Sets the index'th value in the array to newValue. The array will be automatically expanded, if necessary. In that case, if field's values are stored in an user data array, this array is no more used. -
set1Value
public void set1Value(int index, float[] rgb) Sets one of N RGB colors from an array of 3 floats. The array will be expanded and filled with zeros as necessary.
-
setValues(int, float[])instead.