Shape feature of EPS can be used.
authorhegyi
Thu, 01 Mar 2007 16:28:13 +0000
changeset 198d6cc0579b94b
parent 197 c1084e2bff10
child 199 128195bbab73
Shape feature of EPS can be used.
eps_win.cc
eps_win.h
mapstorage.cc
mapstorage.h
nbtab.cc
nbtab.h
     1.1 --- a/eps_win.cc	Thu Mar 01 14:45:07 2007 +0000
     1.2 +++ b/eps_win.cc	Thu Mar 01 16:28:13 2007 +0000
     1.3 @@ -17,6 +17,9 @@
     1.4   */
     1.5  
     1.6  #include <eps_win.h>
     1.7 +
     1.8 +#include <mapselector.h>
     1.9 +
    1.10  #include <set>
    1.11  
    1.12  bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
    1.13 @@ -28,7 +31,7 @@
    1.14    return true;
    1.15  }
    1.16  
    1.17 -EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true)
    1.18 +EpsWin::EpsWin(const std::string& title, std::vector<std::string> nml):Gtk::Dialog(title, true, true)
    1.19  {
    1.20    set_default_size(200, 50);
    1.21  
    1.22 @@ -54,12 +57,16 @@
    1.23        (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
    1.24      }
    1.25  
    1.26 +  mapselector=new MapSelector(nml, "", "Nodeshapes", false);
    1.27 +  mapselector->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &EpsWin::newMapWinNeeded));
    1.28 +
    1.29    hbox.pack_start(*(new Gtk::Label("Filename")));
    1.30    hbox.pack_start(name);
    1.31  
    1.32    Gtk::VBox * vbox=get_vbox();
    1.33  
    1.34    vbox->pack_start(*table);
    1.35 +  vbox->pack_start(*mapselector);
    1.36    vbox->pack_start(hbox);
    1.37  
    1.38    //OK button
    1.39 @@ -87,7 +94,17 @@
    1.40  	{
    1.41  	  values[i]=options[i]->get_active();
    1.42  	}
    1.43 -      signal_eps_details.emit(values, name.get_text());
    1.44 +      signal_eps_details.emit(values, name.get_text(), mapselector->get_active_text());
    1.45      }
    1.46    on_delete_event(NULL);
    1.47  }
    1.48 +
    1.49 +void EpsWin::newMapWinNeeded(bool isitedge)
    1.50 +{
    1.51 +  signal_new_map.emit(false);
    1.52 +}
    1.53 +
    1.54 +void EpsWin::registerNewNodeMap(std::string newmapname)
    1.55 +{
    1.56 +    mapselector->append_text((Glib::ustring)newmapname);
    1.57 +}
     2.1 --- a/eps_win.h	Thu Mar 01 14:45:07 2007 +0000
     2.2 +++ b/eps_win.h	Thu Mar 01 16:28:13 2007 +0000
     2.3 @@ -19,6 +19,8 @@
     2.4  #ifndef EPS_WIN_H
     2.5  #define EPS_WIN_H
     2.6  
     2.7 +class MapSelector;
     2.8 +
     2.9  #include <all_include.h>
    2.10  #include <libgnomecanvasmm.h>
    2.11  #include <libgnomecanvasmm/polygon.h>
    2.12 @@ -49,6 +51,7 @@
    2.13    ///Filename
    2.14    Gtk::Entry name;
    2.15  
    2.16 +  MapSelector * mapselector;
    2.17  public:
    2.18    ///Constructor
    2.19  
    2.20 @@ -58,7 +61,7 @@
    2.21    ///\param eml edgemap list
    2.22    ///\param nml nodemap list
    2.23    ///\param mw the owner \ref NoteBookTab (\ref mytab)
    2.24 -  EpsWin(const std::string& title);
    2.25 +  EpsWin(const std::string& title, std::vector<std::string>);
    2.26  
    2.27    ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab)
    2.28    virtual bool on_delete_event(GdkEventAny *);
    2.29 @@ -75,10 +78,10 @@
    2.30    virtual void on_response(int response_id);
    2.31  
    2.32    ///indicates that user is ready to export EPS file
    2.33 -  sigc::signal<void, std::vector<bool>, std::string > signal_eps_details;
    2.34 +  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details;
    2.35  
    2.36    ///returns \ref signal_eps_details
    2.37 -  sigc::signal<void, std::vector<bool>, std::string > signal_eps_details_ch(){return signal_eps_details;};
    2.38 +  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details_ch(){return signal_eps_details;};
    2.39  
    2.40    ///indicates that the windows can be closed
    2.41    sigc::signal<void> signal_eps_close;
    2.42 @@ -86,7 +89,20 @@
    2.43    ///returns \ref signal_eps_close
    2.44    sigc::signal<void> signal_eps_close_ch(){return signal_eps_close;};
    2.45    
    2.46 +  ///indicates that the windows can be closed
    2.47 +  sigc::signal<void, bool> signal_new_map;
    2.48  
    2.49 +  ///returns \ref signal_eps_close
    2.50 +  sigc::signal<void, bool> signal_new_map_ch(){return signal_new_map;};
    2.51 +
    2.52 +  ///Function is called when new map is required.
    2.53 +  void newMapWinNeeded(bool);
    2.54 +
    2.55 +  ///This function inserts name of the new nodemap in the name list in \ref MapSelector s
    2.56 +
    2.57 +  ///\param new_name
    2.58 +  ///name of new map
    2.59 +  void registerNewNodeMap(std::string new_name);
    2.60  };
    2.61  
    2.62  #endif //EPS_WIN_H
     3.1 --- a/mapstorage.cc	Thu Mar 01 14:45:07 2007 +0000
     3.2 +++ b/mapstorage.cc	Thu Mar 01 16:28:13 2007 +0000
     3.3 @@ -591,8 +591,9 @@
     3.4    background_scaling = scaling;
     3.5  }
     3.6  
     3.7 -void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename)
     3.8 +void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
     3.9  {
    3.10 +  Graph::NodeMap<int> _shapes(graph, 0);
    3.11    Graph::NodeMap<int> _nodeColors(graph, 0);
    3.12    Graph::EdgeMap<int> _edgeColors(graph, 0);
    3.13    Graph::NodeMap<double> _nodeSizes(graph, 6.0);
    3.14 @@ -642,6 +643,13 @@
    3.15  	    }
    3.16  	}
    3.17      }
    3.18 +  if(shapemap!="")
    3.19 +    {
    3.20 +      if((minOfNodeMap(shapemap)>=0)&&(maxOfNodeMap(shapemap)<=4))
    3.21 +	{
    3.22 +	  _shapes=*(nodemap_storage[shapemap]);
    3.23 +	}
    3.24 +    }
    3.25  
    3.26    Palette palette;
    3.27    Palette paletteW(true);
    3.28 @@ -652,11 +660,12 @@
    3.29      absoluteNodeSizes().absoluteEdgeWidths().
    3.30      nodeScale(2).nodeSizes(_nodeSizes).
    3.31      coords(coords).
    3.32 +    nodeShapes(_shapes).
    3.33      nodeColors(composeMap(paletteW,_nodeColors)).
    3.34      edgeColors(composeMap(palette,_edgeColors)).
    3.35      edgeWidthScale(0.3).edgeWidths(_edgeWidths).
    3.36      nodeTexts(_nodeTextMap).nodeTextSize(7).
    3.37 -    enableParallel(_enableParallel).parEdgeDist(4).
    3.38 +    enableParallel(_enableParallel).parEdgeDist(5).
    3.39      drawArrows(_drawArrows).arrowWidth(7).arrowLength(7).
    3.40      run();
    3.41  
     4.1 --- a/mapstorage.h	Thu Mar 01 14:45:07 2007 +0000
     4.2 +++ b/mapstorage.h	Thu Mar 01 16:28:13 2007 +0000
     4.3 @@ -294,7 +294,7 @@
     4.4  
     4.5    void redesign_data_changed();
     4.6  
     4.7 -  void exportGraphToEPS(std::vector<bool>, std::string);
     4.8 +  void exportGraphToEPS(std::vector<bool>, std::string, std::string);
     4.9  };
    4.10  
    4.11  #endif //MAPSTORAGE_H
     5.1 --- a/nbtab.cc	Thu Mar 01 14:45:07 2007 +0000
     5.2 +++ b/nbtab.cc	Thu Mar 01 16:28:13 2007 +0000
     5.3 @@ -223,6 +223,10 @@
     5.4      {
     5.5        mapwin->registerNewNodeMap(mapname);
     5.6      }
     5.7 +  if(epswinexists)
     5.8 +    {
     5.9 +      epswin->registerNewNodeMap(mapname);
    5.10 +    }
    5.11  }
    5.12  
    5.13  void NoteBookTab::createMapWin(std::string name)
    5.14 @@ -240,11 +244,12 @@
    5.15  {
    5.16    if(!epswinexists)
    5.17      {
    5.18 -      epswin=new EpsWin("Export to EPS - "+name);
    5.19 +      epswin=new EpsWin("Export to EPS - "+name, mapstorage->getNodeMapList());
    5.20        epswin->show();
    5.21        epswinexists=true;
    5.22        epswin->signal_eps_details_ch().connect(sigc::mem_fun(*this, &NoteBookTab::exportGraphToEPS));
    5.23        epswin->signal_eps_close_ch().connect(sigc::mem_fun(*this, &NoteBookTab::closeEpsWin));
    5.24 +      epswin->signal_new_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::popupNewMapWin));
    5.25      }
    5.26  }
    5.27  
    5.28 @@ -320,9 +325,9 @@
    5.29    mapstorage->broadcastActiveMaps();
    5.30  }
    5.31  
    5.32 -void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
    5.33 +void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
    5.34  {
    5.35 -  mapstorage->exportGraphToEPS(options, filename);
    5.36 +  mapstorage->exportGraphToEPS(options, filename, shapemap);
    5.37  }
    5.38  
    5.39  void NoteBookTab::title_changed(std::string newtitle)
     6.1 --- a/nbtab.h	Thu Mar 01 14:45:07 2007 +0000
     6.2 +++ b/nbtab.h	Thu Mar 01 16:28:13 2007 +0000
     6.3 @@ -228,7 +228,7 @@
     6.4    void reDesignGraph();
     6.5  
     6.6    ///Lets Mapstorage export the graph to EPS
     6.7 -  void exportGraphToEPS(std::vector<bool>, std::string);
     6.8 +  void exportGraphToEPS(std::vector<bool>, std::string, std::string);
     6.9  
    6.10    ///\ref MapWin calls this function when it updates the maplist in comboboxes.
    6.11    void active_maps_needed();