ladanyi@1: #include ladanyi@1: #include ladanyi@1: #include ladanyi@1: #include ladanyi@1: #include ladanyi@1: ladanyi@1: #define MAIN_PART ladanyi@1: ladanyi@1: std::string * property_strings; ladanyi@1: double * property_defaults; ladanyi@1: ladanyi@1: ladanyi@1: int main(int argc, char *argv[]) ladanyi@1: { hegyi@4: hegyi@4: //initializing hegyi@4: ladanyi@1: property_strings=new std::string[PROPERTY_NUM]; ladanyi@1: property_strings[WIDTH]="Width"; ladanyi@1: property_strings[COLOR]="Color"; ladanyi@1: property_strings[TEXT]="Text"; ladanyi@1: ladanyi@1: property_defaults=new double[PROPERTY_NUM]; ladanyi@1: property_defaults[WIDTH]=10.0; ladanyi@1: property_defaults[COLOR]=100; ladanyi@1: property_defaults[TEXT]=0; ladanyi@1: ladanyi@1: if(argc<2) ladanyi@1: { ladanyi@1: std::cerr << "USAGE: gd " << std::endl; ladanyi@1: return 0; ladanyi@1: } ladanyi@1: ladanyi@1: Coordinates coosvector; ladanyi@1: ladanyi@1: Graph g; ladanyi@1: ladanyi@1: CoordinatesMap cm(g); ladanyi@1: Graph::EdgeMap cap(g), map1(g), map2(g), map3(g), map4(g); hegyi@4: Graph::NodeMap nodedata (g); ladanyi@1: ladanyi@1: //we create one object to read x coordinates ladanyi@1: //and one to read y coordinate of nodes and write them to cm NodeMap. ladanyi@1: XMap xreader (cm); ladanyi@1: YMap yreader (cm); hegyi@4: hegyi@4: //reading in graph and its maps ladanyi@1: ladanyi@1: std::ifstream is(argv[1]); ladanyi@1: ladanyi@1: GraphReader reader(is, g); ladanyi@1: reader.readNodeMap("coordinates_x", xreader); ladanyi@1: reader.readNodeMap("coordinates_y", yreader); ladanyi@1: reader.readNodeMap("data", nodedata); ladanyi@1: reader.readEdgeMap("cap", cap); ladanyi@1: reader.readEdgeMap("map1", map1); ladanyi@1: reader.readEdgeMap("map2", map2); ladanyi@1: reader.readEdgeMap("map3", map3); ladanyi@1: reader.readEdgeMap("map4", map4); ladanyi@1: reader.run(); ladanyi@1: hegyi@4: //initializing MapStorage with the read data hegyi@4: ladanyi@1: MapStorage ms(g); ladanyi@1: ms.addNodeMap("data",&nodedata); ladanyi@1: ms.addEdgeMap("cap",&cap); ladanyi@1: ms.addEdgeMap("map1",&map1); ladanyi@1: ms.addEdgeMap("map2",&map2); ladanyi@1: ms.addEdgeMap("map3",&map3); ladanyi@1: ms.addEdgeMap("map4",&map4); ladanyi@1: hegyi@4: //initializing GUI hegyi@4: ladanyi@1: Gnome::Canvas::init(); ladanyi@1: Gtk::Main app(argc, argv); ladanyi@1: ladanyi@1: MainWin mainwin("Displayed Graph", g, cm, ms); ladanyi@1: app.run(mainwin); ladanyi@1: ladanyi@1: return 0; ladanyi@1: }