[Lemon-commits] hegyi: r3212 - glemon/trunk

Lemon SVN svn at lemon.cs.elte.hu
Thu Mar 1 17:28:14 CET 2007


Author: hegyi
Date: Thu Mar  1 17:28:13 2007
New Revision: 3212

Modified:
   glemon/trunk/eps_win.cc
   glemon/trunk/eps_win.h
   glemon/trunk/mapstorage.cc
   glemon/trunk/mapstorage.h
   glemon/trunk/nbtab.cc
   glemon/trunk/nbtab.h

Log:
Shape feature of EPS can be used.

Modified: glemon/trunk/eps_win.cc
==============================================================================
--- glemon/trunk/eps_win.cc	(original)
+++ glemon/trunk/eps_win.cc	Thu Mar  1 17:28:13 2007
@@ -17,6 +17,9 @@
  */
 
 #include <eps_win.h>
+
+#include <mapselector.h>
+
 #include <set>
 
 bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
@@ -28,7 +31,7 @@
   return true;
 }
 
-EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true)
+EpsWin::EpsWin(const std::string& title, std::vector<std::string> nml):Gtk::Dialog(title, true, true)
 {
   set_default_size(200, 50);
 
@@ -54,12 +57,16 @@
       (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
     }
 
+  mapselector=new MapSelector(nml, "", "Nodeshapes", false);
+  mapselector->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &EpsWin::newMapWinNeeded));
+
   hbox.pack_start(*(new Gtk::Label("Filename")));
   hbox.pack_start(name);
 
   Gtk::VBox * vbox=get_vbox();
 
   vbox->pack_start(*table);
+  vbox->pack_start(*mapselector);
   vbox->pack_start(hbox);
 
   //OK button
@@ -87,7 +94,17 @@
 	{
 	  values[i]=options[i]->get_active();
 	}
-      signal_eps_details.emit(values, name.get_text());
+      signal_eps_details.emit(values, name.get_text(), mapselector->get_active_text());
     }
   on_delete_event(NULL);
 }
+
+void EpsWin::newMapWinNeeded(bool isitedge)
+{
+  signal_new_map.emit(false);
+}
+
+void EpsWin::registerNewNodeMap(std::string newmapname)
+{
+    mapselector->append_text((Glib::ustring)newmapname);
+}

Modified: glemon/trunk/eps_win.h
==============================================================================
--- glemon/trunk/eps_win.h	(original)
+++ glemon/trunk/eps_win.h	Thu Mar  1 17:28:13 2007
@@ -19,6 +19,8 @@
 #ifndef EPS_WIN_H
 #define EPS_WIN_H
 
+class MapSelector;
+
 #include <all_include.h>
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
@@ -49,6 +51,7 @@
   ///Filename
   Gtk::Entry name;
 
+  MapSelector * mapselector;
 public:
   ///Constructor
 
@@ -58,7 +61,7 @@
   ///\param eml edgemap list
   ///\param nml nodemap list
   ///\param mw the owner \ref NoteBookTab (\ref mytab)
-  EpsWin(const std::string& title);
+  EpsWin(const std::string& title, std::vector<std::string>);
 
   ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab)
   virtual bool on_delete_event(GdkEventAny *);
@@ -75,10 +78,10 @@
   virtual void on_response(int response_id);
 
   ///indicates that user is ready to export EPS file
-  sigc::signal<void, std::vector<bool>, std::string > signal_eps_details;
+  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details;
 
   ///returns \ref signal_eps_details
-  sigc::signal<void, std::vector<bool>, std::string > signal_eps_details_ch(){return signal_eps_details;};
+  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details_ch(){return signal_eps_details;};
 
   ///indicates that the windows can be closed
   sigc::signal<void> signal_eps_close;
@@ -86,7 +89,20 @@
   ///returns \ref signal_eps_close
   sigc::signal<void> signal_eps_close_ch(){return signal_eps_close;};
   
+  ///indicates that the windows can be closed
+  sigc::signal<void, bool> signal_new_map;
+
+  ///returns \ref signal_eps_close
+  sigc::signal<void, bool> signal_new_map_ch(){return signal_new_map;};
+
+  ///Function is called when new map is required.
+  void newMapWinNeeded(bool);
+
+  ///This function inserts name of the new nodemap in the name list in \ref MapSelector s
 
