Index: Makefile.am
===================================================================
--- Makefile.am	(revision 96)
+++ Makefile.am	(revision 98)
@@ -29,4 +29,8 @@
 	new_map_win.h \
 	xymap.h \
+	gui_reader.h \
+	gui_reader.cc \
+	gui_writer.h \
+	gui_writer.cc \
 	icons/guipixbufs.h
 
Index: all_include.h
===================================================================
--- all_include.h	(revision 81)
+++ all_include.h	(revision 98)
@@ -38,7 +38,6 @@
 using namespace lemon;
 
-typedef xy<double> Coordinates;
+typedef xy<double> XY;
 typedef ListGraph Graph;
-typedef Graph::NodeMap<Coordinates> CoordinatesMap;
 typedef Graph::Node Node;
 typedef Graph::Edge Edge;
Index: gdc-broken_edge.cc
===================================================================
--- gdc-broken_edge.cc	(revision 93)
+++ gdc-broken_edge.cc	(revision 98)
@@ -2,13 +2,11 @@
 #include <cmath>
 
-GraphDisplayerCanvas::BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p, GraphDisplayerCanvas & gc) : Line(g), gdc(gc), isbutton(false)
+GraphDisplayerCanvas::BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Edge _edge, GraphDisplayerCanvas & gc) : Line(g), edge(_edge), gdc(gc), isbutton(false)
 {
-  my_points=new Gnome::Art::Point[3];
-
   arrow=new Gnome::Canvas::Polygon(g);
   *arrow << Gnome::Canvas::Properties::fill_color("red");
   arrow->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler));
   arrow->lower_to_bottom();
-  setPoints(p);
+  draw();
 }
 
@@ -18,153 +16,69 @@
 }
 
