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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Mar 9 20:21:45 EST 2007


Author: waltweltonlair
Date: 2007-03-09 20:21:45 -0500 (Fri, 09 Mar 2007)
New Revision: 1194

Modified:
   trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
   trunk/MgDev/Common/Stylization/GDRenderer.h
   trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp
   trunk/MgDev/Common/Stylization/SE_Include.h
   trunk/MgDev/Common/Stylization/SE_Renderer.h
   trunk/MgDev/Common/Stylization/SE_StyleVisitor.cpp
   trunk/MgDev/Common/Stylization/SE_StyleVisitor.h
   trunk/MgDev/Common/Stylization/StylizationEngine.cpp
   trunk/MgDev/Common/Stylization/StylizationEngine.h
Log:
Add QueryFeatures support to the new stylization.  This includes handling
of tooltips and urls.  Now when you hover over the geometry of one of the
new symbols QueryFeatures will return that feature and its tooltip / url.

Fixed some other problems while working on this:
- SE_String was not always storing copies of passed in strings
- some members in StylizationEngine were not getting initialized
- the StylizationEngine::Stylize method was checking the wrong data
  at the beginning of the method (member variables instead of passed
  in arguments)
- removed some unnecessary member variables from StylizationEngine
- SE_StyleVisitor now allows the symbol manager to be NULL


Modified: trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/DefaultStylizer.cpp	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/DefaultStylizer.cpp	2007-03-10 01:21:45 UTC (rev 1194)
@@ -119,25 +119,31 @@
     // find the FeatureTypeStyle
     MdfModel::FeatureTypeStyleCollection* ftsc = range->GetFeatureTypeStyles();
 
-    //extract hyperlink and tooltip info
-    //this is invariant, so do outside of feature iterator loop
-    const MdfModel::MdfString* lr_tooltip = &fl->GetToolTip();
-    const MdfModel::MdfString* lr_url = &fl->GetUrl();
-
-    if (lr_tooltip->empty()) lr_tooltip = NULL;
-    if (lr_url->empty()) lr_url = NULL;
-
     //TODO: //HACK: temporary code to detect whether we are using a new style
     //composite symbolizations
     bool use_style_engine = false;
     SE_Renderer* se_renderer = NULL;
-
     if (FeatureTypeStyleVisitor::DetermineFeatureTypeStyle(ftsc->GetAt(0)) == FeatureTypeStyleVisitor::ftsComposite)
     {
         use_style_engine = true;
         se_renderer = dynamic_cast<SE_Renderer*>(m_renderer);
     }
 
+    //extract hyperlink and tooltip info
+    //this is invariant, so do outside of feature iterator loop
+    const MdfModel::MdfString& mdfTip = fl->GetToolTip();
+    const MdfModel::MdfString& mdfUrl = fl->GetUrl();
+    const MdfModel::MdfString* lrTip = mdfTip.empty()? NULL : &mdfTip;
+    const MdfModel::MdfString* lrUrl = mdfUrl.empty()? NULL : &mdfUrl;
+
+    SE_String seTip;
+    SE_String seUrl;
+    if (use_style_engine)
+    {
+        m_styleEngine->ParseStringExpression(mdfTip, seTip);
+        m_styleEngine->ParseStringExpression(mdfUrl, seUrl);
+    }
+
     //TODO:
     //*****************************************
     //* THIS CALL IS REALLY REALLY REALLY SLOW!!!
@@ -201,7 +207,7 @@
             {
                 //we are hoping that the renderer is nice enough to be an SE_Renderer
                 if (se_renderer)
-                    m_styleEngine->Stylize(se_renderer, features, exec, lb, (CompositeTypeStyle*)fts);
+                    m_styleEngine->Stylize(se_renderer, features, exec, lb, (CompositeTypeStyle*)fts, &seTip, &seUrl, NULL);
             }
             else
             {
@@ -238,7 +244,7 @@
                             MdfModel::LengthConverter::UnitToMeters(modelElevSettings->GetUnit(), 1.0),
                             elevType);
                     }