+  ///\param new_name
+  ///name of new map
+  void registerNewNodeMap(std::string new_name);
 };
 
 #endif //EPS_WIN_H

Modified: glemon/trunk/mapstorage.cc
==============================================================================
--- glemon/trunk/mapstorage.cc	(original)
+++ glemon/trunk/mapstorage.cc	Thu Mar  1 17:28:13 2007
@@ -591,8 +591,9 @@
   background_scaling = scaling;
 }
 
-void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename)
+void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
 {
+  Graph::NodeMap<int> _shapes(graph, 0);
   Graph::NodeMap<int> _nodeColors(graph, 0);
   Graph::EdgeMap<int> _edgeColors(graph, 0);
   Graph::NodeMap<double> _nodeSizes(graph, 6.0);
@@ -642,6 +643,13 @@
 	    }
 	}
     }
+  if(shapemap!="")
+    {
+      if((minOfNodeMap(shapemap)>=0)&&(maxOfNodeMap(shapemap)<=4))
+	{
+	  _shapes=*(nodemap_storage[shapemap]);
+	}
+    }
 
   Palette palette;
   Palette paletteW(true);
@@ -652,11 +660,12 @@
     absoluteNodeSizes().absoluteEdgeWidths().
     nodeScale(2).nodeSizes(_nodeSizes).
     coords(coords).
+    nodeShapes(_shapes).
     nodeColors(composeMap(paletteW,_nodeColors)).
     edgeColors(composeMap(palette,_edgeColors)).
     edgeWidthScale(0.3).edgeWidths(_edgeWidths).
     nodeTexts(_nodeTextMap).nodeTextSize(7).
-    enableParallel(_enableParallel).parEdgeDist(4).
+    enableParallel(_enableParallel).parEdgeDist(5).
     drawArrows(_drawArrows).arrowWidth(7).arrowLength(7).
     run();
 

Modified: glemon/trunk/mapstorage.h
==============================================================================
--- glemon/trunk/mapstorage.h	(original)
+++ glemon/trunk/mapstorage.h	Thu Mar  1 17:28:13 2007
@@ -294,7 +294,7 @@
 
   void redesign_data_changed();
 
-  void exportGraphToEPS(std::vector<bool>, std::string);
+  void exportGraphToEPS(std::vector<bool>, std::string, std::string);
 };
 
 #endif //MAPSTORAGE_H

Modified: glemon/trunk/nbtab.cc
==============================================================================
--- glemon/trunk/nbtab.cc	(original)
+++ glemon/trunk/nbtab.cc	Thu Mar  1 17:28:13 2007
@@ -223,6 +223,10 @@
     {
       mapwin->registerNewNodeMap(mapname);
     }
+  if(epswinexists)
+    {
+      epswin->registerNewNodeMap(mapname);
+    }
 }
 
 void NoteBookTab::createMapWin(std::string name)
@@ -240,11 +244,12 @@
 {
   if(!epswinexists)
     {
-      epswin=new EpsWin("Export to EPS - "+name);
+      epswin=new EpsWin("Export to EPS - "+name, mapstorage->getNodeMapList());
       epswin->show();
       epswinexists=true;
       epswin->signal_eps_details_ch().connect(sigc::mem_fun(*this, &NoteBookTab::exportGraphToEPS));
       epswin->signal_eps_close_ch().connect(sigc::mem_fun(*this, &NoteBookTab::closeEpsWin));
+      epswin->signal_new_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::popupNewMapWin));
     }
 }
 
@@ -320,9 +325,9 @@
   mapstorage->broadcastActiveMaps();
 }
 
-void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
+void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
 {
-  mapstorage->exportGraphToEPS(options, filename);
+  mapstorage->exportGraphToEPS(options, filename, shapemap);
 }
 
 void NoteBookTab::title_changed(std::string newtitle)

Modified: glemon/trunk/nbtab.h
==============================================================================
--- glemon/trunk/nbtab.h	(original)
+++ glemon/trunk/nbtab.h	Thu Mar  1 17:28:13 2007
@@ -228,7 +228,7 @@
   void reDesignGraph();
 
   ///Lets Mapstorage export the graph to EPS
-  void exportGraphToEPS(std::vector<bool>, std::string);
+  void exportGraphToEPS(std::vector<bool>, std::string, std::string);
 
   ///\ref MapWin calls this function when it updates the maplist in comboboxes.
   void active_maps_needed();



More information about the Lemon-commits mailing list