## visu_basic visu_basic — Main functions of V_Sim (except graphical ones). |

## Synopsis

                        VisuBasicCLISet;
    void                initVisuBasic                       (void);
    gboolean            visu_basic_getLoadCancel            (void);
    void                visu_basic_setLoadCancel            (gboolean status);
    void                visu_basic_setLoadMessageFunc       (GFunc func,
                                                             gpointer data);
    void                visu_basic_setLoadMessage           (const gchar *mess);
    gboolean            visu_basic_loadData                 (VisuData *data,
                                                             ToolFileFormat *format,
                                                             int nSet,
                                                             GError **error);
    gchar*              visu_basic_parseConfigFiles         (void);
    gboolean            visu_basic_applyCommandLine         (VisuData *data,
                                                             VisuBasicCLISet *set,
                                                             GError **error);
    gboolean            visu_basic_showOptionHelp           (gboolean force);
    void                visu_basic_createExtensions         (VisuData *data,
                                                             VisuBasicCLISet *set,
                                                             gboolean rebuild);
    VisuData*           visu_basic_setDataFromCommandLine   (void);
    void                visu_basic_setExtInfos              (VisuData *dataObj,
                                                             VisuGlExtInfosDrawMethod method,
                                                             int *nodes,
                                                             VisuDataNode *data);
    int                 visu_basic_mainExport               (void);
    ToolUnits           visu_basic_getPreferedUnit          (void);
    gboolean            visu_basic_setPreferedUnit          (ToolUnits unit);
    #define             VISU_VERSION
    #define             VISU_WEB_SITE
    void                visu_basic_setExePath               (const gchar *exePath);
    #define             V_SIM_DATA_DIR
    #define             V_SIM_LEGAL_DIR
    #define             V_SIM_PIXMAPS_DIR
    #define             V_SIM_ICONS_DIR
    #define             V_SIM_LOCAL_CONF_DIR
    #define             V_SIM_OLD_LOCAL_CONF_DIR
    #define             V_SIM_PLUGINS_DIR
    #define             V_SIM_LOCALE_DIR
    const gchar*        visu_basic_getDataDir               (void);
    const gchar*        visu_basic_getLegalDir              (void);
    const gchar*        visu_basic_getPixmapsDir            (void);
    const gchar*        visu_basic_getIconsDir              (void);
    const gchar*        visu_basic_getLocalDir              (void);
    const gchar*        visu_basic_getOldLocalDir           (void);
    const gchar*        visu_basic_getPluginsDir            (void);
    const gchar*        visu_basic_getLocaleDir             (void);
    GMainContext*       visu_basic_getMainContext           (void);
    void                visu_basic_freeAll                  (void);

## Description

There are here the main functions of V_Sim (except for graphical methods) such as open file.

## Details

### VisuBasicCLISet

    typedef struct {
      gchar *colorFile;

      Plane **planesList;

      Surfaces **surfsList;
      GList *fieldsList;

      Shade *shade;

      gint *mapPlaneId;
      ToolMatrixScalingFlag logScale;
      guint nIsolines;
      float* isoLinesColor;

      gchar *bgImage;
    } VisuBasicCLISet;

Internal object to store values read from command line.

gchar *`colorFile`; | TODO
Plane **`planesList`; | TODO
Surfaces **`surfsList`; | TODO
GList *`fieldsList`; | TODO
Shade *`shade`; | TODO
gint *`mapPlaneId`; | TODO
ToolMatrixScalingFlag `logScale`; | TODO
guint `nIsolines`; | TODO
float *`isoLinesColor`; | TODO
gchar *`bgImage`; | TODO

### initVisuBasic ()

    void                initVisuBasic                       (void);

A call to this method is done at startup after having probe the locale of the file system and having initialized the rendering window. It makes the following actions : create the visu object to store the signals, initialize the module part (parameters, and resources), initialize the dump part, the OpenGL part and its extensions, the storage of elements and the 'colorize with data' part.

### visu_basic_getLoadCancel ()

    gboolean            visu_basic_getLoadCancel            (void);

V_Sim implements cancelation load process by setting a flag that can be check by running routine. Use this method to check the flag value (not thread safe). See `visu_basic_setLoadCancel()` to set the cancelation flag.

