[mapguide-commits] r1288 - trunk/MgDev/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Mar 19 13:50:38 EDT 2007


Author: waltweltonlair
Date: 2007-03-19 13:50:38 -0400 (Mon, 19 Mar 2007)
New Revision: 1288

Modified:
   trunk/MgDev/Common/Stylization/SE_Renderer.cpp
Log:
Fix some "sloppy" code... :->  Just removed some expensive calls to trig
functions with simple divisions.

Modified: trunk/MgDev/Common/Stylization/SE_Renderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2007-03-19 17:50:09 UTC (rev 1287)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2007-03-19 17:50:38 UTC (rev 1288)
@@ -145,7 +145,8 @@
 
 
 SE_Renderer::SE_Renderer()
-: m_bSelectionMode(false)
+: m_lbp(NULL)
+, m_bSelectionMode(false)
 , m_selWeight(0.0)
 , m_selColor(0)
 , m_selFill(0)
@@ -289,11 +290,19 @@
                 //compute linear deltas for x and y directions
                 // -- we will use these to quickly move along the line
                 //without having to do too much math
-                double slope = atan2(dy, dx);
-                double dx_incr = cos(slope);
-                double dy_incr = sin(slope);
+                double dx_incr, dy_incr;
+                if (len > 0.0)
+                {
+                    dx_incr = dx / len;
+                    dy_incr = dy / len;
+                }
+                else
+                {
+                    dx_incr = 1.0;
+                    dy_incr = 0.0;
+                }
 
-                double symrot = fromAngle? style->angle : slope;
+                double symrot = fromAngle? style->angle : atan2(dy, dx);
                 double tx = seg_screen[0] + dx_incr * drawpos;
                 double ty = seg_screen[1] + dy_incr * drawpos;
 



More information about the mapguide-commits mailing list