## panelSurfaces panelSurfaces — Gtk interface to load isosurfaces. |

## Synopsis

    #define             SURFACE_NAME_CHOOSE
    #define             SURFACE_NAME_STR
    enum                PanelIsosurfacesColumnId;
    ToolPanel*          panelIsosurfacesInit                ();
    GtkListStore*       panelIsosurfacesGet_listStore       ();
    gboolean            panelIsosurfacesSet_used            (VisuData *dataObj,
                                                             gboolean used);
    void                panelIsosurfacesAdd_withValue       (gchar *filename,
                                                             float value,
                                                             gchar *name);
    void                panelIsosurfacesEdit_surfaceProperties
                                                            (GtkTreeIter *iter);
    gboolean            panelIsosurfacesLoad_file           (const char *file_name,
                                                             gboolean fit_to_box,
                                                             VisuData *data,
                                                             OptionTable *table,
                                                             double **box);
    gboolean            panelIsosurfacesShow_all            (gboolean show);
    GtkWidget*          panelIsosurfacesGenerate_isoValues  (int *nbValues,
                                                             float **values,
                                                             gchar **name,
                                                             float minVal,
                                                             float maxVal);
    gboolean            panelIsosurfacesHide                (Plane **planes);
    gboolean            panelIsosurfacesParse_XMLFile       (const gchar *filename,
                                                             GError **error);

## Description

This module contains the panel used to draw isosurfaces. From it, you can draw isosurfaces on screen after they are loaded through the surfaces module. You can also access tools to manage and create .surf files, these tools are related to the panelSurfacesTools module.

## Details

### SURFACE_NAME_CHOOSE

    #define SURFACE_NAME_CHOOSE "<span size=\"smaller\"><i>"SURFACE_NAME_STR"</i></span>"

The string used in the tree view to represent the surfaces that don't share surface resources.

### SURFACE_NAME_STR

    #define SURFACE_NAME_STR    "Choose an id name"

The default string used to name surfaces that are not associated to any public surface ressource.

### enum PanelIsosurfacesColumnId

    typedef enum
      {
        COLUMN_FIELD_LABEL,
        COLUMN_FIELD_POINTER,
        NB_COLUMN_FIELD
      } PanelIsosurfacesColumnId;

Thesse are the description of the columns stored in the GtkListStore of this panel. See `panelIsosurfacesGet_listStore()` to access this liststore.

`COLUMN_FIELD_LABEL` | a string, the description of the scalar field.
`COLUMN_FIELD_POINTER` | the pointer to the ScalarField object.
`NB_COLUMN_FIELD` | the number of columns.

### panelIsosurfacesInit ()

    ToolPanel*          panelIsosurfacesInit                ();

Should be used in the list declared in externalModules.h to be loaded by V_Sim on start-up. This routine will create the ToolPanel where the iso-surfaces stuff can be done, such as creating a surface, loading a scalar field, changing the properties...

Returns : | a newly created ToolPanel object.

### panelIsosurfacesGet_listStore ()

    GtkListStore*       panelIsosurfacesGet_listStore       ();

This method gives read access to the GtkListStore used to store the scalar field files.

Returns : | the GtkListStore used by this panel to store its scalar fields. It should be considered read-only.

### panelIsosurfacesSet_used ()

    gboolean            panelIsosurfacesSet_used            (VisuData *dataObj,
                                                             gboolean used);

Change the status of the isosurface extension, drawn or not.

`dataObj` : | the current VisuData (can be NULL) ;
`used` : | a boolean.
Returns : | TRUE if the OpenGLAskForReDraw signal should be emitted.

### panelIsosurfacesAdd_withValue ()

    void                panelIsosurfacesAdd_withValue       (gchar *filename,
                                                             float value,
                                                             gchar *name);

Create and add a surface created from the given scalar field. This field must already be loaded. If `name` is not given, the surface will be called "Isosurface id" where id is an increasing counter.

`filename` : | the name of the scalar field from which to add a surface ;
`value` : | the iso value ;
`name` : | the name used to identify the new surface (can be NULL).

### panelIsosurfacesEdit_surfaceProperties ()

    void                panelIsosurfacesEdit_surfaceProperties
                                                            (GtkTreeIter *iter);

Opens a new window allowing to edit surface properties.

`iter` : | the currently selected row iter (or NULL).

### panelIsosurfacesLoad_file ()

    gboolean            panelIsosurfacesLoad_file           (const char *file_name,
                                                             gboolean fit_to_box,
                                                             VisuData *data,
                                                             OptionTable *table,
                                                             double **box);

Tries to load the given `file_name` and if it succeeds, adds loaded surfaces to the isosurfaces panel. In all cases, all previously loaded surfaces are removed from the panel (and from memory).

`file_name` : | the file you want to try to load
`fit_to_box` : | whether these isosurfaces should be resized in order to fit to the current VisuBox ;
`data` : | the VisuData to fit the box to (can be NULL if `fit_to_box` is false ;
`table` : | a set of different Option (can be NULL).
`box` : | a location to store the 6 values defining the loaded box (can be NULL).
Returns : | TRUE in case of success.

### panelIsosurfacesShow_all ()

    gboolean            panelIsosurfacesShow_all            (gboolean show);

Shows or hides all surfaces and check their "draw" status in the panel accordingly.

`show` : | TRUE to show all surfaces, FALSE to hide them.
Returns : | TRUE if surface list should be rebuild and redraw.

### panelIsosurfacesGenerate_isoValues ()

    GtkWidget*          panelIsosurfacesGenerate_isoValues  (int *nbValues,
                                                             float **values,
                                                             gchar **name,
                                                             float minVal,
                                                             float maxVal);

This method opens a little dialog window that is made to help the user enter a list of values for creation of iso-surfaces. These values are generated between `minVal` and `maxVal`.

`nbValues` : | a location of an integer to store the number of generated values ;
`values` : | a pointer on a float array. The target of this pointer must be NULL and it will be allocated after a call to this method. Use `g_free()` after use to free it.
`name` : | a pointer to store a name. The target of this pointer must be NULL on enter. It is associated only if a name is given.
`minVal` : | the minimum value for the range ;
`maxVal` : | the maximum value for the range.
Returns : | the dialog widget.

### panelIsosurfacesHide ()

    gboolean            panelIsosurfacesHide                (Plane **planes);

Must be called after the initialisation of the plane subpanel. It applies the masking scheme of planes on current surfaces.

`planes` : | an array of planes to be applied (NULL terminated).
Returns : | TRUE if the surface should be rebuilt.

### panelIsosurfacesParse_XMLFile ()

    gboolean            panelIsosurfacesParse_XMLFile       (const gchar *filename,
                                                             GError **error);