[mapguide-commits] r4362 - in sandbox/adsk/2.1: Common/Renderers Common/Stylization Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 30 18:09:35 EST 2009


Author: waltweltonlair
Date: 2009-11-30 18:09:34 -0500 (Mon, 30 Nov 2009)
New Revision: 4362

Modified:
   sandbox/adsk/2.1/Common/Renderers/AGGRenderer.cpp
   sandbox/adsk/2.1/Common/Renderers/AGGRenderer.h
   sandbox/adsk/2.1/Common/Renderers/DWFRenderer.cpp
   sandbox/adsk/2.1/Common/Renderers/DWFRenderer.h
   sandbox/adsk/2.1/Common/Renderers/GDRenderer.cpp
   sandbox/adsk/2.1/Common/Renderers/GDRenderer.h
   sandbox/adsk/2.1/Common/Renderers/KmlRenderer.cpp
   sandbox/adsk/2.1/Common/Renderers/KmlRenderer.h
   sandbox/adsk/2.1/Common/Stylization/DefaultStylizer.cpp
   sandbox/adsk/2.1/Common/Stylization/LineBuffer.cpp
   sandbox/adsk/2.1/Common/Stylization/Renderer.h
   sandbox/adsk/2.1/Common/Stylization/StylizationEngine.cpp
   sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.cpp
   sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.h
Log:
Fix #1095: Plot to DWF (eplot) - plot contains additional and wrong elements

Merge the trunk fix into the sandbox stream.


Modified: sandbox/adsk/2.1/Common/Renderers/AGGRenderer.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/AGGRenderer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/AGGRenderer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -1048,6 +1048,13 @@
 }
 
 
+bool AGGRenderer::SupportsZ()
+{
+    // Z values in feature geometry are ignored
+    return false;
+}
+
+
 bool AGGRenderer::SupportsTooltips()
 {
     // set to false to disable processing of tooltips

Modified: sandbox/adsk/2.1/Common/Renderers/AGGRenderer.h
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/AGGRenderer.h	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/AGGRenderer.h	2009-11-30 23:09:34 UTC (rev 4362)
@@ -141,6 +141,8 @@
 
     RENDERERS_API virtual bool RequiresLabelClipping();
 
+    RENDERERS_API virtual bool SupportsZ();
+
     RENDERERS_API virtual bool SupportsTooltips();
 
     RENDERERS_API virtual bool SupportsHyperlinks();

Modified: sandbox/adsk/2.1/Common/Renderers/DWFRenderer.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/DWFRenderer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/DWFRenderer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -2281,6 +2281,13 @@
 }
 
 
+bool DWFRenderer::SupportsZ()
+{
+    // Z values in feature geometry are ignored
+    return false;
+}
+
+
 double DWFRenderer::GetMapToW2DScale()
 {
     return m_scale;

Modified: sandbox/adsk/2.1/Common/Renderers/DWFRenderer.h
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/DWFRenderer.h	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/DWFRenderer.h	2009-11-30 23:09:34 UTC (rev 4362)
@@ -162,6 +162,8 @@
 
     virtual bool RequiresLabelClipping();
 
+    virtual bool SupportsZ();
+
     /////////////////////////////////////////////
     // DWFRenderer specific
     //

Modified: sandbox/adsk/2.1/Common/Renderers/GDRenderer.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/GDRenderer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/GDRenderer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -1160,6 +1160,13 @@
 }
 
 
+bool GDRenderer::SupportsZ()
+{
+    // Z values in feature geometry are ignored
+    return false;
+}
+
+
 bool GDRenderer::SupportsTooltips()
 {
     // set to false to disable processing of tooltips

Modified: sandbox/adsk/2.1/Common/Renderers/GDRenderer.h
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/GDRenderer.h	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/GDRenderer.h	2009-11-30 23:09:34 UTC (rev 4362)
@@ -137,6 +137,8 @@
 
     virtual bool RequiresLabelClipping();
 
+    virtual bool SupportsZ();
+
     virtual bool SupportsTooltips();
 
     virtual bool SupportsHyperlinks();

Modified: sandbox/adsk/2.1/Common/Renderers/KmlRenderer.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/KmlRenderer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/KmlRenderer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -476,6 +476,14 @@
 }
 
 
+bool KmlRenderer::SupportsZ()
+{
+    // although KmlRenderer supports elevation, it ignores Z values
+    // in feature geometry
+    return false;
+}
+
+
 //Inserts the contents of a given DWF input stream
 //into the current output W2D. The given coord sys
 //transformation is applied and geometry will be clipped

