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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Mar 21 16:26:32 EDT 2007


Author: traianstanev
Date: 2007-03-21 16:26:32 -0400 (Wed, 21 Mar 2007)
New Revision: 1322

Modified:
   trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp
   trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.h
   trunk/MgDev/Common/Stylization/SE_Renderer.cpp
   trunk/MgDev/Common/Stylization/SE_Renderer.h
   trunk/MgDev/Common/Stylization/StylizationEngine.cpp
   trunk/MgDev/Common/Stylization/StylizationEngine.h
Log:
Add positioning algorithm for multiple highway shields in case where one road feature has multiple highway designations. This patch also submitted by Martin.

Modified: trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp	2007-03-21 20:22:37 UTC (rev 1321)
+++ trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.cpp	2007-03-21 20:26:32 UTC (rev 1322)
@@ -16,9 +16,11 @@
 //
 
 #include "stdafx.h"
+//#include "SE_Include.h"
 #include "SE_RenderProxies.h"
 #include "SE_PositioningAlgorithms.h"
 #include "SE_Renderer.h"
+#include "SE_SymbolManager.h"
 #include "Renderer.h"
 #include "SE_Bounds.h"
 #include "RS_FontEngine.h"
@@ -28,10 +30,10 @@
 
 SE_RenderPointStyle* DeepClonePointStyle(SE_RenderPointStyle* st)
 {
-    SE_RenderPointStyle* ret = new SE_RenderPointStyle(); 
+    SE_RenderPointStyle* ret = new SE_RenderPointStyle();
     *ret = *st;
     memcpy(ret->bounds, st->bounds, sizeof(ret->bounds));
-    SE_RenderText* txt = new SE_RenderText(); 
+    SE_RenderText* txt = new SE_RenderText();
     *txt = *((SE_RenderText*)st->symbol[0]);
     ret->symbol[0] = txt;
 
@@ -44,7 +46,7 @@
 void UpdateStyleBounds(SE_RenderPointStyle* st, SE_Renderer* renderer)
 {
     SE_RenderText* txt = ((SE_RenderText*)st->symbol[0]);
-    
+
     RS_TextMetrics tm;
     SE_Matrix txf;
     renderer->GetFontEngine()->GetTextMetrics(txt->text, txt->tdef, tm, false);
@@ -93,17 +95,17 @@
 }
 
 
-void SE_PositioningAlgorithms::EightSurrounding(SE_Renderer*    renderer, 
-                                         LineBuffer*     geometry, 
-                                         SE_Matrix&      xform, 
-                                         SE_Style*       style, 
-                                         SE_RenderStyle* rstyle, 
+void SE_PositioningAlgorithms::EightSurrounding(SE_Renderer*    renderer,
+                                         LineBuffer*     geometry,
+                                         SE_Matrix&      xform,
+                                         SE_Style*       style,
+                                         SE_RenderStyle* rstyle,
                                          double          mm2px
                                          )
 {
-    //this placement algorithm implements the MapGuide dynamic point labeling algorithm 
+    //this placement algorithm implements the MapGuide dynamic point labeling algorithm
     //which means 8 candidate labels generated for each symbol
-    
+
     double cx = 0.0;
     double cy = 0.0;
     double dummy;
@@ -123,7 +125,7 @@
     rstyle2->renderPass = rstyle->renderPass;
     memcpy(rstyle2->bounds, rstyle->bounds, sizeof(rstyle2->bounds));
     SE_RenderText* txt = NULL;
-    
+
     for (SE_RenderPrimitiveList::iterator iter = rstyle->symbol.begin(); iter != rstyle->symbol.end(); iter++)
     {
         if ((*iter)->type == SE_RenderTextPrimitive)
@@ -169,17 +171,17 @@
     double symbol_rot_deg = box_angle_rad / M_PI180;
 
     double op_pts[16];
-    
+
     // calculate a 2 pixel offset to allow for label ghosting
-    double offset = 2.0 ; 
-    
+    double offset = 2.0 ;
+
     //compute how far label needs to be offset from
     //center point of symbol
 
     double w = 0.5 * symbol_width;
     double h = 0.5 * symbol_height;
-    double ch = 0;		// vertical center point
-    double cw = 0;		// horizontal center point
+    double ch = 0;      // vertical center point
+    double cw = 0;      // horizontal center point
 
     w += offset;
     h += offset;
@@ -218,10 +220,10 @@
             hsn = h * sn;   nhsn = -hsn;
             hcs = h * cs;   nhcs = -hcs;
         }
-       
-        cwsn = cw * sn;		chsn = ch * sn; 
-        cwcs = cw * cs;		chcs = ch * cs;
 
+        cwsn = cw * sn;     chsn = ch * sn;
+        cwcs = cw * cs;     chcs = ch * cs;
+
         // find the octant that the marker is rotated into, and shift the points accordingly.
         // this way, the overpost points are still within 22.5 degrees of an axis-aligned box.
         // (position 0 will always be the closest to Center-Right)
@@ -242,16 +244,16 @@
     {
         if (!useBounds)
         {
-            symbol_bounds.maxx = w;	symbol_bounds.minx = -w;
-            symbol_bounds.maxy = h;	symbol_bounds.miny = -h;
+            symbol_bounds.maxx = w; symbol_bounds.minx = -w;
+            symbol_bounds.maxy = h; symbol_bounds.miny = -h;
         }
-        op_pts[0] = symbol_bounds.maxx;	op_pts[1] = ch;
-        op_pts[2] = symbol_bounds.maxx;	op_pts[3] = symbol_bounds.maxy;
-        op_pts[4] = cw;				    op_pts[5] = symbol_bounds.maxy;
-        op_pts[6] = symbol_bounds.minx;	op_pts[7] = symbol_bounds.maxy;
-        op_pts[8] = symbol_bounds.minx;	op_pts[9] = ch;
+        op_pts[0] = symbol_bounds.maxx; op_pts[1] = ch;
+        op_pts[2] = symbol_bounds.maxx; op_pts[3] = symbol_bounds.maxy;
+        op_pts[4] = cw;                 op_pts[5] = symbol_bounds.maxy;
+        op_pts[6] = symbol_bounds.minx; op_pts[7] = symbol_bounds.maxy;
+        op_pts[8] = symbol_bounds.minx; op_pts[9] = ch;
         op_pts[10] = symbol_bounds.minx;op_pts[11] = symbol_bounds.miny;
-        op_pts[12] = cw;			    op_pts[13] = symbol_bounds.miny;
+        op_pts[12] = cw;                op_pts[13] = symbol_bounds.miny;
         op_pts[14] = symbol_bounds.maxx;op_pts[15] = symbol_bounds.miny;
     }
 
@@ -304,11 +306,11 @@
 }
 
 
-void SE_PositioningAlgorithms::PathLabels(SE_Renderer*    se_renderer, 
-                      LineBuffer*     geometry, 
-                      SE_Matrix&      xform, 
-                      SE_Style*       style, 
-                      SE_RenderStyle* rstyle, 
+void SE_PositioningAlgorithms::PathLabels(SE_Renderer*    se_renderer,
+                      LineBuffer*     geometry,
+                      SE_Matrix&      xform,
+                      SE_Style*       style,
+                      SE_RenderStyle* rstyle,
                       double          mm2px
                       )
 {
@@ -323,16 +325,283 @@
 
     //TODO: get rid of this dynamic_cast once we fix the class hierarchy
     Renderer* renderer = dynamic_cast<Renderer*>(se_renderer);
-    renderer->ProcessLabelGroup(&info, 1, rt->text, RS_OverpostType_AllFit, true, geometry); 
+    renderer->ProcessLabelGroup(&info, 1, rt->text, RS_OverpostType_AllFit, true, geometry);
 }
 
-    
-void SE_PositioningAlgorithms::MultipleHighwaysShields(SE_Renderer*    renderer, 
-                          LineBuffer*     geometry, 
-                          SE_Matrix&      xform, 
-                          SE_Style*       style, 
-                          SE_RenderStyle* rstyle, 
-                          double          mm2px
+
+void SE_PositioningAlgorithms::MultipleHighwaysShields(SE_Renderer*    renderer,
+                          LineBuffer*     geometry,
+                          SE_Matrix&      xform,
+                          SE_Style*       seStyle,
+                          SE_RenderStyle* rstyle,
+                          double          mm2px,
+                          RS_FeatureReader* featureReader,
+                          SE_SymbolManager* symbolManager
                           )
 {
+
+    // highway info format:  countryCode|type1|num1|type2|num2|type3|num3|...
+    // example:              US|2|101|3|1
+    StringOfTokens highwayInfo = StringOfTokens(featureReader->GetString(L"Url"), L"|");
+
+    int shieldCount = (highwayInfo.getTokenCount() - 1) / 2;
+
+    if (shieldCount < 1)
+        return;
+
+    SE_RenderPrimitiveList * symbolVectors = new SE_RenderPrimitiveList[shieldCount];
+
+    std::wstring countryCode = highwayInfo.getFirstToken();
+
+    int shieldIndex;
+    for (shieldIndex = 0; shieldIndex < shieldCount; shieldIndex++)
+    {
+        std::wstring shieldType = highwayInfo.getNextToken();
+        std::wstring highwayNum = highwayInfo.getNextToken();
+
+        // first the shield graphic
+
+        SE_RenderRaster* rr = new SE_RenderRaster();
+
+        std::wstring imgPathName = HIGWAY_SHIELD_SYMBOLS_LOCATION + HIGWAY_SHIELD_SYMBOLS_PREFIX +
+                                   countryCode + L"_" + shieldType + L".png";
+        rr->pngPtr = symbolManager->GetImageData(L"", imgPathName.c_str(), rr->pngSize);
+
+        rr->position[0] = 0;
+        rr->position[1] = 0;
+        rr->extent[0] = 20;
+        rr->extent[1] = 20;
+        rr->angle = 0;
+
+        if (highwayNum.length() == 1)
+            rr->extent[0] = ((shieldType == L"3") ? 25 : 20);
+        else if (highwayNum.length() == 2)
+            rr->extent[0] = 25;
+        else
+            rr->extent[0] = 30;
+
+        double w = 0.5 * rr->extent[0];
+        double h = 0.5 * rr->extent[1];
+
+        rr->bounds[0].x = -w;
+        rr->bounds[0].y = -h;
+        rr->bounds[1].x =  w;
+        rr->bounds[1].y = -h;
+        rr->bounds[2].x =  w;
+        rr->bounds[2].y =  h;
+        rr->bounds[3].x = -w;
+        rr->bounds[3].y =  h;
+
+        // the shield graphic is ready
+        symbolVectors[shieldIndex].push_back(rr);
+
+
+        // now symbol for the highway number
+
+        SE_RenderText* rt = new SE_RenderText();
+
+        rt->text = highwayNum;
+        rt->position[0] = 0;
+        rt->position[1] = 0;
+        rt->tdef.font().name() = L"Arial";
+        rt->tdef.font().height() = 10*0.001 / mm2px; // convert mm to meters
+        rt->tdef.rotation() = 0;
+
+        rt->tdef.halign() = RS_HAlignment_Center;
+        rt->tdef.valign() = RS_VAlignment_Half;
+
+        if (shieldType == L"1")
+        {
+            rt->tdef.color() = RS_Color(255, 255, 255, 255);
+        }
+        else
+        {
+            rt->tdef.color() = RS_Color(0, 0, 0, 255);
+        }
+
+        rt->tdef.textbg() = RS_TextBackground_None;
+        rt->tdef.font().style() = RS_FontStyle_Bold;
+
+        // the number graphic is ready
+        symbolVectors[shieldIndex].push_back(rt);
+    }
+
+
+    SE_RenderLineStyle* style = (SE_RenderLineStyle* ) rstyle;
+    SE_Matrix symxf;
+    int ptindex = 0;
+    double increment = style->repeat;
+ // double incrementS = 10 * mm2px;          // the 'increment' used between multiple shields
+    double incrementS = style->endOffset;    // use endOffset as the increment between multiple shields
+
+    shieldIndex = 0;
+
+    for (int j=0; j<geometry->cntr_count(); j++)
+    {
+        // current polyline
+        int ptcount = geometry->cntrs()[j];
+        double* pts = geometry->points() + 2*ptindex;
+
+        // init position along the current segment to the start offset
+        double drawpos = style->startOffset;
+
+        int cur_seg = 0;
+
+        while (cur_seg < ptcount - 1)
+        {
+            symxf.setIdentity();
+
+            // current line segment
+            double* seg = pts + cur_seg * 2;
+
+            // transform the point to screen space
+            double  cx1, cy1, cx2, cy2;
+            renderer->WorldToScreenPoint(seg[0], seg[1], cx1, cy1);
+            renderer->WorldToScreenPoint(seg[2], seg[3], cx2, cy2);
+
+            // calc length
+            double dx = cx2 - cx1;
+            double dy = cy2 - cy1;
+            double len = sqrt(dx*dx + dy*dy);
+
+            // check if completely skipping current segment since it is smaller than the increment
+            if (drawpos < len)
+            {
+                double slope = atan2(dy, dx);
+                double dx_fact = cos(slope);
+                double dy_fact = sin(slope);
+
+                double tx = cx1 + dx_fact * drawpos;
+                double ty = cy1 + dy_fact * drawpos;
+                symxf.translate(tx, ty);
+
+                double dx_incr = dx_fact * increment;      // x/y incr between groups of shields
+                double dy_incr = dy_fact * increment;
+
+                double dx_incS = dx_fact * incrementS;     // x/y incr between shields in a group
+                double dy_incS = dy_fact * incrementS;
+
+                // follow the segment and place the shield symbols alternated via shieldIndex
+                while (drawpos < len)
+                {
+                    if (style->drawLast)
+                    {
+
+                        style->symbol = symbolVectors[shieldIndex];
+                        memcpy(style->bounds, symbolVectors[shieldIndex].front()->bounds, sizeof(style->bounds));
+                        SE_RenderStyle* clonedStyle = renderer->CloneRenderStyle(style);
+
+                        SE_LabelInfo info(symxf.x2, symxf.y2, 0.0, 0.0, RS_Units_Device, 0, clonedStyle);
+
+                        renderer->ProcessLabelGroup(&info, 1, RS_OverpostType_AllFit, style->addToExclusionRegions, geometry);
+
+                    }
+                    else
+                    {
+                        renderer->DrawSymbol(symbolVectors[shieldIndex], symxf, 0);
+
+                        // TODO: if this is ever needed ...
+                     // if (style->addToExclusionRegions)
+                     //     renderer->AddExclusionRegion(style, symxf, 0);
+                    }
+
+                    // move on to the next shield, if beyond the last one go back to the first
+                    shieldIndex++;
+                    if (shieldIndex < shieldCount)
+                    {
+                        symxf.translate(dx_incS, dy_incS);
+                        drawpos += incrementS;
+                    }
+                    else
+                    {
+                        // finished with one group
+                        // go back to the first symbol and advance using the full increment
+
+                        shieldIndex = 0;
+                        symxf.translate(dx_incr, dy_incr);
+                        drawpos += increment;
+                    }
+                }
+            }
+
+            drawpos -= len;
+            cur_seg++;
+        }
+
+        ptindex += ptcount;
+    }
+
+    delete [] symbolVectors;
+
 }
+
+
+int StringOfTokens::getTokenCount()
+{
+    if (m_tokenstring.empty())
+    {
+        return 0;
+    }
+
+    std::wstring::size_type curPos = 0;
+    std::wstring::size_type delimPos;
+    int count = 1;
+
+    delimPos = m_tokenstring.find(m_delimiter, curPos);
+
+    while (std::wstring::npos != delimPos)
+    {
+        curPos = delimPos + 1;
+        count++;
+
+        delimPos = m_tokenstring.find(m_delimiter, curPos);
+    }
+
+    return count;
+}
+
+std::wstring StringOfTokens::getFirstToken()
+{
+    if (m_tokenstring.empty())
+    {
+        return L"";
+    }
+
+    m_currentPos = 0;
+
+    std::wstring::size_type delimPos1 = m_tokenstring.find(m_delimiter);
+
+    if (std::wstring::npos == delimPos1)
+    {
+        m_currentPos = m_tokenstring.length();
+        return m_tokenstring;
+    }
+    else
+    {
+        m_currentPos = delimPos1+1;
+        return m_tokenstring.substr(0, delimPos1);
+    }
+}
+
+std::wstring StringOfTokens::getNextToken()
+{
+    if (m_tokenstring.empty() || m_currentPos >= m_tokenstring.length())
+    {
+        return L"";
+    }
+
+    std::wstring::size_type curPos = m_currentPos;
+    std::wstring::size_type delimPos = m_tokenstring.find(m_delimiter, m_currentPos);
+
+    if (std::wstring::npos == delimPos)
+    {
+        m_currentPos = m_tokenstring.length();
+        return m_tokenstring.substr(curPos);
+    }
+    else
+    {
+        m_currentPos = delimPos+1;
+        return m_tokenstring.substr(curPos, delimPos - curPos);
+    }
+}
+

Modified: trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.h	2007-03-21 20:22:37 UTC (rev 1321)
+++ trunk/MgDev/Common/Stylization/SE_PositioningAlgorithms.h	2007-03-21 20:26:32 UTC (rev 1322)
@@ -18,8 +18,16 @@
 #ifndef SE_POSITIONINGALGORITHMS_H
 #define SE_POSITIONINGALGORITHMS_H
 
+#include "SE_RenderProxies.h"
+
+//const std::wstring HIGWAY_SHIELD_SYMBOLS_LOCATION = L"Library://Symbology/HighwaySymbols/";
+const std::wstring HIGWAY_SHIELD_SYMBOLS_LOCATION = L"C:/";
+const std::wstring HIGWAY_SHIELD_SYMBOLS_PREFIX = L"shield_";
+
 class LineBuffer;
 class SE_Renderer;
+class SE_SymbolManager;
+class RS_FeatureReader;
 struct SE_Matrix;
 struct SE_Style;
 struct SE_RenderStyle;
@@ -28,29 +36,58 @@
 class SE_PositioningAlgorithms
 {
 public:
-    static void EightSurrounding(SE_Renderer*    renderer, 
-                          LineBuffer*     geometry, 
-                          SE_Matrix&      xform, 
-                          SE_Style*       style, 
-                          SE_RenderStyle* rstyle, 
+    static void EightSurrounding(SE_Renderer*    renderer,
+                          LineBuffer*     geometry,
+                          SE_Matrix&      xform,
+                          SE_Style*       style,
+                          SE_RenderStyle* rstyle,
                           double          mm2px
                           );
 
-    static void PathLabels(SE_Renderer*    renderer, 
-                          LineBuffer*     geometry, 
-                          SE_Matrix&      xform, 
-                          SE_Style*       style, 
-                          SE_RenderStyle* rstyle, 
+    static void PathLabels(SE_Renderer*    renderer,
+                          LineBuffer*     geometry,
+                          SE_Matrix&      xform,
+                          SE_Style*       style,
+                          SE_RenderStyle* rstyle,
                           double          mm2px
                           );
 
-    static void MultipleHighwaysShields(SE_Renderer*    renderer, 
-                                        LineBuffer*     geometry, 
-                                        SE_Matrix&      xform, 
-                                        SE_Style*       style, 
-                                        SE_RenderStyle* rstyle, 
-                                        double          mm2px
+    static void MultipleHighwaysShields(SE_Renderer*    renderer,
+                                        LineBuffer*     geometry,
+                                        SE_Matrix&      xform,
+                                        SE_Style*       style,
+                                        SE_RenderStyle* rstyle,
+                                        double          mm2px,
+                                        RS_FeatureReader* featureReader,
+                                        SE_SymbolManager* symbolManager
                                         );
 };
 
+class StringOfTokens
+{
+
+public:
+
+
+    StringOfTokens(std::wstring tokenstring, std::wstring delimiter) :
+        m_tokenstring(tokenstring),
+        m_delimiter(delimiter)
+    {
+        m_currentPos = 0;
+    }
+
+
+    int getTokenCount();
+    std::wstring getFirstToken();
+    std::wstring getNextToken();
+
+private:
+
+    std::wstring  m_delimiter;
+    std::wstring  m_tokenstring;
+    std::wstring::size_type m_currentPos;
+
+
+};
+
 #endif // SE_POSITIONINGALGORITHMS_H

Modified: trunk/MgDev/Common/Stylization/SE_Renderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2007-03-21 20:22:37 UTC (rev 1321)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2007-03-21 20:26:32 UTC (rev 1322)
@@ -24,11 +24,11 @@
 using namespace MDFMODEL_NAMESPACE;
 
 //cloning of RenderSymbols. Unfortunate but necessary for delay-drawing labels
-static SE_RenderStyle* CloneRenderStyle(SE_RenderStyle* symbol)
+SE_RenderStyle* SE_Renderer::CloneRenderStyle(SE_RenderStyle* symbol)
 {
     SE_RenderStyle* ret = NULL;
 
-    //first determine what kind of style it is and copy all the 
+    //first determine what kind of style it is and copy all the
     //style specific properties
     switch (symbol->type)
     {
@@ -191,7 +191,7 @@
 
         //transform to screen space -- geometry is in [the original] mapping space
         WorldToScreenPoint(x, y, x, y);
-        
+
         xform.setIdentity();
         xform.translate(x, y);
         double angle = 0;//TODO: angle needs to be added to the RenderPointStyle
@@ -214,9 +214,9 @@
     SE_RenderPrimitiveList& rs = style->symbol;
 
     //check if it is a single symbol that is not a label participant
-    if (rs.size() == 1 
-        && rs[0]->type == SE_RenderPolylinePrimitive 
-        && !style->drawLast 
+    if (rs.size() == 1
+        && rs[0]->type == SE_RenderPolylinePrimitive
+        && !style->drawLast
         && !style->addToExclusionRegions)
     {
         SE_RenderPolyline* rp = (SE_RenderPolyline*)rs[0];
@@ -224,13 +224,13 @@
 
         //check if it is a horizontal line
         if (lb->point_count() == 2
-            && lb->points()[1] == 0.0 
+            && lb->points()[1] == 0.0
             && lb->points()[3] == 0.0)
         {
-            //now make sure it is not a dashed line by comparing the 
+            //now make sure it is not a dashed line by comparing the
             //single segment to the symbol repeat
             double len = lb->points()[2] - lb->points()[0];
-            
+
             if (fabs(len - style->repeat) < 0.001) //repeat must be within 1/1000 of a pixel for us to assume solid line
                                                    //this is only to avoid FP precision issues, in reality they would be exactly equal
             {
@@ -243,9 +243,9 @@
             }
         }
     }
-    
+
     SE_Matrix symxf;
-    
+
     int ptindex = 0;
 
     //get the increment (the render style already stores this in screen units)
@@ -276,7 +276,7 @@
             //transform segment from mapping to screen space
             WorldToScreenPoint(seg[0], seg[1], seg_screen[0], seg_screen[1]);
             WorldToScreenPoint(seg[2], seg[3], seg_screen[2], seg_screen[3]);
-            
+
             //get length
             double dx = seg_screen[2] - seg_screen[0];
             double dy = seg_screen[3] - seg_screen[1];
@@ -305,7 +305,7 @@
                 //loop-draw the symbol along the current segment,
                 //moving along by increment pixels
                 while (drawpos < len)
-                {                    
+                {
                     if (style->drawLast)
                         AddLabel(geometry, style, symxf, symrot);
                     else
@@ -317,10 +317,10 @@
                     }
 
                     symxf.translate(dx_incr, dy_incr);
-                    drawpos += increment; 
+                    drawpos += increment;
                 }
             }
-            
+
             drawpos -= len;
             cur_seg++;
         }
@@ -404,13 +404,13 @@
 
 void SE_Renderer::AddLabel(LineBuffer* geom, SE_RenderStyle* style, SE_Matrix& xform, double angle)
 {
-    //clone the SE_RenderStyle so that the label renderer can keep track of it until 
+    //clone the SE_RenderStyle so that the label renderer can keep track of it until
     //the end of rendering when it draws all the labels
     //TODO: cloning is bad.
     SE_RenderStyle* copied_style = CloneRenderStyle(style);
 
     SE_LabelInfo info(xform.x2, xform.y2, 0.0, 0.0, RS_Units_Device, angle, copied_style);
-    
+
     RS_OverpostType type = RS_OverpostType_AllFit;
 
     ProcessLabelGroup(&info, 1, type, style->addToExclusionRegions, geom);

Modified: trunk/MgDev/Common/Stylization/SE_Renderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.h	2007-03-21 20:22:37 UTC (rev 1321)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.h	2007-03-21 20:26:32 UTC (rev 1322)
@@ -64,6 +64,9 @@
     //sigh
     const RS_F_Point* GetLastExclusionRegion() { return m_lastExclusionRegion; }
 
+    SE_RenderStyle* CloneRenderStyle(SE_RenderStyle* symbol);
+
+
 protected:
     void SetRenderSelectionMode(bool mode);
 
@@ -73,7 +76,7 @@
     void AddExclusionRegion(SE_RenderStyle* rstyle, SE_Matrix& xform, double angle);
 
     RS_F_Point m_lastExclusionRegion[4];
-    
+
 protected:
     SE_LineBufferPool* m_lbp;
     bool m_bSelectionMode;

Modified: trunk/MgDev/Common/Stylization/StylizationEngine.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2007-03-21 20:22:37 UTC (rev 1321)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2007-03-21 20:26:32 UTC (rev 1322)
@@ -39,7 +39,8 @@
 StylizationEngine::StylizationEngine(SE_SymbolManager* resources) :
     m_resources(resources),
     m_renderer(NULL),
-    m_serenderer(NULL)
+    m_serenderer(NULL),
+    m_reader(NULL)
 {
     m_pool = new SE_LineBufferPool;
     m_lbPool = new LineBufferPool;
@@ -70,6 +71,7 @@
         return;
 
     m_renderer = renderer;
+    m_reader = reader;
 
     // make sure we have an SE renderer
     // TODO: eliminate the need to do dynamic casts on these renderers.  We should
@@ -188,6 +190,8 @@
                                 int renderingPass,
                                 int& nextRenderingPass)
 {
+    m_reader = reader;
+
     double mm2pxs = m_serenderer->GetPixelsPerMillimeterScreen();
     double mm2pxw = m_serenderer->GetPixelsPerMillimeterWorld();
 
@@ -199,7 +203,7 @@
     {
         SE_Rule* rulecache = new SE_Rule[nRules];
         rules = rulecache;
-        
+
         for (int i = 0; i < nRules; i++)
         {
             CompositeRule* r = (CompositeRule*)rulecoll->GetAt(i);
@@ -227,7 +231,7 @@
     for (int i = 0; i < nRules; i++)
     {
         bool match = (rules[i].filter == NULL);
-        
+
         if (!match)
         {
             rules[i].filter->Process(executor);
@@ -259,16 +263,16 @@
     }
 
     /* TODO: Obey the indices--Get rid of the indices altogther--single pass! */
-    
+
     for (std::vector<SE_Symbolization*>::const_iterator iter = symbolization->begin(); iter != symbolization->end(); iter++)
     {
         SE_Symbolization* sym = *iter;
 
         double mm2px = (sym->context == MappingUnits)? mm2pxw : mm2pxs;
         SE_Matrix xform;
-        xform.setTransform( sym->scale[0].evaluate(executor), 
+        xform.setTransform( sym->scale[0].evaluate(executor),
                             sym->scale[1].evaluate(executor),
-                            sym->absOffset[0].evaluate(executor), 
+                            sym->absOffset[0].evaluate(executor),
                             sym->absOffset[1].evaluate(executor) );
         xform.scale(mm2px, mm2px);
 
@@ -349,6 +353,12 @@
     {
         SE_PositioningAlgorithms::PathLabels(m_serenderer, geometry, xform, style, rstyle, mm2px);
     }
+    else if (positioningAlgo == L"MultipleHighwayShields")
+    {
+
+        SE_PositioningAlgorithms::MultipleHighwaysShields(m_serenderer, geometry, xform, style, rstyle, mm2px,
+                                                          m_reader, m_resources);
+    }
 }
 
 

Modified: trunk/MgDev/Common/Stylization/StylizationEngine.h
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.h	2007-03-21 20:22:37 UTC (rev 1321)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.h	2007-03-21 20:26:32 UTC (rev 1322)
@@ -92,6 +92,7 @@
     SE_StyleVisitor* m_visitor;
     std::map<CompositeTypeStyle*, SE_Rule*> m_rules;
     LineBufferPool* m_lbPool;
+    RS_FeatureReader* m_reader;
 };
 
 #endif // STYLIZATION_ENGINE_H



More information about the mapguide-commits mailing list