VisuGlExtPairs

VisuGlExtPairs — Draw links between nodes.

Synopsis

#define             VISU_GL_EXT_PAIRS_ID
struct              VisuGlExtPairs;
struct              VisuGlExtPairsClass;
struct              VisuPairDrawFuncs;
                    VisuPairExtension;
void                visu_gl_ext_pairs_draw              (VisuGlExtPairs *pairs);
VisuGlExtPairs *    visu_gl_ext_pairs_getDefault        ();
VisuPairExtension * visu_gl_ext_pairs_getDrawMethod     (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data);
gboolean            visu_gl_ext_pairs_getDrawnPair      (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data,
                                                         guint *node1,
                                                         guint *node2,
                                                         guint id);
guint               visu_gl_ext_pairs_getNDrawn         (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data);
VisuGlExtPairs *    visu_gl_ext_pairs_new               (const gchar *name);
gboolean            visu_gl_ext_pairs_setData           (VisuGlExtPairs *pairs,
                                                         VisuGlView *view,
                                                         VisuData *data);
gboolean            visu_gl_ext_pairs_setDrawMethod     (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data,
                                                         VisuPairExtension *ext);
void                visu_pair_extension_free            (VisuPairExtension *extension);
GList *             visu_pair_extension_getAllMethods   ();
VisuPairExtension * visu_pair_extension_getByName       (const gchar *name);
VisuPairExtension * visu_pair_extension_getDefault      ();
const gchar *       visu_pair_extension_getName         (VisuPairExtension *extension,
                                                         gboolean UTF8);
VisuPairExtension * visu_pair_extension_new             (const char *name,
                                                         const char *printName,
                                                         const char *description,
                                                         gboolean sensitive,
                                                         const VisuPairDrawFuncs *meth);
VisuPairExtension * visu_pair_extension_ref             (VisuPairExtension *ext);
gboolean            visu_pair_extension_setDefault      (VisuPairExtension *extension);
void                visu_pair_extension_unref           (VisuPairExtension *ext);

Object Hierarchy

  GObject
   +----VisuGlExt
         +----VisuGlExtPairs
  GBoxed
   +----VisuPairExtension

Description

This extension draws links between nodes, depending on VisuPairExtension drawing capabilities.

Details

VISU_GL_EXT_PAIRS_ID

#define VISU_GL_EXT_PAIRS_ID "Pairs"

The id used to identify this extension, see visu_gl_ext_rebuild() for instance.


struct VisuGlExtPairs

struct VisuGlExtPairs;

An opaque structure.

Since 3.7


struct VisuGlExtPairsClass

struct VisuGlExtPairsClass {
  VisuGlExtClass parent;
};

A short way to identify _VisuGlExtPairsClass structure.

VisuGlExtClass parent;

the parent class;

Since 3.7


struct VisuPairDrawFuncs

struct VisuPairDrawFuncs {
  /**
   * start:
   * @ele1: a #VisuElement object ;
   * @ele2: a #VisuElement object ;
   * @data: a #VisuPairLink object.
   * @view: a #VisuGlView object, giving some constants describing
   *        the OpenGL scene ;
   *
   * Prototype of functions called at the beginning and
   * the end of drawing of each pairs types. @ele1 and @ele2
   * arguments are the two elements between the pair defined by @data is drawn.
   * This is useful to set some OpenGL definition specific to each pair, such
   * as the color for example.
   */
  void (*start)(VisuElement *ele1, VisuElement *ele2, VisuPairLink *data, VisuGlView *view);

  /**
   * stop:
   * @ele1: a #VisuElement object ;
   * @ele2: a #VisuElement object ;
   * @data: a #VisuPairLink object.
   * @view: a #VisuGlView object, giving some constants describing
   *        the OpenGL scene ;
   *
   * Prototype of functions called at the beginning and
   * the end of drawing of each pairs types. @ele1 and @ele2
   * arguments are the two elements between the pair defined by @data is drawn.
   * This is useful to set some OpenGL definition specific to each pair, such
   * as the color for example.
   */
  void (*stop)(VisuElement *ele1, VisuElement *ele2, VisuPairLink *data, VisuGlView *view);

