| 1 |
578 |
markom |
#ifndef LAYOUT_H
|
| 2 |
|
|
#define LAYOUT_H 1
|
| 3 |
|
|
|
| 4 |
|
|
#ifdef __cplusplus
|
| 5 |
|
|
extern "C" {
|
| 6 |
|
|
#endif
|
| 7 |
|
|
|
| 8 |
|
|
/*
|
| 9 |
|
|
Unlike the original code, we assume that the set of nodes
|
| 10 |
|
|
known to this layout graph is always kept 1-1 with the set
|
| 11 |
|
|
of dual nodes. Similarly with respect to edges.
|
| 12 |
|
|
This implies that every time a dual is created/deleted,
|
| 13 |
|
|
that the corresponding create/delete methods must be
|
| 14 |
|
|
called in the layout graph class.
|
| 15 |
|
|
Additionally, we assume the existence of two ``update''
|
| 16 |
|
|
methods that propagate the correct location and size info
|
| 17 |
|
|
between the layout graph nodes and their duals.
|
| 18 |
|
|
*/
|
| 19 |
|
|
|
| 20 |
|
|
struct Layout_Graph; /* hidden */
|
| 21 |
|
|
|
| 22 |
|
|
/* ptr to user's node info */
|
| 23 |
|
|
typedef void* pItem;
|
| 24 |
|
|
|
| 25 |
|
|
/*
|
| 26 |
|
|
As inputs, we need the following:
|
| 27 |
|
|
|
| 28 |
|
|
For nodes: bbox that just surrounds the node.
|
| 29 |
|
|
For edges: width and height of the text (if any)
|
| 30 |
|
|
associated with the edge.
|
| 31 |
|
|
|
| 32 |
|
|
As outputs, we provide the following:
|
| 33 |
|
|
|
| 34 |
|
|
For nodes: new absolute position of the northwest corner
|
| 35 |
|
|
of the bbox for the node.
|
| 36 |
|
|
For edges: (x,y) coordinates of the endpoints of the edge.
|
| 37 |
|
|
|
| 38 |
|
|
To avoid proliferation of types,
|
| 39 |
|
|
we define a single struct (ItemGeom)
|
| 40 |
|
|
that is used to carry all the input and output info.
|
| 41 |
|
|
|
| 42 |
|
|
Item type Direction ItemGeom Fields Used
|
| 43 |
|
|
--------- --------- --------------------
|
| 44 |
|
|
Node In x1,y1,x2,y2
|
| 45 |
|
|
Out x1,y1
|
| 46 |
|
|
Edge In width,height
|
| 47 |
|
|
Out x1,y1,x2,y2
|
| 48 |
|
|
|
| 49 |
|
|
*/
|
| 50 |
|
|
|
| 51 |
|
|
/* All values are in pixels */
|
| 52 |
|
|
struct ItemGeom {
|
| 53 |
|
|
double x1,y1;
|
| 54 |
|
|
double x2,y2;
|
| 55 |
|
|
double width,height;
|
| 56 |
|
|
};
|
| 57 |
|
|
typedef struct ItemGeom ItemGeom;
|
| 58 |
|
|
|
| 59 |
|
|
struct LayoutConfig {
|
| 60 |
|
|
pItem rootnode;
|
| 61 |
|
|
int graphorder;
|
| 62 |
|
|
int nodespaceH;
|
| 63 |
|
|
int nodespaceV;
|
| 64 |
|
|
int xoffset;
|
| 65 |
|
|
int yoffset;
|
| 66 |
|
|
int computenodesize;
|
| 67 |
|
|
int elementsperline;
|
| 68 |
|
|
int hideedges;
|
| 69 |
|
|
int keeprandompositions;
|
| 70 |
|
|
int maxx;
|
| 71 |
|
|
int maxy;
|
| 72 |
|
|
int gridlock;
|
| 73 |
|
|
};
|
| 74 |
|
|
typedef struct LayoutConfig LayoutConfig;
|
| 75 |
|
|
|
| 76 |
|
|
extern LayoutConfig GetLayoutConfig _ANSI_ARGS_((struct Layout_Graph*));
|
| 77 |
|
|
extern void SetLayoutConfig _ANSI_ARGS_((struct Layout_Graph*, LayoutConfig));
|
| 78 |
|
|
|
| 79 |
|
|
extern int LayoutISI _ANSI_ARGS_((struct Layout_Graph*));
|
| 80 |
|
|
extern int LayoutTree _ANSI_ARGS_((struct Layout_Graph*));
|
| 81 |
|
|
extern int LayoutMatrix _ANSI_ARGS_((struct Layout_Graph*));
|
| 82 |
|
|
extern int LayoutRandom _ANSI_ARGS_((struct Layout_Graph*));
|
| 83 |
|
|
|
| 84 |
|
|
#if DEBUGGING
|
| 85 |
|
|
extern void LayoutDebugging _ANSI_ARGS_((struct Layout_Graph*, struct Node *currentnode, char *string, int type));
|
| 86 |
|
|
#endif
|
| 87 |
|
|
|
| 88 |
|
|
extern struct Layout_Graph* LayoutCreateGraph _ANSI_ARGS_(());
|
| 89 |
|
|
extern void LayoutFreeGraph _ANSI_ARGS_((struct Layout_Graph*));
|
| 90 |
|
|
extern void LayoutClearGraph _ANSI_ARGS_((struct Layout_Graph*));
|
| 91 |
|
|
|
| 92 |
|
|
extern int LayoutCreateNode _ANSI_ARGS_((struct Layout_Graph*,
|
| 93 |
|
|
pItem nodeid,
|
| 94 |
|
|
pItem from, pItem to));
|
| 95 |
|
|
extern int LayoutDeleteNode _ANSI_ARGS_((struct Layout_Graph*, pItem nodeid));
|
| 96 |
|
|
extern int LayoutCreateEdge _ANSI_ARGS_((struct Layout_Graph*,
|
| 97 |
|
|
pItem edgeid,
|
| 98 |
|
|
pItem from, pItem to));
|
| 99 |
|
|
extern int LayoutDeleteEdge _ANSI_ARGS_((struct Layout_Graph*, pItem edgeid));
|
| 100 |
|
|
|
| 101 |
|
|
extern int LayoutGetIthNode _ANSI_ARGS_((struct Layout_Graph*, long, pItem*));
|
| 102 |
|
|
|
| 103 |
|
|
extern int LayoutGetIthEdge _ANSI_ARGS_((struct Layout_Graph*, long, pItem*));
|
| 104 |
|
|
|
| 105 |
|
|
extern int LayoutGetNodeBBox _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom*));
|
| 106 |
|
|
extern int LayoutSetNodeBBox _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom));
|
| 107 |
|
|
|
| 108 |
|
|
extern int LayoutGetEdgeEndPoints _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom*));
|
| 109 |
|
|
extern int LayoutSetEdgeDim _ANSI_ARGS_((struct Layout_Graph*, pItem, ItemGeom));
|
| 110 |
|
|
|
| 111 |
|
|
extern char* LayoutGetError _ANSI_ARGS_((struct Layout_Graph*));
|
| 112 |
|
|
|
| 113 |
|
|
#ifdef __cplusplus
|
| 114 |
|
|
}
|
| 115 |
|
|
#endif
|
| 116 |
|
|
|
| 117 |
|
|
#endif /*LAYOUT_H*/
|