1/* $Id$ $Revision$ */
2/* vim:set shiftwidth=4 ts=8: */
3
4/*************************************************************************
5 * Copyright (c) 2011 AT&T Intellectual Property
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * Contributors: See CVS logs. Details at http://www.graphviz.org/
12 *************************************************************************/
13
14/*
15 * neato layout plugin
16 *
17 */
18
19
20#include "config.h"
21
22#include <stdio.h>
23
24#include "gvplugin_layout.h"
25
26/* FIXME - globals.h is needed for Nop */
27#include "globals.h"
28
29typedef enum { LAYOUT_NEATO,
30 LAYOUT_FDP,
31 LAYOUT_SFDP,
32 LAYOUT_TWOPI,
33 LAYOUT_CIRCO,
34 LAYOUT_PATCHWORK,
35 LAYOUT_CLUSTER,
36 LAYOUT_NOP1,
37 LAYOUT_NOP2,
38 } layout_type;
39
40extern void neato_layout(graph_t * g);
41extern void fdp_layout(graph_t * g);
42extern void sfdp_layout(graph_t * g);
43extern void twopi_layout(graph_t * g);
44extern void circo_layout(graph_t * g);
45extern void patchwork_layout(graph_t * g);
46extern void osage_layout(graph_t * g);
47
48extern void neato_cleanup(graph_t * g);
49extern void fdp_cleanup(graph_t * g);
50extern void sfdp_cleanup(graph_t * g);
51extern void twopi_cleanup(graph_t * g);
52extern void circo_cleanup(graph_t * g);
53extern void patchwork_cleanup(graph_t * g);
54extern void osage_cleanup(graph_t * g);
55
56static void nop1_layout(graph_t * g)
57{
58 Nop = 1;
59 neato_layout(g);
60 Nop = 0;
61}
62
63static void nop2_layout(graph_t * g)
64{
65 Nop = 2;
66 neato_layout(g);
67 Nop = 0;
68}
69
70gvlayout_engine_t neatogen_engine = {
71 neato_layout,
72 neato_cleanup,
73};
74
75gvlayout_engine_t fdpgen_engine = {
76 fdp_layout,
77 fdp_cleanup,
78};
79
80#ifdef SFDP
81gvlayout_engine_t sfdpgen_engine = {
82 sfdp_layout,
83 sfdp_cleanup,
84};
85#endif
86
87gvlayout_engine_t twopigen_engine = {
88 twopi_layout,
89 twopi_cleanup,
90};
91
92gvlayout_engine_t circogen_engine = {
93 circo_layout,
94 circo_cleanup,
95};
96
97gvlayout_engine_t nop1gen_engine = {
98 nop1_layout,
99 neato_cleanup,
100};
101
102gvlayout_engine_t nop2gen_engine = {
103 nop2_layout,
104 neato_cleanup,
105};
106
107gvlayout_engine_t patchwork_engine = {
108 patchwork_layout,
109 patchwork_cleanup,
110};
111
112gvlayout_engine_t osage_engine = {
113 osage_layout,
114 osage_cleanup,
115};
116
117gvlayout_features_t neatogen_features = {
118 0,
119};
120
121gvplugin_installed_t gvlayout_neato_types[] = {
122 {LAYOUT_NEATO, "neato", 0, &neatogen_engine, &neatogen_features},
123 {LAYOUT_FDP, "fdp", 0, &fdpgen_engine, &neatogen_features},
124#ifdef SFDP
125 {LAYOUT_SFDP, "sfdp", 0, &sfdpgen_engine, &neatogen_features},
126#endif
127 {LAYOUT_TWOPI, "twopi", 0, &twopigen_engine, &neatogen_features},
128 {LAYOUT_CIRCO, "circo", 0, &circogen_engine, &neatogen_features},
129 {LAYOUT_PATCHWORK, "patchwork", 0, &patchwork_engine, &neatogen_features},
130 {LAYOUT_CLUSTER, "osage", 0, &osage_engine, &neatogen_features},
131 {LAYOUT_NOP1, "nop", 0, &nop1gen_engine, &neatogen_features},
132 {LAYOUT_NOP1, "nop1", 0, &nop1gen_engine, &neatogen_features},
133 {LAYOUT_NOP1, "nop2", 0, &nop2gen_engine, &neatogen_features},
134 {0, NULL, 0, NULL, NULL}
135};
136