[mapguide-commits] r7744 - sandbox/jng/stylization_refactor/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Aug 7 09:29:49 PDT 2013


Author: jng
Date: 2013-08-07 09:29:48 -0700 (Wed, 07 Aug 2013)
New Revision: 7744

Modified:
   sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.cpp
   sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.h
   sandbox/jng/stylization_refactor/Common/Stylization/FdoEvaluator.h
   sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.cpp
   sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.h
   sandbox/jng/stylization_refactor/Common/Stylization/SE_Evaluator.h
   sandbox/jng/stylization_refactor/Common/Stylization/Stylizer.h
Log:
This submission includes the following changes:
 - Remove FdoExpression/FdoFilter cache cleanup code from GeometryAdapter
 - Update signature of Stylizer::SetGeometryAdapter to use LineBuffer::GeometryType instead of FdoGeometryType (the enum values are the same)
 - Remove unused GetRulesFilter method from DefaultStylizer

Modified: sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.cpp	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.cpp	2013-08-07 16:29:48 UTC (rev 7744)
@@ -466,7 +466,7 @@
 //////////////////////////////////////////////////////////////////////////////
 // WARNING: given pointer to the new stylizer will be destroyed
 // by the stylizer (in its destructor)
-void DefaultStylizer::SetGeometryAdapter(FdoGeometryType type, GeometryAdapter* stylizer)
+void DefaultStylizer::SetGeometryAdapter(LineBuffer::GeometryType type, GeometryAdapter* stylizer)
 {
     GeometryAdapter* old = (GeometryAdapter*)m_hGeomStylizers[type];
     delete old;
@@ -552,84 +552,4 @@
     MdfModel::VectorScaleRange* scaleRange = Stylizer::FindScaleRange(*scaleRanges, mapScale);
 
     return (NULL != scaleRange);
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
-FdoFilter* DefaultStylizer::GetRulesFilter(MdfModel::VectorLayerDefinition* layer,
-                                           double                           mapScale)
-{
-    // look through the scale ranges to find a valid one
-    MdfModel::VectorScaleRangeCollection* scaleRanges = layer->GetScaleRanges();
-    MdfModel::VectorScaleRange* scaleRange = Stylizer::FindScaleRange(*scaleRanges, mapScale);
-
-    // no range -- fast return, the layer is invisible at this scale
-    if (NULL == scaleRange)
-        return NULL;
-
-    // extract all the composite styles once
-    MdfModel::FeatureTypeStyleCollection* ftsc = scaleRange->GetFeatureTypeStyles();
-    std::vector<CompositeTypeStyle*> compTypeStyles;
-    for (int i=0; i<ftsc->GetCount(); ++i)
-    {
-        MdfModel::FeatureTypeStyle* fts = ftsc->GetAt(i);
-        if (FeatureTypeStyleVisitor::DetermineFeatureTypeStyle(fts) == FeatureTypeStyleVisitor::ftsComposite)
-            compTypeStyles.push_back((CompositeTypeStyle*)fts);
-    }
-
-    size_t numTypeStyles = compTypeStyles.size();
-    _ASSERT(numTypeStyles > 0);
-    if (numTypeStyles == 0)
-        return NULL;
-
-    // Build a filter by combining the filters for each rule
-    MdfString filterstr;
-
-    for (size_t i=0; i<numTypeStyles; ++i)
-    {
-        CompositeTypeStyle* style = compTypeStyles.at(i);
-        RuleCollection* rulecoll = style->GetRules();
-        int nRules = rulecoll->GetCount();
-
-        for (int j = nRules-1; j >= 0; --j)
-        {
-            CompositeRule* r = static_cast<CompositeRule*>(rulecoll->GetAt(j));
-            const MdfString& temp = r->GetFilter(); 
-
-            // If any of the rules is the default rule, return an empty filter because the
-            // default rule will match all features, even those not matched by other rules.
-            if (temp.empty())
-                return NULL;
-            else
-            {
-                if (filterstr.empty())
-                    filterstr.append(L"("); // start filter
-                else
-                    filterstr.append(L" OR ");
-
-                filterstr.append(L"(");
-                filterstr.append(temp.c_str());
-                filterstr.append(L")");
-            }
-        }
-    }
-
-    // Output filter
-    FdoFilter* filter = NULL;
-
-    if (!filterstr.empty())
-    {
-        filterstr.append(L")"); // close filter
-
-        try
-        {
-            filter = FdoFilter::Parse(filterstr.c_str());
-        }
-        catch (FdoException* e)
-        {
-            e->Release();
-        }
-    }
-
-    return filter;
-}
+}
\ No newline at end of file

Modified: sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.h
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.h	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/DefaultStylizer.h	2013-08-07 16:29:48 UTC (rev 7744)
@@ -66,13 +66,11 @@
                                                   int saveWidth,
                                                   int saveHeight);
 