Returns : | the cancelation status.

Since 3.6

### visu_basic_setLoadCancel ()

    void                visu_basic_setLoadCancel            (gboolean status);

V_Sim implements cancelation load process by setting a flag that can be check by running routine. Use this method to set the flag value (not thread safe). See `visu_basic_getLoadCancel()` to check the cancelation flag.

`status` : | a boolean.

Since 3.6

### visu_basic_setLoadMessageFunc ()

    void                visu_basic_setLoadMessageFunc       (GFunc func,
                                                             gpointer data);

When a load process is running, on can defined a message function that may be called to output message to the user using `visu_basic_setLoadMessage()`.

`func` : | a function to print a message.. scope call
`data` : | user data.

Since 3.6

### visu_basic_setLoadMessage ()

    void                visu_basic_setLoadMessage           (const gchar *mess);

If a message function on load action has been set by `visu_basic_setLoadMessageFunc()`, then the given `mess` is given as argument to this function.

`mess` : | a string.

Since 3.6

### visu_basic_loadData ()

    gboolean            visu_basic_loadData                 (VisuData *data,
                                                             ToolFileFormat *format,
                                                             int nSet,
                                                             GError **error);

This calls the load method of the current rendering method. Some informations may be store in `error->message` if the returned value is FALSE. The file(s) which is(are) opened is(are) stored in the VisuData. The `nSet` argument is used to load a specific set of nodes if the input format supports it. If `nSet` is 0, then the default set of nodes is loaded.

`data` : | a VisuData object ;
`format` : | a pointer on a format (can be NULL if format is to be guessed) ;. allow-none.
`nSet` : | an integer ;
`error` : | a pointer to store a possible error, location must be initialized to (GError*)0.
Returns : | TRUE if everithing is OK, if FALSE, the `error` is set and should be freed with `g_error_free()`.

### visu_basic_parseConfigFiles ()

    gchar*              visu_basic_parseConfigFiles         (void);

Parse the parameter and the resource file. Used once at startup.

Returns : | a newly allocated GString if some error occured.

### visu_basic_applyCommandLine ()

    gboolean            visu_basic_applyCommandLine         (VisuData *data,
                                                             VisuBasicCLISet *set,
                                                             GError **error);

Call all the get methods on the command line options to tune the given `data`.

`data` : | a VisuData object to apply the options on ;
`set` : | a table of options ;
`error` : | a location for error report.
Returns : | TRUE if complete without error.

### visu_basic_showOptionHelp ()

    gboolean            visu_basic_showOptionHelp           (gboolean force);

Display a small help for some options. The output is different from the -h command line options, here some details about running time options is displayed like the available file format for exportation... If `force` is TRUE, all possible values are output, otherwise only those relevant to the user provided command line options.

`force` : | a boolean.
Returns : | TRUE if something is displayed.

Since 3.6

### visu_basic_createExtensions ()

    void                visu_basic_createExtensions         (VisuData *data,
                                                             VisuBasicCLISet *set,
                                                             gboolean rebuild);

Create all extensions (planes, surfaces...) for the given data. Use static values read from `visu_basic_applyCommandLine()`. This method is mainly used when V_Sim run without the command panel.

`data` : | a VisuData object ;
`set` : | a table of options ;
`rebuild` : | a boolean.

### visu_basic_setDataFromCommandLine ()

    VisuData*           visu_basic_setDataFromCommandLine   (void);

Read the command line option and set the filenames for a new VisuData. The object is not loaded (files are not parsed), just prepared.

Returns : | a newly allocated VisuData if required.. transfer full.

### visu_basic_setExtInfos ()

    void                visu_basic_setExtInfos              (VisuData *dataObj,
                                                             VisuGlExtInfosDrawMethod method,
                                                             int *nodes,
                                                             VisuDataNode *data);

Create and draw possible information on nodes. This method is mainly used when V_Sim run without the command panel.

`dataObj` : | a VisuData object ;
`method` : | where to draw information ;
`nodes` : | a possible list of selected nodes, or NULL ;
`data` : | the information to draw.

### visu_basic_mainExport ()

    int                 visu_basic_mainExport               (void);

This method is called when V_Sim is in export mode from the command line.

Returns : | 0 if everything is normal, 1 if an error occured.

