VisuMap

VisuMap — Describe how to handle and draw coloured map on a plane from a density field.

Functions

Properties

VisuScalarField * field Read / Write
VisuPlane * plane Read / Write
GArray * range-min-max Read / Write
guint scale Read / Write
VisuSurface * surface Read / Write

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── ToolDbgObj
        ╰── VisuMap

Description

A map is a coloured representation of a scalar field on a plane. To define a new map, use visu_map_new_fromPlane() and use visu_map_setField() to associate a scalarfield to it.

The representation of the map is done by an adaptive mesh of triangles. One can adjust the size of the smaller resolution by using visu_map_setLevel(). Finally the level of adaptiveness is chosen at rendering time by choosing a more or less crude precision argument to visu_map_draw().

In adition to the colour representation, isolines can be drawn at given iso-values, see visu_map_setLines().

An additionnal capability allows to export VisuMap into SVG or PDF vector files.

Functions

visu_map_new ()

VisuMap *
visu_map_new ();

Creates a new VisuMap object.

Returns

a newly created VisuMap object.

[transfer full]

Since: 3.6


visu_map_new_fromPlane ()

VisuMap *
visu_map_new_fromPlane (VisuPlane *plane);

Creates a new VisuMap object, projected on plane .

Parameters

plane

a VisuPlane object.

 

Returns

a newly created VisuMap object.

Since: 3.6


visu_map_setPlane ()

gboolean
visu_map_setPlane (VisuMap *map,
                   VisuPlane *plane);

Set the internal VisuPlane of map to plane . All changed to plane will be automatically propagated to map . Use visu_map_setField() to choose the field to take values from, set the level precision with visu_map_setLevel().

Parameters

map

a VisuMap object.

 

plane

a VisuPlane object.

[transfer full][allow-none]

Returns

TRUE if internal plane is changed.

Since: 3.7


visu_map_setSurface ()

gboolean
visu_map_setSurface (VisuMap *map,
                     VisuSurface *surface);

Set the internal VisuSurface of map to surface . All changed to surface will be automatically propagated to map . Use visu_map_setField() to choose the field to take values from, set the level precision with visu_map_setLevel().

Parameters

map

a VisuMap object.

 

surface

a VisuSurface object.

[transfer full][allow-none]

Returns

TRUE if internal surface is changed.

Since: 3.8


visu_map_setField ()

gboolean
visu_map_setField (VisuMap *map,
                   VisuScalarField *field);

It associates the values of field to map .

Parameters

map

a VisuMap object.

 

field

a VisuScalarField object.

 

Returns

TRUE if field is changed.

Since: 3.6


visu_map_setLevel ()

gboolean
visu_map_setLevel (VisuMap *map,
                   float glPrec,
                   float gross,
                   float refLength);

Setup the level of recursivity in triangle calculation, depending on the current zoom level.

Parameters

map

a VisuMap object.

 

glPrec

the global OpenGL precision for drawing (default is 1.).

 

gross

current zoom level.

 

refLength

a reference length (see visu_gl_camera_getRefLength()).

 

Returns

TRUE if the level is actually changed.

Since: 3.6


visu_map_setLines ()

gboolean
visu_map_setLines (VisuMap *map,
                   guint nIsoLines,
                   float minmax[2]);

Calculate nIsoLines equally distributed in minmax .

Parameters

map

a VisuMap object.

 

nIsoLines

number of required isolines.

 

minmax

span for isoline values.

 

Returns

TRUE if lines are successfully calculated.

Since: 3.6


visu_map_setScaling ()

gboolean
visu_map_setScaling (VisuMap *map,
                     ToolMatrixScalingFlag scale);

The scaling algorithm to transform input values into [0;1] is defined by scale .

Parameters

map

a VisuMap object.

 

scale

a flag.

 

Returns

TRUE if scale is changed.

Since: 3.8


visu_map_setScalingRange ()

gboolean
visu_map_setScalingRange (VisuMap *map,
                          const float *minMax);

If minMax is provided, these values are used to scale the values of field to [0;1], otherwise the minMax values of the field itself are used.

Parameters

map

a VisuMap object.

 

minMax

two floats defining a range for input scaling.

[allow-none][array fixed-size=2]

Returns

TRUE if minMax is changed.

Since: 3.8


visu_map_compute_sync ()

void
visu_map_compute_sync (VisuMap *map);

For later use. Currently computation of maps is always synchronous.

Parameters

map

a VisuMap object.

 