-    STYLIZATION_API virtual void SetGeometryAdapter(FdoGeometryType type, GeometryAdapter* stylizer);
+    STYLIZATION_API virtual void SetGeometryAdapter(LineBuffer::GeometryType type, GeometryAdapter* stylizer);
 
     STYLIZATION_API virtual bool HasValidScaleRange(MdfModel::VectorLayerDefinition* layer,
                                                     double mapScale);
 
-    STYLIZATION_API virtual FdoFilter* GetRulesFilter(MdfModel::VectorLayerDefinition* layer,
-                                                      double mapScale);
 private:
     int StylizeVLHelper(MdfModel::VectorLayerDefinition* layer,
                         MdfModel::VectorScaleRange*      scaleRange,

Modified: sandbox/jng/stylization_refactor/Common/Stylization/FdoEvaluator.h
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/FdoEvaluator.h	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/FdoEvaluator.h	2013-08-07 16:29:48 UTC (rev 7744)
@@ -24,6 +24,10 @@
 #include "Renderer.h"
 #include <map>
 
+//-------------------------------------------------------------
+// Provides services for evaluating FDO expressions and filters
+//-------------------------------------------------------------
+
 class FdoEvaluator : public SE_Evaluator
 {
 public:
@@ -41,6 +45,13 @@
     void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
 
     FdoPtr<FdoExpressionEngine> m_exec;
+
+    // BOGUS:
+    // TODO: we use pointer to the MDF strings for caching --
+    // this may be risky but all caching in the stylizer is
+    // based on the MDF pointer staying the same throughout the
+    // stylization process
+
     // FdoFilter cache
     std::map<const void*, FdoFilter*> m_hFilterCache;
     // FdoExpression cache

Modified: sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.cpp
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.cpp	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.cpp	2013-08-07 16:29:48 UTC (rev 7744)
@@ -35,25 +35,7 @@
 //////////////////////////////////////////////////////////////////////////////
 GeometryAdapter::~GeometryAdapter()
 {
-    // free up cached fdo filters
-    for (std::map<const void*, FdoFilter*>::iterator iter = m_hFilterCache.begin();
-        iter != m_hFilterCache.end(); ++iter)
-    {
-        if (iter->second)
-            iter->second->Release();
-    }
-
-    m_hFilterCache.clear();
-
-    // free up cached fdo expressions
-    for (std::map<const void*, FdoExpression*>::iterator iter = m_hExpressionCache.begin();
-        iter != m_hExpressionCache.end(); ++iter)
-    {
-        if (iter->second)
-            iter->second->Release();
-    }
-
-    m_hExpressionCache.clear();
+    
 }
 
 

Modified: sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.h
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.h	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/GeometryAdapter.h	2013-08-07 16:29:48 UTC (rev 7744)
@@ -90,18 +90,6 @@
 
     SE_Evaluator* m_eval;
     LineBufferPool* m_lbPool;
-
-    // BOGUS:
-    // TODO: we use pointer to the MDF strings for caching --
-    // this may be risky but all caching in the stylizer is
-    // based on the MDF pointer staying the same throughout the
-    // stylization process
-
-    // FdoFilter cache
-    std::map<const void*, FdoFilter*> m_hFilterCache;
-
-    // FdoExpression cache
-    std::map<const void*, FdoExpression*> m_hExpressionCache;
 };
 
 #endif

Modified: sandbox/jng/stylization_refactor/Common/Stylization/SE_Evaluator.h
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/SE_Evaluator.h	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/SE_Evaluator.h	2013-08-07 16:29:48 UTC (rev 7744)
@@ -21,6 +21,10 @@
 #include "Stylization.h"
 #include "RendererStyles.h"
 
+//----------------------------------------------------------
+// Provides services for evaluating expressions and filters
+//----------------------------------------------------------
+
 class SE_Evaluator
 {
 public:

Modified: sandbox/jng/stylization_refactor/Common/Stylization/Stylizer.h
===================================================================
--- sandbox/jng/stylization_refactor/Common/Stylization/Stylizer.h	2013-08-07 15:57:40 UTC (rev 7743)
+++ sandbox/jng/stylization_refactor/Common/Stylization/Stylizer.h	2013-08-07 16:29:48 UTC (rev 7744)
@@ -88,7 +88,7 @@
     ///<summary>
     /// Allows a user to set a custom stylization object for a given geometry type.
     ///</summary>
-    virtual void SetGeometryAdapter(FdoGeometryType type, GeometryAdapter* stylizer) = 0;
+    virtual void SetGeometryAdapter(LineBuffer::GeometryType type, GeometryAdapter* stylizer) = 0;
 
     STYLIZATION_API static MdfModel::VectorScaleRange* FindScaleRange(MdfModel::VectorScaleRangeCollection& src, double mapScale);
     STYLIZATION_API static MdfModel::GridScaleRange* FindScaleRange(MdfModel::GridScaleRangeCollection& src, double mapScale);



More information about the mapguide-commits mailing list