[mapguide-commits] r9349 - in sandbox/jng/common_decouple: . Common/Renderers Common/Stylization Server/src/Services/Mapping

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Mar 3 08:14:43 PST 2018


Author: jng
Date: 2018-03-03 08:14:43 -0800 (Sat, 03 Mar 2018)
New Revision: 9349

Added:
   sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.cpp
   sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.h
   sandbox/jng/common_decouple/Common/Stylization/FdoStylizationCommon.h
   sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.h
Modified:
   sandbox/jng/common_decouple/
   sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp
   sandbox/jng/common_decouple/Common/Renderers/GDRenderer.cpp
   sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.cpp
   sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionArgb.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionDecap.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureClass.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureId.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureSource.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionHtmlColor.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionIf.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerDefinition.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerId.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLookup.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterX.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterY.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapName.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapScale.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionRange.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionSession.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionUrlEncode.h
   sandbox/jng/common_decouple/Common/Stylization/ExpressionHelper.h
   sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.cpp
   sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.h
   sandbox/jng/common_decouple/Common/Stylization/GridData.h
   sandbox/jng/common_decouple/Common/Stylization/KeyEncode.h
   sandbox/jng/common_decouple/Common/Stylization/LabelRenderer.cpp
   sandbox/jng/common_decouple/Common/Stylization/LabelRendererLocal.cpp
   sandbox/jng/common_decouple/Common/Stylization/LineBuffer.h
   sandbox/jng/common_decouple/Common/Stylization/PointAdapter.cpp
   sandbox/jng/common_decouple/Common/Stylization/PointAdapter.h
   sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.cpp
   sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.h
   sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.cpp
   sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.h
   sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.cpp
   sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.h
   sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.h
   sandbox/jng/common_decouple/Common/Stylization/SE_LineBuffer.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_LineRenderer.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_PositioningAlgorithms.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_Renderer.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_StyleVisitor.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.cpp
   sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.h
   sandbox/jng/common_decouple/Common/Stylization/Stylization.h
   sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj
   sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj.filters
   sandbox/jng/common_decouple/Common/Stylization/StylizationDefs.h
   sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.cpp
   sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.h
   sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.cpp
   sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.h
   sandbox/jng/common_decouple/Common/Stylization/Stylizer.cpp
   sandbox/jng/common_decouple/Common/Stylization/Stylizer.h
   sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.cpp
   sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.h
   sandbox/jng/common_decouple/Server/src/Services/Mapping/MappingUtil.cpp
Log:
Merged revision(s) 7742-7749 from sandbox/jng/stylization_refactor:
Refactor the stylization library to better abstract out the FDO dependency.
 - Introduce a new abstract SE_Evaluator class that provides the necessary methods for evaluating expressions and filters
 - Introduce a new FdoEvaluator class inheriting from SE_Evaluator that delegates such operations to the FdoExpressionEngine and retains the Expression/Filter caching code from GeometryAdapter
 - Replace all usages of FdoExpressionEngine to use SE_Evaluator instead. Only FdoEvaluator will use FdoExpressionEngine directly and create/parse FdoExpression and FdoFilter objects.

These changes should allow us in the future to have a stylization library without a dependency to FDO by providing an alternate implementation of SE_Evaluator and #ifdef'ing out all the classes that use FDO classes and data types.

Running our Rendering Service test suite and observing the rendered images shows at first glance that these changes have not affected or broken stylization behaviour.
........
Remove/update comments
........
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
........
This submission includes the following changes:
 - Move geometry enums in LineBuffer to StylizationDefs.h
 - Move FDO #includes to a new FdoStylizationCommon.h. Anything using FDO types will include this header.
 - Remove use of FDO geometry enums in AGGRenderer and GDRenderer as we already have equivalent enums already defined in the Stylization library with the same values.
 - Replace usage of FDO geometry enums with their stylization equivalents
 - Re-scope the global stylization exception callback to be a static member of the FdoEvaluator class. This also inclues a STYLIZATION_TRY() and STYLIZATION_CATCH() macro to simplify stylization exception handling.
 - Re-define the StylizerExceptionCallback to include an extra parameter (the method name). This gives greater context to the stylization exception handler in MgMappingUtil
........
More FdoGeometryType to GeometryType enum replacements
........


Index: sandbox/jng/common_decouple
===================================================================
--- sandbox/jng/common_decouple	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple	2018-03-03 16:14:43 UTC (rev 9349)

Property changes on: sandbox/jng/common_decouple
___________________________________________________________________
Modified: svn:mergeinfo
## -21,6 +21,7 ##
 /sandbox/jng/php56x:8975-8985
 /sandbox/jng/rfc155:8872-8884
 /sandbox/jng/simplify:8814-9141
+/sandbox/jng/stylization_refactor:7742-7749
 /sandbox/jng/tiling:8174-8208
 /sandbox/jng/utfgrid:9179-9212
 /sandbox/jng/v30:8212-8227
Modified: sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Renderers/AGGRenderer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -1765,12 +1765,12 @@
         // sanity check - cannot clip against these types
         switch (polygon->geom_type())
         {
-            case FdoGeometryType_Point:
-            case FdoGeometryType_MultiPoint:
-            case FdoGeometryType_LineString:
-            case FdoGeometryType_MultiLineString:
-            case FdoGeometryType_CurveString:
-            case FdoGeometryType_MultiCurveString:
+            case GeometryType_Point:
+            case GeometryType_MultiPoint:
+            case GeometryType_LineString:
+            case GeometryType_MultiLineString:
+            case GeometryType_CurveString:
+            case GeometryType_MultiCurveString:
                 return;
         }
         c()->bPolyClip = true;
@@ -1912,12 +1912,12 @@
     // can't apply an area style to point and linestring geometry types
     switch (featGeom->geom_type())
     {
-        case FdoGeometryType_Point:
-        case FdoGeometryType_MultiPoint:
-        case FdoGeometryType_LineString:
-        case FdoGeometryType_MultiLineString:
-        case FdoGeometryType_CurveString:
-        case FdoGeometryType_MultiCurveString:
+        case GeometryType_Point:
+        case GeometryType_MultiPoint:
+        case GeometryType_LineString:
+        case GeometryType_MultiLineString:
+        case GeometryType_CurveString:
+        case GeometryType_MultiCurveString:
             return;
     }
 

Modified: sandbox/jng/common_decouple/Common/Renderers/GDRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Renderers/GDRenderer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Renderers/GDRenderer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -1754,12 +1754,12 @@
     // can't apply an area style to point and linestring geometry types
     switch (featGeom->geom_type())
     {
-        case FdoGeometryType_Point:
-        case FdoGeometryType_MultiPoint:
-        case FdoGeometryType_LineString:
-        case FdoGeometryType_MultiLineString:
-        case FdoGeometryType_CurveString:
-        case FdoGeometryType_MultiCurveString:
+        case GeometryType_Point:
+        case GeometryType_MultiPoint:
+        case GeometryType_LineString:
+        case GeometryType_MultiLineString:
+        case GeometryType_CurveString:
+        case GeometryType_MultiCurveString:
             return;
     }
 

Modified: sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -27,7 +27,7 @@
 #include "ElevationSettings.h"
 #include "FeatureTypeStyleVisitor.h"
 #include "StylizationEngine.h"
-#include "ExpressionHelper.h"
+#include "FdoEvaluator.h"
 #ifdef _DEBUG
 #include <cstdio>
 #endif
@@ -311,12 +311,12 @@
     // 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
+    // create an FDO evaluator
+    // NOTE: We must create a new evaluator for each call to StylizeVLHelper.  The
+    //       evaluator stores a weak reference to the RS_FeatureReader's internal
     //       FdoIFeatureReader, and this internal reader is different for each
     //       call to StylizeVLHelper.
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(renderer, features);
+    FdoEvaluator eval(renderer, features);
 
     // main loop over feature data
     int nFeatures = 0;
@@ -326,7 +326,7 @@
         ++nFeatures;
         #endif
 
-        LineBuffer* lb = LineBufferPool::NewLineBuffer(&m_lbPool, 8, FdoDimensionality_Z, ignoreZ);
+        LineBuffer* lb = LineBufferPool::NewLineBuffer(&m_lbPool, 8, Dimensionality_Z, ignoreZ);
         if (!lb)
             continue;
 
@@ -364,7 +364,7 @@
             for (int i=0; i<ftsc->GetCount(); ++i)
             {
                 MdfModel::FeatureTypeStyle* fts = ftsc->GetAt(i);
-                adapter->Stylize(renderer, features, initialPass, exec, lb, fts, lrTip, lrUrl, elevSettings);
+                adapter->Stylize(renderer, features, initialPass, &eval, lb, fts, lrTip, lrUrl, elevSettings);
             }
         }
 
@@ -409,7 +409,7 @@
     renderer->SetBufferPool(&m_lbPool);
 
     // create an expression engine with our custom functions
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(renderer, features);
+    FdoEvaluator eval(renderer, features);
 
     // find the FeatureTypeStyle
     MdfModel::GridColorStyle* gcs = range->GetColorStyle();
@@ -428,7 +428,7 @@
 
         // at this point raster is in the raster layer's cs
         if (m_pRasterAdapter)
-            m_pRasterAdapter->Stylize(renderer, features, true, exec, raster, gcs, gss, NULL, NULL, NULL, layer2mapxformer);
+            m_pRasterAdapter->Stylize(renderer, features, true, &eval, raster, gcs, gss, NULL, NULL, NULL, layer2mapxformer);
 
         // need to free returned raster
         delete raster;
