diff --git a/cmake/FindGraphViz.cmake b/cmake/FindGraphViz.cmake index 21f349c..a2852df 100644 --- a/cmake/FindGraphViz.cmake +++ b/cmake/FindGraphViz.cmake @@ -29,7 +29,7 @@ if ( NOT WIN32 ) find_package(PkgConfig) - pkg_check_modules( graphviz ${REQUIRED} libgvc libcdt libcgraph libpathplan ) + pkg_check_modules( graphviz ${REQUIRED} libgvc libcdt libgraph libpathplan ) if ( graphviz_FOUND ) set ( graphviz_INCLUDE_DIRECTORIES ${graphviz_INCLUDE_DIRS} ) endif ( graphviz_FOUND ) @@ -66,7 +66,7 @@ find_library( graphviz_CDT_LIBRARY ) find_library( graphviz_GRAPH_LIBRARY - NAMES cgraph + NAMES graph PATHS ${graphviz_LIBRARY_DIRS} /usr/local/lib64 @@ -162,4 +162,4 @@ include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set GRAPHVIZ_FOUND to TRUE if # all listed variables are TRUE -find_package_handle_standard_args(GraphViz DEFAULT_MSG graphviz_LIBRARIES graphviz_INCLUDE_DIRECTORIES) +find_package_handle_standard_args(GraphViz DEFAULT_MSG graphviz_LIBRARIES graphviz_INCLUDE_DIRECTORIES) \ No newline at end of file diff --git a/src/part/CMakeLists.txt b/src/part/CMakeLists.txt index 041536d..0e9f6d8 100644 --- a/src/part/CMakeLists.txt +++ b/src/part/CMakeLists.txt @@ -29,7 +29,7 @@ set( kgraphviewerpart_PART_SRCS kgraphviewer_part.cpp ) kde4_add_plugin(kgraphviewerpart ${kgraphviewerpart_PART_SRCS}) add_definitions(-DQT_STL) -target_link_libraries(kgraphviewerpart ${KDE4_KPARTS_LIBS} gvc cgraph pathplan cdt kgraphviewerlib) +target_link_libraries(kgraphviewerpart ${KDE4_KPARTS_LIBS} gvc graph pathplan cdt kgraphviewerlib) install( TARGETS kgraphviewerpart DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/src/part/dotgraph.cpp b/src/part/dotgraph.cpp index 57c59b5..95caf92 100644 --- a/src/part/dotgraph.cpp +++ b/src/part/dotgraph.cpp @@ -410,25 +410,27 @@ void DotGraph::updateWithGraph(graph_t* newGraph) setRenderOperations(ops); - Agsym_t *attr = agnxtattr(newGraph, AGRAPH, NULL); + Agsym_t *attr = agfstattr(newGraph); while(attr) { - kDebug() << agnameof(newGraph) << ":" << attr->name << agxget(newGraph,attr); - m_attributes[attr->name] = agxget(newGraph,attr); - attr = agnxtattr(newGraph, AGRAPH, attr); + kDebug() << newGraph->name << ":" << attr->name << agxget(newGraph,attr->index); + m_attributes[attr->name] = agxget(newGraph,attr->index); + attr = agnxtattr(newGraph,attr); } // copy subgraphs - for (graph_t* sg = agfstsubg(newGraph); sg; sg = agnxtsubg(sg)) + for (edge_t* e = agfstout(newGraph->meta_node->graph, newGraph->meta_node); e; + e = agnxtout(newGraph->meta_node->graph, e)) { - kDebug() << "subgraph:" << agnameof(sg); - if (subgraphs().contains(agnameof(sg))) + graph_t* sg = agusergraph(e->head); + kDebug() << "subgraph:" << sg->name; + if (subgraphs().contains(sg->name)) { kDebug() << "known"; // ??? // nodes()[ngn->name]->setZ(ngn->z()); - subgraphs()[agnameof(sg)]->updateWithSubgraph(sg); - if (subgraphs()[agnameof(sg)]->canvasElement()!=0) + subgraphs()[sg->name]->updateWithSubgraph(sg); + if (subgraphs()[sg->name]->canvasElement()!=0) { // nodes()[ngn->id()]->canvasElement()->setGh(m_height); } @@ -438,7 +440,7 @@ void DotGraph::updateWithGraph(graph_t* newGraph) kDebug() << "new"; GraphSubgraph* newsg = new GraphSubgraph(sg); // kDebug() << "new created"; - subgraphs().insert(agnameof(sg), newsg); + subgraphs().insert(sg->name, newsg); // kDebug() << "new inserted"; } @@ -451,14 +453,14 @@ void DotGraph::updateWithGraph(graph_t* newGraph) while (ngn != NULL) // foreach (GraphNode* ngn, newGraph.nodes()) { - kDebug() << "node " << agnameof(ngn); - if (nodes().contains(agnameof(ngn))) + kDebug() << "node " << ngn->name; + if (nodes().contains(ngn->name)) { kDebug() << "known"; // ??? // nodes()[ngn->name]->setZ(ngn->z()); - nodes()[agnameof(ngn)]->updateWithNode(ngn); - if (nodes()[agnameof(ngn)]->canvasElement()!=0) + nodes()[ngn->name]->updateWithNode(ngn); + if (nodes()[ngn->name]->canvasElement()!=0) { // nodes()[ngn->id()]->canvasElement()->setGh(m_height); } @@ -468,7 +470,7 @@ void DotGraph::updateWithGraph(graph_t* newGraph) kDebug() << "new"; GraphNode* newgn = new GraphNode(ngn); // kDebug() << "new created"; - nodes().insert(agnameof(ngn), newgn); + nodes().insert(ngn->name, newgn); // kDebug() << "new inserted"; } @@ -476,11 +478,11 @@ void DotGraph::updateWithGraph(graph_t* newGraph) edge_t* nge = agfstout(newGraph, ngn); while (nge != NULL) { -// kDebug() << "edge " << nge->id; - QString edgeName = QString(agnameof(aghead(nge))) + agnameof(agtail(nge)); + kDebug() << "edge " << nge->id; + QString edgeName = QString(nge->head->name) + nge->tail->name; if (edges().contains(edgeName)) { -// kDebug() << "edge known" << nge->id; + kDebug() << "edge known" << nge->id; // edges()[nge->name]->setZ(nge->z()); edges()[edgeName]->updateWithEdge(nge); if (edges()[edgeName]->canvasEdge()!=0) @@ -495,20 +497,20 @@ void DotGraph::updateWithGraph(graph_t* newGraph) GraphEdge* newEdge = new GraphEdge(); newEdge->setId(edgeName); newEdge->updateWithEdge(nge); - if (elementNamed(agnameof(agtail(nge))) == 0) + if (elementNamed(nge->tail->name) == 0) { GraphNode* newgn = new GraphNode(); // kDebug() << "new created"; - nodes().insert(agnameof(agtail(nge)), newgn); + nodes().insert(nge->tail->name, newgn); } - newEdge->setFromNode(elementNamed(agnameof(agtail(nge)))); - if (elementNamed(agnameof(aghead(nge))) == 0) + newEdge->setFromNode(elementNamed(nge->tail->name)); + if (elementNamed(nge->head->name) == 0) { GraphNode* newgn = new GraphNode(); // kDebug() << "new created"; - nodes().insert(agnameof(aghead(nge)), newgn); + nodes().insert(nge->head->name, newgn); } - newEdge->setToNode(elementNamed(agnameof(aghead(nge)))); + newEdge->setToNode(elementNamed(nge->head->name)); edges().insert(edgeName, newEdge); } } diff --git a/src/part/graphedge.cpp b/src/part/graphedge.cpp index 58a9c12..a17a33c 100644 --- a/src/part/graphedge.cpp +++ b/src/part/graphedge.cpp @@ -141,12 +141,12 @@ void GraphEdge::updateWithEdge(edge_t* edge) kDebug() << "element renderOperations size is now " << ops.size(); } setRenderOperations(ops); - Agsym_t *attr = agnxtattr(agraphof(agtail(edge)), AGEDGE, NULL); + Agsym_t *attr = agfstattr(edge); while(attr) { - kDebug() /*<< edge->name*/ << ":" << attr->name << agxget(edge,attr); - m_attributes[attr->name] = agxget(edge,attr); - attr = agnxtattr(agraphof(agtail(edge)), AGEDGE, attr); + kDebug() /*<< edge->name*/ << ":" << attr->name << agxget(edge,attr->index); + m_attributes[attr->name] = agxget(edge,attr->index); + attr = agnxtattr(edge,attr); } } diff --git a/src/part/graphexporter.cpp b/src/part/graphexporter.cpp index 042cfe0..e6b5a69 100644 --- a/src/part/graphexporter.cpp +++ b/src/part/graphexporter.cpp @@ -118,11 +118,11 @@ QString GraphExporter::writeDot(const DotGraph* graph, const QString& fileName) graph_t* GraphExporter::exportToGraphviz(const DotGraph* graph) { - Agdesc_t type = Agstrictundirected; - type.directed = graph->directed(); - type.strict = graph->strict(); + int type = graph->directed() + ?(graph->strict()?AGDIGRAPHSTRICT:AGDIGRAPH) + :(graph->strict()?AGRAPHSTRICT:AGRAPH); - graph_t* agraph = agopen((graph->id()!="\"\"")?graph->id().toUtf8().data():QString("unnamed").toUtf8().data(), type, NULL); + graph_t* agraph = agopen((graph->id()!="\"\"")?graph->id().toUtf8().data():QString("unnamed").toUtf8().data(), type); QTextStream stream; graph->exportToGraphviz(agraph); @@ -134,7 +134,7 @@ graph_t* GraphExporter::exportToGraphviz(const DotGraph* graph) sit != graph->subgraphs().end(); ++sit ) { const GraphSubgraph& s = **sit; - graph_t* subgraph = agsubg(agraph, s.id().toUtf8().data(), 1); + graph_t* subgraph = agsubg(agraph, s.id().toUtf8().data()); s.exportToGraphviz(subgraph); } @@ -142,7 +142,7 @@ graph_t* GraphExporter::exportToGraphviz(const DotGraph* graph) GraphNodeMap::const_iterator nit; foreach (GraphNode* n, graph->nodes()) { - node_t* node = agnode(agraph, n->id().toUtf8().data(), 1); + node_t* node = agnode(agraph, n->id().toUtf8().data()); n->exportToGraphviz(node); } @@ -151,8 +151,8 @@ graph_t* GraphExporter::exportToGraphviz(const DotGraph* graph) foreach (GraphEdge* e, graph->edges()) { kDebug() << "writing edge" << e->id(); - edge_t* edge = agedge(agraph, agnode(agraph, e->fromNode()->id().toUtf8().data(), 0), - agnode(agraph, e->toNode()->id().toUtf8().data(), 0), NULL, 1); + edge_t* edge = agedge(agraph, agnode(agraph, e->fromNode()->id().toUtf8().data()), + agnode(agraph, e->toNode()->id().toUtf8().data())); e->exportToGraphviz(edge); } diff --git a/src/part/graphnode.cpp b/src/part/graphnode.cpp index 250dc81..cc283aa 100644 --- a/src/part/graphnode.cpp +++ b/src/part/graphnode.cpp @@ -78,8 +78,8 @@ void GraphNode::updateWithNode(const GraphNode& node) void GraphNode::updateWithNode(node_t* node) { - kDebug() << agnameof(node); - m_attributes["id"] = agnameof(node); + kDebug() << node->name; + m_attributes["id"] = node->name; m_attributes["label"] = ND_label(node)->text; DotRenderOpVec ops; @@ -99,12 +99,12 @@ void GraphNode::updateWithNode(node_t* node) setRenderOperations(ops); - Agsym_t *attr = agnxtattr(agraphof(node), AGNODE, NULL); + Agsym_t *attr = agfstattr(node); while(attr) { - kDebug() << agnameof(node) << ":" << attr->name << agxget(node,attr); - m_attributes[attr->name] = agxget(node,attr); - attr = agnxtattr(agraphof(node), AGNODE, attr); + kDebug() << node->name << ":" << attr->name << agxget(node,attr->index); + m_attributes[attr->name] = agxget(node,attr->index); + attr = agnxtattr(node,attr); } } diff --git a/src/part/graphsubgraph.cpp b/src/part/graphsubgraph.cpp index eb11084..82e63cd 100644 --- a/src/part/graphsubgraph.cpp +++ b/src/part/graphsubgraph.cpp @@ -102,8 +102,8 @@ void GraphSubgraph::updateWithSubgraph(const GraphSubgraph& subgraph) void GraphSubgraph::updateWithSubgraph(graph_t* subgraph) { - kDebug() << agnameof(subgraph); - m_attributes["id"] = agnameof(subgraph); + kDebug() << subgraph->name; + m_attributes["id"] = subgraph->name; if (GD_label(subgraph)) m_attributes["label"] = GD_label(subgraph)->text; @@ -124,25 +124,27 @@ void GraphSubgraph::updateWithSubgraph(graph_t* subgraph) setRenderOperations(ops); - Agsym_t *attr = agnxtattr(subgraph, AGRAPH, NULL); + Agsym_t *attr = agfstattr(subgraph); while(attr) { - kDebug() << agnameof(subgraph) << ":" << attr->name << agxget(subgraph,attr); - m_attributes[attr->name] = agxget(subgraph,attr); - attr = agnxtattr(subgraph, AGRAPH, attr); + kDebug() << subgraph->name << ":" << attr->name << agxget(subgraph,attr->index); + m_attributes[attr->name] = agxget(subgraph,attr->index); + attr = agnxtattr(subgraph,attr); } - for (graph_t* sg = agfstsubg(subgraph); sg; sg = agnxtsubg(sg)) + for (edge_t* e = agfstout(subgraph->meta_node->graph, subgraph->meta_node); e; + e = agnxtout(subgraph->meta_node->graph, e)) { - kDebug() << "subsubgraph:" << agnameof(sg); - if ( subgraphs().contains(agnameof(sg))) + graph_t* sg = agusergraph(e->head); + kDebug() << "subsubgraph:" << sg->name; + if ( subgraphs().contains(sg->name)) { kDebug() << "known subsubgraph"; // ??? // nodes()[ngn->name]->setZ(ngn->z()); - subgraphs()[agnameof(sg)]->updateWithSubgraph(sg); - if (subgraphs()[agnameof(sg)]->canvasElement()!=0) + subgraphs()[sg->name]->updateWithSubgraph(sg); + if (subgraphs()[sg->name]->canvasElement()!=0) { // nodes()[ngn->id()]->canvasElement()->setGh(m_height); } @@ -152,7 +154,7 @@ void GraphSubgraph::updateWithSubgraph(graph_t* subgraph) kDebug() << "new subsubgraph"; GraphSubgraph* newsg = new GraphSubgraph(sg); // kDebug() << "new created"; - subgraphs().insert(agnameof(sg), newsg); + subgraphs().insert(sg->name, newsg); // kDebug() << "new inserted"; } diff --git a/src/part/loadagraphthread.cpp b/src/part/loadagraphthread.cpp index 27a10ee..6475aa8 100644 --- a/src/part/loadagraphthread.cpp +++ b/src/part/loadagraphthread.cpp @@ -30,12 +30,12 @@ void LoadAGraphThread::run() kError() << "Failed to open file " << m_dotFileName; return; } - m_g = agread(fp, NULL); + m_g = agread(fp); if (!m_g) { kError() << "Failed to read file, retrying to work around graphviz bug(?)"; rewind(fp); - m_g = agread(fp, NULL); + m_g = agread(fp); } if (m_g==0) {