COIN-OR::LEMON - Graph Library

Changeset 53:e73d7540bd24 in glemon-0.x for graph-displayer.cc


Ignore:
Timestamp:
07/29/05 14:01:37 (14 years ago)
Author:
Akos Ladanyi
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2111
Message:

added support for saving files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph-displayer.cc

    r28 r53  
    1 #include <all_include.h>
    2 #include <mapstorage.h>
    3 #include <main_win.h>
     1#include "all_include.h"
     2#include "mapstorage.h"
     3#include "main_win.h"
    44#include <libgnomecanvasmm.h>
    55#include <libgnomecanvasmm/polygon.h>
     
    3838  node_property_defaults[N_TEXT]=0;
    3939
    40   if(argc<2)
    41   {
    42       std::cerr << "USAGE: gd <input filename.lgf>" << std::endl;
    43       return 0;
    44   }
    45 
    46   Coordinates coosvector;
    47 
    48   Graph g;
    49 
    50   CoordinatesMap cm(g);
    51   Graph::EdgeMap<double> cap(g), map1(g), map2(g), map3(g), map4(g);
    52   Graph::NodeMap<double> nodedata (g);
    53 
    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);
    58 
    59   //reading in graph and its maps
    60 
    61   std::ifstream is(argv[1]);
    62 
    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);
    72   reader.run();
    73 
    74   //initializing MapStorage with the read data
    75 
    76   MapStorage ms(g);
    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);
    83 
    8440  //initializing GUI
    8541
     
    8743  Gtk::Main app(argc, argv);
    8844
    89   MainWin mainwin("Displayed Graph", g, cm, ms);
     45  MainWin mainwin("Displayed Graph");
    9046  app.run(mainwin);
    9147
Note: See TracChangeset for help on using the changeset viewer.