[Lemon-commits] ladanyi: r3386 - glemon/branches/akos
Lemon SVN
svn at lemon.cs.elte.hu
Sun Nov 18 14:33:49 CET 2007
Author: ladanyi
Date: Sun Nov 18 14:33:27 2007
New Revision: 3386
Modified:
glemon/branches/akos/eps_win.cc
glemon/branches/akos/eps_win.h
glemon/branches/akos/mapstorage.cc
glemon/branches/akos/mapstorage.h
glemon/branches/akos/nbtab.cc
glemon/branches/akos/nbtab.h
Log:
Ported r3212 from trunk.
Modified: glemon/branches/akos/eps_win.cc
==============================================================================
--- glemon/branches/akos/eps_win.cc (original)
+++ glemon/branches/akos/eps_win.cc Sun Nov 18 14:33:27 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> n_nml, std::vector<std::string> s_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(n_nml, s_nml, "", "Nodeshapes", false, true, NUM);
+ 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/branches/akos/eps_win.h
==============================================================================
--- glemon/branches/akos/eps_win.h (original)
+++ glemon/branches/akos/eps_win.h Sun Nov 18 14:33:27 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>, 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/branches/akos/mapstorage.cc
==============================================================================
--- glemon/branches/akos/mapstorage.cc (original)
+++ glemon/branches/akos/mapstorage.cc Sun Nov 18 14:33:27 2007
@@ -1418,8 +1418,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);
@@ -1469,6 +1470,25 @@
}
}
}
+ if(shapemap!="")
+ {
+ double min = std::numeric_limits<double>::max();
+ double max = std::numeric_limits<double>::min();
+ for (NodeIt n(graph); n != INVALID; ++n)
+ {
+ double v = static_cast<double>(get(shapemap, n));
+ if (v < min) min = v;
+ if (v > max) max = v;
+ }
+ if((min>=0)&&(max<=4))
+ {
+ NumericNodeMap& map = static_cast<NumericNodeMapData*>(getNodeMapData(shapemap))->map;
+ for (NodeIt n(graph); n != INVALID; ++n)
+ {
+ _shapes[n] = static_cast<int>(map[n]);
+ }
+ }
+ }
Palette palette;
Palette paletteW(true);
@@ -1479,11 +1499,12 @@
absoluteNodeSizes().absoluteEdgeWidths().
nodeScale(2).nodeSizes(_nodeSizes).
coords(node_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/branches/akos/mapstorage.h
==============================================================================
--- glemon/branches/akos/mapstorage.h (original)
+++ glemon/branches/akos/mapstorage.h Sun Nov 18 14:33:27 2007
@@ -538,7 +538,7 @@
const std::string& arrow_coord_ymap_name);
public:
- void exportGraphToEPS(std::vector<bool>, std::string);
+ void exportGraphToEPS(std::vector<bool>, std::string, std::string);
};
#endif //MAPSTORAGE_H
Modified: glemon/branches/akos/nbtab.cc
==============================================================================
--- glemon/branches/akos/nbtab.cc (original)
+++ glemon/branches/akos/nbtab.cc Sun Nov 18 14:33:27 2007
@@ -239,6 +239,10 @@
{
mapwin->registerNewNodeMap(mapname);
}
+ if(epswinexists)
+ {
+ epswin->registerNewNodeMap(mapname);
+ }
}
void NoteBookTab::createMapWin(std::string name)
@@ -261,11 +265,12 @@
{
if(!epswinexists)
{
- epswin=new EpsWin("Export to EPS - "+name);
+ epswin=new EpsWin("Export to EPS - "+name, mapstorage->getNodeMapList(NUM), mapstorage->getNodeMapList(STR));
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));
}
}
@@ -341,9 +346,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/branches/akos/nbtab.h
==============================================================================
--- glemon/branches/akos/nbtab.h (original)
+++ glemon/branches/akos/nbtab.h Sun Nov 18 14:33:27 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