  /**
   * main:
   * @ele1: a #VisuElement object ;
   * @ele2: a #VisuElement object ;
   * @data: a #VisuPairLink object ;
   * @view: a #VisuGlView object, giving some constants describing
   *        the OpenGL scene ;
   * @x1: a floating point value ;
   * @y1: a floating point value ;
   * @z1: a floating point value ;
   * @x2: a floating point value ;
   * @y2: a floating point value ;
   * @z2: a floating point value ;
   * @d2: a floating point value ;
   * @alpha: a floating point value.
   *
   * Prototype of function to draw a pair. Such function are called each time a pair
   * is drawn between the two points (@x1, @y1, @z1) and (@x2, @y2, @z2). The @d2 argument
   * is the square distance between the two points. The @alpha argument
   * is a proposed alpha colour from the main program, its value is in [0;1].
   */
  void (*main)(VisuElement *ele1, VisuElement *ele2,
               VisuPairLink *data, VisuGlView *view,
               double x1, double y1, double z1,
               double x2, double y2, double z2,
               float d2, float alpha);
};

Drawing method for a VisuPairLink.

start ()

a method called before drawing a family of VisuPairLink.

stop ()

a method called after drawing a family of VisuPairLink.

main ()

a method used to draw each link of a VisuPairLink.

VisuPairExtension

typedef struct _VisuPairExtension VisuPairExtension;

An Opaque structure.


visu_gl_ext_pairs_draw ()

void                visu_gl_ext_pairs_draw              (VisuGlExtPairs *pairs);

Draw the pairs, see visu_gl_ext_pairs_setData() to attach a VisuData object to pairs.

pairs :

a VisuGlExtPairs object.

Since 3.7


visu_gl_ext_pairs_getDefault ()

VisuGlExtPairs *    visu_gl_ext_pairs_getDefault        ();

V_Sim is using a default pair object.

Returns :

a VisuGlExtPairs object used by default. [transfer none]

Since 3.7


visu_gl_ext_pairs_getDrawMethod ()

VisuPairExtension * visu_gl_ext_pairs_getDrawMethod     (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data);

Get the drawing method of a pair.

pairs :

the rendering VisuGlExtPairs object.

data :

a VisuPairLink object.

Returns :

a drawing method.

Since 3.6


visu_gl_ext_pairs_getDrawnPair ()

gboolean            visu_gl_ext_pairs_getDrawnPair      (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data,
                                                         guint *node1,
                                                         guint *node2,
                                                         guint id);

After pairs have been drawn, the ids of nodes in between links have been done can be retrieved with this routine. id range in between 0 and the value returned by visu_gl_ext_pairs_getNDrawn().

pairs :

the rendering VisuGlExtPairs object.

data :

a VisuPairLink object ;

node1 :

a location to store a node id ;. [out]

node2 :

a location to store a node id ;. [out]

id :

an index value.

Returns :

TRUE if id is a valid number.

Since 3.7


visu_gl_ext_pairs_getNDrawn ()

guint               visu_gl_ext_pairs_getNDrawn         (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data);

This returns the number of pairs with characteristics of data, that have been drawn.

pairs :

the rendering VisuGlExtPairs object.

data :

a VisuPairLink object.

Returns :

the number of drawn pairs.

Since 3.7


visu_gl_ext_pairs_new ()

VisuGlExtPairs *    visu_gl_ext_pairs_new               (const gchar *name);

Creates a new VisuGlExt to draw a pairs.

name :

the name to give to the extension (default is VISU_GL_EXT_PAIRS_ID). [allow-none]

Returns :

a pointer to the VisuGlExt it created or NULL otherwise.

