Showing
6 changed files
with
230 additions
and
56 deletions
| ... | @@ -17,7 +17,8 @@ NodeItem::NodeItem(int x, int y) | ... | @@ -17,7 +17,8 @@ NodeItem::NodeItem(int x, int y) |
| 17 | { | 17 | { |
| 18 | this->x = x; | 18 | this->x = x; |
| 19 | this->y = y; | 19 | this->y = y; |
| 20 | - this->color = QColor(0, 0, 0); //R, G, B | 20 | + //this->color = QColor(Qt::green); //R, G, B |
| 21 | + this->color = QColor(Qt::green); | ||
| 21 | setZValue((x+y)%2); | 22 | setZValue((x+y)%2); |
| 22 | 23 | ||
| 23 | setFlags(ItemIsSelectable | ItemIsMovable); | 24 | setFlags(ItemIsSelectable | ItemIsMovable); |
| ... | @@ -26,13 +27,14 @@ NodeItem::NodeItem(int x, int y) | ... | @@ -26,13 +27,14 @@ NodeItem::NodeItem(int x, int y) |
| 26 | 27 | ||
| 27 | QRectF NodeItem::boundingRect() const | 28 | QRectF NodeItem::boundingRect() const |
| 28 | { | 29 | { |
| 29 | - return QRectF(0, 0, 110, 70); | 30 | + return QRectF(0, 0, NODE_SIZE, NODE_SIZE); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | QPainterPath NodeItem::shape() const | 33 | QPainterPath NodeItem::shape() const |
| 33 | { | 34 | { |
| 34 | QPainterPath path; | 35 | QPainterPath path; |
| 35 | - path.addRect(14, 14, 82, 42); | 36 | + //path.addRect(14, 14, 82, 42); |
| 37 | + path.addRect(0, 0, NODE_SIZE, NODE_SIZE); | ||
| 36 | return path; | 38 | return path; |
| 37 | } | 39 | } |
| 38 | 40 | ||
| ... | @@ -40,43 +42,51 @@ void NodeItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option | ... | @@ -40,43 +42,51 @@ void NodeItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option |
| 40 | { | 42 | { |
| 41 | Q_UNUSED(widget); | 43 | Q_UNUSED(widget); |
| 42 | 44 | ||
| 45 | + //QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; | ||
| 46 | + //if (option->state & QStyle::State_MouseOver) | ||
| 47 | + // fillColor = fillColor.light(125); | ||
| 48 | + | ||
| 49 | + //const qreal& lod = option->levelOfDetailFromTransform(painter->worldTransform()); | ||
| 50 | + //if (lod < 0.2) { | ||
| 51 | + // if (lod < 0.125) { | ||
| 52 | + // painter->fillRect(QRectF(0, 0, 110, 70), fillColor); | ||
| 53 | + // return; | ||
| 54 | + // } | ||
| 55 | + | ||
| 56 | + // QBrush b = painter->brush(); | ||
| 57 | + // painter->setBrush(fillColor); | ||
| 58 | + // painter->drawRect(13, 13, 97, 57); | ||
| 59 | + // painter->setBrush(b); | ||
| 60 | + // return; | ||
| 61 | + //} | ||
| 62 | + | ||
| 63 | + //QPen oldPen = painter->pen(); | ||
| 64 | + //QPen pen = oldPen; | ||
| 65 | + //int width = 0; | ||
| 66 | + //if (option->state & QStyle::State_Selected) | ||
| 67 | + // width += 2; | ||
| 68 | + | ||
| 69 | + //pen.setWidth(width); | ||
| 70 | + //QBrush b = painter->brush(); | ||
| 71 | + //painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100))); | ||
| 72 | + | ||
| 73 | + //painter->drawRect(QRect(14, 14, 79, 39)); | ||
| 74 | + //painter->setBrush(b); | ||
| 75 | + | ||
| 76 | + //if (lod >= 1) { | ||
| 77 | + // painter->setPen(QPen(Qt::gray, 1)); | ||
| 78 | + // painter->drawLine(15, 54, 94, 54); | ||
| 79 | + // painter->drawLine(94, 53, 94, 15); | ||
| 80 | + // painter->setPen(QPen(Qt::black, 0)); | ||
| 81 | + //} | ||
| 82 | + | ||
| 43 | QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; | 83 | QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; |
| 44 | - if (option->state & QStyle::State_MouseOver) | 84 | + if (option->state & QStyle::State_MouseOver) fillColor = fillColor.light(125); |
| 45 | - fillColor = fillColor.light(125); | 85 | + painter->setPen(QPen(Qt::black)); |
| 46 | - | 86 | + painter->setBrush(QBrush(fillColor)); |
| 47 | - const qreal& lod = option->levelOfDetailFromTransform(painter->worldTransform()); | 87 | + painter->drawRect(0, 0, NODE_SIZE, NODE_SIZE); |
| 48 | - if (lod < 0.2) { | 88 | + //painter->fillRect(QRectF(0, 0, NODE_SIZE, NODE_SIZE), fillColor); |
| 49 | - if (lod < 0.125) { | 89 | + //painter->drawRect(0, 0, NODE_SIZE, NODE_SIZE); |
| 50 | - painter->fillRect(QRectF(0, 0, 110, 70), fillColor); | ||
| 51 | - return; | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - QBrush b = painter->brush(); | ||
| 55 | - painter->setBrush(fillColor); | ||
| 56 | - painter->drawRect(13, 13, 97, 57); | ||
| 57 | - painter->setBrush(b); | ||
| 58 | - return; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - QPen oldPen = painter->pen(); | ||
| 62 | - QPen pen = oldPen; | ||
| 63 | - int width = 0; | ||
| 64 | - if (option->state & QStyle::State_Selected) | ||
| 65 | - width += 2; | ||
| 66 | - | ||
| 67 | - pen.setWidth(width); | ||
| 68 | - QBrush b = painter->brush(); | ||
| 69 | - painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100))); | ||
| 70 | - | ||
| 71 | - painter->drawRect(QRect(14, 14, 79, 39)); | ||
| 72 | - painter->setBrush(b); | ||
| 73 | - | ||
| 74 | - if (lod >= 1) { | ||
| 75 | - painter->setPen(QPen(Qt::gray, 1)); | ||
| 76 | - painter->drawLine(15, 54, 94, 54); | ||
| 77 | - painter->drawLine(94, 53, 94, 15); | ||
| 78 | - painter->setPen(QPen(Qt::black, 0)); | ||
| 79 | - } | ||
| 80 | 90 | ||
| 81 | // Draw text | 91 | // Draw text |
| 82 | //if (lod >= 2) { | 92 | //if (lod >= 2) { | ... | ... |
| ... | @@ -60,9 +60,13 @@ | ... | @@ -60,9 +60,13 @@ |
| 60 | </PropertyGroup> | 60 | </PropertyGroup> |
| 61 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 61 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
| 62 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> | 62 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> |
| 63 | + <IncludePath>C:\boost\boost_1_63_0;$(IncludePath)</IncludePath> | ||
| 64 | + <LibraryPath>C:\boost\boost_1_63_0\stage\lib;$(LibraryPath)</LibraryPath> | ||
| 63 | </PropertyGroup> | 65 | </PropertyGroup> |
| 64 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 66 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
| 65 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> | 67 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> |
| 68 | + <IncludePath>C:\boost\boost_1_63_0;$(IncludePath)</IncludePath> | ||
| 69 | + <LibraryPath>C:\boost\boost_1_63_0\stage\lib;$(LibraryPath)</LibraryPath> | ||
| 66 | </PropertyGroup> | 70 | </PropertyGroup> |
| 67 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 71 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
| 68 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> | 72 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> |
| ... | @@ -84,7 +88,7 @@ | ... | @@ -84,7 +88,7 @@ |
| 84 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | 88 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> |
| 85 | </ClCompile> | 89 | </ClCompile> |
| 86 | <Link> | 90 | <Link> |
| 87 | - <SubSystem>Windows</SubSystem> | 91 | + <SubSystem>Console</SubSystem> |
| 88 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> | 92 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> |
| 89 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 93 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
| 90 | <GenerateDebugInformation>true</GenerateDebugInformation> | 94 | <GenerateDebugInformation>true</GenerateDebugInformation> |
| ... | @@ -101,7 +105,7 @@ | ... | @@ -101,7 +105,7 @@ |
| 101 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | 105 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> |
| 102 | </ClCompile> | 106 | </ClCompile> |
| 103 | <Link> | 107 | <Link> |
| 104 | - <SubSystem>Windows</SubSystem> | 108 | + <SubSystem>Console</SubSystem> |
| 105 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> | 109 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> |
| 106 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 110 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
| 107 | <GenerateDebugInformation>true</GenerateDebugInformation> | 111 | <GenerateDebugInformation>true</GenerateDebugInformation> |
| ... | @@ -117,7 +121,7 @@ | ... | @@ -117,7 +121,7 @@ |
| 117 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | 121 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> |
| 118 | </ClCompile> | 122 | </ClCompile> |
| 119 | <Link> | 123 | <Link> |
| 120 | - <SubSystem>Windows</SubSystem> | 124 | + <SubSystem>Console</SubSystem> |
| 121 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> | 125 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> |
| 122 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 126 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
| 123 | <GenerateDebugInformation>false</GenerateDebugInformation> | 127 | <GenerateDebugInformation>false</GenerateDebugInformation> |
| ... | @@ -133,7 +137,7 @@ | ... | @@ -133,7 +137,7 @@ |
| 133 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | 137 | <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> |
| 134 | </ClCompile> | 138 | </ClCompile> |
| 135 | <Link> | 139 | <Link> |
| 136 | - <SubSystem>Windows</SubSystem> | 140 | + <SubSystem>Console</SubSystem> |
| 137 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> | 141 | <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> |
| 138 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 142 | <AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
| 139 | <GenerateDebugInformation>false</GenerateDebugInformation> | 143 | <GenerateDebugInformation>false</GenerateDebugInformation> | ... | ... |
| ... | @@ -14,22 +14,27 @@ PaperGraphWidget::PaperGraphWidget(QWidget *parent) | ... | @@ -14,22 +14,27 @@ PaperGraphWidget::PaperGraphWidget(QWidget *parent) |
| 14 | layout->addWidget(view); | 14 | layout->addWidget(view); |
| 15 | setLayout(layout); | 15 | setLayout(layout); |
| 16 | 16 | ||
| 17 | - setWindowTitle(tr("Paper Graph Visualization")); | 17 | + setWindowTitle(tr("dblp paper graph visualization")); |
| 18 | +} | ||
| 19 | + | ||
| 20 | +void PaperGraphWidget::print_graph(const Graph & graph) | ||
| 21 | +{ | ||
| 22 | + //print graph | ||
| 18 | } | 23 | } |
| 19 | 24 | ||
| 20 | void PaperGraphWidget::initscene() | 25 | void PaperGraphWidget::initscene() |
| 21 | { | 26 | { |
| 22 | scene = new QGraphicsScene(this); | 27 | scene = new QGraphicsScene(this); |
| 23 | 28 | ||
| 24 | - int x = 0, y; | 29 | + //int x = 0, y; |
| 25 | - for (int i=-11000; i<11000; i+=110) { | 30 | + //for (int i=-11000; i<11000; i+=110) { |
| 26 | - ++x; | 31 | + // ++x; |
| 27 | - y = 0; | 32 | + // y = 0; |
| 28 | - for (int j=-7000; j<7000; j+=70) { | 33 | + // for (int j=-7000; j<7000; j+=70) { |
| 29 | - ++y; | 34 | + // ++y; |
| 30 | - QGraphicsItem *item = new NodeItem(x, y); | 35 | + // QGraphicsItem *item = new NodeItem(x, y); |
| 31 | - item->setPos(QPointF(i, j)); | 36 | + // item->setPos(QPointF(i, j)); |
| 32 | - scene->addItem(item); | 37 | + // scene->addItem(item); |
| 33 | - } | 38 | + // } |
| 34 | - } | 39 | + //} |
| 35 | } | 40 | } | ... | ... |
| ... | @@ -3,9 +3,42 @@ | ... | @@ -3,9 +3,42 @@ |
| 3 | 3 | ||
| 4 | #include <QtWidgets/QWidget> | 4 | #include <QtWidgets/QWidget> |
| 5 | #include <QGraphicsScene> | 5 | #include <QGraphicsScene> |
| 6 | + | ||
| 7 | +#include <boost/graph/adjacency_list.hpp> | ||
| 8 | +#include <boost/graph/kamada_kawai_spring_layout.hpp> | ||
| 9 | +#include <boost/graph/random_layout.hpp> | ||
| 10 | + | ||
| 6 | #include "ui_PaperGraphWidget.h" | 11 | #include "ui_PaperGraphWidget.h" |
| 7 | 12 | ||
| 8 | -//class QGraphicsScene; | 13 | + |
| 14 | +using namespace boost; | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +enum vertex_position_t { vertex_position }; | ||
| 18 | +//enum vertex_type_t { vertex_type }; | ||
| 19 | +namespace boost { | ||
| 20 | + BOOST_INSTALL_PROPERTY(vertex, position); | ||
| 21 | + //BOOST_INSTALL_PROPERTY(vertex, type); | ||
| 22 | +} | ||
| 23 | +typedef square_topology<>::point_type point; | ||
| 24 | +struct simple_edge { | ||
| 25 | + int first, second; | ||
| 26 | +}; | ||
| 27 | +typedef boost::property<vertex_index_t, int, | ||
| 28 | + boost::property<vertex_name_t, std::string, | ||
| 29 | + boost::property<vertex_position_t, point>> | ||
| 30 | +> VertexProperties; | ||
| 31 | +typedef adjacency_list< | ||
| 32 | + listS, //outEdgeList | ||
| 33 | + listS, //VertexList | ||
| 34 | + undirectedS, | ||
| 35 | + //vertex properties | ||
| 36 | + //VertexProperties, | ||
| 37 | + VertexProperties, | ||
| 38 | + //edge properties | ||
| 39 | + boost::property<edge_weight_t, double> | ||
| 40 | +> Graph; | ||
| 41 | + | ||
| 9 | 42 | ||
| 10 | class PaperGraphWidget : public QWidget | 43 | class PaperGraphWidget : public QWidget |
| 11 | { | 44 | { |
| ... | @@ -13,6 +46,7 @@ class PaperGraphWidget : public QWidget | ... | @@ -13,6 +46,7 @@ class PaperGraphWidget : public QWidget |
| 13 | 46 | ||
| 14 | public: | 47 | public: |
| 15 | PaperGraphWidget(QWidget *parent = 0); | 48 | PaperGraphWidget(QWidget *parent = 0); |
| 49 | + void print_graph(const Graph& graph); | ||
| 16 | 50 | ||
| 17 | private: | 51 | private: |
| 18 | void initscene(); | 52 | void initscene(); | ... | ... |
| 1 | #include "PaperGraphWidget.h" | 1 | #include "PaperGraphWidget.h" |
| 2 | #include <QtWidgets/QApplication> | 2 | #include <QtWidgets/QApplication> |
| 3 | +#include <QDebug> | ||
| 4 | + | ||
| 5 | +#include <algorithm> | ||
| 6 | +#include <exception> | ||
| 7 | +#include <fstream> | ||
| 8 | +#include <iterator> | ||
| 9 | +#include <string> | ||
| 10 | +#include <map> | ||
| 11 | +#include <vector> | ||
| 12 | + | ||
| 13 | +#include <boost/algorithm/string.hpp> //boost::split | ||
| 14 | +//#include <boost/bind.hpp> | ||
| 15 | +#include <boost/bimap.hpp> | ||
| 16 | + | ||
| 17 | +using namespace std; | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +const string PAPER_FILENAME = "dblp-paper.txt"; | ||
| 21 | + | ||
| 22 | +Graph read_graph(ifstream& in) { | ||
| 23 | + /** | ||
| 24 | + * Parse Paper dataset | ||
| 25 | + * - paper_key, [author_list], publish_year | ||
| 26 | + * Column Delimiter: || | ||
| 27 | + * Author list Delimiter: && | ||
| 28 | + */ | ||
| 29 | + std::string line; | ||
| 30 | + vector<std::string> tokens; | ||
| 31 | + vector<std::string> authors; | ||
| 32 | + vector<pair<string, string>> edges; | ||
| 33 | + | ||
| 34 | + typedef boost::bimap<string, int> bm_type; | ||
| 35 | + bm_type node_ids; | ||
| 36 | + vector<simple_edge> edges_indexes; | ||
| 37 | + int node_cnt = 0; | ||
| 38 | + qDebug() << "* graph reading start" << endl; | ||
| 39 | + while (std::getline(in, line) && !line.empty()) { | ||
| 40 | + boost::split(tokens, line, boost::is_any_of("||"), boost::token_compress_on); | ||
| 41 | + boost::split(authors, tokens[1], boost::is_any_of("&&"), boost::token_compress_on); | ||
| 42 | + | ||
| 43 | + const string& paper_key = tokens[0]; | ||
| 44 | + if (node_ids.left.find(paper_key) == node_ids.left.end()) { | ||
| 45 | + //node_ids[paper_key] = node_cnt++; | ||
| 46 | + node_ids.insert(bm_type::value_type(paper_key, node_cnt++)); | ||
| 47 | + //qDebug() << paper_key.c_str() << " "; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + for (auto author : authors) { | ||
| 51 | + edges.push_back(pair<string, string>(paper_key, author)); | ||
| 52 | + if (node_ids.left.find(author) == node_ids.left.end()) { | ||
| 53 | + //node_ids[author] = node_cnt++; | ||
| 54 | + node_ids.insert(bm_type::value_type(author, node_cnt++)); | ||
| 55 | + //qDebug() << author.c_str() << " "; | ||
| 56 | + | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + //debug | ||
| 62 | + if (node_cnt > 100) break; | ||
| 63 | + } | ||
| 64 | + qDebug() << "* graph reading complete" << endl; | ||
| 65 | + | ||
| 66 | + //std::sort(node_names.begin(), node_names.end()); | ||
| 67 | + | ||
| 68 | + //Make graph | ||
| 69 | + //Graph --> defined in "PaperGraphWidget.h" | ||
| 70 | + | ||
| 71 | + for (auto edge : edges) { | ||
| 72 | + edges_indexes.push_back({ | ||
| 73 | + node_ids.left.find(edge.first)->get_right(), | ||
| 74 | + node_ids.left.find(edge.second)->get_right() | ||
| 75 | + }); | ||
| 76 | + } | ||
| 77 | + Graph graph(edges_indexes.begin(), edges_indexes.end(), node_ids.size()); | ||
| 78 | + | ||
| 79 | + //print map | ||
| 80 | + //for (auto it=node_ids.left.begin(), itend=node_ids.left.end(); | ||
| 81 | + // it!=itend; ++it) { | ||
| 82 | + // qDebug() << it->first.c_str() << " " << it->second << endl; | ||
| 83 | + //} | ||
| 84 | + | ||
| 85 | + //set index property | ||
| 86 | + typedef typename graph_traits<Graph>::edge_iterator edge_iterator; | ||
| 87 | + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; | ||
| 88 | + vertex_iterator vi, vi_end; | ||
| 89 | + int i = 0; | ||
| 90 | + for (boost::tie(vi, vi_end)=vertices(graph); vi!=vi_end; ++vi) { | ||
| 91 | + boost::put(vertex_index, graph, *vi, i); | ||
| 92 | + boost::put(vertex_name, graph, *vi, | ||
| 93 | + node_ids.right.find(i)->get_left()); | ||
| 94 | + //VertexProperties prop = VertexProperties(i, | ||
| 95 | + // boost::property<vertex_name_t, std::string, | ||
| 96 | + // boost::property<vertex_position_t, point>>()); | ||
| 97 | + | ||
| 98 | + ++i; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + //for (auto edge : edges) { | ||
| 103 | + // //add edge | ||
| 104 | + // //VertexProperties prop = VertexProperties() | ||
| 105 | + // //add_edge(node_ids[edge.first], node_ids[edge.second],); | ||
| 106 | + //} | ||
| 107 | + | ||
| 108 | + //make graph layout | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + return graph; | ||
| 112 | +} | ||
| 3 | 113 | ||
| 4 | int main(int argc, char *argv[]) | 114 | int main(int argc, char *argv[]) |
| 5 | { | 115 | { |
| ... | @@ -7,6 +117,17 @@ int main(int argc, char *argv[]) | ... | @@ -7,6 +117,17 @@ int main(int argc, char *argv[]) |
| 7 | app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); | 117 | app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); |
| 8 | 118 | ||
| 9 | PaperGraphWidget w; | 119 | PaperGraphWidget w; |
| 120 | + | ||
| 121 | + try { | ||
| 122 | + ifstream fin(PAPER_FILENAME); | ||
| 123 | + w.print_graph(read_graph(fin)); | ||
| 124 | + fin.close(); | ||
| 125 | + } catch (const std::exception& e) { | ||
| 126 | + qDebug() << "Error: " << e.what() << endl; | ||
| 127 | + return -1; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + | ||
| 10 | w.show(); | 131 | w.show(); |
| 11 | 132 | ||
| 12 | return app.exec(); | 133 | return app.exec(); | ... | ... |
-
Please register or login to post a comment