![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum DataFileInputScaleId; #define VISU_ERROR_DATA_FILE GQuark dataFileGet_quark (); enum DataFileErrorFlag; int initDataFileModule (); void dataFileReDraw (VisuData *data
); gboolean dataFileSet_used (VisuData *data
,int val
); int dataFileGet_used (VisuData *data
); gboolean dataFileSet_file (VisuData *data
,const char *filename
,gboolean *new
,GError **error
); gboolean dataFileGet_fileSet (VisuData *visuData
); gchar* dataFileGet_file (VisuData *visuData
); gboolean dataFileGet_fileMinMaxFromColumn (VisuData *visuData
,float minMax[2]
,int column
); gboolean dataFileSet_scaleType (VisuData *visuData
,DataFileInputScaleId scale
); DataFileInputScaleId dataFileGet_scaleType (VisuData *visuData
); gboolean dataFileSet_min (VisuData *visuData
,float min
); gboolean dataFileSet_max (VisuData *visuData
,float max
); float dataFileGet_min (VisuData *visuData
); float dataFileGet_max (VisuData *visuData
); gboolean dataFileSet_colUsed (VisuData *visuData
,int val
,int pos
); int* dataFileGet_colUsed (VisuData *visuData
); int dataFileGet_nbColumns (VisuData *visuData
); gboolean dataFileSet_shade (VisuData *visuData
,Shade *shade
); Shade* dataFileGet_shade (VisuData *visuData
); gboolean dataFileSet_scalingUsed (VisuData *visuData
,int val
); int dataFileGet_scalingUsed (VisuData *visuData
); gboolean dataFileApply_hideOnMinValue (VisuData *visuData
,int column
,float value
);
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 dataFileSet_file()
. 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
dataFileSet_used()
.
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 dataFileApply_hideOnMinValue()
, it is possible to hide
some nodes depending on given input data. If the column
argument
is -1, it unmask all nodes.
typedef enum { dataFile_normalize, dataFile_minMax } DataFileInputScaleId;
Control how input data are converted into [0;1], after conversion, values are clamped if needed.
GQuark dataFileGet_quark ();
Internal routine for error handling.
Returns : |
the GQuark associated to errors related to colour data files. |
typedef enum { DATA_FILE_ERROR_NO_COLUMN, DATA_FILE_ERROR_MISSING_DATA } DataFileErrorFlag;
Possible errors when reading a file with column data.
int initDataFileModule ();
Called by V_Sim on startup, should not be called again.
Returns : |
1 if eveything goes right. |
void dataFileReDraw (VisuData *data
);
This methods is a short-cut to call visu_data_createAllNodes()
and then emit the
'OpenGLAskForReDraw' signal.
May become deprecated soon.
|
a VisuData object that holds the data file informations. |
gboolean dataFileSet_used (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
dataFileSet_file()
to choose them.
|
a VisuData object to set the colorisation tool or not ; |
|
a boolean integer. |
Returns : |
TRUE if val is true and if a valid input file is already in memory. |
int dataFileGet_used (VisuData *data
);
This method retrieve the used flag, see dataFileSet_used()
to set it.
|
a VisuData object to get if the colorisation tool is set or not ; |
Returns : |
1 if the used flag is set. |
gboolean dataFileSet_file (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.
gboolean dataFileGet_fileSet (VisuData *visuData
);
A set of data per node can be associated to a VisuData. This
routine retrieves if visuData
has it or not.
|
a VisuData object. |
Returns : |
TRUE if visuData has colour data associated.
|
Since 3.6
gchar* dataFileGet_file (VisuData *visuData
);
If the given visuData
has an input data file already loaded, it returns its name.
|
a VisuData object. |
Returns : |
the name of the input data file if set. This name is own by V_Sim and should not be freed. |
gboolean dataFileGet_fileMinMaxFromColumn (VisuData *visuData
,float minMax[2]
,int 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 VisuData 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.
|
gboolean dataFileSet_scaleType (VisuData *visuData
,DataFileInputScaleId scale
);
This method is used to change the scale method used on input data.
See DataFileInputScaleId for further informations. This method raises
a error if no input file has already been associated to the give visuData
.
|
a VisuData object ; |
|
an integer. |
Returns : |
1 if visu_data_createAllNodes() should be called.
|
DataFileInputScaleId dataFileGet_scaleType (VisuData *visuData
);
Retrieve the scaling method of input data associated to the given visuData
.
|
a VisuData object. |
Returns : |
the scaling method if visuData has an input data file associated
or the default value if not.
|
gboolean dataFileSet_min (VisuData *visuData
,float min
);
When the scaling method is dataFile_minMax (see DataFileInputScaleId)
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 VisuData object ; |
|
a floating point value. |
Returns : |
1 if visu_data_createAllNodes() should be called.
|
gboolean dataFileSet_max (VisuData *visuData
,float max
);
When the scaling method is dataFile_minMax (see DataFileInputScaleId)
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 VisuData object ; |
|
a floating point value. |
Returns : |
1 if visu_data_createAllNodes() should be called.
|
float dataFileGet_min (VisuData *visuData
);
Retrieve the minimum value used when scaling is user defined.
|
a VisuData object. |
Returns : |
the minimum bound if visuData has an input data file associated
or the default value if not.
|
float dataFileGet_max (VisuData *visuData
);
Retrieve the maximum value used when scaling is user defined.
|
a VisuData object. |
Returns : |
the maximum bound if visuData has an input data file associated
or the default value if not.
|
gboolean dataFileSet_colUsed (VisuData *visuData
,int val
,int pos
);
Choose if the loaded value should change the given channel of the colour.
|
a VisuData object ; |
|
0 or 1 ; |
|
an integer in [0;2]. |
Returns : |
1 if visu_data_createAllNodes() should be called.
|
int* dataFileGet_colUsed (VisuData *visuData
);
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. |
Returns : |
a three value array, own by V_Sim. It should not be freed. |
int dataFileGet_nbColumns (VisuData *visuData
);
This method is used to retrieve the number of columns of data read in the loaded file.
|
a VisuData object. |
Returns : |
this number of columns. |
gboolean dataFileSet_shade (VisuData *visuData
,Shade *shade
);
Apply all caracteristic of the given shade to the colorization the the given VisuObject.
|
the VisuData object which the colour data are associated to ; |
|
a valid Shade object. |
Returns : |
TRUE if visu_data_createAllNodes() should be called.
|
Shade* dataFileGet_shade (VisuData *visuData
);
Return the shade used to colourise the nodes.
|
the VisuData object which the colour data are associated to. |
Returns : |
the Shade used (own by V_Sim). |
gboolean dataFileSet_scalingUsed (VisuData *visuData
,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 VisuData object hosting the data values ; |
|
a column id. |
Returns : |
TRUE if the status changed. |
int dataFileGet_scalingUsed (VisuData *visuData
);
Retrieve if a column is used as entry to scale the nodes.
|
a VisuData object hosting the data values. |
Returns : |
-1 if no scaling is used. |
gboolean dataFileApply_hideOnMinValue (VisuData *visuData
,int column
,float value
);
Use this method hide nodes whose data from column column
is
lower than the given value
. If column
is -1, then all previous
masking are cancelled.
|
the VisuData object which the colour data are associated to ; |
|
a integer corresponding to a column id ; |
|
a floating point value. |
Returns : |
TRUE if visu_data_createAllNodes() should be called and
"NodeRenderedChanged" signal should be emitted (with a
NULL VisuElement parameter).
|