• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/CVUT/diplomka/Automata_editor/gvwrapper/graphvizwrapper.h

Go to the documentation of this file.
00001 #ifndef GRAPHVIZWRAPPER_H_64684351348614
00002 #define GRAPHVIZWRAPPER_H_64684351348614
00003 
00004 #include "interfaces/igraphviz.h"
00005 
00006 #include <QObject>
00007 
00008 // GraphViz headers
00009 #include "graphviz/gvc.h"
00010 
00011 class GVEdge : public IGVEdge
00012 {
00013 public:
00014     GVEdge(Agraph_t *graph, Agedge_t *edge);
00015     ~GVEdge();
00016 
00017     QString getHeadName() const;
00018     QString getTailName() const;
00019 
00020     QString getLabel() const;
00021     QPoint  getLabelPos() const;
00022 
00023     QSharedPointer<IGVEdge> getNextOutEdge() const;
00024 
00025     TCPList getControlPoints() const;
00026 
00027 private:
00028     Agraph_t    *m_graph;
00029     Agedge_t    *m_edge;
00030 };
00031 
00032 
00033 
00034 class GVNode : public IGVNode
00035 {
00036 public:
00037     GVNode(Agraph_t *graph, Agnode_t *node);
00038     ~GVNode();
00039 
00040     QString getName() const;
00041     QPoint  getPos() const;
00042 
00043     QSharedPointer<IGVNode> getPrevNode() const;
00044     QSharedPointer<IGVNode> getNextNode() const;
00045 
00046     QSharedPointer<IGVEdge> getFirstOutEdge() const;
00047 
00048 private:
00049     Agraph_t    *m_graph;
00050     Agnode_t    *m_node;
00051 };
00052 
00053 
00054 
00055 class GVGraph : public IGVGraph
00056 {
00057 public:
00058     GVGraph();
00059     ~GVGraph();
00060 
00061     bool        addNode(const QString &name);
00062     int         getNodeCount() const;
00063     QSharedPointer<IGVNode> getNode(const QString &name) const;
00064     QSharedPointer<IGVNode> getFirstNode() const;
00065     QSharedPointer<IGVNode> getLastNode() const;
00066 
00067     bool        addEdge(const QString &s1, const QString &s2, const QString &l);
00068     int         getEdgeCount() const;
00069 
00070     void        layoutGraphUsingDot();
00071     void        renderToFile(const QString &fileName);
00072 
00073 private:
00074     Agraph_t    *m_graph;
00075     GVC_t       *m_gvc;
00076     bool        m_layout;
00077 };
00078 
00079 
00080 
00081 class GraphVizWrapper : public QObject, public IGraphViz
00082 {
00083     Q_OBJECT
00084     Q_INTERFACES(IGraphViz)
00085 public:
00086     GraphVizWrapper();
00087 
00088     virtual ~GraphVizWrapper();
00089 
00090     QString     getVersion() const { return "2.0"; }
00091     QString     getGraphVizVersion() const;
00092 
00093     QSharedPointer<IGVGraph>    createGraph() const;
00094 };
00095 
00096 #endif //GRAPHVIZWRAPPER_H_64684351348614

Generated on Tue Jan 4 2011 03:03:21 for Autoamata editor by  doxygen 1.7.0