[Lemon-commits] [lemon_svn] hegyi: r2083 - hugo/trunk/gui

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:50:00 CET 2006


Author: hegyi
Date: Fri Jul 22 13:04:27 2005
New Revision: 2083

Modified:
   hugo/trunk/gui/all_include.h
   hugo/trunk/gui/graph_displayer_canvas-edge.cc
   hugo/trunk/gui/graph_displayer_canvas-node.cc
   hugo/trunk/gui/graph_displayer_canvas.cc
   hugo/trunk/gui/graphocska.lgf

Log:
There were bugs, created yesterday, and there is still one. (I hope only one :) )

Modified: hugo/trunk/gui/all_include.h
==============================================================================
--- hugo/trunk/gui/all_include.h	(original)
+++ hugo/trunk/gui/all_include.h	Fri Jul 22 13:04:27 2005
@@ -22,7 +22,7 @@
 #define RANGE 3
 #define WIN_WIDTH 900
 #define WIN_HEIGHT 600
-
+#define ALMOST_ONE 0.99999999999999
 
 #ifndef MAIN_PART
 extern std::vector <std::string> edge_property_strings;

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	Fri Jul 22 13:04:27 2005
@@ -136,6 +136,10 @@
 		{
 		  if(j!=length)
 		    {
+		      if((number-(int)number)>ALMOST_ONE)
+			{
+			  number=round(number);
+			}
 		      int digit=(int)(number/maxpos);
 		      str[j]=(digit+'0');
 		      number-=digit*maxpos;
@@ -174,6 +178,10 @@
 	    {
 	      if(j!=length)
 		{
+		  if((number-(int)number)>ALMOST_ONE)
+		    {
+		      number=round(number);
+		    }
 		  int digit=(int)(number/maxpos);
 		  str[j]=(digit+'0');
 		  number-=digit*maxpos;

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	Fri Jul 22 13:04:27 2005
@@ -135,7 +135,7 @@
   //in that case empty string will be written, because
   //that is the deleter map
 
-  Graph::NodeMap<double> * actual_map;
+  Graph::NodeMap<double> * actual_map=NULL;
   if(mapname!="Default")
     {
       actual_map=(mapstorage.nodemap_storage)[mapname];
@@ -165,7 +165,14 @@
 		{
 		  if(j!=length)
 		    {
- 		      int digit=(int)round(number/maxpos);
+//  		      std::cout << (number) << "-" << (int)number << "=" << (number)-(int)number << std::endl;
+		      if((number-(int)number)>ALMOST_ONE)
+			{
+// 			  std::cout<<"rounding: " <<number<<std::endl;
+			  number=round(number);
+			}
+ 		      int digit=(int)(number/maxpos);
+// 		      std::cout << number << "/" << maxpos << "=" << digit << std::endl;
 		      str[j]=(digit+'0');
 		      number-=digit*maxpos;
 		      number*=10;
@@ -202,6 +209,10 @@
 	    {
 	      if(j!=length)
 		{
+		  if((number-(int)number)>ALMOST_ONE)
+		    {
+		      number=round(number);
+		    }
 		  int digit=(int)(number/maxpos);
 		  str[j]=(digit+'0');
 		  number-=digit*maxpos;

Modified: hugo/trunk/gui/graph_displayer_canvas.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas.cc	Fri Jul 22 13:04:27 2005
@@ -2,7 +2,7 @@
 #include <broken_edge.h>
 #include <math.h>
 
-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),canvasentrywidget(NULL),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),edgemap_to_edit(""),nodemap_to_edit(""),mapwin(mw)
+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),canvasentrywidget(NULL),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),nodemap_to_edit(""),edgemap_to_edit(""),mapwin(mw)
 {
   
   

Modified: hugo/trunk/gui/graphocska.lgf
==============================================================================
--- hugo/trunk/gui/graphocska.lgf	(original)
+++ hugo/trunk/gui/graphocska.lgf	Fri Jul 22 13:04:27 2005
@@ -1,20 +1,20 @@
 @nodeset
 id	coordinates_x	coordinates_y data
 1	230	-80	1.123
-2	230	100	3
-3	120	-80	5
-4	120	100	7
-5	20	100	9
-6	20	-80	11
-7	-40	10	13
-8	-100	100	15
-9	-100	10	17
-10	-100	-80	19
-11	-200	-80	21
-12	-200	10	23
-13	-200	100	25
-14	-300	100	27
-15	-300	-80	29
+2	230	100	3.234
+3	120	-80	5.345
+4	120	100	7.456
+5	20	100	9.567
+6	20	-80	11.678
+7	-40	10	13.789
+8	-100	100	15.890
+9	-100	10	17.901
+10	-100	-80	19.012
+11	-200	-80	21.000
+12	-200	10	23.001
+13	-200	100	25.003
+14	-300	100	27.004
+15	-300	-80	29.9999
 
 @edgeset
 	        cap	map1	map2	map3	map4



More information about the Lemon-commits mailing list