COIN-OR::LEMON - Graph Library

Changeset 198:d6cc0579b94b in glemon-0.x


Ignore:
Timestamp:
03/01/07 17:28:13 (17 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3211
Message:

Shape feature of EPS can be used.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • eps_win.cc

    r196 r198  
    1818
    1919#include <eps_win.h>
     20
     21#include <mapselector.h>
     22
    2023#include <set>
    2124
     
    2932}
    3033
    31 EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true)
     34EpsWin::EpsWin(const std::string& title, std::vector<std::string> nml):Gtk::Dialog(title, true, true)
    3235{
    3336  set_default_size(200, 50);
     
    5558    }
    5659
     60  mapselector=new MapSelector(nml, "", "Nodeshapes", false);
     61  mapselector->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &EpsWin::newMapWinNeeded));
     62
    5763  hbox.pack_start(*(new Gtk::Label("Filename")));
    5864  hbox.pack_start(name);
     
    6167
    6268  vbox->pack_start(*table);
     69  vbox->pack_start(*mapselector);
    6370  vbox->pack_start(hbox);
    6471
     
    8895          values[i]=options[i]->get_active();
    8996        }
    90       signal_eps_details.emit(values, name.get_text());
     97      signal_eps_details.emit(values, name.get_text(), mapselector->get_active_text());
    9198    }
    9299  on_delete_event(NULL);
    93100}
     101
     102void EpsWin::newMapWinNeeded(bool isitedge)
     103{
     104  signal_new_map.emit(false);
     105}
     106
     107void EpsWin::registerNewNodeMap(std::string newmapname)
     108{
     109    mapselector->append_text((Glib::ustring)newmapname);
     110}
  • eps_win.h

    r196 r198  
    1919#ifndef EPS_WIN_H
    2020#define EPS_WIN_H
     21
     22class MapSelector;
    2123
    2224#include <all_include.h>
     
    5052  Gtk::Entry name;
    5153
     54  MapSelector * mapselector;
    5255public:
    5356  ///Constructor
     
    5962  ///\param nml nodemap list
    6063  ///\param mw the owner \ref NoteBookTab (\ref mytab)
    61   EpsWin(const std::string& title);
     64  EpsWin(const std::string& title, std::vector<std::string>);
    6265
    6366  ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab)
     
    7679
    7780  ///indicates that user is ready to export EPS file
    78   sigc::signal<void, std::vector<bool>, std::string > signal_eps_details;
     81  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details;
    7982
    8083  ///returns \ref signal_eps_details
    81   sigc::signal<void, std::vector<bool>, std::string > signal_eps_details_ch(){return signal_eps_details;};
     84  sigc::signal<void, std::vector<bool>, std::string, std::string > signal_eps_details_ch(){return signal_eps_details;};
    8285
    8386  ///indicates that the windows can be closed
     
    8790  sigc::signal<void> signal_eps_close_ch(){return signal_eps_close;};
    8891 
     92  ///indicates that the windows can be closed
     93  sigc::signal<void, bool> signal_new_map;
    8994
     95  ///returns \ref signal_eps_close
     96  sigc::signal<void, bool> signal_new_map_ch(){return signal_new_map;};
     97
     98  ///Function is called when new map is required.
     99  void newMapWinNeeded(bool);
     100
     101  ///This function inserts name of the new nodemap in the name list in \ref MapSelector s
     102
     103  ///\param new_name
     104  ///name of new map
     105  void registerNewNodeMap(std::string new_name);
    90106};
    91107
  • mapstorage.cc

    r195 r198  
    592592}
    593593
    594 void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename)
    595 {
     594void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
     595{
     596  Graph::NodeMap<int> _shapes(graph, 0);
    596597  Graph::NodeMap<int> _nodeColors(graph, 0);
    597598  Graph::EdgeMap<int> _edgeColors(graph, 0);
     
    643644        }
    644645    }
     646  if(shapemap!="")
     647    {
     648      if((minOfNodeMap(shapemap)>=0)&&(maxOfNodeMap(shapemap)<=4))
     649        {
     650          _shapes=*(nodemap_storage[shapemap]);
     651        }
     652    }
    645653
    646654  Palette palette;
     
    653661    nodeScale(2).nodeSizes(_nodeSizes).
    654662    coords(coords).
     663    nodeShapes(_shapes).
    655664    nodeColors(composeMap(paletteW,_nodeColors)).
    656665    edgeColors(composeMap(palette,_edgeColors)).
    657666    edgeWidthScale(0.3).edgeWidths(_edgeWidths).
    658667    nodeTexts(_nodeTextMap).nodeTextSize(7).
    659     enableParallel(_enableParallel).parEdgeDist(4).
     668    enableParallel(_enableParallel).parEdgeDist(5).
    660669    drawArrows(_drawArrows).arrowWidth(7).arrowLength(7).
    661670    run();
  • mapstorage.h

    r195 r198  
    295295  void redesign_data_changed();
    296296
    297   void exportGraphToEPS(std::vector<bool>, std::string);
     297  void exportGraphToEPS(std::vector<bool>, std::string, std::string);
    298298};
    299299
  • nbtab.cc

    r197 r198  
    224224      mapwin->registerNewNodeMap(mapname);
    225225    }
     226  if(epswinexists)
     227    {
     228      epswin->registerNewNodeMap(mapname);
     229    }
    226230}
    227231
     
    241245  if(!epswinexists)
    242246    {
    243       epswin=new EpsWin("Export to EPS - "+name);
     247      epswin=new EpsWin("Export to EPS - "+name, mapstorage->getNodeMapList());
    244248      epswin->show();
    245249      epswinexists=true;
    246250      epswin->signal_eps_details_ch().connect(sigc::mem_fun(*this, &NoteBookTab::exportGraphToEPS));
    247251      epswin->signal_eps_close_ch().connect(sigc::mem_fun(*this, &NoteBookTab::closeEpsWin));
     252      epswin->signal_new_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::popupNewMapWin));
    248253    }
    249254}
     
    321326}
    322327
    323 void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
    324 {
    325   mapstorage->exportGraphToEPS(options, filename);
     328void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename, std::string shapemap)
     329{
     330  mapstorage->exportGraphToEPS(options, filename, shapemap);
    326331}
    327332
  • nbtab.h

    r196 r198  
    229229
    230230  ///Lets Mapstorage export the graph to EPS
    231   void exportGraphToEPS(std::vector<bool>, std::string);
     231  void exportGraphToEPS(std::vector<bool>, std::string, std::string);
    232232
    233233  ///\ref MapWin calls this function when it updates the maplist in comboboxes.
Note: See TracChangeset for help on using the changeset viewer.