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
-
public class SoMFColor extends SoMField
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 ofSbColor
. 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:
SbColor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.fields.SoField
SoField.FieldTypes
-
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
-
-
Constructor Summary
Constructors Constructor Description SoMFColor(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
disableDeleteValues()
Temporary disable value deleting.boolean
equals(java.lang.Object obj)
int
find(SbColor targetValue)
Calls find(targetValue, false).int
find(SbColor targetValue, boolean addIfNotFound)
Finds the given targetValue in the array and returns the index of that value.void
finishEditing()
Indicates that batch edits have finished.java.nio.FloatBuffer
getDirectValues(int start)
Returns a pointer into the array of values in the field, starting at index start.SbColor
getValueAt(int i)
SbColor[]
getValues(int start)
Returns a pointer into the array of values in the field, starting at index start.void
set1HSVValue(int index, float[] hsv)
Sets one of N HSV colors from an array of 3 floats.void
set1HSVValue(int index, float h, float s, float v)
Sets one of N HSV colors from 3 floats.void
set1Value(int index, float[] rgb)
Sets one of N RGB colors from an array of 3 floats.void
set1Value(int index, float r, float g, float b)
Sets one of N RGB colors from 3 floats.void
set1Value(int index, SbColor newValue)
Sets the index'th value in the array to newValue.void
set1Value(int index, SbVec3f vec)
Sets one of N RGB colors fromSbVec3f
.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.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.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.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.void
setValue(SbColor newValue)
Sets the first value in the array to newValue, and deletes.void
setValue(SbVec3f vec)
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.void
setValues(int start, float[] rgb)
Sets RGB values from the specified array of floats.void
setValues(int start, float[][] rgb)
Sets values starting at index start to the colors in rgb.void
setValues(int start, int num, float[] rgb)
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])
instead.void
setValues(int start, SbColor[] newValues)
Sets num values starting at index start to the values.void
setValuesBuffer(java.nio.ByteBuffer userData)
Sets the field to contain the values stored in userData.java.nio.FloatBuffer
startEditing()
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, setNum
-
Methods 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, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
SoMFColor
public SoMFColor(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
Default constructor.
-
-
Method Detail
-
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(int, SbColor[])
-
setValues
@Deprecated(since="9.3.1") public void setValues(int start, int num, float[] rgb)
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
public int find(SbColor targetValue)
Calls find(targetValue, false).
-
finishEditing
public void finishEditing()
Indicates that batch edits have finished. SeestartEditing()
.
-
setValuesBuffer
public void setValuesBuffer(java.nio.ByteBuffer userData)
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
public SbColor getValueAt(int i)
-
startEditing
public java.nio.FloatBuffer 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
public java.nio.FloatBuffer getDirectValues(int start)
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
public SbColor[] getValues(int start)
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.
-
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
public void setValue(SbVec3f vec)
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
public void set1Value(int index, SbVec3f vec)
Sets one of N RGB colors fromSbVec3f
. The array will be expanded and filled with zeros as necessary.
-
setValues
public void setValues(int start, SbColor[] newValues)
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
public int find(SbColor targetValue, boolean addIfNotFound)
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
public void setValue(SbColor newValue)
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
public void set1Value(int index, SbColor newValue)
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.
-
-