gui/graph-displayer.cc
author deba
Wed, 01 Mar 2006 10:17:25 +0000
changeset 1990 15fb7a4ea6be
parent 1849 a4d1362397fe
child 2012 224cd6aacfc1
permissions -rw-r--r--
Some classes assumed that the GraphMaps should be inherited
from an ObserverBase. These classes parents replaced with
DefaultMap which cause that the graph maps should not be
inherited from the ObserverBase.
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;
hegyi@1731
    13
int longest_property_string_length;
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@1731
    40
  longest_property_string_length=0;
hegyi@1731
    41
  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@1731
    42
    {
hegyi@1731
    43
      int j=edge_property_strings[i].size();
hegyi@1731
    44
      if(j>longest_property_string_length)
hegyi@1731
    45
	{
hegyi@1731
    46
	  longest_property_string_length=j;
hegyi@1731
    47
	}
hegyi@1731
    48
    }
hegyi@1731
    49
  for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@1731
    50
    {
hegyi@1731
    51
      int j=node_property_strings[i].size();
hegyi@1731
    52
      if(j>longest_property_string_length)
hegyi@1731
    53
	{
hegyi@1731
    54
	  longest_property_string_length=j;
hegyi@1731
    55
	}
hegyi@1731
    56
    }
hegyi@1731
    57
hegyi@1731
    58
hegyi@1440
    59
  //initializing GUI
hegyi@1440
    60
ladanyi@1412
    61
  Gnome::Canvas::init();
ladanyi@1412
    62
  Gtk::Main app(argc, argv);
ladanyi@1412
    63
hegyi@1849
    64
  MainWin mytab;
ladanyi@1616
    65
hegyi@1869
    66
//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
hegyi@1869
    67
//     {
hegyi@1869
    68
//       mytab.readFile(argv[1]);
hegyi@1869
    69
//     }
hegyi@1869
    70
  if(argc>=2)
hegyi@1849
    71
    {
hegyi@1869
    72
      for(int i=1;i<argc;i++)
hegyi@1869
    73
	{
hegyi@1869
    74
	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
hegyi@1869
    75
	    {
hegyi@1869
    76
	      mytab.readFile(argv[i]);
hegyi@1869
    77
	    }
hegyi@1869
    78
	}
hegyi@1869
    79
    }
hegyi@1869
    80
  else
hegyi@1869
    81
    {
hegyi@1869
    82
      mytab.newTab();
hegyi@1849
    83
    }
ladanyi@1616
    84
  
hegyi@1849
    85
  app.run(mytab);
ladanyi@1412
    86
ladanyi@1412
    87
  return 0;
ladanyi@1412
    88
}