summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/autolayout
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /umbrello/umbrello/autolayout
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'umbrello/umbrello/autolayout')
-rw-r--r--umbrello/umbrello/autolayout/Makefile.am20
-rw-r--r--umbrello/umbrello/autolayout/_graph.h34
-rw-r--r--umbrello/umbrello/autolayout/autolayout.h45
-rw-r--r--umbrello/umbrello/autolayout/autolayoutdlg.cpp184
-rw-r--r--umbrello/umbrello/autolayout/autolayoutdlg.h63
-rw-r--r--umbrello/umbrello/autolayout/autolayouter.cpp29
-rw-r--r--umbrello/umbrello/autolayout/autolayouter.h64
-rw-r--r--umbrello/umbrello/autolayout/autolayouteradapter.cpp191
-rw-r--r--umbrello/umbrello/autolayout/autolayouteradapter.h87
-rw-r--r--umbrello/umbrello/autolayout/baseinclude.h29
-rw-r--r--umbrello/umbrello/autolayout/canvas.h34
-rw-r--r--umbrello/umbrello/autolayout/diagram.h50
-rw-r--r--umbrello/umbrello/autolayout/diagram_interface.h31
-rw-r--r--umbrello/umbrello/autolayout/dotautolayouter.cpp43
-rw-r--r--umbrello/umbrello/autolayout/dotautolayouter.h38
-rw-r--r--umbrello/umbrello/autolayout/graphvizautolayouter.cpp54
-rw-r--r--umbrello/umbrello/autolayout/graphvizautolayouter.h50
-rw-r--r--umbrello/umbrello/autolayout/graphvizgraph.cpp150
-rw-r--r--umbrello/umbrello/autolayout/graphvizgraph.h58
-rw-r--r--umbrello/umbrello/autolayout/graphviznode.cpp46
-rw-r--r--umbrello/umbrello/autolayout/graphviznode.h42
-rw-r--r--umbrello/umbrello/autolayout/newautolayoutdialog.ui554
-rw-r--r--umbrello/umbrello/autolayout/node.h37
-rw-r--r--umbrello/umbrello/autolayout/simplecanvas.cpp20
-rw-r--r--umbrello/umbrello/autolayout/simplecanvas.h39
25 files changed, 1992 insertions, 0 deletions
diff --git a/umbrello/umbrello/autolayout/Makefile.am b/umbrello/umbrello/autolayout/Makefile.am
new file mode 100644
index 00000000..8c2a6cb3
--- /dev/null
+++ b/umbrello/umbrello/autolayout/Makefile.am
@@ -0,0 +1,20 @@
+noinst_LTLIBRARIES = libautolayout.la
+
+INCLUDES = -Idialogs -Irefactoring \
+ $(all_includes)
+#AM_CXXFLAGS = -I/usr/include/graphviz/
+
+libautolayout_la_METASOURCES = AUTO
+#noinst_HEADERS = node.h autolayout.h autolayoutdlg.h autolayouter.h canvas.h \
+# autolayouteradapter.h graphvizautolayouter.h simplecanvas.h graphvizgraph.h graphviznode.h \
+# dotautolayouter.h dotautolayouter.h baseinclude.h
+#noinst_LIBRARIES = libautolayout.la
+libautolayout_la_SOURCES = newautolayoutdialog.ui autolayoutdlg.cpp \
+ autolayouter.cpp autolayouteradapter.cpp graphvizautolayouter.cpp simplecanvas.cpp \
+ graphvizgraph.cpp graphviznode.cpp dotautolayouter.cpp neatoautolayouter.cpp \
+ circoautolayouter.cpp
+
+#libautolayout_la_LIBADD = /usr/lib/graphviz/libdotneato.la
+#libautolayout_la_LDFLAGS = -ldotneato -L/usr/lib/graphviz
+
+
diff --git a/umbrello/umbrello/autolayout/_graph.h b/umbrello/umbrello/autolayout/_graph.h
new file mode 100644
index 00000000..179a9471
--- /dev/null
+++ b/umbrello/umbrello/autolayout/_graph.h
@@ -0,0 +1,34 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTGRAPH_H
+#define AUTOLAYOUTGRAPH_H
+#include "baseinclude.h"
+namespace Autolayout {
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class Graph{
+public:
+ virtual ~Graph() {}
+ virtual void addNode(const char *name, int width,int heigt)=0;
+ virtual void addEdge(const char* nodea,const char*nodeb,int weight=100)=0;
+ virtual Node* getNode(const char*)=0;
+ virtual bool empty()=0;
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/autolayout.h b/umbrello/umbrello/autolayout/autolayout.h
new file mode 100644
index 00000000..9f34a1d8
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayout.h
@@ -0,0 +1,45 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUT_H
+#define AUTOLAYOUT_H
+
+
+#include "canvas.h"
+#include "simplecanvas.h"
+
+#include "node.h"
+
+#include "_graph.h"
+//#include "diagram.h"
+
+
+
+#include "graphviznode.h"
+#include "graphvizgraph.h"
+
+
+
+#include "autolayouter.h"
+#include "autolayouteradapter.h"
+#include "graphvizautolayouter.h"
+#include "dotautolayouter.h"
+#include "circoautolayouter.h"
+#include "neatoautolayouter.h"
+
+
+
+
+
+#endif
diff --git a/umbrello/umbrello/autolayout/autolayoutdlg.cpp b/umbrello/umbrello/autolayout/autolayoutdlg.cpp
new file mode 100644
index 00000000..2f6b1a4c
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayoutdlg.cpp
@@ -0,0 +1,184 @@
+/***************************************************************************
+ * copyright (C) 2005 *
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "autolayoutdlg.h"
+#include "../associationwidget.h"
+#include "../umlwidget.h"
+#include "autolayout.h"
+#include "newautolayoutdialog.h"
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <qslider.h>
+#include <kdebug.h>
+
+
+AutolayoutDlg::AutolayoutDlg(KConfig* c,UMLView* v,QWidget *parent, const char *name)
+ :MyDialog1(parent, name)
+{
+ view=v;
+ readConfig(c);
+ config=c;
+}
+
+void AutolayoutDlg::slotSetAssociationWeight(int i)
+{
+ associationWeight=i;
+}
+
+
+void AutolayoutDlg::slotSetDependenciesWeight(int i)
+{
+ dependenciesWeight=i;
+}
+
+
+void AutolayoutDlg::slotSetGeneralizationWeight(int i)
+{
+ generalizationWeight=i;
+}
+void AutolayoutDlg::slotSetGenralizationAsEdges(bool b)
+{
+ genralizationAsEdges=b;
+}
+
+
+void AutolayoutDlg::slotSetDependenciesAsEdges(bool b)
+{
+ dependenciesAsEdges=b;
+}
+
+
+void AutolayoutDlg::slotSetAssociationAsEdges(bool b)
+{
+ associationAsEdges=b;
+}
+
+
+
+void AutolayoutDlg::slotSetCompressShapes(bool b)
+{
+ compressShapes=b;
+}
+
+
+void AutolayoutDlg::slotSetCenterDiagram(bool b)
+{
+ centerDiagram=b;
+}
+
+
+void AutolayoutDlg::slotSetClusterizeHierarchies(bool b)
+
+{
+ clusterizeHierarchies=b;
+}
+
+
+void AutolayoutDlg::slotSetShapeSeparation(int i)
+{
+ shapeSeparation=i;
+}
+
+void AutolayoutDlg::slotReloadSettings()
+{
+ readConfig(config);
+}
+
+
+void AutolayoutDlg::slotSaveSettings()
+{
+ writeConfig(config);
+}
+
+
+void AutolayoutDlg::slotDoAutolayout()
+{
+
+ Autolayout::Autolayouter* a=getAutolayouter();;
+
+ a->setAssociationAsEdges( associationAsEdges);
+ a->setAssociationWeight( associationWeight );
+ a->setCenterDiagram( centerDiagram);
+ a->setDependenciesAsEdges( dependenciesAsEdges);
+ a->setClusterizeHierarchies( clusterizeHierarchies);
+ a->setCompressShapes( compressShapes);
+ a->setDependenciesWeight( dependenciesWeight);
+ a->setGeneralizationAsEdges( genralizationAsEdges);
+ a->setGeneralizationWeight( generalizationWeight);
+ a->setNoteConnectionWeight( 1);
+ a->setNoteConnectionsAsEdges(true);
+ a->setShapeSeparation( shapeSeparation);
+ a->autolayout( view);
+ delete a;
+ a=0;
+ accept();
+}
+
+void AutolayoutDlg::readConfig( KConfig * conf)
+{
+ conf->setGroup("AutolayoutDlg");
+ associationEdgesCB->setChecked((bool)(conf->readBoolEntry( "associationAsEdges",false)));
+ centerDiagramCB->setChecked((bool)(conf->readBoolEntry( "centerDiagram",true)));
+ dependenciesEdgesCB->setChecked((bool)(conf->readBoolEntry( "dependenciesAsEdges",false)));
+ clusterizeHierarchiesCB->setChecked((bool)(conf->readBoolEntry( "clusterizeHierarchies",false)));
+ compressShapesCB->setChecked((bool)(conf->readBoolEntry( "compressShapes",true)));
+ dependenciedEdgesSL->setValue((int)(conf->readNumEntry( "dependenciesWeight",0)));
+ generalizationCB->setChecked((bool)(conf->readBoolEntry( "genralizationAsEdges",true)));
+ generalizationEdgessSL->setValue((int)(conf->readNumEntry( "generalizationWeight",1)));
+ associationEdgesSL->setValue((int)(conf->readNumEntry( "associationWeight",0)));
+ shapeSeparationSB->setValue((int)(conf->readNumEntry( "shapeSeparation",0)));
+ algorithmCOB->setCurrentItem((int)(conf->readNumEntry( "algorithm",0)));
+}
+
+void AutolayoutDlg::writeConfig( KConfig * conf)
+{
+ // conf=kapp->config();
+ conf->setGroup("AutolayoutDlg");
+ conf->writeEntry( "associationAsEdges",associationEdgesCB->isChecked());
+ conf->writeEntry( "centerDiagram", centerDiagramCB->isChecked());
+ conf->writeEntry("dependenciesAsEdges",dependenciesEdgesCB->isChecked());
+ conf->writeEntry("clusterizeHierarchies",clusterizeHierarchiesCB->isChecked());
+ conf->writeEntry("dependenciesWeight", dependenciedEdgesSL->value());
+ conf->writeEntry("genralizationAsEdges",generalizationCB->isChecked());
+
+ conf->writeEntry("generalizationWeight",generalizationEdgessSL->value());
+ conf->writeEntry("associationWeight",associationEdgesSL->value());
+ conf->writeEntry("shapeSeparation",shapeSeparationSB->value());
+ //conf->writeEntry("al
+
+
+ //algorithmCOB->setCurrentItem(conf->readNumEntry( "algorithm",0));
+
+}
+
+void AutolayoutDlg::slotSelectAlgorithm( const QString& _algname)
+{
+ algname=_algname;
+
+}
+
+Autolayout::Autolayouter * AutolayoutDlg::getAutolayouter( )
+{
+ const QString text = algorithmCOB->currentText();
+ kDebug() << "Autolayout Algorithm " << algname << " found " << text << endl;
+ if (text == "dot")
+ return new Autolayout::DotAutolayouter();
+ if (text == "circo")
+ return new Autolayout::CircoAutolayouter();
+ if (text == "neato")
+ return new Autolayout::NeatoAutolayouter();
+ kError() << "Autolayout Algorithm not found" << endl;
+ return new Autolayout::DotAutolayouter();
+}
+
+
+
+#include "autolayoutdlg.moc"
diff --git a/umbrello/umbrello/autolayout/autolayoutdlg.h b/umbrello/umbrello/autolayout/autolayoutdlg.h
new file mode 100644
index 00000000..2e40d736
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayoutdlg.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * copyright (C) 2005 *
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTDLG_H
+#define AUTOLAYOUTDLG_H
+
+#include "newautolayoutdialog.h"
+#include "../umlview.h"
+#include <qobject.h>
+#include <kconfig.h>
+#include "autolayout.h"
+
+class AutolayoutDlg : public MyDialog1
+{
+ Q_OBJECT
+ public:
+ AutolayoutDlg(KConfig* c,UMLView* v, QWidget *parent = 0, const char *name = 0);
+ public slots:
+ virtual void slotSetAssociationWeight(int i);
+ virtual void slotSetDependenciesWeight(int i);
+ virtual void slotSetGeneralizationWeight(int i);
+ virtual void slotSetGenralizationAsEdges(bool b);
+ virtual void slotSetDependenciesAsEdges(bool b);
+ virtual void slotSetAssociationAsEdges(bool b);
+ virtual void slotSetCompressShapes(bool b);
+ virtual void slotSetCenterDiagram(bool b);
+ virtual void slotSetClusterizeHierarchies(bool b);
+ virtual void slotSetShapeSeparation(int i);
+ virtual void slotReloadSettings();
+ virtual void slotSaveSettings();
+ virtual void slotDoAutolayout();
+ void readConfig(KConfig*);
+ void writeConfig(KConfig*);
+ virtual void slotSelectAlgorithm(const QString&);
+
+
+ private:
+ UMLView *view;
+ int associationWeight;
+ int dependenciesWeight;
+ int generalizationWeight;
+ bool genralizationAsEdges;
+ bool dependenciesAsEdges;
+ bool associationAsEdges;
+ bool compressShapes;
+ bool centerDiagram;
+ bool clusterizeHierarchies;
+ int shapeSeparation;
+ KConfig* config;
+ QString algname;
+ Autolayout::Autolayouter* getAutolayouter();
+
+};
+
+#endif
diff --git a/umbrello/umbrello/autolayout/autolayouter.cpp b/umbrello/umbrello/autolayout/autolayouter.cpp
new file mode 100644
index 00000000..f70fd195
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayouter.cpp
@@ -0,0 +1,29 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "autolayouter.h"
+
+namespace Autolayout {
+
+
+
+void Autolayouter::autolayout( UMLView * v )
+{
+ setCanvas(v);
+ setGraph(v);
+ run();
+ updateView(v);
+}
+
+} // end namespace Autolayout
+
diff --git a/umbrello/umbrello/autolayout/autolayouter.h b/umbrello/umbrello/autolayout/autolayouter.h
new file mode 100644
index 00000000..a56b1ce3
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayouter.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTAUTOLAYOUTER_H
+#define AUTOLAYOUTAUTOLAYOUTER_H
+#include "baseinclude.h"
+
+namespace Autolayout {
+
+/**
+This is the super class of any class which encapsulate an autolayout algorithm
+
+
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class Autolayouter {
+public:
+ virtual ~Autolayouter() {}
+
+ virtual void setNoteConnectionWeight(int i)=0;
+ virtual void setNoteConnectionsAsEdges(bool b)=0;
+ virtual void setAssociationWeight(int i)=0;
+
+ virtual void setDependenciesWeight(int i)=0;
+
+ virtual void setGeneralizationWeight(int i)=0;
+
+ virtual void setGeneralizationAsEdges(bool b)=0;
+
+ virtual void setDependenciesAsEdges(bool b)=0;
+
+ virtual void setAssociationAsEdges(bool b)=0;
+
+ virtual void setCompressShapes(bool b)=0;
+
+ virtual void setCenterDiagram(bool b)=0;
+
+ virtual void setClusterizeHierarchies(bool b)=0;
+
+ virtual void setShapeSeparation(int i)=0;
+
+ virtual void autolayout(UMLView* v);
+protected:
+ virtual void run()=0;
+ virtual void updateView(UMLView*)=0;
+ virtual Autolayout::Canvas* getCanvas()=0;
+ virtual Autolayout::Graph* getGraph()=0;
+ virtual Autolayout::Graph* setGraph(UMLView* view)=0;
+ virtual Autolayout::Canvas* setCanvas(UMLView* view)=0;
+
+
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/autolayouteradapter.cpp b/umbrello/umbrello/autolayout/autolayouteradapter.cpp
new file mode 100644
index 00000000..0673fde1
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayouteradapter.cpp
@@ -0,0 +1,191 @@
+/***************************************************************************
+ * copyright (C) 2005 *
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "autolayouteradapter.h"
+
+
+namespace Autolayout
+ {
+
+ AutolayouterAdapter::AutolayouterAdapter()
+ : Autolayout::Autolayouter()
+ {}
+
+
+ AutolayouterAdapter::~AutolayouterAdapter()
+ {}}
+
+void Autolayout::AutolayouterAdapter::addRelationship( AssociationWidget * a )
+ {
+ int weight;
+ switch (a->getAssocType())
+ {
+ case Uml::at_Generalization:;
+ case Uml::at_Realization:
+ {
+ if (genralizationAsEdges)weight=generalizationWeight;
+ else return;
+ break;
+ }
+ case Uml::at_Dependency:
+ {
+ if (dependenciesAsEdges) weight=dependenciesWeight;
+ else return;
+ break;
+ }
+ case Uml::at_Anchor:
+ {
+ if (anchorsAsEdges) weight=anchorsWeight;
+ else return;
+ break;
+ }
+ case Uml::at_Aggregation:;
+ case Uml::at_Association:;
+ case Uml::at_Containment:;
+ case Uml::at_Composition:;
+ default: return;
+ /*case Uml::at_Association_Self:;
+ case Uml::at_Activity:;
+ case Uml::at_Relationship:;
+ case Uml::at_Coll_Message:;
+ case Uml::at_Seq_Message:;
+ case Uml::at_Coll_Message_Self:;
+ case Uml::at_Seq_Message_Self:;
+ case Uml::at_Containment:;
+ case Uml::at_Composition:;
+ case Uml::at_Realization:;
+ case Uml::at_UniAssociation:;
+
+ case Uml::at_State:;
+ case Uml::at_Unknown:;
+ */
+ };
+ getGraph()->addEdge(a->getWidgetID(Uml::A).c_str(),a->getWidgetID(Uml::B).c_str(),weight);
+ }
+
+void Autolayout::AutolayouterAdapter::setAssociationWeight( int i )
+ {
+ associationWeight=i;
+ }
+
+void Autolayout::AutolayouterAdapter::setDependenciesWeight( int i )
+ {
+ dependenciesWeight=i;
+ }
+
+void Autolayout::AutolayouterAdapter::setGeneralizationWeight( int i )
+ {
+ generalizationWeight=i;
+ }
+
+void Autolayout::AutolayouterAdapter::setGeneralizationAsEdges( bool b )
+ {
+ genralizationAsEdges=b;
+ }
+
+void Autolayout::AutolayouterAdapter::setDependenciesAsEdges( bool b )
+ {
+ dependenciesAsEdges=b;
+ }
+
+void Autolayout::AutolayouterAdapter::setAssociationAsEdges( bool b )
+ {
+ associationAsEdges=b;
+ }
+
+void Autolayout::AutolayouterAdapter::setCompressShapes( bool b )
+ {
+ compressShapes=b;
+ }
+
+void Autolayout::AutolayouterAdapter::setCenterDiagram( bool b )
+ {
+ centerDiagram=b;
+ }
+
+void Autolayout::AutolayouterAdapter::setClusterizeHierarchies( bool b )
+ {
+ clusterizeHierarchies=b;
+ }
+
+void Autolayout::AutolayouterAdapter::setShapeSeparation( int i )
+ {
+ shapeSeparation=i;
+ }
+
+Autolayout::Graph * Autolayout::AutolayouterAdapter::setGraph( UMLView * view )
+ {
+ if (! view) return 0;
+ Autolayout::Graph * g=getGraph();
+ if (g&&g->empty())
+ {
+ UMLWidgetList list = view->getWidgetList();
+ UMLWidget* widget;
+ for ( widget = list.first(); widget; widget= list.next() )
+ {
+ if (widget->getBaseType() == Uml::wt_Class)
+ {
+
+
+ g->addNode(widget->getID().c_str(),widget->getWidth(),
+ widget->getHeight());
+ }
+ }
+ AssociationWidgetList as_list=view->getAssociationList();
+ AssociationWidget* assoc;
+ AssociationWidgetListIt it(as_list);
+ while ( (assoc = it.current()) != 0 )
+ {
+ ++it;
+ addRelationship(assoc);
+ }
+ }
+ return g;
+ }
+
+void Autolayout::AutolayouterAdapter::updateView( UMLView* view )
+ {
+if (! view) return ;
+UMLWidgetList list = view->getWidgetList();
+ UMLWidget* widget;
+ Graph *g=getGraph();
+ if (! view||!g) return ;
+ for ( widget = list.first(); widget; widget= list.next() )
+ if (widget->getBaseType() == Uml::wt_Class)
+ {
+ Node* n =g->getNode(widget->getID().c_str());
+ //printf("old values widgets %s x,y:%d,%d\n",widget->getID().c_str(),widget->getX(),widget->getY());
+ //int x_old=widget->getX();
+ //int x_calc=n.getX();
+ //int x_calc2=30 +n.getX()-widget->getWidth()/2;
+ widget->setX(getCanvas()->getBaseX() +n->getX()-widget->getWidth()/2);
+ //int x=widget->getX();
+ widget->setY(getCanvas()->getMaxY()/2-(n->getY()+(widget->getHeight()/2)));
+
+ widget->updateWidget();
+
+ }
+ }
+
+Autolayout::Canvas * Autolayout::AutolayouterAdapter::setCanvas( UMLView* view )
+ {
+ return canvas=new Autolayout::SimpleCanvas(view->getCanvasWidth(),view->getCanvasHeight());
+ }
+
+void Autolayout::AutolayouterAdapter::setNoteConnectionWeight( int i )
+{
+noteConnectionWeight=i;
+}
+
+void Autolayout::AutolayouterAdapter::setNoteConnectionsAsEdges( bool b )
+{
+noteConnectionAsEdges=b;
+}
diff --git a/umbrello/umbrello/autolayout/autolayouteradapter.h b/umbrello/umbrello/autolayout/autolayouteradapter.h
new file mode 100644
index 00000000..7c52e742
--- /dev/null
+++ b/umbrello/umbrello/autolayout/autolayouteradapter.h
@@ -0,0 +1,87 @@
+/***************************************************************************
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTAUTOLAYOUTERADAPTER_H
+#define AUTOLAYOUTAUTOLAYOUTERADAPTER_H
+//#include "autolayout.h"
+#include "baseinclude.h"
+#include "autolayouter.h"
+#include "../umlnamespace.h"
+
+
+namespace Autolayout
+{
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class AutolayouterAdapter : virtual public Autolayout::Autolayouter
+{
+public:
+ AutolayouterAdapter();
+
+ virtual ~AutolayouterAdapter();
+ virtual void setAssociationWeight(int i);
+
+ virtual void setDependenciesWeight(int i);
+
+ virtual void setGeneralizationWeight(int i);
+
+ virtual void setGeneralizationAsEdges(bool b);
+
+ virtual void setDependenciesAsEdges(bool b);
+
+ virtual void setAssociationAsEdges(bool b);
+
+ virtual void setCompressShapes(bool b);
+
+ virtual void setCenterDiagram(bool b);
+
+ virtual void setClusterizeHierarchies(bool b);
+
+ virtual void setShapeSeparation(int i);
+ virtual void setNoteConnectionsAsEdges(bool b);
+ virtual void setNoteConnectionWeight(int i);
+
+
+protected:
+ virtual void run()=0;
+ virtual void updateView(UMLView* view);
+ virtual Canvas* getCanvas(){return canvas;};
+ virtual Graph* getGraph()=0;
+ virtual Graph* setGraph(UMLView* view);
+ virtual void addRelationship(AssociationWidget* a);
+ virtual Canvas* setCanvas(UMLView* view);
+
+ int associationWeight;
+ int dependenciesWeight;
+ int generalizationWeight;
+ bool genralizationAsEdges;
+ bool dependenciesAsEdges;
+ bool associationAsEdges;
+ bool compressShapes;
+ bool centerDiagram;
+ bool clusterizeHierarchies;
+ int shapeSeparation;
+ int noteConnectionWeight;
+ bool noteConnectionAsEdges;
+ bool anchorsAsEdges;
+ int anchorsWeight;
+ Canvas* canvas;
+private:
+ //Graph* graph;
+
+
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/baseinclude.h b/umbrello/umbrello/autolayout/baseinclude.h
new file mode 100644
index 00000000..590c1a5c
--- /dev/null
+++ b/umbrello/umbrello/autolayout/baseinclude.h
@@ -0,0 +1,29 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTBASEINCLUDE_H
+
+#include "../umlview.h"
+#include "../associationwidget.h"
+#include "../umlwidget.h"
+
+#include "canvas.h"
+#include "simplecanvas.h"
+
+#include "node.h"
+
+#include "_graph.h"
+
+
+#endif
diff --git a/umbrello/umbrello/autolayout/canvas.h b/umbrello/umbrello/autolayout/canvas.h
new file mode 100644
index 00000000..246df8a7
--- /dev/null
+++ b/umbrello/umbrello/autolayout/canvas.h
@@ -0,0 +1,34 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTCANVAS_H
+#define AUTOLAYOUTCANVAS_H
+
+namespace Autolayout {
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class Canvas{
+public:
+ virtual int getMaxX()=0;
+ virtual int getMaxY()=0;
+ virtual int getBaseX()=0;
+ virtual int getBaseY()=0;
+ virtual ~Canvas() {}
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/diagram.h b/umbrello/umbrello/autolayout/diagram.h
new file mode 100644
index 00000000..33bda398
--- /dev/null
+++ b/umbrello/umbrello/autolayout/diagram.h
@@ -0,0 +1,50 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTABLEDIAGRAM_H
+#define AUTOLAYOUTABLEDIAGRAM_H
+#include <dotneato.h>
+#define internal_renderizer
+#include "autolayout.h"
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+Umbrello UML Modeller Authors
+*/
+namespace Autolayout{
+class Diagram//: public virtual Graph, public virtual Canvas{
+{
+private:
+ Agraph_t* g;
+ Agsym_t* a_width;
+ Agsym_t* a_height;
+ Agsym_t* a_label;
+#ifndef internal_renderizer
+ GVC_t* gvc;
+#endif
+public:
+ Diagram(int,int);
+
+ ~Diagram();
+
+ void addNode(const char *name, int width,int heigt);
+ void addEdge(const char* nodea,const char*nodeb);
+ void autolayout();
+ void save();
+ Node getNode(const char*);
+
+};
+
+
+}
+#endif
diff --git a/umbrello/umbrello/autolayout/diagram_interface.h b/umbrello/umbrello/autolayout/diagram_interface.h
new file mode 100644
index 00000000..caee5752
--- /dev/null
+++ b/umbrello/umbrello/autolayout/diagram_interface.h
@@ -0,0 +1,31 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __DIAGRAM_INTERFACE_H
+#define __DIAGRAM_INTERFACE_H
+
+class DiagramInterface
+{
+public:
+ DiagramInterface() {}
+ virtual ~DiagramInterface() {}
+
+
+private:
+ DiagramInterface( const DiagramInterface& source );
+ void operator = ( const DiagramInterface& source );
+};
+
+
+#endif // __DIAGRAM_INTERFACE_H
diff --git a/umbrello/umbrello/autolayout/dotautolayouter.cpp b/umbrello/umbrello/autolayout/dotautolayouter.cpp
new file mode 100644
index 00000000..5d197845
--- /dev/null
+++ b/umbrello/umbrello/autolayout/dotautolayouter.cpp
@@ -0,0 +1,43 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "dotautolayouter.h"
+
+#include <graphviz/dotprocs.h>
+
+namespace Autolayout {
+
+DotAutolayouter::DotAutolayouter()
+ : Autolayout::GraphvizAutolayouter()
+{
+}
+
+
+DotAutolayouter::~DotAutolayouter()
+{
+ dot_cleanup(gg->_agraph);
+}
+
+
+void DotAutolayouter::run()
+{
+ //#ifndef internal_renderizer
+ /* bind graph to GV context - currently must be done before layout */
+ // gvBindContext(gvc,g);
+ //#endif
+ // do layout
+ //dot_layout();
+ dot_layout( gg->_agraph );
+}
+
+}
diff --git a/umbrello/umbrello/autolayout/dotautolayouter.h b/umbrello/umbrello/autolayout/dotautolayouter.h
new file mode 100644
index 00000000..5c6530ba
--- /dev/null
+++ b/umbrello/umbrello/autolayout/dotautolayouter.h
@@ -0,0 +1,38 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTDOTAUTOLAYOUTER_H
+#define AUTOLAYOUTDOTAUTOLAYOUTER_H
+#include "baseinclude.h"
+#include "graphvizautolayouter.h"
+
+namespace Autolayout {
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class DotAutolayouter : virtual public Autolayout::GraphvizAutolayouter
+{
+public:
+ DotAutolayouter();
+
+ virtual ~DotAutolayouter();
+
+ virtual void run();
+
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/graphvizautolayouter.cpp b/umbrello/umbrello/autolayout/graphvizautolayouter.cpp
new file mode 100644
index 00000000..8defc5ef
--- /dev/null
+++ b/umbrello/umbrello/autolayout/graphvizautolayouter.cpp
@@ -0,0 +1,54 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "graphvizautolayouter.h"
+
+#include <graphviz/graph.h>
+
+namespace Autolayout {
+
+GraphvizAutolayouter::GraphvizAutolayouter()
+ : Autolayout::AutolayouterAdapter()
+{
+ gg = new GraphvizGraph();
+}
+
+GraphvizAutolayouter::~GraphvizAutolayouter()
+{
+ agclose(gg->_agraph);
+ delete gg;
+}
+
+void GraphvizAutolayouter::setCompressShapes( bool b )
+{
+ gg->setCompressShapes(b);
+}
+
+void GraphvizAutolayouter::setCenterDiagram( bool b )
+{
+ gg->setCenterDiagram(b);
+}
+
+void GraphvizAutolayouter::setShapeSeparation( int i )
+{
+ gg->setShapeSeparation(i);
+}
+
+Autolayout::Canvas * GraphvizAutolayouter::setCanvas( UMLView * view )
+{
+ Canvas* canvas= AutolayouterAdapter::setCanvas(view);
+ gg->setCanvas(canvas);
+}
+
+} // end namespace AutoLayout
+
diff --git a/umbrello/umbrello/autolayout/graphvizautolayouter.h b/umbrello/umbrello/autolayout/graphvizautolayouter.h
new file mode 100644
index 00000000..114ae63f
--- /dev/null
+++ b/umbrello/umbrello/autolayout/graphvizautolayouter.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTGRAPHVIZAUTOLAYOUTER_H
+#define AUTOLAYOUTGRAPHVIZAUTOLAYOUTER_H
+#include "baseinclude.h"
+#include "autolayouteradapter.h"
+#include "graphvizgraph.h"
+
+namespace Autolayout
+{
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class GraphvizAutolayouter : virtual public Autolayout::AutolayouterAdapter
+{
+public:
+ GraphvizAutolayouter();
+
+
+ virtual void setCompressShapes(bool b);
+
+ virtual void setCenterDiagram(bool b);
+
+ virtual void setShapeSeparation(int i);
+
+ virtual Canvas* setCanvas(UMLView* view);
+
+ virtual ~GraphvizAutolayouter();
+
+protected:
+ virtual Graph* getGraph(){if (!gg) gg=new GraphvizGraph(); return gg;}
+
+ virtual void run()=0;
+ GraphvizGraph* gg;
+
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/graphvizgraph.cpp b/umbrello/umbrello/autolayout/graphvizgraph.cpp
new file mode 100644
index 00000000..716f9223
--- /dev/null
+++ b/umbrello/umbrello/autolayout/graphvizgraph.cpp
@@ -0,0 +1,150 @@
+/***************************************************************************
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "graphvizgraph.h"
+
+#include <graphviz/graph.h>
+#include <kdebug.h>
+
+#define DPI 96
+
+char* _strcpy(const char* name)
+{
+ char *a;
+ strlen(name);
+ a=new char[strlen(name)+1];
+ a=strcpy(a,name);
+ return a;
+}
+namespace Autolayout
+{
+
+/**
+ *
+ * @return
+ */
+GraphvizGraph::GraphvizGraph()
+ : Autolayout::Graph()
+{
+ aginit();
+ empty_flag=true;
+ _agraph = agopen("graph",AGDIGRAPH);
+ a_width= agnodeattr(_agraph, "width", "");;
+ a_height= agnodeattr(_agraph, "height", "");
+ a_label = agnodeattr(_agraph, "label", "");
+ a_weight= agedgeattr(_agraph,"weight","");
+ agnodeattr(_agraph, "fixedsize", "true");
+ agnodeattr(_agraph, "margin", "0.01,0.01");
+ agnodeattr(_agraph, "shape", "box");
+ agraphattr(_agraph, "dpi", "DPI/0");
+
+
+}
+
+
+GraphvizGraph::~GraphvizGraph()
+{
+ nodelist.clear();
+ agclose(_agraph);
+ /* Free graph structures */
+ //#ifndef internal_renderizer
+
+ /* Clean up output file and errors */
+ // dotneato_terminate(gvc);
+ //dotneato_eof(gvc);
+
+}
+
+
+
+
+void GraphvizGraph::addEdge(const char* nodea, const char* nodeb, int weight)
+{
+ char *a=_strcpy(nodea);
+ char *b=_strcpy(nodeb);
+ char *weight_str;
+ asprintf(&weight_str,"%d",weight);
+ Agedge_t* e= agedge(_agraph,agnode(_agraph,a),agnode(_agraph,b));
+ delete[](a);
+ delete[](b);
+ agxset(e,a_weight->index,weight_str);
+
+
+}
+
+void GraphvizGraph::addNode(const char* name, int width, int height)
+{
+ char *a =_strcpy(name);
+ char *w_str,*h_str;
+ Agnode_t* node =agnode(_agraph,a);
+ delete[](a);
+ agxset(node, a_label->index, "a");
+ asprintf(&h_str,"%f",((float)height)/DPI);
+ asprintf(&w_str,"%f",((float)width)/DPI);
+ agxset(node, a_height->index,h_str);// sprintf("%d",height));
+ free (h_str);
+ agxset(node, a_width->index, w_str);
+ free (w_str);
+ empty_flag = false;
+}
+
+
+void Autolayout::GraphvizGraph::setCompressShapes( bool b )
+{
+ if (empty())
+ {
+ if (b) agraphattr(_agraph,"ratio","compress");
+ else agraphattr(_agraph,"ratio","");
+ }
+}
+
+void Autolayout::GraphvizGraph::setCenterDiagram( bool b )
+{
+ if (empty())
+ {
+ if (b) agraphattr(_agraph,"center","true");
+ else agraphattr(_agraph,"center","false");
+ }
+}
+
+void Autolayout::GraphvizGraph::setShapeSeparation( int i )
+{
+ char* a;
+ asprintf(&a,"%f",((float) i)/10.0);
+ agraphattr(_agraph,"nodesep",a);
+ free (a);
+}
+
+bool Autolayout::GraphvizGraph::empty( )
+{
+ return empty_flag;
+}
+
+Autolayout::Node* Autolayout::GraphvizGraph::getNode( const char * arg1 )
+{
+ char *a = _strcpy(arg1);
+ Autolayout::GraphvizNode* b=
+ new Autolayout::GraphvizNode(agnode(_agraph,a));
+ delete[](a);
+ nodelist.push_back(b);
+ return b;
+}
+
+void GraphvizGraph::setCanvas( Autolayout::Canvas * canvas)
+{
+ char buf[100];
+ sprintf(buf,"%f,%f",((float)canvas->getMaxX()/DPI),((float)canvas->getMaxY()/DPI));
+ kDebug() << "size: " << buf << endl;
+ agraphattr(_agraph, "size", buf);
+ agraphattr(_agraph, "page", buf);
+}
+
+} // end namespace Autolayout
+
diff --git a/umbrello/umbrello/autolayout/graphvizgraph.h b/umbrello/umbrello/autolayout/graphvizgraph.h
new file mode 100644
index 00000000..dfbf323d
--- /dev/null
+++ b/umbrello/umbrello/autolayout/graphvizgraph.h
@@ -0,0 +1,58 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTGRAPHVIZGRAPH_H
+#define AUTOLAYOUTGRAPHVIZGRAPH_H
+
+#include "baseinclude.h"
+#include "_graph.h"
+#include "graphviznode.h"
+#include <deque>
+#include <graphviz/types.h>
+
+namespace Autolayout
+{
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class GraphvizGraph : virtual public Autolayout::Graph
+{
+public:
+ GraphvizGraph();
+
+ virtual ~GraphvizGraph();
+
+ virtual Node* getNode(const char* arg1);
+ virtual bool empty();
+ virtual void addEdge(const char* nodea, const char* nodeb, int weight=10);
+ virtual void addNode(const char* name, int width, int heigt);
+ void setCompressShapes(bool b);
+ void setCenterDiagram(bool b);
+ void setShapeSeparation(int i);
+ void setCanvas(Canvas* );
+ Agraph_t* _agraph;
+ Agsym_t* a_width;
+ Agsym_t* a_height;
+ Agsym_t* a_label;
+ Agsym_t* a_weight;
+ std::deque<Node*> nodelist;
+ GVC_t* gvc;
+ bool empty_flag;
+ friend class GraphvizAutolayouter;
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/graphviznode.cpp b/umbrello/umbrello/autolayout/graphviznode.cpp
new file mode 100644
index 00000000..ea3510cf
--- /dev/null
+++ b/umbrello/umbrello/autolayout/graphviznode.cpp
@@ -0,0 +1,46 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "graphviznode.h"
+
+#include <stdio.h>
+#include <graphviz/types.h>
+#include <graphviz/graph.h>
+
+namespace Autolayout {
+
+
+
+GraphvizNode::~GraphvizNode()
+{
+}
+
+
+int GraphvizNode::getX()
+{
+ point p = ND_coord_i(n);
+ return p.x;
+}
+
+int GraphvizNode::getY()
+{
+ point p = ND_coord_i(n);
+ return p.y;
+}
+
+}
+
+Autolayout::GraphvizNode::GraphvizNode( Agnode_t * node )
+{
+ n=node;
+}
diff --git a/umbrello/umbrello/autolayout/graphviznode.h b/umbrello/umbrello/autolayout/graphviznode.h
new file mode 100644
index 00000000..0efcb6d8
--- /dev/null
+++ b/umbrello/umbrello/autolayout/graphviznode.h
@@ -0,0 +1,42 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef AUTOLAYOUTGRAPHVIZNODE_H
+#define AUTOLAYOUTGRAPHVIZNODE_H
+
+#include "node.h"
+
+class Agnode_t;
+
+namespace Autolayout {
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class GraphvizNode : virtual public Autolayout::Node
+{
+
+ GraphvizNode (Agnode_t* n);
+ Agnode_t* n;
+ virtual ~GraphvizNode();
+public:
+
+
+ int getX();
+ int getY();
+ friend class GraphvizGraph;
+};
+
+}
+
+#endif
diff --git a/umbrello/umbrello/autolayout/newautolayoutdialog.ui b/umbrello/umbrello/autolayout/newautolayoutdialog.ui
new file mode 100644
index 00000000..e6407a5c
--- /dev/null
+++ b/umbrello/umbrello/autolayout/newautolayoutdialog.ui
@@ -0,0 +1,554 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>662</width>
+ <height>281</height>
+ </rect>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame12</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>La&amp;yout Algorithm</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboBox1</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>dot</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>neato</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>circo</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>algorithmCOB</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Shape separation</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>shapeSeparationSB</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>shapeSeparationSB</cstring>
+ </property>
+ <property name="prefix">
+ <string></string>
+ </property>
+ <property name="maxValue">
+ <number>200</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame3</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>clusterizeHierarchiesCB</cstring>
+ </property>
+ <property name="text">
+ <string>Clusteri&amp;ze Hierarchies</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>centerDiagramCB</cstring>
+ </property>
+ <property name="text">
+ <string>Ce&amp;nter Diagram</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>compressShapesCB</cstring>
+ </property>
+ <property name="text">
+ <string>Co&amp;mpress Shapes</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame5_2_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter7_4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>generalizationCB</cstring>
+ </property>
+ <property name="text">
+ <string>Generalization as Ed&amp;ges</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>generalizationEdgessSL</cstring>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Weight</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the weight that the autolayout algoritm must use to compare association with other relationships like Generalization and Dependence</string>
+ </property>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame5_2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>associationEdgesCB</cstring>
+ </property>
+ <property name="text">
+ <string>Association as Ed&amp;ges</string>
+ </property>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>associationEdgesSL</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Weight</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the weight that the autolayout algoritm must use to compare association with other relationships like Generalization and Dependence</string>
+ </property>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frame5</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>dependenciesEdgesCB</cstring>
+ </property>
+ <property name="text">
+ <string>Dependencies &amp;as Edges</string>
+ </property>
+ </widget>
+ <widget class="QSlider">
+ <property name="name">
+ <cstring>dependenciedEdgesSL</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Weight</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the weight that the autolayout algoritm must use to compare association with other relationships like Generalization and Dependence</string>
+ </property>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>1</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>He&amp;lp</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>277</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>restoreDefaultsBTN</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Restore Default</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>saveDefaultsBTN</cstring>
+ </property>
+ <property name="text">
+ <string>Save As Defa&amp;ult</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>generalizationCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>generalizationEdgessSL</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>associationEdgesCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>associationEdgesSL</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>dependenciesEdgesCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>dependenciedEdgesSL</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>shapeSeparationSB</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetShapeSeparation(int)</slot>
+ </connection>
+ <connection>
+ <sender>clusterizeHierarchiesCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetClusterizeHierarchies(bool)</slot>
+ </connection>
+ <connection>
+ <sender>centerDiagramCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetCenterDiagram(bool)</slot>
+ </connection>
+ <connection>
+ <sender>compressShapesCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetCompressShapes(bool)</slot>
+ </connection>
+ <connection>
+ <sender>generalizationCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetGenralizationAsEdges(bool)</slot>
+ </connection>
+ <connection>
+ <sender>generalizationEdgessSL</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetGeneralizationWeight(int)</slot>
+ </connection>
+ <connection>
+ <sender>associationEdgesCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetAssociationAsEdges(bool)</slot>
+ </connection>
+ <connection>
+ <sender>associationEdgesSL</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetAssociationWeight(int)</slot>
+ </connection>
+ <connection>
+ <sender>dependenciesEdgesCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetDependenciesAsEdges(bool)</slot>
+ </connection>
+ <connection>
+ <sender>dependenciedEdgesSL</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSetDependenciesWeight(int)</slot>
+ </connection>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotDoAutolayout()</slot>
+ </connection>
+ <connection>
+ <sender>restoreDefaultsBTN</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotReloadSettings()</slot>
+ </connection>
+ <connection>
+ <sender>saveDefaultsBTN</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSaveSettings()</slot>
+ </connection>
+ <connection>
+ <sender>algorithmCOB</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>slotSelectAlgorithm(const QString&amp;)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotDoAutolayout()</slot>
+ <slot>slotSaveSettings()</slot>
+ <slot>slotReloadSettings()</slot>
+ <slot>slotSetClusterizeHierarchies(bool b)</slot>
+ <slot>slotSetAssociationWeight(int i)</slot>
+ <slot>slotSetDependenciesWeight(int i)</slot>
+ <slot>slotSetGeneralizationWeight(int i)</slot>
+ <slot>slotSetGenralizationAsEdges(bool b)</slot>
+ <slot>slotSetDependenciesAsEdges(bool b)</slot>
+ <slot>slotSetAssociationAsEdges(bool b)</slot>
+ <slot>slotSetCompressShapes(bool b)</slot>
+ <slot>slotSetCenterDiagram(bool b)</slot>
+ <slot>slotSetShapeSeparation(int i)</slot>
+ <slot specifier="pure virtual">slotSelectAlgorithm(const QString&amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/umbrello/umbrello/autolayout/node.h b/umbrello/umbrello/autolayout/node.h
new file mode 100644
index 00000000..c2532b8b
--- /dev/null
+++ b/umbrello/umbrello/autolayout/node.h
@@ -0,0 +1,37 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTNODE_H
+#define AUTOLAYOUTNODE_H
+
+namespace Autolayout {
+
+/**
+@author Umbrello UML Modeller Authors
+*/
+class Node{
+
+ //Node(Agnode_t* n);
+
+
+ //
+public:
+ virtual ~Node() {}
+ virtual int getX()=0;
+ virtual int getY()=0;
+
+
+};
+}
+#endif
diff --git a/umbrello/umbrello/autolayout/simplecanvas.cpp b/umbrello/umbrello/autolayout/simplecanvas.cpp
new file mode 100644
index 00000000..0598c15e
--- /dev/null
+++ b/umbrello/umbrello/autolayout/simplecanvas.cpp
@@ -0,0 +1,20 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "simplecanvas.h"
+
+namespace Autolayout {
+
+
+
+}
diff --git a/umbrello/umbrello/autolayout/simplecanvas.h b/umbrello/umbrello/autolayout/simplecanvas.h
new file mode 100644
index 00000000..41865f8a
--- /dev/null
+++ b/umbrello/umbrello/autolayout/simplecanvas.h
@@ -0,0 +1,39 @@
+/*
+ * copyright (C) 2005
+ * Umbrello UML Modeller Authors <uml-devel @uml.sf.net>
+ */
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef AUTOLAYOUTSIMPLECANVAS_H
+#define AUTOLAYOUTSIMPLECANVAS_H
+
+#include "canvas.h"
+#include <qrect.h>
+namespace Autolayout {
+
+/**
+@author Dimitri Ognibene <ognibened @yahoo.it>
+*/
+class SimpleCanvas: public Canvas
+{
+public:
+ SimpleCanvas(int i, int j):max_x(i),max_y(j){}
+ virtual ~SimpleCanvas() {}
+ virtual int getMaxX(){return max_x;}
+ virtual int getMaxY(){return max_y;}
+ virtual int getBaseX(){return 0;}
+ virtual int getBaseY(){return 0;}
+ int max_x,max_y;
+};
+
+}
+
+#endif