Since: 3.8


visu_map_getPlane ()

VisuPlane *
visu_map_getPlane (VisuMap *map);

Retrieves the plane map is based on.

Parameters

map

a VisuMap object.

 

Returns

a VisuPlane or NULL.

[transfer none][allow-none]

Since: 3.7


visu_map_getField ()

VisuScalarField *
visu_map_getField (VisuMap *map);

Retrieves the field map is projected from.

Parameters

map

a VisuMap object.

 

Returns

a VisuScalarField or NULL.

[transfer none][allow-none]

Since: 3.8


visu_map_getScaledMinMax ()

gboolean
visu_map_getScaledMinMax (const VisuMap *map,
                          float minMax[2]);

After map has been computed, one can access the scaled min and max values represented in the map. For field values, see visu_map_getFieldMinMax().

Parameters

map

a VisuMap object.

 

minMax

two float location.

[out caller-allocates][array fixed-size=2]

Returns

TRUE if the map has been computed and minMax has valid values.

Since: 3.6


visu_map_getFieldMinMax ()

float *
visu_map_getFieldMinMax (VisuMap *map);

After map has been computed, one can access the min and max values of the field as represented in the map. For scaled values, see visu_map_getScaledMinMax().

Parameters

map

a VisuMap object.

 

Returns

two floats being the min and the max.

Since: 3.6


visu_map_getScalingRange ()

const float *
visu_map_getScalingRange (const VisuMap *map);

Retrieves the min and max values used to scale the data in map .

Parameters

map

a VisuMap object.

 

Returns

a min / max range.

[array fixed-size=2]

Since: 3.8


visu_map_getLegendScale ()

float
visu_map_getLegendScale ();

Retrieve information about the static legend attached to maps.

Returns

the scale factor of the static legend associated to maps.

Since: 3.7


visu_map_getLegendPosition ()

float
visu_map_getLegendPosition (ToolXyzDir dir);

Retrieve information about the static legend attached to maps.

Parameters

Returns

the static legend position on screen in reduced coordinates.

Since: 3.7


visu_map_draw ()

void
visu_map_draw (VisuMap *map,
               float prec,
               ToolShade *shade,
               float *rgb,
               gboolean alpha);

It draws the map with the given shade . prec give the level of refinement used to draw the map, 100 means normal and 200 means twice smaller level. If rgb is present, this colour is used for possible isolines. If alpha is TRUE, an alpha channel is added as a linear variation of the value of each vertex.

Parameters

map

a VisuMap object.

 

prec

a pourcentage value.

 

shade

a ToolShade object.

 

rgb

a colour or NULL.

 

alpha

a boolean.

 

Since: 3.6


visu_map_export ()

gboolean
visu_map_export (VisuMap *map,
                 const ToolShade *shade,
                 const float *rgb,
                 float precision,
                 const gchar *filename,
                 VisuMapExportFormat format,
                 GError **error);

Export the given map to the format , using the shade color. If rgb is provided and map has some isolines, they will be drawn with this colour, otherwise an inverse colour is used.

Parameters

map

a VisuMap object.

 

shade

a ToolShade object.

 

rgb

a colour (can be NULL).

 

precision

a pourcentage for rendering quality.

 

filename

the location to export to.

 

format

the kind of format.

 

error

a location to store an error.

 

Returns

TRUE if no error.

Since: 3.6

Types and Values

enum VisuMapExportFormat

Possible export for the map, see visu_map_export().

Members

VISU_MAP_EXPORT_SVG

SVG export ;

 

VISU_MAP_EXPORT_PDF

PDF export.

 

Since: 3.6


struct VisuMap

struct VisuMap;

Common name to refer to a _VisuMap.

Property Details

The “field” property

  “field”                    VisuScalarField *

projection field.

Flags: Read / Write


The “plane” property

  “plane”                    VisuPlane *

projection plane.

Flags: Read / Write


The “range-min-max” property

  “range-min-max”            GArray *

min / max range to normalise data.

Flags: Read / Write


The “scale” property

  “scale”                    guint

scaling scheme of input values.

Flags: Read / Write

Allowed values: <= 2

Default value: 0


The “surface” property

  “surface”                  VisuSurface *

projection surface.

Flags: Read / Write

Signal Details

The “changed” signal

void
user_function (VisuMap *map,
               gpointer user_data)

This signal is emitted each time the map has been changed and recomputed.

Parameters

map

the object emitting the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: No Hooks

Since: 3.8