-                    adapter->Stylize(m_renderer, features, exec, lb, fts, lr_tooltip, lr_url, elevSettings);
+                    adapter->Stylize(m_renderer, features, exec, lb, fts, lrTip, lrUrl, elevSettings);
                     
                     delete elevSettings;
                     elevSettings = NULL;

Modified: trunk/MgDev/Common/Stylization/GDRenderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/GDRenderer.h	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/GDRenderer.h	2007-03-10 01:21:45 UTC (rev 1194)
@@ -172,6 +172,12 @@
                                    bool             exclude,
                                    LineBuffer*      path = NULL);
 
+    virtual void AddExclusionRegion(RS_F_Point* fpts, int npts);
+
+    ////////////////////////////////////////////////
+    // RS_FontEngine
+    //
+
     virtual void DrawString(const RS_String& s,
                     int              x,
                     int              y,
@@ -187,8 +193,6 @@
                        RS_F_Point*      res,
                        float*           offsets);
 
-    virtual void AddExclusionRegion(RS_F_Point* fpts, int npts);
-
 private:
     double _MeterToMapSize(RS_Units unit, double number);
     double _PixelToMapSize(Renderer* renderer, int pixels);

Modified: trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp	2007-03-10 01:21:45 UTC (rev 1194)
@@ -193,7 +193,7 @@
     if (exprstr.empty())
     {
         val.expression = NULL;
-        val.value = L"";
+        val = L"";
     }
     else
     {

Modified: trunk/MgDev/Common/Stylization/SE_Include.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Include.h	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/SE_Include.h	2007-03-10 01:21:45 UTC (rev 1194)
@@ -191,8 +191,20 @@
     const wchar_t* value;
     FdoExpression* expression;
 
-    SE_INLINE SE_String() : expression(NULL), value(NULL) { }
-    SE_INLINE SE_String(const wchar_t* s) : value(s), expression(NULL) { }
+    SE_INLINE SE_String() : expression(NULL), value(NULL)
+    {}
+    SE_INLINE SE_String(const wchar_t* s) : expression(NULL)
+    {
+        if (s)
+        {
+            size_t len = wcslen(s) + 1;
+            wchar_t* copy = new wchar_t[len];
+            value = wcscpy(copy, s);
+        }
+        else
+            value = NULL;
+    }
+
     ~SE_String() 
     {
         if (value)
@@ -237,7 +249,20 @@
         return value;
     }
 
-    SE_INLINE void operator=(const wchar_t* s) { value = s; }
+    SE_INLINE void operator=(const wchar_t* s)
+    {
+        if (value)
+            delete[] value;
+
+        if (s)
+        {
+            size_t len = wcslen(s) + 1;
+            wchar_t* copy = new wchar_t[len];
+            value = wcscpy(copy, s);
+        }
+        else
+            value = NULL;
+    }
 };
 
 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -542,6 +567,7 @@
 struct SE_Rule
 {
     std::vector<SE_Symbolization*> symbolization;
+    RS_String legendLabel;  // no expressions on this guy
     FdoFilter* filter;
     
     ~SE_Rule()

Modified: trunk/MgDev/Common/Stylization/SE_Renderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.h	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.h	2007-03-10 01:21:45 UTC (rev 1194)
@@ -27,11 +27,11 @@
 public:
     void SetLineBufferPool(SE_LineBufferPool* pool);
     /* SE_RenderSymbol, under associated xform, is in screen space, and geometry is in screen space */
-    virtual void ProcessPoint(LineBuffer* geometry, SE_RenderPointStyle* style);
-    virtual void ProcessLine(LineBuffer* geometry, SE_RenderLineStyle* style);
-    virtual void ProcessArea(LineBuffer* geometry, SE_RenderAreaStyle* style);
+    STYLIZATION_API virtual void ProcessPoint(LineBuffer* geometry, SE_RenderPointStyle* style);
+    STYLIZATION_API virtual void ProcessLine(LineBuffer* geometry, SE_RenderLineStyle* style);
+    STYLIZATION_API virtual void ProcessArea(LineBuffer* geometry, SE_RenderAreaStyle* style);
 
-    virtual void DrawSymbol(SE_RenderSymbol& symbol, const SE_Matrix& xform, double anglerad);
+    STYLIZATION_API virtual void DrawSymbol(SE_RenderSymbol& symbol, const SE_Matrix& xform, double anglerad);
 
     virtual void DrawScreenPolyline(LineBuffer* polyline, unsigned int color, double weight) = 0; // px
     virtual void DrawScreenPolygon(LineBuffer* polygon, unsigned int fill) = 0;

Modified: trunk/MgDev/Common/Stylization/SE_StyleVisitor.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_StyleVisitor.cpp	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/SE_StyleVisitor.cpp	2007-03-10 01:21:45 UTC (rev 1194)
@@ -50,22 +50,23 @@
     m_resources = resources;
     m_lbp = lbp;
     m_primitive = NULL;
+    m_symbolization = NULL;
+    m_style = NULL;
 }
 