Modified: sandbox/adsk/2.1/Common/Renderers/KmlRenderer.h
===================================================================
--- sandbox/adsk/2.1/Common/Renderers/KmlRenderer.h	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Renderers/KmlRenderer.h	2009-11-30 23:09:34 UTC (rev 4362)
@@ -119,6 +119,8 @@
 
     virtual bool RequiresLabelClipping();
 
+    virtual bool SupportsZ();
+
     ////////////////////////////////////////////////
     // SE_Renderer
     //

Modified: sandbox/adsk/2.1/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Stylization/DefaultStylizer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Stylization/DefaultStylizer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -277,6 +277,9 @@
             elevType);
     }
 
+    // ignore Z values if the renderer doesn't need them
+    bool ignoreZ = !renderer->SupportsZ();
+
     // create an expression engine with our custom functions
     // NOTE: We must create a new engine for each call to StylizeVLHelper.  The
     //       engine stores a weak reference to the RS_FeatureReader's internal
@@ -292,7 +295,7 @@
         ++nFeatures;
         #endif
 
-        LineBuffer* lb = LineBufferPool::NewLineBuffer(&m_lbPool, 8, FdoDimensionality_Z, false);
+        LineBuffer* lb = LineBufferPool::NewLineBuffer(&m_lbPool, 8, FdoDimensionality_Z, ignoreZ);
         if (!lb)
             continue;
 

Modified: sandbox/adsk/2.1/Common/Stylization/LineBuffer.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Stylization/LineBuffer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Stylization/LineBuffer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -1525,7 +1525,7 @@
 
     bool move = false;
 