@@ -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(GeometryType type, GeometryAdapter* stylizer)
 {
     GeometryAdapter* old = (GeometryAdapter*)m_hGeomStylizers[type];
     delete old;
@@ -487,35 +487,35 @@
     // otherwise need to create one based on the geometry type
     switch (geomType)
     {
-    case FdoGeometryType_LineString:
-        m_hGeomStylizers[FdoGeometryType_LineString] = new PolylineAdapter(&m_lbPool);
+    case GeometryType_LineString:
+        m_hGeomStylizers[GeometryType_LineString] = new PolylineAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_MultiLineString:
-        m_hGeomStylizers[FdoGeometryType_MultiLineString] = new PolylineAdapter(&m_lbPool);
+    case GeometryType_MultiLineString:
+        m_hGeomStylizers[GeometryType_MultiLineString] = new PolylineAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_CurveString:
-        m_hGeomStylizers[FdoGeometryType_CurveString] = new PolylineAdapter(&m_lbPool);
+    case GeometryType_CurveString:
+        m_hGeomStylizers[GeometryType_CurveString] = new PolylineAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_MultiCurveString:
-        m_hGeomStylizers[FdoGeometryType_MultiCurveString] = new PolylineAdapter(&m_lbPool);
+    case GeometryType_MultiCurveString:
+        m_hGeomStylizers[GeometryType_MultiCurveString] = new PolylineAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_Polygon:
-        m_hGeomStylizers[FdoGeometryType_Polygon] = new PolygonAdapter(&m_lbPool);
+    case GeometryType_Polygon:
+        m_hGeomStylizers[GeometryType_Polygon] = new PolygonAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_MultiPolygon:
-        m_hGeomStylizers[FdoGeometryType_MultiPolygon] = new PolygonAdapter(&m_lbPool);
+    case GeometryType_MultiPolygon:
+        m_hGeomStylizers[GeometryType_MultiPolygon] = new PolygonAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_CurvePolygon:
-        m_hGeomStylizers[FdoGeometryType_CurvePolygon] = new PolygonAdapter(&m_lbPool);
+    case GeometryType_CurvePolygon:
+        m_hGeomStylizers[GeometryType_CurvePolygon] = new PolygonAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_MultiCurvePolygon:
-        m_hGeomStylizers[FdoGeometryType_MultiCurvePolygon] = new PolygonAdapter(&m_lbPool);
+    case GeometryType_MultiCurvePolygon:
+        m_hGeomStylizers[GeometryType_MultiCurvePolygon] = new PolygonAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_Point:
-        m_hGeomStylizers[FdoGeometryType_Point] = new PointAdapter(&m_lbPool);
+    case GeometryType_Point:
+        m_hGeomStylizers[GeometryType_Point] = new PointAdapter(&m_lbPool);
         break;
-    case FdoGeometryType_MultiPoint:
-        m_hGeomStylizers[FdoGeometryType_MultiPoint] = new PointAdapter(&m_lbPool);
+    case GeometryType_MultiPoint:
+        m_hGeomStylizers[GeometryType_MultiPoint] = new PointAdapter(&m_lbPool);
         break;
     default :
         break;
@@ -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/common_decouple/Common/Stylization/DefaultStylizer.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/DefaultStylizer.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -66,13 +66,11 @@
                                                   int saveWidth,
                                                   int saveHeight);
 
-    STYLIZATION_API virtual void SetGeometryAdapter(FdoGeometryType type, GeometryAdapter* stylizer);
+    STYLIZATION_API virtual void SetGeometryAdapter(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/common_decouple/Common/Stylization/ExpressionFunctionArgb.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionArgb.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionArgb.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_ARGB_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionArgb : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionDecap.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionDecap.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionDecap.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_DECAP_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionDecap : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureClass.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureClass.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureClass.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_FEATURECLASS_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionFeatureClass : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureId.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureId.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureId.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,6 +20,7 @@
 
 #include "Stylization.h"
 #include "KeyEncode.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionFeatureId : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureSource.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureSource.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionFeatureSource.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_FEATURESOURCE_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionFeatureSource : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionHtmlColor.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionHtmlColor.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionHtmlColor.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_HTMLCOLOR_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionHtmlColor : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionIf.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionIf.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionIf.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_IF_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionIf : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerDefinition.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerDefinition.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerDefinition.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_LAYERDEFINITION_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionLayerDefinition : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerId.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerId.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLayerId.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_LAYERID_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionLayerId : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLookup.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLookup.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionLookup.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_LOOKUP_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionLookup : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterX.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterX.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterX.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_MAPCENTERX_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionMapCenterX : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterY.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterY.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapCenterY.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_MAPCENTERY_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionMapCenterY : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapName.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapName.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapName.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_MAPNAME_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionMapName : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapScale.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapScale.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionMapScale.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_MAPCENTERSCALE_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionMapScale : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionRange.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionRange.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionRange.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_RANGE_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionRange : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionSession.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionSession.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionSession.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,6 +20,7 @@
 #define EXPRESSION_FUNCTION_SESSION_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionSession : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionUrlEncode.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionUrlEncode.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionFunctionUrlEncode.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,6 +19,7 @@
 #define EXPRESSION_FUNCTION_URLENCODE_H_
 
 #include "Stylization.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionFunctionUrlEncode : public FdoExpressionEngineINonAggregateFunction
 {

Modified: sandbox/jng/common_decouple/Common/Stylization/ExpressionHelper.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ExpressionHelper.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ExpressionHelper.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,6 +20,7 @@
 
 #include "Stylization.h"
 #include "Renderer.h"
+#include "FdoStylizationCommon.h"
 
 class ExpressionHelper
 {

Copied: sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.cpp (from rev 7749, sandbox/jng/stylization_refactor/Common/Stylization/FdoEvaluator.cpp)
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.cpp	                        (rev 0)
+++ sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -0,0 +1,449 @@
+//
+//  Copyright (C) 2007-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "Stylization.h"
+#include "RendererStyles.h"
+#include "FdoEvaluator.h"
+#include "ExpressionHelper.h"
+
+// Non-fatal stylizer exception logging mechanism.
+StylizerExceptionCallback FdoEvaluator::sm_stylizerExceptionCallback = NULL;
+
+FdoEvaluator::FdoEvaluator(Renderer* renderer, RS_FeatureReader* reader)
+{
+    m_exec = ExpressionHelper::GetExpressionEngine(renderer, reader);
+}
+
+FdoEvaluator::~FdoEvaluator()
+{
+    // 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();
+
+    m_exec = NULL;
+}
+
+bool FdoEvaluator::EvalInt32(const MdfModel::MdfString& exprstr, int& res, bool bSuppressErrors)
+{
+    // darn, it must be an expression, so evaluate it
+    if (!m_exec)
+    {
+        // hmmm... we can't eval as expression, what to do?
+        _ASSERT(false);
+        return false;
+    }
+
+    FdoExpression* expr = ObtainFdoExpression(&exprstr);
+    // make sure we have a parsed expression
+    if (!expr)
+    {
+        _ASSERT(false);
+        return false;
+    }
+
+    try
+    {
+        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
+        res = ExpressionHelper::GetAsInt32(lval.p);
+        return true;
+    }
+    catch (FdoException* e)
+    {
+        if (bSuppressErrors)
+            e->Release();
+        else
+            ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.EvalInt32");
+    }
+    catch (...)
+    {
+    }
+
+    return false;
+}
+
+bool FdoEvaluator::EvalBoolean(const MdfModel::MdfString& exprstr, bool& res, bool bSuppressErrors)
+{
+    // check for boolean constants first...
+    const wchar_t* sb = exprstr.c_str();
+
+    if (_wcsnicmp(sb, L"true", 5) == 0)
+    {
+        // value was constant, return true
+        res = true;
+        return true;
+    }
+
+    if (_wcsnicmp(sb, L"false", 6) == 0)
+    {
+        // value was constant, return true
+        res = false;
+        return true;
+    }
+
+    // darn, it must be an expression, so evaluate it
+    if (!m_exec)
+    {
+        // hmmm... we can't eval as expression, what to do?
+        _ASSERT(false);
+        return false;
+    }
+
+    FdoExpression* expr = ObtainFdoExpression(&exprstr);
+
+    // make sure we have a parsed expression
+    if (!expr)
+    {
+        _ASSERT(false);
+        return false;
+    }
+
+    // and then hope evaluation succeeds
+    try
+    {
+        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
+        res = ExpressionHelper::GetAsBoolean(lval.p);
+    }
+    catch (FdoException* e)
+    {
+        if (bSuppressErrors)
+            e->Release();
+        else
+            ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.EvalBoolean");
+    }
+    catch (...)
+    {
+    }
+
+    // value was expression, so not cacheable
+    return false;
+}
+
+bool FdoEvaluator::EvalDouble(const MdfModel::MdfString& exprstr, double& res, bool bSuppressErrors)
+{
+    // TODO: needs an expression processor argument to eval expressions
+
+    const wchar_t* sd = exprstr.c_str();
+
+    double d = 0.0;
+
+    // We will look if there is any other stuff behind any numeric data in
+    // order to detect if we are dealing with just a number or an expression.
+    // For example "100 + stuff" would successfully parse a number, yet it
+    // is not just a number.
+    wchar_t* tmp = (wchar_t*)alloca((wcslen(sd)+1)*sizeof(wchar_t));
+    *tmp = L'\0';
+    int status = swscanf(sd, L"%lf%s", &d, tmp);
+
+    if (status == 1 || (status && !wcslen(tmp)))
+    {
+        // value is constant
+        res = d;
+        return true;
+    }
+
+    // try to evaluate as expression if it was not constant
+    if (!m_exec)
+    {
+        // hmmm... we can't eval as expression, what to do?
+        _ASSERT(false);
+        return false;
+    }
+
+    FdoExpression* expr = ObtainFdoExpression(&exprstr);
+
+    // make sure we have a parsed expression
+    if (!expr)
+    {
+        _ASSERT(false);
+        return false;
+    }
+
+    // and then hope evaluation succeeds
+    try
+    {
+        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
+        res = ExpressionHelper::GetAsDouble(lval.p);
+    }
+    catch (FdoException* e)
+    {
+        if (bSuppressErrors)
+            e->Release();
+        else
+            ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.EvalDouble");
+    }
+    catch (...)
+    {
+    }
+
+    // if we are here, the value was not constant so it is not cacheable
+    return false;
+}
+
+bool FdoEvaluator::EvalString(const MdfModel::MdfString& exprstr, RS_String& res, bool bSuppressErrors)
+{
+    if (!m_exec)
+    {
+        // no execution engine... spit the string back out
+        _ASSERT(false);
+        res = exprstr;
+        return false;
+    }
+
+    // TODO: need a scheme to check if a string is a constant expression
+    //       so that we can cache it instead of evaluating every time
+    FdoExpression* expr = ObtainFdoExpression(&exprstr);
+
+    if (!expr)
+    {
+        // this should not happen...
+        res = exprstr;
+        return false;
+    }
+
+    // try-catch the expression evaluation - I think we want
+    // a silent failure here...
+    try
+    {
+        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
+        const wchar_t* str = ExpressionHelper::GetAsString(lval.p);
+        res = str? str : L"";
+    }
+    catch (FdoException* e)
+    {
+        if (bSuppressErrors)
+            e->Release();
+        else
+            ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.EvalString");
+    }
+    catch (...)
+    {
+    }
+
+    // not cacheable
+    return false;
+}
+
+bool FdoEvaluator::EvalColor(const MdfModel::MdfString& exprstr, RS_Color& rscolor, bool bSuppressErrors)
+{
+    // TODO: needs an expression processor argument to eval expressions
+
+    // string is in the form "AARRGGBB"
+    const wchar_t* scolor = exprstr.c_str();
+
+    size_t len = wcslen(scolor);
+    unsigned int color = 0;
+    bool isConst = false;
+
+    // try to check if the expression is constant
+    int status = 0;
+    if (len == 0)
+    {
+        // error or a color was not set
+        // use transparent black which indicates "not set"
+        rscolor = RS_Color(RS_Color::EMPTY_COLOR_RGBA);
+        return true;
+    }
+    else if (len == 8)
+    {
+        status = swscanf(scolor, L"%8X", &color);
+    }
+    else if (len == 6)
+    {
+        status = swscanf(scolor, L"%6X", &color);
+
+        // there was no alpha specified in the constant string, add it
+        color |= 0xFF000000;
+    }
+
+    if (status != 1)
+    {
+        // if not constant try to evaluate as expression
+        if (!m_exec)
+        {
+            _ASSERT(false);
+            rscolor = RS_Color(0x000000FF);
+            return true;
+        }
+
+        FdoExpression* expr = ObtainFdoExpression(&exprstr);
+
+        // make sure we have a parsed expression
+        if (!expr)
+        {
+            _ASSERT(false);
+            rscolor = RS_Color(0x000000FF);
+            return false;
+        }
+
+        try
+        {
+            FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
+            color = (unsigned int)ExpressionHelper::GetAsInt32(lval.p);
+        }
+        catch (FdoException* e)
+        {
+            if (bSuppressErrors)
+                e->Release();
+            else
+                ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.EvalColor");
+            rscolor = RS_Color(0x000000FF);
+            return false;
+        }
+        catch (...)
+        {
+            return false;
+        }
+    }
+    else
+    {
+        isConst = true;
+    }
+
+    rscolor.alpha() =  color >> 24;
+    rscolor.red()   = (color >> 16) & 0xFF;
+    rscolor.green() = (color >>  8) & 0xFF;
+    rscolor.blue()  =  color        & 0xFF;
+
+    return isConst;
+}
+
+bool FdoEvaluator::ExecFilter(const MdfModel::MdfString* pExprstr, bool bSuppressErrors)
+{
+    // TODO: we use pointers 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
+
+    // empty expression - no filter
+    // pass trivially
+    if (pExprstr->empty())
+        return true;
+
+    // get from cache
+    FdoFilter* filter = m_hFilterCache[pExprstr];
+
+    // if in cache, return existing
+    // NOTE: do not addref, it is not needed
+    if (!filter)
+    {
+        try
+        {
+            // otherwise parse and cache it
+            filter = FdoFilter::Parse(pExprstr->c_str());
+            m_hFilterCache[pExprstr] = filter;
+        }
+        catch (FdoException* e)
+        {
+            if (bSuppressErrors)
+                e->Release();
+            else
+                ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.ExecFilter");
+            filter = NULL;
+        }
+    }
+
+    // no filter means pass in this case
+    if (!filter)
+        return true;
+
+    // m_exec should be set in the Stylize call
+    // of the inheriting geometry adapter
+    _ASSERT(m_exec);
+
+    bool res = false;
+    try
+    {
+        res = m_exec->ProcessFilter(filter);
+    }
+    catch (FdoException* e)
+    {
+        if (bSuppressErrors)
+            e->Release();
+        else
+            ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.ExecFilter");
+    }
+
+    return res;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// parses and caches an FDO filter from a pointer to an MDF string.
+// Once cached, the filter will be reused next time the same expression
+// is asked for.
+FdoExpression* FdoEvaluator::ObtainFdoExpression(const MdfModel::MdfString* pExprstr)
+{
+    // TODO: we use pointers 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
+
+    // empty expression - no filter
+    if (pExprstr->empty())
+        return NULL;
+
+    // get from cache
+    FdoExpression* expr = m_hExpressionCache[pExprstr];
+
+    // if in cache, return existing
+    // NOTE: do not addref, it is not needed
+    if (expr)
+        return expr;
+
+    try
+    {
+        // otherwise parse and cache it
+        expr = FdoExpression::Parse(pExprstr->c_str());
+        m_hExpressionCache[pExprstr] = expr;
+    }
+    catch (FdoException* e)
+    {
+        ProcessStylizerException(e, __LINE__, __WFILE__, L"FdoEvaluator.ObtainFdoExpression");
+        expr = NULL;
+    }
+
+    return expr;
+}
+
+void FdoEvaluator::SetStylizerExceptionCallback(StylizerExceptionCallback callbackFunction)
+{
+    sm_stylizerExceptionCallback = callbackFunction;
+}
+
+void FdoEvaluator::ProcessStylizerException(FdoException* exception, int line, wchar_t* file, wchar_t* methodName)
+{
+    if (NULL != sm_stylizerExceptionCallback)
+    {
+        (*sm_stylizerExceptionCallback)(exception, line, file, methodName);
+    }
+    exception->Release();
+}
\ No newline at end of file

Copied: sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.h (from rev 7749, sandbox/jng/stylization_refactor/Common/Stylization/FdoEvaluator.h)
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.h	                        (rev 0)
+++ sandbox/jng/common_decouple/Common/Stylization/FdoEvaluator.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -0,0 +1,83 @@
+//
+//  Copyright (C) 2007-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef FDO_EVALUATOR_H_
+#define FDO_EVALUATOR_H_
+
+#include "Stylization.h"
+#include "RendererStyles.h"
+#include "SE_Evaluator.h"
+#include "Renderer.h"
+#include <map>
+
+#include "FdoStylizationCommon.h"
+
+typedef void (*StylizerExceptionCallback)(FdoException* exception, int line, wchar_t* file, wchar_t* methodName);
+
+//-------------------------------------------------------------
+// Provides services for evaluating FDO expressions and filters
+//-------------------------------------------------------------
+
+class FdoEvaluator : public SE_Evaluator
+{
+public:
+    FdoEvaluator(Renderer* renderer, RS_FeatureReader* reader);
+    virtual ~FdoEvaluator();
+
+    STYLIZATION_API virtual bool EvalInt32(const MdfModel::MdfString& exprstr, int& res, bool bSuppressErrors);
+    STYLIZATION_API virtual bool EvalBoolean(const MdfModel::MdfString& exprstr, bool& res, bool bSuppressErrors);
+    STYLIZATION_API virtual bool EvalDouble(const MdfModel::MdfString& exprstr, double& res, bool bSuppressErrors);
+    STYLIZATION_API virtual bool EvalString(const MdfModel::MdfString& exprstr, RS_String& res, bool bSuppressErrors);
+    STYLIZATION_API virtual bool EvalColor(const MdfModel::MdfString& exprstr, RS_Color& color, bool bSuppressErrors);
+    STYLIZATION_API virtual bool ExecFilter(const MdfModel::MdfString* pExprstr, bool bSuppressErrors);
+
+    //Non-fatal FDO exception logging mechanism
+    STYLIZATION_API static void ProcessStylizerException(FdoException* exception, int line, wchar_t* file, wchar_t* methodName);
+    STYLIZATION_API static void SetStylizerExceptionCallback(StylizerExceptionCallback callbackFunction);
+private:
+    FdoExpression* ObtainFdoExpression(const MdfModel::MdfString* pExprstr);
+
+    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
+    std::map<const void*, FdoExpression*> m_hExpressionCache;
+
+    static StylizerExceptionCallback sm_stylizerExceptionCallback;
+};
+
+#define STYLIZATION_TRY() \
+    try \
+    {
+
+#define STYLIZATION_CATCH(methodName) \
+    } \
+    catch (FdoException* e) \
+    { \
+        FdoEvaluator::ProcessStylizerException(e, __LINE__, __WFILE__, methodName); \
+    } \
+    catch (...) \
+    { }
+
+#endif
\ No newline at end of file

Copied: sandbox/jng/common_decouple/Common/Stylization/FdoStylizationCommon.h (from rev 7749, sandbox/jng/stylization_refactor/Common/Stylization/FdoStylizationCommon.h)
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/FdoStylizationCommon.h	                        (rev 0)
+++ sandbox/jng/common_decouple/Common/Stylization/FdoStylizationCommon.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -0,0 +1,30 @@
+//
+//  Copyright (C) 2007-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef FDO_STYLIZATION_COMMON_H_
+#define FDO_STYLIZATION_COMMON_H_
+
+// Common FDO headers
+#pragma warning(push)
+#pragma warning(disable: 4201)
+#include "Fdo.h"
+#include "FdoExpressionEngine.h"
+#include "FdoExpressionEngineFunctionCollection.h"
+#include "FdoExpressionEngineINonAggregateFunction.h"
+#pragma warning(pop)
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,15 +20,12 @@
 #include "GeometryAdapter.h"
 #include "SymbolVisitor.h"
 #include "SLDSymbols.h"
-#include "ExpressionHelper.h"
+#include "SE_Evaluator.h"
 
-
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
 //////////////////////////////////////////////////////////////////////////////
 GeometryAdapter::GeometryAdapter(LineBufferPool* lbp)
 {
-    m_exec = NULL;
+    m_eval = NULL;
     m_lbPool = lbp;
 }
 
@@ -36,25 +33,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();
+    
 }
 
 
@@ -79,7 +58,7 @@
     }
 
     // darn, it must be an expression, so evaluate it
-    if (!m_exec)
+    if (!m_eval)
     {
         // hmmm... we can't eval as expression, what to do?
         _ASSERT(false);
@@ -86,31 +65,8 @@
         return false;
     }
 
-    FdoExpression* expr = ObtainFdoExpression(&exprstr);
-
-    // make sure we have a parsed expression
-    if (!expr)
-    {
-        _ASSERT(false);
-        return false;
-    }
-
     // and then hope evaluation succeeds
-    try
-    {
-        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
-        res = ExpressionHelper::GetAsBoolean(lval.p);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-    catch (...)
-    {
-    }
-
-    // value was expression, so not cacheable
-    return false;
+    return m_eval->EvalBoolean(exprstr, res);
 }
 
 
@@ -139,7 +95,7 @@
     }
 
     // try to evaluate as expression if it was not constant
-    if (!m_exec)
+    if (!m_eval)
     {
         // hmmm... we can't eval as expression, what to do?
         _ASSERT(false);
@@ -146,31 +102,8 @@
         return false;
     }
 
-    FdoExpression* expr = ObtainFdoExpression(&exprstr);
-
-    // make sure we have a parsed expression
-    if (!expr)
-    {
-        _ASSERT(false);
-        return false;
-    }
-
     // and then hope evaluation succeeds
-    try
-    {
-        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
-        res = ExpressionHelper::GetAsDouble(lval.p);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-    catch (...)
-    {
-    }
-
-    // if we are here, the value was not constant so it is not cacheable
-    return false;
+    return m_eval->EvalDouble(exprstr, res);
 }
 
 
@@ -177,7 +110,7 @@
 //////////////////////////////////////////////////////////////////////////////
 bool GeometryAdapter::EvalString(const MdfModel::MdfString& exprstr, RS_String& res)
 {
-    if (!m_exec)
+    if (!m_eval)
     {
         // no execution engine... spit the string back out
         _ASSERT(false);
@@ -187,33 +120,7 @@
 
     // TODO: need a scheme to check if a string is a constant expression
     //       so that we can cache it instead of evaluating every time
-    FdoExpression* expr = ObtainFdoExpression(&exprstr);
-
-    if (!expr)
-    {
-        // this should not happen...
-        res = exprstr;
-        return false;
-    }
-
-    // try-catch the expression evaluation - I think we want
-    // a silent failure here...
-    try
-    {
-        FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
-        const wchar_t* str = ExpressionHelper::GetAsString(lval.p);
-        res = str? str : L"";
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-    catch (...)
-    {
-    }
-
-    // not cacheable
-    return false;
+    return m_eval->EvalString(exprstr, res);
 }
 
 
@@ -253,7 +160,7 @@
     if (status != 1)
     {
         // if not constant try to evaluate as expression
-        if (!m_exec)
+        if (!m_eval)
         {
             _ASSERT(false);
             rscolor = RS_Color(0x000000FF);
@@ -260,31 +167,7 @@
             return true;
         }
 
-        FdoExpression* expr = ObtainFdoExpression(&exprstr);
-
-        // make sure we have a parsed expression
-        if (!expr)
-        {
-            _ASSERT(false);
-            rscolor = RS_Color(0x000000FF);
-            return false;
-        }
-
-        try
-        {
-            FdoPtr<FdoLiteralValue> lval = m_exec->Evaluate(expr);
-            color = (unsigned int)ExpressionHelper::GetAsInt32(lval.p);
-        }
-        catch (FdoException* e)
-        {
-            ProcessStylizerException(e, __LINE__, __WFILE__);
-            rscolor = RS_Color(0x000000FF);
-            return false;
-        }
-        catch (...)
-        {
-            return false;
-        }
+        return m_eval->EvalColor(exprstr, rscolor);
     }
     else
     {
@@ -679,7 +562,7 @@
 void GeometryAdapter::Stylize(Renderer*                   /*renderer*/,
                               RS_FeatureReader*           /*features*/,
                               bool                        /*initialPass*/,
-                              FdoExpressionEngine*        /*exec*/,
+                              SE_Evaluator*               /*eval*/,
                               LineBuffer*                 /*lb*/,
                               MdfModel::FeatureTypeStyle* /*style*/,
                               const MdfModel::MdfString*  /*tooltip*/,
@@ -721,7 +604,7 @@
 // Parses and caches an FDO filter from a pointer to an MDF string.
 // Once cached, the filter will be reused next time the same expression
 // is asked for.  Also executes the filter and returns failure or success.
-bool GeometryAdapter::ExecFdoFilter(const MdfModel::MdfString* pExprstr)
+bool GeometryAdapter::ExecFilter(const MdfModel::MdfString* pExprstr)
 {
     // TODO: we use pointers to the MDF strings for caching -
     //       this may be risky but all caching in the stylizer is
@@ -733,88 +616,14 @@
     if (pExprstr->empty())
         return true;
 
-    // get from cache
-    FdoFilter* filter = m_hFilterCache[pExprstr];
-
-    // if in cache, return existing
-    // NOTE: do not addref, it is not needed
-    if (!filter)
-    {
-        try
-        {
-            // otherwise parse and cache it
-            filter = FdoFilter::Parse(pExprstr->c_str());
-            m_hFilterCache[pExprstr] = filter;
-        }
-        catch (FdoException* e)
-        {
-            ProcessStylizerException(e, __LINE__, __WFILE__);
-            filter = NULL;
-        }
-    }
-
-    // no filter means pass in this case
-    if (!filter)
-        return true;
-
     // m_exec should be set in the Stylize call
     // of the inheriting geometry adapter
-    _ASSERT(m_exec);
+    _ASSERT(m_eval);
 
-    bool res = false;
-    try
-    {
-        res = m_exec->ProcessFilter(filter);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-
-    return res;
+    return m_eval->ExecFilter(pExprstr);
 }
 
-
 //////////////////////////////////////////////////////////////////////////////
-// parses and caches an FDO filter from a pointer to an MDF string.
-// Once cached, the filter will be reused next time the same expression
-// is asked for.
-FdoExpression* GeometryAdapter::ObtainFdoExpression(const MdfModel::MdfString* pExprstr)
-{
-    // TODO: we use pointers 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
-
-    // empty expression - no filter
-    if (pExprstr->empty())
-        return NULL;
-
-    // get from cache
-    FdoExpression* expr = m_hExpressionCache[pExprstr];
-
-    // if in cache, return existing
-    // NOTE: do not addref, it is not needed
-    if (expr)
-        return expr;
-
-    try
-    {
-        // otherwise parse and cache it
-        expr = FdoExpression::Parse(pExprstr->c_str());
-        m_hExpressionCache[pExprstr] = expr;
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-        expr = NULL;
-    }
-
-    return expr;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
 bool GeometryAdapter::GetElevationParams(RS_ElevationSettings* elevSettings,
                                          double& zOffset, double& zExtrusion,
                                          RS_ElevationType& elevType)

Modified: sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/GeometryAdapter.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -24,6 +24,7 @@
 
 class LineBuffer;
 class LineBufferPool;
+class SE_Evaluator;
 
 //-----------------------------------------------------------------------------
 // Base class for helper classes which know how to stylize a particular
@@ -60,7 +61,7 @@
     STYLIZATION_API virtual void Stylize(Renderer*                   renderer,
                                          RS_FeatureReader*           features,
                                          bool                        initialPass,
-                                         FdoExpressionEngine*        exec,
+                                         SE_Evaluator*               eval,
                                          LineBuffer*                 lb,
                                          MdfModel::FeatureTypeStyle* style,
                                          const MdfModel::MdfString*  tooltip = NULL,
@@ -78,8 +79,7 @@
                                           Renderer*        renderer,
                                           LineBuffer*      lb);
 
-    STYLIZATION_API bool ExecFdoFilter(const MdfModel::MdfString* pExprstr);
-    STYLIZATION_API FdoExpression* ObtainFdoExpression(const MdfModel::MdfString* pExprstr);
+    STYLIZATION_API bool ExecFilter(const MdfModel::MdfString* pExprstr);
 
 protected:
     STYLIZATION_API bool GetElevationParams(RS_ElevationSettings* elevationSettings,
@@ -88,20 +88,8 @@
 
     double GetClipOffset(RS_LineStroke& lineStroke, double mapScale);
 
-    FdoExpressionEngine* m_exec;
+    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/common_decouple/Common/Stylization/GridData.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/GridData.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/GridData.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -21,6 +21,7 @@
 #include "MdfModel.h"
 #include "Band.h"
 #include "HillShade.h"
+#include "FdoStylizationCommon.h"
 
 ///<summary>
 /// This class keep a set of Band.

Modified: sandbox/jng/common_decouple/Common/Stylization/KeyEncode.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/KeyEncode.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/KeyEncode.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,6 +20,7 @@
 
 #include "Stylization.h"
 #include "RS_BufferOutputStream.h"
+#include "FdoStylizationCommon.h"
 
 //forward declare
 class RS_FeatureReader;

Modified: sandbox/jng/common_decouple/Common/Stylization/LabelRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/LabelRenderer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/LabelRenderer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -18,12 +18,10 @@
 #include "stdafx.h"
 #include "LabelRenderer.h"
 #include "SE_Renderer.h"
+#include "FdoEvaluator.h"
 
 //#define DEBUG_LABELS
 
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
-
 //////////////////////////////////////////////////////////////////////////////
 LabelRenderer::LabelRenderer(SE_Renderer* se_renderer)
 : LabelRendererBase(se_renderer)
@@ -89,11 +87,11 @@
                                       double           scaleLimit)
 {
     // get the geometry type
-    int geomType = (path != NULL)? path->geom_type() : FdoGeometryType_None;
+    int geomType = (path != NULL)? path->geom_type() : GeometryType_None;
 
     // in the case of linear geometry we'll label along the path, so prepare
     // for that (transform to screen space, group into stitch groups)
-    if (geomType == FdoGeometryType_LineString || geomType == FdoGeometryType_MultiLineString)
+    if (geomType == GeometryType_LineString || geomType == GeometryType_MultiLineString)
     {
         BeginOverpostGroup(type, true, exclude);
 
@@ -230,8 +228,8 @@
 //////////////////////////////////////////////////////////////////////////////
 void LabelRenderer::BlastLabels()
 {
-    try
-    {
+    STYLIZATION_TRY()
+
         //-------------------------------------------------------
         // step 1 - perform stitching
         //-------------------------------------------------------
@@ -293,14 +291,8 @@
         //-------------------------------------------------------
 
         Cleanup();
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-    catch (...)
-    {
-    }
+    
+    STYLIZATION_CATCH(L"LabelRenderer.BlastLabels")
 }
 
 

Modified: sandbox/jng/common_decouple/Common/Stylization/LabelRendererLocal.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/LabelRendererLocal.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/LabelRendererLocal.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -18,12 +18,10 @@
 #include "stdafx.h"
 #include "LabelRendererLocal.h"
 #include "SE_Renderer.h"
+#include "FdoEvaluator.h"
 
 //#define DEBUG_LABELS
 
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
-
 //////////////////////////////////////////////////////////////////////////////
 LabelRendererLocal::LabelRendererLocal(SE_Renderer* se_renderer, double tileExtentOffset)
 : LabelRendererBase(se_renderer)
@@ -95,11 +93,11 @@
     BeginOverpostGroup(type, true, exclude);
 
     // get the geometry type
-    int geomType = (path != NULL)? path->geom_type() : FdoGeometryType_None;
+    int geomType = (path != NULL)? path->geom_type() : GeometryType_None;
 
     // in the case of linear geometry we'll label along the path, so prepare
     // for that (transform to screen space, group into stitch groups)
-    if (geomType == FdoGeometryType_LineString || geomType == FdoGeometryType_MultiLineString)
+    if (geomType == GeometryType_LineString || geomType == GeometryType_MultiLineString)
     {
         // indicate that the current group will be labeled along the path
         m_labelGroups.back().m_algo = laCurve;
@@ -177,7 +175,7 @@
             offset += lblpathpts;
         }
     }
-    else if (geomType == FdoGeometryType_Polygon || geomType == FdoGeometryType_MultiPolygon)
+    else if (geomType == GeometryType_Polygon || geomType == GeometryType_MultiPolygon)
     {
         // we only expect one label info per polygon to be passed in from stylization
         _ASSERT(nlabels == 1);
@@ -379,8 +377,7 @@
 //////////////////////////////////////////////////////////////////////////////
 void LabelRendererLocal::BlastLabels()
 {
-    try
-    {
+    STYLIZATION_TRY()
         //-------------------------------------------------------
         // step 1 - perform stitching
         //-------------------------------------------------------
@@ -825,14 +822,8 @@
         finalGroups.clear();
         m_hStitchTable.clear();
         m_overpost.Clear();
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-    catch (...)
-    {
-    }
+    
+    STYLIZATION_CATCH(L"LabelRendererLocal.BlastLabels")
 }
 
 

Modified: sandbox/jng/common_decouple/Common/Stylization/LineBuffer.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/LineBuffer.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/LineBuffer.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -18,6 +18,7 @@
 #ifndef LINEBUFFER_H_
 #define LINEBUFFER_H_
 
+#include "Stylization.h"
 #include "StylizationAPI.h"
 #include "StylizationDefs.h"
 #include "Bounds.h"
@@ -86,43 +87,6 @@
         ctAGF   = 4
     };
 
-    //Matches the FGF enumeration FdoDimensionality
-    enum Dimensionality
-    {
-        /// X and Y dimensions are present.
-        Dimensionality_XY = 0,
-        /// Z dimension is present.
-        Dimensionality_Z  = 1,
-        /// M ('measure') dimension is present.
-        Dimensionality_M  = 2
-    };
-
-    //Matches the FGF enumeration FdoGeometryType
-    enum GeometryType
-    {
-        GeometryType_None = 0,
-        GeometryType_Point = 1,
-        GeometryType_LineString = 2,
-        GeometryType_Polygon = 3,
-        GeometryType_MultiPoint = 4,
-        GeometryType_MultiLineString = 5,
-        GeometryType_MultiPolygon = 6,
-        GeometryType_MultiGeometry = 7,
-        GeometryType_CurveString = 10,
-        GeometryType_CurvePolygon = 11,
-        GeometryType_MultiCurveString = 12,
-        GeometryType_MultiCurvePolygon = 13
-    };
-
-    //Matches FdoGeometryComponentType
-    enum GeometryComponentType
-    {
-        GeometryComponentType_LinearRing = 129,
-        GeometryComponentType_CircularArcSegment = 130,
-        GeometryComponentType_LineStringSegment = 131,
-        GeometryComponentType_Ring = 132
-    };
-
     STYLIZATION_API LineBuffer(int size, int dimensionality = Dimensionality_XY, bool bIgnoreZ = true);
     STYLIZATION_API virtual ~LineBuffer();
 
@@ -300,7 +264,7 @@
     STYLIZATION_API LineBufferPool();
     STYLIZATION_API virtual ~LineBufferPool();
 
-    STYLIZATION_API static LineBuffer* NewLineBuffer(LineBufferPool* pool, int requestSize, int dimensionality = LineBuffer::Dimensionality_XY, bool bIgnoreZ = true);
+    STYLIZATION_API static LineBuffer* NewLineBuffer(LineBufferPool* pool, int requestSize, int dimensionality = Dimensionality_XY, bool bIgnoreZ = true);
     STYLIZATION_API static void FreeLineBuffer(LineBufferPool* pool, LineBuffer* lb);
 
 private:

Modified: sandbox/jng/common_decouple/Common/Stylization/PointAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/PointAdapter.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/PointAdapter.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -46,7 +46,7 @@
 void PointAdapter::Stylize(Renderer*                   renderer,
                            RS_FeatureReader*           features,
                            bool                        initialPass,
-                           FdoExpressionEngine*        exec,
+                           SE_Evaluator*               eval,
                            LineBuffer*                 geometry,
                            MdfModel::FeatureTypeStyle* style,
                            const MdfModel::MdfString*  tooltip,
@@ -54,7 +54,7 @@
                            RS_ElevationSettings*       elevSettings,
                            CSysTransformer*            /*layer2mapxformer*/)
 {
-    m_exec = exec;
+    m_eval = eval;
 
     // no need to do anything if the style is not a point style, so quit
     if (FeatureTypeStyleVisitor::DetermineFeatureTypeStyle(style) != FeatureTypeStyleVisitor::ftsPoint)
@@ -72,7 +72,7 @@
         rule = static_cast<MdfModel::PointRule*>(prc->GetAt(i));
 
         // apply any filter on the rule - if it fails move to the next rule
-        if (!ExecFdoFilter(&rule->GetFilter()))
+        if (!ExecFilter(&rule->GetFilter()))
         {
             // don't stylize with failed rule
             rule = NULL;

Modified: sandbox/jng/common_decouple/Common/Stylization/PointAdapter.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/PointAdapter.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/PointAdapter.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -29,7 +29,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_Evaluator*               eval,
                          LineBuffer*                 geometry,
                          MdfModel::FeatureTypeStyle* style,
                          const MdfModel::MdfString*  tooltip = NULL,

Modified: sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -46,7 +46,7 @@
 void PolygonAdapter::Stylize(Renderer*                   renderer,
                              RS_FeatureReader*           features,
                              bool                        initialPass,
-                             FdoExpressionEngine*        exec,
+                             SE_Evaluator*               eval,
                              LineBuffer*                 geometry,
                              MdfModel::FeatureTypeStyle* style,
                              const MdfModel::MdfString*  tooltip,
@@ -54,7 +54,7 @@
                              RS_ElevationSettings*       elevSettings,
                              CSysTransformer*            /*layer2mapxformer*/)
 {
-    m_exec = exec;
+    m_eval = eval;
 
     // no need to do anything if the style is not an area style, so quit
     if (FeatureTypeStyleVisitor::DetermineFeatureTypeStyle(style) != FeatureTypeStyleVisitor::ftsArea)
@@ -72,7 +72,7 @@
         rule = static_cast<MdfModel::AreaRule*>(arc->GetAt(i));
 
         // apply any filter on the rule - if it fails move to the next rule
-        if (!ExecFdoFilter(&rule->GetFilter()))
+        if (!ExecFilter(&rule->GetFilter()))
         {
             // don't stylize with failed rule
             rule = NULL;

Modified: sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/PolygonAdapter.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -29,7 +29,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_Evaluator*               eval,
                          LineBuffer*                 geometry,
                          MdfModel::FeatureTypeStyle* style,
                          const MdfModel::MdfString*  tooltip = NULL,

Modified: sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -54,7 +54,7 @@
 void PolylineAdapter::Stylize(Renderer*                   renderer,
                               RS_FeatureReader*           features,
                               bool                        initialPass,
-                              FdoExpressionEngine*        exec,
+                              SE_Evaluator*               eval,
                               LineBuffer*                 geometry,
                               MdfModel::FeatureTypeStyle* style,
                               const MdfModel::MdfString*  tooltip,
@@ -62,7 +62,7 @@
                               RS_ElevationSettings*       elevSettings,
                               CSysTransformer*            /*layer2mapxformer*/)
 {
-    m_exec = exec;
+    m_eval = eval;
 
     // no need to do anything if the style is not a line style, so quit
     if (FeatureTypeStyleVisitor::DetermineFeatureTypeStyle(style) != FeatureTypeStyleVisitor::ftsLine)
@@ -80,7 +80,7 @@
         rule = static_cast<MdfModel::LineRule*>(lrc->GetAt(i));
 
         // apply any filter on the rule - if it fails move to the next rule
-        if (!ExecFdoFilter(&rule->GetFilter()))
+        if (!ExecFilter(&rule->GetFilter()))
         {
             // don't stylize with failed rule
             rule = NULL;

Modified: sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/PolylineAdapter.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -29,7 +29,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_Evaluator*               eval,
                          LineBuffer*                 geometry,
                          MdfModel::FeatureTypeStyle* style,
                          const MdfModel::MdfString*  tooltip = NULL,

Modified: sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -42,7 +42,7 @@
 void RasterAdapter::Stylize(Renderer*                   renderer,
                             RS_FeatureReader*           features,
                             bool                        initialPass,
-                            FdoExpressionEngine*        exec,
+                            SE_Evaluator*               eval,
                             RS_Raster*                  raster,
                             MdfModel::GridColorStyle*   style,
                             MdfModel::GridSurfaceStyle* surfStyle,
@@ -55,7 +55,7 @@
     //printf("\n---===+++ Enter RasterAdapter::Stylize(() +++===---\n");
 #endif
 
-    m_exec = exec;
+    m_eval = eval;
 
     // get the map data extent
     // this is in map cs

Modified: sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/RasterAdapter.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -32,7 +32,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_Evaluator*               eval,
                          RS_Raster*                  raster,
                          MdfModel::GridColorStyle*   style,
                          MdfModel::GridSurfaceStyle* surfStyle = NULL,

Copied: sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.cpp (from rev 7749, sandbox/jng/stylization_refactor/Common/Stylization/SE_Evaluator.cpp)
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.cpp	                        (rev 0)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -0,0 +1,19 @@
+//
+//  Copyright (C) 2007-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "SE_Evaluator.h"
\ No newline at end of file

Copied: sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.h (from rev 7749, sandbox/jng/stylization_refactor/Common/Stylization/SE_Evaluator.h)
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.h	                        (rev 0)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_Evaluator.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -0,0 +1,39 @@
+//
+//  Copyright (C) 2007-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef SE_EXPRESSIONEVALUATOR_H_
+#define SE_EXPRESSIONEVALUATOR_H_
+
+#include "Stylization.h"
+#include "RendererStyles.h"
+
+//----------------------------------------------------------
+// Provides services for evaluating expressions and filters
+//----------------------------------------------------------
+
+class SE_Evaluator
+{
+public:
+    STYLIZATION_API virtual bool EvalInt32(const MdfModel::MdfString& exprstr, int& res, bool bSuppressErrors = false) = 0;
+    STYLIZATION_API virtual bool EvalBoolean(const MdfModel::MdfString& exprstr, bool& res, bool bSuppressErrors = false) = 0;
+    STYLIZATION_API virtual bool EvalDouble(const MdfModel::MdfString& exprstr, double& res, bool bSuppressErrors = false) = 0;
+    STYLIZATION_API virtual bool EvalString(const MdfModel::MdfString& exprstr, RS_String& res, bool bSuppressErrors = false) = 0;
+    STYLIZATION_API virtual bool EvalColor(const MdfModel::MdfString& exprstr, RS_Color& color, bool bSuppressErrors = false) = 0;
+    STYLIZATION_API virtual bool ExecFilter(const MdfModel::MdfString* pExprstr, bool bSuppressErrors = false) = 0;
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -23,8 +23,6 @@
 
 using namespace MDFMODEL_NAMESPACE;
 
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
 void SE_ExpressionBase::SetParameterValues(OverrideCollection* overrides)
 {
     m_parameters.clear();
@@ -134,7 +132,6 @@
 void SE_ExpressionBase::ParseColorExpression(const MdfModel::MdfString& exprstr, SE_Color& val, unsigned int defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
     val.defValue.argb = defaultValue;
 
     // process any parameters in the expression
@@ -169,16 +166,7 @@
         return;
     }
 
-    // We have an expression - parse it using FDO.  If the parse
-    // call fails then the value stays at the default.
-    try
-    {
-        val.expression = FdoExpression::Parse(cstr);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
+    val.expression = cstr;
 }
 
 
@@ -185,7 +173,6 @@
 void SE_ExpressionBase::ParseDoubleExpression(const MdfModel::MdfString& exprstr, SE_Double& val, const double defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
     val.defValue = defaultValue;
 
     // process any parameters in the expression
@@ -220,16 +207,7 @@
         return;
     }
 
-    // We have an expression - parse it using FDO.  If the parse
-    // call fails then the value stays at the default.
-    try
-    {
-        val.expression = FdoExpression::Parse(cstr);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
+    val.expression = cstr;
 }
 
 
@@ -236,7 +214,6 @@
 void SE_ExpressionBase::ParseIntegerExpression(const MdfModel::MdfString& exprstr, SE_Integer& val, const int defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
     val.defValue = defaultValue;
 
     // process any parameters in the expression
@@ -271,16 +248,7 @@
         return;
     }
 
-    // We have an expression - parse it using FDO.  If the parse
-    // call fails then the value stays at the default.
-    try
-    {
-        val.expression = FdoExpression::Parse(cstr);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
+    val.expression = cstr;
 }
 
 
@@ -287,7 +255,6 @@
 void SE_ExpressionBase::ParseBooleanExpression(const MdfModel::MdfString& exprstr, SE_Boolean& val, const bool defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
     val.defValue = defaultValue;
 
     // process any parameters in the expression
@@ -322,16 +289,7 @@
         return;
     }
 
-    // We have an expression - parse it using FDO.  If the parse
-    // call fails then the value stays at the default.
-    try
-    {
-        val.expression = FdoExpression::Parse(cstr);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
+    val.expression = cstr;
 }
 
 
@@ -389,9 +347,6 @@
 
 void SE_ExpressionBase::ParseStringExpression(const MdfModel::MdfString& exprstr, SE_String& val, const wchar_t* defaultValue, const wchar_t* allowedValues)
 {
-    // set to default - we set the value later on
-    val.expression = NULL;
-
     // process any parameters in the expression
     const wchar_t* defValue = ReplaceParameters(exprstr);
     val.setDefValue(UnquoteLiteral(defValue? defValue : defaultValue));
@@ -424,14 +379,5 @@
         return;
     }
 
-    // We have an expression - parse it using FDO.  If the parse
-    // call fails then the value stays at the default.
-    try
-    {
-        val.expression = FdoExpression::Parse(str);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
+    val.expression = str;
 }

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_ExpressionBase.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -19,7 +19,7 @@
 #define SE_EXPRESSIONBASE_H_
 
 #include "Stylization.h"
-#include "ExpressionHelper.h"
+#include "SE_Evaluator.h"
 #include <map>
 #include <string>
 
@@ -56,26 +56,19 @@
         unsigned int argb;
     } value; //g++ doesn't like nameless structs, otherwise things would be far cleaner
 
-    FdoExpression* expression;
+    MdfModel::MdfString expression;
 
-    SE_INLINE SE_Color() : expression(NULL) { defValue.argb = 0; value.argb = 0; }
-    ~SE_Color() { if (expression) expression->Release(); }
+    SE_INLINE SE_Color() { defValue.argb = 0; value.argb = 0; }
+    ~SE_Color() { }
 
     // Retrieve argb color
-    SE_INLINE unsigned int evaluate(FdoExpressionEngine* exec)
+    SE_INLINE unsigned int evaluate(SE_Evaluator* eval)
     {
-        if (expression)
+        if (!expression.empty())
         {
-            value.argb = defValue.argb;
-            try
-            {
-                FdoPtr<FdoLiteralValue> lval = exec->Evaluate(expression);
-                value.argb = (unsigned int)ExpressionHelper::GetAsInt32(lval.p);
-            }
-            catch (FdoException* e)
-            {
-                e->Release();
-            }
+            RS_Color color = RS_Color::FromARGB(defValue.argb);
+            eval->EvalColor(expression, color);
+            value.argb = color.argb();
         }
 
         // return the value
@@ -84,7 +77,7 @@
 
     SE_INLINE bool empty()
     {
-        return defValue.argb == 0 && value.argb == 0 && expression == NULL;
+        return defValue.argb == 0 && value.argb == 0 && expression.empty();
     }
 
     SE_INLINE void operator=(SE_Color& c)
@@ -91,7 +84,7 @@
     {
         defValue.argb = c.defValue.argb;
         value.argb = c.value.argb;
-        expression = FDO_SAFE_ADDREF(c.expression);
+        expression = c.expression;
     }
 };
 
@@ -101,25 +94,18 @@
 {
     double defValue;
     double value;
-    FdoExpression* expression;
+    MdfModel::MdfString expression;
 
-    SE_INLINE SE_Double() : defValue(0.0), value(0.0), expression(NULL) { }
-    ~SE_Double() { if (expression) expression->Release(); }
+    SE_INLINE SE_Double() : defValue(0.0), value(0.0) { }
+    ~SE_Double() { }
 
-    SE_INLINE double evaluate(FdoExpressionEngine* exec)
+    SE_INLINE double evaluate(SE_Evaluator* eval)
     {
-        if (expression)
+        if (!expression.empty())
         {
-            value = defValue;
-            try
-            {
-                FdoPtr<FdoLiteralValue> lval = exec->Evaluate(expression);
-                value = ExpressionHelper::GetAsDouble(lval.p);
-            }
-            catch (FdoException* e)
-            {
-                e->Release();
-            }
+            double d = defValue;
+            eval->EvalDouble(expression, d);
+            value = d;
         }
 
         // return the value
@@ -130,7 +116,7 @@
     {
         defValue = d.defValue;
         value = d.value;
-        expression = FDO_SAFE_ADDREF(d.expression);
+        expression = d.expression;
     }
 };
 
@@ -140,25 +126,18 @@
 {
     int defValue;
     int value;
-    FdoExpression* expression;
+    MdfModel::MdfString expression;
 
-    SE_INLINE SE_Integer() : defValue(0), value(0), expression(NULL) { }
-    ~SE_Integer() { if (expression) expression->Release(); }
+    SE_INLINE SE_Integer() : defValue(0), value(0) { }
+    ~SE_Integer() { }
 
-    SE_INLINE int evaluate(FdoExpressionEngine* exec)
+    SE_INLINE int evaluate(SE_Evaluator* eval)
     {
-        if (expression)
+        if (!expression.empty())
         {
-            value = defValue;
-            try
-            {
-                FdoPtr<FdoLiteralValue> lval = exec->Evaluate(expression);
-                value = ExpressionHelper::GetAsInt32(lval.p);
-            }
-            catch (FdoException* e)
-            {
-                e->Release();
-            }
+            int i = defValue;
+            eval->EvalInt32(expression, i);
+            value = i;
         }
 
         // return the value
@@ -169,7 +148,7 @@
     {
         defValue = i.defValue;
         value = i.value;
-        expression = FDO_SAFE_ADDREF(i.expression);
+        expression = i.expression;
     }
 };
 
@@ -179,25 +158,18 @@
 {
     bool defValue;
     bool value;
-    FdoExpression* expression;
+    MdfModel::MdfString expression;
 
-    SE_INLINE SE_Boolean() : defValue(false), value(false), expression(NULL) { }
-    ~SE_Boolean() { if (expression) expression->Release(); }
+    SE_INLINE SE_Boolean() : defValue(false), value(false) { }
+    ~SE_Boolean() { }
 
-    SE_INLINE bool evaluate(FdoExpressionEngine* exec)
+    SE_INLINE bool evaluate(SE_Evaluator* eval)
     {
-        if (expression)
+        if (!expression.empty())
         {
-            value = defValue;
-            try
-            {
-                FdoPtr<FdoLiteralValue> lval = exec->Evaluate(expression);
-                value = ExpressionHelper::GetAsBoolean(lval.p);
-            }
-            catch (FdoException* e)
-            {
-                e->Release();
-            }
+            bool b = defValue;
+            eval->EvalBoolean(expression, b);
+            value = b;
         }
 
         // return the value
@@ -208,7 +180,7 @@
     {
         defValue = b.defValue;
         value = b.value;
-        expression = FDO_SAFE_ADDREF(b.expression);
+        expression = b.expression;
     }
 };
 
@@ -218,15 +190,13 @@
 {
     wchar_t* defValue;
     wchar_t* value;
-    FdoExpression* expression;
+    MdfModel::MdfString expression;
 
-    SE_INLINE SE_String() : defValue(NULL), value(NULL), expression(NULL) { }
+    SE_INLINE SE_String() : defValue(NULL), value(NULL) { }
     ~SE_String()
     {
         delete[] value;
         delete[] defValue;
-        if (expression)
-            expression->Release();
     }
 
     void setDefValue(wchar_t* newDefValue)
@@ -260,29 +230,23 @@
         return sEmpty;
     }
 
-    SE_INLINE const wchar_t* evaluate(FdoExpressionEngine* exec)
+    SE_INLINE const wchar_t* evaluate(SE_Evaluator* eval)
     {
-        if (expression)
+        if (!expression.empty())
         {
             delete[] value;
             value = NULL;
 
-            try
+            RS_String str;
+            eval->EvalString(expression, str);
+            if (!str.empty())
             {
-                FdoPtr<FdoLiteralValue> lval = exec->Evaluate(expression);
-                const wchar_t* newValue = ExpressionHelper::GetAsString(lval.p);
-                if (newValue)
-                {
-                    // the expression was successfully evaluated - update the value
-                    size_t len = wcslen(newValue) + 1;
-                    value = new wchar_t[len];
-                    wcscpy(value, newValue);
-                }
+                // the expression was successfully evaluated - update the value
+                size_t len = str.length() + 1;
+                value = new wchar_t[len];
+                const wchar_t* src = str.c_str();
+                wcscpy(value, src);
             }
-            catch (FdoException* e)
-            {
-                e->Release();
-            }
         }
 
         // return the value
@@ -327,7 +291,7 @@
         else
             value = NULL;
 
-        expression = FDO_SAFE_ADDREF(s.expression);
+        expression = s.expression;
     }
 };
 

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_LineBuffer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_LineBuffer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_LineBuffer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -301,7 +301,7 @@
         }
     }
 
-    m_xf_buf->SetGeometryType(LineBuffer::GeometryType_LineString);
+    m_xf_buf->SetGeometryType(GeometryType_LineString);
 }
 
 

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_LineRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_LineRenderer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_LineRenderer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -269,7 +269,7 @@
                 SE_RenderPolyline* pl = (SE_RenderPolyline*)primitive;
 
                 // create the chopped up LineBuffer for this primitive
-                choppedBuffers[cur_prim] = LineBufferPool::NewLineBuffer(lbp, 128, FdoDimensionality_XY, true);
+                choppedBuffers[cur_prim] = LineBufferPool::NewLineBuffer(lbp, 128, Dimensionality_XY, true);
                 ChopLineBuffer(pl->geometry->xf_buffer(), choppedBuffers[cur_prim]);
 
                 // update rendering attributes to account for the selection mode - it's
@@ -291,7 +291,7 @@
                 SE_RenderText* tp = (SE_RenderText*)primitive;
 
                 // create the chopped up LineBuffer for this primitive
-                choppedBuffers[cur_prim] = LineBufferPool::NewLineBuffer(lbp, 1, FdoDimensionality_XY, true);
+                choppedBuffers[cur_prim] = LineBufferPool::NewLineBuffer(lbp, 1, Dimensionality_XY, true);
                 choppedBuffers[cur_prim]->MoveTo(tp->position[0], tp->position[1]);
 
                 // update rendering attributes to account for the selection mode - it's
@@ -309,7 +309,7 @@
                 SE_RenderRaster* rp = (SE_RenderRaster*)primitive;
 
                 // create the chopped up LineBuffer for this primitive
-                choppedBuffers[cur_prim] = LineBufferPool::NewLineBuffer(lbp, 1, FdoDimensionality_XY, true);
+                choppedBuffers[cur_prim] = LineBufferPool::NewLineBuffer(lbp, 1, Dimensionality_XY, true);
                 choppedBuffers[cur_prim]->MoveTo(rp->position[0], rp->position[1]);
 
                 // raster primitive don't have any rendering attributes that need to be
@@ -323,7 +323,7 @@
         }
 
         // this will be our work buffer
-        LineBuffer geom(maxChoppedSize, FdoDimensionality_XY, true);
+        LineBuffer geom(maxChoppedSize, Dimensionality_XY, true);
 
         // for each contour
         for (int cur_contour=0; cur_contour<geometry->cntr_count(); ++cur_contour)
@@ -1643,7 +1643,7 @@
     if (geometry.point_type(0) != (unsigned char)LineBuffer::stMoveTo)
         return NULL;
 
-    LineBuffer* ret = LineBufferPool::NewLineBuffer(lbp, geometry.point_count(), FdoDimensionality_XY, true);
+    LineBuffer* ret = LineBufferPool::NewLineBuffer(lbp, geometry.point_count(), Dimensionality_XY, true);
     std::auto_ptr<LineBuffer> spRetLB(ret);
     ret->SetGeometryType(geometry.geom_type());
 
@@ -1713,7 +1713,7 @@
     if (geometry.point_type(0) != (unsigned char)LineBuffer::stMoveTo)
         return NULL;
 
-    LineBuffer* ret = LineBufferPool::NewLineBuffer(lbp, geometry.point_count(), FdoDimensionality_XY, true);
+    LineBuffer* ret = LineBufferPool::NewLineBuffer(lbp, geometry.point_count(), Dimensionality_XY, true);
     std::auto_ptr<LineBuffer> spRetLB(ret);
     ret->SetGeometryType(geometry.geom_type());
 

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_PositioningAlgorithms.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_PositioningAlgorithms.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_PositioningAlgorithms.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -178,8 +178,8 @@
     // eight surrounding labeling only applies to point feature geometry
     switch (geometry->geom_type())
     {
-        case FdoGeometryType_Point:
-        case FdoGeometryType_MultiPoint:
+        case GeometryType_Point:
+        case GeometryType_MultiPoint:
             break;
 
         default:
@@ -466,10 +466,10 @@
     // path labeling only applies to linestring feature geometry
     switch (geometry->geom_type())
     {
-        case FdoGeometryType_LineString:
-        case FdoGeometryType_MultiLineString:
-        case FdoGeometryType_CurveString:
-        case FdoGeometryType_MultiCurveString:
+        case GeometryType_LineString:
+        case GeometryType_MultiLineString:
+        case GeometryType_CurveString:
+        case GeometryType_MultiCurveString:
             break;
 
         default:

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_Renderer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_Renderer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_Renderer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -201,10 +201,10 @@
     {
         switch (featGeom->geom_type())
         {
-            case FdoGeometryType_LineString:
-            case FdoGeometryType_MultiLineString:
-            case FdoGeometryType_Polygon:
-            case FdoGeometryType_MultiPolygon:
+            case GeometryType_LineString:
+            case GeometryType_MultiLineString:
+            case GeometryType_Polygon:
+            case GeometryType_MultiPolygon:
             {
                 double x0, y0;
                 featGeom->Centroid(LineBuffer::ctLine, &x0, &y0, &angleRad);
@@ -271,8 +271,8 @@
     // can't apply a line style to point geometry types
     switch (featGeom->geom_type())
     {
-        case FdoGeometryType_Point:
-        case FdoGeometryType_MultiPoint:
+        case GeometryType_Point:
+        case GeometryType_MultiPoint:
             return;
     }
 
@@ -344,12 +344,12 @@
     // can't apply an area style to point and linestring geometry types
     switch (featGeom->geom_type())
     {
-        case FdoGeometryType_Point:
-        case FdoGeometryType_MultiPoint:
-        case FdoGeometryType_LineString:
-        case FdoGeometryType_MultiLineString:
-        case FdoGeometryType_CurveString:
-        case FdoGeometryType_MultiCurveString:
+        case GeometryType_Point:
+        case GeometryType_MultiPoint:
+        case GeometryType_LineString:
+        case GeometryType_MultiLineString:
+        case GeometryType_CurveString:
+        case GeometryType_MultiCurveString:
             return;
     }
 


Property changes on: sandbox/jng/common_decouple/Common/Stylization/SE_Renderer.cpp
___________________________________________________________________
Modified: svn:mergeinfo
## -2,5 +2,6 ##
 /branches/2.6/MgDev/Common/Stylization/SE_Renderer.cpp:8340
 /sandbox/adsk/2.4j/Common/Stylization/SE_Renderer.cpp:6327-6445
 /sandbox/jng/createruntimemap/Common/Stylization/SE_Renderer.cpp:7486-7555
+/sandbox/jng/stylization_refactor/Common/Stylization/SE_Renderer.cpp:7742-7749
 /sandbox/rfc94/Common/Stylization/SE_Renderer.cpp:5099-5163
 /trunk/MgDev/Common/Stylization/SE_Renderer.cpp:6250-6326
\ No newline at end of property
Modified: sandbox/jng/common_decouple/Common/Stylization/SE_StyleVisitor.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_StyleVisitor.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_StyleVisitor.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -55,10 +55,10 @@
     ParseDoubleExpression(pointUsage.GetOriginOffsetY(), style->originOffset[1], 0.0);
 
     // set flag if all properties are constant
-    style->cacheable = !(style->angleDeg.expression
-                      || style->angleControl.expression
-                      || style->originOffset[0].expression
-                      || style->originOffset[1].expression);
+    style->cacheable = (!style->angleDeg.expression.empty()
+                     && !style->angleControl.expression.empty()
+                     && !style->originOffset[0].expression.empty()
+                     && !style->originOffset[1].expression.empty());
 
     return style;
 }
@@ -95,22 +95,22 @@
     }
 
     // set flag if all properties are constant
-    style->cacheable = !(style->angleDeg.expression
-                      || style->angleControl.expression
-                      || style->unitsControl.expression
-                      || style->vertexControl.expression
-                      || style->startOffset.expression
-                      || style->endOffset.expression
-                      || style->repeat.expression
-                      || style->vertexAngleLimit.expression
-                      || style->vertexJoin.expression
-                      || style->vertexMiterLimit.expression
-                      || style->dpWeight.expression
-                      || style->dpColor.expression
-                      || style->dpWeightScalable.expression
-                      || style->dpCap.expression
-                      || style->dpJoin.expression
-                      || style->dpMiterLimit.expression);
+    style->cacheable = (!style->angleDeg.expression.empty()
+                     && !style->angleControl.expression.empty()
+                     && !style->unitsControl.expression.empty()
+                     && !style->vertexControl.expression.empty()
+                     && !style->startOffset.expression.empty()
+                     && !style->endOffset.expression.empty()
+                     && !style->repeat.expression.empty()
+                     && !style->vertexAngleLimit.expression.empty()
+                     && !style->vertexJoin.expression.empty()
+                     && !style->vertexMiterLimit.expression.empty()
+                     && !style->dpWeight.expression.empty()
+                     && !style->dpColor.expression.empty()
+                     && !style->dpWeightScalable.expression.empty()
+                     && !style->dpCap.expression.empty()
+                     && !style->dpJoin.expression.empty()
+                     && !style->dpMiterLimit.expression.empty());
 
     return style;
 }
@@ -130,15 +130,15 @@
     ParseDoubleExpression(areaUsage.GetBufferWidth(), style->bufferWidth, 0.0);
 
     // set flag if all properties are constant
-    style->cacheable = !(style->angleDeg.expression
-                      || style->angleControl.expression
-                      || style->originControl.expression
-                      || style->clippingControl.expression
-                      || style->origin[0].expression
-                      || style->origin[1].expression
-                      || style->repeat[0].expression
-                      || style->repeat[1].expression
-                      || style->bufferWidth.expression);
+    style->cacheable =  (!style->angleDeg.expression.empty()
+                      && !style->angleControl.expression.empty()
+                      && !style->originControl.expression.empty()
+                      && !style->clippingControl.expression.empty()
+                      && !style->origin[0].expression.empty()
+                      && !style->origin[1].expression.empty()
+                      && !style->repeat[0].expression.empty()
+                      && !style->repeat[1].expression.empty()
+                      && !style->bufferWidth.expression.empty());
 
     return style;
 }
@@ -667,15 +667,15 @@
         if (primitive->color.value.argb == 0)
             primitive->color.value.comps.a = 255;
 
-        primitive->cacheable = !(primitive->weight.expression
-                              || primitive->color.expression
-                              || primitive->weightScalable.expression
-                              || primitive->cap.expression
-                              || primitive->join.expression
-                              || primitive->miterLimit.expression
-                              || primitive->resizeControl.expression
-                              || primitive->scaleX.expression
-                              || primitive->scaleY.expression);
+        primitive->cacheable = (!primitive->weight.expression.empty()
+                             && !primitive->color.expression.empty()
+                             && !primitive->weightScalable.expression.empty()
+                             && !primitive->cap.expression.empty()
+                             && !primitive->join.expression.empty()
+                             && !primitive->miterLimit.expression.empty()
+                             && !primitive->resizeControl.expression.empty()
+                             && !primitive->scaleX.expression.empty()
+                             && !primitive->scaleY.expression.empty());
     }
     else
     {
@@ -694,16 +694,16 @@
         ParseDoubleExpression(path.GetScaleY(), primitive->scaleY, 1.0);
         ParseStringExpression(path.GetResizeControl(), primitive->resizeControl, GraphicElement::sResizeControlDefault, GraphicElement::sResizeControlValues);
 
-        primitive->cacheable = !(primitive->weight.expression
-                              || primitive->color.expression
-                              || primitive->fill.expression
-                              || primitive->weightScalable.expression
-                              || primitive->cap.expression
-                              || primitive->join.expression
-                              || primitive->miterLimit.expression
-                              || primitive->resizeControl.expression
-                              || primitive->scaleX.expression
-                              || primitive->scaleY.expression);
+        primitive->cacheable =  (!primitive->weight.expression.empty()
+                              && !primitive->color.expression.empty()
+                              && !primitive->fill.expression.empty()
+                              && !primitive->weightScalable.expression.empty()
+                              && !primitive->cap.expression.empty()
+                              && !primitive->join.expression.empty()
+                              && !primitive->miterLimit.expression.empty()
+                              && !primitive->resizeControl.expression.empty()
+                              && !primitive->scaleX.expression.empty()
+                              && !primitive->scaleY.expression.empty());
     }
 }
 
@@ -745,7 +745,7 @@
         ParseStringExpression(image.GetResourceId(), primitive->pngResourceId, image.GetResourceId().c_str());
         ParseStringExpression(image.GetLibraryItemName(), primitive->pngResourceName, image.GetLibraryItemName().c_str());
 
-        if (primitive->pngResourceId.expression == NULL && primitive->pngResourceName.expression == NULL) // constant path
+        if (primitive->pngResourceId.expression.empty() && primitive->pngResourceName.expression.empty()) // constant path
         {
             // if we have non-empty resource ID then use it, otherwise
             // use the ID of any parent symbol definition
@@ -771,13 +771,13 @@
     ParseBooleanExpression(image.GetSizeScalable(), primitive->sizeScalable, true);
     ParseStringExpression(image.GetResizeControl(), primitive->resizeControl, GraphicElement::sResizeControlDefault, GraphicElement::sResizeControlValues);
 
-    primitive->cacheable = !(primitive->position[0].expression
-                          || primitive->position[1].expression
-                          || primitive->extent[0].expression
-                          || primitive->extent[1].expression
-                          || primitive->angleDeg.expression
-                          || primitive->sizeScalable.expression
-                          || primitive->resizeControl.expression)
+    primitive->cacheable =  (!primitive->position[0].expression.empty()
+                          && !primitive->position[1].expression.empty()
+                          && !primitive->extent[0].expression.empty()
+                          && !primitive->extent[1].expression.empty()
+                          && !primitive->angleDeg.expression.empty()
+                          && !primitive->sizeScalable.expression.empty()
+                          && !primitive->resizeControl.expression.empty())
                           && primitive->imageData.data;
 }
 
@@ -821,31 +821,31 @@
         ParseDoubleExpression(frame->GetOffsetY(), primitive->frameOffset[1], 0.0);
     }
 
-    primitive->cacheable = !(primitive->content.expression
-                          || primitive->fontName.expression
-                          || primitive->height.expression
-                          || primitive->angleDeg.expression
-                          || primitive->position[0].expression
-                          || primitive->position[1].expression
-                          || primitive->lineSpacing.expression
-                          || primitive->heightScalable.expression
-                          || primitive->bold.expression
-                          || primitive->italic.expression
-                          || primitive->underlined.expression
-                          || primitive->overlined.expression
-                          || primitive->obliqueAngle.expression
-                          || primitive->trackSpacing.expression
-                          || primitive->hAlignment.expression
-                          || primitive->vAlignment.expression
-                          || primitive->justification.expression
-                          || primitive->textColor.expression
-                          || primitive->ghostColor.expression
-                          || primitive->frameLineColor.expression
-                          || primitive->frameFillColor.expression
-                          || primitive->frameOffset[0].expression
-                          || primitive->frameOffset[1].expression
-                          || primitive->markup.expression
-                          || primitive->resizeControl.expression);
+    primitive->cacheable =  (!primitive->content.expression.empty()
+                          && !primitive->fontName.expression.empty()
+                          && !primitive->height.expression.empty()
+                          && !primitive->angleDeg.expression.empty()
+                          && !primitive->position[0].expression.empty()
+                          && !primitive->position[1].expression.empty()
+                          && !primitive->lineSpacing.expression.empty()
+                          && !primitive->heightScalable.expression.empty()
+                          && !primitive->bold.expression.empty()
+                          && !primitive->italic.expression.empty()
+                          && !primitive->underlined.expression.empty()
+                          && !primitive->overlined.expression.empty()
+                          && !primitive->obliqueAngle.expression.empty()
+                          && !primitive->trackSpacing.expression.empty()
+                          && !primitive->hAlignment.expression.empty()
+                          && !primitive->vAlignment.expression.empty()
+                          && !primitive->justification.expression.empty()
+                          && !primitive->textColor.expression.empty()
+                          && !primitive->ghostColor.expression.empty()
+                          && !primitive->frameLineColor.expression.empty()
+                          && !primitive->frameFillColor.expression.empty()
+                          && !primitive->frameOffset[0].expression.empty()
+                          && !primitive->frameOffset[1].expression.empty()
+                          && !primitive->markup.expression.empty()
+                          && !primitive->resizeControl.expression.empty());
 }
 
 
@@ -925,16 +925,16 @@
         ParseDoubleExpression(box->GetPositionY(), m_style->resizePosition[1], 0.0);
         ParseStringExpression(box->GetGrowControl(), m_style->growControl, ResizeBox::sGrowControlDefault, ResizeBox::sGrowControlValues);
 
-        m_style->cacheable &= !(m_style->resizeSize[0].expression
-                             || m_style->resizeSize[1].expression
-                             || m_style->resizePosition[0].expression
-                             || m_style->resizePosition[1].expression
-                             || m_style->growControl.expression);
+        m_style->cacheable &=  (!m_style->resizeSize[0].expression.empty()
+                             && !m_style->resizeSize[1].expression.empty()
+                             && !m_style->resizePosition[0].expression.empty()
+                             && !m_style->resizePosition[1].expression.empty()
+                             && !m_style->growControl.expression.empty());
     }
 
     // the symbol instance scales also affect the evaluated style
-    m_style->cacheable &= !(m_symbolInstance->scale[0].expression
-                         || m_symbolInstance->scale[1].expression);
+    m_style->cacheable &=  (!m_symbolInstance->scale[0].expression.empty()
+                         && !m_symbolInstance->scale[1].expression.empty());
 
     m_symbolInstance->styles.push_back(m_style);
 }

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -98,7 +98,7 @@
 
     SE_RenderPolyline* ret = new SE_RenderPolyline();
 
-    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->exec);
+    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->eval);
     if (wcscmp(sResizeCtrl, L"AddToResizeBox") == 0)
         ret->resizeControl = SE_ResizeControl_AddToResizeBox;
     else if (wcscmp(sResizeCtrl, L"AdjustToResizeBox") == 0)
@@ -108,10 +108,10 @@
 
     ret->geometry = geometry->Clone();
 
-    double wx                  = weightScalable.evaluate(ctx->exec)? fabs(ctx->xform->x0) : ctx->mm2su;
-    ret->lineStroke.weight     = weight.evaluate(ctx->exec) * wx;
-    ret->lineStroke.color      = color.evaluate(ctx->exec);
-    ret->lineStroke.miterLimit = miterLimit.evaluate(ctx->exec);
+    double wx                  = weightScalable.evaluate(ctx->eval)? fabs(ctx->xform->x0) : ctx->mm2su;
+    ret->lineStroke.weight     = weight.evaluate(ctx->eval) * wx;
+    ret->lineStroke.color      = color.evaluate(ctx->eval);
+    ret->lineStroke.miterLimit = miterLimit.evaluate(ctx->eval);
     if (ret->lineStroke.miterLimit < 0.0)
         ret->lineStroke.miterLimit = 0.0;
 
@@ -122,7 +122,7 @@
     else if (devWeightInMM < 0.0)
         ret->lineStroke.weight = 0.0;
 
-    const wchar_t* sCap = cap.evaluate(ctx->exec);
+    const wchar_t* sCap = cap.evaluate(ctx->eval);
     if (wcscmp(sCap, L"Round") == 0)    // check this first since it's the most common
         ret->lineStroke.cap = SE_LineCap_Round;
     else if (wcscmp(sCap, L"None") == 0)
@@ -134,7 +134,7 @@
     else // default is Round
         ret->lineStroke.cap = SE_LineCap_Round;
 
-    const wchar_t* sJoin = join.evaluate(ctx->exec);
+    const wchar_t* sJoin = join.evaluate(ctx->eval);
     if (wcscmp(sJoin, L"Round") == 0)   // check this first since it's the most common
         ret->lineStroke.join = SE_LineJoin_Round;
     else if (wcscmp(sJoin, L"None") == 0)
@@ -149,8 +149,8 @@
     else // default is Round
         ret->lineStroke.join = SE_LineJoin_Round;
 
-    ret->scaleX = scaleX.evaluate(ctx->exec);
-    ret->scaleY = scaleY.evaluate(ctx->exec);
+    double dScaleX = scaleX.evaluate(ctx->eval);
+    double dScaleY = scaleY.evaluate(ctx->eval);
 
     // populate the line buffer
     if (ret->scaleX != 1.0 || ret->scaleY != 1.0)
@@ -226,7 +226,7 @@
 
     SE_RenderPolygon* ret = new SE_RenderPolygon();
 
-    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->exec);
+    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->eval);
     if (wcscmp(sResizeCtrl, L"AddToResizeBox") == 0)
         ret->resizeControl = SE_ResizeControl_AddToResizeBox;
     else if (wcscmp(sResizeCtrl, L"AdjustToResizeBox") == 0)
@@ -235,12 +235,12 @@
         ret->resizeControl = SE_ResizeControl_ResizeNone;
 
     ret->geometry = geometry->Clone();
-    ret->fill     = fill.evaluate(ctx->exec);
+    ret->fill     = fill.evaluate(ctx->eval);
 
-    double wx                  = weightScalable.evaluate(ctx->exec)? fabs(ctx->xform->x0) : ctx->mm2su;
-    ret->lineStroke.weight     = weight.evaluate(ctx->exec) * wx;
-    ret->lineStroke.color      = color.evaluate(ctx->exec);
-    ret->lineStroke.miterLimit = miterLimit.evaluate(ctx->exec);
+    double wx                  = weightScalable.evaluate(ctx->eval)? fabs(ctx->xform->x0) : ctx->mm2su;
+    ret->lineStroke.weight     = weight.evaluate(ctx->eval) * wx;
+    ret->lineStroke.color      = color.evaluate(ctx->eval);
+    ret->lineStroke.miterLimit = miterLimit.evaluate(ctx->eval);
     if (ret->lineStroke.miterLimit < 0.0)
         ret->lineStroke.miterLimit = 0.0;
 
@@ -251,7 +251,7 @@
     else if (devWeightInMM < 0.0)
         ret->lineStroke.weight = 0.0;
 
-    const wchar_t* sCap = cap.evaluate(ctx->exec);
+    const wchar_t* sCap = cap.evaluate(ctx->eval);
     if (wcscmp(sCap, L"Round") == 0)    // check this first since it's the most common
         ret->lineStroke.cap = SE_LineCap_Round;
     else if (wcscmp(sCap, L"None") == 0)
@@ -263,7 +263,7 @@
     else // default is Round
         ret->lineStroke.cap = SE_LineCap_Round;
 
-    const wchar_t* sJoin = join.evaluate(ctx->exec);
+    const wchar_t* sJoin = join.evaluate(ctx->eval);
     if (wcscmp(sJoin, L"Round") == 0)   // check this first since it's the most common
         ret->lineStroke.join = SE_LineJoin_Round;
     else if (wcscmp(sJoin, L"None") == 0)
@@ -282,7 +282,10 @@
     ret->scaleY = scaleY.evaluate(ctx->exec);
 
     // populate the line buffer
-    if (ret->scaleX != 1.0 || ret->scaleY != 1.0)
+    double dScaleX = scaleX.evaluate(ctx->eval);
+    double dScaleY = scaleY.evaluate(ctx->eval);
+
+    if(dScaleX != 1.0 || dScaleY != 1.0)
     {
         // combine the path scaling with the style transform
         SE_Matrix xform(ret->scaleX, 0.0, 0.0, 0.0, ret->scaleY, 0.0);
@@ -327,13 +330,13 @@
         return NULL;
 
     // don't bother creating a primitive if there's no content
-    const wchar_t* contentStr = content.evaluate(ctx->exec);
+    const wchar_t* contentStr = content.evaluate(ctx->eval);
     if (wcslen(contentStr) == 0)
         return NULL;
 
     SE_RenderText* ret = new SE_RenderText();
 
-    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->exec);
+    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->eval);
     if (wcscmp(sResizeCtrl, L"AddToResizeBox") == 0)
         ret->resizeControl = SE_ResizeControl_AddToResizeBox;
     else if (wcscmp(sResizeCtrl, L"AdjustToResizeBox") == 0)
@@ -340,11 +343,11 @@
         ret->resizeControl = SE_ResizeControl_AdjustToResizeBox;
     else // default is ResizeNone
         ret->resizeControl = SE_ResizeControl_ResizeNone;
-    if(NULL != content.expression)
-        ret->expression  = content.expression->ToString();
+    if(!content.expression.empty())
+        ret->expression  = content.expression;
     ret->content     = contentStr;
-    ret->position[0] = position[0].evaluate(ctx->exec);
-    ret->position[1] = position[1].evaluate(ctx->exec);
+    ret->position[0] = position[0].evaluate(ctx->eval);
+    ret->position[1] = position[1].evaluate(ctx->eval);
 
     ctx->xform->transform(ret->position[0], ret->position[1]);
 
@@ -351,49 +354,49 @@
     RS_TextDef& textDef = ret->tdef;
     RS_FontDef& fontDef = textDef.font();
 
-    textDef.rotation() = fmod(angleDeg.evaluate(ctx->exec), 360.0);   // in degrees
+    textDef.rotation() = fmod(angleDeg.evaluate(ctx->eval), 360.0);   // in degrees
 
     int style = RS_FontStyle_Regular;
-    if (bold.evaluate(ctx->exec))
+    if (bold.evaluate(ctx->eval))
         style |= RS_FontStyle_Bold;
-    if (italic.evaluate(ctx->exec))
+    if (italic.evaluate(ctx->eval))
         style |= RS_FontStyle_Italic;
-    if (underlined.evaluate(ctx->exec))
+    if (underlined.evaluate(ctx->eval))
         style |= RS_FontStyle_Underline;
-    if (overlined.evaluate(ctx->exec))
+    if (overlined.evaluate(ctx->eval))
         style |= RS_FontStyle_Overline;
 
     fontDef.style() = (RS_FontStyle_Mask)style;
-    fontDef.name()  = fontName.evaluate(ctx->exec);
+    fontDef.name()  = fontName.evaluate(ctx->eval);
 
     // RS_TextDef expects font height to be in meters - convert it from mm
-    double wy              = heightScalable.evaluate(ctx->exec)? 0.001 * fabs(ctx->xform->y1) / ctx->mm2sud : 0.001;
-    fontDef.height()       = height.evaluate(ctx->exec) * wy;
-    textDef.obliqueAngle() = obliqueAngle.evaluate(ctx->exec);
-    textDef.trackSpacing() = trackSpacing.evaluate(ctx->exec);
-    textDef.linespace()    = lineSpacing.evaluate(ctx->exec);
-    textDef.textcolor()    = RS_Color::FromARGB(textColor.evaluate(ctx->exec));
-    textDef.markup()       = markup.evaluate(ctx->exec);
+    double wy              = heightScalable.evaluate(ctx->eval)? 0.001 * fabs(ctx->xform->y1) / ctx->mm2sud : 0.001;
+    fontDef.height()       = height.evaluate(ctx->eval) * wy;
+    textDef.obliqueAngle() = obliqueAngle.evaluate(ctx->eval);
+    textDef.trackSpacing() = trackSpacing.evaluate(ctx->eval);
+    textDef.linespace()    = lineSpacing.evaluate(ctx->eval);
+    textDef.textcolor()    = RS_Color::FromARGB(textColor.evaluate(ctx->eval));
+    textDef.markup()       = markup.evaluate(ctx->eval);
 
     if (!ghostColor.empty())
     {
-        textDef.ghostcolor() = RS_Color::FromARGB(ghostColor.evaluate(ctx->exec));
+        textDef.ghostcolor() = RS_Color::FromARGB(ghostColor.evaluate(ctx->eval));
         textDef.textbg() |= RS_TextBackground_Ghosted;
     }
     if (!frameLineColor.empty())
     {
-        textDef.framecolor() = RS_Color::FromARGB(frameLineColor.evaluate(ctx->exec));
+        textDef.framecolor() = RS_Color::FromARGB(frameLineColor.evaluate(ctx->eval));
         textDef.textbg() |= RS_TextBackground_Framed;
     }
     if (!frameFillColor.empty())
     {
-        textDef.opaquecolor() = RS_Color::FromARGB(frameFillColor.evaluate(ctx->exec));
+        textDef.opaquecolor() = RS_Color::FromARGB(frameFillColor.evaluate(ctx->eval));
         textDef.textbg() |= RS_TextBackground_Opaque;
     }
-    textDef.frameoffsetx() = frameOffset[0].evaluate(ctx->exec) * fabs(ctx->xform->x0);
-    textDef.frameoffsety() = frameOffset[1].evaluate(ctx->exec) * fabs(ctx->xform->y1);
+    textDef.frameoffsetx() = frameOffset[0].evaluate(ctx->eval) * fabs(ctx->xform->x0);
+    textDef.frameoffsety() = frameOffset[1].evaluate(ctx->eval) * fabs(ctx->xform->y1);
 
-    const wchar_t* hAlign = hAlignment.evaluate(ctx->exec);
+    const wchar_t* hAlign = hAlignment.evaluate(ctx->eval);
     if (wcscmp(hAlign, L"Center") == 0)     // check this first since it's the most common
         textDef.halign() = RS_HAlignment_Center;
     else if (wcscmp(hAlign, L"Left") == 0)
@@ -403,7 +406,7 @@
     else // default is Center
         textDef.halign() = RS_HAlignment_Center;
 
-    const wchar_t* vAlign = vAlignment.evaluate(ctx->exec);
+    const wchar_t* vAlign = vAlignment.evaluate(ctx->eval);
     if (wcscmp(vAlign, L"Halfline") == 0)   // check this first since it's the most common
         textDef.valign() = RS_VAlignment_Half;
     else if (wcscmp(vAlign, L"Bottom") == 0)
@@ -417,7 +420,7 @@
     else // default is Halfline
         textDef.valign() = RS_VAlignment_Half;
 
-    const wchar_t* justification = this->justification.evaluate(ctx->exec);
+    const wchar_t* justification = this->justification.evaluate(ctx->eval);
     if (wcscmp(justification, L"FromAlignment") == 0)   // check this first since it's the most common
     {
         switch (textDef.halign())
@@ -514,7 +517,7 @@
 {
     SE_RenderRaster* ret = new SE_RenderRaster();
 
-    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->exec);
+    const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->eval);
     if (wcscmp(sResizeCtrl, L"AddToResizeBox") == 0)
         ret->resizeControl = SE_ResizeControl_AddToResizeBox;
     else if (wcscmp(sResizeCtrl, L"AdjustToResizeBox") == 0)
@@ -526,10 +529,10 @@
     {
         // if we have non-empty resource ID then use it, otherwise use
         // the ID of any parent symbol definition
-        const wchar_t* resourceId = pngResourceId.evaluate(ctx->exec);
+        const wchar_t* resourceId = pngResourceId.evaluate(ctx->eval);
         if (wcslen(resourceId) == 0)
             resourceId = resId;
-        ctx->resources->GetImageData(resourceId, pngResourceName.evaluate(ctx->exec), ret->imageData);
+        ctx->resources->GetImageData(resourceId, pngResourceName.evaluate(ctx->eval), ret->imageData);
     }
     else
     {
@@ -536,22 +539,22 @@
         ret->imageData = imageData;
     }
 
-    ret->position[0] = position[0].evaluate(ctx->exec);
-    ret->position[1] = position[1].evaluate(ctx->exec);
+    ret->position[0] = position[0].evaluate(ctx->eval);
+    ret->position[1] = position[1].evaluate(ctx->eval);
     ctx->xform->transform(ret->position[0], ret->position[1]);
 
-    if (sizeScalable.evaluate(ctx->exec))
+    if (sizeScalable.evaluate(ctx->eval))
     {
-        ret->extent[0] = fabs(extent[0].evaluate(ctx->exec) * fabs(ctx->xform->x0));
-        ret->extent[1] = fabs(extent[1].evaluate(ctx->exec) * fabs(ctx->xform->y1));
+        ret->extent[0] = fabs(extent[0].evaluate(ctx->eval) * fabs(ctx->xform->x0));
+        ret->extent[1] = fabs(extent[1].evaluate(ctx->eval) * fabs(ctx->xform->y1));
     }
     else
     {
-        ret->extent[0] = fabs(extent[0].evaluate(ctx->exec) * ctx->mm2sud);
-        ret->extent[1] = fabs(extent[1].evaluate(ctx->exec) * ctx->mm2sud);
+        ret->extent[0] = fabs(extent[0].evaluate(ctx->eval) * ctx->mm2sud);
+        ret->extent[1] = fabs(extent[1].evaluate(ctx->eval) * ctx->mm2sud);
     }
 
-    ret->angleRad = fmod(angleDeg.evaluate(ctx->exec), 360.0) * M_PI180;
+    ret->angleRad = fmod(angleDeg.evaluate(ctx->eval), 360.0) * M_PI180;
 
     // this one is just a raw double
     ret->opacity = opacity;
@@ -587,7 +590,7 @@
 void SE_Style::evaluate(SE_EvalContext* ctx)
 {
     // evaluate values that are common to all styles
-    rstyle->renderPass = renderPass.evaluate(ctx->exec);
+    rstyle->renderPass = renderPass.evaluate(ctx->eval);
 
     //
     // evaluation of all primitives and also resize box stuff
@@ -599,10 +602,10 @@
     if (useBox)
     {
         // get the initial resize box
-        double dx = resizePosition[0].evaluate(ctx->exec);
-        double dy = resizePosition[1].evaluate(ctx->exec);
-        double sx = 0.5*fabs(resizeSize[0].evaluate(ctx->exec));
-        double sy = 0.5*fabs(resizeSize[1].evaluate(ctx->exec));
+        double dx = resizePosition[0].evaluate(ctx->eval);
+        double dy = resizePosition[1].evaluate(ctx->eval);
+        double sx = 0.5*fabs(resizeSize[0].evaluate(ctx->eval));
+        double sy = 0.5*fabs(resizeSize[1].evaluate(ctx->eval));
 
         double ptAx, ptAy, ptBx, ptBy;
         ctx->xform->transform(dx - sx, dy - sy, ptAx, ptAy);
@@ -656,7 +659,7 @@
         double transy0 = 0.0;
         double transx1 = 0.0;
         double transy1 = 0.0;
-        const wchar_t* sGrowCtrl = growControl.evaluate(ctx->exec);
+        const wchar_t* sGrowCtrl = growControl.evaluate(ctx->eval);
         if (wcscmp(sGrowCtrl, L"GrowInX") == 0)
         {
             if (sx0 != 0.0)
@@ -792,18 +795,18 @@
     delete rstyle;
     rstyle = style;
 
-    const wchar_t* sAngleControl = angleControl.evaluate(ctx->exec);
+    const wchar_t* sAngleControl = angleControl.evaluate(ctx->eval);
     if (wcscmp(sAngleControl, L"FromGeometry") == 0)
         style->angleControl = SE_AngleControl_FromGeometry;
     else // default is FromAngle
         style->angleControl = SE_AngleControl_FromAngle;
 
-    style->angleRad = fmod(angleDeg.evaluate(ctx->exec), 360.0) * M_PI180;
+    style->angleRad = fmod(angleDeg.evaluate(ctx->eval), 360.0) * M_PI180;
 
     // scale by xform->x0 and xform->y1 instead of mm2su, because these encompass
     // mm2su as well as scaleX and scaleY
-    style->offset[0] = originOffset[0].evaluate(ctx->exec) * ctx->xform->x0;
-    style->offset[1] = originOffset[1].evaluate(ctx->exec) * ctx->xform->y1;
+    style->offset[0] = originOffset[0].evaluate(ctx->eval) * ctx->xform->x0;
+    style->offset[1] = originOffset[1].evaluate(ctx->eval) * ctx->xform->y1;
 
     // evaluate all the primitives too
     SE_Style::evaluate(ctx);
@@ -821,19 +824,19 @@
     delete rstyle;
     rstyle = style;
 
-    const wchar_t* sAngleControl = angleControl.evaluate(ctx->exec);
+    const wchar_t* sAngleControl = angleControl.evaluate(ctx->eval);
     if (wcscmp(sAngleControl, L"FromAngle") == 0)
         style->angleControl = SE_AngleControl_FromAngle;
     else // default is FromGeometry
         style->angleControl = SE_AngleControl_FromGeometry;
 
-    const wchar_t* sUnitsControl = unitsControl.evaluate(ctx->exec);
+    const wchar_t* sUnitsControl = unitsControl.evaluate(ctx->eval);
     if (wcscmp(sUnitsControl, L"Parametric") == 0)
         style->unitsControl = SE_UnitsControl_Parametric;
     else // default is Absolute
         style->unitsControl = SE_UnitsControl_Absolute;
 
-    const wchar_t* sVertexControl = vertexControl.evaluate(ctx->exec);
+    const wchar_t* sVertexControl = vertexControl.evaluate(ctx->eval);
     if (wcscmp(sVertexControl, L"OverlapNone") == 0)
         style->vertexControl = SE_VertexControl_OverlapNone;
     else if (wcscmp(sVertexControl, L"OverlapDirect") == 0)
@@ -844,11 +847,11 @@
     else // default is OverlapWrap
         style->vertexControl = SE_VertexControl_OverlapWrap;
 
-    style->angleRad = fmod(angleDeg.evaluate(ctx->exec), 360.0) * M_PI180;
+    style->angleRad = fmod(angleDeg.evaluate(ctx->eval), 360.0) * M_PI180;
 
-    style->startOffset = startOffset.evaluate(ctx->exec);
-    style->endOffset   = endOffset.evaluate(ctx->exec);
-    style->repeat      = repeat.evaluate(ctx->exec);
+    style->startOffset = startOffset.evaluate(ctx->eval);
+    style->endOffset   = endOffset.evaluate(ctx->eval);
+    style->repeat      = repeat.evaluate(ctx->eval);
 
     // with parametric units control the repeat / offsets will be scaled
     // later on by each contour length, which includes the transform
@@ -875,15 +878,15 @@
         }
     }
 
-    double angleLimit = vertexAngleLimit.evaluate(ctx->exec);
+    double angleLimit = vertexAngleLimit.evaluate(ctx->eval);
     if (angleLimit < 0.0)
         angleLimit = 0.0;
     style->vertexAngleLimit = fmod(angleLimit, 360.0) * M_PI180;
-    style->vertexMiterLimit = vertexMiterLimit.evaluate(ctx->exec);
+    style->vertexMiterLimit = vertexMiterLimit.evaluate(ctx->eval);
     if (style->vertexMiterLimit < 0.0)
         style->vertexMiterLimit = 0.0;
 
-    const wchar_t* sJoin = vertexJoin.evaluate(ctx->exec);
+    const wchar_t* sJoin = vertexJoin.evaluate(ctx->eval);
     if (wcscmp(sJoin, L"Round") == 0)       // check this first since it's the most common
         style->vertexJoin = SE_LineJoin_Round;
     else if (wcscmp(sJoin, L"None") == 0)
@@ -898,10 +901,10 @@
     else // default is Round
         style->vertexJoin = SE_LineJoin_Round;
 
-    double wx                      = dpWeightScalable.evaluate(ctx->exec)? fabs(ctx->xform->x0) : ctx->mm2su;
-    style->dpLineStroke.weight     = dpWeight.evaluate(ctx->exec) * wx;
-    style->dpLineStroke.color      = dpColor.evaluate(ctx->exec);
-    style->dpLineStroke.miterLimit = dpMiterLimit.evaluate(ctx->exec);
+    double wx                      = dpWeightScalable.evaluate(ctx->eval)? fabs(ctx->xform->x0) : ctx->mm2su;
+    style->dpLineStroke.weight     = dpWeight.evaluate(ctx->eval) * wx;
+    style->dpLineStroke.color      = dpColor.evaluate(ctx->eval);
+    style->dpLineStroke.miterLimit = dpMiterLimit.evaluate(ctx->eval);
     if (style->dpLineStroke.miterLimit < 0.0)
         style->dpLineStroke.miterLimit = 0.0;
 
@@ -912,7 +915,7 @@
     else if (devWeightInMM < 0.0)
         style->dpLineStroke.weight = 0.0;
 
-    const wchar_t* sdpCap = dpCap.evaluate(ctx->exec);
+    const wchar_t* sdpCap = dpCap.evaluate(ctx->eval);
     if (wcscmp(sdpCap, L"Round") == 0)      // check this first since it's the most common
         style->dpLineStroke.cap = SE_LineCap_Round;
     else if (wcscmp(sdpCap, L"None") == 0)
@@ -924,7 +927,7 @@
     else // default is Round
         style->dpLineStroke.cap = SE_LineCap_Round;
 
-    const wchar_t* sdpJoin = dpJoin.evaluate(ctx->exec);
+    const wchar_t* sdpJoin = dpJoin.evaluate(ctx->eval);
     if (wcscmp(sdpJoin, L"Round") == 0)     // check this first since it's the most common
         style->dpLineStroke.join = SE_LineJoin_Round;
     else if (wcscmp(sdpJoin, L"None") == 0)
@@ -987,13 +990,13 @@
     delete rstyle;
     rstyle = style;
 
-    const wchar_t* sAngleControl = angleControl.evaluate(ctx->exec);
+    const wchar_t* sAngleControl = angleControl.evaluate(ctx->eval);
     if (wcscmp(sAngleControl, L"FromGeometry") == 0)
         style->angleControl = SE_AngleControl_FromGeometry;
     else // default is FromAngle
         style->angleControl = SE_AngleControl_FromAngle;
 
-    const wchar_t* sOriginControl = originControl.evaluate(ctx->exec);
+    const wchar_t* sOriginControl = originControl.evaluate(ctx->eval);
     if (wcscmp(sOriginControl, L"Centroid") == 0)
         style->originControl = SE_OriginControl_Centroid;
     else if (wcscmp(sOriginControl, L"Local") == 0)
@@ -1001,7 +1004,7 @@
     else // default is Global
         style->originControl = SE_OriginControl_Global;
 
-    const wchar_t* sClippingControl = clippingControl.evaluate(ctx->exec);
+    const wchar_t* sClippingControl = clippingControl.evaluate(ctx->eval);
     if (wcscmp(sClippingControl, L"Inside") == 0)
         style->clippingControl = SE_ClippingControl_Inside;
     else if (wcscmp(sClippingControl, L"Overlap") == 0)
@@ -1009,12 +1012,12 @@
     else // default is Clip
         style->clippingControl = SE_ClippingControl_Clip;
 
-    style->angleRad = fmod(angleDeg.evaluate(ctx->exec), 360.0) * M_PI180;
+    style->angleRad = fmod(angleDeg.evaluate(ctx->eval), 360.0) * M_PI180;
 
     // scale by xform->x0 and xform->y1 instead of mm2su, because these encompass
     // mm2su as well as scaleX and scaleY
-    style->origin[0] = origin[0].evaluate(ctx->exec);
-    style->origin[1] = origin[1].evaluate(ctx->exec);
+    style->origin[0]   = origin[0].evaluate(ctx->eval);
+    style->origin[1]   = origin[1].evaluate(ctx->eval);
     if (style->originControl != SE_OriginControl_Local)
     {
         // For non-local origin control the origin is in millimeters and must
@@ -1030,9 +1033,9 @@
         if (ctx->xform->y1 < 0.0)
             style->origin[1] = 1.0 - style->origin[1];
     }
-    style->repeat[0]   = repeat[0].evaluate(ctx->exec)   * fabs(ctx->xform->x0);
-    style->repeat[1]   = repeat[1].evaluate(ctx->exec)   * fabs(ctx->xform->y1);
-    style->bufferWidth = bufferWidth.evaluate(ctx->exec) * fabs(ctx->xform->x0);
+    style->repeat[0]   = repeat[0].evaluate(ctx->eval)   * fabs(ctx->xform->x0);
+    style->repeat[1]   = repeat[1].evaluate(ctx->eval)   * fabs(ctx->xform->y1);
+    style->bufferWidth = bufferWidth.evaluate(ctx->eval) * fabs(ctx->xform->x0);
     double origRepeatX = style->repeat[0];
     double origRepeatY = style->repeat[1];
 

Modified: sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/SE_SymbolDefProxies.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -37,7 +37,7 @@
 public:
     RS_FontEngine* fonte;
     SE_Matrix* xform;
-    FdoExpressionEngine* exec;
+    SE_Evaluator* eval;
     SE_SymbolManager* resources;
     double mm2su;
     double mm2sud;      // number of screen units per mm device
@@ -286,16 +286,12 @@
 {
     std::vector<SE_SymbolInstance*> symbolInstances;
     RS_String legendLabel;  // no expressions on this guy?
-    FdoFilter* filter;
+    MdfModel::MdfString filter;
 
-    SE_Rule() : filter(NULL)
-    {}
+    SE_Rule() {}
 
     ~SE_Rule()
     {
-        if (filter)
-            filter->Release();
-
         for (std::vector<SE_SymbolInstance*>::iterator iter = symbolInstances.begin(); iter != symbolInstances.end(); ++iter)
             delete *iter;
 

Modified: sandbox/jng/common_decouple/Common/Stylization/Stylization.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/Stylization.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/Stylization.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -81,16 +81,6 @@
 
 #include "Base64.h"
 
-// FDO headers
-#pragma warning(push)
-#pragma warning(disable: 4201)
-#include "Fdo.h"
-#include "FdoExpressionEngine.h"
-#include "FdoExpressionEngineFunctionCollection.h"
-#include "FdoExpressionEngineINonAggregateFunction.h"
-#pragma warning(pop)
-
-
 #ifndef __WFILE__
 // Wide character version of __FILE__ macro
 #define WIDEN2(x) L ## x
@@ -98,12 +88,6 @@
 #define __WFILE__ WIDEN(__FILE__)
 #endif
 
-//Non-fatal FDO exception logging mechanism
-//Implementation is defined in Stylizer.cpp
-typedef void (*StylizerExceptionCallback)(FdoException* exception, int line, wchar_t* file);
-void ProcessStylizerException(FdoException* exception);
-STYLIZATION_API void SetStylizerExceptionCallback(StylizerExceptionCallback callbackFunction);
-
 // avoid linux warnings
 #ifndef _WIN32
 static const void* avoid_warning1 = (void*)FDO_ACTIVELONGTRANSACTION;

Modified: sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj	2018-03-03 16:14:43 UTC (rev 9349)
@@ -235,11 +235,13 @@
     <ClCompile Include="ExpressionFunctionSession.cpp" />
     <ClCompile Include="ExpressionFunctionUrlEncode.cpp" />
     <ClCompile Include="ExpressionHelper.cpp" />
+    <ClCompile Include="FdoEvaluator.cpp" />
     <ClCompile Include="LineBuffer.cpp" />
     <ClCompile Include="Matrix3D.cpp" />
     <ClCompile Include="Point2D.cpp" />
     <ClCompile Include="Point3D.cpp" />
     <ClCompile Include="PolygonUtils.cpp" />
+    <ClCompile Include="SE_Evaluator.cpp" />
     <ClCompile Include="Vector2D.cpp" />
     <ClCompile Include="Vector3D.cpp" />
     <ClCompile Include="Stylizer.cpp" />
@@ -325,11 +327,14 @@
     <ClInclude Include="ExpressionHelper.h" />
     <ClInclude Include="Bounds.h" />
     <ClInclude Include="DataValueStack.h" />
+    <ClInclude Include="FdoEvaluator.h" />
+    <ClInclude Include="FdoStylizationCommon.h" />
     <ClInclude Include="LineBuffer.h" />
     <ClInclude Include="Matrix3D.h" />
     <ClInclude Include="Point2D.h" />
     <ClInclude Include="Point3D.h" />
     <ClInclude Include="PolygonUtils.h" />
+    <ClInclude Include="SE_Evaluator.h" />
     <ClInclude Include="Vector2D.h" />
     <ClInclude Include="Vector3D.h" />
     <ClInclude Include="CSysTransformer.h" />

Modified: sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj.filters
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj.filters	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/Stylization.vcxproj.filters	2018-03-03 16:14:43 UTC (rev 9349)
@@ -283,6 +283,12 @@
     <ClCompile Include="ExpressionFunctionMapScale.cpp">
       <Filter>ExpressionEngine</Filter>
     </ClCompile>
+    <ClCompile Include="SE_Evaluator.cpp">
+      <Filter>StyleEngine</Filter>
+    </ClCompile>
+    <ClCompile Include="FdoEvaluator.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="ExpressionFunctionArgb.h">
@@ -608,6 +614,15 @@
     <ClInclude Include="ExpressionFunctionMapScale.h">
       <Filter>ExpressionEngine</Filter>
     </ClInclude>
+    <ClInclude Include="SE_Evaluator.h">
+      <Filter>StyleEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="FdoEvaluator.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="FdoStylizationCommon.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Stylization.rc" />

Modified: sandbox/jng/common_decouple/Common/Stylization/StylizationDefs.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/StylizationDefs.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/StylizationDefs.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -30,6 +30,43 @@
 #include <limits>
 #include <climits>
 
+//Matches the FGF enumeration FdoDimensionality
+enum Dimensionality
+{
+    /// X and Y dimensions are present.
+    Dimensionality_XY = 0,
+    /// Z dimension is present.
+    Dimensionality_Z  = 1,
+    /// M ('measure') dimension is present.
+    Dimensionality_M  = 2
+};
+
+//Matches the FGF enumeration FdoGeometryType
+enum GeometryType
+{
+    GeometryType_None = 0,
+    GeometryType_Point = 1,
+    GeometryType_LineString = 2,
+    GeometryType_Polygon = 3,
+    GeometryType_MultiPoint = 4,
+    GeometryType_MultiLineString = 5,
+    GeometryType_MultiPolygon = 6,
+    GeometryType_MultiGeometry = 7,
+    GeometryType_CurveString = 10,
+    GeometryType_CurvePolygon = 11,
+    GeometryType_MultiCurveString = 12,
+    GeometryType_MultiCurvePolygon = 13
+};
+
+//Matches FdoGeometryComponentType
+enum GeometryComponentType
+{
+    GeometryComponentType_LinearRing = 129,
+    GeometryComponentType_CircularArcSegment = 130,
+    GeometryComponentType_LineStringSegment = 131,
+    GeometryComponentType_Ring = 132
+};
+
 // frequently used constants
 const double M_PI180 = (M_PI / 180.0);
 const double M_180PI = (180.0 / M_PI);

Modified: sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -24,6 +24,7 @@
 #include "SE_PositioningAlgorithms.h"
 #include "SE_SymbolDefProxies.h"
 #include "FeatureTypeStyleVisitor.h"
+#include "FdoEvaluator.h"
 
 #include <algorithm>
 #include <functional>
@@ -34,8 +35,6 @@
 
 using namespace MDFMODEL_NAMESPACE;
 
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
 StylizationEngine::StylizationEngine(SE_SymbolManager* resources, SE_BufferPool* pool) :
     m_resources(resources),
     m_pool(pool),
@@ -54,7 +53,7 @@
 
 
 // TODO: Stylize one CompoundSymbol feature and label per run; investigate caching
-//       possibilities to avoid filter execution on subsequent passes
+//       possibilities to avoid filter evalution on subsequent passes
 void StylizationEngine::StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                                            MdfModel::VectorScaleRange*      range,
                                            SE_Renderer*                     se_renderer,
@@ -127,7 +126,7 @@
         //       stores a weak reference to the RS_FeatureReader's internal
         //       FdoIFeatureReader, and this internal reader is different for each
         //       pass.
-        FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(se_renderer, reader);
+        FdoEvaluator eval(se_renderer, reader);
 
         while (reader->ReadNext())
         {
@@ -136,7 +135,7 @@
                 nFeatures++;
             #endif
 
-            LineBuffer* lb = LineBufferPool::NewLineBuffer(m_pool, 8, FdoDimensionality_Z, ignoreZ);
+            LineBuffer* lb = LineBufferPool::NewLineBuffer(m_pool, 8, Dimensionality_Z, ignoreZ);
             if (!lb)
                 continue;
 
@@ -168,7 +167,7 @@
             for (size_t i=0; i<numTypeStyles; ++i)
             {
                 bool initialPass = (i == 0 && instanceRenderingPass == 0 && symbolRenderingPass == 0);
-                Stylize(reader, exec, lb, compTypeStyles[i], &seTip, &seUrl, NULL,
+                Stylize(reader, &eval, lb, compTypeStyles[i], &seTip, &seUrl, NULL,
                         initialPass, instanceRenderingPass, symbolRenderingPass,
                         nextInstanceRenderingPass, nextSymbolRenderingPass);
             }
@@ -460,7 +459,7 @@
         //       stores a weak reference to the RS_FeatureReader's internal
         //       FdoIFeatureReader, and this internal reader is different for each
         //       pass.
-        FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(se_renderer, NULL);
+        FdoEvaluator eval(se_renderer, NULL);
 
         std::auto_ptr<LineBuffer> spLB;
         size_t nPos = watermarkPosList.size();
@@ -467,7 +466,7 @@
         for (size_t posIx=0; posIx<nPos; posIx+=2)
         {
             //Get geometry
-            LineBuffer* lb = LineBufferPool::NewLineBuffer(m_pool, 8, FdoDimensionality_Z);
+            LineBuffer* lb = LineBufferPool::NewLineBuffer(m_pool, 8, Dimensionality_Z);
             spLB.reset(lb);
             lb->MoveTo(watermarkPosList[posIx], watermarkPosList[posIx+1]);
             // tell line buffer the current drawing scale (used for arc tessellation)
@@ -523,8 +522,8 @@
             // - compute the overall clip offset
 
             SE_Matrix xformScale;
-            xformScale.scale(sym->scale[0].evaluate(exec),
-                             sym->scale[1].evaluate(exec));
+            xformScale.scale(sym->scale[0].evaluate(&eval),
+                             sym->scale[1].evaluate(&eval));
 
             // The symbol geometry needs to be inverted if the y coordinate in the renderer
             // points down.  This is so that in symbol definitions y points up consistently
@@ -538,7 +537,7 @@
 
             // initialize the style evaluation context
             SE_EvalContext evalCtx;
-            evalCtx.exec = exec;
+            evalCtx.eval = &eval;
             evalCtx.mm2su = mm2suX;
             evalCtx.mm2sud = mm2sud;
             evalCtx.mm2suw = mm2suw;
@@ -555,7 +554,7 @@
 
                 // process the symbol rendering pass - negative rendering passes are
                 // rendered with pass 0
-                int symbolRenderPass = style->renderPass.evaluate(exec);
+                int symbolRenderPass = style->renderPass.evaluate(&eval);
                 if (symbolRenderPass < 0)
                     symbolRenderPass = 0;
 
@@ -636,7 +635,7 @@
                 for (size_t styIx=0; styIx<nStyles; ++styIx)
                 {
                     SE_Style* style = sym->styles[styIx];
-                    double styleClipOffsetSU = GetClipOffset(sym, style, exec, mm2suX, mm2suY);
+                    double styleClipOffsetSU = GetClipOffset(sym, style, &eval, mm2suX, mm2suY);
                     clipOffsetSU = rs_max(styleClipOffsetSU, clipOffsetSU);
                 }
 
@@ -677,8 +676,8 @@
 
             // initialize the style application context
             SE_Matrix xformTrans;
-            xformTrans.translate(sym->absOffset[0].evaluate(exec) * mm2suX,
-                                 sym->absOffset[1].evaluate(exec) * mm2suY);
+            xformTrans.translate(sym->absOffset[0].evaluate(&eval) * mm2suX,
+                                 sym->absOffset[1].evaluate(&eval) * mm2suY);
 
             SE_ApplyContext applyCtx;
             applyCtx.geometry = lb;
@@ -692,7 +691,7 @@
 
                 // process the symbol rendering pass - negative rendering passes are
                 // rendered with pass 0
-                int symbolRenderPass = style->renderPass.evaluate(exec);
+                int symbolRenderPass = style->renderPass.evaluate(&eval);
                 if (symbolRenderPass < 0)
                     symbolRenderPass = 0;
 
@@ -714,11 +713,11 @@
                 }
 
                 // TODO: why are these in the symbol instance?
-                style->rstyle->addToExclusionRegion = sym->addToExclusionRegion.evaluate(exec);
-                style->rstyle->checkExclusionRegion = sym->checkExclusionRegion.evaluate(exec);
-                style->rstyle->drawLast = sym->drawLast.evaluate(exec);
+                style->rstyle->addToExclusionRegion = sym->addToExclusionRegion.evaluate(&eval);
+                style->rstyle->checkExclusionRegion = sym->checkExclusionRegion.evaluate(&eval);
+                style->rstyle->drawLast = sym->drawLast.evaluate(&eval);
 
-                const wchar_t* positioningAlgo = sym->positioningAlgorithm.evaluate(exec);
+                const wchar_t* positioningAlgo = sym->positioningAlgorithm.evaluate(&eval);
                 if (wcslen(positioningAlgo) > 0)
                 {
                     LayoutCustomLabel(positioningAlgo, &applyCtx, style->rstyle, mm2suX);
@@ -749,7 +748,7 @@
 
 
 void StylizationEngine::Stylize(RS_FeatureReader* reader,
-                                FdoExpressionEngine* exec,
+                                SE_Evaluator* eval,
                                 LineBuffer* geometry,
                                 CompositeTypeStyle* style,
                                 SE_String* seTip,
@@ -777,17 +776,9 @@
         {
             CompositeRule* r = static_cast<CompositeRule*>(rulecoll->GetAt(i));
             const MdfString& filterstr = r->GetFilter();
-            rulecache[i].filter = NULL;
             if (!filterstr.empty())
             {
-                try
-                {
-                    rulecache[i].filter = FdoFilter::Parse(filterstr.c_str());
-                }
-                catch (FdoException* e)
-                {
-                    ProcessStylizerException(e, __LINE__, __WFILE__);
-                }
+                rulecache[i].filter = filterstr;
             }
 
             rulecache[i].legendLabel= r->GetLegendLabel();
@@ -800,18 +791,13 @@
     SE_Rule* rule = NULL;
     for (int i=0; i<nRules; ++i)
     {
-        bool match = (rules[i].filter == NULL);
+        bool match = (rules[i].filter.empty());
 
         if (!match)
         {
-            try
-            {
-                match = exec->ProcessFilter(rules[i].filter);
-            }
-            catch (FdoException* e)
-            {
-                ProcessStylizerException(e, __LINE__, __WFILE__);
-            }
+            STYLIZATION_TRY()
+                match = eval->ExecFilter(&rules[i].filter);
+            STYLIZATION_CATCH(L"StylizationEngine.Stylize")
         }
 
         if (match)
@@ -826,10 +812,10 @@
 
     // we found a valid rule - send a StartFeature notification
     RS_String rs_tip, rs_url;
-    if (seTip->expression || wcslen(seTip->getValue()) > 0)
-        rs_tip = seTip->evaluate(exec);
-    if (seUrl->expression || wcslen(seUrl->getValue()) > 0)
-        rs_url = seUrl->evaluate(exec);
+    if (!seTip->expression.empty() || wcslen(seTip->getValue()) > 0)
+        rs_tip = seTip->evaluate(eval);
+    if (!seUrl->expression.empty() || wcslen(seUrl->getValue()) > 0)
+        rs_url = seUrl->evaluate(eval);
     RS_String& rs_thm = rule->legendLabel;
     m_serenderer->StartFeature(reader, initialPass, rs_tip.empty()? NULL : &rs_tip, rs_url.empty()? NULL : &rs_url, rs_thm.empty()? NULL : &rs_thm);
 
@@ -951,7 +937,7 @@
 
         // process the instance rendering pass - negative rendering passes
         // are rendered with pass 0
-        int instanceRenderPass = sym->renderPass.evaluate(exec);
+        int instanceRenderPass = sym->renderPass.evaluate(eval);
         if (instanceRenderPass < 0)
             instanceRenderPass = 0;
 
@@ -965,29 +951,29 @@
         {
             switch (geometry->geom_type())
             {
-            case FdoGeometryType_Point:
-            case FdoGeometryType_MultiPoint:
+            case GeometryType_Point:
+            case GeometryType_MultiPoint:
                 if (sym->geomContext != SymbolInstance::gcPoint)
                     continue;
                 break;
 
-            case FdoGeometryType_LineString:
-            case FdoGeometryType_MultiLineString:
-            case FdoGeometryType_CurveString:
-            case FdoGeometryType_MultiCurveString:
+            case GeometryType_LineString:
+            case GeometryType_MultiLineString:
+            case GeometryType_CurveString:
+            case GeometryType_MultiCurveString:
                 if (sym->geomContext != SymbolInstance::gcLineString)
                     continue;
                 break;
 
-            case FdoGeometryType_Polygon:
-            case FdoGeometryType_MultiPolygon:
-            case FdoGeometryType_CurvePolygon:
-            case FdoGeometryType_MultiCurvePolygon:
+            case GeometryType_Polygon:
+            case GeometryType_MultiPolygon:
+            case GeometryType_CurvePolygon:
+            case GeometryType_MultiCurvePolygon:
                 if (sym->geomContext != SymbolInstance::gcPolygon)
                     continue;
                 break;
 
-//          case FdoGeometryType_MultiGeometry:
+//          case GeometryType_MultiGeometry:
 //              continue;
 //              break;
             }
@@ -994,8 +980,8 @@
         }
 
         SE_Matrix xformScale;
-        xformScale.scale(sym->scale[0].evaluate(exec),
-                         sym->scale[1].evaluate(exec));
+        xformScale.scale(sym->scale[0].evaluate(eval),
+                         sym->scale[1].evaluate(eval));
 
         // The symbol geometry needs to be inverted if the y coordinate in the renderer
         // points down.  This is so that in symbol definitions y points up consistently
@@ -1009,7 +995,7 @@
 
         // initialize the style evaluation context
         SE_EvalContext evalCtx;
-        evalCtx.exec = exec;
+        evalCtx.eval = eval;
         evalCtx.mm2su = mm2suX;
         evalCtx.mm2sud = mm2sud;
         evalCtx.mm2suw = mm2suw;
@@ -1027,7 +1013,7 @@
 
             // process the symbol rendering pass - negative rendering passes are
             // rendered with pass 0
-            int symbolRenderPass = style->renderPass.evaluate(exec);
+            int symbolRenderPass = style->renderPass.evaluate(eval);
             if (symbolRenderPass < 0)
                 symbolRenderPass = 0;
 
@@ -1050,7 +1036,7 @@
             // compute offset to apply to the clipping bounds
             if (bClip)
             {
-                double styleClipOffsetSU = GetClipOffset(sym, style, exec, mm2suX, mm2suY);
+                double styleClipOffsetSU = GetClipOffset(sym, style, eval, mm2suX, mm2suY);
                 clipOffsetSU = rs_max(styleClipOffsetSU, clipOffsetSU);
             }
         }
@@ -1107,7 +1093,7 @@
 
             // process the instance rendering pass - negative rendering passes are
             // rendered with pass 0
-            int instanceRenderPass = sym->renderPass.evaluate(exec);
+            int instanceRenderPass = sym->renderPass.evaluate(eval);
             if (instanceRenderPass < 0)
                 instanceRenderPass = 0;
 
@@ -1134,29 +1120,29 @@
             {
                 switch (geometry->geom_type())
                 {
-                case FdoGeometryType_Point:
-                case FdoGeometryType_MultiPoint:
+                case GeometryType_Point:
+                case GeometryType_MultiPoint:
                     if (sym->geomContext != SymbolInstance::gcPoint)
                         continue;
                     break;
 
-                case FdoGeometryType_LineString:
-                case FdoGeometryType_MultiLineString:
-                case FdoGeometryType_CurveString:
-                case FdoGeometryType_MultiCurveString:
+                case GeometryType_LineString:
+                case GeometryType_MultiLineString:
+                case GeometryType_CurveString:
+                case GeometryType_MultiCurveString:
                     if (sym->geomContext != SymbolInstance::gcLineString)
                         continue;
                     break;
 
-                case FdoGeometryType_Polygon:
-                case FdoGeometryType_MultiPolygon:
-                case FdoGeometryType_CurvePolygon:
-                case FdoGeometryType_MultiCurvePolygon:
+                case GeometryType_Polygon:
+                case GeometryType_MultiPolygon:
+                case GeometryType_CurvePolygon:
+                case GeometryType_MultiCurvePolygon:
                     if (sym->geomContext != SymbolInstance::gcPolygon)
                         continue;
                     break;
 
-//              case FdoGeometryType_MultiGeometry:
+//              case GeometryType_MultiGeometry:
 //                  continue;
 //                  break;
                 }
@@ -1167,8 +1153,8 @@
 
             // initialize the style application context
             SE_Matrix xformTrans;
-            xformTrans.translate(sym->absOffset[0].evaluate(exec) * mm2suX,
-                                 sym->absOffset[1].evaluate(exec) * mm2suY);
+            xformTrans.translate(sym->absOffset[0].evaluate(eval) * mm2suX,
+                                 sym->absOffset[1].evaluate(eval) * mm2suY);
 
             SE_ApplyContext applyCtx;
             applyCtx.geometry = lb;
@@ -1183,7 +1169,7 @@
 
                 // process the symbol rendering pass - negative rendering passes are
                 // rendered with pass 0
-                int symbolRenderPass = style->renderPass.evaluate(exec);
+                int symbolRenderPass = style->renderPass.evaluate(eval);
                 if (symbolRenderPass < 0)
                     symbolRenderPass = 0;
 
@@ -1205,11 +1191,11 @@
                 }
 
                 // TODO: why are these in the symbol instance?
-                style->rstyle->addToExclusionRegion = sym->addToExclusionRegion.evaluate(exec);
-                style->rstyle->checkExclusionRegion = sym->checkExclusionRegion.evaluate(exec);
-                style->rstyle->drawLast = sym->drawLast.evaluate(exec);
+                style->rstyle->addToExclusionRegion = sym->addToExclusionRegion.evaluate(eval);
+                style->rstyle->checkExclusionRegion = sym->checkExclusionRegion.evaluate(eval);
+                style->rstyle->drawLast = sym->drawLast.evaluate(eval);
 
-                const wchar_t* positioningAlgo = sym->positioningAlgorithm.evaluate(exec);
+                const wchar_t* positioningAlgo = sym->positioningAlgorithm.evaluate(eval);
                 if (wcslen(positioningAlgo) > 0)
                 {
                     LayoutCustomLabel(positioningAlgo, &applyCtx, style->rstyle, mm2suX);
@@ -1246,7 +1232,7 @@
 // to them does not display in the map region.  This method computes the
 // required clip offset for the supplied style.  The value returned is in
 // screen units.
-double StylizationEngine::GetClipOffset(SE_SymbolInstance* sym, SE_Style* style, FdoExpressionEngine* exec, double mm2suX, double mm2suY)
+double StylizationEngine::GetClipOffset(SE_SymbolInstance* sym, SE_Style* style, SE_Evaluator* eval, double mm2suX, double mm2suY)
 {
     double clipOffsetSU = 0.0;
 
@@ -1270,8 +1256,8 @@
                 xformStyle.rotate(ptStyle->angleRad);
 
                 // symbol instance offset
-                xformStyle.translate(sym->absOffset[0].evaluate(exec) * mm2suX,
-                                     sym->absOffset[1].evaluate(exec) * mm2suY);
+                xformStyle.translate(sym->absOffset[0].evaluate(eval) * mm2suX,
+                                     sym->absOffset[1].evaluate(eval) * mm2suY);
 
                 // compute the offset
                 for (int i=0; i<4; ++i)

Modified: sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/StylizationEngine.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -29,6 +29,7 @@
 class SE_BufferPool;
 class SE_StyleVisitor;
 class SE_ApplyContext;
+class SE_Evaluator;
 class RS_FeatureReader;
 class RS_ElevationSettings;
 class LineBuffer;
@@ -79,7 +80,7 @@
 
     // Stylizes the current feature on the reader using the supplied composite type style.
     void Stylize(RS_FeatureReader* reader,
-                 FdoExpressionEngine* exec,
+                 SE_Evaluator* eval,
                  LineBuffer* geometry,
                  CompositeTypeStyle* style,
                  SE_String* seTip,
@@ -95,7 +96,7 @@
 
 private:
     void LayoutCustomLabel(const wchar_t* positioningAlgo, SE_ApplyContext* applyCtx, SE_RenderStyle* rstyle, double mm2su);
-    double GetClipOffset(SE_SymbolInstance* sym, SE_Style* style, FdoExpressionEngine* exec, double mm2suX, double mm2suY);
+    double GetClipOffset(SE_SymbolInstance* sym, SE_Style* style, SE_Evaluator* eval, double mm2suX, double mm2suY);
 
 private:
     SE_Renderer* m_serenderer;

Modified: sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -23,10 +23,9 @@
 #include "SLDSymbols.h"
 #include "SE_StyleVisitor.h"
 #include "SE_BufferPool.h"
+#include "FdoEvaluator.h"
 #include <cmath>
 
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
 ///////////////////////////////////////////////////////////////////////////////
 void StylizationUtil::ParseColor(const MdfString& colorstr, RS_Color& rscol)
 {
@@ -124,8 +123,8 @@
 
     pSERenderer->StartLayer(NULL, NULL);
 
-    try
-    {
+    STYLIZATION_TRY()
+
         int type = FeatureTypeStyleVisitor::DetermineFeatureTypeStyle(fts);
         switch (type)
         {
@@ -187,15 +186,9 @@
             default:
                 break;
         }
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-    catch (...)
-    {
-    }
 
+    STYLIZATION_CATCH(L"StylizationUtil.DrawStylePreview")
+
     pSERenderer->EndLayer();
     pSERenderer->EndMap();
 }
@@ -517,8 +510,8 @@
     std::vector<SE_SymbolInstance*> symbolInstances;
     visitor.Convert(symbolInstances, csym);
 
-    // create an expression engine with our custom functions
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(pSERenderer, NULL);
+    // create our FDO evaluator
+    FdoEvaluator eval(pSERenderer, NULL);
 
     //-------------------------------------------------------
     // step 1 - get the preview bounds for the symbolization
@@ -525,7 +518,7 @@
     //-------------------------------------------------------
 
     RS_Bounds symBounds(DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX);
-    GetCompositeSymbolizationPreviewBounds(symbolInstances, pSERenderer, sman, exec, symBounds);
+    GetCompositeSymbolizationPreviewBounds(symbolInstances, pSERenderer, sman, &eval, symBounds);
 
     //-------------------------------------------------------
     // step 2 - bounds processing
@@ -619,7 +612,7 @@
         SE_SymbolInstance* sym = *iter;
 
         // skip labels
-        if (sym->drawLast.evaluate(exec))
+        if (sym->drawLast.evaluate(&eval))
             continue;
 
         // get the actual amount to scale the symbol instance
@@ -641,8 +634,8 @@
 
         // this time we scale by [S_si], [S_mm], and [S_a]
         SE_Matrix xformScale;
-        xformScale.scale(sym->scale[0].evaluate(exec),
-                         sym->scale[1].evaluate(exec));
+        xformScale.scale(sym->scale[0].evaluate(&eval),
+                         sym->scale[1].evaluate(&eval));
         xformScale.scale(mm2suX, mm2suY);
         xformScale.scale(scale, scale);
 
@@ -649,7 +642,7 @@
         // initialize the style evaluation context
         // NOTE: do not adjust the mm2su values by the scale factor
         SE_EvalContext evalCtx;
-        evalCtx.exec = exec;
+        evalCtx.eval = &eval;
         evalCtx.mm2su = mm2suX;
         evalCtx.mm2sud = mm2sud;
         evalCtx.mm2suw = mm2suw;
@@ -712,8 +705,8 @@
                     xformStyle.rotate(angleRad);
 
                     // symbol instance offset - must scale this by [S_mm], and [S_a]
-                    xformStyle.translate(sym->absOffset[0].evaluate(exec) * mm2suX * scale,
-                                         sym->absOffset[1].evaluate(exec) * mm2suY * scale);
+                    xformStyle.translate(sym->absOffset[0].evaluate(&eval) * mm2suX * scale,
+                                         sym->absOffset[1].evaluate(&eval) * mm2suY * scale);
 
                     // factor the translation into the transform and draw the symbol
                     xformStyle.premultiply(xformTrans);
@@ -732,7 +725,7 @@
                         case SymbolInstance::gcLineString:
                         {
                             // a horizontal line centered vertically in the preview image
-                            lb.SetGeometryType(FdoGeometryType_LineString);
+                            lb.SetGeometryType(GeometryType_LineString);
                             lb.MoveTo(x        , y + 0.5*height);
                             lb.LineTo(x + width, y + 0.5*height);
                             break;
@@ -741,7 +734,7 @@
                         case SymbolInstance::gcPolygon:
                         {
                             // a rectangle around the border of the preview image
-                            lb.SetGeometryType(FdoGeometryType_LineString);
+                            lb.SetGeometryType(GeometryType_LineString);
                             lb.MoveTo(x        , y         );
                             lb.LineTo(x + width, y         );
                             lb.LineTo(x + width, y + height);
@@ -773,7 +766,7 @@
                 {
                     // set the preview geometry to a rectangle filling the preview image
                     LineBuffer lb(5);
-                    lb.SetGeometryType(FdoGeometryType_Polygon);
+                    lb.SetGeometryType(GeometryType_Polygon);
                     lb.MoveTo(x        , y         );
                     lb.LineTo(x + width, y         );
                     lb.LineTo(x + width, y + height);
@@ -810,7 +803,7 @@
 void StylizationUtil::GetCompositeSymbolizationPreviewBounds(std::vector<SE_SymbolInstance*> symbolInstances,
                                                              SE_Renderer* pSERenderer,
                                                              SE_SymbolManager* sman,
-                                                             FdoExpressionEngine* exec,
+                                                             SE_Evaluator* eval,
                                                              RS_Bounds& bounds)
 {
     // make sure we have symbol instances
@@ -830,7 +823,7 @@
         SE_SymbolInstance* sym = *iter;
 
         // skip labels
-        if (sym->drawLast.evaluate(exec))
+        if (sym->drawLast.evaluate(eval))
             continue;
 
         // keep y pointing up while we compute the bounds
@@ -838,13 +831,13 @@
         double mm2suY = mm2suX;
 
         SE_Matrix xformScale;
-        xformScale.scale(sym->scale[0].evaluate(exec),
-                         sym->scale[1].evaluate(exec));
+        xformScale.scale(sym->scale[0].evaluate(eval),
+                         sym->scale[1].evaluate(eval));
         xformScale.scale(mm2suX, mm2suY);
 
         // initialize the style evaluation context
         SE_EvalContext evalCtx;
-        evalCtx.exec = exec;
+        evalCtx.eval = eval;
         evalCtx.mm2su = mm2suX;
         evalCtx.mm2sud = mm2sud;
         evalCtx.mm2suw = mm2suw;
@@ -888,8 +881,8 @@
                     xformStyle.rotate(ptStyle->angleRad);
 
                     // symbol instance offset
-                    xformStyle.translate(sym->absOffset[0].evaluate(exec) * mm2suX,
-                                         sym->absOffset[1].evaluate(exec) * mm2suY);
+                    xformStyle.translate(sym->absOffset[0].evaluate(eval) * mm2suX,
+                                         sym->absOffset[1].evaluate(eval) * mm2suY);
 
                     break;
                 }
@@ -982,12 +975,12 @@
     std::vector<SE_SymbolInstance*> symbolInstances;
     visitor.Convert(symbolInstances, csym);
 
-    // create an expression engine with our custom functions
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(pSERenderer, NULL);
+    // create an FDO evaluator
+    FdoEvaluator eval(pSERenderer, NULL);
 
     // calculate bounds - symbol geometries cannot use expressions, so no expression engine is needed
     RS_Bounds symBounds(DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX);
-    GetCompositeSymbolizationBoundsInternal(symbolInstances, pSERenderer, sman, exec, symBounds);
+    GetCompositeSymbolizationBoundsInternal(symbolInstances, pSERenderer, sman, &eval, symBounds);
 
     // clean up
     for (std::vector<SE_SymbolInstance*>::iterator iter = symbolInstances.begin(); iter != symbolInstances.end(); ++iter)
@@ -1005,7 +998,7 @@
 void StylizationUtil::GetCompositeSymbolizationBoundsInternal(std::vector<SE_SymbolInstance*> symbolInstances,
                                                               SE_Renderer* pSERenderer,
                                                               SE_SymbolManager* sman,
-                                                              FdoExpressionEngine* exec,
+                                                              SE_Evaluator* eval,
                                                               RS_Bounds& bounds)
 {
     // make sure we have symbol instances
@@ -1023,7 +1016,7 @@
         SE_SymbolInstance* sym = *iter;
 
         // skip labels
-        if (sym->drawLast.evaluate(exec))
+        if (sym->drawLast.evaluate(eval))
             continue;
 
         // keep y pointing up while we compute the bounds
@@ -1031,13 +1024,13 @@
         double mm2suY = mm2suX;
 
         SE_Matrix xformScale;
-        xformScale.scale(sym->scale[0].evaluate(exec),
-                         sym->scale[1].evaluate(exec));
+        xformScale.scale(sym->scale[0].evaluate(eval),
+                         sym->scale[1].evaluate(eval));
         xformScale.scale(mm2suX, mm2suY);
 
         // initialize the style evaluation context
         SE_EvalContext evalCtx;
-        evalCtx.exec = exec;
+        evalCtx.eval = eval;
         evalCtx.mm2su = mm2suX;
         evalCtx.mm2sud = mm2sud;
         evalCtx.mm2suw = mm2suw;
@@ -1071,8 +1064,8 @@
                     xformStyle.rotate(ptStyle->angleRad);
 
                     // symbol instance offset
-                    xformStyle.translate(sym->absOffset[0].evaluate(exec) * mm2suX,
-                                         sym->absOffset[1].evaluate(exec) * mm2suY);
+                    xformStyle.translate(sym->absOffset[0].evaluate(eval) * mm2suX,
+                                         sym->absOffset[1].evaluate(eval) * mm2suY);
 
                     break;
                 }

Modified: sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/StylizationUtil.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -27,6 +27,7 @@
 class Renderer;
 class SE_Renderer;
 class SE_SymbolManager;
+class SE_Evaluator;
 struct SE_SymbolInstance;
 
 // Provides helper methods for:
@@ -73,13 +74,13 @@
     static void GetCompositeSymbolizationBoundsInternal(std::vector<SE_SymbolInstance*> symbolInstances,
                                                         SE_Renderer* pSERenderer,
                                                         SE_SymbolManager* sman,
-                                                        FdoExpressionEngine* exec,
+                                                        SE_Evaluator* eval,
                                                         RS_Bounds& bounds);
 
     static void GetCompositeSymbolizationPreviewBounds(std::vector<SE_SymbolInstance*> symbolInstances,
                                                        SE_Renderer* pSERenderer,
                                                        SE_SymbolManager* sman,
-                                                       FdoExpressionEngine* exec,
+                                                       SE_Evaluator* eval,
                                                        RS_Bounds& bounds);
 };
 

Modified: sandbox/jng/common_decouple/Common/Stylization/Stylizer.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/Stylizer.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/Stylizer.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -52,21 +52,3 @@
     return NULL;
 }
 
-// Non-fatal stylizer exception logging mechanism.
-static StylizerExceptionCallback g_stylizerExceptionCallback = NULL;
-
-void SetStylizerExceptionCallback(StylizerExceptionCallback callbackFunction)
-{
-    g_stylizerExceptionCallback = callbackFunction;
-}
-
-void ProcessStylizerException(FdoException* exception, int line, wchar_t* file)
-{
-    if (NULL != g_stylizerExceptionCallback)
-    {
-        (*g_stylizerExceptionCallback)(exception, line, file);
-    }
-    exception->Release();
-}
-
-

Modified: sandbox/jng/common_decouple/Common/Stylization/Stylizer.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/Stylizer.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/Stylizer.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -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(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);

Modified: sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.cpp
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -17,11 +17,10 @@
 
 #include "stdafx.h"
 #include "ThemeParameters.h"
+#include "FdoEvaluator.h"
 
 static const wchar_t* sEmpty = L"";
 
-extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
-
 //////////////////////////////////////////////////////////////////////////////
 
 ThemeParameters* ThemeParameters::Parse(const wchar_t* expressionString)
@@ -28,14 +27,9 @@
 {
     // parse the expression and see if it consists of one of our theming functions
     FdoPtr<FdoExpression> expression;
-    try
-    {
+    STYLIZATION_TRY()
         expression = FdoExpression::Parse(expressionString);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
+    STYLIZATION_CATCH(L"ThemeParameters.Parse")
 
     FdoFunction* function = dynamic_cast<FdoFunction*>(expression.p);
     if (function != NULL)

Modified: sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.h
===================================================================
--- sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.h	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Common/Stylization/ThemeParameters.h	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,8 +20,8 @@
 
 #include "Stylization.h"
 #include "RendererStyles.h"
+#include "FdoStylizationCommon.h"
 
-
 //////////////////////////////////////////////////////////////////////////////
 class ThemeParameters
 {

Modified: sandbox/jng/common_decouple/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/jng/common_decouple/Server/src/Services/Mapping/MappingUtil.cpp	2018-03-03 15:58:31 UTC (rev 9348)
+++ sandbox/jng/common_decouple/Server/src/Services/Mapping/MappingUtil.cpp	2018-03-03 16:14:43 UTC (rev 9349)
@@ -20,6 +20,7 @@
 #include "AGGRenderer.h"
 #include "Bounds.h"
 #include "DefaultStylizer.h"
+#include "FdoEvaluator.h"
 #include "Fdo.h"
 #include "Renderer.h"
 #include "SAX2Parser.h"
@@ -1281,7 +1282,7 @@
 
 
 ///////////////////////////////////////////////////////////////////////////////
-void MgMappingUtilExceptionTrap(FdoException* except, int line, wchar_t* file)
+void MgMappingUtilExceptionTrap(FdoException* except, int line, wchar_t* file, wchar_t* methodName)
 {
     MG_TRY()
 
@@ -1296,9 +1297,11 @@
         arguments.Add(buf);
     }
 
-    mgException = new MgFdoException(L"MgStylizationUtil.ExceptionTrap", line, file, NULL, messageId, &arguments, nativeErrorCode);
+    mgException = new MgFdoException(methodName, line, file, NULL, messageId, &arguments, nativeErrorCode);
+    //Throw it to record this method in the stack trace
+    MG_THROW()
 
-    MG_CATCH(L"MgStylizationUtil.ExceptionTrap")
+    MG_CATCH(L"MgMappingUtilExceptionTrap")
 
     MgServerManager* serverManager = MgServerManager::GetInstance();
     STRING locale = (NULL == serverManager) ?
@@ -1314,7 +1317,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 void MgMappingUtil::InitializeStylizerCallback()
 {
-    SetStylizerExceptionCallback(&MgMappingUtilExceptionTrap);
+    FdoEvaluator::SetStylizerExceptionCallback(&MgMappingUtilExceptionTrap);
 }
 
 


Property changes on: sandbox/jng/common_decouple/Server/src/Services/Mapping/MappingUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
## -5,4 +5,5 ##
 /sandbox/jng/clean_json/Server/src/Services/Mapping/MappingUtil.cpp:8818-9180
 /sandbox/jng/createruntimemap/Server/src/Services/Mapping/MappingUtil.cpp:7486-7555
 /sandbox/jng/ogc/Server/src/Services/Mapping/MappingUtil.cpp:9240-9255
+/sandbox/jng/stylization_refactor/Server/src/Services/Mapping/MappingUtil.cpp:7742-7749
 /sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
\ No newline at end of property


More information about the mapguide-commits mailing list