-void SE_StyleVisitor::ProcessPointUsage(PointUsage& pointUsage)
+SE_PointStyle* SE_StyleVisitor::ProcessPointUsage(PointUsage& pointUsage)
 {
     SE_PointStyle* style = new SE_PointStyle();
-    m_style = style;
     ParseDoubleExpression(pointUsage.GetAngle(), style->angle);
     ParseDoubleExpression(pointUsage.GetOriginOffsetX(), style->offset[0]);
     ParseDoubleExpression(pointUsage.GetOriginOffsetY(), style->offset[1]);
     ParseStringExpression(pointUsage.GetAngleControl(), style->orientation);
+    return style;
 }
 
-void SE_StyleVisitor::ProcessLineUsage(LineUsage& lineUsage)
+SE_LineStyle* SE_StyleVisitor::ProcessLineUsage(LineUsage& lineUsage)
 {
     SE_LineStyle* style = new SE_LineStyle();
-    m_style = style;
     ParseDoubleExpression(lineUsage.GetStartOffset(), style->startOffset);
     ParseDoubleExpression(lineUsage.GetEndOffset(), style->endOffset);
     ParseDoubleExpression(lineUsage.GetRepeat(), style->repeat);
@@ -75,12 +76,12 @@
     ParseStringExpression(lineUsage.GetAngleControl(), style->orientation);
     ParseStringExpression(lineUsage.GetVertexControl(), style->overlap);
     //ParseStringExpression(lineUsage.GetLineJoin(), style->join);
+    return style;
 }
 
-void SE_StyleVisitor::ProcessAreaUsage(AreaUsage& areaUsage)
+SE_AreaStyle* SE_StyleVisitor::ProcessAreaUsage(AreaUsage& areaUsage)
 {
     SE_AreaStyle* style = new SE_AreaStyle();
-    m_style = style;
     ParseDoubleExpression(areaUsage.GetAngle(), style->angle);
     ParseDoubleExpression(areaUsage.GetOriginX(), style->origin[0]);
     ParseDoubleExpression(areaUsage.GetOriginY(), style->origin[1]);
@@ -90,6 +91,7 @@
     ParseStringExpression(areaUsage.GetAngleControl(), style->orientation);
     ParseStringExpression(areaUsage.GetClippingControl(), style->clipping);
     ParseStringExpression(areaUsage.GetOriginControl(), style->origincontrol);
+    return style;
 }
 
 bool SE_StyleVisitor::ParseDouble(const wchar_t*& str, double& val)
@@ -118,7 +120,7 @@
     double sx, sy, rx, ry, rot, large, cw;
 
     SE_LineBuffer* lb = &buffer;
-    
+
     wchar_t tag, ptag = 0;
 
     for (;data < end; )
@@ -128,7 +130,7 @@
             data++;
             continue;
         }
-        
+
         tag = *data++;
 
 TagSwitch:
@@ -194,7 +196,7 @@
                 return false;
             if (!ParseDoublePair(data, x, y))
                 return false;