-void GraphDisplayerCanvas::BrokenEdge::setPoints(Gnome::Canvas::Points p, bool move)
+void GraphDisplayerCanvas::BrokenEdge::draw()
 {
-  bool set_arrow=false;
-  //red arrow losts its position-right button
-  if(!move)
-    {
-      if(p.size()==2)
-	{
-	  set_arrow=true;
-	  Gnome::Canvas::Points points_with_center;
-	  points_with_center.push_back(my_points[0]=p[0]);
-	  points_with_center.push_back(my_points[1]=Gnome::Art::Point( (p[0].get_x()+p[1].get_x())/2+0 , (p[0].get_y()+p[1].get_y())/2 )+0 );
-	  points_with_center.push_back(my_points[2]=p[1]);
-	  property_points().set_value(points_with_center);
-	}  
-      if(p.size()==3)
-	{
-	  set_arrow=true;
-	  property_points().set_value(p);
-	  for(int i=0;i<3;i++)
-	    {
-	      my_points[i]=p[i];
-	    }
-	}
+  MapStorage& ms = gdc.mytab.mapstorage;
+
+  // update the edge
+  {
+    Gnome::Canvas::Points points;
+    Node source = ms.graph.source(edge);
+    Node target = ms.graph.target(edge);
+    points.push_back(Gnome::Art::Point(ms.coords[source].x,
+          ms.coords[source].y));
+    points.push_back(Gnome::Art::Point(ms.arrow_pos[edge].x,
+          ms.arrow_pos[edge].y));
+    points.push_back(Gnome::Art::Point(ms.coords[target].x,
+          ms.coords[target].y));
+    property_points().set_value(points);
+  }
+
+  // update the arrow
+  {
+    //calculating coordinates of the direction indicator arrow
+    XY target(ms.coords[ms.graph.target(edge)]);
+    XY center(ms.arrow_pos[edge]);
+
+    XY unit_vector_in_dir(target-center);
+    double length=sqrt( unit_vector_in_dir.normSquare() );
+
+    //       std::cout << target << " - " << center << " = " << unit_vector_in_dir << "    / " <<unit_vector_in_dir.normSquare() ;
+    unit_vector_in_dir/=length;
+    //       std::cout << " = " << unit_vector_in_dir << std::endl;
+
+    XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
+    //       std::cout << unit_norm_vector << std::endl;
+
+    {      
+      //       /\       // top
+      //      /  \      //
+      //      -  -      // c(enter)l(eft), ccl, ccr, cr
+      //       ||       //
+      //       ||       // b(ottom)l, br
     }
-  else
-    {
-      //arrow keeps its position-left button
 
-//       if(p.size()==2)
-//       	{
-//       	  Gnome::Canvas::Points points;
-//       	  my_points[0]=p[0];
-//       	  my_points[2]=p[1];
-//       	  for(int i=0;i<3;i++)
-//       	    {
-//       	      points.push_back(my_points[i]);
-//       	    }
-//       	  property_points().set_value(points);
-//       	}
-      set_arrow=true;
+    double size=3;
 
-      //////////////////////////////////////////////////////////////////////////////////////////////////////
-      /////////// keeps shape-with scalar multiplication - version 2.
-      //////////////////////////////////////////////////////////////////////////////////////////////////////
+    XY bl (center - unit_vector_in_dir * 3 * size + unit_norm_vector * size );
+    XY br (center - unit_vector_in_dir * 3 * size - unit_norm_vector * size );
+    XY ccl(center + unit_vector_in_dir *  size + unit_norm_vector * size );
+    XY ccr(center + unit_vector_in_dir *  size - unit_norm_vector * size );
+    XY cl (center + unit_vector_in_dir *  size + unit_norm_vector * 2 * size );
+    XY cr (center + unit_vector_in_dir *  size - unit_norm_vector * 2 * size );
+    XY top(center + unit_vector_in_dir * 3 * size);
 
-      if(p.size()==2)
-      	{
-	  //old vector from one to the other node - a
-	  xy<double> a_v(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y());
-	  //new vector from one to the other node - b
-	  xy<double> b_v(p[1].get_x()-p[0].get_x(),p[1].get_y()-p[0].get_y());
+    //std::cout << bl << " " << br << " " << ccl << " "  << ccr << " " << cl << " " << cr << " " << top << std::endl;
 
-	  double absa=sqrt(a_v.normSquare());
-	  double absb=sqrt(b_v.normSquare());
+    Gnome::Canvas::Points arrow_points;
+    arrow_points.push_back(Gnome::Art::Point( bl.x , bl.y  ) );
+    arrow_points.push_back(Gnome::Art::Point( br.x , br.y  ) );
+    arrow_points.push_back(Gnome::Art::Point( ccr.x, ccr.y ) );
+    arrow_points.push_back(Gnome::Art::Point( cr.x , cr.y  ) );
+    arrow_points.push_back(Gnome::Art::Point( top.x, top.y ) );
+    arrow_points.push_back(Gnome::Art::Point( cl.x , cl.y  ) );
+    arrow_points.push_back(Gnome::Art::Point( ccl.x, ccl.y ) );
 
-	  if((absa!=0)&&(absb!=0))
-	    {
-	      //old vector from one node to the breakpoint - c
-	      xy<double> c_v(my_points[1].get_x()-my_points[0].get_x(),my_points[1].get_y()-my_points[0].get_y());
-
-	      //unit vector with the same direction to a_v
-	      xy<double> a_v_u(a_v.x/absa,a_v.y/absa);
-
-	      //normal vector of unit vector with the same direction to a_v
-	      xy<double> a_v_u_n(((-1)*a_v_u.y),a_v_u.x);
-
-	      //unit vector with the same direction to b_v
-	      xy<double> b_v_u(b_v.x/absb,b_v.y/absb);
-
-	      //normal vector of unit vector with the same direction to b_v
-	      xy<double> b_v_u_n(((-1)*b_v_u.y),b_v_u.x);
-
-	      //vector c in a_v_u and a_v_u_n co-ordinate system
-	      xy<double> c_a(c_v*a_v_u,c_v*a_v_u_n);
-
-	      //new vector from one node to the breakpoint - d - we have to calculate this one
-	      xy<double> d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n);
-
-	      my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y());
-
-	      my_points[0]=p[0];
-	      my_points[2]=p[1];
-	  
-	      Gnome::Canvas::Points points;
-	      for(int i=0;i<3;i++)
-		{
-		  points.push_back(my_points[i]);
-		}
-	      property_points().set_value(points);
-	    }
-	  else
-	    {
-	      //if distance is 0, segmentation would be occured
-	      //in calculations, because of division by zero
-	      //But we have luck: the edge cannot be seen in
-	      //this case, so no update needed
-	      set_arrow=false;
-	    }
-	}
-    }
-  if(set_arrow)
-    {
-      //calculating coordinates of the direction indicator arrow
-
-      xy<gdouble> target( my_points[2].get_x(), my_points[2].get_y() );
-      xy<gdouble> center( my_points[1].get_x(), my_points[1].get_y() );
-
-      xy<gdouble> unit_vector_in_dir(target-center);
-      double length=sqrt( unit_vector_in_dir.normSquare() );
-
-      //       std::cout << target << " - " << center << " = " << unit_vector_in_dir << "    / " <<unit_vector_in_dir.normSquare() ;
-      unit_vector_in_dir/=length;
-      //       std::cout << " = " << unit_vector_in_dir << std::endl;
-
-      xy<gdouble> unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
-      //       std::cout << unit_norm_vector << std::endl;
-
-      {      
-	//       /\       // top
-	//      /  \      //
-	//      -  -      // c(enter)l(eft), ccl, ccr, cr
-	//       ||       //
-	//       ||       // b(ottom)l, br
-      }
-
-      double size=3;
-
-      xy<gdouble> bl (center - unit_vector_in_dir * 3 * size + unit_norm_vector * size );
-      xy<gdouble> br (center - unit_vector_in_dir * 3 * size - unit_norm_vector * size );
-      xy<gdouble> ccl(center + unit_vector_in_dir *  size + unit_norm_vector * size );
-      xy<gdouble> ccr(center + unit_vector_in_dir *  size - unit_norm_vector * size );
-      xy<gdouble> cl (center + unit_vector_in_dir *  size + unit_norm_vector * 2 * size );
-      xy<gdouble> cr (center + unit_vector_in_dir *  size - unit_norm_vector * 2 * size );
-      xy<gdouble> top(center + unit_vector_in_dir * 3 * size);
-	 
-      //std::cout << bl << " " << br << " " << ccl << " "  << ccr << " " << cl << " " << cr << " " << top << std::endl;
-
-      Gnome::Canvas::Points arrow_points;
-      arrow_points.push_back(Gnome::Art::Point( bl.x , bl.y  ) );
-      arrow_points.push_back(Gnome::Art::Point( br.x , br.y  ) );
-      arrow_points.push_back(Gnome::Art::Point( ccr.x, ccr.y ) );
-      arrow_points.push_back(Gnome::Art::Point( cr.x , cr.y  ) );
-      arrow_points.push_back(Gnome::Art::Point( top.x, top.y ) );
-      arrow_points.push_back(Gnome::Art::Point( cl.x , cl.y  ) );
-      arrow_points.push_back(Gnome::Art::Point( ccl.x, ccl.y ) );
-
-      arrow->property_points().set_value(arrow_points);
-    }
+    arrow->property_points().set_value(arrow_points);
+  }
 }
 
