Changeset 191:af2ed974ab68 in glemon-0.x
- Timestamp:
- 02/27/07 18:18:19 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3202
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r186 r191 49 49 dijkstrabox.cc \ 50 50 background_chooser_dialog.h \ 51 background_chooser_dialog.cc 51 background_chooser_dialog.cc \ 52 eps_win.h \ 53 eps_win.cc 52 54 53 55 glemon_CXXFLAGS = $(GTK_CFLAGS) $(LEMON_CFLAGS) -
all_include.h
r174 r191 35 35 enum {E_WIDTH, E_COLOR, E_TEXT, EDGE_PROPERTY_NUM}; // edge properties; 36 36 enum {N_RADIUS, N_COLOR, N_TEXT, NODE_PROPERTY_NUM}; // node properties; 37 enum {N_MAPS, E_MAPS, ARROWS, PAR, EPS_PROPERTY_NUM}; // eps properties; 37 38 enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, MAP_EDIT, TOOL_NUM}; // tools; 38 39 #define RANGE 3 -
main_win.cc
r190 r191 49 49 Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline( 50 50 2328, gui_icons_newmap); 51 Glib::RefPtr<Gdk::Pixbuf> p_eps_pixbuf = Gdk::Pixbuf::create_from_inline( 52 2328, gui_icons_eps); 51 53 52 54 Gtk::IconSource move_icon_source; … … 85 87 newmap_icon_set.add_source(newmap_icon_source); 86 88 p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set); 89 90 Gtk::IconSource eps_icon_source; 91 eps_icon_source.set_pixbuf(p_eps_pixbuf); 92 Gtk::IconSet eps_icon_set; 93 eps_icon_set.add_source(eps_icon_source); 94 p_icon_factory->add(Gtk::StockID("gd-eps"), eps_icon_set); 87 95 88 96 p_icon_factory->add_default(); … … 152 160 ag->add( Gtk::Action::create("DesignGraph", Gtk::Stock::REFRESH), 153 161 sigc::mem_fun ( *this , &MainWin::reDesignGraph ) ); 162 163 ag->add( Gtk::Action::create("Eps", Gtk::StockID("gd-eps")), 164 sigc::mem_fun ( *this , &MainWin::exportToEPS ) ); 154 165 155 166 uim=Gtk::UIManager::create(); … … 209 220 " <toolitem action='AddMap' />" 210 221 " <toolitem action='DesignGraph' />" 222 " <toolitem action='Eps' />" 211 223 " </toolbar>" 212 224 "</ui>"; … … 611 623 } 612 624 625 void MainWin::exportToEPS() 626 { 627 if(active_tab!=-1) 628 { 629 tabs[active_tab]->createExportToEPSWin(tabnames[active_tab]); 630 } 631 } 632 613 633 void MainWin::createBackgroundChooser() 614 634 { -
main_win.h
r190 r191 263 263 virtual void reDesignGraph(); 264 264 265 virtual void exportToEPS(); 266 265 267 void createBackgroundChooser(); 266 268 }; -
mapstorage.cc
r184 r191 24 24 #include <cmath> 25 25 #include <gtkmm.h> 26 27 const double i_d=20; 26 #include<lemon/graph_to_eps.h> 27 28 const int i_d=20; 28 29 const double a_d=0.05; 29 30 const double p_d=40000; … … 590 591 background_scaling = scaling; 591 592 } 593 594 void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename) 595 { 596 Graph::NodeMap<int> _nodeColors(graph, 0); 597 Graph::EdgeMap<int> _edgeColors(graph, 0); 598 Graph::NodeMap<double> _nodeSizes(graph, 6.0); 599 Graph::EdgeMap<double> _edgeWidths(graph, 1.0); 600 bool _drawArrows=options[ARROWS]; 601 bool _enableParallel=options[PAR]; 602 603 std::string emptyString=""; 604 Graph::NodeMap<std::string> _nodeTextMap(graph,emptyString); 605 606 //_nodeTextMap=(Graph::NodeMap<void> *)&emptyStringMap; 607 608 if(options[N_MAPS]) 609 { 610 if(active_nodemaps[N_RADIUS]!="") 611 { 612 _nodeSizes=*(nodemap_storage[active_nodemaps[N_RADIUS]]); 613 } 614 if(active_nodemaps[N_COLOR]!="") 615 { 616 for(NodeIt ni(graph);ni!=INVALID;++ni) 617 { 618 _nodeColors[ni]=(int)((*(nodemap_storage[active_nodemaps[N_COLOR]]))[ni]); 619 } 620 } 621 if(active_nodemaps[N_TEXT]!="") 622 { 623 for(NodeIt ni(graph);ni!=INVALID;++ni) 624 { 625 std::ostringstream o; 626 o << ((*(nodemap_storage[active_nodemaps[N_TEXT]]))[ni]); 627 _nodeTextMap[ni]=o.str(); 628 } 629 } 630 } 631 if(options[E_MAPS]) 632 { 633 if(active_edgemaps[E_WIDTH]!="") 634 { 635 _edgeWidths=*(edgemap_storage[active_edgemaps[E_WIDTH]]); 636 } 637 if(active_edgemaps[E_COLOR]!="") 638 { 639 for(EdgeIt ei(graph);ei!=INVALID;++ei) 640 { 641 _edgeColors[ei]=(int)((*(edgemap_storage[active_edgemaps[E_COLOR]]))[ei]); 642 } 643 } 644 } 645 646 Palette palette; 647 Palette paletteW(true); 648 649 graphToEps(graph,filename). 650 title("Sample .eps figure (fits to A4)"). 651 copyright("(C) 2006 LEMON Project"). 652 absoluteNodeSizes().absoluteEdgeWidths(). 653 nodeScale(2).nodeSizes(_nodeSizes). 654 coords(coords). 655 nodeColors(composeMap(paletteW,_nodeColors)). 656 edgeColors(composeMap(palette,_edgeColors)). 657 edgeWidthScale(0.3).edgeWidths(_edgeWidths). 658 nodeTexts(_nodeTextMap).nodeTextSize(7). 659 enableParallel(_enableParallel).parEdgeDist(4). 660 drawArrows(_drawArrows).arrowWidth(7).arrowLength(7). 661 run(); 662 663 } -
mapstorage.h
r184 r191 292 292 293 293 void redesign_data_changed(); 294 295 void exportGraphToEPS(std::vector<bool>, std::string); 294 296 }; 295 297 -
nbtab.cc
r186 r191 18 18 19 19 #include <nbtab.h> 20 #include <eps_win.h> 20 21 21 22 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this) … … 227 228 } 228 229 230 void NoteBookTab::createExportToEPSWin(std::string name) 231 { 232 if(!epswinexists) 233 { 234 epswin=new EpsWin("Export to EPS - "+name, *this); 235 epswin->show(); 236 epswinexists=true; 237 } 238 } 239 240 229 241 void NoteBookTab::createDesignWin(std::string name) 230 242 { … … 257 269 } 258 270 271 void NoteBookTab::closeEpsWin() 272 { 273 epswinexists=false; 274 delete epswin; 275 } 276 259 277 bool NoteBookTab::closeDesignWin(GdkEventAny * e) 260 278 { … … 291 309 mapstorage.broadcastActiveMaps(); 292 310 } 311 312 void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename) 313 { 314 mapstorage.exportGraphToEPS(options, filename); 315 } -
nbtab.h
r177 r191 24 24 #include "mapstorage.h" 25 25 #include "map_win.h" 26 //#include "eps_win.h" 27 class EpsWin; 26 28 #include "design_win.h" 27 29 #include "graph_displayer_canvas.h" … … 98 100 bool designwinexists; 99 101 102 ///Indicates whether the \ref EpsWin is opened or not. See \ref epswin. 103 bool epswinexists; 104 100 105 ///Address of the only \ref MapWin that the \ref NoteBookTab can open. 101 106 … … 113 118 ///more complicated to synchronize them. 114 119 DesignWin * designwin; 120 121 ///Address of the only \ref EpsWin that the \ref NoteBookTab can open. 122 123 ///Only one of this window can be opened at the same time (\ref epswinexists), 124 ///because there is no need for more, one per tab is enough. 125 ///There won't be benefit of more than one. 126 EpsWin * epswin; 115 127 116 128 public: … … 186 198 void createDesignWin(std::string); 187 199 200 ///Pops up a window, that can dump graph to EPS 201 202 ///Different parameters can be set here. 203 void createExportToEPSWin(std::string); 204 188 205 ///Closes and deregistrates the \ref MapWin of \ref NoteBookTab. 189 206 … … 192 209 void closeMapWin(); 193 210 211 ///Closes and deregistrates the \ref DesignWin of \ref NoteBookTab. 212 213 ///See also 214 ///\ref designwin. 194 215 bool closeDesignWin(GdkEventAny *); 216 217 ///Closes and deregistrates the \ref EpsWin of \ref NoteBookTab. 218 219 ///See also 220 ///\ref epswin. 221 void closeEpsWin(); 195 222 196 223 ///Sets node representation settings … … 202 229 ///Let the graph redesign, based on gravity and edge elasticity. 203 230 void reDesignGraph(); 231 232 ///Lets Mapstorage export the graph to EPS 233 void exportGraphToEPS(std::vector<bool>, std::string); 204 234 205 235 ///\ref MapWin calls this function when it updates the maplist in comboboxes.
Note: See TracChangeset
for help on using the changeset viewer.