VisuColorization

VisuColorization — Adds a possibility to colorize nodes depending on data read in an input file.

Functions

Properties

gboolean apply-all Read / Write
VisuBox * box Read / Write
gint column-blue Read / Write
gint column-green Read / Write
gint column-red Read / Write
gint column-size Read / Write
GArray * data-min-max Read
guint n-columns Read
guint normalisation Read / Write
GArray * range-min-max Read / Write
ToolShade * shade Read / Write
gint single-param Read / Write
ToolMinmax * single-range Read
gchar * source-file Read

Types and Values

Object Hierarchy

    GObject
    ╰── ToolDbgObj
        ╰── VisuDataColorizer
            ╰── VisuColorization

Implemented Interfaces

VisuColorization implements VisuNodeMasker.

Description

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(). 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_data_colorizer_setActive().

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.

It is implementing VisuNodeMasker interface, thus allowing to hide nodes depending on colorization values.

Functions

visu_colorization_new ()

VisuColorization *
visu_colorization_new ();

Create a new object to store colorisation data.

Returns

a newly created VisuColorization.

[transfer full]

Since: 3.7


visu_colorization_new_fromCLI ()

VisuColorization *
visu_colorization_new_fromCLI (VisuData *dataObj,
                               GError **error);

Use all command line options related to colorization to create a new colorization object, storing its values in dataObj .

Parameters

dataObj

a VisuData object.

 

error

an error location.

[allow-none]

Returns

a newly created VisuColorization object.

[transfer full]

Since: 3.8


visu_colorization_setBox ()

gboolean
visu_colorization_setBox (VisuColorization *dt,
                          VisuBox *box);

Change the associated box for dt . This box is used for the coordinate colourisation.

Parameters

dt

a VisuColorization object.

 

box

a VisuBox object.

[allow-none]

Returns

TRUE if value has been changed.

Since: 3.8


visu_colorization_setNodeModel ()

void
visu_colorization_setNodeModel (VisuColorization *dt,
                                VisuNodeValuesFarray *values);

Change the VisuNodeValuesFarray this dt is associated to.

Parameters

dt

a VisuColorization object.

 

values

a VisuNodeValuesFarray object.

[allow-none]

Since: 3.8


visu_colorization_setScaleType ()

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 .

Parameters

dt

a VisuColorization object ;

 

scale

an integer.

 

Returns

TRUE if VisuNodeArray::RenderingChanged should be emitted.


visu_colorization_getScaleType ()

VisuColorizationInputScaleId
visu_colorization_getScaleType (const VisuColorization *dt);

Retrieve the scaling method of input data associated to the given dt .

Parameters

dt

a VisuColorization object.

[allow-none]

Returns

the scaling method if dt is not NULL or the default value if not.


visu_colorization_setMin ()

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 .

Parameters

dt

a VisuColorization object ;

 

min

a floating point value.

 

column

a column id.

 

Returns

TRUE if VisuNodeArray::RenderingChanged should be emitted.


visu_colorization_setMax ()

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 .

Parameters

dt

a VisuColorization object ;

 

max

a floating point value.

 

column

a column id.

 

Returns

TRUE if VisuNodeArray::RenderingChanged should be emitted.


visu_colorization_getMin ()

float
visu_colorization_getMin (const VisuColorization *dt,
                          int column);

Retrieve the minimum value used when scaling is user defined.

Parameters

dt

a VisuData object.

[allow-none]

column

a column id.

 

Returns

the minimum bound if dt is not NULL or the default value if not.


visu_colorization_getMax ()

float
visu_colorization_getMax (const VisuColorization *dt,
                          int column);

Retrieve the maximum value used when scaling is user defined.

Parameters

dt

a VisuData object.

[allow-none]

column

a column id.

 

Returns

the maximum bound if dt is not NULL or the default value if not.


visu_colorization_setColUsed ()

gboolean
visu_colorization_setColUsed (VisuColorization *dt,
                              int val,
                              int pos);

Choose if the loaded value should change the given channel of the colour.

Parameters

dt

a VisuColorization object ;

 

val

a column id a special value ;

 

pos

an integer in [0;2].

 

Returns

TRUE if VisuNodeArray::RenderingChanged should be emitted.


visu_colorization_setColUsedArr ()

gboolean
visu_colorization_setColUsedArr (VisuColorization *dt,
                                 const int vals[3]);

Setup all three channels at once, see visu_colorization_setColUsed().

Parameters

dt

a VisuColorization object.

 

vals

the new columns to be used per channel.

[array fixed-size=3]

Returns

TRUE if any changes.

Since: 3.8


visu_colorization_getColUsed ()

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.

Parameters

dt

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]


visu_colorization_getNColumns ()

int
visu_colorization_getNColumns (const VisuColorization *dt);

This method is used to retrieve the number of columns of data read in the loaded file.

Parameters

dt

a VisuColorization object.

 

Returns

this number of columns, or -1 if none.


visu_colorization_getSingleColumnId ()

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 .

Parameters

dt

a VisuColorization object.

[allow-none]

id

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.


visu_colorization_setShade ()

