![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum VisuMapExportFormat; VisuMap; VisuMap* visu_map_new (); VisuMap* visu_map_newFromPlane (Plane *plane
); void visu_map_free (VisuMap *map
); gboolean visu_map_setField (VisuMap *map
,ScalarField *field
,ToolMatrixScalingFlag scale
,float *inputMinMax
,float ext[3]
); gboolean visu_map_setLevel (VisuMap *map
,float gross
,float boxSpan
); gboolean visu_map_setLines (VisuMap *map
,guint nIsoLines
,float minmax[2]
); float* visu_map_getScaledMinMax (VisuMap *map
); float* visu_map_getFieldMinMax (VisuMap *map
); int visu_map_getGlListId (VisuMap *map
); void visu_map_compute (VisuMap *map
); void visu_map_draw (VisuMap *map
,float prec
,Shade *shade
,float *rgb
,gboolean alpha
,gboolean direct
); gboolean visu_map_export (VisuMap *map
,Shade *shade
,float *rgb
,float precision
,gchar *filename
,VisuMapExportFormat format
,GError **error
);
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
VisuMap* visu_map_new ();
Creates a new VisuMap object.
Returns : |
a newly created VisuMap object. |
Since 3.6
VisuMap* visu_map_newFromPlane (Plane *plane
);
Creates a new VisuMap object, projected on plane
.
Since 3.6
void visu_map_free (VisuMap *map
);
Deallocate all memory related to map
.
|
a VisuMap object. |
Since 3.6
gboolean visu_map_setField (VisuMap *map
,ScalarField *field
,ToolMatrixScalingFlag scale
,float *inputMinMax
,float ext[3]
);
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 ScalarField object. |
|
a flag. |
|
two floats or NULL. |
|
the box extension. |
Returns : |
a newly created VisuMap object. |
Since 3.6
gboolean visu_map_setLevel (VisuMap *map
,float gross
,float boxSpan
);
Setup the level of recursivity in triangle calculation, depending on the current zoom level.
|
a VisuMap object. |
|
current zoom level. |
|
the size of the rendering box. |
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
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
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
int visu_map_getGlListId (VisuMap *map
);
When visu_map_draw()
is called with direct being FALSE, one can
access the OpenGL list used to draw the map with this routine.
|
a VisuMap object. |
Returns : |
the OpenGL list id for this map. |
Since 3.6
void visu_map_compute (VisuMap *map
);
After a Plane and a ScalarField 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
,Shade *shade
,float *rgb
,gboolean alpha
,gboolean direct
);
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. If direct
is
FALSE, the drawing is compiled in a list available by calling
visu_map_getGlListId()
.
|
a VisuMap object. |
|
a pourcentage value. |
|
a Shade object. |
|
a colour or NULL. |
|
a boolean. |
|
a boolean. |
Since 3.6
gboolean visu_map_export (VisuMap *map
,Shade *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 Shade 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