-    // loop over all segments, MoveTos denote start of polygon
+    // loop over all segments, MoveTo's denote start of polygon
     // in a multipolygon
     for (int i=0; i<m_cur_types; ++i)
     {
@@ -1573,14 +1573,14 @@
             // find the t values for x and y exit points
             if (deltaX != 0.0)
                 tOutX = (xOut - aline[0]) / deltaX;
-            else if (clipRect.minx<=aline[0] && aline[0]<=clipRect.maxx)
+            else if (clipRect.minx <= aline[0] && aline[0] <= clipRect.maxx)
                 tOutX = std::numeric_limits<double>::infinity();
             else
                 tOutX = -std::numeric_limits<double>::infinity();
 
             if (deltaY != 0.0)
                 tOutY = (yOut - aline[1]) / deltaY;
-            else if (clipRect.miny<=aline[1]&& aline[1]<=clipRect.maxy)
+            else if (clipRect.miny <= aline[1]&& aline[1] <= clipRect.maxy)
                 tOutY = std::numeric_limits<double>::infinity();
             else
                 tOutY = -std::numeric_limits<double>::infinity();
@@ -1619,7 +1619,7 @@
                 // a possible turning vertex
                 if (tOut1 < tIn2)
                 {
-                    // if tOut1 > 0.0 and tOut1 < 1.0 then line crosses over
+                    // if tOut1 > 0.0 and tOut1 <= 1.0 then line crosses over
                     // intermediate corner region - generate turning vertex
                     if (tOut1 > 0.0 && tOut1 <= 1.0)
                     {
@@ -1767,7 +1767,7 @@
 //                     structure pointed to contains the coordinates of the
 //                     corners of the clip rectangle.
 //         x         - passes the x coordinate of the clipped vertex.
-//         y         - passes the y coordiante of the clipped vertex.
+//         y         - passes the y coordinate of the clipped vertex.
 //
 // RETURNS: None.
 //
@@ -1785,8 +1785,8 @@
     // TODO: NOT Z AWARE
     bool degenerate = false;
 
-    // only line segments can be degenerate -- a move indicates the start of a new
-    // polygon, so it is not degenerate
+    // only line segments can be degenerate - a move indicates the start of a
+    // new polygon, so it is not degenerate
     int npts = move? 0 : lb->m_cntrs[lb->m_cur_cntr];
 
     if (npts > 1)
@@ -1803,8 +1803,8 @@
                       ((x <= x1 && x2 <= x1) || (x >= x1 && x2 >= x1)));
     }
 
-    // else if there is only one vertex, and the new vertex is identical, then
-    // flag as degenerate
+    // else if there is only one vertex, and the new vertex is identical,
+    // then flag as degenerate
     else if (npts == 1)
     {
         degenerate =   x == lb->x_coord(lb->point_count()-1)
@@ -1922,32 +1922,18 @@
 //
 // FUNCTION: ClipLine().
 //
-// PURPOSE: Clip a line (given in application coordinates) against the
+// PURPOSE: Clips a line (given in application coordinates) against the
 //          specified clip rectangle using the Cohen-Sutherland clipping
-//          algorithm. Note - the clipped segment is guaranteed to have
+//          algorithm.  Note - the clipped segment is guaranteed to have
 //          the same directon as the original.
 //
 // PARAMETERS:
+//     clipRect - the rectangle to clip against
+//     line     - an array of 4 doubles containing the x/y coordinates
+//                of the line segment's start and end points
+//     ret      - an array of 4 doubles which will contain the x/y
+//                coordinates of the line's clipped start and end points
 //
-//     Input:
-//
-//         clipRect - passes a reference to an OpsFloatExtent structure; the
-//                    structure contains the coordinates of the corners of
-//                    the clip rectangle.
-//         endPt1   - passes a reference to an OpsFloatPoint structure; the
-//                    structure contains the coordinates of the first endpoint
-//                    of the line segment.
-//         endPt2   - passes a reference to an OpsFloatPoint structure; the
-//                    structure contains the coordinates of the second endpoint
-//                    of the line segment.
-//
-//     Output:
-//
-//         endPt1   - the coordinates of the (possibly clipped) first endpoint
-//                    are returned in the referenced structure.
-//         endPt2   - the coordinates of the (possibly clipped) second endpoint
-//                    are returned in the referenced structure.
-//
 // RETURNS: The method returns 0 if the line segment is not visible with respect
 //          the clip rectangle; 1 if the line segment is visible and the second
 //          endpoint was not clipped off; 2 if the segment is visible and the

Modified: sandbox/adsk/2.1/Common/Stylization/Renderer.h
===================================================================
--- sandbox/adsk/2.1/Common/Stylization/Renderer.h	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Stylization/Renderer.h	2009-11-30 23:09:34 UTC (rev 4362)
@@ -184,22 +184,22 @@
     virtual RS_Bounds& GetBounds() = 0;
 
     //------------------------------------------------------
-    // Geometry clipping renderer options
+    // Geometry renderer settings
     //------------------------------------------------------
 
-    ///<summary>
-    /// Flags whether the geometry used to render the feature is clipped.
-    ///</summary>
+    // Flags whether the geometry used to render the feature is clipped.
     virtual bool RequiresClipping() = 0;
 
-    ///<summary>
-    /// Flags whether the geometry used to label the feature is clipped.
-    /// This only applies if geometry clipping is set to false.  By setting
-    /// label clipping to true, you can be assured of generating on-screen
-    /// labels even though the feature geometry is not clipped to the screen.
-    ///</summary>
+    // Flags whether the geometry used to label the feature is clipped.
+    // This only applies if geometry clipping is set to false.  By setting
+    // label clipping to true, you can be assured of generating on-screen
+    // labels even though the feature geometry is not clipped to the screen.
     virtual bool RequiresLabelClipping() = 0;
 
+    // Flags whether the renderer has rendering support for geometry
+    // containing Z values.
+    virtual bool SupportsZ() = 0;
+
     //------------------------------------------------------
     // Miscellaneous
     //------------------------------------------------------

Modified: sandbox/adsk/2.1/Common/Stylization/StylizationEngine.cpp
===================================================================
--- sandbox/adsk/2.1/Common/Stylization/StylizationEngine.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Common/Stylization/StylizationEngine.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -95,6 +95,9 @@
     if (numTypeStyles == 0)
         return;
 
+    // ignore Z values if the renderer doesn't need them
+    bool ignoreZ = !se_renderer->SupportsZ();
+
     // we always start with rendering pass 0
     int instanceRenderingPass = 0;
     int symbolRenderingPass = 0;
@@ -129,7 +132,7 @@
                 nFeatures++;
             #endif
 
-            LineBuffer* lb = LineBufferPool::NewLineBuffer(m_pool, 8, FdoDimensionality_Z, false);
+            LineBuffer* lb = LineBufferPool::NewLineBuffer(m_pool, 8, FdoDimensionality_Z, ignoreZ);
             if (!lb)
                 continue;
 

Modified: sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.cpp
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.cpp	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.cpp	2009-11-30 23:09:34 UTC (rev 4362)
@@ -464,6 +464,13 @@
 }
 
 
+bool FeatureInfoRenderer::SupportsZ()
+{
+    // Z values in feature geometry are ignored
+    return false;
+}
+
+
 bool FeatureInfoRenderer::RequiresCompositeLineStyleSeparation()
 {
     return false;

Modified: sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.h
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.h	2009-11-30 22:36:33 UTC (rev 4361)
+++ sandbox/adsk/2.1/Server/src/Services/Rendering/FeatureInfoRenderer.h	2009-11-30 23:09:34 UTC (rev 4362)
@@ -127,6 +127,8 @@
 
     virtual bool RequiresLabelClipping();
 
+    virtual bool SupportsZ();
+
     virtual bool RequiresCompositeLineStyleSeparation();
 
     ///////////////////////////////////



More information about the mapguide-commits mailing list