# HG changeset patch # User hegyi # Date 1172766493 0 # Node ID d6cc0579b94b0c4e5664e5b1b1995217277e6174 # Parent c1084e2bff1053d62729a52545e0c9dc24d984c7 Shape feature of EPS can be used. diff -r c1084e2bff10 -r d6cc0579b94b eps_win.cc --- a/eps_win.cc Thu Mar 01 14:45:07 2007 +0000 +++ b/eps_win.cc Thu Mar 01 16:28:13 2007 +0000 @@ -17,6 +17,9 @@ */ #include + +#include + #include 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 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); +} diff -r c1084e2bff10 -r d6cc0579b94b eps_win.h --- a/eps_win.h Thu Mar 01 14:45:07 2007 +0000 +++ b/eps_win.h Thu Mar 01 16:28:13 2007 +0000 @@ -19,6 +19,8 @@ #ifndef EPS_WIN_H #define EPS_WIN_H +class MapSelector; + #include #include #include @@ -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); ///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, std::string > signal_eps_details; + sigc::signal, std::string, std::string > signal_eps_details; ///returns \ref signal_eps_details - sigc::signal, std::string > signal_eps_details_ch(){return signal_eps_details;}; + sigc::signal, std::string, std::string > signal_eps_details_ch(){return signal_eps_details;}; ///indicates that the windows can be closed sigc::signal signal_eps_close; @@ -86,7 +89,20 @@ ///returns \ref signal_eps_close sigc::signal signal_eps_close_ch(){return signal_eps_close;}; + ///indicates that the windows can be closed + sigc::signal signal_new_map; + ///returns \ref signal_eps_close + sigc::signal 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 diff -r c1084e2bff10 -r d6cc0579b94b mapstorage.cc --- a/mapstorage.cc Thu Mar 01 14:45:07 2007 +0000 +++ b/mapstorage.cc Thu Mar 01 16:28:13 2007 +0000 @@ -591,8 +591,9 @@ background_scaling = scaling; } -void MapStorage::exportGraphToEPS(std::vector options, std::string filename) +void MapStorage::exportGraphToEPS(std::vector options, std::string filename, std::string shapemap) { + Graph::NodeMap _shapes(graph, 0); Graph::NodeMap _nodeColors(graph, 0); Graph::EdgeMap _edgeColors(graph, 0); Graph::NodeMap _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(); diff -r c1084e2bff10 -r d6cc0579b94b mapstorage.h --- a/mapstorage.h Thu Mar 01 14:45:07 2007 +0000 +++ b/mapstorage.h Thu Mar 01 16:28:13 2007 +0000 @@ -294,7 +294,7 @@ void redesign_data_changed(); - void exportGraphToEPS(std::vector, std::string); + void exportGraphToEPS(std::vector, std::string, std::string); }; #endif //MAPSTORAGE_H diff -r c1084e2bff10 -r d6cc0579b94b nbtab.cc --- a/nbtab.cc Thu Mar 01 14:45:07 2007 +0000 +++ b/nbtab.cc Thu Mar 01 16:28:13 2007 +0000 @@ -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 options, std::string filename) +void NoteBookTab::exportGraphToEPS(std::vector options, std::string filename, std::string shapemap) { - mapstorage->exportGraphToEPS(options, filename); + mapstorage->exportGraphToEPS(options, filename, shapemap); } void NoteBookTab::title_changed(std::string newtitle) diff -r c1084e2bff10 -r d6cc0579b94b nbtab.h --- a/nbtab.h Thu Mar 01 14:45:07 2007 +0000 +++ b/nbtab.h Thu Mar 01 16:28:13 2007 +0000 @@ -228,7 +228,7 @@ void reDesignGraph(); ///Lets Mapstorage export the graph to EPS - void exportGraphToEPS(std::vector, std::string); + void exportGraphToEPS(std::vector, std::string, std::string); ///\ref MapWin calls this function when it updates the maplist in comboboxes. void active_maps_needed();