![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
VisuMap; enum VisuMapExportFormat; void visu_map_compute (VisuMap *map
); void visu_map_draw (VisuMap *map
,float prec
,ToolShade *shade
,float *rgb
,gboolean alpha
); gboolean visu_map_export (VisuMap *map
,ToolShade *shade
,float *rgb
,float precision
,gchar *filename
,VisuMapExportFormat format
,GError **error
); void visu_map_free (VisuMap *map
); float * visu_map_getFieldMinMax (VisuMap *map
); VisuPlane * visu_map_getPlane (VisuMap *map
); float * visu_map_getScaledMinMax (VisuMap *map
); void visu_map_init (); VisuMap * visu_map_new (); VisuMap * visu_map_newFromPlane (VisuPlane *plane
); VisuMap * visu_map_ref (VisuMap *map
); gboolean visu_map_setField (VisuMap *map
,VisuScalarField *field
,ToolMatrixScalingFlag scale
,float *inputMinMax
); gboolean visu_map_setLevel (VisuMap *map
,float glPrec
,float gross
,float refLength
); gboolean visu_map_setLines (VisuMap *map
,guint nIsoLines
,float minmax[2]
); gboolean visu_map_setPlane (VisuMap *map
,VisuPlane *plane
); void visu_map_unref (VisuMap *map
);
A map is a coloured representation of a scalar field on a
plane. To define a new map, use visu_map_newFromPlane()
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.
typedef enum { VISU_MAP_EXPORT_SVG, VISU_MAP_EXPORT_PDF } VisuMapExportFormat;
Possible export for the map, see visu_map_export()
.
Since 3.6
void visu_map_compute (VisuMap *map
);
After a VisuPlane and a VisuScalarField has been defined (see
visu_map_newFromPlane()
and visu_map_setField()
), the map is
computed by refining a triangle approximation up to level defined
by visu_map_setLevel()
. The evaluation is lazy and calculation is
indeed done, only if required level is lower than actual
level. Calculation is done only for missing levels anyway.
|
a VisuMap object. |
Since 3.6
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.
|
a VisuMap object. |
|
a pourcentage value. |
|
a ToolShade object. |
|
a colour or NULL. |
|
a boolean. |
Since 3.6
gboolean visu_map_export (VisuMap *map
,ToolShade *shade
,float *rgb
,float precision
,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.
|
a VisuMap object. |
|
a ToolShade object. |
|
a colour (can be NULL). |
|
a pourcentage for rendering quality. |
|
the location to export to. |
|
the kind of format. |
|
a location to store an error. |
Returns : |
TRUE if no error. |
Since 3.6
void visu_map_free (VisuMap *map
);
Deallocate all memory related to map
.
|
a VisuMap object. |
Since 3.6
float * visu_map_getFieldMinMax (VisuMap *map
);
After map
has been computed by visu_map_compute()
, one can access
the min and max values of the field as represented in the map. For
scaled values, see visu_map_getScaledMinMax()
.
|
a VisuMap object. |
Returns : |
two floats being the min and the max. |
Since 3.6
VisuPlane * visu_map_getPlane (VisuMap *map
);
Retrieves the plane map
is based on.
Since 3.7
float * visu_map_getScaledMinMax (VisuMap *map
);
After map
has been computed by visu_map_compute()
, one can access
the scaled min and max values represented in the map. For
field values, see visu_map_getFieldMinMax()
.
|
a VisuMap object. |
Returns : |
two floats being the min and the max in [0;1]. |
Since 3.6
void visu_map_init ();
Initialise the map routines. Should not be called except at initialisation time.
Since 3.7
VisuMap * visu_map_new ();
Creates a new VisuMap object.
Returns : |
a newly created VisuMap object. [transfer full] |
Since 3.6
VisuMap * visu_map_newFromPlane (VisuPlane *plane
);
Creates a new VisuMap object, projected on plane
.
Since 3.6
VisuMap * visu_map_ref (VisuMap *map
);
Increase the ref counter.
|
a VisuMap object. |
Returns : |
itself. |
Since 3.7
gboolean visu_map_setField (VisuMap *map
,VisuScalarField *field
,ToolMatrixScalingFlag scale
,float *inputMinMax
);
It associates the values of field
to map
. The calculation is not
directly done, and a call to visu_map_compute()
is necessary. If
inputMinMax
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. The scaling algorithm is defined by scale
.
|
a VisuMap object. |
|
a VisuScalarField object. |
|
a flag. |
|
two floats or NULL. |
Returns : |
TRUE if field is changed. |
Since 3.6
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.
|
a VisuMap object. |
|
the global OpenGL precision for drawing (default is 1.). |
|
current zoom level. |
|
a reference length (see visu_gl_camera_getRefLength() ). |
Returns : |
TRUE if the level is actually changed. |
Since 3.6
gboolean visu_map_setLines (VisuMap *map
,guint nIsoLines
,float minmax[2]
);
Calculate nIsoLines
equally distributed in minmax
.
|
a VisuMap object. |
|
number of required isolines. |
|
span for isoline values. |
Returns : |
TRUE if lines are successfully calculated. |
Since 3.6
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()
and finally call
visu_map_compute()
to get the map.
|
a VisuMap object. |
|
a VisuPlane object. [transfer full][allow-none] |
Returns : |
TRUE if internal plane is changed. |
Since 3.7