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