COIN-OR::LEMON - Graph Library

Changeset 194:6b2b718420eb in glemon-0.x


Ignore:
Timestamp:
02/28/07 19:20:28 (17 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3205
Message:

Header reorganising

Files:
37 edited

Legend:

Unmodified
Added
Removed
  • algobox.cc

    r174 r194  
    1818
    1919#include <algobox.h>
     20#include <mapstorage.h>
     21#include <mapselector.h>
    2022
    2123enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
  • algobox.h

    r174 r194  
    2020#define ALGOBOX_H
    2121
    22 class AlgoBox;
     22class MapStorage;
     23class MapSelector;
    2324
    2425#include <all_include.h>
    25 #include <mapstorage.h>
    26 #include <mapselector.h>
    2726#include <libgnomecanvasmm.h>
    2827#include <libgnomecanvasmm/polygon.h>
  • algowin.cc

    r174 r194  
    1818
    1919#include <algowin.h>
     20#include <algobox.h>
    2021#include <kruskalbox.h>
    2122#include <dijkstrabox.h>
  • algowin.h

    r174 r194  
    2020#define ALGOWIN_H
    2121
    22 class AlgoWin;
    23 
    2422#include <all_include.h>
    25 //#include <mapstorage.h>
    26 #include <algobox.h>
    2723#include <libgnomecanvasmm.h>
    2824#include <libgnomecanvasmm/polygon.h>
    2925
     26class AlgoBox;
    3027class MapStorage;
    3128
  • background_chooser_dialog.cc

    r184 r194  
    1 #include "background_chooser_dialog.h"
     1#include <background_chooser_dialog.h>
    22#include <gtkmm/stock.h>
    3 #include "mapstorage.h"
     3#include <mapstorage.h>
    44
    55BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
  • design_win.cc

    r177 r194  
    1717 */
    1818
     19#include <nbtab.h>
    1920#include <design_win.h>
    2021
  • design_win.h

    r177 r194  
    2020#define DESWIN_H
    2121
    22 class DesignWin;
     22class NoteBookTab;
    2323
    2424#include <all_include.h>
    25 #include <nbtab.h>
    2625#include <libgnomecanvasmm.h>
    2726#include <libgnomecanvasmm/polygon.h>
  • dijkstrabox.cc

    r188 r194  
    1717 */
    1818
     19#include <mapstorage.h>
     20#include <mapselector.h>
     21#include <algobox.h>
    1922#include <dijkstrabox.h>
     23
    2024#include <lemon/dijkstra.h>
    2125#include <lemon/suurballe.h>
  • dijkstrabox.h

    r174 r194  
    2020#define DIJKSTRABOX_H
    2121
    22 class DijkstraBox;
     22class AlgoBox;
    2323
    2424#include <all_include.h>
    25 #include <algobox.h>
    2625#include <libgnomecanvasmm.h>
    2726#include <libgnomecanvasmm/polygon.h>
  • eps_win.cc

    r192 r194  
    1717 */
    1818
    19 #include "eps_win.h"
     19#include <nbtab.h>
     20#include <eps_win.h>
    2021#include <set>
    2122
  • eps_win.h

    r192 r194  
    2020#define EPS_WIN_H
    2121
    22 class EpsWin;
     22class NoteBookTab;
    2323
    2424#include <all_include.h>
    25 #include <nbtab.h>
    26 #include <mapselector.h>
    2725#include <libgnomecanvasmm.h>
    2826#include <libgnomecanvasmm/polygon.h>
  • gdc-broken_edge.cc

    r189 r194  
    1717 */
    1818
    19 #include "graph_displayer_canvas.h"
     19#include <graph_displayer_canvas.h>
     20#include <mapstorage.h>
     21#include <nbtab.h>
    2022#include <cmath>
    2123
     
    3436void GraphDisplayerCanvas::EdgeBase::drawArrow(XY unit_vector_in_dir)
    3537{
    36   MapStorage& ms = canvas.mytab.mapstorage;
     38  MapStorage& ms = *canvas.mytab.mapstorage;
    3739  XY center(ms.arrow_pos[edge]);
    3840  XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
     
    8587void GraphDisplayerCanvas::BrokenEdge::draw()
    8688{
    87   MapStorage& ms = canvas.mytab.mapstorage;
     89  MapStorage& ms = *canvas.mytab.mapstorage;
    8890
    8991  //calculating coordinates of the direction indicator arrow
     
    151153        Gnome::Canvas::Points points_new;
    152154
    153         canvas.mytab.mapstorage.arrow_pos.set(edge, canvas.mytab.mapstorage.arrow_pos[edge] + XY(dx, dy));
     155        canvas.mytab.mapstorage->arrow_pos.set(edge, canvas.mytab.mapstorage->arrow_pos[edge] + XY(dx, dy));
    154156
    155157        draw();
    156         canvas.textReposition(canvas.mytab.mapstorage.arrow_pos[edge]);
     158        canvas.textReposition(canvas.mytab.mapstorage->arrow_pos[edge]);
    157159
    158160        clicked_x=e->motion.x;
     
    195197void GraphDisplayerCanvas::LoopEdge::draw()
    196198{
    197   MapStorage& ms = canvas.mytab.mapstorage;
     199  MapStorage& ms = *canvas.mytab.mapstorage;
    198200
    199201  Node node = ms.graph.source(edge);
     
    248250      if(isbutton)
    249251      {
    250         canvas.mytab.mapstorage.arrow_pos.set(edge, XY(e->motion.x, e->motion.y));
     252        canvas.mytab.mapstorage->arrow_pos.set(edge, XY(e->motion.x, e->motion.y));
    251253
    252254        draw();
    253         canvas.textReposition(canvas.mytab.mapstorage.arrow_pos[edge]);
     255        canvas.textReposition(canvas.mytab.mapstorage->arrow_pos[edge]);
    254256      }
    255257    default: break;
  • graph-displayer.cc

    r174 r194  
    2222
    2323#include "all_include.h"
    24 #include "mapstorage.h"
    2524#include "main_win.h"
    2625#include <libgnomecanvasmm.h>
  • graph_displayer_canvas-edge.cc

    r179 r194  
    1717 */
    1818
    19 #include "graph_displayer_canvas.h"
     19#include <graph_displayer_canvas.h>
     20#include <mapstorage.h>
     21#include <nbtab.h>
    2022#include <cmath>
    2123
     
    2830  min=edge_property_defaults[E_WIDTH];
    2931  max=edge_property_defaults[E_WIDTH];
    30   Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
     32  Graph::EdgeMap<double> actual_map((mytab.mapstorage)->graph,edge_property_defaults[E_WIDTH]);
    3133 
    3234  if(edge==INVALID)
    3335    {
    34       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     36      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    3537        {
    3638          double v=fabs(actual_map[i]);
     
    6971  double min, max;
    7072
    71   min=(mytab.mapstorage).minOfEdgeMap(mapname);
    72   max=(mytab.mapstorage).maxOfEdgeMap(mapname);
    73   actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
    74 
    75   if(edge==INVALID)
    76     {
    77       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     73  min=(mytab.mapstorage)->minOfEdgeMap(mapname);
     74  max=(mytab.mapstorage)->maxOfEdgeMap(mapname);
     75  actual_map=((mytab.mapstorage)->edgemap_storage)[mapname];
     76
     77  if(edge==INVALID)
     78    {
     79      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    7880        {
    7981          double v=(*actual_map)[i];
     
    132134  //green in RGB
    133135  Graph::EdgeMap<double> * actual_map;
    134   actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
     136  actual_map=((mytab.mapstorage)->edgemap_storage)[mapname];
    135137
    136138  double max, min;
    137139
    138   max=(mytab.mapstorage).maxOfEdgeMap(mapname);
    139   min=(mytab.mapstorage).minOfEdgeMap(mapname);
    140 
    141   if(edge==INVALID)
    142     {
    143       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     140  max=(mytab.mapstorage)->maxOfEdgeMap(mapname);
     141  min=(mytab.mapstorage)->minOfEdgeMap(mapname);
     142
     143  if(edge==INVALID)
     144    {
     145      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    144146        {
    145147          double w=(*actual_map)[i];
     
    183185  //the minimum of the nodemap to the range of
    184186  //green in RGB
    185   Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
     187  Graph::EdgeMap<double> actual_map((mytab.mapstorage)->graph,edge_property_defaults[E_COLOR]);
    186188
    187189  double max, min;
     
    192194  if(edge==INVALID)
    193195    {
    194       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     196      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    195197        {
    196198          double w=actual_map[i];
     
    237239  if(edge==INVALID)
    238240    {
    239       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     241      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    240242        {
    241243          edgemap_to_edit=mapname;
    242           double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[i];
     244          double number=(*((mytab.mapstorage)->edgemap_storage)[mapname])[i];
    243245         
    244246          std::ostringstream ostr;
     
    251253  else
    252254    {
    253           double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
     255          double number=(*((mytab.mapstorage)->edgemap_storage)[mapname])[edge];
    254256
    255257          std::ostringstream ostr;
     
    272274  if(edge==INVALID)
    273275    {
    274       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     276      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    275277        {
    276278          edgemap_to_edit="";
  • graph_displayer_canvas-event.cc

    r187 r194  
    1717 */
    1818
    19 #include "graph_displayer_canvas.h"
     19#include <graph_displayer_canvas.h>
     20#include <mapstorage.h>
     21#include <nbtab.h>
    2022#include <cmath>
    2123
     
    146148      active_item=(get_item_at(clicked_x, clicked_y));
    147149      active_node=INVALID;
    148       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     150      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    149151        {
    150152          if(nodesmap[i]==active_item)
     
    169171      if(active_node!=INVALID)
    170172        {
    171           (mytab.mapstorage).modified = true;
     173          (mytab.mapstorage)->modified = true;
    172174         
    173175          //new coordinates will be the old values,
     
    191193          std::ostringstream ostr;
    192194          ostr << "(" <<
    193             (mytab.mapstorage).coords[active_node].x << ", " <<
    194             (mytab.mapstorage).coords[active_node].y << ")";
     195            (mytab.mapstorage)->coords[active_node].x << ", " <<
     196            (mytab.mapstorage)->coords[active_node].y << ")";
    195197          double radius =
    196198            (nodesmap[active_node]->property_x2().get_value() -
     
    199201            {
    200202              coord_text->property_text().set_value(ostr.str());
    201               coord_text->property_x().set_value((mytab.mapstorage).coords[active_node].x +
     203              coord_text->property_x().set_value((mytab.mapstorage)->coords[active_node].x +
    202204                                                 radius);
    203               coord_text->property_y().set_value((mytab.mapstorage).coords[active_node].y -
     205              coord_text->property_y().set_value((mytab.mapstorage)->coords[active_node].y -
    204206                                                 radius);
    205207            }
     
    208210              coord_text = new Gnome::Canvas::Text(
    209211                                                   displayed_graph,
    210                                                    (mytab.mapstorage).coords[active_node].x + radius,
    211                                                    (mytab.mapstorage).coords[active_node].y - radius,
     212                                                   (mytab.mapstorage)->coords[active_node].x + radius,
     213                                                   (mytab.mapstorage)->coords[active_node].y - radius,
    212214                                                   ostr.str());
    213215              coord_text->property_fill_color().set_value("black");
     
    300302
    301303    case GDK_BUTTON_RELEASE:
    302       (mytab.mapstorage).modified = true;
     304      (mytab.mapstorage)->modified = true;
    303305
    304306      is_drawn=true;
     
    306308      isbutton=1;
    307309
    308       active_node=(mytab.mapstorage).graph.addNode();
     310      active_node=(mytab.mapstorage)->graph.addNode();
    309311
    310312      //initiating values corresponding to new node in maps
     
    313315
    314316      // update coordinates
    315       (mytab.mapstorage).coords.set(active_node, XY(clicked_x, clicked_y));
     317      (mytab.mapstorage)->coords.set(active_node, XY(clicked_x, clicked_y));
    316318
    317319      // update all other maps
    318320      for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
    319           (mytab.mapstorage).nodemap_storage.begin(); it !=
    320           (mytab.mapstorage).nodemap_storage.end(); ++it)
     321          (mytab.mapstorage)->nodemap_storage.begin(); it !=
     322          (mytab.mapstorage)->nodemap_storage.end(); ++it)
    321323      {
    322324        if ((it->first != "coordinates_x") &&
     
    324326        {
    325327          (*(it->second))[active_node] =
    326             (mytab.mapstorage).nodemap_default[it->first];
     328            (mytab.mapstorage)->nodemap_default[it->first];
    327329        }
    328330      }
    329331      // increment the id map's default value
    330       (mytab.mapstorage).nodemap_default["label"] += 1.0;
     332      (mytab.mapstorage)->nodemap_default["label"] += 1.0;
    331333
    332334      nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
     
    378380          active_item=(get_item_at(clicked_x, clicked_y));
    379381          active_node=INVALID;
    380           for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     382          for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    381383          {
    382384            if(nodesmap[i]==active_item)
     
    407409          target_item=(get_item_at(clicked_x, clicked_y));
    408410          Node target_node=INVALID;
    409           for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     411          for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    410412          {
    411413            if(nodesmap[i]==target_item)
     
    417419          if(target_node!=INVALID)
    418420          {
    419             (mytab.mapstorage).modified = true;
     421            (mytab.mapstorage)->modified = true;
    420422
    421423            *(nodesmap[target_node]) <<
     
    423425
    424426            //creating new edge
    425             active_edge=(mytab.mapstorage).graph.addEdge(active_node,
     427            active_edge=(mytab.mapstorage)->graph.addEdge(active_node,
    426428                target_node);
    427429
     
    429431            for (std::map<std::string,
    430432                Graph::EdgeMap<double>*>::const_iterator it =
    431                 (mytab.mapstorage).edgemap_storage.begin(); it !=
    432                 (mytab.mapstorage).edgemap_storage.end(); ++it)
     433                (mytab.mapstorage)->edgemap_storage.begin(); it !=
     434                (mytab.mapstorage)->edgemap_storage.end(); ++it)
    433435            {
    434436              (*(it->second))[active_edge] =
    435                 (mytab.mapstorage).edgemap_default[it->first];
     437                (mytab.mapstorage)->edgemap_default[it->first];
    436438            }
    437439            // increment the id map's default value
    438             (mytab.mapstorage).edgemap_default["label"] += 1.0;
     440            (mytab.mapstorage)->edgemap_default["label"] += 1.0;
    439441
    440442            if(target_node!=active_node)               
    441443            {
    442444              // set the coordinates of the arrow on the new edge
    443               MapStorage& ms = mytab.mapstorage;
     445              MapStorage& ms = *mytab.mapstorage;
    444446              ms.arrow_pos.set(active_edge,
    445447                  (ms.coords[ms.graph.source(active_edge)] +
     
    453455            {
    454456              // set the coordinates of the arrow on the new edge
    455               MapStorage& ms = mytab.mapstorage;
     457              MapStorage& ms = *mytab.mapstorage;
    456458              ms.arrow_pos.set(active_edge,
    457459                  (ms.coords[ms.graph.source(active_edge)] +
     
    464466
    465467            //initializing edge-text as well, to empty string
    466             XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
     468            XY text_pos=mytab.mapstorage->arrow_pos[active_edge];
    467469            text_pos+=(XY(10,10));
    468470
     
    498500        if(target_item)
    499501        {
    500           propertyUpdate((mytab.mapstorage).graph.target(active_edge),N_COLOR);
     502          propertyUpdate((mytab.mapstorage)->graph.target(active_edge),N_COLOR);
    501503          target_item=NULL;
    502504        }
     
    522524      active_edge=INVALID;
    523525      //was it a node?
    524       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     526      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    525527        {
    526528          if(nodesmap[i]==active_item)
     
    532534      if(active_node==INVALID)
    533535        {
    534           for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     536          for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    535537            {
    536538              if(edgesmap[i]->getLine()==active_item)
     
    561563              if(active_node!=INVALID)
    562564                {
    563                   (mytab.mapstorage).modified = true;
     565                  (mytab.mapstorage)->modified = true;
    564566
    565567                  std::set<Graph::Edge> edges_to_delete;
    566568
    567                   for(OutEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
     569                  for(OutEdgeIt e((mytab.mapstorage)->graph,active_node);e!=INVALID;++e)
    568570                    {
    569571                      edges_to_delete.insert(e);
    570572                    }
    571573                 
    572                   for(InEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
     574                  for(InEdgeIt e((mytab.mapstorage)->graph,active_node);e!=INVALID;++e)
    573575                    {
    574576                      edges_to_delete.insert(e);
     
    636638
    637639            //find the activated item between text of nodes
    638             for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     640            for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    639641              {
    640642                //at the same time only one can be active
     
    648650            if(clicked_node==INVALID)
    649651              {
    650                 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     652                for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    651653                  {
    652654                    //at the same time only one can be active
     
    661663              {
    662664                //find the activated item between texts
    663                 for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     665                for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    664666                  {
    665667                    //at the same time only one can be active
     
    673675                if(clicked_edge==INVALID)
    674676                  {
    675                     for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     677                    for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    676678                      {
    677679                        //at the same time only one can be active
     
    715717                      case Gtk::RESPONSE_ACCEPT:
    716718                        double new_value = spin.get_value();
    717                         (*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
     719                        (*(mytab.mapstorage)->nodemap_storage[nodemap_to_edit])[active_node] =
    718720                          new_value;
    719721                        std::ostringstream ostr;
     
    758760                        case Gtk::RESPONSE_ACCEPT:
    759761                          double new_value = spin.get_value();
    760                           (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
     762                          (*(mytab.mapstorage)->edgemap_storage[edgemap_to_edit])[active_edge] =
    761763                            new_value;
    762764                          std::ostringstream ostr;
     
    783785  delete(nodetextmap[node_to_delete]);
    784786  delete(nodesmap[node_to_delete]);
    785   (mytab.mapstorage).graph.erase(node_to_delete);
     787  (mytab.mapstorage)->graph.erase(node_to_delete);
    786788}
    787789
     
    790792  delete(edgetextmap[edge_to_delete]);
    791793  delete(edgesmap[edge_to_delete]);
    792   (mytab.mapstorage).graph.erase(edge_to_delete);
     794  (mytab.mapstorage)->graph.erase(edge_to_delete);
    793795}
    794796
     
    810812    else
    811813    {
    812       for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     814      for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    813815      {
    814816        if(edgesmap[i]==active_bre)
     
    852854
    853855  // the new coordinates of the centre of the node
    854   double coord_x = dx + (mytab.mapstorage).coords[moved_node].x;
    855   double coord_y = dy + (mytab.mapstorage).coords[moved_node].y;
     856  double coord_x = dx + (mytab.mapstorage)->coords[moved_node].x;
     857  double coord_y = dy + (mytab.mapstorage)->coords[moved_node].y;
    856858
    857859  // write back the new coordinates to the coords map
    858   (mytab.mapstorage).coords.set(moved_node, XY(coord_x, coord_y));
     860  (mytab.mapstorage)->coords.set(moved_node, XY(coord_x, coord_y));
    859861
    860862  //all the edges connected to the moved point has to be redrawn
    861   for(OutEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
     863  for(OutEdgeIt ei((mytab.mapstorage)->graph,moved_node);ei!=INVALID;++ei)
    862864    {
    863865      XY arrow_pos;
    864866
    865       if (mytab.mapstorage.graph.source(ei) == mytab.mapstorage.graph.target(ei))
    866         {
    867           arrow_pos = mytab.mapstorage.arrow_pos[ei] + XY(dx, dy);
     867      if (mytab.mapstorage->graph.source(ei) == mytab.mapstorage->graph.target(ei))
     868        {
     869          arrow_pos = mytab.mapstorage->arrow_pos[ei] + XY(dx, dy);
    868870        }
    869871      else
     
    871873          XY moved_node_1(coord_x - dx, coord_y - dy);
    872874          XY moved_node_2(coord_x, coord_y);
    873           Node target = mytab.mapstorage.graph.target(ei);
    874           XY fix_node(mytab.mapstorage.coords[target].x,
    875                       mytab.mapstorage.coords[target].y);
    876           XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
     875          Node target = mytab.mapstorage->graph.target(ei);
     876          XY fix_node(mytab.mapstorage->coords[target].x,
     877                      mytab.mapstorage->coords[target].y);
     878          XY old_arrow_pos(mytab.mapstorage->arrow_pos[ei]);
    877879
    878880          arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
    879881        }
    880882
    881       mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
     883      mytab.mapstorage->arrow_pos.set(ei, arrow_pos);
    882884      edgesmap[ei]->draw();
    883885
    884886      //reposition of edgetext
    885       XY text_pos=mytab.mapstorage.arrow_pos[ei];
     887      XY text_pos=mytab.mapstorage->arrow_pos[ei];
    886888      text_pos+=(XY(10,10));
    887889      edgetextmap[ei]->property_x().set_value(text_pos.x);
     
    889891    }
    890892
    891   for(InEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
    892     {
    893       if (mytab.mapstorage.graph.source(ei) != mytab.mapstorage.graph.target(ei))
     893  for(InEdgeIt ei((mytab.mapstorage)->graph,moved_node);ei!=INVALID;++ei)
     894    {
     895      if (mytab.mapstorage->graph.source(ei) != mytab.mapstorage->graph.target(ei))
    894896        {
    895897          XY moved_node_1(coord_x - dx, coord_y - dy);
    896898          XY moved_node_2(coord_x, coord_y);
    897           Node source = mytab.mapstorage.graph.source(ei);
    898           XY fix_node(mytab.mapstorage.coords[source].x,
    899                       mytab.mapstorage.coords[source].y);
    900           XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
     899          Node source = mytab.mapstorage->graph.source(ei);
     900          XY fix_node(mytab.mapstorage->coords[source].x,
     901                      mytab.mapstorage->coords[source].y);
     902          XY old_arrow_pos(mytab.mapstorage->arrow_pos[ei]);
    901903
    902904          XY arrow_pos;
    903905          arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
    904906
    905           mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
     907          mytab.mapstorage->arrow_pos.set(ei, arrow_pos);
    906908          edgesmap[ei]->draw();
    907909
    908910          //reposition of edgetext
    909           XY text_pos=mytab.mapstorage.arrow_pos[ei];
     911          XY text_pos=mytab.mapstorage->arrow_pos[ei];
    910912          text_pos+=(XY(10,10));
    911913          edgetextmap[ei]->property_x().set_value(text_pos.x);
  • graph_displayer_canvas-node.cc

    r179 r194  
    1717 */
    1818
    19 #include "graph_displayer_canvas.h"
     19#include <graph_displayer_canvas.h>
     20#include <mapstorage.h>
     21#include <nbtab.h>
    2022#include <cmath>
    2123
     
    2628  Graph::NodeMap<double> * actual_map;
    2729  double min, max;
    28   min=(mytab.mapstorage).minOfNodeMap(mapname);
    29   max=(mytab.mapstorage).maxOfNodeMap(mapname);
    30   actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
    31 
    32   if(node==INVALID)
    33     {
    34       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     30  min=(mytab.mapstorage)->minOfNodeMap(mapname);
     31  max=(mytab.mapstorage)->maxOfNodeMap(mapname);
     32  actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];
     33
     34  if(node==INVALID)
     35    {
     36      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    3537        {
    3638          double v=fabs((*actual_map)[i]);
     
    104106  min=node_property_defaults[N_RADIUS];
    105107  max=node_property_defaults[N_RADIUS];
    106   Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]);
     108  Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_RADIUS]);
    107109 
    108110  if(node==INVALID)
    109111    {
    110       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     112      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    111113        {
    112114          double v=fabs(actual_map[i]);
     
    168170
    169171  Graph::NodeMap<double> * actual_map;
    170   actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
     172  actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];
    171173
    172174  double max, min;
    173175
    174   max=(mytab.mapstorage).maxOfNodeMap(mapname);
    175   min=(mytab.mapstorage).minOfNodeMap(mapname);
    176 
    177   if(node==INVALID)
    178     {
    179 
    180       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     176  max=(mytab.mapstorage)->maxOfNodeMap(mapname);
     177  min=(mytab.mapstorage)->minOfNodeMap(mapname);
     178
     179  if(node==INVALID)
     180    {
     181
     182      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    181183        {
    182184          Gdk::Color color;
     
    223225  //green in RGB
    224226
    225   Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]);
     227  Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_COLOR]);
    226228
    227229  double max, min;
     
    233235    {
    234236
    235       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     237      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    236238        {
    237239          Gdk::Color color;
     
    280282
    281283  Graph::NodeMap<double> * actual_map=NULL;
    282   actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
    283 
    284   if(node==INVALID)
    285     {
    286       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     284  actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];
     285
     286  if(node==INVALID)
     287    {
     288      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    287289        {
    288290          nodemap_to_edit=mapname;
     
    317319  if(node==INVALID)
    318320    {
    319       for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     321      for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    320322        {
    321323          nodemap_to_edit="";
  • graph_displayer_canvas-zoom.cc

    r174 r194  
    1717 */
    1818
    19 #include "graph_displayer_canvas.h"
     19#include <graph_displayer_canvas.h>
    2020#include <cmath>
    2121
  • graph_displayer_canvas.cc

    r190 r194  
    1717 */
    1818
    19 #include "graph_displayer_canvas.h"
     19#include <mapstorage.h>
     20#include <nbtab.h>
     21#include <graph_displayer_canvas.h>
    2022#include <lemon/random.h>
    2123#include <cmath>
    2224
    2325GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
    24   nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
    25   nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
     26  nodesmap(mainw.mapstorage->graph), edgesmap(mainw.mapstorage->graph), edgetextmap(mainw.mapstorage->graph),
     27  nodetextmap(mainw.mapstorage->graph), displayed_graph(*(root()), 0, 0),
    2628  isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
    2729  edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10),
     
    5052    delete background;
    5153  }
    52   if (mytab.mapstorage.isBackgroundSet())
     54  if (mytab.mapstorage->isBackgroundSet())
    5355  {
    5456    background_set = true;
    5557    refBackground = Gdk::Pixbuf::create_from_file(
    56       mytab.mapstorage.getBackgroundFilename());
     58      mytab.mapstorage->getBackgroundFilename());
    5759    background = new Gnome::Canvas::Pixbuf(
    5860        *(root()),
     
    7072GraphDisplayerCanvas::~GraphDisplayerCanvas()
    7173{
    72   for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
     74  for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n)
    7375    {
    7476      delete nodesmap[n];
     
    7678    }
    7779 
    78   for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
     80  for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e)
    7981    {
    8082      delete edgesmap[e];
     
    119121      if(mapname!="")
    120122        {
    121           if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )
     123          if( ( ((mytab.mapstorage)->nodemap_storage).find(mapname) != ((mytab.mapstorage)->nodemap_storage).end() ) )
    122124            {
    123125              switch(prop)
     
    166168      if(mapname!="")
    167169        {
    168           if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )
     170          if( ( ((mytab.mapstorage)->edgemap_storage).find(mapname) != ((mytab.mapstorage)->edgemap_storage).end() ) )
    169171            {
    170172              switch(prop)
     
    208210  //first edges are drawn, to hide joining with nodes later
    209211
    210   for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    211   {
    212     if (mytab.mapstorage.graph.source(i) == mytab.mapstorage.graph.target(i))
     212  for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
     213  {
     214    if (mytab.mapstorage->graph.source(i) == mytab.mapstorage->graph.target(i))
    213215    {
    214216      edgesmap[i]=new LoopEdge(displayed_graph, i, *this);
     
    220222    //initializing edge-text as well, to empty string
    221223
    222     XY text_pos=mytab.mapstorage.arrow_pos[i];
     224    XY text_pos=mytab.mapstorage->arrow_pos[i];
    223225    text_pos+=(XY(10,10));
    224226
     
    231233  //afterwards nodes come to be drawn
    232234
    233   for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     235  for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    234236  {
    235237    //drawing bule nodes, with black line around them
     
    237239    nodesmap[i]=new Gnome::Canvas::Ellipse(
    238240        displayed_graph,
    239         (mytab.mapstorage).coords[i].x-20,
    240         (mytab.mapstorage).coords[i].y-20,
    241         (mytab.mapstorage).coords[i].x+20,
    242         (mytab.mapstorage).coords[i].y+20);
     241        (mytab.mapstorage)->coords[i].x-20,
     242        (mytab.mapstorage)->coords[i].y-20,
     243        (mytab.mapstorage)->coords[i].x+20,
     244        (mytab.mapstorage)->coords[i].y+20);
    243245    *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
    244246    *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
     
    248250
    249251    XY text_pos(
    250         ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
    251         ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
     252        ((mytab.mapstorage)->coords[i].x+node_property_defaults[N_RADIUS]+5),
     253        ((mytab.mapstorage)->coords[i].y+node_property_defaults[N_RADIUS]+5));
    252254
    253255    nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
     
    282284  forming_edge=INVALID;
    283285
    284   for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
     286  for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n)
    285287  {
    286288    delete nodesmap[n];
     
    288290  }
    289291
    290   for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
     292  for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e)
    291293  {
    292294    delete edgesmap[e];
     
    324326void GraphDisplayerCanvas::reDesignGraph()
    325327{
    326   NodeIt firstnode((mytab.mapstorage).graph);
     328  NodeIt firstnode((mytab.mapstorage)->graph);
    327329  //is it not an empty graph?
    328330  if(firstnode!=INVALID)
     
    334336      if(!was_redesigned)
    335337        {
    336           NodeIt i((mytab.mapstorage).graph);
     338          NodeIt i((mytab.mapstorage)->graph);
    337339
    338340          dim2::Point<double> init(init_vector_length*rnd(),
     
    346348      int iterations;
    347349
    348       (mytab.mapstorage).get_design_data(attraction, propulsation, iterations);
     350      (mytab.mapstorage)->get_design_data(attraction, propulsation, iterations);
    349351
    350352      //iteration counter
    351353      for(int l=0;l<iterations;l++)
    352354        {
    353           Graph::NodeMap<double> x(mytab.mapstorage.graph);
    354           Graph::NodeMap<double> y(mytab.mapstorage.graph);
     355          Graph::NodeMap<double> x(mytab.mapstorage->graph);
     356          Graph::NodeMap<double> y(mytab.mapstorage->graph);
    355357          XYMap<Graph::NodeMap<double> > actual_forces;
    356358          actual_forces.setXMap(x);
     
    358360
    359361          //count actual force for each nodes
    360           for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     362          for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
    361363            {
    362364              //propulsation of nodes
    363               for (NodeIt j((mytab.mapstorage).graph); j!=INVALID; ++j)
     365              for (NodeIt j((mytab.mapstorage)->graph); j!=INVALID; ++j)
    364366                {
    365367                  if(i!=j)
    366368                    {
    367369                      lemon::dim2::Point<double> delta =
    368                         ((mytab.mapstorage).coords[i]-
    369                          (mytab.mapstorage).coords[j]);
     370                        ((mytab.mapstorage)->coords[i]-
     371                         (mytab.mapstorage)->coords[j]);
    370372
    371373                      const double length_sqr=std::max(delta.normSquare(),min_dist);
     
    382384                }
    383385              //attraction of nodes, to which actual node is bound
    384               for(OutEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei)
     386              for(OutEdgeIt ei((mytab.mapstorage)->graph,i);ei!=INVALID;++ei)
    385387                {
    386388                  lemon::dim2::Point<double> delta =
    387                     ((mytab.mapstorage).coords[i]-
    388                      (mytab.mapstorage).coords[mytab.mapstorage.
     389                    ((mytab.mapstorage)->coords[i]-
     390                     (mytab.mapstorage)->coords[mytab.mapstorage->
    389391                                               graph.target(ei)]);
    390392               
     
    395397                  actual_forces.set(i,actual_forces[i]-delta);
    396398                }
    397               for(InEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei)
     399              for(InEdgeIt ei((mytab.mapstorage)->graph,i);ei!=INVALID;++ei)
    398400                {
    399401                  lemon::dim2::Point<double> delta =
    400                     ((mytab.mapstorage).coords[i]-
    401                      (mytab.mapstorage).coords[mytab.mapstorage.
     402                    ((mytab.mapstorage)->coords[i]-
     403                     (mytab.mapstorage)->coords[mytab.mapstorage->
    402404                                               graph.source(ei)]);
    403405               
     
    409411                }
    410412            }
    411           for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    412             {
    413               if(((mytab.mapstorage).coords[i].x)+actual_forces[i].x>max_coord)
    414                 {
    415                   actual_forces[i].x=max_coord-((mytab.mapstorage).coords[i].x);
    416                   std::cout << "Correction! " << (((mytab.mapstorage).coords[i].x)+actual_forces[i].x) << std::endl;
    417                 }
    418               else if(((mytab.mapstorage).coords[i].x)+actual_forces[i].x<(0-max_coord))
    419                 {
    420                   actual_forces[i].x=0-max_coord-((mytab.mapstorage).coords[i].x);
    421                   std::cout << "Correction! " << (((mytab.mapstorage).coords[i].x)+actual_forces[i].x) << std::endl;
    422                 }
    423               if(((mytab.mapstorage).coords[i].y)+actual_forces[i].y>max_coord)
    424                 {
    425                   actual_forces[i].y=max_coord-((mytab.mapstorage).coords[i].y);
    426                   std::cout << "Correction! " << (((mytab.mapstorage).coords[i].y)+actual_forces[i].y) << std::endl;
    427                 }
    428               else if(((mytab.mapstorage).coords[i].y)+actual_forces[i].y<(0-max_coord))
    429                 {
    430                   actual_forces[i].y=0-max_coord-((mytab.mapstorage).coords[i].y);
    431                   std::cout << "Correction! " << (((mytab.mapstorage).coords[i].y)+actual_forces[i].y) << std::endl;
     413          for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
     414            {
     415              if(((mytab.mapstorage)->coords[i].x)+actual_forces[i].x>max_coord)
     416                {
     417                  actual_forces[i].x=max_coord-((mytab.mapstorage)->coords[i].x);
     418                  std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].x)+actual_forces[i].x) << std::endl;
     419                }
     420              else if(((mytab.mapstorage)->coords[i].x)+actual_forces[i].x<(0-max_coord))
     421                {
     422                  actual_forces[i].x=0-max_coord-((mytab.mapstorage)->coords[i].x);
     423                  std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].x)+actual_forces[i].x) << std::endl;
     424                }
     425              if(((mytab.mapstorage)->coords[i].y)+actual_forces[i].y>max_coord)
     426                {
     427                  actual_forces[i].y=max_coord-((mytab.mapstorage)->coords[i].y);
     428                  std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].y)+actual_forces[i].y) << std::endl;
     429                }
     430              else if(((mytab.mapstorage)->coords[i].y)+actual_forces[i].y<(0-max_coord))
     431                {
     432                  actual_forces[i].y=0-max_coord-((mytab.mapstorage)->coords[i].y);
     433                  std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].y)+actual_forces[i].y) << std::endl;
    432434                }
    433435              moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i);
  • graph_displayer_canvas.h

    r187 r194  
    2020#define GRAPH_DISPLAYER_CANVAS_H
    2121
    22 class GraphDisplayerCanvas;
     22class NoteBookTab;
    2323
    2424#include "all_include.h"
    25 #include "nbtab.h"
    2625#include <libgnomecanvasmm.h>
    2726#include <libgnomecanvasmm/polygon.h>
    28 #include <lemon/dim2.h>
    2927
    3028///This class is the canvas, on which the graph can be drawn.
  • gui_reader.cc

    r177 r194  
    1717 */
    1818
    19 #include "gui_reader.h"
    20 #include "xml.h"
    21 #include "mapstorage.h"
     19#include <gui_reader.h>
     20#include <mapstorage.h>
     21
     22#include <xml.h>
    2223#include <lemon/dim2.h>
    2324#include <vector>
  • gui_reader.h

    r174 r194  
    1919#ifndef GUI_READER_H
    2020#define GUI_READER_H
     21#include <lemon/lemon_reader.h>
    2122
    22 #include "mapstorage.h"
    23 #include <lemon/lemon_reader.h>
     23class MapStorage;
    2424
    2525using lemon::LemonReader;
  • gui_writer.cc

    r177 r194  
    1717 */
    1818
    19 #include "gui_writer.h"
    20 #include "xml.h"
    21 #include "mapstorage.h"
     19#include <xml.h>
    2220#include <lemon/dim2.h>
    2321#include <vector>
     22
     23#include <gui_writer.h>
     24#include <mapstorage.h>
    2425
    2526std::string GuiWriter::header()
  • gui_writer.h

    r174 r194  
    2020#define GUI_WRITER_H
    2121
    22 #include "mapstorage.h"
    2322#include <lemon/lemon_writer.h>
     23
     24class MapStorage;
    2425
    2526using lemon::LemonWriter;
  • kruskalbox.cc

    r174 r194  
    1717 */
    1818
     19#include <lemon/kruskal.h>
     20
     21#include <mapstorage.h>
     22#include <mapselector.h>
     23#include <algobox.h>
    1924#include <kruskalbox.h>
    2025
  • kruskalbox.h

    r174 r194  
    2020#define KRUSKALBOX_H
    2121
    22 class KruskalBox;
     22class AlgoBox;
    2323
    2424#include <all_include.h>
    25 #include <algobox.h>
    26 #include <lemon/kruskal.h>
    2725#include <libgnomecanvasmm.h>
    2826#include <libgnomecanvasmm/polygon.h>
  • main_win.cc

    r191 r194  
    2121#endif
    2222
    23 #include "main_win.h"
    24 #include "guipixbufs.h"
    25 #include "background_chooser_dialog.h"
     23#include <main_win.h>
     24#include <guipixbufs.h>
     25#include <background_chooser_dialog.h>
     26
     27#include <mapstorage.h>
     28#include <graph_displayer_canvas.h>
     29#include <algowin.h>
     30#include <new_map_win.h>
     31#include <nbtab.h>
    2632
    2733#include "i18n.h"
     
    365371  if(active_tab!=-1)
    366372    {
    367       if (tabs[active_tab]->mapstorage.modified)
     373      if (tabs[active_tab]->mapstorage->modified)
    368374        {
    369375          Gtk::MessageDialog mdialog(_("<b>Save changes before closing?</b>"), true,
     
    554560    {
    555561    }
    556   awp->update_maplist(&(tabs[i]->mapstorage));
     562  awp->update_maplist(tabs[i]->mapstorage);
    557563}
    558564
     
    633639void MainWin::createBackgroundChooser()
    634640{
    635   BackgroundChooserDialog dialog(&(tabs[active_tab]->mapstorage));
     641  BackgroundChooserDialog dialog(tabs[active_tab]->mapstorage);
    636642  dialog.run();
    637643}
  • main_win.h

    r191 r194  
    2121
    2222#include "all_include.h"
    23 #include "algowin.h"
    24 #include "map_win.h"
    25 #include "new_map_win.h"
    26 #include "nbtab.h"
    2723#include <libgnomecanvasmm.h>
    2824#include <libgnomecanvasmm/polygon.h>
    2925
     26class AlgoWin;
     27class NoteBookTab;
    3028
    3129///This class is the main window of GUI.
  • map_win.cc

    r174 r194  
    1717 */
    1818
    19 #include "map_win.h"
     19#include <map_win.h>
     20#include <nbtab.h>
     21#include <mapselector.h>
    2022#include <set>
    2123
  • map_win.h

    r174 r194  
    2020#define MAP_WIN_H
    2121
    22 class MapWin;
     22class NoteBookTab;
     23class MapSelector;
    2324
    2425#include <all_include.h>
    25 #include <nbtab.h>
    26 #include <mapselector.h>
    2726#include <libgnomecanvasmm.h>
    2827#include <libgnomecanvasmm/polygon.h>
  • mapselector.cc

    r174 r194  
    1717 */
    1818
    19 #include "mapselector.h"
     19#include <mapselector.h>
    2020
    2121MapSelector::MapSelector(std::vector<std::string> ml, std::string act, std::string labeltext, bool edge, bool d):def(d),itisedge(edge),set_new_map(false)
  • mapselector.h

    r174 r194  
    2020#define MAPSELECTOR_H
    2121
    22 class MapSelector;
    23 
    2422#include <all_include.h>
    25 #include <map_win.h>
    2623#include <libgnomecanvasmm.h>
    2724#include <libgnomecanvasmm/polygon.h>
  • mapstorage.cc

    r191 r194  
    1717 */
    1818
    19 #include "mapstorage.h"
    20 #include "nbtab.h"
    21 #include "gui_writer.h"
    22 #include "gui_reader.h"
    2319#include <limits>
    2420#include <cmath>
    2521#include <gtkmm.h>
    26 #include<lemon/graph_to_eps.h>
     22
     23#include <mapstorage.h>
     24#include <graph_displayer_canvas.h> //kivenni
     25#include <nbtab.h> //kivenni
     26#include <gui_writer.h>
     27#include <gui_reader.h>
     28#include <lemon/graph_to_eps.h>
    2729
    2830const int i_d=20;
  • mapstorage.h

    r191 r194  
    2020#define MAPSTORAGE_H
    2121
    22 class Mapstorage;
    23 
    24 #include "all_include.h"
    25 #include "xymap.h"
     22#include <all_include.h>
     23#include <xymap.h>
    2624#include <libgnomecanvasmm.h>
    2725
  • nbtab.cc

    r191 r194  
    1818
    1919#include <nbtab.h>
     20#include <mapstorage.h>
    2021#include <eps_win.h>
    21 
    22 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this)
    23 {
     22#include <map_win.h>
     23#include <design_win.h>
     24#include <graph_displayer_canvas.h>
     25
     26
     27
     28NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false)
     29{
     30  mapstorage=new MapStorage(*this);
     31
    2432  Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
    2533  gd_canvas=new GraphDisplayerCanvas(*this);
     
    2836
    2937  //connecting signals - controller character
    30   mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
    31   mapstorage.signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
    32   mapstorage.signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
     38  mapstorage->signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
     39  mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
     40  mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
    3341  show_all_children();
    3442  show();
     
    3745void NoteBookTab::readFile(const std::string &file)
    3846{
    39   mapstorage.readFromFile(file);
    40   mapstorage.file_name = file;
    41   mapstorage.modified = false;
     47  mapstorage->readFromFile(file);
     48  mapstorage->file_name = file;
     49  mapstorage->modified = false;
    4250  gd_canvas->drawGraph();
    4351  if(mapwinexists)
    4452    {
    45       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     53      mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    4654    }
    4755  signal_title.emit(Glib::filename_display_basename(file));
     
    5058void NoteBookTab::newFile()
    5159{
    52   if (mapstorage.modified)
     60  if (mapstorage->modified)
    5361  {
    5462    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     
    6977  }
    7078  gd_canvas->clear();
    71   mapstorage.clear();
    72   if(mapwinexists)
    73     {
    74       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     79  mapstorage->clear();
     80  if(mapwinexists)
     81    {
     82      mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    7583    }
    7684  signal_title.emit("unsaved file");
     
    7987void NoteBookTab::openFile()
    8088{
    81   if (mapstorage.modified)
     89  if (mapstorage->modified)
    8290  {
    8391    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     
    103111  {
    104112    gd_canvas->clear();
    105     mapstorage.clear();
     113    mapstorage->clear();
    106114    Glib::ustring filename = fcdialog.get_filename();
    107     if (!mapstorage.readFromFile(filename))
    108     {
    109       mapstorage.file_name = filename;
    110       mapstorage.modified = false;
     115    if (!mapstorage->readFromFile(filename))
     116    {
     117      mapstorage->file_name = filename;
     118      mapstorage->modified = false;
    111119      gd_canvas->drawGraph();
    112120      if(mapwinexists)
    113121        {
    114           mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     122          mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    115123        }
    116124      signal_title.emit(Glib::filename_display_basename(filename));
     
    121129void NoteBookTab::saveFile()
    122130{
    123   if (mapstorage.file_name == "") {
     131  if (mapstorage->file_name == "") {
    124132    saveFileAs();
    125133  }
    126134  else
    127135  {
    128     mapstorage.writeToFile(mapstorage.file_name);
    129     mapstorage.modified = false;
    130     signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
     136    mapstorage->writeToFile(mapstorage->file_name);
     137    mapstorage->modified = false;
     138    signal_title.emit(Glib::filename_display_basename(mapstorage->file_name));
    131139  }
    132140}
     
    140148  {
    141149    Glib::ustring filename = fcdialog.get_filename();
    142     mapstorage.file_name = filename;
    143     mapstorage.writeToFile(filename);
    144     mapstorage.modified = false;
     150    mapstorage->file_name = filename;
     151    mapstorage->writeToFile(filename);
     152    mapstorage->modified = false;
    145153    signal_title.emit(Glib::filename_display_basename(filename));
    146154  }
     
    149157void NoteBookTab::close()
    150158{
    151   if (mapstorage.modified)
     159  if (mapstorage->modified)
    152160  {
    153161    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     
    168176  }
    169177  gd_canvas->clear();
    170   mapstorage.clear();
    171   if(mapwinexists)
    172     {
    173       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     178  mapstorage->clear();
     179  if(mapwinexists)
     180    {
     181      mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    174182    }
    175183  signal_title.emit("unsaved file");
     
    178186void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
    179187{
    180   mapstorage.changeActiveMap(itisedge, prop, mapname);
     188  mapstorage->changeActiveMap(itisedge, prop, mapname);
    181189}
    182190
     
    193201std::string NoteBookTab::getActiveEdgeMap(int prop)
    194202{
    195   return mapstorage.getActiveEdgeMap(prop);
     203  return mapstorage->getActiveEdgeMap(prop);
    196204}
    197205
    198206std::string NoteBookTab::getActiveNodeMap(int prop)
    199207{
    200   return mapstorage.getActiveNodeMap(prop);
     208  return mapstorage->getActiveNodeMap(prop);
    201209}
    202210
     
    221229  if(!mapwinexists)
    222230    {
    223       mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
    224       mapst2mapwin=mapstorage.signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
     231      mapwin=new MapWin("Map Setup - "+name, mapstorage->getEdgeMapList(), mapstorage->getNodeMapList(), *this);
     232      mapst2mapwin=mapstorage->signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
    225233      mapwin->show();
    226234      mapwinexists=true;
     
    245253      double attraction, propulsation;
    246254      int iterations;
    247       mapstorage.get_design_data(attraction, propulsation, iterations);
     255      mapstorage->get_design_data(attraction, propulsation, iterations);
    248256      designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this);
    249257
     
    255263      designwin->signal_delete_event().connect(sigc::mem_fun(*this, &NoteBookTab::closeDesignWin));
    256264
    257       mapst2designwin=mapstorage.signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
     265      mapst2designwin=mapstorage->signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
    258266
    259267      designwin->show();
     
    307315void NoteBookTab::active_maps_needed()
    308316{
    309   mapstorage.broadcastActiveMaps();
     317  mapstorage->broadcastActiveMaps();
    310318}
    311319
    312320void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
    313321{
    314   mapstorage.exportGraphToEPS(options, filename);
    315 }
     322  mapstorage->exportGraphToEPS(options, filename);
     323}
  • nbtab.h

    r191 r194  
    2020#define NBTAB_H
    2121
    22 class NoteBookTab;
    23 
    24 #include "mapstorage.h"
    25 #include "map_win.h"
    26 //#include "eps_win.h"
     22class MapStorage;
    2723class EpsWin;
    28 #include "design_win.h"
    29 #include "graph_displayer_canvas.h"
     24class MapWin;
     25class DesignWin;
     26class GraphDisplayerCanvas;
     27
    3028#include <libgnomecanvasmm.h>
    3129#include <libgnomecanvasmm/polygon.h>
     
    6058 
    6159  ///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook.
    62   MapStorage mapstorage;
     60  MapStorage * mapstorage;
    6361   
    6462  ///Title changement indicator.
  • new_map_win.cc

    r174 r194  
    1818
    1919#include <new_map_win.h>
     20#include <nbtab.h>
     21#include <mapstorage.h>
    2022
    2123bool NewMapWin::closeIfEscapeIsPressed(GdkEventKey* e)
     
    120122            {
    121123              //create the new map
    122               Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage.graph, def_val);
     124              Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage->graph, def_val);
    123125             
    124126              if(!only_nums)
     
    126128                  std::stack<double> polishstack;
    127129                 
    128                   for(EdgeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
     130                  for(EdgeIt k(mytab.mapstorage->graph); k!=INVALID; ++k)
    129131                    {
    130132                      for(int i=0;i<(int)polishform.size();i++)
     
    145147                            default:
    146148                              //substitute variable
    147                               std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage.edgemap_storage;
     149                              std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage->edgemap_storage;
    148150                              bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
    149151                              if(itisvar)
    150152                                {
    151                                   polishstack.push( (*(mytab.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
     153                                  polishstack.push( (*(mytab.mapstorage->edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
    152154                                }
    153155                              else
     
    188190              //if addition was not successful addEdgeMap returns one.
    189191              //cause can be that there is already a map named like the new one
    190               if(mytab.mapstorage.addEdgeMap(mapname, emptr, def_val))
     192              if(mytab.mapstorage->addEdgeMap(mapname, emptr, def_val))
    191193                {
    192194                  abortion=1;
     
    203205            {
    204206              //create the new map
    205               Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage.graph, def_val);
     207              Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage->graph, def_val);
    206208
    207209              if(!only_nums)
     
    209211                  std::stack<double> polishstack;
    210212 
    211                   for(NodeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
     213                  for(NodeIt k(mytab.mapstorage->graph); k!=INVALID; ++k)
    212214                    {
    213215                      for(int i=0;i<(int)polishform.size();i++)
     
    227229                              break;
    228230                            default:
    229                               std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage.nodemap_storage;
     231                              std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage->nodemap_storage;
    230232                              bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
    231233                              if(itisvar)
    232234                                {
    233                                   polishstack.push( (*(mytab.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
     235                                  polishstack.push( (*(mytab.mapstorage->nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
    234236                                }
    235237                              else
     
    269271              //if addition was not successful addNodeMap returns one.
    270272              //cause can be that there is already a map named like the new one
    271               if(mytab.mapstorage.addNodeMap(mapname,emptr, def_val))
     273              if(mytab.mapstorage->addNodeMap(mapname,emptr, def_val))
    272274                {
    273275                  abortion=1;
     
    480482  if(itisedge)
    481483    {
    482       cancel=(mytab.mapstorage.edgemap_storage.find(variable)==mytab.mapstorage.edgemap_storage.end());
     484      cancel=(mytab.mapstorage->edgemap_storage.find(variable)==mytab.mapstorage->edgemap_storage.end());
    483485    }
    484486  else
    485487    {
    486       cancel=(mytab.mapstorage.nodemap_storage.find(variable)==mytab.mapstorage.nodemap_storage.end());
     488      cancel=(mytab.mapstorage->nodemap_storage.find(variable)==mytab.mapstorage->nodemap_storage.end());
    487489    }
    488490  //maybe it is number
  • new_map_win.h

    r174 r194  
    2020#define NEWMAPWIN_H
    2121
    22 class NewMapWin;
    23 
    2422#include <all_include.h>
    25 #include <nbtab.h>
    2623#include <libgnomecanvasmm.h>
    2724#include <libgnomecanvasmm/polygon.h>
    2825#include <stack>
     26
     27class NoteBookTab;
    2928
    3029///Graphical interface for node/edge map creation.
Note: See TracChangeset for help on using the changeset viewer.