-            
+
             sx = lx;
             sy = ly;
 
@@ -208,7 +210,7 @@
                 lx = x;
                 ly = y;
             }
-    
+
             if (rx == 0 || ry == 0)
             {
                 lb->LineTo(lx, ly);
@@ -241,7 +243,7 @@
         }
         ptag = tag;
     }
-    
+
     return true;
 }
 
@@ -298,7 +300,7 @@
     {
         //x0 equal to x1 -- vertical chord
         cx0 = x0;
-        cx1 = x1;        
+        cx1 = x1;
     }
     else
     {
@@ -326,8 +328,8 @@
         eAng += 2*M_PI;
 
     /* TODO: scale radii until properly specified instead of failing */
-    if (!_finite(cx0) || _isnan(cx0) || 
-        !_finite(cx1) || _isnan(cx1) || 
+    if (!_finite(cx0) || _isnan(cx0) ||
+        !_finite(cx1) || _isnan(cx1) ||
         !_finite(cy0) || _isnan(cy0) ||
         !_finite(cy1) || _isnan(cy1))
         return false;
@@ -393,7 +395,7 @@
          * so we will change it to black. */
         if (line->color.argb() == 0)
             line->color.a = 255;
-        line->cacheable = !(line->weight.expression || 
+        line->cacheable = !(line->weight.expression ||
                             line->color.expression);
     }
     else
@@ -405,8 +407,8 @@
         ParseDoubleExpression(path.GetLineWeight(), polygon->weight);
         polygon->fill = color;
         ParseColorExpression(path.GetLineColor(), polygon->color);
-        polygon->cacheable = !(polygon->weight.expression || 
-                            polygon->color.expression || 
+        polygon->cacheable = !(polygon->weight.expression ||
+                            polygon->color.expression ||
                             polygon->fill.expression);
     }
 }
@@ -415,7 +417,7 @@
 {
     SE_Raster* primitive = new SE_Raster();
     m_primitive = primitive;
-    
+
     if (image.GetContent().size())
     {
         /* Handle this; Base64 as MdfString is not a particularly inspired plan */
@@ -423,13 +425,13 @@
     }
     else
     {
-        //TODO: Disallow expressions for now since 
+        //TODO: Disallow expressions for now since
         //ParseStringExpression(image.GetReference(), primitive->pngPath);
         primitive->pngPath.value = image.GetReference().c_str();
         primitive->pngPath.expression = NULL;
 
         if (primitive->pngPath.expression == NULL) // constant path
-            primitive->pngPtr = m_resources->GetImageData(image.GetReference().c_str(), primitive->pngSize);
+            primitive->pngPtr = m_resources? m_resources->GetImageData(image.GetReference().c_str(), primitive->pngSize) : NULL;
         else
             primitive->pngPtr = NULL;
     }
@@ -487,8 +489,6 @@
 
 void SE_StyleVisitor::VisitSimpleSymbolDefinition(MdfModel::SimpleSymbolDefinition& simpleSymbol)
 {
-    m_style = NULL;
-
     SetDefaultValues(&simpleSymbol);
 
     // TODO - We need a hint that says what feature geometry type we're
@@ -498,13 +498,16 @@
     LineUsage* lineUsage = simpleSymbol.GetLineUsage();
     AreaUsage* areaUsage = simpleSymbol.GetAreaUsage();
 
+    m_style = NULL;
     if (pointUsage != NULL)
-        this->ProcessPointUsage(*pointUsage);
+        m_style = this->ProcessPointUsage(*pointUsage);
     else if (lineUsage != NULL)
-        this->ProcessLineUsage(*lineUsage);
+        m_style = this->ProcessLineUsage(*lineUsage);
     else if (areaUsage != NULL)
-        this->ProcessAreaUsage(*areaUsage);
-    else
+        m_style = this->ProcessAreaUsage(*areaUsage);
+
+    // must have a style in order to render something
+    if (m_style == NULL)
         return;
 
     GraphicElementCollection* graphics = simpleSymbol.GetGraphics();
@@ -514,7 +517,7 @@
     {
         GraphicElement* elem = graphics->GetAt(i);
         elem->AcceptVisitor(*this);
-        
+
         if (m_primitive)
         {
             m_primitive->resize = elem->GetResizeControl();
@@ -546,15 +549,17 @@
     {
         SimpleSymbol* sym = symbols->GetAt(i);
         SimpleSymbolDefinition* def = sym->GetSymbolDefinition();
-        const MdfString& ref = sym->GetSymbolReference();
-
         if (def == NULL)
         {
-            def = dynamic_cast<SimpleSymbolDefinition*>(m_resources->GetSymbolDefinition(ref.c_str()));        
+            if (m_resources == NULL)
+                return;
+
+            const MdfString& ref = sym->GetSymbolReference();
+            def = dynamic_cast<SimpleSymbolDefinition*>(m_resources->GetSymbolDefinition(ref.c_str()));
             if (def == NULL)
                 return;
         }
-        
+
         VisitSimpleSymbolDefinition(*def);
 
         if (m_style)
@@ -575,21 +580,21 @@
     for (int i = 0; i < nSymbols; i++)
     {
         SymbolInstance* instance = symbols->GetAt(i);
-        SymbolDefinition* sd = m_resources->GetSymbolDefinition(instance->GetSymbolReference().c_str());
+        SymbolDefinition* sd = m_resources? m_resources->GetSymbolDefinition(instance->GetSymbolReference().c_str()) : NULL;
         if (sd == NULL)
             continue;
 
         m_symbolization = new SE_Symbolization;
 
         m_symbolization->context = instance->GetSizeContext();
-        
+
         ParseBooleanExpression(instance->GetDrawLast(), m_symbolization->drawLast);
         ParseBooleanExpression(instance->GetAddToExclusionRegion(), m_symbolization->addToExclusionRegions);
         ParseBooleanExpression(instance->GetCheckExclusionRegion(), m_symbolization->checkExclusionRegions);
 
         if (!instance->GetPositioningAlgorithm().empty())
             m_symbolization->positioningAlgorithm = instance->GetPositioningAlgorithm();
-        
+
         ParseDoubleExpression(instance->GetScaleX(), m_symbolization->scale[0]);
         ParseDoubleExpression(instance->GetScaleY(), m_symbolization->scale[1]);
         ParseDoubleExpression(instance->GetInsertionOffsetX(), m_symbolization->absOffset[0]);

Modified: trunk/MgDev/Common/Stylization/SE_StyleVisitor.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_StyleVisitor.h	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/SE_StyleVisitor.h	2007-03-10 01:21:45 UTC (rev 1194)
@@ -39,7 +39,7 @@
     class CompoundSymbolDefinition;
 }
 
-class SE_StyleVisitor : public MdfModel::IGraphicElementVisitor, public MdfModel::ISymbolDefinitionVisitor, private SE_ExpressionBase
+class SE_StyleVisitor : public MdfModel::IGraphicElementVisitor, public MdfModel::ISymbolDefinitionVisitor, public SE_ExpressionBase
 {
 public:
     SE_StyleVisitor(SE_SymbolManager* resources, SE_LineBufferPool* lbp);
@@ -53,9 +53,9 @@
     virtual void VisitSimpleSymbolDefinition(MdfModel::SimpleSymbolDefinition& simpleSymbol);
     virtual void VisitCompoundSymbolDefinition(MdfModel::CompoundSymbolDefinition& compoundSymbol);
 
-    void ProcessPointUsage(MdfModel::PointUsage& pointUsage);
-    void ProcessLineUsage(MdfModel::LineUsage& lineUsage);
-    void ProcessAreaUsage(MdfModel::AreaUsage& areaUsage);
+    SE_PointStyle* ProcessPointUsage(MdfModel::PointUsage& pointUsage);
+    SE_LineStyle* ProcessLineUsage(MdfModel::LineUsage& lineUsage);
+    SE_AreaStyle* ProcessAreaUsage(MdfModel::AreaUsage& areaUsage);
 
     void Convert(std::vector<SE_Symbolization*>& styles, MdfModel::CompositeSymbolization* symbolization);
 private:

Modified: trunk/MgDev/Common/Stylization/StylizationEngine.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2007-03-10 01:21:45 UTC (rev 1194)
@@ -26,6 +26,8 @@
 #include "SE_PositioningAlgorithms.h"
 #include "RS_FontEngine.h"
 
+#include "Renderer.h"
+
 #include <algorithm>
 #include <functional>
 
@@ -33,7 +35,10 @@
 
 
 StylizationEngine::StylizationEngine(SE_SymbolManager* resources) :
-    m_resources(resources)
+    m_resources(resources),
+    m_renderer(NULL),
+    m_exec(NULL),
+    m_reader(NULL)
 {
     m_pool = new SE_LineBufferPool;
     m_visitor = new SE_StyleVisitor(resources, m_pool);
@@ -50,20 +55,25 @@
                                  RS_FeatureReader* feature,
                                  RS_FilterExecutor* executor,
                                  LineBuffer* geometry,
-                                 CompositeTypeStyle* style )
+                                 CompositeTypeStyle* style,
+                                 SE_String* seTip,
+                                 SE_String* seUrl,
+                                 RS_ElevationSettings* /*elevSettings*/)
 {
-    if (m_renderer == NULL || m_reader == NULL || m_exec == NULL)
+    if (renderer == NULL || feature == NULL || executor == NULL)
         return;
 
     m_renderer = renderer;
     m_reader = feature;
     m_exec = executor;
 
-    m_renderer->GetWorldToScreenTransform(m_w2s);
-    m_mm2pxs = m_renderer->GetPixelsPerMillimeterScreen();
-    m_mm2pxw = m_renderer->GetPixelsPerMillimeterWorld();
+    SE_Matrix w2s;
+    m_renderer->GetWorldToScreenTransform(w2s);
     m_renderer->SetLineBufferPool(m_pool);
 
+    double mm2pxs = m_renderer->GetPixelsPerMillimeterScreen();
+    double mm2pxw = m_renderer->GetPixelsPerMillimeterWorld();
+
     SE_Rule*& rules = m_rules[style];
     RuleCollection* rulecoll = style->GetRules();
     int nRules = rulecoll->GetCount();
@@ -78,7 +88,6 @@
             CompositeRule* r = (CompositeRule*)rulecoll->GetAt(i);
             const MdfString& filterstr = r->GetFilter();
             rulecache[i].filter = NULL;
-            
             if (!filterstr.empty())
             {
                 try
@@ -91,15 +100,17 @@
                 }
             }
 
+            rulecache[i].legendLabel= r->GetLegendLabel();
+
             m_visitor->Convert(rulecache[i].symbolization, r->GetSymbolization());
         }
     }
 
-    std::vector<SE_Symbolization*>* symbolization = NULL;
+    SE_Rule* rule = NULL;
 
     for (int i = 0; i < nRules; i++)
     {
-        bool match = rules[i].filter == NULL;
+        bool match = (rules[i].filter == NULL);
         
         if (!match)
         {
@@ -109,26 +120,42 @@
 
         if (match)
         {
-            symbolization = &rules[i].symbolization;
+            rule = &rules[i];
             break;
         }
     }
 
-    if (symbolization == NULL)
+    if (rule == NULL)
         return;
 
-    /* TODO: Obey the indices--Get rid of the indices alltogther--single pass! */
+    std::vector<SE_Symbolization*>* symbolization = &rule->symbolization;
+
+    // TODO: eliminate the need to do dynamic casts on these renderers.  We should
+    //       probably ultimately have just one renderer interface class...
+    Renderer* baseRenderer = dynamic_cast<Renderer*>(m_renderer);
+    if (baseRenderer != NULL)
+    {
+        const wchar_t* strTip = seTip->evaluate(m_exec);
+        const wchar_t* strUrl = seUrl->evaluate(m_exec);
+        RS_String rs_tip = strTip? strTip : L"";
+        RS_String rs_url = strUrl? strUrl : L"";
+        RS_String& rs_thm = rule->legendLabel;
+
+        baseRenderer->StartFeature(feature, rs_tip.empty()? NULL : &rs_tip, rs_url.empty()? NULL : &rs_url, rs_thm.empty()? NULL : &rs_thm);
+    }
+
+    /* TODO: Obey the indices--Get rid of the indices altogther--single pass! */
     
     SE_LineBuffer* xformGeom = m_pool->NewLineBuffer(geometry->point_count());
     xformGeom->compute_bounds() = false;
         
-    xformGeom->Transform(geometry, m_w2s);
+    xformGeom->Transform(geometry, w2s);
 
     for (std::vector<SE_Symbolization*>::const_iterator iter = symbolization->begin(); iter != symbolization->end(); iter++)
     {
         SE_Symbolization* sym = *iter;
 
-        double mm2px = (sym->context == MappingUnits ? m_mm2pxw : m_mm2pxs);
+        double mm2px = (sym->context == MappingUnits ? mm2pxw : mm2pxs);
         SE_Matrix xform;
         xform.setTransform( sym->scale[0].evaluate(m_exec), 
                             sym->scale[1].evaluate(m_exec),
@@ -577,3 +604,9 @@
 
     m_rules.clear();
 }
+
+//parses a string expression
+void StylizationEngine::ParseStringExpression(const MdfString& mdf_string, SE_String& se_string)
+{
+    m_visitor->ParseStringExpression(mdf_string, se_string);
+}

Modified: trunk/MgDev/Common/Stylization/StylizationEngine.h
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.h	2007-03-09 23:36:56 UTC (rev 1193)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.h	2007-03-10 01:21:45 UTC (rev 1194)
@@ -29,6 +29,7 @@
 class SE_Renderer;
 class SE_StyleVisitor;
 class LineBuffer;
+class RS_ElevationSettings;
 
 namespace MDFMODEL_NAMESPACE
 {
@@ -44,16 +45,21 @@
     /* TODO: don't leak basically everything */
     ~StylizationEngine();
     /* TODO: add stylize layer to this class, and reset functionality to RS_FeatureReader API & implementations
-     * Stylizize one CompoundSymbol feature and label per run; investigate caching possiblities to avoid
+     * Stylize one CompoundSymbol feature and label per run; investigate caching possiblities to avoid
      * filter execution on subsequent passes */
     void Stylize(SE_Renderer* renderer,
                  RS_FeatureReader* feature,
                  RS_FilterExecutor* executor,
                  LineBuffer* geometry,
-                 CompositeTypeStyle* style);
+                 CompositeTypeStyle* style,
+                 SE_String* seTip,
+                 SE_String* seUrl,
+                 RS_ElevationSettings* elevSettings);
 
     void ClearCache();
 
+    void ParseStringExpression(const MdfString& mdf_string, SE_String& se_string);
+
 private:
     SE_RenderPointStyle* EvaluatePointStyle(SE_LineBuffer* geometry, SE_Matrix& xform, SE_PointStyle* style, double mm2px);
     SE_RenderAreaStyle* EvaluateAreaStyle(SE_Matrix& xform, SE_AreaStyle* style);
@@ -61,12 +67,11 @@
 
     void LayoutCustomLabel(const std::wstring& positioningAlgo, LineBuffer* geometry, SE_Matrix& xform, SE_Style* style, SE_RenderStyle* rstyle, double mm2px);
     void EvaluateSymbols(SE_Matrix& xform, SE_Style* style, SE_RenderStyle* renderStyle, double mm2px);
+
+private:
     SE_Renderer* m_renderer;
     RS_FilterExecutor* m_exec;
     RS_FeatureReader* m_reader;
-    SE_Matrix m_w2s;
-    double m_mm2pxs;
-    double m_mm2pxw;
     SE_SymbolManager* m_resources;
     SE_LineBufferPool* m_pool;
     SE_StyleVisitor* m_visitor;



More information about the mapguide-commits mailing list