VisuPair

VisuPair — V_Sim can draw link between nodes. This part defines a pair object and interface to draw pairs.

Functions

Properties

VisuElement * first-element Read / Write / Construct Only
GArray * links Read
VisuElement * second-element Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── ToolDbgObj
        ╰── VisuPair

Description

The visu_pairs.c defines only general methods to draw pairs. It introduces a new object called VisuPairLink. This stores some characteristics on links between two VisuElement. The main characteristic is that pairs are drawn only if the length between two nodes is in a specific range. Use visu_pair_link_setDistance() and visu_pair_link_getDistance() to tune this range.

This file does not draw any pairs. But it gives some interface to create rendering capabilities. To create a new pair rendering module, called VisuPairExtension, use visu_pair_extension_new(). Basically, a VisuPairExtension is characterized by it drawing method. But it can have other methods that are called in different cases. See main() and startStop() prototypes to have more informations.

Functions

visu_pair_new ()

VisuPair *
visu_pair_new (VisuElement *ele1,
               VisuElement *ele2);

Creates a VisuPair between ele1 and ele2 .

Parameters

ele1

a VisuElement object.

 

ele2

a VisuElement object.

 

Returns

a newly created object.

[transfer full]

Since: 3.8


visu_pair_getElements ()

void
visu_pair_getElements (const VisuPair *pair,
                       VisuElement **ele1,
                       VisuElement **ele2);

Retrieve the VisuElement constituting the pair.

Parameters

pair

a VisuPair object.

 

ele1

a location to store a VisuElement object pointer.

[out][allow-none][transfer none]

ele2

a location to store a VisuElement object pointer.

[out][allow-none][transfer none]

Since: 3.7


visu_pair_addLink ()

VisuPairLink *
visu_pair_addLink (VisuPair *pair,
                   const float minMax[2]);

A link between two elements is characterized by its boundary distances.

Parameters

pair

a VisuPair object.

 

minMax

the two min and max distances.

[array fixed-size=2]

Returns

the VisuPairLink object associated to the given two elements and distances. If none exists it is created. The returned value should not be freed.

[transfer none]


visu_pair_removeLink ()

gboolean
visu_pair_removeLink (VisuPair *pair,
                      VisuPairLink *data);

Delete the given link.

Parameters

pair

a VisuPair object.

 

data

a link object.

 

Returns

TRUE if the link exists and has been successfully removed.


visu_pair_getLinks ()

GList *
visu_pair_getLinks (VisuPair *pair);

There can be one or several links between elements, retrieve them with this routine.

Parameters

pair

a VisuPair object.

 

Returns

a list of VisuPairLink. The list content is owned by V_Sim but the list should be freed with g_list_free() after use.

[element-type VisuPairLink*][transfer container]


visu_pair_getNthLink ()

VisuPairLink *
visu_pair_getNthLink (VisuPair *pair,
                      guint pos);

A link can also be retrieved by its position.

Parameters

pair

a VisuPair object.

 

pos

the position in the list of links.

 

Returns

the VisuPairLink object associated to the given two elements and distances. If none exists NULL is returned.

[transfer none]


visu_pair_contains ()

gboolean
visu_pair_contains (const VisuPair *pair,
                    const VisuPairLink *link);

Tests if link is contained in pair .

Parameters

pair

a VisuPair object.

 

link

a VisuPairLink object.

 

Returns

TRUE if link is a member of pair .

Since: 3.8


visu_pair_getBondDistance ()

gboolean
visu_pair_getBondDistance (VisuPair *pair,
                           VisuData *dataObj,
                           gfloat *from,
                           gfloat *to);

Compute the bond distribution for the given pair and look for the first peak and returns its span. When given, from and to contains the lengths between which the bond for pair is the most probable.

Parameters

pair

a VisuPair object.

 

dataObj

a VisuData object.

 

from

a location for a float.

[out caller-allocates]

to

a location for a float.

[out caller-allocates]

Returns

TRUE if a significant bond length can be found.

Since: 3.8


VisuPairForeachFunc ()

void
(*VisuPairForeachFunc) (VisuPair *pair,
                        VisuPairLink *data,
                        gpointer user_data);

Prototype of functions called with the foreach method apply to each links in a pair.

Parameters

pair

a VisuPair object.

 

data

a VisuPairLink object ;

 

user_data

some user defined data.

 

visu_pair_foreach ()

void
visu_pair_foreach (VisuPair *pair,
                   VisuPairForeachFunc whatToDo,
                   gpointer user_data);

Apply whatToDo on every VisuPairLink of pair .

Parameters

pair

a VisuPair object.

 

whatToDo

method to apply.

[scope call][closure user_data]

user_data

some user data.

[closure]

Since: 3.8


visu_pair_getDistanceDistribution ()

VisuPairDistribution *
visu_pair_getDistanceDistribution (VisuPair *pair,
                                   VisuData *dataObj,
                                   float step,
                                   float min,
                                   float max);

This will compute the distance distribution of nodes for the given pair .

Parameters

pair

a VisuPair ;

 

dataObj

a VisuData ;

 

step

a float for the distance mesh (negative value to use built-in default) ;

 

min

a float for the minimum scanning value (negative value to use built-in default).

 

max

a float for the maximum scanning value (negative value to use built-in default).

 

Returns

a structure defining the distance distribution. This structure is private and should not be freed.


visu_pair_distribution_getNextPick ()

gboolean
visu_pair_distribution_getNextPick (VisuPairDistribution *dd,
                                    guint startStopId[2],
                                    guint *integral,
                                    guint *max,
                                    guint *posMax);

Try to find the next pick in the distribution. A pick is a group of consecutive non-null values, with a significant integral. On enter, startStopId contains the span to look into for the pick, and on output, it contains the span of the pick itself.

Parameters

dd

a VisuPairDistribution object.

 

startStopId

two ids.

 

integral

a location for a guint value, can be NULL.

 

max

a location to store the value ;

 

posMax

a location to store the position of the pick.

 

Returns

TRUE if a pick is found.

Since: 3.6

Types and Values

struct VisuPairDistribution

struct VisuPairDistribution {
  VisuElement *ele1, *ele2;
  guint *histo;
  guint nValues;
  float initValue, stepValue;
  guint nNodesEle1, nNodesEle2;
};

This structure stores for a given pair, the distance distribution on a given range [initValue ;nValues * stepValue [.

Members

VisuElement *ele1;

one VisuElement.

 

VisuElement *ele2;

one VisuElement.

 

guint *histo;

an array containing the distribution ;

 

guint nValues;

the size of the array ;

 

float initValue;

the initial distance value (usualy 0) ;

 

float stepValue;

the step increase in distance at each value ;

 

guint nNodesEle1;

the number of nodes used during the computation ;

 

guint nNodesEle2;

idem for VisuElement 2.

 

Property Details

The “first-element” property

  “first-element”            VisuElement *

first element.

Flags: Read / Write / Construct Only


The “links” property

  “links”                    GArray *

array of links.

Flags: Read


The “second-element” property

  “second-element”           VisuElement *

second element.

Flags: Read / Write / Construct Only