### visu_basic_getPreferedUnit ()

    ToolUnits           visu_basic_getPreferedUnit          (void);

By setting the prefered unit, when a file is load, V_Sim tries to render it in this prefered unit.

Returns : | the prefered unit set by the user (default is unit_undefined).

Since 3.5

### visu_basic_setPreferedUnit ()

    gboolean            visu_basic_setPreferedUnit          (ToolUnits unit);

By setting the prefered unit, when a file is load, V_Sim tries to render it in this prefered unit.

`unit` : | a ToolUnits value.
Returns : | TRUE if the prefered unit is actually changed.

Since 3.5

### VISU_VERSION

    #define VISU_VERSION       VERSION

The value of current compiled version.

### VISU_WEB_SITE

    #define VISU_WEB_SITE      "http://inac.cea.fr/L_Sim/V_Sim"

URL where to find info on V_Sim.

### visu_basic_setExePath ()

    void                visu_basic_setExePath               (const gchar *exePath);

This method is used to tell V_Sim where V_Sim is running (usually reading from argv[0]. This makes it possible to relocate everything on the fly. `exePath` is copied.

`exePath` : | a path where the V_Sim executable is running in.

Since 3.6

### V_SIM_DATA_DIR

    #define V_SIM_DATA_DIR           visu_basic_getDataDir()

The directory where data files are stored.

### V_SIM_LEGAL_DIR

    #define V_SIM_LEGAL_DIR          visu_basic_getLegalDir()

The directory where copyright and author files are stored.

### V_SIM_PIXMAPS_DIR

    #define V_SIM_PIXMAPS_DIR        visu_basic_getPixmapsDir()

The directory where pixmap files are stored.

### V_SIM_ICONS_DIR

    #define V_SIM_ICONS_DIR          visu_basic_getIconsDir()

The directory where icon files are stored.

### V_SIM_LOCAL_CONF_DIR

    #define V_SIM_LOCAL_CONF_DIR     visu_basic_getLocalDir()

The directory where user configuration files are stored.

### V_SIM_OLD_LOCAL_CONF_DIR

    #define V_SIM_OLD_LOCAL_CONF_DIR visu_basic_getOldLocalDir()

Old value of V_SIM_LOCAL_CONF_DIR.

### V_SIM_PLUGINS_DIR

    #define V_SIM_PLUGINS_DIR        visu_basic_getPluginsDir()

The directory where plugin files are stored.

### V_SIM_LOCALE_DIR

    #define V_SIM_LOCALE_DIR         visu_basic_getLocaleDir()

The directory where locale files are stored.

### visu_basic_getDataDir ()

    const gchar*        visu_basic_getDataDir               (void);

Get the static string where V_Sim looks for its data files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getLegalDir ()

    const gchar*        visu_basic_getLegalDir              (void);

Get the static string where V_Sim looks for its legal files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getPixmapsDir ()

    const gchar*        visu_basic_getPixmapsDir            (void);

Get the static string where V_Sim looks for its pixmap files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getIconsDir ()

    const gchar*        visu_basic_getIconsDir              (void);

Get the static string where V_Sim looks for its icon files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getLocalDir ()

    const gchar*        visu_basic_getLocalDir              (void);

Get the static string where V_Sim looks for its user configuration files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getOldLocalDir ()

    const gchar*        visu_basic_getOldLocalDir           (void);

Get the static string where V_Sim looks for its user configuration files (old location).

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getPluginsDir ()

    const gchar*        visu_basic_getPluginsDir            (void);

Get the static string where V_Sim looks for its plug-in files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getLocaleDir ()

    const gchar*        visu_basic_getLocaleDir             (void);

Get the static string where V_Sim looks for its localisation files.

Returns : | a string owned by V_Sim.. transfer none.

Since 3.4

### visu_basic_getMainContext ()

    GMainContext*       visu_basic_getMainContext           (void);

Even without GUI, V_Sim requires to run a main loop. This method is to get the main loop.

Returns : | the main loop, as defined in GLib.. transfer none.

Since 3.6

### visu_basic_freeAll ()

    void                visu_basic_freeAll                  (void);

This routine is called by V_Sim when quiting and it frees the memory used by visu_basic.

Since 3.5