gui/graph-displayer.cc
changeset 1481 ca33a3cf41ce
parent 1435 8e85e6bbefdf
child 1503 97836166605d
equal deleted inserted replaced
0:9d1e3ebba461 1:e56670100448
    10 double * property_defaults;
    10 double * property_defaults;
    11 
    11 
    12 
    12 
    13 int main(int argc, char *argv[])
    13 int main(int argc, char *argv[])
    14 {
    14 {
       
    15 
       
    16   //initializing
       
    17 
    15   property_strings=new std::string[PROPERTY_NUM];
    18   property_strings=new std::string[PROPERTY_NUM];
    16   property_strings[WIDTH]="Width";
    19   property_strings[WIDTH]="Width";
    17   property_strings[COLOR]="Color";
    20   property_strings[COLOR]="Color";
    18   property_strings[TEXT]="Text";
    21   property_strings[TEXT]="Text";
    19 
    22 
    32 
    35 
    33   Graph g;
    36   Graph g;
    34 
    37 
    35   CoordinatesMap cm(g);
    38   CoordinatesMap cm(g);
    36   Graph::EdgeMap<double> cap(g), map1(g), map2(g), map3(g), map4(g);
    39   Graph::EdgeMap<double> cap(g), map1(g), map2(g), map3(g), map4(g);
       
    40   Graph::NodeMap<double> nodedata (g);
    37 
    41 
    38   //we create one object to read x coordinates
    42   //we create one object to read x coordinates
    39   //and one to read y coordinate of nodes and write them to cm NodeMap.
    43   //and one to read y coordinate of nodes and write them to cm NodeMap.
    40 
       
    41   XMap <CoordinatesMap> xreader (cm);
    44   XMap <CoordinatesMap> xreader (cm);
    42   YMap <CoordinatesMap> yreader (cm);
    45   YMap <CoordinatesMap> yreader (cm);
    43   Graph::NodeMap<double> nodedata (g);
    46 
       
    47   //reading in graph and its maps
    44 
    48 
    45   std::ifstream is(argv[1]);
    49   std::ifstream is(argv[1]);
    46 
    50 
    47   GraphReader<Graph> reader(is, g);
    51   GraphReader<Graph> reader(is, g);
    48   reader.readNodeMap("coordinates_x", xreader);
    52   reader.readNodeMap("coordinates_x", xreader);
    53   reader.readEdgeMap("map2", map2);
    57   reader.readEdgeMap("map2", map2);
    54   reader.readEdgeMap("map3", map3);
    58   reader.readEdgeMap("map3", map3);
    55   reader.readEdgeMap("map4", map4);
    59   reader.readEdgeMap("map4", map4);
    56   reader.run();
    60   reader.run();
    57 
    61 
       
    62   //initializing MapStorage with the read data
       
    63 
    58   MapStorage ms(g);
    64   MapStorage ms(g);
    59   ms.addNodeMap("data",&nodedata);
    65   ms.addNodeMap("data",&nodedata);
    60   ms.addEdgeMap("cap",&cap);
    66   ms.addEdgeMap("cap",&cap);
    61   ms.addEdgeMap("map1",&map1);
    67   ms.addEdgeMap("map1",&map1);
    62   ms.addEdgeMap("map2",&map2);
    68   ms.addEdgeMap("map2",&map2);
    63   ms.addEdgeMap("map3",&map3);
    69   ms.addEdgeMap("map3",&map3);
    64   ms.addEdgeMap("map4",&map4);
    70   ms.addEdgeMap("map4",&map4);
       
    71 
       
    72   //initializing GUI
    65 
    73 
    66   Gnome::Canvas::init();
    74   Gnome::Canvas::init();
    67   Gtk::Main app(argc, argv);
    75   Gtk::Main app(argc, argv);
    68 
    76 
    69   MainWin mainwin("Displayed Graph", g, cm, ms);
    77   MainWin mainwin("Displayed Graph", g, cm, ms);