@@ -204,10 +118,8 @@
 	  Gnome::Canvas::Points points_new;
 
-	  points_new.push_back(my_points[0]);
-	  points_new.push_back(my_points[1]=Gnome::Art::Point(my_points[1].get_x()+dx,my_points[1].get_y()+dy));
-	  points_new.push_back(my_points[2]);
+          gdc.mytab.mapstorage.arrow_pos.set(edge, gdc.mytab.mapstorage.arrow_pos[edge] + XY(dx, dy));
 
-	  setPoints(points_new);
-	  gdc.textReposition(xy<double>(my_points[1].get_x(),my_points[1].get_y()));
+	  draw();
+	  gdc.textReposition(gdc.mytab.mapstorage.arrow_pos[edge]);
 
 	  clicked_x=e->motion.x;
@@ -220,8 +132,2 @@
   return true;
 }
-
-xy<double> GraphDisplayerCanvas::BrokenEdge::getArrowPos()
-{
-  xy<double> ret_val(my_points[1].get_x(),my_points[1].get_y());
-  return ret_val;
-}
Index: graph_displayer_canvas-event.cc
===================================================================
--- graph_displayer_canvas-event.cc	(revision 96)
+++ graph_displayer_canvas-event.cc	(revision 98)
@@ -148,9 +148,9 @@
         double coord_y = new_y - (clicked_y - (mytab.mapstorage).coords[active_node].y);
 
