#ifndef LAYOUT_H
|
#ifndef LAYOUT_H
|
#define LAYOUT_H 1
|
#define LAYOUT_H 1
|
|
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
extern "C" {
|
extern "C" {
|
#endif
|
#endif
|
|
|
/*
|
/*
|
Unlike the original code, we assume that the set of nodes
|
Unlike the original code, we assume that the set of nodes
|
known to this layout graph is always kept 1-1 with the set
|
known to this layout graph is always kept 1-1 with the set
|
of dual nodes. Similarly with respect to edges.
|
of dual nodes. Similarly with respect to edges.
|
This implies that every time a dual is created/deleted,
|
This implies that every time a dual is created/deleted,
|
that the corresponding create/delete methods must be
|
that the corresponding create/delete methods must be
|
called in the layout graph class.
|
called in the layout graph class.
|
Additionally, we assume the existence of two ``update''
|
Additionally, we assume the existence of two ``update''
|
methods that propagate the correct location and size info
|
methods that propagate the correct location and size info
|
between the layout graph nodes and their duals.
|
between the layout graph nodes and their duals.
|
*/
|
*/
|
|
|
struct Layout_Graph; /* hidden */
|
struct Layout_Graph; /* hidden */
|
|
|
/* ptr to user's node info */
|
/* ptr to user's node info */
|
typedef void* pItem;
|
typedef void* pItem;
|
|
|
/*
|
/*
|
As inputs, we need the following:
|
As inputs, we need the following:
|
|
|
For nodes: bbox that just surrounds the node.
|
For nodes: bbox that just surrounds the node.
|
For edges: width and height of the text (if any)
|
For edges: width and height of the text (if any)
|
associated with the edge.
|
associated with the edge.
|
|
|
As outputs, we provide the following:
|
As outputs, we provide the following:
|
|
|
For nodes: new absolute position of the northwest corner
|
For nodes: new absolute position of the northwest corner
|
of the bbox for the node.
|
of the bbox for the node.
|
For edges: (x,y) coordinates of the endpoints of the edge.
|
For edges: (x,y) coordinates of the endpoints of the edge.
|
|
|
To avoid proliferation of types,
|
To avoid proliferation of types,
|
we define a single struct (ItemGeom)
|
we define a single struct (ItemGeom)
|
that is used to carry all the input and output info.
|
that is used to carry all the input and output info.
|
|
|
Item type Direction ItemGeom Fields Used
|
Item type Direction ItemGeom Fields Used
|
--------- --------- --------------------
|
--------- --------- --------------------
|
Node In x1,y1,x2,y2
|
Node In x1,y1,x2,y2
|
Out x1,y1
|
Out x1,y1
|
Edge In width,height
|
Edge In width,height
|
Out x1,y1,x2,y2
|
Out x1,y1,x2,y2
|
|
|
*/
|
*/
|
|
|
/* All values are in pixels */
|
/* All values are in pixels */
|
struct ItemGeom {
|
struct ItemGeom {
|
double x1,y1;
|
double x1,y1;
|
double x2,y2;
|
double x2,y2;
|
double width,height;
|
double width,height;
|
};
|
};
|
typedef struct ItemGeom ItemGeom;
|
typedef struct ItemGeom ItemGeom;
|
|
|
struct LayoutConfig {
|
struct LayoutConfig {
|
pItem rootnode;
|
pItem rootnode;
|
int graphorder;
|
int graphorder;
|
int nodespaceH;
|
int nodespaceH;
|
int nodespaceV;
|
int nodespaceV;
|
int xoffset;
|
int xoffset;
|
int yoffset;
|
int yoffset;
|
int computenodesize;
|
int computenodesize;
|
int elementsperline;
|
int elementsperline;
|
int hideedges;
|
int hideedges;
|
int keeprandompositions;
|
int keeprandompositions;
|
int maxx;
|
int maxx;
|
int maxy;
|
int maxy;
|
int gridlock;
|
int gridlock;
|
};
|
};
|
typedef struct LayoutConfig LayoutConfig;
|
typedef struct LayoutConfig LayoutConfig;
|
|
|
extern LayoutConfig GetLayoutConfig _ANSI_ARGS_((struct Layout_Graph*));
|
extern LayoutConfig GetLayoutConfig _ANSI_ARGS_((struct Layout_Graph*));
|
extern void SetLayoutConfig _ANSI_ARGS_((struct Layout_Graph*, LayoutConfig));
|
extern void SetLayoutConfig _ANSI_ARGS_((struct Layout_Graph*, LayoutConfig));
|
|
|
extern int LayoutISI _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutISI _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutTree _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutTree _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutMatrix _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutMatrix _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutRandom _ANSI_ARGS_((struct Layout_Graph*));
|
extern int LayoutRandom _ANSI_ARGS_((struct Layout_Graph*));
|
|
|
#if DEBUGGING
|
#if DEBUGGING
|
extern void LayoutDebugging _ANSI_ARGS_((struct Layout_Graph*, struct Node *currentnode, char *string, int type));
|
extern void LayoutDebugging _ANSI_ARGS_((struct Layout_Graph*, struct Node *currentnode, char *string, int type));
|
#endif
|
#endif
|
|
|
extern struct Layout_Graph* LayoutCreateGraph _ANSI_ARGS_(());
|
extern struct Layout_Graph* LayoutCreateGraph _ANSI_ARGS_(());
|
extern void LayoutFreeGraph _ANSI_ARGS_((struct Layout_Graph*));
|
extern void LayoutFreeGraph _ANSI_ARGS_((struct Layout_Graph*));
|
extern void LayoutClearGraph _ANSI_ARGS_((struct Layout_Graph*));
|
extern void LayoutClearGraph _ANSI_ARGS_((struct Layout_Graph*));
|
|
|
extern int LayoutCreateNode _ANSI_ARGS_((struct Layout_Graph*,
|
extern int LayoutCreateNode _ANSI_ARGS_((struct Layout_Graph*,
|
pItem nodeid,
|
pItem nodeid,
|
pItem from, pItem to));
|
pItem from, pItem to));
|
extern int LayoutDeleteNode _ANSI_ARGS_((struct Layout_Graph*, pItem nodeid));
|
extern int LayoutDeleteNode _ANSI_ARGS_((struct Layout_Graph*, pItem nodeid));
|
extern int LayoutCreateEdge _ANSI_ARGS_((struct Layout_Graph*,
|
extern int LayoutCreateEdge _ANSI_ARGS_((struct Layout_Graph*,
|
pItem edgeid,
|
pItem edgeid,
|
pItem from, pItem to));
|
pItem from, pItem to));
|
extern int LayoutDeleteEdge _ANSI_ARGS_((struct Layout_Graph*, pItem edgeid));
|
extern int LayoutDeleteEdge _ANSI_ARGS_((struct Layout_Graph*, pItem edgeid));
|
|
|
extern int LayoutGetIthNode _ANSI_ARGS_((struct Layout_Graph*, long, pItem*));
|
extern int LayoutGetIthNode _ANSI_ARGS_((struct Layout_Graph*, long, pItem*));
|
|
|
extern int LayoutGetIthEdge _ANSI_ARGS_((struct Layout_Graph*, long, pItem*));
|
extern int LayoutGetIthEdge _ANSI_ARGS_((struct Layout_Graph*, long, pItem*));
|
|
|
extern int LayoutGetNodeBBox _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom*));
|
extern int LayoutGetNodeBBox _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom*));
|
extern int LayoutSetNodeBBox _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom));
|
extern int LayoutSetNodeBBox _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom));
|
|
|
extern int LayoutGetEdgeEndPoints _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom*));
|
extern int LayoutGetEdgeEndPoints _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom*));
|
extern int LayoutSetEdgeDim _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom));
|
extern int LayoutSetEdgeDim _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom));
|
|
|
extern char* LayoutGetError _ANSI_ARGS_((struct Layout_Graph*));
|
extern char* LayoutGetError _ANSI_ARGS_((struct Layout_Graph*));
|
|
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
}
|
}
|
#endif
|
#endif
|
|
|
#endif /*LAYOUT_H*/
|
#endif /*LAYOUT_H*/
|
|
|