libsbml-draw
layout.h
Go to the documentation of this file.
1 /* MIT License
2  */
3 
4 //== FILEDOC =========================================================================
5 
10 //== BEGINNING OF CODE ===============================================================
11 
12 #ifndef __SBNW_LAYOUT_H_
13 #define __SBNW_LAYOUT_H_
14 
15 //== INCLUDES ========================================================================
16 
17 #include "SagittariusCore.h"
18 #include "autolayoutSBML.h"
19 #include "error.h"
20 
21 #include <stdint.h>
22 
23 //-- C methods --
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
37 typedef struct {
39  void* n;
40 } gf_network;
41 
50 typedef struct {
52  void* n;
53 } gf_node;
54 
62 typedef struct {
64  void* r;
65 } gf_reaction;
66 
75 typedef struct {
77  void* c;
78 } gf_curve;
79 
87 typedef struct {
89  void* c;
91 
100 typedef struct {
102  void* canv;
103 } gf_canvas;
104 
114 typedef struct {
117  void* net;
119  void* canv;
121  char* cont;
122 
123  // sbml opts
124  int level;
125  int version;
126 } gf_layoutInfo;
127 
134 //DEPRECATED: rename to gf_point
135 typedef struct {
137  Real x;
138  Real y;
139 } CPoint;
140 
148 typedef struct {
153 } gf_point;
154 
163 typedef struct {
165  void* tf;
166 } gf_transform;
167 
177 typedef struct {
186 } gf_curveCP;
187 
195 typedef enum {
196  GF_ROLE_SUBSTRATE,
197  GF_ROLE_PRODUCT,
198  GF_ROLE_SIDESUBSTRATE,
199  GF_ROLE_SIDEPRODUCT,
200  GF_ROLE_MODIFIER,
201  GF_ROLE_ACTIVATOR,
202  GF_ROLE_INHIBITOR
203 } gf_specRole;
204 
209 _GraphfabExport void gf_freeLayoutInfo(gf_layoutInfo* l);
210 
215 _GraphfabExport void gf_freeLayoutInfoHierarch(gf_layoutInfo* l);
216 
223 _GraphfabExport void gf_freeModelAndLayout(gf_SBMLModel* mod, gf_layoutInfo* l);
224 
229 _GraphfabExport gf_SBMLModel gf_SBMLModel_new();
230 
236 _GraphfabExport gf_SBMLModel* gf_SBMLModel_newp();
237 
242 _GraphfabExport gf_layoutInfo gf_layoutInfo_new(uint64_t level, uint64_t version, uint64_t width, uint64_t height);
243 
249 _GraphfabExport gf_layoutInfo* gf_layoutInfo_newp(uint64_t level, uint64_t version, uint64_t width, uint64_t height);
250 
251 // -- Input --
252 
269 _GraphfabExport gf_layoutInfo* gf_processLayout(gf_SBMLModel* lo);
270 
280 _GraphfabExport gf_layoutInfo* gf_loadSBMLIntoLayoutEngine(const char* buf, gf_SBMLModel* r);
281 
282 // -- Configuration --
283 
291 _GraphfabExport void gf_setModelNamespace(gf_layoutInfo* l, unsigned long level, unsigned long version);
292 
299 _GraphfabExport const char* gf_getDefaultCompartmentId();
300 
307 _GraphfabExport void gf_setDefaultCompartmentId(const char* id);
308 
309 // -- Object API --
310 
311 // Network
312 
317 _GraphfabExport gf_network gf_getNetwork(gf_layoutInfo* l);
318 
325 _GraphfabExport gf_network* gf_getNetworkp(gf_layoutInfo* l);
326 
331 _GraphfabExport void gf_clearNetwork(gf_network* n);
332 
337 _GraphfabExport void gf_releaseNetwork(gf_network* n);
338 
345 _GraphfabExport char* gf_nw_getId(gf_network* n);
346 
354 _GraphfabExport void gf_nw_setId(gf_network* n, const char* id);
355 
360 _GraphfabExport uint64_t gf_nw_getNumNodes(const gf_network* n);
361 
369 _GraphfabExport uint64_t gf_nw_getNumUniqueNodes(const gf_network* n);
370 
375 _GraphfabExport uint64_t gf_nw_getNumRxns(const gf_network* n);
376 
381 _GraphfabExport uint64_t gf_nw_getNumComps(const gf_network* n);
382 
388 _GraphfabExport gf_node gf_nw_getNode(gf_network* n, uint64_t i);
389 
395 _GraphfabExport gf_node gf_nw_getUniqueNode(gf_network* n, uint64_t i);
396 
404 _GraphfabExport gf_node* gf_nw_getNodep(gf_network* n, uint64_t i);
405 
413 _GraphfabExport gf_node* gf_nw_getUniqueNodep(gf_network* n, uint64_t i);
414 
421 _GraphfabExport gf_node* gf_nw_getNodepFromId(gf_network* nw, const char* id);
422 
429 _GraphfabExport gf_reaction gf_nw_getRxn(gf_network* n, uint64_t i);
430 
437 _GraphfabExport gf_reaction* gf_nw_getRxnp(gf_network* n, uint64_t i);
438 
444 _GraphfabExport void gf_nw_removeRxn(gf_network* n, gf_reaction* r);
445 
451 _GraphfabExport gf_compartment gf_nw_getCompartment(gf_network* n, uint64_t i);
452 
459 _GraphfabExport gf_compartment* gf_nw_getCompartmentp(gf_network* n, uint64_t i);
460 
468 _GraphfabExport gf_compartment* gf_nw_findCompartmentById(gf_network* n, const char* id);
469 
476 _GraphfabExport void gf_nw_rebuildCurves(gf_network* n);
477 
482 _GraphfabExport void gf_nw_recenterJunctions(gf_network* n);
483 
490 _GraphfabExport gf_compartment gf_nw_newCompartment(gf_network* nw, const char* id, const char* name);
491 
499 _GraphfabExport gf_compartment* gf_nw_newCompartmentp(gf_network* nw, const char* id, const char* name);
500 
508 _GraphfabExport gf_node gf_nw_newNode(gf_network* nw, const char* id, const char* name, gf_compartment* compartment);
509 
515 _GraphfabExport gf_node gf_nw_aliasOf(gf_network* nw, gf_node* n);
516 
525 _GraphfabExport gf_node* gf_nw_newNodep(gf_network* nw, const char* id, const char* name, gf_compartment* compartment);
526 
535 _GraphfabExport gf_node* gf_nw_newAliasNodep(gf_network* nw, gf_node* source);
536 
541 _GraphfabExport int gf_nw_removeNode(gf_network* nw, gf_node* node);
542 
550 _GraphfabExport int gf_nw_connectNode(gf_network* nw, gf_node* node, gf_reaction* reaction, gf_specRole role);
551 
559 _GraphfabExport int gf_nw_connectNodeRoleStr(gf_network* nw, gf_node* n, gf_reaction* r, const char* role_str);
560 
568 _GraphfabExport int gf_nw_isNodeConnected(gf_network* nw, gf_node* node, gf_reaction* reaction);
569 
575 _GraphfabExport int gf_nw_isLayoutSpecified(gf_network* nw);
576 
582 _GraphfabExport int gf_nw_getNumInstances(gf_network* nw, gf_node* n);
583 
589 _GraphfabExport int gf_nw_getNumAliasInstances(gf_network* nw, gf_node* n);
590 
597 _GraphfabExport gf_node gf_nw_getInstance(gf_network* nw, gf_node* n, uint64_t i);
598 
605 _GraphfabExport gf_node* gf_nw_getInstancep(gf_network* nw, gf_node* n, uint64_t i);
606 
613 _GraphfabExport gf_node* gf_nw_getAliasInstancep(gf_network* nw, gf_node* n, uint64_t i);
614 
615 // Node
616 
622 _GraphfabExport void gf_node_setCompartment(gf_node* n, gf_compartment* c);
623 
628 _GraphfabExport void gf_clearNode(gf_node* n);
629 
634 _GraphfabExport void gf_releaseNode(const gf_node* n);
635 
640 _GraphfabExport int gf_node_isLocked(gf_node* n);
641 
646 _GraphfabExport void gf_node_lock(gf_node* n);
647 
652 _GraphfabExport void gf_node_unlock(gf_node* n);
653 
658 _GraphfabExport int gf_node_alias(gf_node* n, gf_network* m);
659 
671 _GraphfabExport int gf_node_make_alias(gf_node* n, gf_network* m);
672 
677 _GraphfabExport int gf_node_isAliased(gf_node* n);
678 
683 _GraphfabExport void gf_node_setIsAlias(gf_node* n, int isAlias);
684 
689 _GraphfabExport gf_point gf_node_getCentroid(gf_node* n);
690 
697 _GraphfabExport void gf_node_getCentroidXY(gf_node* n, double* x, double* y);
698 
703 _GraphfabExport void gf_node_setCentroid(gf_node* n, gf_point p);
704 
709 _GraphfabExport double gf_node_getWidth(gf_node* n);
710 
715 _GraphfabExport void gf_node_setWidth(gf_node* n, double width);
716 
721 _GraphfabExport double gf_node_getHeight(gf_node* n);
722 
727 _GraphfabExport void gf_node_setHeight(gf_node* n, double height);
728 
733 _GraphfabExport char* gf_node_getID(gf_node* n);
734 
739 _GraphfabExport void gf_node_setID(gf_node* n, const char* id);
740 
745 _GraphfabExport const char* gf_node_getName(gf_node* n);
746 
751 _GraphfabExport void gf_node_setName(gf_node* n, const char* name);
752 
760 _GraphfabExport int gf_node_getConnectedReactions(gf_node* n, gf_network* m, unsigned int* num, gf_reaction** rxns);
761 
769 _GraphfabExport int gf_node_getAttachedCurves(gf_node* n, gf_network* m, unsigned int* num, gf_curve** curves);
770 
776 _GraphfabExport int gf_node_isIdentical(gf_node* u, gf_node* v);
777 
783 _GraphfabExport int gf_nw_nodeHasCompartment(gf_network* nw, gf_node* x);
784 
792 
793 // Reaction
794 
799 _GraphfabExport void gf_releaseRxn(const gf_reaction* r);
800 
807 _GraphfabExport gf_reaction gf_nw_newReaction(gf_network* nw, const char* id, const char* name);
808 
816 _GraphfabExport gf_reaction* gf_nw_newReactionp(gf_network* nw, const char* id, const char* name);
817 
822 _GraphfabExport char* gf_reaction_getID(gf_reaction* r);
823 
828 _GraphfabExport gf_point gf_reaction_getCentroid(gf_reaction* r);
829 
834 _GraphfabExport void gf_reaction_setCentroid(gf_reaction* r, gf_point p);
835 
840 _GraphfabExport uint64_t gf_reaction_getNumSpec(const gf_reaction* r);
841 
846 _GraphfabExport int gf_reaction_hasSpec(const gf_reaction* r, const gf_node* n);
847 
852 _GraphfabExport gf_specRole gf_reaction_getSpecRole(const gf_reaction* r, uint64_t i);
853 
860 _GraphfabExport const char* gf_roleToStr(gf_specRole role);
861 
868 _GraphfabExport gf_specRole gf_strToRole(const char* str);
869 
874 _GraphfabExport uint64_t gf_reaction_specGeti(const gf_reaction* r, uint64_t i);
875 
880 _GraphfabExport uint64_t gf_reaction_getNumCurves(const gf_reaction* r);
881 
886 _GraphfabExport gf_curve gf_reaction_getCurve(const gf_reaction* r, uint64_t i);
887 
893 _GraphfabExport gf_curve* gf_reaction_getCurvep(const gf_reaction* r, uint64_t i);
894 
899 _GraphfabExport void gf_reaction_recenter(gf_reaction* r);
900 
905 _GraphfabExport void gf_reaction_recalcCurveCPs(gf_reaction* r);
906 
907 // Curve
908 
913 _GraphfabExport void gf_releaseCurve(const gf_curve* c);
914 
919 // _GraphfabExport char* gf_curve_getID(gf_curve* c);
920 
927 _GraphfabExport gf_specRole gf_curve_getRole(gf_curve* c);
928 
933 _GraphfabExport gf_curveCP gf_getCurveCPs(const gf_curve* c);
934 
939 _GraphfabExport int gf_curve_hasArrowhead(const gf_curve* c);
940 
941 
948 _GraphfabExport int gf_curve_getArrowheadVerts(const gf_curve* c, unsigned int* n, gf_point** v);
949 
950 // Comparment
951 
956 _GraphfabExport void gf_releaseCompartment(const gf_compartment* c);
957 
962 _GraphfabExport char* gf_compartment_getID(gf_compartment* c);
963 
969 
975 _GraphfabExport void gf_compartment_setMinCorner(gf_compartment* c, gf_point p);
976 
982 
988 _GraphfabExport void gf_compartment_setMaxCorner(gf_compartment* c, gf_point p);
989 
994 _GraphfabExport double gf_compartment_getWidth(gf_compartment* c);
995 
1000 _GraphfabExport double gf_compartment_getHeight(gf_compartment* c);
1001 
1006 _GraphfabExport uint64_t gf_compartment_getNumElt(gf_compartment* c);
1007 
1015 _GraphfabExport int gf_compartment_addNode(gf_compartment* c, gf_node* n);
1016 
1023 _GraphfabExport int gf_compartment_removeNode(gf_compartment* c, gf_node* n);
1024 
1031 _GraphfabExport int gf_compartment_containsNode(gf_compartment* c, gf_node* n);
1032 
1039 _GraphfabExport int gf_compartment_containsReaction(gf_compartment* c, gf_reaction* r);
1040 
1041 // Transform
1042 
1050 _GraphfabExport void gf_fit_to_window(gf_layoutInfo* l, double left, double top, double right, double bottom);
1051 
1062 _GraphfabExport gf_transform* gf_tf_fitToWindow(gf_layoutInfo* l, double left, double top, double right, double bottom);
1063 
1074 _GraphfabExport void gf_moveNetworkToFirstQuad(gf_layoutInfo* l, double x_disp, double y_disp);
1075 
1081 _GraphfabExport CPoint gf_tf_apply_to_point(gf_transform* tf, CPoint p);
1082 
1087 _GraphfabExport gf_point gf_tf_getScale(gf_transform* tf);
1088 
1095 _GraphfabExport gf_point gf_tf_getDisplacement(gf_transform* tf);
1096 
1104 _GraphfabExport gf_point gf_tf_getPostDisplacement(gf_transform* tf);
1105 
1110 _GraphfabExport void gf_dump_transform(gf_transform* tf);
1111 
1116 _GraphfabExport void gf_release_transform(gf_transform* tf);
1117 
1118 // Canvas
1119 
1124 _GraphfabExport gf_canvas gf_getCanvas(gf_layoutInfo* l);
1125 
1130 _GraphfabExport gf_canvas* gf_getCanvasp(gf_layoutInfo* l);
1131 
1136 _GraphfabExport void gf_clearCanvas(gf_canvas* c);
1137 
1142 _GraphfabExport void gf_releaseCanvas(gf_canvas* c);
1143 
1148 _GraphfabExport unsigned int gf_canvGetWidth(gf_canvas* c);
1149 
1154 _GraphfabExport unsigned int gf_canvGetHeight(gf_canvas* c);
1155 
1161 _GraphfabExport void gf_canvSetWidth(gf_canvas* c, unsigned long width);
1162 
1168 _GraphfabExport void gf_canvSetHeight(gf_canvas* c, unsigned long height);
1169 
1170 // -- Queries --
1171 
1178 _GraphfabExport void gf_getNodeCentroid(gf_layoutInfo* l, const char* id, CPoint* p);
1179 
1180 // -- Configuration
1181 
1190 _GraphfabExport int gf_lockNodeId(gf_layoutInfo* l, const char* id);
1191 
1200 _GraphfabExport int gf_unlockNodeId(gf_layoutInfo* l, const char* id);
1201 
1210 _GraphfabExport int gf_aliasNodeId(gf_layoutInfo* l, const char* id);
1211 
1217 _GraphfabExport void gf_aliasNodebyDegree(gf_layoutInfo* l, const int minDegree);
1218 
1219 // -- Processing --
1220 
1225 _GraphfabExport void gf_randomizeLayout(gf_layoutInfo* m);
1226 
1232 _GraphfabExport void gf_randomizeLayout2(gf_network* n, gf_canvas* c);
1233 
1242 _GraphfabExport void gf_randomizeLayout_fromExtents(gf_network* n, double left, double top, double right, double bottom);
1243 
1244 // -- Output --
1245 
1254 _GraphfabExport int gf_writeSBMLwithLayout(const char* filename, gf_SBMLModel* m, gf_layoutInfo* l, int use_transformed_coords);
1255 
1262 _GraphfabExport int gf_writeSBML(const char* filename, gf_SBMLModel* m);
1263 
1271 _GraphfabExport const char* gf_getSBMLwithLayoutStr(gf_SBMLModel* m, gf_layoutInfo* l, int use_transformed_coords);
1272 
1277 _GraphfabExport const char* gf_getCurrentLibraryVersion(void);
1278 
1283 _GraphfabExport void gf_free(void* x);
1284 
1290 _GraphfabExport gf_point gf_computeCubicBezierPoint(gf_curveCP* c, Real t);
1291 
1299 _GraphfabExport gf_point* gf_computeCubicBezierLineIntersec(gf_curveCP* c, gf_point* line_start, gf_point* line_end);
1300 
1306 _GraphfabExport int gf_arrowheadStyleGetNumVerts(int style);
1307 
1314 _GraphfabExport gf_point gf_arrowheadStyleGetVert(int style, int n);
1315 
1321 _GraphfabExport int gf_arrowheadStyleIsFilled(int style);
1322 
1327 _GraphfabExport unsigned long gf_arrowheadNumStyles();
1328 
1334 _GraphfabExport void gf_arrowheadSetStyle(gf_specRole role, int style);
1335 
1340 _GraphfabExport int gf_arrowheadGetStyle(gf_specRole role);
1341 
1348 _GraphfabExport void gf_layout_alignToOrigin(gf_layoutInfo* l, double pad_x, double pad_y);
1349 
1350 #ifdef __cplusplus
1351 }//extern "C"
1352 #endif
1353 
1354 //-- C++ methods --
1355 #ifdef __cplusplus
1356 
1357 
1358 
1359 #endif
1360 
1361 #endif
_GraphfabExport uint64_t gf_compartment_getNumElt(gf_compartment *c)
Get the number of species in the compartment.
Definition: layout.cpp:1961
_GraphfabExport gf_network gf_getNetwork(gf_layoutInfo *l)
Get the network associated with the model.
Definition: layout.cpp:917
_GraphfabExport char * gf_compartment_getID(gf_compartment *c)
Get the id, user frees memory.
Definition: layout.cpp:1905
_GraphfabExport void gf_free(void *x)
Frees the memory block at x.
Definition: layout.cpp:2253
_GraphfabExport int gf_compartment_removeNode(gf_compartment *c, gf_node *n)
Remove a node from the compartment.
Definition: layout.cpp:1983
_GraphfabExport gf_transform * gf_tf_fitToWindow(gf_layoutInfo *l, double left, double top, double right, double bottom)
Fit to the specified window (do not apply transform)
Definition: layout.cpp:2051
_GraphfabExport void gf_node_lock(gf_node *n)
Lock the node.
Definition: layout.cpp:1430
_GraphfabExport int gf_node_isLocked(gf_node *n)
Is the node locked?
Definition: layout.cpp:1423
_GraphfabExport gf_point gf_tf_getScale(gf_transform *tf)
Get the scale of the transform.
Definition: layout.cpp:2093
_GraphfabExport uint64_t gf_nw_getNumUniqueNodes(const gf_network *n)
Get the number of unique nodes.
Definition: layout.cpp:963
_GraphfabExport CPoint gf_tf_apply_to_point(gf_transform *tf, CPoint p)
Apply transform to point.
Definition: layout.cpp:2086
_GraphfabExport uint64_t gf_nw_getNumRxns(const gf_network *n)
Get the number of reactions.
Definition: layout.cpp:970
_GraphfabExport double gf_compartment_getHeight(gf_compartment *c)
Get the height of the compartment.
Definition: layout.cpp:1954
_GraphfabExport gf_reaction gf_nw_newReaction(gf_network *nw, const char *id, const char *name)
Add a new reaction to the network.
Definition: layout.cpp:1613
_GraphfabExport void gf_randomizeLayout_fromExtents(gf_network *n, double left, double top, double right, double bottom)
Randomize node positions for a given network & extents.
Definition: layout.cpp:2239
_GraphfabExport int gf_nw_removeNode(gf_network *nw, gf_node *node)
Remove a node from the network.
Definition: layout.cpp:1234
_GraphfabExport gf_layoutInfo * gf_processLayout(gf_SBMLModel *lo)
Process the layout info from a document.
Definition: layout.cpp:118
_GraphfabExport void gf_clearNetwork(gf_network *n)
Clear the network - does not deallocate.
Definition: layout.cpp:931
_GraphfabExport unsigned int gf_canvGetWidth(gf_canvas *c)
Get the width of the canvas.
Definition: layout.cpp:2149
_GraphfabExport int gf_aliasNodeId(gf_layoutInfo *l, const char *id)
Create node aliases.
SAGITTARIUS_REAL Real
Make Real visible to C. Consider letting Real lie in top namespace.
Definition: SagittariusCommon.h:112
_GraphfabExport int gf_arrowheadGetStyle(gf_specRole role)
Get the style for the role type.
Definition: layout.cpp:2322
_GraphfabExport gf_specRole gf_reaction_getSpecRole(const gf_reaction *r, uint64_t i)
Get the role for spec i.
Definition: layout.cpp:1707
_GraphfabExport uint64_t gf_reaction_specGeti(const gf_reaction *r, uint64_t i)
Get the global index of a reactant/product/participant given its local index in a reaction.
Definition: layout.cpp:1753
_GraphfabExport void gf_dump_transform(gf_transform *tf)
Dump transform.
Definition: layout.cpp:2114
A point in 2D space.
Definition: layout.h:135
_GraphfabExport void gf_freeLayoutInfo(gf_layoutInfo *l)
Call to clean up an instance of gf_layoutInfo when it is no longer needed.
Definition: layout.cpp:30
_GraphfabExport void gf_node_setName(gf_node *n, const char *name)
Set the name of a node.
Definition: layout.cpp:1514
_GraphfabExport void gf_canvSetHeight(gf_canvas *c, unsigned long height)
Set the height of the canvas.
Definition: layout.cpp:2170
_GraphfabExport double gf_node_getWidth(gf_node *n)
Get the width of the node.
Definition: layout.cpp:1460
_GraphfabExport void gf_node_unlock(gf_node *n)
Unlock the node.
Definition: layout.cpp:1437
_GraphfabExport gf_node * gf_nw_getNodep(gf_network *n, uint64_t i)
Get the node at index i.
Definition: layout.cpp:1000
_GraphfabExport const char * gf_roleToStr(gf_specRole role)
Convert role to string.
Definition: layout.cpp:1715
_GraphfabExport gf_layoutInfo * gf_layoutInfo_newp(uint64_t level, uint64_t version, uint64_t width, uint64_t height)
Create a new layout info object.
Definition: layout.cpp:112
_GraphfabExport uint64_t gf_nw_getNumNodes(const gf_network *n)
Get the number of nodes.
Definition: layout.cpp:956
_GraphfabExport void gf_node_getCentroidXY(gf_node *n, double *x, double *y)
Get the centroid of the node.
gf_point c1
Control 1.
Definition: layout.h:181
_GraphfabExport int gf_unlockNodeId(gf_layoutInfo *l, const char *id)
Unlock a node by id.
_GraphfabExport int gf_nw_connectNodeRoleStr(gf_network *nw, gf_node *n, gf_reaction *r, const char *role_str)
Connect a node to a reaction.
Definition: layout.cpp:1282
_GraphfabExport int gf_nw_isLayoutSpecified(gf_network *nw)
Did the SBML model include layout?
Definition: layout.cpp:1302
_GraphfabExport void gf_releaseCanvas(gf_canvas *c)
Release the canvas.
Definition: layout.cpp:2142
_GraphfabExport void gf_moveNetworkToFirstQuad(gf_layoutInfo *l, double x_disp, double y_disp)
Move the entire network to the first quadrant.
Definition: layout.cpp:2076
_GraphfabExport void gf_setModelNamespace(gf_layoutInfo *l, unsigned long level, unsigned long version)
Set the level and version of the SBML.
Definition: layout.cpp:886
_GraphfabExport gf_node gf_nw_getInstance(gf_network *nw, gf_node *n, uint64_t i)
Get the ith instance of an aliased node.
Definition: layout.cpp:1324
_GraphfabExport gf_point gf_arrowheadStyleGetVert(int style, int n)
Get the nth vertex of the arrow polygon.
Definition: layout.cpp:2285
_GraphfabExport gf_compartment * gf_nw_getCompartmentp(gf_network *n, uint64_t i)
Get the compartment at index i.
Definition: layout.cpp:1074
_GraphfabExport int gf_writeSBML(const char *filename, gf_SBMLModel *m)
Write an SBML file (does not include layout.
Definition: layout.cpp:2199
_GraphfabExport gf_layoutInfo gf_layoutInfo_new(uint64_t level, uint64_t version, uint64_t width, uint64_t height)
Create a new layout info object.
Definition: layout.cpp:102
_GraphfabExport void gf_compartment_setMinCorner(gf_compartment *c, gf_point p)
Set the "upper left" corner.
Definition: layout.cpp:1926
_GraphfabExport int gf_curve_hasArrowhead(const gf_curve *c)
Returns true if the given curve should be drawn with an arrowhead.
Definition: layout.cpp:1866
_GraphfabExport uint64_t gf_reaction_getNumSpec(const gf_reaction *r)
Get the number of species in the reaction.
Definition: layout.cpp:1674
_GraphfabExport void gf_node_setIsAlias(gf_node *n, int isAlias)
Set whether the node is an alias node or not.
Definition: layout.cpp:1416
_GraphfabExport gf_compartment * gf_nw_findCompartmentById(gf_network *n, const char *id)
Find a compartment by id.
Definition: layout.cpp:1082
_GraphfabExport gf_reaction * gf_nw_newReactionp(gf_network *nw, const char *id, const char *name)
Add a new reaction to the network.
Definition: layout.cpp:1642
_GraphfabExport void gf_release_transform(gf_transform *tf)
Release transform.
Definition: layout.cpp:2120
_GraphfabExport int gf_node_getConnectedReactions(gf_node *n, gf_network *m, unsigned int *num, gf_reaction **rxns)
Get a list of all reactions connected to the node.
Definition: layout.cpp:1525
_GraphfabExport const char * gf_getCurrentLibraryVersion(void)
Returns the current version of the library.
Definition: layout.cpp:2249
_GraphfabExport int gf_node_isIdentical(gf_node *u, gf_node *v)
Tests whether two nodes are identical.
Definition: layout.cpp:1567
_GraphfabExport const char * gf_getDefaultCompartmentId()
Get the id of the default SBML compartment.
Definition: layout.cpp:891
_GraphfabExport int gf_node_alias(gf_node *n, gf_network *m)
Alias the node.
Definition: layout.cpp:1394
_GraphfabExport void gf_releaseNetwork(gf_network *n)
Release the network.
Definition: layout.cpp:935
_GraphfabExport void gf_clearNode(gf_node *n)
Clear the node - does not deallocate.
Definition: layout.cpp:1358
Error information.
_GraphfabExport void gf_releaseCurve(const gf_curve *c)
Release the curve.
Definition: layout.cpp:1804
_GraphfabExport void gf_arrowheadSetStyle(gf_specRole role, int style)
Set the arrowhead style for a specific role type.
Definition: layout.cpp:2297
_GraphfabExport void gf_node_setID(gf_node *n, const char *id)
Get the id, user frees memory.
Definition: layout.cpp:1492
_GraphfabExport gf_point gf_tf_getPostDisplacement(gf_transform *tf)
Get the displacement component of the transform.
Definition: layout.cpp:2106
_GraphfabExport void gf_node_setWidth(gf_node *n, double width)
Set the width of the node.
Definition: layout.cpp:1466
_GraphfabExport unsigned long gf_arrowheadNumStyles()
Get the number of arrowhead styles.
Definition: layout.cpp:2293
_GraphfabExport void gf_nw_rebuildCurves(gf_network *n)
Rebuild all curves in the network.
Definition: layout.cpp:1095
_GraphfabExport gf_compartment * gf_nw_nodeGetCompartment(gf_network *nw, gf_node *x)
Get the compartment which contains node x.
Definition: layout.cpp:1590
_GraphfabExport uint64_t gf_reaction_getNumCurves(const gf_reaction *r)
Get the number of curves in the reaction.
Definition: layout.cpp:1761
gf_point e
End.
Definition: layout.h:185
_GraphfabExport gf_node * gf_nw_getInstancep(gf_network *nw, gf_node *n, uint64_t i)
Get the ith instance of an aliased node.
Definition: layout.cpp:1338
_GraphfabExport int gf_node_getAttachedCurves(gf_node *n, gf_network *m, unsigned int *num, gf_curve **curves)
Get a list of all curves connected to the node.
Definition: layout.cpp:1546
_GraphfabExport int gf_lockNodeId(gf_layoutInfo *l, const char *id)
Lock a node by id.
_GraphfabExport void gf_freeModelAndLayout(gf_SBMLModel *mod, gf_layoutInfo *l)
Call to clean up an instance of gf_layoutInfo and gf_SBMLModel when they are no longer needed.
Definition: layout.cpp:52
_GraphfabExport gf_point gf_tf_getDisplacement(gf_transform *tf)
Get the displacement of the transform.
Definition: layout.cpp:2099
_GraphfabExport gf_curveCP gf_getCurveCPs(const gf_curve *c)
Get the CPs for the curve.
Definition: layout.cpp:1862
_GraphfabExport int gf_arrowheadStyleIsFilled(int style)
Is the given style filled?
Definition: layout.cpp:2289
_GraphfabExport gf_network * gf_getNetworkp(gf_layoutInfo *l)
Get the network associated with the model.
Definition: layout.cpp:924
_GraphfabExport gf_specRole gf_strToRole(const char *str)
Convert string to role.
Definition: layout.cpp:1730
_GraphfabExport int gf_nw_nodeHasCompartment(gf_network *nw, gf_node *x)
Return true if the node has a compartment assigned.
Definition: layout.cpp:1577
_GraphfabExport char * gf_reaction_getID(gf_reaction *r)
Get the id, user frees memory.
Definition: layout.cpp:1648
_GraphfabExport int gf_reaction_hasSpec(const gf_reaction *r, const gf_node *n)
Return true if the reaction has the given species.
Definition: layout.cpp:1682
_GraphfabExport gf_node * gf_nw_newNodep(gf_network *nw, const char *id, const char *name, gf_compartment *compartment)
Add a new node to the network.
Definition: layout.cpp:1214
_GraphfabExport int gf_node_make_alias(gf_node *n, gf_network *m)
Create aliases of a given node.
Definition: layout.cpp:1404
_GraphfabExport void gf_canvSetWidth(gf_canvas *c, unsigned long width)
Set the width of the canvas.
Definition: layout.cpp:2156
_GraphfabExport void gf_setDefaultCompartmentId(const char *id)
Set the id of the default SBML compartment.
Definition: layout.cpp:895
_GraphfabExport gf_curve gf_reaction_getCurve(const gf_reaction *r, uint64_t i)
Get the curve i.
Definition: layout.cpp:1773
_GraphfabExport void gf_nw_setId(gf_network *n, const char *id)
Set the id of the network (via the SBML model)
Definition: layout.cpp:949
Real x
x coordinate
Definition: layout.h:150
_GraphfabExport gf_node * gf_nw_getNodepFromId(gf_network *nw, const char *id)
Get the node with the given id.
Definition: layout.cpp:1016
_GraphfabExport gf_canvas * gf_getCanvasp(gf_layoutInfo *l)
Get the canvas associated with the model.
Definition: layout.cpp:2131
A 2D cubic Bezier curve.
Definition: layout.h:75
_GraphfabExport void gf_reaction_recalcCurveCPs(gf_reaction *r)
Recalculate the curve CPs, don't recenter.
Definition: layout.cpp:1797
_GraphfabExport gf_compartment * gf_nw_newCompartmentp(gf_network *nw, const char *id, const char *name)
Add a new compartment to the network.
Definition: layout.cpp:1136
First file included.
Real y
y coordinate
Definition: layout.h:152
_GraphfabExport void gf_reaction_setCentroid(gf_reaction *r, gf_point p)
Set the centroid of the reaction.
Definition: layout.cpp:1667
_GraphfabExport void gf_clearCanvas(gf_canvas *c)
Get the canvas associated with the model.
Definition: layout.cpp:2138
_GraphfabExport void gf_node_setCentroid(gf_node *n, gf_point p)
Set the centroid of the node.
Definition: layout.cpp:1452
_GraphfabExport void gf_releaseNode(const gf_node *n)
Release the node.
Definition: layout.cpp:1362
_GraphfabExport const char * gf_getSBMLwithLayoutStr(gf_SBMLModel *m, gf_layoutInfo *l, int use_transformed_coords)
String version of writeSBMLwithLayout.
Definition: layout.cpp:2209
_GraphfabExport gf_node * gf_nw_getAliasInstancep(gf_network *nw, gf_node *n, uint64_t i)
Get the ith instance of an aliased node.
Definition: layout.cpp:1344
_GraphfabExport void gf_node_setCompartment(gf_node *n, gf_compartment *c)
Add a node to a compartment.
Definition: layout.cpp:1350
_GraphfabExport void gf_layout_alignToOrigin(gf_layoutInfo *l, double pad_x, double pad_y)
Align the network to the origin.
Definition: layout.cpp:905
Type which holds layout info.
Definition: layout.h:114
_GraphfabExport void gf_compartment_setMaxCorner(gf_compartment *c, gf_point p)
Set the "lower right" corner.
Definition: layout.cpp:1940
_GraphfabExport char * gf_nw_getId(gf_network *n)
Get the id of the network (i.e. the SBML model)
Definition: layout.cpp:942
_GraphfabExport gf_SBMLModel gf_SBMLModel_new()
Create a new SBML model.
Definition: layout.cpp:90
_GraphfabExport void gf_reaction_recenter(gf_reaction *r)
Recenter reaction centroid.
Definition: layout.cpp:1790
_GraphfabExport int gf_compartment_containsReaction(gf_compartment *c, gf_reaction *r)
Return whether the compartment contains this node.
Definition: layout.cpp:2013
_GraphfabExport gf_SBMLModel * gf_SBMLModel_newp()
Create a new SBML model.
Definition: layout.cpp:96
_GraphfabExport int gf_nw_isNodeConnected(gf_network *nw, gf_node *node, gf_reaction *reaction)
Return whether the given node is connected to the given reaction.
Definition: layout.cpp:1289
_GraphfabExport gf_canvas gf_getCanvas(gf_layoutInfo *l)
Get the canvas associated with the model.
Definition: layout.cpp:2126
_GraphfabExport void gf_releaseRxn(const gf_reaction *r)
Release the reaction.
Definition: layout.cpp:1605
_GraphfabExport gf_layoutInfo * gf_loadSBMLIntoLayoutEngine(const char *buf, gf_SBMLModel *r)
[DEPRECATED] Load SBML document from memory buffer and process
Definition: layout.cpp:798
_GraphfabExport gf_reaction gf_nw_getRxn(gf_network *n, uint64_t i)
Get the node at index i.
Definition: layout.cpp:1033
_GraphfabExport gf_node * gf_nw_newAliasNodep(gf_network *nw, gf_node *source)
Create and add an alias node from a given source node.
Definition: layout.cpp:1221
_GraphfabExport const char * gf_node_getName(gf_node *n)
Get the name, client must free memory.
Definition: layout.cpp:1503
_GraphfabExport int gf_nw_getNumAliasInstances(gf_network *nw, gf_node *n)
Get the number of instances of the node.
Definition: layout.cpp:1320
_GraphfabExport double gf_compartment_getWidth(gf_compartment *c)
Get the width of the compartment.
Definition: layout.cpp:1947
_GraphfabExport gf_node gf_nw_newNode(gf_network *nw, const char *id, const char *name, gf_compartment *compartment)
Add a new node to the network.
Definition: layout.cpp:1142
_GraphfabExport void gf_nw_recenterJunctions(gf_network *n)
Recenter reaction junctions.
Definition: layout.cpp:1101
_GraphfabExport double gf_node_getHeight(gf_node *n)
Get the height of the node.
Definition: layout.cpp:1473
_GraphfabExport gf_compartment gf_nw_newCompartment(gf_network *nw, const char *id, const char *name)
Add a new compartment to the network.
Definition: layout.cpp:1107
A species in a model.
Definition: layout.h:50
_GraphfabExport gf_point gf_compartment_getMinCorner(gf_compartment *c)
Get the "upper left" corner.
Definition: layout.cpp:1919
_GraphfabExport int gf_compartment_containsNode(gf_compartment *c, gf_node *n)
Return whether the compartment contains this node.
Definition: layout.cpp:1998
_GraphfabExport int gf_writeSBMLwithLayout(const char *filename, gf_SBMLModel *m, gf_layoutInfo *l, int use_transformed_coords)
Write an SBML file, including layout.
Definition: layout.cpp:2177
_GraphfabExport uint64_t gf_nw_getNumComps(const gf_network *n)
Get the number of compartments.
Definition: layout.cpp:977
_GraphfabExport char * gf_node_getID(gf_node *n)
Get the id, user frees memory.
Definition: layout.cpp:1485
A point in 2D space.
Definition: layout.h:148
_GraphfabExport void gf_freeLayoutInfoHierarch(gf_layoutInfo *l)
Call to clean up an instance of gf_layoutInfo and all contained data structures.
Definition: layout.cpp:38
A compartment in a model.
Definition: layout.h:87
_GraphfabExport unsigned int gf_canvGetHeight(gf_canvas *c)
Get the height of the canvas.
Definition: layout.cpp:2163
A reaction network.
Definition: layout.h:37
_GraphfabExport int gf_nw_getNumInstances(gf_network *nw, gf_node *n)
Get the number of instances of the node.
Definition: layout.cpp:1311
_GraphfabExport gf_compartment gf_nw_getCompartment(gf_network *n, uint64_t i)
Get the compartment at index i.
Definition: layout.cpp:1066
A curve control points.
Definition: layout.h:177
_GraphfabExport gf_point gf_node_getCentroid(gf_node *n)
Get the centroid of the node.
Definition: layout.cpp:1444
_GraphfabExport gf_specRole gf_curve_getRole(gf_curve *c)
Get the id, user frees memory.
Definition: layout.cpp:1839
_GraphfabExport gf_node gf_nw_getUniqueNode(gf_network *n, uint64_t i)
Get the unique node at index i.
Definition: layout.cpp:992
C wrapper for SBMLDocument.
Definition: autolayoutSBML.h:25
_GraphfabExport gf_point * gf_computeCubicBezierLineIntersec(gf_curveCP *c, gf_point *line_start, gf_point *line_end)
Compute the intersection between a cubic Bezier and a line.
Definition: layout.cpp:2262
_GraphfabExport int gf_curve_getArrowheadVerts(const gf_curve *c, unsigned int *n, gf_point **v)
Get the vertices for the curve's arrowhead.
Definition: layout.cpp:1873
_GraphfabExport gf_point gf_reaction_getCentroid(gf_reaction *r)
Get the centroid of the reaction.
Definition: layout.cpp:1657
_GraphfabExport void gf_fit_to_window(gf_layoutInfo *l, double left, double top, double right, double bottom)
Fit to the specified window.
Definition: layout.cpp:2028
gf_specRole
Species role in a reaction.
Definition: layout.h:195
gf_point c2
Control 2.
Definition: layout.h:183
_GraphfabExport void gf_node_setHeight(gf_node *n, double height)
Set the height of the node.
Definition: layout.cpp:1479
A reaction in a model.
Definition: layout.h:62
_GraphfabExport int gf_compartment_addNode(gf_compartment *c, gf_node *n)
Add a node to the compartment.
Definition: layout.cpp:1968
_GraphfabExport void gf_aliasNodebyDegree(gf_layoutInfo *l, const int minDegree)
Create node aliases by node degree.
Definition: layout.cpp:263
A 2D affine transform.
Definition: layout.h:163
_GraphfabExport void gf_releaseCompartment(const gf_compartment *c)
Release a compartment object.
Definition: layout.cpp:1894
_GraphfabExport int gf_nw_connectNode(gf_network *nw, gf_node *node, gf_reaction *reaction, gf_specRole role)
Connect a node to a reaction.
Definition: layout.cpp:1257
_GraphfabExport gf_node * gf_nw_getUniqueNodep(gf_network *n, uint64_t i)
Get the node at index i.
Definition: layout.cpp:1008
_GraphfabExport gf_point gf_computeCubicBezierPoint(gf_curveCP *c, Real t)
Compute a point on the parametric curve.
Definition: layout.cpp:2257
_GraphfabExport gf_node gf_nw_getNode(gf_network *n, uint64_t i)
Get the node at index i.
Definition: layout.cpp:984
_GraphfabExport void gf_randomizeLayout(gf_layoutInfo *m)
Randomize node positions.
Definition: layout.cpp:2221
_GraphfabExport void gf_nw_removeRxn(gf_network *n, gf_reaction *r)
Remove the given reaction.
Definition: layout.cpp:1057
_GraphfabExport int gf_arrowheadStyleGetNumVerts(int style)
Get the number of vertices in the arrowhead polygon.
Definition: layout.cpp:2281
_GraphfabExport gf_curve * gf_reaction_getCurvep(const gf_reaction *r, uint64_t i)
Get the curve i.
Definition: layout.cpp:1783
gf_point s
Start.
Definition: layout.h:179
_GraphfabExport int gf_node_isAliased(gf_node *n)
Is the node aliased?
Definition: layout.cpp:1409
_GraphfabExport gf_point gf_compartment_getMaxCorner(gf_compartment *c)
Get the "lower right" corner.
Definition: layout.cpp:1933
Drawing canvas.
Definition: layout.h:100
_GraphfabExport void gf_randomizeLayout2(gf_network *n, gf_canvas *c)
Randomize node positions for a given network & canvas.
Definition: layout.cpp:2230
_GraphfabExport gf_reaction * gf_nw_getRxnp(gf_network *n, uint64_t i)
Get the node at index i.
Definition: layout.cpp:1045
_GraphfabExport void gf_getNodeCentroid(gf_layoutInfo *l, const char *id, CPoint *p)
Get the centroid of a node.
Definition: layout.cpp:204
_GraphfabExport gf_node gf_nw_aliasOf(gf_network *nw, gf_node *n)
Creates a new node that is the alias of a given node.
Definition: layout.cpp:1185