+        // write back the new coordinates to the coords map
+        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
+
         clicked_x=new_x;
         clicked_y=new_y;
-
-        // write back the new coordinates to the coords map
-        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
 
         // reposition the coordinates text
@@ -184,25 +184,23 @@
         for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
-            Gnome::Canvas::Points coos;
-            double x1, x2, y1, y2;
-
-            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
-            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
+            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.coords[target].x,
+                        mytab.mapstorage.coords[target].y);
+            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
+
+            XY arrow_pos;
 	    if(isbutton==3)
-	      {
-		edgesmap[ei]->setPoints(coos);
-	      }
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, false);
 	    else
-	      {
-		edgesmap[ei]->setPoints(coos,true);
-	      }
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, true);
+
+            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+            edgesmap[ei]->draw();
 
 	    //reposition of edgetext
-	    xy<double> text_pos=edgesmap[ei]->getArrowPos();
-	    text_pos+=(xy<double>(10,10));
+	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
+	    text_pos+=(XY(10,10));
 	    edgetextmap[ei]->property_x().set_value(text_pos.x);
 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
@@ -211,24 +209,23 @@
         for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
-            Gnome::Canvas::Points coos;
-            double x1, x2, y1, y2;
-
-            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
-            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
-            coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
+            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.coords[source].x,
+                        mytab.mapstorage.coords[source].y);
+            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
+
+            XY arrow_pos;
 	    if(isbutton==3)
-	      {
-		edgesmap[ei]->setPoints(coos);
-	      }
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, false);
 	    else
-	      {
-		edgesmap[ei]->setPoints(coos,true);
-	      }
-
-	    xy<double> text_pos=edgesmap[ei]->getArrowPos();
-	    text_pos+=(xy<double>(10,10));
+              arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, true);
+
+            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+            edgesmap[ei]->draw();
+
+	    //reposition of edgetext
+	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
+	    text_pos+=(XY(10,10));
 	    edgetextmap[ei]->property_x().set_value(text_pos.x);
 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
@@ -239,4 +236,56 @@
 
   return false;
