[Lemon-commits] [lemon_svn] hegyi: r2011 - hugo/trunk/gui
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:30 CET 2006
Author: hegyi
Date: Wed Jun 29 21:44:30 2005
New Revision: 2011
Modified:
hugo/trunk/gui/graph_displayer_canvas-edge.cc
hugo/trunk/gui/graph_displayer_canvas-event.cc
hugo/trunk/gui/graph_displayer_canvas-node.cc
hugo/trunk/gui/graph_displayer_canvas.cc
hugo/trunk/gui/map_win.cc
hugo/trunk/gui/mapstorage.cc
hugo/trunk/gui/mapstorage.h
Log:
Uh, long comment arrives... Zoom update does not happen after editorial steps. Nodes initial color is light blue, if there is any item under them. Strange node-text relations disappeared. Initial values of new items are given now in a more common way. The wood-cutter way of handling default values of properties is now changed.
Modified: hugo/trunk/gui/graph_displayer_canvas-edge.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-edge.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-edge.cc Wed Jun 29 21:44:30 2005
@@ -5,11 +5,21 @@
int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
{
+ Graph::EdgeMap<double> * actual_map;
+ if(mapname=="Default")
+ {
+ actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
+ }
+ else
+ {
+ actual_map=(mapstorage.edgemap_storage)[mapname];
+ }
+
if(edge==INVALID)
{
for (EdgeIt i(g); i!=INVALID; ++i)
{
- int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
+ int w=(int)(*actual_map)[i];
if(w>=0)
{
edgesmap[i]->property_width_pixels().set_value(w);
@@ -18,7 +28,7 @@
}
else
{
- int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge];
+ int w=(int)(*actual_map)[edge];
if(w>=0)
{
edgesmap[edge]->property_width_pixels().set_value(w);
@@ -33,16 +43,35 @@
//function maps the range of the maximum and
//the minimum of the nodemap to the range of
//green in RGB
- if(edge==INVALID)
+ Graph::EdgeMap<double> * actual_map;
+ if(mapname=="Default")
+ {
+ actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_COLOR]);
+ }
+ else
+ {
+ actual_map=(mapstorage.edgemap_storage)[mapname];
+ }
+
+ double max, min;
+
+ if(mapname!="Default")
+ {
+ max=mapstorage.maxOfEdgeMap(mapname);
+ min=mapstorage.minOfEdgeMap(mapname);
+ }
+ else
{
+ max=edge_property_defaults[E_COLOR];
+ min=edge_property_defaults[E_COLOR];
+ }
+ if(edge==INVALID)
+ {
for (EdgeIt i(g); i!=INVALID; ++i)
{
- double w=(*(mapstorage.edgemap_storage)[mapname])[i];
- double max=mapstorage.maxOfEdgeMap(mapname);
- double min=mapstorage.minOfEdgeMap(mapname);
-
- //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
+ double w=(*actual_map)[i];
+
Gdk::Color color;
if(max!=min)
{
@@ -52,18 +81,15 @@
{
color.set_rgb_p (0, 100, 0);
}
-
edgesmap[i]->property_fill_color_gdk().set_value(color);
}
}
else
{
- double w=(*(mapstorage.edgemap_storage)[mapname])[edge];
- double max=mapstorage.maxOfEdgeMap(mapname);
- double min=mapstorage.minOfEdgeMap(mapname);
-
- //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
Gdk::Color color;
+
+ double w=(*actual_map)[edge];
+
if(max!=min)
{
color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
@@ -85,13 +111,12 @@
//EXCEPT when the name of the map is Text, because
//in that case empty string will be written, because
//that is the deleter map
- //\todo isn't it a bit woodcutter?
if(edge==INVALID)
{
for (EdgeIt i(g); i!=INVALID; ++i)
{
- if(mapname!=edge_property_strings[E_TEXT])
+ if(mapname!="Default")
{
double number=(*(mapstorage.edgemap_storage)[mapname])[i];
int length=1;
@@ -128,7 +153,7 @@
}
else
{
- if(mapname!=edge_property_strings[E_TEXT])
+ if(mapname!="Default")
{
double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
int length=1;
Modified: hugo/trunk/gui/graph_displayer_canvas-event.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-event.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-event.cc Wed Jun 29 21:44:30 2005
@@ -28,20 +28,19 @@
switch(newtool)
{
case MOVE:
- actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
+ actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
break;
- //it has to assigned to canvas, because all the canvas has to be monitored, not only the elements of the already drawn group
case CREATE_NODE:
actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
break;
case CREATE_EDGE:
- actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
+ actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
break;
case ERASER:
- actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
+ actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
break;
default:
@@ -60,9 +59,9 @@
{
case GDK_BUTTON_PRESS:
//we mark the location of the event to be able to calculate parameters of dragging
- clicked_x=e->button.x;
- clicked_y=e->button.y;
- active_item=(get_item_at(e->button.x, e->button.y));
+ window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+
+ active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
for (NodeIt i(g); i!=INVALID; ++i)
{
@@ -85,7 +84,6 @@
isbutton=0;
active_item=NULL;
active_node=INVALID;
- updateScrollRegion();
break;
case GDK_MOTION_NOTIFY:
//we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
@@ -96,15 +94,19 @@
//new coordinate therefore the new movement
//has to be calculated from here
- double dx=e->motion.x-clicked_x;
- double dy=e->motion.y-clicked_y;
+ double new_x, new_y;
+
+ window_to_world (e->motion.x, e->motion.y, new_x, new_y);
+
+ double dx=new_x-clicked_x;
+ double dy=new_y-clicked_y;
//repositioning node and its text
active_item->move(dx, dy);
nodetextmap[active_node]->move(dx, dy);
- clicked_x=e->motion.x;
- clicked_y=e->motion.y;
+ clicked_x=new_x;
+ clicked_y=new_y;
//all the edges connected to the moved point has to be redrawn
EdgeIt ei;
@@ -168,7 +170,7 @@
default: break;
}
- return true;
+ return false;
}
bool GraphDisplayerCanvas::createNodeEventHandler(GdkEvent* e)
@@ -177,16 +179,21 @@
{
//draw the new node in red at the clicked place
+ case GDK_2BUTTON_PRESS:
+ std::cout << "double click" << std::endl;
+ break;
case GDK_BUTTON_PRESS:
isbutton=1;
active_node=NodeIt(g,g.addNode());
//initiating values corresponding to new node in maps
-
window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+ target_item=NULL;
+ target_item=get_item_at(clicked_x, clicked_y);
+
nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
active_item=(Gnome::Canvas::Item *)(nodesmap[active_node]);
*(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
@@ -205,9 +212,8 @@
{
double world_motion_x, world_motion_y;
GdkEvent * generated=new GdkEvent();
- window_to_world (e->motion.x, e->motion.y, world_motion_x, world_motion_y);
- generated->motion.x=world_motion_x;
- generated->motion.y=world_motion_y;
+ generated->motion.x=e->motion.x;
+ generated->motion.y=e->motion.y;
generated->type=GDK_MOTION_NOTIFY;
moveEventHandler(generated);
break;
@@ -216,10 +222,19 @@
//finalize the new node
case GDK_BUTTON_RELEASE:
isbutton=0;
- *active_item << Gnome::Canvas::Properties::fill_color("blue");
+ if(!target_item)
+ {
+ //Its appropriate color is given by update.
+ //*active_item << Gnome::Canvas::Properties::fill_color("blue");
+ }
+ else
+ {
+ //In this case the given color has to be overwritten, because the noe covers an other item.
+ *active_item << Gnome::Canvas::Properties::fill_color("lightblue");
+ }
+ target_item=NULL;
active_item=NULL;
active_node=INVALID;
- updateScrollRegion();
break;
default:
break;
@@ -239,9 +254,10 @@
if(active_node==INVALID)
{
//we mark the location of the event to be able to calculate parameters of dragging
- clicked_x=e->button.x;
- clicked_y=e->button.y;
- active_item=(get_item_at(e->button.x, e->button.y));
+
+ window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+
+ active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
for (NodeIt i(g); i!=INVALID; ++i)
{
@@ -269,7 +285,8 @@
//node
else
{
- target_item=(get_item_at(e->button.x, e->button.y));
+ window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+ target_item=(get_item_at(clicked_x, clicked_y));
Graph::NodeIt target_node=INVALID;
for (NodeIt i(g); i!=INVALID; ++i)
{
@@ -366,7 +383,8 @@
switch(e->type)
{
case GDK_BUTTON_PRESS:
- active_item=(get_item_at(e->button.x, e->button.y));
+ window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+ active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
active_edge=INVALID;
for (NodeIt i(g); i!=INVALID; ++i)
@@ -386,56 +404,61 @@
}
}
}
- *active_item << Gnome::Canvas::Properties::fill_color("red");
+ if(active_item)
+ {
+ *active_item << Gnome::Canvas::Properties::fill_color("red");
+ }
break;
case GDK_BUTTON_RELEASE:
- if(active_item==(get_item_at(e->button.x, e->button.y)))
+ window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+ if(active_item)
{
- if(active_node!=INVALID)
+ if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
{
+ if(active_node!=INVALID)
+ {
- //collecting edges to delete
- EdgeIt e;
- std::set<Graph::Edge> edges_to_delete;
+ //collecting edges to delete
+ EdgeIt e;
+ std::set<Graph::Edge> edges_to_delete;
- g.firstOut(e,active_node);
- for(;e!=INVALID;g.nextOut(e))
- {
+ g.firstOut(e,active_node);
+ for(;e!=INVALID;g.nextOut(e))
+ {
edges_to_delete.insert(e);
- }
+ }
- g.firstIn(e,active_node);
- for(;e!=INVALID;g.nextIn(e))
- {
+ g.firstIn(e,active_node);
+ for(;e!=INVALID;g.nextIn(e))
+ {
edges_to_delete.insert(e);
- }
+ }
- //deleting collected edges
- for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
+ //deleting collected edges
+ for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
+ {
+ deleteItem(*edge_set_it);
+ }
+ deleteItem(active_node);
+ }
+ //a simple edge was chosen
+ else
{
- deleteItem(*edge_set_it);
+ deleteItem(active_edge);
}
- deleteItem(active_node);
}
- //a simple edge was chosen
+ //pointer was moved, deletion is cancelled
else
{
- deleteItem(active_edge);
- }
-
-
- }
- //pointer was moved, deletion is cancelled
- else
- {
- if(active_node!=INVALID)
- {
- *active_item << Gnome::Canvas::Properties::fill_color("blue");
- }
- else
- {
- *active_item << Gnome::Canvas::Properties::fill_color("green");
+ if(active_node!=INVALID)
+ {
+ *active_item << Gnome::Canvas::Properties::fill_color("blue");
+ }
+ else
+ {
+ *active_item << Gnome::Canvas::Properties::fill_color("green");
+ }
}
}
//reseting datas
@@ -450,7 +473,7 @@
default:
break;
}
- return true;
+ return false;
}
void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
Modified: hugo/trunk/gui/graph_displayer_canvas-node.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-node.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-node.cc Wed Jun 29 21:44:30 2005
@@ -5,15 +5,28 @@
int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
{
+ Graph::NodeMap<double> * actual_map;
+ if(mapname=="Default")
+ {
+ actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
+ }
+ else
+ {
+ actual_map=(mapstorage.nodemap_storage)[mapname];
+ }
+
if(node==INVALID)
{
for (NodeIt i(g); i!=INVALID; ++i)
{
- int w=(int)(*(mapstorage.nodemap_storage)[mapname])[i];
+ int w=(int)(*actual_map)[i];
if(w>=0)
{
double x1, y1, x2, y2;
- nodesmap[i]->get_bounds(x1, y1, x2, y2);
+ x1=nodesmap[i]->property_x1().get_value();
+ x2=nodesmap[i]->property_x2().get_value();
+ y1=nodesmap[i]->property_y1().get_value();
+ y2=nodesmap[i]->property_y2().get_value();
nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
@@ -23,11 +36,16 @@
}
else
{
- int w=(int)(*(mapstorage.nodemap_storage)[mapname])[node];
+ //I think only new nodes use this case
+// int w=(int)(*actual_map)[node];
+ int w=(int)(node_property_defaults[N_RADIUS]);
if(w>=0)
{
double x1, y1, x2, y2;
- nodesmap[node]->get_bounds(x1, y1, x2, y2);
+ x1=nodesmap[node]->property_x1().get_value();
+ x2=nodesmap[node]->property_x2().get_value();
+ y1=nodesmap[node]->property_y1().get_value();
+ y2=nodesmap[node]->property_y2().get_value();
nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
@@ -44,17 +62,39 @@
//the minimum of the nodemap to the range of
//green in RGB
+ Graph::NodeMap<double> * actual_map;
+ if(mapname=="Default")
+ {
+ actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
+ }
+ else
+ {
+ actual_map=(mapstorage.nodemap_storage)[mapname];
+ }
+
+ double max, min;
+
+ if(mapname!="Default")
+ {
+ max=mapstorage.maxOfNodeMap(mapname);
+ min=mapstorage.minOfNodeMap(mapname);
+ }
+ else
+ {
+ max=node_property_defaults[N_COLOR];
+ min=node_property_defaults[N_COLOR];
+ }
+
+
if(node==INVALID)
{
for (NodeIt i(g); i!=INVALID; ++i)
{
- double w=(*(mapstorage.nodemap_storage)[mapname])[i];
- double max=mapstorage.maxOfNodeMap(mapname);
- double min=mapstorage.minOfNodeMap(mapname);
-
- //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
Gdk::Color color;
+
+ double w=(*actual_map)[i];
+
if(max!=min)
{
color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
@@ -69,12 +109,10 @@
}
else
{
- double w=(*(mapstorage.nodemap_storage)[mapname])[node];
- double max=mapstorage.maxOfNodeMap(mapname);
- double min=mapstorage.minOfNodeMap(mapname);
-
- //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
Gdk::Color color;
+
+ double w=(*actual_map)[node];
+
if(max!=min)
{
color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
@@ -96,15 +134,24 @@
//EXCEPT when the name of the map is Text, because
//in that case empty string will be written, because
//that is the deleter map
- //\todo isn't it a bit woodcutter?
+
+ Graph::NodeMap<double> * actual_map;
+ if(mapname=="Default")
+ {
+ actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
+ }
+ else
+ {
+ actual_map=(mapstorage.nodemap_storage)[mapname];
+ }
if(node==INVALID)
{
for (NodeIt i(g); i!=INVALID; ++i)
{
- if(mapname!=node_property_strings[N_TEXT])
+ if(mapname!="Default")
{
- double number=(*(mapstorage.nodemap_storage)[mapname])[i];
+ double number=(*actual_map)[i];
int length=1;
//if number is smaller than one, length would be negative, or invalid
if(number>=1)
@@ -138,9 +185,9 @@
}
else
{
- if(mapname!=node_property_strings[N_TEXT])
+ if(mapname!="Default")
{
- double number=(*(mapstorage.nodemap_storage)[mapname])[node];
+ double number=(*actual_map)[node];
int length=1;
//if number is smaller than one, length would be negative, or invalid
if(number>=1)
Modified: hugo/trunk/gui/graph_displayer_canvas.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas.cc Wed Jun 29 21:44:30 2005
@@ -5,7 +5,7 @@
GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms, MapWin * mw):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),nodetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),mapwin(mw)
{
- actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
+ actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
actual_tool=CREATE_NODE;
active_node=INVALID;
Modified: hugo/trunk/gui/map_win.cc
==============================================================================
--- hugo/trunk/gui/map_win.cc (original)
+++ hugo/trunk/gui/map_win.cc Wed Jun 29 21:44:30 2005
@@ -23,45 +23,15 @@
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
{
-
- std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
- std::set<int> props;
-
- int actprop;
-
- //here we find out, which map is the default in MapStorage for this property, which are not
- for(int j=0;j<ms.numOfEdgeMaps();j++)
- {
- //this is the default value for this property
- if(emsi->second==&(ms.default_edgemaps[i]))
- {
- actprop=j;
- }
- //these are the maps NOT to show for this property
- for(int k=0;k<EDGE_PROPERTY_NUM;k++)
- {
- if(emsi->second==&(ms.default_edgemaps[k]))
- {
- props.insert(j);
- }
- }
- emsi++;
- }
-
//filling in combo box with choices
std::list<Glib::ustring> listStrings;
listStrings.push_back("Default");
- emsi=ms.beginOfEdgeMaps();
-
- for(int j=0;j<ms.numOfEdgeMaps();j++)
+ std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
+ for(;emsi!=ms.endOfEdgeMaps();emsi++)
{
- if( ( props.find(j) )==( props.end() ) )
- {
listStrings.push_back(emsi->first);
- }
- emsi++;
}
e_combo_array[i].set_popdown_strings(listStrings);
@@ -102,45 +72,16 @@
for(int i=0;i<NODE_PROPERTY_NUM;i++)
{
-
- std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
- std::set<int> props;
-
- int actprop;
-
- //here we find out, which map is the default in MapStorage for this property, which are not
- for(int j=0;j<ms.numOfNodeMaps();j++)
- {
- //these are the maps NOT to show for this property
- if(emsi->second==&(ms.default_nodemaps[i]))
- {
- actprop=j;
- }
- //this is the other maps to show for this property
- for(int k=0;k<NODE_PROPERTY_NUM;k++)
- {
- if(emsi->second==&(ms.default_nodemaps[k]))
- {
- props.insert(j);
- }
- }
- emsi++;
- }
-
//filling in combo box with choices
std::list<Glib::ustring> listStrings;
listStrings.push_back("Default");
- emsi=ms.beginOfNodeMaps();
+ std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
- for(int j=0;j<ms.numOfNodeMaps();j++)
+ for(;emsi!=ms.endOfNodeMaps();emsi++)
{
- if( ( props.find(j) )==( props.end() ) )
- {
- listStrings.push_back(emsi->first);
- }
- emsi++;
+ listStrings.push_back(emsi->first);
}
n_combo_array[i].set_popdown_strings(listStrings);
@@ -188,12 +129,7 @@
Glib::ustring mapname = entry->get_text();
if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
{
- if(mapname=="Default")
- {
- mapname=edge_property_strings[prop];
- }
-
- if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
+ if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
{
switch(prop)
{
@@ -224,12 +160,7 @@
Glib::ustring mapname = entry->get_text();
if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
{
- if(mapname=="Default")
- {
- mapname=node_property_strings[prop];
- }
-
- if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
+ if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
{
switch(prop)
{
@@ -261,18 +192,12 @@
Glib::ustring mapname = entry->get_text();
if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
{
- if(mapname=="Default")
- {
- mapname=node_property_strings[i];
- }
-
- if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
+ if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
{
switch(i)
{
case N_RADIUS:
- //gdc.changeNodeRadius(mapname, node);
- std::cout << "If default map-value problem is solved, uncomment line in MapWin::node_update!" << std::endl;
+ gdc.changeNodeRadius(mapname, node);
break;
case N_COLOR:
gdc.changeNodeColor(mapname, node);
@@ -301,18 +226,13 @@
Glib::ustring mapname = entry->get_text();
if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
{
- if(mapname=="Default")
- {
- mapname=edge_property_strings[i];
- }
- if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
+ if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
{
switch(i)
{
case E_WIDTH:
- //gdc.changeEdgeWidth(mapname, edge);
- std::cout << "If default map-value problem is solved, uncomment line in MapWin::edge_update!" << std::endl;
+ gdc.changeEdgeWidth(mapname, edge);
break;
case E_COLOR:
gdc.changeEdgeColor(mapname, edge);
Modified: hugo/trunk/gui/mapstorage.cc
==============================================================================
--- hugo/trunk/gui/mapstorage.cc (original)
+++ hugo/trunk/gui/mapstorage.cc Wed Jun 29 21:44:30 2005
@@ -2,36 +2,6 @@
MapStorage::MapStorage(Graph & graph):g(graph)
{
- for(int i=0;i<EDGE_PROPERTY_NUM;i++)
- {
- Graph::EdgeMap<double> emd(g,edge_property_defaults[i]);
- default_edgemaps.push_back(emd);
- }
-
- for(int i=0;i<NODE_PROPERTY_NUM;i++)
- {
- Graph::NodeMap<double> nmd(g,node_property_defaults[i]);
- default_nodemaps.push_back(nmd);
- }
-
- for(int i=0;i<EDGE_PROPERTY_NUM;i++)
- {
- for (EdgeIt j(g); j!=INVALID; ++j)
- {
- (default_edgemaps[i])[j]=edge_property_defaults[i];
- }
- addEdgeMap(edge_property_strings[i],&(default_edgemaps[i]));
- }
-
- for(int i=0;i<NODE_PROPERTY_NUM;i++)
- {
- for (NodeIt j(g); j!=INVALID; ++j)
- {
- (default_nodemaps[i])[j]=node_property_defaults[i];
- }
- addNodeMap(node_property_strings[i],&(default_nodemaps[i]));
- }
-
};
int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
@@ -102,19 +72,9 @@
void MapStorage::initMapsForEdge(Graph::Edge e)
{
- e=e;
-// beragad, aztan csovez
-// std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
-// for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
-// {
-// std::cout << "szevasz\n";
-// (*((*ems_it).second))[e]=0;
-// }
-// std::cout << std::endl;
-
-// g_closure_invoke...
-// for(int i=0;i<EDGE_PROPERTY_NUM;i++)
-// {
-// (default_edgemaps[i])[e]=property_defaults[i];
-// }
+ std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
+ for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
+ {
+ (*((*ems_it).second))[e]=5;
+ }
}
Modified: hugo/trunk/gui/mapstorage.h
==============================================================================
--- hugo/trunk/gui/mapstorage.h (original)
+++ hugo/trunk/gui/mapstorage.h Wed Jun 29 21:44:30 2005
@@ -81,6 +81,12 @@
///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
+ ///To be able to iterate through each maps this function returns an iterator pointing to the last nodemap in the storage.
+ std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
+
+ ///To be able to iterate through each maps this function returns an iterator pointing to the last edgemap in the storage.
+ std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
+
///This function sets a default base value for the newly created node
void initMapsForNode(NodeIt);
More information about the Lemon-commits
mailing list