gui/graph-displayer.cc
author hegyi
Sun, 07 Aug 2005 22:14:59 +0000
changeset 1617 c17d61f77319
parent 1606 dc4ea2010dee
child 1650 422906271d22
permissions -rw-r--r--
Until this commitment gui gave us segmentation fault in the case when no element was on graph_displayer_canvas and a map to visualize by a property has been changed.
ladanyi@1606
     1
#include "all_include.h"
ladanyi@1606
     2
#include "mapstorage.h"
ladanyi@1606
     3
#include "main_win.h"
ladanyi@1412
     4
#include <libgnomecanvasmm.h>
ladanyi@1412
     5
#include <libgnomecanvasmm/polygon.h>
ladanyi@1412
     6
ladanyi@1412
     7
#define MAIN_PART
ladanyi@1412
     8
hegyi@1512
     9
std::vector <std::string> edge_property_strings;
hegyi@1512
    10
std::vector <double> edge_property_defaults;
hegyi@1512
    11
std::vector <std::string> node_property_strings;
hegyi@1512
    12
std::vector <double> node_property_defaults;
ladanyi@1412
    13
ladanyi@1412
    14
ladanyi@1412
    15
int main(int argc, char *argv[])
ladanyi@1412
    16
{
hegyi@1440
    17
hegyi@1440
    18
  //initializing
hegyi@1440
    19
hegyi@1512
    20
  edge_property_strings.resize(EDGE_PROPERTY_NUM);
hegyi@1512
    21
  edge_property_strings[E_WIDTH]="Edge Width";
hegyi@1512
    22
  edge_property_strings[E_COLOR]="Edge Color";
hegyi@1512
    23
  edge_property_strings[E_TEXT]="Edge Text";
ladanyi@1412
    24
hegyi@1512
    25
  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
hegyi@1512
    26
  edge_property_defaults[E_WIDTH]=10.0;
hegyi@1512
    27
  edge_property_defaults[E_COLOR]=100;
hegyi@1512
    28
  edge_property_defaults[E_TEXT]=0;
hegyi@1512
    29
hegyi@1512
    30
  node_property_strings.resize(NODE_PROPERTY_NUM);
hegyi@1512
    31
  node_property_strings[N_RADIUS]="Node Radius";
hegyi@1512
    32
  node_property_strings[N_COLOR]="Node Color";
hegyi@1512
    33
  node_property_strings[N_TEXT]="Node Text";
hegyi@1512
    34
hegyi@1512
    35
  node_property_defaults.resize(NODE_PROPERTY_NUM);
hegyi@1512
    36
  node_property_defaults[N_RADIUS]=20.0;
hegyi@1512
    37
  node_property_defaults[N_COLOR]=100;
hegyi@1512
    38
  node_property_defaults[N_TEXT]=0;
ladanyi@1412
    39
hegyi@1440
    40
  //initializing GUI
hegyi@1440
    41
ladanyi@1412
    42
  Gnome::Canvas::init();
ladanyi@1412
    43
  Gtk::Main app(argc, argv);
ladanyi@1412
    44
ladanyi@1606
    45
  MainWin mainwin("Displayed Graph");
ladanyi@1616
    46
ladanyi@1616
    47
  if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
ladanyi@1616
    48
  {
ladanyi@1616
    49
    mainwin.readFile(argv[1]);
ladanyi@1616
    50
  }
ladanyi@1616
    51
  
ladanyi@1412
    52
  app.run(mainwin);
ladanyi@1412
    53
ladanyi@1412
    54
  return 0;
ladanyi@1412
    55
}