+}
+
+XY GraphDisplayerCanvas::calcArrowPos(XY moved_node_1, XY moved_node_2, XY fix_node, XY old_arrow_pos, bool move)
+{
+  if(!move)
+  {
+    return XY((moved_node_2.x + fix_node.x) / 2.0, (moved_node_2.y + fix_node.y) / 2.0);
+  }
+  else
+  {
+    //////////////////////////////////////////////////////////////////////////////////////////////////////
+    /////////// keeps shape-with scalar multiplication - version 2.
+    //////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    //old vector from one to the other node - a
+    xy<double> a_v(moved_node_1.x-fix_node.x,moved_node_1.y-fix_node.y);
+    //new vector from one to the other node - b
+    xy<double> b_v(moved_node_2.x-fix_node.x,moved_node_2.y-fix_node.y);
+
+    double absa=sqrt(a_v.normSquare());
+    double absb=sqrt(b_v.normSquare());
+
+    if ((absa == 0.0) || (absb == 0.0))
+    {
+      return old_arrow_pos;
+    }
+    else
+    {
+      //old vector from one node to the breakpoint - c
+      xy<double> c_v(old_arrow_pos.x-fix_node.x,old_arrow_pos.y-fix_node.y);
+
+      //unit vector with the same direction to a_v
+      xy<double> a_v_u(a_v.x/absa,a_v.y/absa);
+
+      //normal vector of unit vector with the same direction to a_v
+      xy<double> a_v_u_n(((-1)*a_v_u.y),a_v_u.x);
+
+      //unit vector with the same direction to b_v
+      xy<double> b_v_u(b_v.x/absb,b_v.y/absb);
+
+      //normal vector of unit vector with the same direction to b_v
+      xy<double> b_v_u_n(((-1)*b_v_u.y),b_v_u.x);
+
+      //vector c in a_v_u and a_v_u_n co-ordinate system
+      xy<double> c_a(c_v*a_v_u,c_v*a_v_u_n);
+
+      //new vector from one node to the breakpoint - d - we have to calculate this one
+      xy<double> d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n);
+
+      return XY(d_v.x+fix_node.x,d_v.y+fix_node.y);
+    }
+  }
 }
 
@@ -406,5 +455,5 @@
 
               //drawing new edge
-              edgesmap[active_edge]=new BrokenEdge(displayed_graph, coos,
+              edgesmap[active_edge]=new BrokenEdge(displayed_graph, active_edge,
                   *this);
               *(edgesmap[active_edge]) <<
@@ -415,6 +464,6 @@
 
               //initializing edge-text as well, to empty string
-              xy<double> text_pos=edgesmap[active_edge]->getArrowPos();
-              text_pos+=(xy<double>(10,10));
+              XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
+              text_pos+=(XY(10,10));
 
               edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
Index: graph_displayer_canvas.cc
===================================================================
--- graph_displayer_canvas.cc	(revision 96)
+++ graph_displayer_canvas.cc	(revision 98)
@@ -169,5 +169,5 @@
           (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].y));
     
-    edgesmap[i]=new BrokenEdge(displayed_graph, coos, *this);
+    edgesmap[i]=new BrokenEdge(displayed_graph, i, *this);
     *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green");
     edgesmap[i]->property_width_units().set_value(10);    
@@ -176,6 +176,6 @@
     //initializing edge-text as well, to empty string
 
-    xy<double> text_pos=edgesmap[i]->getArrowPos();
-    text_pos+=(xy<double>(10,10));
+    XY text_pos=mytab.mapstorage.arrow_pos[i];
+    text_pos+=(XY(10,10));
 
     edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
Index: graph_displayer_canvas.h
===================================================================
--- graph_displayer_canvas.h	(revision 96)
+++ graph_displayer_canvas.h	(revision 98)
@@ -15,10 +15,11 @@
 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
 {
+  friend class BrokenEdge;
+
   class BrokenEdge : public Gnome::Canvas::Line
   {
+    Edge edge;
     GraphDisplayerCanvas & gdc;
     Gnome::Canvas::Polygon * arrow;
-    Gnome::Art::Point * my_points;
-
 
     ///Indicates whether the button of mouse is pressed or not
@@ -32,8 +33,7 @@
     bool edgeFormerEventHandler(GdkEvent*);
   public:
-    BrokenEdge(Gnome::Canvas::Group &, Gnome::Canvas::Points, GraphDisplayerCanvas &);
+    BrokenEdge(Gnome::Canvas::Group &, Edge, GraphDisplayerCanvas &);
     ~BrokenEdge();
-    void setPoints(Gnome::Canvas::Points, bool move=false);
-    xy<double> getArrowPos();
+    void draw();
   };
   typedef Gnome::Canvas::CanvasAA Parent;
@@ -201,4 +201,5 @@
   NoteBookTab & mytab;
 
+  XY GraphDisplayerCanvas::calcArrowPos(XY, XY, XY, XY, bool);
 };
 