gboolean
visu_colorization_setShade (VisuColorization *dt,
                            const ToolShade *shade);

Apply all caracteristic of the given shade to the colorization dt .

Parameters

dt

the VisuColorization object which the colour data are associated to ;

 

shade

a valid ToolShade object.

 

Returns

TRUE if VisuNodeArray::RenderingChanged should be emitted.


visu_colorization_getShade ()

const ToolShade *
visu_colorization_getShade (const VisuColorization *dt);

Return the shade used to colourise the nodes.

Parameters

dt

the VisuColorization object which the colour data are associated to.

[allow-none]

Returns

the ToolShade used (own by V_Sim).

[transfer none]


visu_colorization_setScalingUsed ()

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.

Parameters

dt

a VisuColorization object hosting the data values ;

 

val

a column id.

 

Returns

TRUE if the status changed.


visu_colorization_getScalingUsed ()

int
visu_colorization_getScalingUsed (const VisuColorization *dt);

Retrieve if a column is used as entry to scale the nodes.

Parameters

dt

a VisuColorization object hosting the data values.

[allow-none]

Returns

-1 if no scaling is used.


visu_colorization_setRestrictInRange ()

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().

Parameters

dt

a VisuColorization object with some data file information.

 

status

a boolean.

 

Returns

TRUE if the status is changed indeed.

Since: 3.7


visu_colorization_getRestrictInRange ()

gboolean
visu_colorization_getRestrictInRange (const VisuColorization *dt);

The colourisation can be applied on all nodes or on nodes within range. See visu_colorization_setRestrictInRange().

Parameters

dt

a VisuColorization object with some data file information.

 

Returns

TRUE if colourisation is done only if values are in range.

Since: 3.7


visu_colorization_getFile ()

const gchar *
visu_colorization_getFile (const VisuColorization *dt);

If the given dt has an input data file already loaded, it returns its name.

Parameters

dt

a VisuColorization object.

[allow-none]

Returns

the name of the input data file if set.

Types and Values

enum VisuColorizationInputScaleId

Control how input data are converted into [0;1], after conversion, values are clamped if needed.

Members

VISU_COLORIZATION_NORMALIZE

input data are converted into [0;1] using input min/max values.

 

VISU_COLORIZATION_MINMAX

input data are converted into [0;1] using user defined min/max values.

 

VISU_COLORIZATION_UNSET

#define VISU_COLORIZATION_UNSET  -4

To be used when a column id is awaited. A constant value will then be used.


VISU_COLORIZATION_FROM_X

#define VISU_COLORIZATION_FROM_X  -3

To be used when a column id is awaited. The reduced coordinate in x direction will then be used.


VISU_COLORIZATION_FROM_Y

#define VISU_COLORIZATION_FROM_Y  -2

To be used when a column id is awaited. The reduced coordinate in y direction will then be used.


VISU_COLORIZATION_FROM_Z

#define VISU_COLORIZATION_FROM_Z  -1

To be used when a column id is awaited. The reduced coordinate in z direction will then be used.


VISU_COLORIZATION_LABEL

#define VISU_COLORIZATION_LABEL _("Colorization data")

Default label used to name colourisation data.


struct VisuColorization

struct VisuColorization;

An opaque structure to store colorisation settings.

Since: 3.7


struct VisuColorizationClass

struct VisuColorizationClass {
  VisuDataColorizerClass parent;
};

Common name to refer to a _VisuColorizationClass.

Members

VisuDataColorizerClass parent;

private.

 

Property Details

The “apply-all” property

  “apply-all”                gboolean

apply colorization on all nodes.

Flags: Read / Write

Default value: TRUE


The “box” property

  “box”                      VisuBox *

box.

Flags: Read / Write


The “column-blue” property

  “column-blue”              gint

column the blue channel is read from.

Flags: Read / Write

Allowed values: >= -4

Default value: -4


The “column-green” property

  “column-green”             gint

column the green channel is read from.

Flags: Read / Write

Allowed values: >= -4

Default value: -4


The “column-red” property

  “column-red”               gint

column the red channel is read from.

Flags: Read / Write

Allowed values: >= -4

Default value: -4


The “column-size” property

  “column-size”              gint

column the size factor is read from.

Flags: Read / Write

Allowed values: >= -4

Default value: -4


The “data-min-max” property

  “data-min-max”             GArray *

min / max values of data.

Flags: Read


The “n-columns” property

  “n-columns”                guint

number of columns.

Flags: Read

Default value: 0


The “normalisation” property

  “normalisation”            guint

input normalisation scheme.

Flags: Read / Write

Allowed values: <= 1

Default value: 0


The “range-min-max” property

  “range-min-max”            GArray *

min / max range to normalise data.

Flags: Read / Write


The “shade” property

  “shade”                    ToolShade *

shading scheme.

Flags: Read / Write


The “single-param” property

  “single-param”             gint

colorization data is single variable.

Flags: Read / Write

Allowed values: >= -4

Default value: -4


The “single-range” property

  “single-range”             ToolMinmax *

applied min and max values.

Flags: Read


The “source-file” property

  “source-file”              gchar *

Source file if any.

Flags: Read

Default value: NULL