ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: #include ladanyi@1412: ladanyi@1412: #define MAIN_PART ladanyi@1412: hegyi@1512: std::vector edge_property_strings; hegyi@1512: std::vector edge_property_defaults; hegyi@1512: std::vector node_property_strings; hegyi@1512: std::vector node_property_defaults; ladanyi@1412: ladanyi@1412: ladanyi@1412: int main(int argc, char *argv[]) ladanyi@1412: { hegyi@1440: hegyi@1440: //initializing hegyi@1440: hegyi@1512: edge_property_strings.resize(EDGE_PROPERTY_NUM); hegyi@1512: edge_property_strings[E_WIDTH]="Edge Width"; hegyi@1512: edge_property_strings[E_COLOR]="Edge Color"; hegyi@1512: edge_property_strings[E_TEXT]="Edge Text"; ladanyi@1412: hegyi@1512: edge_property_defaults.resize(EDGE_PROPERTY_NUM); hegyi@1512: edge_property_defaults[E_WIDTH]=10.0; hegyi@1512: edge_property_defaults[E_COLOR]=100; hegyi@1512: edge_property_defaults[E_TEXT]=0; hegyi@1512: hegyi@1512: node_property_strings.resize(NODE_PROPERTY_NUM); hegyi@1512: node_property_strings[N_RADIUS]="Node Radius"; hegyi@1512: node_property_strings[N_COLOR]="Node Color"; hegyi@1512: node_property_strings[N_TEXT]="Node Text"; hegyi@1512: hegyi@1512: node_property_defaults.resize(NODE_PROPERTY_NUM); hegyi@1512: node_property_defaults[N_RADIUS]=20.0; hegyi@1512: node_property_defaults[N_COLOR]=100; hegyi@1512: node_property_defaults[N_TEXT]=0; ladanyi@1412: ladanyi@1412: if(argc<2) ladanyi@1412: { ladanyi@1412: std::cerr << "USAGE: gd " << std::endl; ladanyi@1412: return 0; ladanyi@1412: } ladanyi@1412: ladanyi@1412: Coordinates coosvector; ladanyi@1412: ladanyi@1412: Graph g; ladanyi@1412: ladanyi@1412: CoordinatesMap cm(g); ladanyi@1412: Graph::EdgeMap cap(g), map1(g), map2(g), map3(g), map4(g); hegyi@1440: Graph::NodeMap nodedata (g); ladanyi@1412: ladanyi@1412: //we create one object to read x coordinates ladanyi@1412: //and one to read y coordinate of nodes and write them to cm NodeMap. ladanyi@1412: XMap xreader (cm); ladanyi@1412: YMap yreader (cm); hegyi@1440: hegyi@1440: //reading in graph and its maps ladanyi@1412: ladanyi@1412: std::ifstream is(argv[1]); ladanyi@1412: ladanyi@1412: GraphReader reader(is, g); ladanyi@1412: reader.readNodeMap("coordinates_x", xreader); ladanyi@1412: reader.readNodeMap("coordinates_y", yreader); ladanyi@1412: reader.readNodeMap("data", nodedata); ladanyi@1412: reader.readEdgeMap("cap", cap); ladanyi@1412: reader.readEdgeMap("map1", map1); ladanyi@1412: reader.readEdgeMap("map2", map2); ladanyi@1412: reader.readEdgeMap("map3", map3); ladanyi@1412: reader.readEdgeMap("map4", map4); ladanyi@1412: reader.run(); ladanyi@1412: hegyi@1440: //initializing MapStorage with the read data hegyi@1440: ladanyi@1412: MapStorage ms(g); ladanyi@1412: ms.addNodeMap("data",&nodedata); ladanyi@1412: ms.addEdgeMap("cap",&cap); ladanyi@1412: ms.addEdgeMap("map1",&map1); ladanyi@1412: ms.addEdgeMap("map2",&map2); ladanyi@1412: ms.addEdgeMap("map3",&map3); ladanyi@1412: ms.addEdgeMap("map4",&map4); ladanyi@1412: hegyi@1440: //initializing GUI hegyi@1440: ladanyi@1412: Gnome::Canvas::init(); ladanyi@1412: Gtk::Main app(argc, argv); ladanyi@1412: ladanyi@1412: MainWin mainwin("Displayed Graph", g, cm, ms); ladanyi@1412: app.run(mainwin); ladanyi@1412: ladanyi@1412: return 0; ladanyi@1412: }