Index: gui_reader.cc
===================================================================
--- gui_reader.cc	(revision 98)
+++ gui_reader.cc	(revision 98)
@@ -0,0 +1,33 @@
+#include "gui_reader.h"
+#include "xml.h"
+#include "mapstorage.h"
+#include <lemon/xy.h>
+#include <vector>
+
+bool GuiReader::header(const std::string& line)
+{
+  std::istringstream ls(line);
+  std::string head;
+  ls >> head;
+  return head == "@gui";
+}
+
+void GuiReader::read(std::istream& is)
+{
+  XmlIo x(is);
+  std::map<int, xy<double> > m;
+  x("arrow_pos", m);
+
+  if ((int)m.size() != countEdges(mapstorage->graph)) return;
+
+  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
+  {
+    int edgeid = (int)(*mapstorage->edgemap_storage["id"])[e];
+    mapstorage->arrow_pos.set(e, m[edgeid]);
+  }
+  mapstorage->ArrowPosReadOK();
+}
+
+GuiReader::GuiReader(LemonReader& reader, MapStorage* ms) : Parent(reader), mapstorage(ms)
+{
+}
Index: gui_reader.h
===================================================================
--- gui_reader.h	(revision 98)
+++ gui_reader.h	(revision 98)
@@ -0,0 +1,21 @@
+#ifndef GUI_READER_H
+#define GUI_READER_H
+
+#include "mapstorage.h"
+#include <lemon/lemon_reader.h>
+
+using lemon::LemonReader;
+
+class GuiReader : public LemonReader::SectionReader
+{
+  private:
+    MapStorage* mapstorage;
+  protected:
+    virtual bool header(const std::string&);
+    virtual void read(std::istream&);
+  public:
+    typedef LemonReader::SectionReader Parent;
+    GuiReader(LemonReader&, MapStorage*);
+};
+
+#endif
Index: gui_writer.cc
===================================================================
--- gui_writer.cc	(revision 98)
+++ gui_writer.cc	(revision 98)
@@ -0,0 +1,26 @@
+#include "gui_writer.h"
+#include "xml.h"
+#include "mapstorage.h"
+#include <lemon/xy.h>
+#include <vector>
+
+std::string GuiWriter::header()
+{
+  return "@gui";
+}
+
+void GuiWriter::write(std::ostream& os)
+{
+  XmlIo x(os);
+  std::map<int, xy<double> > m;
+  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
+  {
+    int edgeid = (int)(*(mapstorage->edgemap_storage["id"]))[e];
+    m[edgeid] = mapstorage->arrow_pos[e];
+  }
+  x("arrow_pos", m);
+}
+
+GuiWriter::GuiWriter(LemonWriter& writer, MapStorage* ms) : Parent(writer), mapstorage(ms)
+{
+}
Index: gui_writer.h
===================================================================
--- gui_writer.h	(revision 98)
+++ gui_writer.h	(revision 98)
@@ -0,0 +1,21 @@
+#ifndef GUI_WRITER_H
+#define GUI_WRITER_H
+
+#include "mapstorage.h"
+#include <lemon/lemon_writer.h>
+
+using lemon::LemonWriter;
+
+class GuiWriter : public LemonWriter::SectionWriter
+{
+  private:
+    MapStorage* mapstorage;
+  protected:
+    virtual std::string header();
+    virtual void write(std::ostream&);
+  public:
+    typedef LemonWriter::SectionWriter Parent;
+    GuiWriter(LemonWriter&, MapStorage*);
+};
+
+#endif
Index: mapstorage.cc
===================================================================
--- mapstorage.cc	(revision 94)
+++ mapstorage.cc	(revision 98)
@@ -1,3 +1,5 @@
 #include "mapstorage.h"