Since 3.7


visu_gl_ext_pairs_setData ()

gboolean            visu_gl_ext_pairs_setData           (VisuGlExtPairs *pairs,
                                                         VisuGlView *view,
                                                         VisuData *data);

Attach an VisuGlView to render to and setup the pairs to get the node population also.

pairs :

The VisuGlExtPairs to attached to.

view :

the view where to draw the pairs.

data :

the nodes to get the population of.

Returns :

TRUE if visu_gl_ext_pairs_draw() should be called and then 'OpenGLAskForReDraw' signal be emitted.

Since 3.7


visu_gl_ext_pairs_setDrawMethod ()

gboolean            visu_gl_ext_pairs_setDrawMethod     (VisuGlExtPairs *pairs,
                                                         VisuPairLink *data,
                                                         VisuPairExtension *ext);

Set the drawing method of a pair.

pairs :

the rendering VisuGlExtPairs object.

data :

a VisuPairLink object.

ext :

a VisuPairExtension object.

Returns :

TRUE if drawing method is changed.

Since 3.6


visu_pair_extension_free ()

void                visu_pair_extension_free            (VisuPairExtension *extension);

Free all the allocated attributes of the specified method.

extension :

the extension to delete.

visu_pair_extension_getAllMethods ()

GList *             visu_pair_extension_getAllMethods   ();

Useful to know all VisuPairExtension.

Returns :

a list of all the known VisuPairExtension. This list should be considered read-only. [element-type VisuPairExtension*][transfer none]

visu_pair_extension_getByName ()

VisuPairExtension * visu_pair_extension_getByName       (const gchar *name);

Useful to know a VisuPairExtension when knowing its name.

name :

a method name (untranslated).

Returns :

a VisuPairExtension, or NULL if not any matchs.

Since 3.6


visu_pair_extension_getDefault ()

VisuPairExtension * visu_pair_extension_getDefault      ();

If some process need to know the current VisuPairExtension. Such extension has been set with setPairsMethod().

Returns :

the current VisuPairExtension, NULL if none has been set.

visu_pair_extension_getName ()

const gchar *       visu_pair_extension_getName         (VisuPairExtension *extension,
                                                         gboolean UTF8);

A VisuPairExtension has an internal name and a translated name for UI.

extension :

a VisuPairExtension object ;

UTF8 :

if name is provided for UI or not.

Returns :

a private label identifying this extension.

Since 3.7


visu_pair_extension_new ()

VisuPairExtension * visu_pair_extension_new             (const char *name,
                                                         const char *printName,
                                                         const char *description,
                                                         gboolean sensitive,
                                                         const VisuPairDrawFuncs *meth);

This creates a new pairs extension. Such an extension describes how to draw links (called pairs) between elements. The sensitive argument is to inform if pairs must be redrawn when the OpenGL engine sends the OpenGLFacetteChanged signal.

name :

name of the extension (must be non null) ;

printName :

a string to label the method that can be safely translated ;

description :

a brief description of the extension (can be null) ;

sensitive :

a boolean 0 or 1 ;

meth :

a set of drawing methods.

Returns :

the new VisuPairExtension or null if something wrong happens.

visu_pair_extension_ref ()

VisuPairExtension * visu_pair_extension_ref             (VisuPairExtension *ext);

Increase the ref counter.

ext :

a VisuPairExtension object.

Returns :

itself.

Since 3.7


visu_pair_extension_setDefault ()

gboolean            visu_pair_extension_setDefault      (VisuPairExtension *extension);

Choose the method used to draw pairs.

extension :

a VisuPairExtension object.

Returns :

TRUE if pairs should be rebuilt.

visu_pair_extension_unref ()

void                visu_pair_extension_unref           (VisuPairExtension *ext);

Decrease the ref counter, free all memory if counter reachs zero.

ext :

a VisuPairExtension object.

Since 3.7