Edge and nodemap edition is done.
1 #include <all_include.h>
2 #include <mapstorage.h>
4 #include <libgnomecanvasmm.h>
5 #include <libgnomecanvasmm/polygon.h>
9 std::vector <std::string> edge_property_strings;
10 std::vector <double> edge_property_defaults;
11 std::vector <std::string> node_property_strings;
12 std::vector <double> node_property_defaults;
15 int main(int argc, char *argv[])
20 edge_property_strings.resize(EDGE_PROPERTY_NUM);
21 edge_property_strings[E_WIDTH]="Edge Width";
22 edge_property_strings[E_COLOR]="Edge Color";
23 edge_property_strings[E_TEXT]="Edge Text";
25 edge_property_defaults.resize(EDGE_PROPERTY_NUM);
26 edge_property_defaults[E_WIDTH]=10.0;
27 edge_property_defaults[E_COLOR]=100;
28 edge_property_defaults[E_TEXT]=0;
30 node_property_strings.resize(NODE_PROPERTY_NUM);
31 node_property_strings[N_RADIUS]="Node Radius";
32 node_property_strings[N_COLOR]="Node Color";
33 node_property_strings[N_TEXT]="Node Text";
35 node_property_defaults.resize(NODE_PROPERTY_NUM);
36 node_property_defaults[N_RADIUS]=20.0;
37 node_property_defaults[N_COLOR]=100;
38 node_property_defaults[N_TEXT]=0;
42 std::cerr << "USAGE: gd <input filename.lgf>" << std::endl;
46 Coordinates coosvector;
51 Graph::EdgeMap<double> cap(g), map1(g), map2(g), map3(g), map4(g);
52 Graph::NodeMap<double> nodedata (g);
54 //we create one object to read x coordinates
55 //and one to read y coordinate of nodes and write them to cm NodeMap.
56 XMap <CoordinatesMap> xreader (cm);
57 YMap <CoordinatesMap> yreader (cm);
59 //reading in graph and its maps
61 std::ifstream is(argv[1]);
63 GraphReader<Graph> reader(is, g);
64 reader.readNodeMap("coordinates_x", xreader);
65 reader.readNodeMap("coordinates_y", yreader);
66 reader.readNodeMap("data", nodedata);
67 reader.readEdgeMap("cap", cap);
68 reader.readEdgeMap("map1", map1);
69 reader.readEdgeMap("map2", map2);
70 reader.readEdgeMap("map3", map3);
71 reader.readEdgeMap("map4", map4);
74 //initializing MapStorage with the read data
77 ms.addNodeMap("data",&nodedata);
78 ms.addEdgeMap("cap",&cap);
79 ms.addEdgeMap("map1",&map1);
80 ms.addEdgeMap("map2",&map2);
81 ms.addEdgeMap("map3",&map3);
82 ms.addEdgeMap("map4",&map4);
86 Gnome::Canvas::init();
87 Gtk::Main app(argc, argv);
89 MainWin mainwin("Displayed Graph", g, cm, ms);