Graphviz  2.29.20120524.0446
plugin/neato_layout/gvlayout_neato_layout.c
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 /*
00015  *  neato layout plugin
00016  *
00017  */
00018 
00019 
00020 #ifdef HAVE_CONFIG_H
00021 #include "config.h"
00022 #endif
00023 
00024 #include <stdio.h>
00025 
00026 #include "gvplugin_layout.h"
00027 
00028 /* FIXME - globals.h is needed for Nop */
00029 #include "globals.h"
00030 
00031 
00032 #ifdef WIN32 //*dependencies
00033 #ifdef WITH_CGRAPH
00034     #pragma comment( lib, "cgraph.lib" )
00035 #else
00036     #pragma comment( lib, "graph.lib" )
00037 #endif
00038     #pragma comment( lib, "gvc.lib" )
00039     #pragma comment( lib, "pathplan.lib" )
00040     #pragma comment( lib, "neatogen.lib" )
00041     #pragma comment( lib, "circogen.lib" )
00042     #pragma comment( lib, "twopigen.lib" )
00043     #pragma comment( lib, "fdpgen.lib" )
00044     #pragma comment( lib, "sparse.lib" )
00045     #pragma comment( lib, "cdt.lib" )
00046     #pragma comment( lib, "gts.lib" )
00047     #pragma comment( lib, "glib-2.0.lib" )
00048     #pragma comment( lib, "vpsc.lib" )
00049     #pragma comment( lib, "patchwork.lib" )
00050     #pragma comment( lib, "gvortho.lib" )
00051 #endif
00052 
00053 
00054 typedef enum { LAYOUT_NEATO,
00055                 LAYOUT_FDP,
00056                 LAYOUT_SFDP,
00057                 LAYOUT_TWOPI,
00058                 LAYOUT_CIRCO,
00059                 LAYOUT_PATCHWORK,
00060                 LAYOUT_CLUSTER,
00061                 LAYOUT_NOP1,
00062                 LAYOUT_NOP2,
00063         } layout_type;
00064 
00065 extern void neato_layout(graph_t * g);
00066 extern void fdp_layout(graph_t * g);
00067 extern void sfdp_layout(graph_t * g);
00068 extern void twopi_layout(graph_t * g);
00069 extern void circo_layout(graph_t * g);
00070 extern void patchwork_layout(graph_t * g);
00071 extern void osage_layout(graph_t * g);
00072 
00073 extern void neato_cleanup(graph_t * g);
00074 extern void fdp_cleanup(graph_t * g);
00075 extern void sfdp_cleanup(graph_t * g);
00076 extern void twopi_cleanup(graph_t * g);
00077 extern void circo_cleanup(graph_t * g);
00078 extern void patchwork_cleanup(graph_t * g);
00079 extern void osage_cleanup(graph_t * g);
00080 
00081 static void nop1_layout(graph_t * g)
00082 {
00083     Nop = 1;
00084     neato_layout(g);
00085     Nop = 0;
00086 }
00087 
00088 static void nop2_layout(graph_t * g)
00089 {
00090     Nop = 2;
00091     neato_layout(g);
00092     Nop = 0;
00093 }
00094 
00095 gvlayout_engine_t neatogen_engine = {
00096     neato_layout,
00097     neato_cleanup,
00098 };
00099 
00100 gvlayout_engine_t fdpgen_engine = {
00101     fdp_layout,
00102     fdp_cleanup,
00103 };
00104 
00105 #ifdef SFDP
00106 gvlayout_engine_t sfdpgen_engine = {
00107     sfdp_layout,
00108     sfdp_cleanup,
00109 };
00110 #endif
00111 
00112 gvlayout_engine_t twopigen_engine = {
00113     twopi_layout,
00114     twopi_cleanup,
00115 };
00116 
00117 gvlayout_engine_t circogen_engine = {
00118     circo_layout,
00119     circo_cleanup,
00120 };
00121 
00122 gvlayout_engine_t nop1gen_engine = {
00123     nop1_layout,
00124     neato_cleanup,
00125 };
00126 
00127 gvlayout_engine_t nop2gen_engine = {
00128     nop2_layout,
00129     neato_cleanup,
00130 };
00131 
00132 gvlayout_engine_t patchwork_engine = {
00133     patchwork_layout,
00134     patchwork_cleanup,
00135 };
00136 
00137 gvlayout_engine_t osage_engine = {
00138     osage_layout,
00139     osage_cleanup,
00140 };
00141 
00142 gvlayout_features_t neatogen_features = {
00143         0,
00144 };
00145 
00146 gvplugin_installed_t gvlayout_neato_types[] = {
00147     {LAYOUT_NEATO, "neato", 0, &neatogen_engine, &neatogen_features},
00148     {LAYOUT_FDP, "fdp", 0, &fdpgen_engine, &neatogen_features},
00149 #ifdef SFDP
00150     {LAYOUT_SFDP, "sfdp", 0, &sfdpgen_engine, &neatogen_features},
00151 #endif
00152     {LAYOUT_TWOPI, "twopi", 0, &twopigen_engine, &neatogen_features},
00153     {LAYOUT_CIRCO, "circo", 0, &circogen_engine, &neatogen_features},
00154     {LAYOUT_PATCHWORK, "patchwork", 0, &patchwork_engine, &neatogen_features},
00155     {LAYOUT_CLUSTER, "osage", 0, &osage_engine, &neatogen_features},
00156     {LAYOUT_NOP1, "nop", 0, &nop1gen_engine, &neatogen_features},
00157     {LAYOUT_NOP1, "nop1", 0, &nop1gen_engine, &neatogen_features},
00158     {LAYOUT_NOP1, "nop2", 0, &nop2gen_engine, &neatogen_features},
00159     {0, NULL, 0, NULL, NULL}
00160 };