[Lemon-commits] ladanyi: r3382 - glemon/branches/akos
Lemon SVN
svn at lemon.cs.elte.hu
Sun Nov 18 01:54:36 CET 2007
Author: ladanyi
Date: Sun Nov 18 01:54:33 2007
New Revision: 3382
Modified:
glemon/branches/akos/algobox.cc
glemon/branches/akos/algobox.h
glemon/branches/akos/algowin.cc
glemon/branches/akos/algowin.h
glemon/branches/akos/background_chooser_dialog.cc
glemon/branches/akos/design_win.cc
glemon/branches/akos/design_win.h
glemon/branches/akos/dijkstrabox.h
glemon/branches/akos/eps_win.cc
glemon/branches/akos/eps_win.h
glemon/branches/akos/gdc-broken_edge.cc
glemon/branches/akos/graph-displayer.cc
glemon/branches/akos/graph_displayer_canvas-edge.cc
glemon/branches/akos/graph_displayer_canvas-event.cc
glemon/branches/akos/graph_displayer_canvas-node.cc
glemon/branches/akos/graph_displayer_canvas-zoom.cc
glemon/branches/akos/graph_displayer_canvas.cc
glemon/branches/akos/graph_displayer_canvas.h
glemon/branches/akos/gui_reader.cc
glemon/branches/akos/gui_reader.h
glemon/branches/akos/gui_writer.cc
glemon/branches/akos/gui_writer.h
glemon/branches/akos/kruskalbox.cc
glemon/branches/akos/kruskalbox.h
glemon/branches/akos/main_win.cc
glemon/branches/akos/main_win.h
glemon/branches/akos/map_win.cc
glemon/branches/akos/map_win.h
glemon/branches/akos/mapselector.cc
glemon/branches/akos/mapselector.h
glemon/branches/akos/mapstorage.cc
glemon/branches/akos/nbtab.cc
glemon/branches/akos/nbtab.h
glemon/branches/akos/new_map_win.cc
glemon/branches/akos/new_map_win.h
Log:
Ported r3205 from trunk.
Modified: glemon/branches/akos/algobox.cc
==============================================================================
--- glemon/branches/akos/algobox.cc (original)
+++ glemon/branches/akos/algobox.cc Sun Nov 18 01:54:33 2007
@@ -17,6 +17,8 @@
*/
#include <algobox.h>
+#include <mapstorage.h>
+#include <mapselector.h>
enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
Modified: glemon/branches/akos/algobox.h
==============================================================================
--- glemon/branches/akos/algobox.h (original)
+++ glemon/branches/akos/algobox.h Sun Nov 18 01:54:33 2007
@@ -19,11 +19,10 @@
#ifndef ALGOBOX_H
#define ALGOBOX_H
-class AlgoBox;
+class MapStorage;
+class MapSelector;
#include <all_include.h>
-#include <mapstorage.h>
-#include <mapselector.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/algowin.cc
==============================================================================
--- glemon/branches/akos/algowin.cc (original)
+++ glemon/branches/akos/algowin.cc Sun Nov 18 01:54:33 2007
@@ -17,6 +17,7 @@
*/
#include <algowin.h>
+#include <algobox.h>
#include <kruskalbox.h>
#include <dijkstrabox.h>
Modified: glemon/branches/akos/algowin.h
==============================================================================
--- glemon/branches/akos/algowin.h (original)
+++ glemon/branches/akos/algowin.h Sun Nov 18 01:54:33 2007
@@ -19,14 +19,11 @@
#ifndef ALGOWIN_H
#define ALGOWIN_H
-class AlgoWin;
-
#include <all_include.h>
-//#include <mapstorage.h>
-#include <algobox.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
+class AlgoBox;
class MapStorage;
///Algorithm identifiers.
Modified: glemon/branches/akos/background_chooser_dialog.cc
==============================================================================
--- glemon/branches/akos/background_chooser_dialog.cc (original)
+++ glemon/branches/akos/background_chooser_dialog.cc Sun Nov 18 01:54:33 2007
@@ -1,6 +1,6 @@
-#include "background_chooser_dialog.h"
+#include <background_chooser_dialog.h>
#include <gtkmm/stock.h>
-#include "mapstorage.h"
+#include <mapstorage.h>
BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
mapstorage(ms),
Modified: glemon/branches/akos/design_win.cc
==============================================================================
--- glemon/branches/akos/design_win.cc (original)
+++ glemon/branches/akos/design_win.cc Sun Nov 18 01:54:33 2007
@@ -16,6 +16,7 @@
*
*/
+#include <nbtab.h>
#include <design_win.h>
bool DesignWin::closeIfEscapeIsPressed(GdkEventKey* e)
Modified: glemon/branches/akos/design_win.h
==============================================================================
--- glemon/branches/akos/design_win.h (original)
+++ glemon/branches/akos/design_win.h Sun Nov 18 01:54:33 2007
@@ -19,10 +19,9 @@
#ifndef DESWIN_H
#define DESWIN_H
-class DesignWin;
+class NoteBookTab;
#include <all_include.h>
-#include <nbtab.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/dijkstrabox.h
==============================================================================
--- glemon/branches/akos/dijkstrabox.h (original)
+++ glemon/branches/akos/dijkstrabox.h Sun Nov 18 01:54:33 2007
@@ -19,10 +19,9 @@
#ifndef DIJKSTRABOX_H
#define DIJKSTRABOX_H
-class DijkstraBox;
+class AlgoBox;
#include <all_include.h>
-#include <algobox.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/eps_win.cc
==============================================================================
--- glemon/branches/akos/eps_win.cc (original)
+++ glemon/branches/akos/eps_win.cc Sun Nov 18 01:54:33 2007
@@ -16,7 +16,8 @@
*
*/
-#include "eps_win.h"
+#include <nbtab.h>
+#include <eps_win.h>
#include <set>
bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
Modified: glemon/branches/akos/eps_win.h
==============================================================================
--- glemon/branches/akos/eps_win.h (original)
+++ glemon/branches/akos/eps_win.h Sun Nov 18 01:54:33 2007
@@ -19,11 +19,9 @@
#ifndef EPS_WIN_H
#define EPS_WIN_H
-class EpsWin;
+class NoteBookTab;
#include <all_include.h>
-#include <nbtab.h>
-#include <mapselector.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/gdc-broken_edge.cc
==============================================================================
--- glemon/branches/akos/gdc-broken_edge.cc (original)
+++ glemon/branches/akos/gdc-broken_edge.cc Sun Nov 18 01:54:33 2007
@@ -16,7 +16,9 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
GraphDisplayerCanvas::EdgeBase::EdgeBase(Gnome::Canvas::Group& _group, Edge _edge, GraphDisplayerCanvas& _canvas) :
@@ -33,7 +35,7 @@
void GraphDisplayerCanvas::EdgeBase::drawArrow(XY unit_vector_in_dir)
{
- MapStorage& ms = canvas.mytab.mapstorage;
+ MapStorage& ms = *canvas.mytab.mapstorage;
XY center(ms.getArrowCoords(edge));
XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
@@ -84,7 +86,7 @@
void GraphDisplayerCanvas::BrokenEdge::draw()
{
- MapStorage& ms = canvas.mytab.mapstorage;
+ MapStorage& ms = *canvas.mytab.mapstorage;
//calculating coordinates of the direction indicator arrow
XY head(ms.getNodeCoords(ms.graph.target(edge)));
@@ -150,10 +152,10 @@
Gnome::Canvas::Points points_new;
- canvas.mytab.mapstorage.setArrowCoords(edge, canvas.mytab.mapstorage.getArrowCoords(edge) + XY(dx, dy));
+ canvas.mytab.mapstorage->setArrowCoords(edge, canvas.mytab.mapstorage->getArrowCoords(edge) + XY(dx, dy));
draw();
- canvas.textReposition(canvas.mytab.mapstorage.getArrowCoords(edge));
+ canvas.textReposition(canvas.mytab.mapstorage->getArrowCoords(edge));
clicked_x=e->motion.x;
clicked_y=e->motion.y;
@@ -194,7 +196,7 @@
void GraphDisplayerCanvas::LoopEdge::draw()
{
- MapStorage& ms = canvas.mytab.mapstorage;
+ MapStorage& ms = *canvas.mytab.mapstorage;
Node node = ms.graph.source(edge);
XY center = (ms.getNodeCoords(node) + ms.getArrowCoords(edge)) / 2.0;
@@ -247,10 +249,10 @@
case GDK_MOTION_NOTIFY:
if(isbutton)
{
- canvas.mytab.mapstorage.setArrowCoords(edge, XY(e->motion.x, e->motion.y));
+ canvas.mytab.mapstorage->setArrowCoords(edge, XY(e->motion.x, e->motion.y));
draw();
- canvas.textReposition(canvas.mytab.mapstorage.getArrowCoords(edge));
+ canvas.textReposition(canvas.mytab.mapstorage->getArrowCoords(edge));
}
default: break;
}
Modified: glemon/branches/akos/graph-displayer.cc
==============================================================================
--- glemon/branches/akos/graph-displayer.cc (original)
+++ glemon/branches/akos/graph-displayer.cc Sun Nov 18 01:54:33 2007
@@ -21,7 +21,6 @@
#endif
#include "all_include.h"
-#include "mapstorage.h"
#include "main_win.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/graph_displayer_canvas-edge.cc
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas-edge.cc (original)
+++ glemon/branches/akos/graph_displayer_canvas-edge.cc Sun Nov 18 01:54:33 2007
@@ -16,22 +16,25 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
const int minimum_edge_width=0;
int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
{
+ MapStorage& ms = *mytab.mapstorage;
double min, max;
min=edge_property_defaults[E_WIDTH];
max=edge_property_defaults[E_WIDTH];
- Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
+ Graph::EdgeMap<double> actual_map(ms.graph,edge_property_defaults[E_WIDTH]);
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
double v=fabs(actual_map[i]);
int w;
@@ -65,25 +68,26 @@
int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
{
+ MapStorage& ms = *mytab.mapstorage;
double min, max;
{
- EdgeIt e(mytab.mapstorage.graph);
- min = max = mytab.mapstorage.get(mapname, e);
+ EdgeIt e(ms.graph);
+ min = max = ms.get(mapname, e);
for (; e != INVALID; ++e)
{
- if (static_cast<double>(mytab.mapstorage.get(mapname, e)) > max)
- max = mytab.mapstorage.get(mapname, e);
- if (static_cast<double>(mytab.mapstorage.get(mapname, e)) < min)
- min = mytab.mapstorage.get(mapname, e);
+ if (static_cast<double>(ms.get(mapname, e)) > max)
+ max = ms.get(mapname, e);
+ if (static_cast<double>(ms.get(mapname, e)) < min)
+ min = ms.get(mapname, e);
}
}
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
- double v=mytab.mapstorage.get(mapname, i);
+ double v=ms.get(mapname, i);
int w;
if(autoscale)
{
@@ -122,7 +126,7 @@
}
else
{
- int w=(int)mytab.mapstorage.get(mapname, edge);
+ int w=(int)ms.get(mapname, edge);
if(w>=0)
{
edgesmap[edge]->setLineWidth(w);
@@ -133,6 +137,7 @@
int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Edge edge)
{
+ MapStorage& ms = *mytab.mapstorage;
//function maps the range of the maximum and
//the minimum of the nodemap to the range of
@@ -141,22 +146,22 @@
double max, min;
{
- EdgeIt e(mytab.mapstorage.graph);
- min = max = mytab.mapstorage.get(mapname, e);
+ EdgeIt e(ms.graph);
+ min = max = ms.get(mapname, e);
for (; e != INVALID; ++e)
{
- if (static_cast<double>(mytab.mapstorage.get(mapname, e)) > max)
- max = mytab.mapstorage.get(mapname, e);
- if (static_cast<double>(mytab.mapstorage.get(mapname, e)) < min)
- min = mytab.mapstorage.get(mapname, e);
+ if (static_cast<double>(ms.get(mapname, e)) > max)
+ max = ms.get(mapname, e);
+ if (static_cast<double>(ms.get(mapname, e)) < min)
+ min = ms.get(mapname, e);
}
}
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
- double w=mytab.mapstorage.get(mapname, i);
+ double w=ms.get(mapname, i);
Gdk::Color color;
if(max!=min)
@@ -174,7 +179,7 @@
{
Gdk::Color color;
- double w=mytab.mapstorage.get(mapname, edge);
+ double w=ms.get(mapname, edge);
if(max!=min)
{
@@ -192,11 +197,12 @@
int GraphDisplayerCanvas::resetEdgeColor (Edge edge)
{
+ MapStorage& ms = *mytab.mapstorage;
//function maps the range of the maximum and
//the minimum of the nodemap to the range of
//green in RGB
- Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
+ Graph::EdgeMap<double> actual_map(ms.graph,edge_property_defaults[E_COLOR]);
double max, min;
@@ -205,7 +211,7 @@
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
double w=actual_map[i];
@@ -243,6 +249,8 @@
int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Edge edge)
{
+ MapStorage& ms = *mytab.mapstorage;
+
//the number in the map will be written on the edge
//EXCEPT when the name of the map is Default, because
//in that case empty string will be written, because
@@ -250,27 +258,28 @@
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
edgemap_to_edit=mapname;
edgetextmap[i]->property_text().set_value(
- static_cast<std::string>(mytab.mapstorage.get(mapname, i)));
+ static_cast<std::string>(ms.get(mapname, i)));
}
}
else
{
edgetextmap[edge]->property_text().set_value(
- static_cast<std::string>(mytab.mapstorage.get(mapname, edge)));
+ static_cast<std::string>(ms.get(mapname, edge)));
}
return 0;
-
};
int GraphDisplayerCanvas::resetEdgeText (Edge edge)
{
+ MapStorage& ms = *mytab.mapstorage;
+
//the number in the map will be written on the edge
//EXCEPT when the name of the map is Default, because
//in that case empty string will be written, because
@@ -278,12 +287,11 @@
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
edgemap_to_edit="";
edgetextmap[i]->property_text().set_value("");
}
-
}
else
{
@@ -291,5 +299,4 @@
}
return 0;
-
};
Modified: glemon/branches/akos/graph_displayer_canvas-event.cc
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas-event.cc (original)
+++ glemon/branches/akos/graph_displayer_canvas-event.cc Sun Nov 18 01:54:33 2007
@@ -16,7 +16,9 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
@@ -136,6 +138,8 @@
bool GraphDisplayerCanvas::moveEventHandler(GdkEvent* e)
{
+ MapStorage& ms = *mytab.mapstorage;
+
static Gnome::Canvas::Text *coord_text = 0;
switch(e->type)
{
@@ -145,7 +149,7 @@
active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
if(nodesmap[i]==active_item)
{
@@ -168,7 +172,7 @@
//we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
if(active_node!=INVALID)
{
- mytab.mapstorage.setModified();
+ ms.setModified();
//new coordinates will be the old values,
//because the item will be moved to the
@@ -190,8 +194,8 @@
// reposition the coordinates text
std::ostringstream ostr;
ostr << "(" <<
- mytab.mapstorage.getNodeCoords(active_node).x << ", " <<
- mytab.mapstorage.getNodeCoords(active_node).y << ")";
+ ms.getNodeCoords(active_node).x << ", " <<
+ ms.getNodeCoords(active_node).y << ")";
double radius =
(nodesmap[active_node]->property_x2().get_value() -
nodesmap[active_node]->property_x1().get_value()) / 2.0;
@@ -199,16 +203,16 @@
{
coord_text->property_text().set_value(ostr.str());
coord_text->property_x().set_value(
- mytab.mapstorage.getNodeCoords(active_node).x + radius);
+ ms.getNodeCoords(active_node).x + radius);
coord_text->property_y().set_value(
- mytab.mapstorage.getNodeCoords(active_node).y - radius);
+ ms.getNodeCoords(active_node).y - radius);
}
else
{
coord_text = new Gnome::Canvas::Text(
displayed_graph,
- mytab.mapstorage.getNodeCoords(active_node).x + radius,
- mytab.mapstorage.getNodeCoords(active_node).y - radius,
+ ms.getNodeCoords(active_node).x + radius,
+ ms.getNodeCoords(active_node).y - radius,
ostr.str());
coord_text->property_fill_color().set_value("black");
coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
@@ -285,6 +289,8 @@
bool GraphDisplayerCanvas::createNodeEventHandler(GdkEvent* e)
{
+ MapStorage& ms = *mytab.mapstorage;
+
switch(e->type)
{
//move the new node
@@ -299,7 +305,7 @@
}
case GDK_BUTTON_RELEASE:
- mytab.mapstorage.setModified();
+ ms.setModified();
is_drawn=true;
@@ -307,7 +313,7 @@
window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
- active_node = mytab.mapstorage.addNode(XY(clicked_x, clicked_y));
+ active_node = ms.addNode(XY(clicked_x, clicked_y));
nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
@@ -342,6 +348,8 @@
bool GraphDisplayerCanvas::createEdgeEventHandler(GdkEvent* e)
{
+ MapStorage& ms = *mytab.mapstorage;
+
switch(e->type)
{
case GDK_BUTTON_PRESS:
@@ -357,7 +365,7 @@
active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
if(nodesmap[i]==active_item)
{
@@ -386,7 +394,7 @@
window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
target_item=(get_item_at(clicked_x, clicked_y));
Node target_node=INVALID;
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
if(nodesmap[i]==target_item)
{
@@ -396,12 +404,12 @@
//the clicked item is a node, the edge can be drawn
if(target_node!=INVALID)
{
- mytab.mapstorage.setModified();
+ ms.setModified();
*(nodesmap[target_node]) <<
Gnome::Canvas::Properties::fill_color("red");
- active_edge = mytab.mapstorage.addEdge(active_node, target_node);
+ active_edge = ms.addEdge(active_node, target_node);
if(target_node!=active_node)
{
@@ -413,7 +421,7 @@
}
//initializing edge-text as well, to empty string
- XY text_pos=mytab.mapstorage.getArrowCoords(active_edge);
+ XY text_pos=ms.getArrowCoords(active_edge);
text_pos+=(XY(10,10));
edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
@@ -447,7 +455,7 @@
}
if(target_item)
{
- propertyUpdate((mytab.mapstorage).graph.target(active_edge),N_COLOR);
+ propertyUpdate(ms.graph.target(active_edge),N_COLOR);
target_item=NULL;
}
active_node=INVALID;
@@ -462,6 +470,8 @@
bool GraphDisplayerCanvas::eraserEventHandler(GdkEvent* e)
{
+ MapStorage& ms = *mytab.mapstorage;
+
switch(e->type)
{
case GDK_BUTTON_PRESS:
@@ -471,7 +481,7 @@
active_node=INVALID;
active_edge=INVALID;
//was it a node?
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
if(nodesmap[i]==active_item)
{
@@ -481,7 +491,7 @@
//or was it an edge?
if(active_node==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
if(edgesmap[i]->getLine()==active_item)
{
@@ -510,16 +520,16 @@
//a node was found
if(active_node!=INVALID)
{
- mytab.mapstorage.setModified();
+ ms.setModified();
std::set<Graph::Edge> edges_to_delete;
- for(OutEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
+ for(OutEdgeIt e(ms.graph,active_node);e!=INVALID;++e)
{
edges_to_delete.insert(e);
}
- for(InEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
+ for(InEdgeIt e(ms.graph,active_node);e!=INVALID;++e)
{
edges_to_delete.insert(e);
}
@@ -570,6 +580,8 @@
bool GraphDisplayerCanvas::mapEditEventHandler(GdkEvent* e)
{
+ MapStorage& ms = *mytab.mapstorage;
+
if(actual_tool==MAP_EDIT)
{
switch(e->type)
@@ -585,7 +597,7 @@
active_item=(get_item_at(clicked_x, clicked_y));
//find the activated item between text of nodes
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if(nodetextmap[i]==active_item)
@@ -597,7 +609,7 @@
//if there was not, search for it between nodes
if(clicked_node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if(nodesmap[i]==active_item)
@@ -610,7 +622,7 @@
if(clicked_node==INVALID)
{
//find the activated item between texts
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if(edgetextmap[i]==active_item)
@@ -622,7 +634,7 @@
//if it was not between texts, search for it between edges
if(clicked_edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(ms.graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if((edgesmap[i]->getLine())==active_item)
@@ -671,19 +683,19 @@
case Gtk::RESPONSE_CANCEL:
break;
case Gtk::RESPONSE_ACCEPT:
- switch (mytab.mapstorage.getNodeMapElementType(nodemap_to_edit))
+ switch (ms.getNodeMapElementType(nodemap_to_edit))
{
case MapValue::NUMERIC:
- mytab.mapstorage.set(nodemap_to_edit, active_node,
+ ms.set(nodemap_to_edit, active_node,
atof(entry.get_text().c_str()));
break;
case MapValue::STRING:
- mytab.mapstorage.set(nodemap_to_edit, active_node,
+ ms.set(nodemap_to_edit, active_node,
static_cast<std::string>(entry.get_text()));
break;
}
nodetextmap[active_node]->property_text().set_value(
- static_cast<std::string>(mytab.mapstorage.get(nodemap_to_edit, active_node)));
+ static_cast<std::string>(ms.get(nodemap_to_edit, active_node)));
//mapwin.updateNode(active_node);
//mapwin.updateNode(Node(INVALID));
@@ -731,19 +743,19 @@
case Gtk::RESPONSE_CANCEL:
break;
case Gtk::RESPONSE_ACCEPT:
- switch (mytab.mapstorage.getEdgeMapElementType(edgemap_to_edit))
+ switch (ms.getEdgeMapElementType(edgemap_to_edit))
{
case MapValue::NUMERIC:
- mytab.mapstorage.set(edgemap_to_edit, active_edge,
+ ms.set(edgemap_to_edit, active_edge,
atof(entry.get_text().c_str()));
break;
case MapValue::STRING:
- mytab.mapstorage.set(edgemap_to_edit, active_edge,
+ ms.set(edgemap_to_edit, active_edge,
static_cast<std::string>(entry.get_text()));
break;
}
edgetextmap[active_edge]->property_text().set_value(
- static_cast<std::string>(mytab.mapstorage.get(edgemap_to_edit, active_edge)));
+ static_cast<std::string>(ms.get(edgemap_to_edit, active_edge)));
//mapwin.updateEdge(active_edge);
// mapwin.updateEdge(Edge(INVALID));
@@ -764,14 +776,14 @@
{
delete(nodetextmap[node_to_delete]);
delete(nodesmap[node_to_delete]);
- (mytab.mapstorage).graph.erase(node_to_delete);
+ mytab.mapstorage->graph.erase(node_to_delete);
}
void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
{
delete(edgetextmap[edge_to_delete]);
delete(edgesmap[edge_to_delete]);
- (mytab.mapstorage).graph.erase(edge_to_delete);
+ mytab.mapstorage->graph.erase(edge_to_delete);
}
void GraphDisplayerCanvas::textReposition(XY new_place)
@@ -791,7 +803,7 @@
}
else
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i(mytab.mapstorage->graph); i!=INVALID; ++i)
{
if(edgesmap[i]==active_bre)
{
@@ -815,6 +827,8 @@
void GraphDisplayerCanvas::moveNode(double dx, double dy, Gnome::Canvas::Item * item, Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
+
Gnome::Canvas::Item * moved_item=item;
Node moved_node=node;
@@ -833,60 +847,60 @@
nodetextmap[moved_node]->move(dx, dy);
// the new coordinates of the centre of the node
- double coord_x = dx + mytab.mapstorage.getNodeCoords(moved_node).x;
- double coord_y = dy + mytab.mapstorage.getNodeCoords(moved_node).y;
+ double coord_x = dx + ms.getNodeCoords(moved_node).x;
+ double coord_y = dy + ms.getNodeCoords(moved_node).y;
// write back the new coordinates to the coords map
- mytab.mapstorage.setNodeCoords(moved_node, XY(coord_x, coord_y));
+ ms.setNodeCoords(moved_node, XY(coord_x, coord_y));
//all the edges connected to the moved point has to be redrawn
- for(OutEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
+ for(OutEdgeIt ei(ms.graph,moved_node);ei!=INVALID;++ei)
{
XY arrow_pos;
- if (mytab.mapstorage.graph.source(ei) == mytab.mapstorage.graph.target(ei))
+ if (ms.graph.source(ei) == ms.graph.target(ei))
{
- arrow_pos = mytab.mapstorage.getArrowCoords(ei) + XY(dx, dy);
+ arrow_pos = ms.getArrowCoords(ei) + XY(dx, dy);
}
else
{
XY moved_node_1(coord_x - dx, coord_y - dy);
XY moved_node_2(coord_x, coord_y);
- Node target = mytab.mapstorage.graph.target(ei);
- XY fix_node = mytab.mapstorage.getNodeCoords(target);
- XY old_arrow_pos(mytab.mapstorage.getArrowCoords(ei));
+ Node target = ms.graph.target(ei);
+ XY fix_node = ms.getNodeCoords(target);
+ XY old_arrow_pos(ms.getArrowCoords(ei));
arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
}
- mytab.mapstorage.setArrowCoords(ei, arrow_pos);
+ ms.setArrowCoords(ei, arrow_pos);
edgesmap[ei]->draw();
//reposition of edgetext
- XY text_pos=mytab.mapstorage.getArrowCoords(ei);
+ XY text_pos=ms.getArrowCoords(ei);
text_pos+=(XY(10,10));
edgetextmap[ei]->property_x().set_value(text_pos.x);
edgetextmap[ei]->property_y().set_value(text_pos.y);
}
- for(InEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
+ for(InEdgeIt ei(ms.graph,moved_node);ei!=INVALID;++ei)
{
- if (mytab.mapstorage.graph.source(ei) != mytab.mapstorage.graph.target(ei))
+ if (ms.graph.source(ei) != ms.graph.target(ei))
{
XY moved_node_1(coord_x - dx, coord_y - dy);
XY moved_node_2(coord_x, coord_y);
- Node source = mytab.mapstorage.graph.source(ei);
- XY fix_node = mytab.mapstorage.getNodeCoords(source);
- XY old_arrow_pos(mytab.mapstorage.getArrowCoords(ei));
+ Node source = ms.graph.source(ei);
+ XY fix_node = ms.getNodeCoords(source);
+ XY old_arrow_pos(ms.getArrowCoords(ei));
XY arrow_pos;
arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
- mytab.mapstorage.setArrowCoords(ei, arrow_pos);
+ ms.setArrowCoords(ei, arrow_pos);
edgesmap[ei]->draw();
//reposition of edgetext
- XY text_pos=mytab.mapstorage.getArrowCoords(ei);
+ XY text_pos=ms.getArrowCoords(ei);
text_pos+=(XY(10,10));
edgetextmap[ei]->property_x().set_value(text_pos.x);
edgetextmap[ei]->property_y().set_value(text_pos.y);
Modified: glemon/branches/akos/graph_displayer_canvas-node.cc
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas-node.cc (original)
+++ glemon/branches/akos/graph_displayer_canvas-node.cc Sun Nov 18 01:54:33 2007
@@ -16,32 +16,36 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
const int minimum_node_radius=5;
int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
+
double min, max;
{
- NodeIt n(mytab.mapstorage.graph);
- min = max = mytab.mapstorage.get(mapname, n);
+ NodeIt n(ms.graph);
+ min = max = ms.get(mapname, n);
for (; n != INVALID; ++n)
{
- if (static_cast<double>(mytab.mapstorage.get(mapname, n)) > max)
- max = mytab.mapstorage.get(mapname, n);
- if (static_cast<double>(mytab.mapstorage.get(mapname, n)) < min)
- min = mytab.mapstorage.get(mapname, n);
+ if (static_cast<double>(ms.get(mapname, n)) > max)
+ max = ms.get(mapname, n);
+ if (static_cast<double>(ms.get(mapname, n)) < min)
+ min = ms.get(mapname, n);
}
}
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
- double v=fabs(mytab.mapstorage.get(mapname,i));
+ double v=fabs(ms.get(mapname,i));
int w;
if(autoscale)
{
@@ -108,14 +112,16 @@
int GraphDisplayerCanvas::resetNodeRadius (Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
+
double min, max;
min=node_property_defaults[N_RADIUS];
max=node_property_defaults[N_RADIUS];
- Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]);
+ Graph::NodeMap<double> actual_map(ms.graph,node_property_defaults[N_RADIUS]);
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
double v=fabs(actual_map[i]);
int w;
@@ -169,6 +175,7 @@
int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
//function maps the range of the maximum and
//the minimum of the nodemap to the range of
@@ -177,25 +184,25 @@
double max, min;
{
- NodeIt n(mytab.mapstorage.graph);
- min = max = mytab.mapstorage.get(mapname, n);
+ NodeIt n(ms.graph);
+ min = max = ms.get(mapname, n);
for (; n != INVALID; ++n)
{
- if (static_cast<double>(mytab.mapstorage.get(mapname, n)) > max)
- max = mytab.mapstorage.get(mapname, n);
- if (static_cast<double>(mytab.mapstorage.get(mapname, n)) < min)
- min = mytab.mapstorage.get(mapname, n);
+ if (static_cast<double>(ms.get(mapname, n)) > max)
+ max = ms.get(mapname, n);
+ if (static_cast<double>(ms.get(mapname, n)) < min)
+ min = ms.get(mapname, n);
}
}
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
Gdk::Color color;
- double w=mytab.mapstorage.get(mapname, i);
+ double w=ms.get(mapname, i);
if(max!=min)
{
@@ -213,7 +220,7 @@
{
Gdk::Color color;
- double w=mytab.mapstorage.get(mapname, node);
+ double w=ms.get(mapname, node);
if(max!=min)
{
@@ -231,12 +238,13 @@
int GraphDisplayerCanvas::resetNodeColor (Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
//function maps the range of the maximum and
//the minimum of the nodemap to the range of
//green in RGB
- Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]);
+ Graph::NodeMap<double> actual_map(ms.graph,node_property_defaults[N_COLOR]);
double max, min;
@@ -246,7 +254,7 @@
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
Gdk::Color color;
@@ -286,6 +294,7 @@
int GraphDisplayerCanvas::changeNodeText (std::string mapname, Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
//the number in the map will be written on the node
//EXCEPT when the name of the map is Text, because
@@ -294,24 +303,25 @@
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
nodemap_to_edit=mapname;
nodetextmap[i]->property_text().set_value(
- static_cast<std::string>(mytab.mapstorage.get(mapname, i)));
+ static_cast<std::string>(ms.get(mapname, i)));
}
}
else
{
nodetextmap[node]->property_text().set_value(
- static_cast<std::string>(mytab.mapstorage.get(mapname, node)));
+ static_cast<std::string>(ms.get(mapname, node)));
}
return 0;
};
int GraphDisplayerCanvas::resetNodeText (Node node)
{
+ MapStorage& ms = *mytab.mapstorage;
//the number in the map will be written on the node
//EXCEPT when the name of the map is Text, because
@@ -320,7 +330,7 @@
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
nodemap_to_edit="";
nodetextmap[i]->property_text().set_value("");
Modified: glemon/branches/akos/graph_displayer_canvas-zoom.cc
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas-zoom.cc (original)
+++ glemon/branches/akos/graph_displayer_canvas-zoom.cc Sun Nov 18 01:54:33 2007
@@ -16,7 +16,7 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
#include <cmath>
void GraphDisplayerCanvas::zoomIn()
Modified: glemon/branches/akos/graph_displayer_canvas.cc
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas.cc (original)
+++ glemon/branches/akos/graph_displayer_canvas.cc Sun Nov 18 01:54:33 2007
@@ -16,13 +16,15 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <mapstorage.h>
+#include <nbtab.h>
+#include <graph_displayer_canvas.h>
#include <lemon/random.h>
#include <cmath>
GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
- nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
- nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
+ nodesmap(mainw.mapstorage->graph), edgesmap(mainw.mapstorage->graph), edgetextmap(mainw.mapstorage->graph),
+ nodetextmap(mainw.mapstorage->graph), displayed_graph(*(root()), 0, 0),
isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10),
was_redesigned(false), is_drawn(false), mytab(mainw),
@@ -49,11 +51,11 @@
{
delete background;
}
- if (mytab.mapstorage.isBackgroundSet())
+ if (mytab.mapstorage->isBackgroundSet())
{
background_set = true;
refBackground = Gdk::Pixbuf::create_from_file(
- mytab.mapstorage.getBackgroundFilename());
+ mytab.mapstorage->getBackgroundFilename());
background = new Gnome::Canvas::Pixbuf(
*(root()),
0.0 - refBackground->get_width() / 2.0,
@@ -69,13 +71,13 @@
GraphDisplayerCanvas::~GraphDisplayerCanvas()
{
- for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
+ for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n)
{
delete nodesmap[n];
delete nodetextmap[n];
}
- for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
+ for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e)
{
delete edgesmap[e];
delete edgetextmap[e];
@@ -118,7 +120,7 @@
{
if(mapname!="")
{
- std::vector<std::string> nodemaps = mytab.mapstorage.getNodeMapList();
+ std::vector<std::string> nodemaps = mytab.mapstorage->getNodeMapList();
bool found = false;
for (std::vector<std::string>::const_iterator it = nodemaps.begin();
it != nodemaps.end(); ++it)
@@ -176,7 +178,7 @@
{
if(mapname!="")
{
- std::vector<std::string> edgemaps = mytab.mapstorage.getEdgeMapList();
+ std::vector<std::string> edgemaps = mytab.mapstorage->getEdgeMapList();
bool found = false;
for (std::vector<std::string>::const_iterator it = edgemaps.begin();
it != edgemaps.end(); ++it)
@@ -229,9 +231,9 @@
{
//first edges are drawn, to hide joining with nodes later
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
- if (mytab.mapstorage.graph.source(i) == mytab.mapstorage.graph.target(i))
+ if (mytab.mapstorage->graph.source(i) == mytab.mapstorage->graph.target(i))
{
edgesmap[i]=new LoopEdge(displayed_graph, i, *this);
}
@@ -241,7 +243,7 @@
}
//initializing edge-text as well, to empty string
- XY text_pos=mytab.mapstorage.getArrowCoords(i);
+ XY text_pos=mytab.mapstorage->getArrowCoords(i);
text_pos+=(XY(10,10));
edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
@@ -252,16 +254,16 @@
//afterwards nodes come to be drawn
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//drawing bule nodes, with black line around them
nodesmap[i]=new Gnome::Canvas::Ellipse(
displayed_graph,
- mytab.mapstorage.getNodeCoords(i).x-20,
- mytab.mapstorage.getNodeCoords(i).y-20,
- mytab.mapstorage.getNodeCoords(i).x+20,
- mytab.mapstorage.getNodeCoords(i).y+20);
+ mytab.mapstorage->getNodeCoords(i).x-20,
+ mytab.mapstorage->getNodeCoords(i).y-20,
+ mytab.mapstorage->getNodeCoords(i).x+20,
+ mytab.mapstorage->getNodeCoords(i).y+20);
*(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
*(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
nodesmap[i]->raise_to_top();
@@ -269,8 +271,8 @@
//initializing edge-text as well, to empty string
XY text_pos(
- (mytab.mapstorage.getNodeCoords(i).x+node_property_defaults[N_RADIUS]+5),
- (mytab.mapstorage.getNodeCoords(i).y+node_property_defaults[N_RADIUS]+5));
+ (mytab.mapstorage->getNodeCoords(i).x+node_property_defaults[N_RADIUS]+5),
+ (mytab.mapstorage->getNodeCoords(i).y+node_property_defaults[N_RADIUS]+5));
nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
text_pos.x, text_pos.y, "");
@@ -303,13 +305,13 @@
active_edge=INVALID;
forming_edge=INVALID;
- for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
+ for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n)
{
delete nodesmap[n];
delete nodetextmap[n];
}
- for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
+ for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e)
{
delete edgesmap[e];
delete edgetextmap[e];
@@ -345,7 +347,8 @@
void GraphDisplayerCanvas::reDesignGraph()
{
- NodeIt firstnode((mytab.mapstorage).graph);
+ MapStorage& ms = *mytab.mapstorage;
+ NodeIt firstnode(ms.graph);
//is it not an empty graph?
if(firstnode!=INVALID)
{
@@ -355,7 +358,7 @@
if(!was_redesigned)
{
- NodeIt i((mytab.mapstorage).graph);
+ NodeIt i(ms.graph);
dim2::Point<double> init(init_vector_length*rnd(),
init_vector_length*rnd());
@@ -367,28 +370,28 @@
double propulsation;
int iterations;
- (mytab.mapstorage).get_design_data(attraction, propulsation, iterations);
+ ms.get_design_data(attraction, propulsation, iterations);
//iteration counter
for(int l=0;l<iterations;l++)
{
- Graph::NodeMap<double> x(mytab.mapstorage.graph);
- Graph::NodeMap<double> y(mytab.mapstorage.graph);
+ Graph::NodeMap<double> x(ms.graph);
+ Graph::NodeMap<double> y(ms.graph);
XYMap<Graph::NodeMap<double> > actual_forces;
actual_forces.setXMap(x);
actual_forces.setYMap(y);
//count actual force for each nodes
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
//propulsation of nodes
- for (NodeIt j((mytab.mapstorage).graph); j!=INVALID; ++j)
+ for (NodeIt j(ms.graph); j!=INVALID; ++j)
{
if(i!=j)
{
lemon::dim2::Point<double> delta =
- (mytab.mapstorage.getNodeCoords(i)-
- mytab.mapstorage.getNodeCoords(j));
+ (ms.getNodeCoords(i)-
+ ms.getNodeCoords(j));
const double length_sqr=std::max(delta.normSquare(),min_dist);
@@ -403,11 +406,11 @@
}
}
//attraction of nodes, to which actual node is bound
- for(OutEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei)
+ for(OutEdgeIt ei(ms.graph,i);ei!=INVALID;++ei)
{
lemon::dim2::Point<double> delta =
- (mytab.mapstorage.getNodeCoords(i)-
- mytab.mapstorage.getNodeCoords(mytab.mapstorage.graph.target(ei)));
+ (ms.getNodeCoords(i)-
+ ms.getNodeCoords(ms.graph.target(ei)));
//calculating attraction strength
//greater distance means greater strength
@@ -415,11 +418,11 @@
actual_forces.set(i,actual_forces[i]-delta);
}
- for(InEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei)
+ for(InEdgeIt ei(ms.graph,i);ei!=INVALID;++ei)
{
lemon::dim2::Point<double> delta =
- (mytab.mapstorage.getNodeCoords(i)-
- mytab.mapstorage.getNodeCoords(mytab.mapstorage.graph.source(ei)));
+ (ms.getNodeCoords(i)-
+ ms.getNodeCoords(ms.graph.source(ei)));
//calculating attraction strength
//greater distance means greater strength
@@ -428,27 +431,27 @@
actual_forces.set(i,actual_forces[i]-delta);
}
}
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i(ms.graph); i!=INVALID; ++i)
{
- if(((mytab.mapstorage).getNodeCoords(i).x)+actual_forces[i].x>max_coord)
+ if((ms.getNodeCoords(i).x)+actual_forces[i].x>max_coord)
{
- actual_forces[i].x=max_coord-((mytab.mapstorage).getNodeCoords(i).x);
- std::cout << "Correction! " << (((mytab.mapstorage).getNodeCoords(i).x)+actual_forces[i].x) << std::endl;
+ actual_forces[i].x=max_coord-(ms.getNodeCoords(i).x);
+ std::cout << "Correction! " << ((ms.getNodeCoords(i).x)+actual_forces[i].x) << std::endl;
}
- else if(((mytab.mapstorage).getNodeCoords(i).x)+actual_forces[i].x<(0-max_coord))
+ else if((ms.getNodeCoords(i).x)+actual_forces[i].x<(0-max_coord))
{
- actual_forces[i].x=0-max_coord-((mytab.mapstorage).getNodeCoords(i).x);
- std::cout << "Correction! " << (((mytab.mapstorage).getNodeCoords(i).x)+actual_forces[i].x) << std::endl;
+ actual_forces[i].x=0-max_coord-(ms.getNodeCoords(i).x);
+ std::cout << "Correction! " << ((ms.getNodeCoords(i).x)+actual_forces[i].x) << std::endl;
}
- if(((mytab.mapstorage).getNodeCoords(i).y)+actual_forces[i].y>max_coord)
+ if((ms.getNodeCoords(i).y)+actual_forces[i].y>max_coord)
{
- actual_forces[i].y=max_coord-((mytab.mapstorage).getNodeCoords(i).y);
- std::cout << "Correction! " << (((mytab.mapstorage).getNodeCoords(i).y)+actual_forces[i].y) << std::endl;
+ actual_forces[i].y=max_coord-(ms.getNodeCoords(i).y);
+ std::cout << "Correction! " << ((ms.getNodeCoords(i).y)+actual_forces[i].y) << std::endl;
}
- else if(((mytab.mapstorage).getNodeCoords(i).y)+actual_forces[i].y<(0-max_coord))
+ else if((ms.getNodeCoords(i).y)+actual_forces[i].y<(0-max_coord))
{
- actual_forces[i].y=0-max_coord-((mytab.mapstorage).getNodeCoords(i).y);
- std::cout << "Correction! " << (((mytab.mapstorage).getNodeCoords(i).y)+actual_forces[i].y) << std::endl;
+ actual_forces[i].y=0-max_coord-(ms.getNodeCoords(i).y);
+ std::cout << "Correction! " << ((ms.getNodeCoords(i).y)+actual_forces[i].y) << std::endl;
}
moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i);
}
Modified: glemon/branches/akos/graph_displayer_canvas.h
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas.h (original)
+++ glemon/branches/akos/graph_displayer_canvas.h Sun Nov 18 01:54:33 2007
@@ -19,13 +19,11 @@
#ifndef GRAPH_DISPLAYER_CANVAS_H
#define GRAPH_DISPLAYER_CANVAS_H
-class GraphDisplayerCanvas;
+class NoteBookTab;
#include "all_include.h"
-#include "nbtab.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
-#include <lemon/dim2.h>
///This class is the canvas, on which the graph can be drawn.
class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
Modified: glemon/branches/akos/gui_reader.cc
==============================================================================
--- glemon/branches/akos/gui_reader.cc (original)
+++ glemon/branches/akos/gui_reader.cc Sun Nov 18 01:54:33 2007
@@ -16,9 +16,10 @@
*
*/
-#include "gui_reader.h"
-#include "xml.h"
-#include "mapstorage.h"
+#include <gui_reader.h>
+#include <mapstorage.h>
+
+#include <xml.h>
#include "io_helper.h"
#include <lemon/dim2.h>
#include <vector>
Modified: glemon/branches/akos/gui_reader.h
==============================================================================
--- glemon/branches/akos/gui_reader.h (original)
+++ glemon/branches/akos/gui_reader.h Sun Nov 18 01:54:33 2007
@@ -18,9 +18,9 @@
#ifndef GUI_READER_H
#define GUI_READER_H
+#include <lemon/lemon_reader.h>
#include "mapstorage.h"
-#include <lemon/lemon_reader.h>
using lemon::LemonReader;
Modified: glemon/branches/akos/gui_writer.cc
==============================================================================
--- glemon/branches/akos/gui_writer.cc (original)
+++ glemon/branches/akos/gui_writer.cc Sun Nov 18 01:54:33 2007
@@ -19,9 +19,13 @@
#include "gui_writer.h"
#include "io_helper.h"
#include "mapstorage.h"
+#include "xml.h"
#include <lemon/dim2.h>
#include <vector>
+#include <gui_writer.h>
+#include <mapstorage.h>
+
std::string GuiWriter::header()
{
return "@gui";
Modified: glemon/branches/akos/gui_writer.h
==============================================================================
--- glemon/branches/akos/gui_writer.h (original)
+++ glemon/branches/akos/gui_writer.h Sun Nov 18 01:54:33 2007
@@ -19,9 +19,10 @@
#ifndef GUI_WRITER_H
#define GUI_WRITER_H
-#include "mapstorage.h"
#include <lemon/lemon_writer.h>
+class MapStorage;
+
using lemon::LemonWriter;
class GuiWriter : public LemonWriter::SectionWriter
Modified: glemon/branches/akos/kruskalbox.cc
==============================================================================
--- glemon/branches/akos/kruskalbox.cc (original)
+++ glemon/branches/akos/kruskalbox.cc Sun Nov 18 01:54:33 2007
@@ -16,6 +16,11 @@
*
*/
+#include <lemon/kruskal.h>
+
+#include <mapstorage.h>
+#include <mapselector.h>
+#include <algobox.h>
#include <kruskalbox.h>
enum {INPUT, OUTPUT, MAP_NUM};
Modified: glemon/branches/akos/kruskalbox.h
==============================================================================
--- glemon/branches/akos/kruskalbox.h (original)
+++ glemon/branches/akos/kruskalbox.h Sun Nov 18 01:54:33 2007
@@ -19,11 +19,9 @@
#ifndef KRUSKALBOX_H
#define KRUSKALBOX_H
-class KruskalBox;
+class AlgoBox;
#include <all_include.h>
-#include <algobox.h>
-#include <lemon/kruskal.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/main_win.cc
==============================================================================
--- glemon/branches/akos/main_win.cc (original)
+++ glemon/branches/akos/main_win.cc Sun Nov 18 01:54:33 2007
@@ -25,6 +25,12 @@
#include "save_details_dialog.h"
#include "background_chooser_dialog.h"
+#include <mapstorage.h>
+#include <graph_displayer_canvas.h>
+#include <algowin.h>
+#include <new_map_win.h>
+#include <nbtab.h>
+
#include "i18n.h"
MainWin::MainWin()
@@ -368,7 +374,7 @@
{
if(active_tab!=-1)
{
- if (tabs[active_tab]->mapstorage.getModified())
+ if (tabs[active_tab]->mapstorage->getModified())
{
Gtk::MessageDialog mdialog(_("<b>Save changes before closing?</b>"), true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -557,7 +563,7 @@
for(;(i<(int)tabnames.size())&&(tabnames[i]!=tabname);i++)
{
}
- awp->update_maplist(&(tabs[i]->mapstorage));
+ awp->update_maplist(tabs[i]->mapstorage);
}
void MainWin::deRegisterAlgoWin(AlgoWin * awp)
@@ -628,7 +634,7 @@
void MainWin::createSaveDetailsDialog()
{
- SaveDetailsDialog dialog(&(tabs[active_tab]->mapstorage));
+ SaveDetailsDialog dialog(tabs[active_tab]->mapstorage);
dialog.run();
}
@@ -642,6 +648,6 @@
void MainWin::createBackgroundChooser()
{
- BackgroundChooserDialog dialog(&(tabs[active_tab]->mapstorage));
+ BackgroundChooserDialog dialog(tabs[active_tab]->mapstorage);
dialog.run();
}
Modified: glemon/branches/akos/main_win.h
==============================================================================
--- glemon/branches/akos/main_win.h (original)
+++ glemon/branches/akos/main_win.h Sun Nov 18 01:54:33 2007
@@ -20,13 +20,11 @@
#define MAIN_WIN_H
#include "all_include.h"
-#include "algowin.h"
-#include "map_win.h"
-#include "new_map_win.h"
-#include "nbtab.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
+class AlgoWin;
+class NoteBookTab;
///This class is the main window of GUI.
Modified: glemon/branches/akos/map_win.cc
==============================================================================
--- glemon/branches/akos/map_win.cc (original)
+++ glemon/branches/akos/map_win.cc Sun Nov 18 01:54:33 2007
@@ -16,7 +16,9 @@
*
*/
-#include "map_win.h"
+#include <map_win.h>
+#include <nbtab.h>
+#include <mapselector.h>
#include <set>
bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
Modified: glemon/branches/akos/map_win.h
==============================================================================
--- glemon/branches/akos/map_win.h (original)
+++ glemon/branches/akos/map_win.h Sun Nov 18 01:54:33 2007
@@ -19,11 +19,10 @@
#ifndef MAP_WIN_H
#define MAP_WIN_H
-class MapWin;
+class NoteBookTab;
+class MapSelector;
#include <all_include.h>
-#include <nbtab.h>
-#include <mapselector.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/mapselector.cc
==============================================================================
--- glemon/branches/akos/mapselector.cc (original)
+++ glemon/branches/akos/mapselector.cc Sun Nov 18 01:54:33 2007
@@ -16,7 +16,7 @@
*
*/
-#include "mapselector.h"
+#include <mapselector.h>
MapSelector::MapSelector(std::vector<std::string> n_ml,
std::vector<std::string> s_ml, std::string act,
Modified: glemon/branches/akos/mapselector.h
==============================================================================
--- glemon/branches/akos/mapselector.h (original)
+++ glemon/branches/akos/mapselector.h Sun Nov 18 01:54:33 2007
@@ -19,10 +19,7 @@
#ifndef MAPSELECTOR_H
#define MAPSELECTOR_H
-class MapSelector;
-
#include <all_include.h>
-#include <map_win.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/branches/akos/mapstorage.cc
==============================================================================
--- glemon/branches/akos/mapstorage.cc (original)
+++ glemon/branches/akos/mapstorage.cc Sun Nov 18 01:54:33 2007
@@ -16,10 +16,6 @@
*
*/
-#include "mapstorage.h"
-#include "nbtab.h"
-#include "gui_writer.h"
-#include "gui_reader.h"
#include "i18n.h"
#include <limits>
#include <cmath>
@@ -29,6 +25,11 @@
#include <algorithm>
#include <gtkmm.h>
#include "file_import_dialog.h"
+#include <mapstorage.h>
+#include <graph_displayer_canvas.h> //kivenni
+#include <nbtab.h> //kivenni
+#include <gui_writer.h>
+#include <gui_reader.h>
#include <lemon/graph_to_eps.h>
const int i_d=20;
Modified: glemon/branches/akos/nbtab.cc
==============================================================================
--- glemon/branches/akos/nbtab.cc (original)
+++ glemon/branches/akos/nbtab.cc Sun Nov 18 01:54:33 2007
@@ -17,43 +17,51 @@
*/
#include <nbtab.h>
+#include <mapstorage.h>
#include <eps_win.h>
+#include <map_win.h>
+#include <design_win.h>
+#include <graph_displayer_canvas.h>
-NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this)
+
+
+NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false)
{
+ mapstorage=new MapStorage(*this);
+
Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
gd_canvas=new GraphDisplayerCanvas(*this);
pScrolledWindow->add(*gd_canvas);
add(*pScrolledWindow);
//connecting signals - controller character
- mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
- mapstorage.signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
- mapstorage.signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
+ mapstorage->signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
+ mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
+ mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
show_all_children();
show();
}
void NoteBookTab::readFile(const std::string &file)
{
- mapstorage.readFromFile(file);
- mapstorage.setFileName(file);
- mapstorage.setModified(false);
+ mapstorage->readFromFile(file);
+ mapstorage->setFileName(file);
+ mapstorage->setModified(false);
gd_canvas->drawGraph();
if(mapwinexists)
{
mapwin->update(
- mapstorage.getEdgeMapList(NUM),
- mapstorage.getEdgeMapList(STR),
- mapstorage.getNodeMapList(NUM),
- mapstorage.getNodeMapList(STR));
+ mapstorage->getEdgeMapList(NUM),
+ mapstorage->getEdgeMapList(STR),
+ mapstorage->getNodeMapList(NUM),
+ mapstorage->getNodeMapList(STR));
}
signal_title.emit(Glib::filename_display_basename(file));
}
void NoteBookTab::newFile()
{
- if (mapstorage.getModified())
+ if (mapstorage->getModified())
{
Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -72,21 +80,21 @@
}
}
gd_canvas->clear();
- mapstorage.clear();
+ mapstorage->clear();
if(mapwinexists)
{
mapwin->update(
- mapstorage.getEdgeMapList(NUM),
- mapstorage.getEdgeMapList(STR),
- mapstorage.getNodeMapList(NUM),
- mapstorage.getNodeMapList(STR));
+ mapstorage->getEdgeMapList(NUM),
+ mapstorage->getEdgeMapList(STR),
+ mapstorage->getNodeMapList(NUM),
+ mapstorage->getNodeMapList(STR));
}
signal_title.emit("unsaved file");
}
void NoteBookTab::openFile()
{
- if (mapstorage.getModified())
+ if (mapstorage->getModified())
{
Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -110,20 +118,20 @@
if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
{
gd_canvas->clear();
- mapstorage.clear();
+ mapstorage->clear();
Glib::ustring filename = fcdialog.get_filename();
- if (!mapstorage.readFromFile(filename))
+ if (!mapstorage->readFromFile(filename))
{
- mapstorage.setFileName(filename);
- mapstorage.setModified(false);
+ mapstorage->setFileName(filename);
+ mapstorage->setModified(false);
gd_canvas->drawGraph();
if(mapwinexists)
{
mapwin->update(
- mapstorage.getEdgeMapList(NUM),
- mapstorage.getEdgeMapList(STR),
- mapstorage.getNodeMapList(NUM),
- mapstorage.getNodeMapList(STR));
+ mapstorage->getEdgeMapList(NUM),
+ mapstorage->getEdgeMapList(STR),
+ mapstorage->getNodeMapList(NUM),
+ mapstorage->getNodeMapList(STR));
}
signal_title.emit(Glib::filename_display_basename(filename));
}
@@ -132,14 +140,14 @@
void NoteBookTab::saveFile()
{
- if (mapstorage.getFileName() == "") {
+ if (mapstorage->getFileName() == "") {
saveFileAs();
}
else
{
- mapstorage.writeToFile(mapstorage.getFileName());
- mapstorage.setModified(false);
- signal_title.emit(Glib::filename_display_basename(mapstorage.getFileName()));
+ mapstorage->writeToFile(mapstorage->getFileName());
+ mapstorage->setModified(false);
+ signal_title.emit(Glib::filename_display_basename(mapstorage->getFileName()));
}
}
@@ -151,16 +159,16 @@
if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
{
Glib::ustring filename = fcdialog.get_filename();
- mapstorage.setFileName(filename);
- mapstorage.writeToFile(filename);
- mapstorage.setModified(false);
+ mapstorage->setFileName(filename);
+ mapstorage->writeToFile(filename);
+ mapstorage->setModified(false);
signal_title.emit(Glib::filename_display_basename(filename));
}
}
void NoteBookTab::close()
{
- if (mapstorage.getModified())
+ if (mapstorage->getModified())
{
Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -179,21 +187,21 @@
}
}
gd_canvas->clear();
- mapstorage.clear();
+ mapstorage->clear();
if(mapwinexists)
{
mapwin->update(
- mapstorage.getEdgeMapList(NUM),
- mapstorage.getEdgeMapList(STR),
- mapstorage.getNodeMapList(NUM),
- mapstorage.getNodeMapList(STR));
+ mapstorage->getEdgeMapList(NUM),
+ mapstorage->getEdgeMapList(STR),
+ mapstorage->getNodeMapList(NUM),
+ mapstorage->getNodeMapList(STR));
}
signal_title.emit("unsaved file");
}
void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
{
- mapstorage.changeActiveMap(itisedge, prop, mapname);
+ mapstorage->changeActiveMap(itisedge, prop, mapname);
}
sigc::signal<void, NoteBookTab *, bool> NoteBookTab::signal_newmap_needed()
@@ -208,12 +216,12 @@
std::string NoteBookTab::getActiveEdgeMap(int prop)
{
- return mapstorage.getActiveEdgeMap(prop);
+ return mapstorage->getActiveEdgeMap(prop);
}
std::string NoteBookTab::getActiveNodeMap(int prop)
{
- return mapstorage.getActiveNodeMap(prop);
+ return mapstorage->getActiveNodeMap(prop);
}
void NoteBookTab::registerNewEdgeMap(std::string mapname)
@@ -237,12 +245,12 @@
if(!mapwinexists)
{
mapwin=new MapWin("Map Setup - "+name,
- mapstorage.getEdgeMapList(NUM),
- mapstorage.getEdgeMapList(STR),
- mapstorage.getNodeMapList(NUM),
- mapstorage.getNodeMapList(STR),
+ mapstorage->getEdgeMapList(NUM),
+ mapstorage->getEdgeMapList(STR),
+ mapstorage->getNodeMapList(NUM),
+ mapstorage->getNodeMapList(STR),
*this);
- mapst2mapwin=mapstorage.signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
+ mapst2mapwin=mapstorage->signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
mapwin->show();
mapwinexists=true;
}
@@ -265,17 +273,17 @@
{
double attraction, propulsation;
int iterations;
- mapstorage.get_design_data(attraction, propulsation, iterations);
+ mapstorage->get_design_data(attraction, propulsation, iterations);
designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this);
- designwin->signal_attraction().connect(sigc::mem_fun(mapstorage, &MapStorage::set_attraction));
- designwin->signal_propulsation().connect(sigc::mem_fun(mapstorage, &MapStorage::set_propulsation));
- designwin->signal_iteration().connect(sigc::mem_fun(mapstorage, &MapStorage::set_iteration));
+ designwin->signal_attraction().connect(sigc::mem_fun(*mapstorage, &MapStorage::set_attraction));
+ designwin->signal_propulsation().connect(sigc::mem_fun(*mapstorage, &MapStorage::set_propulsation));
+ designwin->signal_iteration().connect(sigc::mem_fun(*mapstorage, &MapStorage::set_iteration));
designwin->close_run().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::reDesignGraph));
designwin->signal_delete_event().connect(sigc::mem_fun(*this, &NoteBookTab::closeDesignWin));
- mapst2designwin=mapstorage.signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
+ mapst2designwin=mapstorage->signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
designwin->show();
designwinexists=true;
@@ -327,10 +335,10 @@
void NoteBookTab::active_maps_needed()
{
- mapstorage.broadcastActiveMaps();
+ mapstorage->broadcastActiveMaps();
}
void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
{
- mapstorage.exportGraphToEPS(options, filename);
+ mapstorage->exportGraphToEPS(options, filename);
}
Modified: glemon/branches/akos/nbtab.h
==============================================================================
--- glemon/branches/akos/nbtab.h (original)
+++ glemon/branches/akos/nbtab.h Sun Nov 18 01:54:33 2007
@@ -19,14 +19,12 @@
#ifndef NBTAB_H
#define NBTAB_H
-class NoteBookTab;
-
-#include "mapstorage.h"
-#include "map_win.h"
-//#include "eps_win.h"
+class MapStorage;
class EpsWin;
-#include "design_win.h"
-#include "graph_displayer_canvas.h"
+class MapWin;
+class DesignWin;
+class GraphDisplayerCanvas;
+
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
@@ -59,7 +57,7 @@
NoteBookTab();
///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook.
- MapStorage mapstorage;
+ MapStorage * mapstorage;
///Title changement indicator.
Modified: glemon/branches/akos/new_map_win.cc
==============================================================================
--- glemon/branches/akos/new_map_win.cc (original)
+++ glemon/branches/akos/new_map_win.cc Sun Nov 18 01:54:33 2007
@@ -17,6 +17,8 @@
*/
#include <new_map_win.h>
+#include <nbtab.h>
+#include <mapstorage.h>
bool NewMapWin::closeIfEscapeIsPressed(GdkEventKey* e)
{
@@ -101,10 +103,12 @@
std::vector<double>* NewMapWin::evaluate_expr(const std::string polishform)
{
+ MapStorage& ms = *mytab.mapstorage;
+
std::vector<double>* ret = new std::vector<double>;
std::stack<double> polishstack;
- for(EdgeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
+ for(EdgeIt k(ms.graph); k!=INVALID; ++k)
{
for(int i=0;i<(int)polishform.size();i++)
{
@@ -124,11 +128,11 @@
default:
//substitute variable
std::vector<std::string> ems =
- mytab.mapstorage.getEdgeMapList(NUM);
+ ms.getEdgeMapList(NUM);
bool itisvar=(std::find(ems.begin(), ems.end(), ch2var[ polishform[i] ]) != ems.end());
if(itisvar)
{
- polishstack.push(mytab.mapstorage.get(ch2var[ polishform[i] ], k));
+ polishstack.push(ms.get(ch2var[ polishform[i] ], k));
}
else
{
@@ -168,6 +172,8 @@
void NewMapWin::on_response(int response_id)
{
+ MapStorage& ms = *mytab.mapstorage;
+
if(response_id==Gtk::RESPONSE_OK)
{
std::string map_name = name.get_text();
@@ -182,7 +188,7 @@
// check whether the map already exists
if (edge.get_active())
{
- if (mytab.mapstorage.edgeMapExists(map_name))
+ if (ms.edgeMapExists(map_name))
{
setErrorMsg("Map '" + map_name + "' already exists.");
return;
@@ -190,7 +196,7 @@
}
else
{
- if (mytab.mapstorage.nodeMapExists(map_name))
+ if (ms.nodeMapExists(map_name))
{
setErrorMsg("Map '" + map_name + "' already exists.");
return;
@@ -207,10 +213,10 @@
{
// the full string was a number
if (edge.get_active())
- mytab.mapstorage.createEdgeMap(map_name, MapValue::NUMERIC,
+ ms.createEdgeMap(map_name, MapValue::NUMERIC,
MapValue(d));
else
- mytab.mapstorage.createNodeMap(map_name, MapValue::NUMERIC,
+ ms.createNodeMap(map_name, MapValue::NUMERIC,
MapValue(d));
}
else
@@ -220,23 +226,23 @@
values = evaluate_expr(string2Polishform(def_val, edge.get_active()));
if (edge.get_active())
{
- mytab.mapstorage.createEdgeMap(map_name, MapValue::NUMERIC,
+ ms.createEdgeMap(map_name, MapValue::NUMERIC,
MapValue(0.0));
std::vector<double>::const_iterator vit = values->begin();
- for (EdgeIt it(mytab.mapstorage.graph); it != INVALID; ++it)
+ for (EdgeIt it(ms.graph); it != INVALID; ++it)
{
- mytab.mapstorage.set(map_name, it, MapValue(*vit));
+ ms.set(map_name, it, MapValue(*vit));
++vit;
}
}
else
{
- mytab.mapstorage.createNodeMap(map_name, MapValue::NUMERIC,
+ ms.createNodeMap(map_name, MapValue::NUMERIC,
MapValue(0.0));
std::vector<double>::const_iterator vit = values->begin();
- for (NodeIt it(mytab.mapstorage.graph); it != INVALID; ++it)
+ for (NodeIt it(ms.graph); it != INVALID; ++it)
{
- mytab.mapstorage.set(map_name, it, MapValue(*vit));
+ ms.set(map_name, it, MapValue(*vit));
++vit;
}
}
@@ -246,10 +252,10 @@
else if (text == "String")
{
if (edge.get_active())
- mytab.mapstorage.createEdgeMap(map_name, MapValue::STRING,
+ ms.createEdgeMap(map_name, MapValue::STRING,
MapValue(def_val));
else
- mytab.mapstorage.createNodeMap(map_name, MapValue::STRING,
+ ms.createNodeMap(map_name, MapValue::STRING,
MapValue(def_val));
}
@@ -656,18 +662,20 @@
bool NewMapWin::validVariable(std::string variable, bool itisedge)
{
+ MapStorage& ms = *mytab.mapstorage;
+
bool cancel;
//is it mapname?
if(itisedge)
{
std::vector<std::string> edge_maps =
- mytab.mapstorage.getEdgeMapList(NUM);
+ ms.getEdgeMapList(NUM);
cancel=(std::find(edge_maps.begin(), edge_maps.end(), variable)==edge_maps.end());
}
else
{
std::vector<std::string> node_maps =
- mytab.mapstorage.getNodeMapList(NUM);
+ ms.getNodeMapList(NUM);
cancel=(std::find(node_maps.begin(), node_maps.end(), variable)==node_maps.end());
}
//maybe it is number
Modified: glemon/branches/akos/new_map_win.h
==============================================================================
--- glemon/branches/akos/new_map_win.h (original)
+++ glemon/branches/akos/new_map_win.h Sun Nov 18 01:54:33 2007
@@ -19,14 +19,13 @@
#ifndef NEWMAPWIN_H
#define NEWMAPWIN_H
-class NewMapWin;
-
#include <all_include.h>
-#include <nbtab.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
#include <stack>
+class NoteBookTab;
+
///Graphical interface for node/edge map creation.
///This class is responsible for creating a window,
More information about the Lemon-commits
mailing list