+#include "gui_writer.h"
+#include "gui_reader.h"
 #include <gtkmm.h>
 #include <cmath>
@@ -5,5 +7,5 @@
 #include <cmath>
 
-MapStorage::MapStorage() : modified(false), file_name("")
+MapStorage::MapStorage() : modified(false), file_name(""), arrow_pos_read_ok(false)
 {
   nodemap_storage["coordinates_x"] = new Graph::NodeMap<double>(graph);
@@ -11,4 +13,9 @@
   nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph);
   coords.setYMap(*nodemap_storage["coordinates_y"]);
+
+  edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph);
+  arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]);
+  edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph);
+  arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]);
 
   nodemap_storage["id"] = new Graph::NodeMap<double>(graph);
@@ -248,4 +255,5 @@
       greader.readEdgeMap(*it, *edgemap_storage[*it]);
     }
+    GuiReader gui_reader(greader, this);
     greader.run();
   } catch (DataFormatError& error) {
@@ -284,4 +292,13 @@
   }
 
+  if (!arrow_pos_read_ok)
+  {
+    arrow_pos_read_ok = false;
+    for (EdgeIt e(graph); e != INVALID; ++e)
+    {
+      arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
+    }
+  }
+
   // fill in the default values for the maps
   for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
@@ -339,12 +356,17 @@
   {
     gwriter.writeNodeMap(it->first, *(it->second));
-    //std::cout << "wrote " << it->first << " nodemap" << std::endl;
   }
   for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
       edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
   {
-    gwriter.writeEdgeMap(it->first, *(it->second));
-    //std::cout << "wrote " << it->first << " edgemap" << std::endl;
-  }
+    if ((it->first != "arrow_pos_x") &&
+        (it->first != "arrow_pos_y"))
+    {
+      gwriter.writeEdgeMap(it->first, *(it->second));
+    }
+  }
+
+  GuiWriter gui_writer(gwriter, this);
+
   gwriter.run();
 }
@@ -366,5 +388,7 @@
       edgemap_storage.begin(); it != edgemap_storage.end(); ++it)
   {
-    if (it->first != "id")
+    if ((it->first != "id") &&
+        (it->first != "arrow_pos_x") &&
+        (it->first != "arrow_pos_y"))
     {
       delete it->second;
@@ -388,2 +412,7 @@
   modified = false;
 }
+
+void MapStorage::ArrowPosReadOK()
+{
+  arrow_pos_read_ok = true;
+}
Index: mapstorage.h
===================================================================
--- mapstorage.h	(revision 94)
+++ mapstorage.h	(revision 98)
@@ -24,5 +24,8 @@
 
   Graph graph;
+  /// the coordinates of the nodes
   XYMap<Graph::NodeMap<double> > coords;
+  /// the coordinates of the arrows on the edges
+  XYMap<Graph::EdgeMap<double> > arrow_pos;
 
   bool modified;
@@ -52,4 +55,6 @@
   // Default values for the maps
   std::map< std::string, double > edgemap_default;
+
+  bool arrow_pos_read_ok;
 
 protected:
@@ -128,4 +133,6 @@
 
   void clear();
+
+  void ArrowPosReadOK();
 };
 
Index: xymap.h
===================================================================
--- xymap.h	(revision 53)
+++ xymap.h	(revision 98)
@@ -4,7 +4,4 @@
 #include <lemon/list_graph.h>
 #include <lemon/xy.h>
-
-using lemon::ListGraph;
-using lemon::xy;
 
 template<class M>
@@ -16,5 +13,5 @@
   public:
     typedef typename M::Key Key;
-    typedef xy<typename M::Value> Value;
+    typedef lemon::xy<typename M::Value> Value;
     XYMap() {}
     XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
