| V_Sim API - Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Signals | ||||
VisuPairLinkVisuPairLink — V_Sim can draw link between nodes. This part defines a pair object and interface to draw pairs. |
#define VISU_PAIR_DISTANCE_MAX #define VISU_PAIR_DISTANCE_MIN VisuPair; struct VisuPairDistribution; void (*VisuPairForeachFunc) (VisuElement *ele1,VisuElement *ele2,VisuPairLink *data,gpointer user_data); struct VisuPairLink; struct VisuPairLinkClass; gboolean visu_pair_distribution_getNextPick (VisuPairDistribution *dd,guint startStopId[2],guint *integral,guint *max,guint *posMax); void visu_pair_foreach (VisuPairForeachFunc whatToDo,gpointer user_data); VisuPairDistribution * visu_pair_getDistanceDistribution (VisuPair *pair,VisuData *dataObj,float step,float min,float max); void visu_pair_getElements (const VisuPair *pair,VisuElement **ele1,VisuElement **ele2); VisuPair * visu_pair_getPair (VisuElement *ele1,VisuElement *ele2); gpointer visu_pair_getProperty (VisuPair *pair,const gchar *key); GList * visu_pair_link_getAll (VisuElement *ele1,VisuElement *ele2); ToolColor * visu_pair_link_getColor (const VisuPairLink *data); float visu_pair_link_getDistance (const VisuPairLink *data,int minOrMax); gboolean visu_pair_link_getDrawn (const VisuPairLink *data); VisuPairLink * visu_pair_link_getFromId (VisuElement *ele1,VisuElement *ele2,guint pos); VisuPair * visu_pair_link_getPair (const VisuPairLink *data); gboolean visu_pair_link_getPrintLength (const VisuPairLink *data); gboolean visu_pair_link_isDrawn (const VisuPairLink *data); VisuPairLink * visu_pair_link_new (VisuElement *ele1,VisuElement *ele2,float minMax[2]); gboolean visu_pair_link_setColor (VisuPairLink *data,ToolColor *destColor); gboolean visu_pair_link_setDistance (VisuPairLink *data,float val,int minOrMax); gboolean visu_pair_link_setDrawn (VisuPairLink *data,gboolean drawn); gboolean visu_pair_link_setPrintLength (VisuPairLink *data,gboolean status); gboolean visu_pair_readLinkFromTokens (gchar **tokens,int *index,VisuPairLink **data,int position,GError **error); gboolean visu_pair_removePairLink (VisuElement *ele1,VisuElement *ele2,VisuPairLink *data); void visu_pair_setProperty (VisuPair *pair,const gchar *key,gpointer value,GDestroyNotify freeFunc);
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.
#define VISU_PAIR_DISTANCE_MAX 1
Flag used to define the maximum length to draw pair. This is useful with
the visu_pair_link_getDistance() and the visu_pair_link_setDistance() methods.
#define VISU_PAIR_DISTANCE_MIN 0
Flag used to define the minimum length to draw pair. This is useful with
the visu_pair_link_getDistance() and the visu_pair_link_setDistance() methods.
typedef struct _VisuPair VisuPair;
An opaque structure to define links (i.e. several VisuPairLink) between elements.
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[.
VisuElement * |
one VisuElement. |
VisuElement * |
one VisuElement. |
guint * |
an array containing the distribution ; |
guint |
the size of the array ; |
| the initial distance value (usualy 0) ; | |
| the step increase in distance at each value ; | |
guint |
the number of nodes used during the computation ; |
guint |
idem for VisuElement 2. |
void (*VisuPairForeachFunc) (VisuElement *ele1,VisuElement *ele2,VisuPairLink *data,gpointer user_data);
Prototype of functions called with the foreach method apply to each pairs.
|
a VisuElement object ; |
|
a VisuElement object ; |
|
a VisuPairLink object ; |
|
some user defined data. |
struct VisuPairLinkClass {
GObjectClass parent;
};
A short way to identify _VisuPairLinkClass structure.
GObjectClass |
the parent class; |
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.
|
a VisuPairDistribution object. |
|
two ids. |
|
a location for a guint value, can be NULL. |
|
a location to store the value ; |
|
a location to store the position of the pick. |
Returns : |
TRUE if a pick is found. |
Since 3.6
void visu_pair_foreach (VisuPairForeachFunc whatToDo,gpointer user_data);
The way VisuPairLink are stored in V_Sim is private and could changed between version. This method is used to apply some method each pairs.
|
a VisuPairForeachFunc() method ;. [scope call]
|
|
some user defined data. |
VisuPairDistribution * visu_pair_getDistanceDistribution (VisuPair *pair,VisuData *dataObj,float step,float min,float max);
This will compute the distnace distribution of nodes for the given
pair.
|
a VisuPair ; |
|
a VisuData ; |
|
a float for the distance mesh (negative value to use built-in default) ; |
|
a float for the minimum scanning value (negative value to use built-in default). |
|
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. |
void visu_pair_getElements (const VisuPair *pair,VisuElement **ele1,VisuElement **ele2);
Retrieve the VisuElement constituting the pair.
|
a VisuPair object. |
|
a location to store a VisuElement object pointer. [out][allow-none][transfer none] |
|
a location to store a VisuElement object pointer. [out][allow-none][transfer none] |
Since 3.7
VisuPair * visu_pair_getPair (VisuElement *ele1,VisuElement *ele2);
The object VisuPair is used to characterized links between two elements.
|
a VisuElement object ; |
|
a VisuElement object. |
Returns : |
the VisuPair object associated to the given two elements. If none exists it is created. The returned value should not be freed. [transfer none] |
gpointer visu_pair_getProperty (VisuPair *pair,const gchar *key);
Retrieve the property associated to the key or NULL if none exist.
|
a VisuPair object ; |
|
a string. |
Returns : |
the associated data. [transfer none] |
GList * visu_pair_link_getAll (VisuElement *ele1,VisuElement *ele2);
There can be one or several links between elements, retrieve them with this routine.
|
a VisuElement object ; |
|
a VisuElement object. |
Returns : |
a list of VisuPairLink. The list is owned by V_Sim and should not be freed. [element-type VisuPairLink*][transfer none] |
ToolColor * visu_pair_link_getColor (const VisuPairLink *data);
Look for the properties of the pair data to find if a colour has
been defined. If none, the default colour is returned instead.
|
a VisuPairLink object. |
Returns : |
a colour (don't free it). [transfer none] |
float visu_pair_link_getDistance (const VisuPairLink *data,int minOrMax);
A pair between ele1 and ele2 is drawn only if its length is between
a minimum and a maximum value. This method can get these values.
|
a VisuPairLink object ; |
|
VISU_PAIR_DISTANCE_MIN or VISU_PAIR_DISTANCE_MAX. |
Returns : |
the minimum or the maximum value for the pair between ele1 and ele2. |
gboolean visu_pair_link_getDrawn (const VisuPairLink *data);
A pair can or cannot be drawn, use this method to retrieve its state.
|
a VisuPairLink object ; |
Returns : |
TRUE if pairs can be drawn. |
VisuPairLink * visu_pair_link_getFromId (VisuElement *ele1,VisuElement *ele2,guint pos);
A link can also be retrieved by its position.
|
a VisuElement object ; |
|
a VisuElement object ; |
|
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] |
VisuPair * visu_pair_link_getPair (const VisuPairLink *data);
A link object is always associated to a VisuPair.
|
a VisuPairLink object. |
Returns : |
the VisuPair this link is related to. [transfer none] |
Since 3.7
gboolean visu_pair_link_getPrintLength (const VisuPairLink *data);
Get the print length parameter of a pair. This parameter is used to tell if length should be drawn near pairs of this kind.
|
a VisuPairLink object. |
Returns : |
TRUE if length are printed. |
gboolean visu_pair_link_isDrawn (const VisuPairLink *data);
A link is used or not depending on a distance criterion and a flag,
see visu_pair_link_setDrawn() and visu_pair_link_setDistance().
|
a VisuPairLink object. |
Returns : |
TRUE if the data is indeed drawn or not. |
Since 3.7
VisuPairLink * visu_pair_link_new (VisuElement *ele1,VisuElement *ele2,float minMax[2]);
A link between two elements is characterized by its boundary distances.
|
a VisuElement object ; |
|
a VisuElement object ; |
|
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] |
gboolean visu_pair_link_setColor (VisuPairLink *data,ToolColor *destColor);
Set the color of the given pair.
|
a VisuPairLink object ; |
|
a ToolColor object. |
Returns : |
TRUE if parameter has been changed. |
gboolean visu_pair_link_setDistance (VisuPairLink *data,float val,int minOrMax);
Set the minimum or the maximum length for the given pair.
|
a floating point value ; |
|
a VisuPairLink object ; |
|
VISU_PAIR_DISTANCE_MAX or VISU_PAIR_DISTANCE_MIN. |
Returns : |
TRUE if parameter has been changed. |
gboolean visu_pair_link_setDrawn (VisuPairLink *data,gboolean drawn);
A pair can or cannot be drawn, use this method to tune it.
|
a VisuPairLink object ; |
|
a boolean. |
Returns : |
TRUE if parameter has been changed. |
gboolean visu_pair_link_setPrintLength (VisuPairLink *data,gboolean status);
Set the attribute that controls if the length of pairs are drawn near pairs.
|
a VisuPairLink object ; |
|
TRUE to print length near pairs. |
Returns : |
TRUE if parameter has been changed. |
gboolean visu_pair_readLinkFromTokens (gchar **tokens,int *index,VisuPairLink **data,int position,GError **error);
This routine is used to read the resource file. Given tokens, it
associate a link object by reading the two elements and the two
distances that characterised this link.
|
array of tokens resulting from a call to g_strsplit() with " " as separator ; |
|
IN, the position of the beginning in tokens ; OUT, one token
after the last read ; |
|
a pointer to return an allocated link object ; |
|
the number of the line of the config
file which the line argument is taken from ; |
|
a location to store a possible reading error. |
Returns : |
TRUE if succeed. |
gboolean visu_pair_removePairLink (VisuElement *ele1,VisuElement *ele2,VisuPairLink *data);
Delete the given link.
|
a VisuElement object ; |
|
a VisuElement object ; |
|
a link object. |
Returns : |
TRUE if the link exists and has been successfully removed. |
void visu_pair_setProperty (VisuPair *pair,const gchar *key,gpointer value,GDestroyNotify freeFunc);
Each element/element can have associated data.
|
a VisuPair object ; |
|
a static string ; |
|
a pointer to some allocated data ; |
|
a destroying method (can be NULL). |
"ParameterChanged" signalvoid user_function (VisuPairLink *data,
gpointer user_data) : No Recursion
Gets emitted when some rendering parameter of data has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.7