![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
VisuColorization; enum VisuColorizationErrorFlag; gboolean (*VisuColorizationHidingFunc) (VisuColorization *dt
,const VisuColorizationNodeData *values
,gpointer data
); enum VisuColorizationInputScaleId; struct VisuColorizationNodeData; gboolean visu_colorization_applyHide (VisuColorization *dt
,VisuData *dataObj
); VisuColorization * visu_colorization_get (VisuData *data
,gboolean create
,gboolean *new
); const int * visu_colorization_getColUsed (const VisuColorization *dt
); gboolean visu_colorization_getColumnMinMax (const VisuColorization *dt
,float minMax[2]
,guint column
); GQuark visu_colorization_getErrorQuark (); gchar * visu_colorization_getFile (const VisuColorization *dt
); gboolean visu_colorization_getFileSet (const VisuColorization *dt
); float visu_colorization_getMax (const VisuColorization *dt
,int column
); float visu_colorization_getMin (const VisuColorization *dt
,int column
); int visu_colorization_getNColumns (const VisuColorization *dt
); gboolean visu_colorization_getRestrictInRange (const VisuColorization *dt
); VisuColorizationInputScaleId visu_colorization_getScaleType (const VisuColorization *dt
); int visu_colorization_getScalingUsed (const VisuColorization *dt
); ToolShade * visu_colorization_getShade (const VisuColorization *dt
); gboolean visu_colorization_getSingleColumnId (const VisuColorization *dt
,gint *id
); gboolean visu_colorization_getUsed (const VisuColorization *dt
); int visu_colorization_init (); VisuColorization * visu_colorization_new (); VisuColorization * visu_colorization_new_fromData (VisuData *dataObj
,guint nbColumns
,GArray *data
,gboolean *new
); VisuColorization * visu_colorization_new_fromFile (VisuData *data
,const char *filename
,gboolean *new
,GError **error
); VisuColorization * visu_colorization_ref (VisuColorization *dt
); gboolean visu_colorization_setColUsed (VisuColorization *dt
,int val
,int pos
); void visu_colorization_setHidingFunc (VisuColorization *dt
,VisuColorizationHidingFunc func
,gpointer data
,GDestroyNotify destroy
); gboolean visu_colorization_setMax (VisuColorization *dt
,float max
,int column
); gboolean visu_colorization_setMin (VisuColorization *dt
,float min
,int column
); gboolean visu_colorization_setRestrictInRange (VisuColorization *dt
,gboolean status
); gboolean visu_colorization_setScaleType (VisuColorization *dt
,VisuColorizationInputScaleId scale
); gboolean visu_colorization_setScalingUsed (VisuColorization *dt
,int val
); gboolean visu_colorization_setShade (VisuColorization *dt
,ToolShade *shade
); gboolean visu_colorization_setUsed (VisuData *data
,int val
); void visu_colorization_unref (VisuColorization *dt
);
With this module, it is possible to colorize nodes depending
on data read in an input file. An input file can be associated to a
VisuData object using visu_colorization_new_fromFile()
. Doing this, the
rendering is changed and nodes are colorized following a scheme
describe later. To turn off colorization without removing the data
file (for temporary turn off for instance), use
visu_colorization_setUsed()
.
The input file must have the same numbers of uncommented lines as there are nodes in the VisuData associated with. If less data is given, missing data are treaded as min values data. The input data file can has as much column as desired. The colorization is based on a linear color transformation. This transformation is applied on color channel in RGB mode or in HSV mode. Resulting color is given by : [resulting color vect] = [vectB] + [input data][vectA], where [input data] are input data scaled to [0;1]. It is possible to choose which column multiplies which color channel.
Using visu_colorization_applyHide()
, it is possible to hide
some nodes depending on given input data.
typedef struct _VisuColorization VisuColorization;
An opaque structure to store colorisation settings.
Since 3.7
typedef enum { VISU_COLORIZATION_ERROR_NO_COLUMN, VISU_COLORIZATION_ERROR_MISSING_DATA } VisuColorizationErrorFlag;
Possible errors when reading a file with column data.
gboolean (*VisuColorizationHidingFunc) (VisuColorization *dt
,const VisuColorizationNodeData *values
,gpointer data
);
Function to decide to hide a node or not.
|
a VisuColorization object ; |
|
the column values. |
|
some data. [closure] |
Returns : |
TRUE to hide a node depending on values . |
Since 3.7
typedef enum { VISU_COLORIZATION_NORMALIZE, VISU_COLORIZATION_MINMAX } VisuColorizationInputScaleId;
Control how input data are converted into [0;1], after conversion, values are clamped if needed.
struct VisuColorizationNodeData { const VisuData *dataObj; const VisuNode *node; GArray *data; };
This structure holds the column value for a given node. It is mainly intended for bindings...
gboolean visu_colorization_applyHide (VisuColorization *dt
,VisuData *dataObj
);
From the hiding function of dt (see
visu_colorization_setHidingFunc()
), apply hiding property to nodes
of dataObj
.
|
a VisuColorization object. |
|
a VisuData object to apply hiding scheme on. |
Returns : |
TRUE if "VisibilityChanged" signal should be emitted. |
Since 3.7
VisuColorization * visu_colorization_get (VisuData *data
,gboolean create
,gboolean *new
);
Return an already associated VisuColorization object to data
, or
create it if necessary.
|
a VisuData object. [allow-none] |
|
a boolean. |
|
a boolean location. [out][allow-none] |
Returns : |
a VisuColorization object. This object will
be automatically freed with data . [transfer none]
|
Since 3.7
const int * visu_colorization_getColUsed (const VisuColorization *dt
);
This method is used to retrieve the vector used to adapt or not the colour to the value of the loaded data.
|
a VisuData object. [allow-none] |
Returns : |
a three value array, own by V_Sim. It should not be freed. [transfer none][array fixed-size=3] |
gboolean visu_colorization_getColumnMinMax (const VisuColorization *dt
,float minMax[2]
,guint column
);
This method is used to retrieve the minimum and the maximum
values of the column designed by the column
argument. Column
are numbered beginning at 0.
|
the VisuColorization object which the colour data are associated to ; |
|
an allocated array of two floating point values ; |
|
an integer. |
Returns : |
FALSE if column < 0 or if column is greater than the number
of read column or if no file has been set. |
GQuark visu_colorization_getErrorQuark ();
Internal routine for error handling.
Returns : |
the GQuark associated to errors related to colour data files. [transfer none] |
gchar * visu_colorization_getFile (const VisuColorization *dt
);
If the given dt
has an input data file already loaded, it returns its name.
|
a VisuColorization object. [allow-none] |
Returns : |
the name of the input data file if set. [transfer full] |
gboolean visu_colorization_getFileSet (const VisuColorization *dt
);
A set of data per node can be associated to a VisuData. This
routine retrieves if visuData
has it or not.
|
a VisuColorization object. [allow-none] |
Returns : |
TRUE if visuData has colour data associated. |
Since 3.6
float visu_colorization_getMax (const VisuColorization *dt
,int column
);
Retrieve the maximum value used when scaling is user defined.
|
a VisuData object. [allow-none] |
|
a column id. |
Returns : |
the maximum bound if dt is not NULL
or the default value if not. |
float visu_colorization_getMin (const VisuColorization *dt
,int column
);
Retrieve the minimum value used when scaling is user defined.
|
a VisuData object. [allow-none] |
|
a column id. |
Returns : |
the minimum bound if dt is not NULL
or the default value if not. |
int visu_colorization_getNColumns (const VisuColorization *dt
);
This method is used to retrieve the number of columns of data read in the loaded file.
|
a VisuColorization object. |
Returns : |
this number of columns. |
gboolean visu_colorization_getRestrictInRange
(const VisuColorization *dt
);
The colourisation can be applied on all nodes or on nodes within
range. See visu_colorization_setRestrictInRange()
.
|
a VisuColorization object with some data file information. |
Returns : |
TRUE if colourisation is done only if values are in range. |
Since 3.7
VisuColorizationInputScaleId visu_colorization_getScaleType
(const VisuColorization *dt
);
Retrieve the scaling method of input data associated to the given dt
.
|
a VisuColorization object. [allow-none] |
Returns : |
the scaling method if dt is not NULL
or the default value if not. |
int visu_colorization_getScalingUsed (const VisuColorization *dt
);
Retrieve if a column is used as entry to scale the nodes.
|
a VisuColorization object hosting the data values. [allow-none] |
Returns : |
-1 if no scaling is used. |
ToolShade * visu_colorization_getShade (const VisuColorization *dt
);
Return the shade used to colourise the nodes.
|
the VisuColorization object which the colour data are associated to. [allow-none] |
Returns : |
the ToolShade used (own by V_Sim). [transfer none] |
gboolean visu_colorization_getSingleColumnId (const VisuColorization *dt
,gint *id
);
The colourisation can be applied from values coming from several
columns. But, if only one column is used, this routine will give it
in id
.
|
a VisuColorization object. |
|
a location to store a column id. [out] |
Returns : |
FALSE if several columns are used, or TRUE if a single column is used for the colourisation. |
gboolean visu_colorization_getUsed (const VisuColorization *dt
);
This method retrieve the used flag, see visu_colorization_setUsed()
to set it.
|
a VisuColorization object to get if the colorisation tool is set or not ;. [allow-none] |
Returns : |
1 if the used flag is set. |
int visu_colorization_init ();
Called by V_Sim on startup, should not be called again.
Returns : |
1 if eveything goes right. |
VisuColorization * visu_colorization_new ();
Create a new object to store colorisation data.
Returns : |
a newly created VisuColorization. [transfer full] |
Since 3.7
VisuColorization * visu_colorization_new_fromData (VisuData *dataObj
,guint nbColumns
,GArray *data
,gboolean *new
);
Add colourisation data to dataObj
.
|
a VisuData object. |
|
an integer. |
|
the colorization data. [element-type gfloat] |
|
a location for a boolean. [allow-none][out caller-allocates] |
Returns : |
a newly created VisuColorization or NULL. [transfer full] |
Since 3.7
VisuColorization * visu_colorization_new_fromFile (VisuData *data
,const char *filename
,gboolean *new
,GError **error
);
Call this method to parse a data file and associate its values to the given VisuData object.
|
a VisuData object to attach the data file to ; |
|
the path to find the data file on the disk ; |
|
a location for a boolean. [allow-none][out caller-allocates] |
|
a location to a NULL GError. |
Returns : |
a newly created VisuColorization or NULL. [transfer full] |
VisuColorization * visu_colorization_ref (VisuColorization *dt
);
Increase the ref counter.
|
a VisuColorization object. |
Returns : |
itself. |
Since 3.7
gboolean visu_colorization_setColUsed (VisuColorization *dt
,int val
,int pos
);
Choose if the loaded value should change the given channel of the colour.
|
a VisuColorization object ; |
|
a column id a special value ; |
|
an integer in [0;2]. |
Returns : |
TRUE if VisuNodeArray::RenderingChanged should be emitted. |
void visu_colorization_setHidingFunc (VisuColorization *dt
,VisuColorizationHidingFunc func
,gpointer data
,GDestroyNotify destroy
);
Set the hiding function to be called when
visu_colorization_applyHide()
is used.
|
a VisuColorization object. |
|
a VisuColorizationHidingFunc function. [allow-none][closure data] |
|
some data. [closure] |
|
a destroy function for data . |
Since 3.7
gboolean visu_colorization_setMax (VisuColorization *dt
,float max
,int column
);
When the scaling method is VISU_COLORIZATION_MINMAX (see VisuColorizationInputScaleId)
min and max value for convert input data are user defined. Use this method
to choose the maximum bound. This method raises
a error if no input file has already been associated to the give visuData
.
|
a VisuColorization object ; |
|
a floating point value. |
|
a column id. |
Returns : |
TRUE if VisuNodeArray::RenderingChanged should be emitted. |
gboolean visu_colorization_setMin (VisuColorization *dt
,float min
,int column
);
When the scaling method is VISU_COLORIZATION_MINMAX (see VisuColorizationInputScaleId)
min and max value for convert input data are user defined. Use this method
to choose the minimum bound. This method raises
a error if no input file has already been associated to the give visuData
.
|
a VisuColorization object ; |
|
a floating point value. |
|
a column id. |
Returns : |
TRUE if VisuNodeArray::RenderingChanged should be emitted. |
gboolean visu_colorization_setRestrictInRange (VisuColorization *dt
,gboolean status
);
The colourisation can be applied on all nodes or on nodes within
range. See visu_colorization_getRestrictInRange()
and
visu_colorization_setMin()
and visu_colorization_setMax()
.
|
a VisuColorization object with some data file information. |
|
a boolean. |
Returns : |
TRUE if the status is changed indeed. |
Since 3.7
gboolean visu_colorization_setScaleType (VisuColorization *dt
,VisuColorizationInputScaleId scale
);
This method is used to change the scale method used on input data.
See VisuColorizationInputScaleId for further informations. This method raises
a error if no input file has already been associated to the give visuData
.
|
a VisuColorization object ; |
|
an integer. |
Returns : |
TRUE if VisuNodeArray::RenderingChanged should be emitted. |
gboolean visu_colorization_setScalingUsed (VisuColorization *dt
,int val
);
Give the column id to used to take the scaling values from. Set -1 if no scaling used. The scaling is used to change the size of each node, using an homothetic factor.
|
a VisuColorization object hosting the data values ; |
|
a column id. |
Returns : |
TRUE if the status changed. |
gboolean visu_colorization_setShade (VisuColorization *dt
,ToolShade *shade
);
Apply all caracteristic of the given shade to the colorization the the given VisuObject.
|
the VisuColorization object which the colour data are associated to ; |
|
a valid ToolShade object. |
Returns : |
TRUE if VisuNodeArray::RenderingChanged should be emitted. |
gboolean visu_colorization_setUsed (VisuData *data
,int val
);
When TRUE, rendering is modified by applying a colorization
method to normal nodes. The color used depend on input data. See
visu_colorization_new_fromFile()
to choose them.
|
a VisuData object to set the colorisation tool or not ; |
|
a boolean. |
Returns : |
TRUE if val is true and if a valid input file is already in memory. |
void visu_colorization_unref (VisuColorization *dt
);
Decrease the ref counter, free all memory if counter reachs zero.
|
a VisuColorization object. |
Since 3.7