[mapguide-commits] r9357 - in sandbox/jng/common_decouple_v2: . Common/Stylization Server/src/Services/Kml Server/src/Services/Mapping Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Mar 4 07:49:24 PST 2018


Author: jng
Date: 2018-03-04 07:49:24 -0800 (Sun, 04 Mar 2018)
New Revision: 9357

Added:
   sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.h
   sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.h
   sandbox/jng/common_decouple_v2/Common/Stylization/RS_FdoFeatureReader.h
   sandbox/jng/common_decouple_v2/Common/Stylization/RS_Types.h
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluator.h
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluatorFactory.h
Modified:
   sandbox/jng/common_decouple_v2/
   sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.h
   sandbox/jng/common_decouple_v2/Common/Stylization/ExpressionHelper.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.h
   sandbox/jng/common_decouple_v2/Common/Stylization/LabelRendererLocal.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/LineBuffer.h
   sandbox/jng/common_decouple_v2/Common/Stylization/PointAdapter.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/PointAdapter.h
   sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.h
   sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.h
   sandbox/jng/common_decouple_v2/Common/Stylization/RS_FeatureReader.h
   sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.h
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.h
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineBuffer.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineRenderer.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_PositioningAlgorithms.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_Renderer.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_StyleVisitor.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.h
   sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj
   sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj.filters
   sandbox/jng/common_decouple_v2/Common/Stylization/StylizationDefs.h
   sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.h
   sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.cpp
   sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.h
   sandbox/jng/common_decouple_v2/Common/Stylization/Stylizer.h
   sandbox/jng/common_decouple_v2/Server/src/Services/Kml/ServerKmlService.cpp
   sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/MappingUtil.cpp
   sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/RSMgFeatureReader.h
   sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/FeaturePropRenderer.cpp
   sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/ServerRenderingService.cpp
Log:
Re-work decoupling FDO from the Stylization Engine (vs how I did it previously on the stylization_refactor sandbox):
 - Use GeometryType/Dimensionality/GeometryComponentType everywhere instead of FdoGeometryType/FdoDimensionality/FdoGeometryComponentType
 - Typedef FdoInt8/16/32/64/DateTime as RS_Int8/16/32/64/DateTime respectively
 - Add RS_FdoFeatureReader (that inherits from RS_FeatureReader) to provide the GetInternalReader method. Update all existing implementations to inherit from RS_FdoFeatureReader instead.
 - Add SE_ExpressionEvaluator abstract class that provides services for evaluating expressions
 - Add SE_ExpressionEvaluatorFactory abstract class that can construct SE_ExpressionEvaluator instances
 - Replace usages of FdoExpressionEngine with SE_ExpressionEvaluator
 - Replace usages of FdoExpression with MdfString
 - Add FDO implementation of:
   - SE_ExpressionEvaluator (FdoExpressionEvaluator)
     - This does all the interaction with the FDO expression engine and the caching of Fdo filters and expressions
   - SE_ExpressionEvaluatorFactory (FdoExpressionEvaluatorFactory)
     - This creates FdoExpressionEvaluator instances
 - Ensure all consumers in the MapGuide Server pass down a FdoExpressionEvaluatorFactory where required.

Index: sandbox/jng/common_decouple_v2
===================================================================
--- sandbox/jng/common_decouple_v2	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2	2018-03-04 15:49:24 UTC (rev 9357)

Property changes on: sandbox/jng/common_decouple_v2
___________________________________________________________________
Modified: svn:mergeinfo
## -11,7 +11,7 ##
 /sandbox/jng/clean_json:8818-9180
 /sandbox/jng/cmake_v2:9259-9317
 /sandbox/jng/cmdline:9199-9217
-/sandbox/jng/common_decouple:9351-9352
+/sandbox/jng/common_decouple:9351-9352,9354
 /sandbox/jng/convenience_apis:8262-8268,8271-8363
 /sandbox/jng/coordsys_mapagent:9231-9254
 /sandbox/jng/createruntimemap:7486-7555
Modified: sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -27,7 +27,7 @@
 #include "ElevationSettings.h"
 #include "FeatureTypeStyleVisitor.h"
 #include "StylizationEngine.h"
-#include "ExpressionHelper.h"
+#include "SE_ExpressionEvaluatorFactory.h"
 #ifdef _DEBUG
 #include <cstdio>
 #endif
@@ -63,6 +63,7 @@
 void DefaultStylizer::StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                                          Renderer*                        renderer,
                                          RS_FeatureReader*                features,
+                                         SE_ExpressionEvaluatorFactory*   evFactory,
                                          CSysTransformer*                 xformer,
                                          double                           mapScale,
                                          CancelStylization                cancel,
@@ -101,7 +102,7 @@
     // composite type styles are handled by the new style engine
     if (foundComposite)
     {
-        m_styleEngine->StylizeVectorLayer(layer, scaleRange, (SE_Renderer*)renderer, features, xformer, cancel, userData);
+        m_styleEngine->StylizeVectorLayer(layer, scaleRange, evFactory, (SE_Renderer*)renderer, features, xformer, cancel, userData);
     }
     else
     {
@@ -148,7 +149,7 @@
             // draw even if we are not drawing the actual geometry
             if (maxStyles == 0)
             {
-                nFeatures = StylizeVLHelper(layer, scaleRange, renderer, features, true, xformer, cancel, userData);
+                nFeatures = StylizeVLHelper(layer, scaleRange, renderer, features, evFactory, true, xformer, cancel, userData);
             }
             else
             {
@@ -181,7 +182,7 @@
                             syms->Adopt(syms2->GetAt(i));
                     }
 
-                    nFeatures += StylizeVLHelper(layer, scaleRange, renderer, features, i==0, xformer, cancel, userData);
+                    nFeatures += StylizeVLHelper(layer, scaleRange, renderer, features, evFactory, i==0, xformer, cancel, userData);
 
                     // clear line style from each rule in the layer definition
                     for (int m=0; m<rules->GetCount(); ++m)
@@ -216,7 +217,7 @@
         else
         {
             // composite line style separation not required
-            nFeatures = StylizeVLHelper(layer, scaleRange, renderer, features, true, xformer, cancel, userData);
+            nFeatures = StylizeVLHelper(layer, scaleRange, renderer, features, evFactory, true, xformer, cancel, userData);
         }
 
         #ifdef _DEBUG
@@ -234,12 +235,13 @@
 //////////////////////////////////////////////////////////////////////////////
 void DefaultStylizer::StylizeWatermark(Renderer* renderer,
                                        MdfModel::WatermarkDefinition* watermark,
+                                       SE_ExpressionEvaluatorFactory* evFactory,
                                        int drawWidth,
                                        int drawHeight,
                                        int saveWidth,
                                        int saveHeight)
 {
-    m_styleEngine->StylizeWatermark((SE_Renderer*)renderer, watermark, drawWidth, drawHeight, saveWidth, saveHeight);
+    m_styleEngine->StylizeWatermark((SE_Renderer*)renderer, watermark, evFactory, drawWidth, drawHeight, saveWidth, saveHeight);
     m_styleEngine->ClearCache();
 }
 
@@ -249,6 +251,7 @@
                                      MdfModel::VectorScaleRange*      scaleRange,
                                      Renderer*                        renderer,
                                      RS_FeatureReader*                features,
+                                     SE_ExpressionEvaluatorFactory*   evFactory,
                                      bool                             initialPass,
                                      CSysTransformer*                 xformer,
                                      CancelStylization                cancel,
@@ -311,12 +314,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 expression evaluator with our custom functions
+    // 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);
+    std::auto_ptr<SE_ExpressionEvaluator> exec(evFactory->CreateEvaluator(renderer, features));
 
     // main loop over feature data
     int nFeatures = 0;
@@ -326,7 +329,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 +367,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, exec.get(), lb, fts, lrTip, lrUrl, elevSettings);
             }
         }
 
@@ -383,6 +386,7 @@
 void DefaultStylizer::StylizeGridLayer(MdfModel::GridLayerDefinition* layer,
                                        Renderer*                      renderer,
                                        RS_FeatureReader*              features,
+                                       SE_ExpressionEvaluatorFactory* evFactory,
                                        CSysTransformer*               layer2mapxformer,
                                        double                         mapScale,
                                        CancelStylization              cancel,
@@ -409,7 +413,7 @@
     renderer->SetBufferPool(&m_lbPool);
 
     // create an expression engine with our custom functions
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(renderer, features);
+    std::auto_ptr<SE_ExpressionEvaluator> exec(evFactory->CreateEvaluator(renderer, features));
 
     // find the FeatureTypeStyle
     MdfModel::GridColorStyle* gcs = range->GetColorStyle();
@@ -428,7 +432,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, exec.get(), raster, gcs, gss, NULL, NULL, NULL, layer2mapxformer);
 
         // need to free returned raster
         delete raster;
@@ -466,7 +470,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 +491,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;

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/DefaultStylizer.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -40,6 +40,7 @@
     STYLIZATION_API virtual void StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                                                     Renderer*                        renderer,
                                                     RS_FeatureReader*                features,
+                                                    SE_ExpressionEvaluatorFactory*   evFactory,
                                                     CSysTransformer*                 xformer,
                                                     double                           mapScale,
                                                     CancelStylization                cancel,
@@ -48,6 +49,7 @@
     STYLIZATION_API virtual void StylizeGridLayer(MdfModel::GridLayerDefinition* layer,
                                                   Renderer*                      renderer,
                                                   RS_FeatureReader*              features,
+                                                  SE_ExpressionEvaluatorFactory* evFactory,
                                                   CSysTransformer*               xformer,
                                                   double                         mapScale,
                                                   CancelStylization              cancel,
@@ -61,12 +63,13 @@
 
     STYLIZATION_API virtual void StylizeWatermark(Renderer* renderer,
                                                   MdfModel::WatermarkDefinition* watermark,
+                                                  SE_ExpressionEvaluatorFactory* evFactory,
                                                   int drawWidth,
                                                   int drawHeight,
                                                   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);
@@ -78,6 +81,7 @@
                         MdfModel::VectorScaleRange*      scaleRange,
                         Renderer*                        renderer,
                         RS_FeatureReader*                features,
+                        SE_ExpressionEvaluatorFactory*   evFactory,
                         bool                             initialPass,
                         CSysTransformer*                 xformer,
                         CancelStylization                cancel,

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/ExpressionHelper.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/ExpressionHelper.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/ExpressionHelper.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -35,11 +35,9 @@
 #include "ExpressionFunctionLookup.h"
 #include "ExpressionFunctionRange.h"
 
+#include "RS_FdoFeatureReader.h"
 
 
-#include "RS_FeatureReader.h"
-
-
 const RS_String s_Empty(L"");
 
 
@@ -115,11 +113,13 @@
 // defined by stylization.
 FdoExpressionEngine* ExpressionHelper::GetExpressionEngine(Renderer* renderer, RS_FeatureReader* reader)
 {
+    RS_FdoFeatureReader* frdr = dynamic_cast<RS_FdoFeatureReader*>(reader);
+
     // get the user-defined functions
     FdoPtr<FdoExpressionEngineFunctionCollection> userDefinedFunctions = ExpressionHelper::GetExpressionEngineFunctions(renderer, reader);
 
     // create the engine
-    FdoPtr<FdoIFeatureReader> fdoReader = reader? reader->GetInternalReader() : NULL;
+    FdoPtr<FdoIFeatureReader> fdoReader = frdr ? frdr->GetInternalReader() : NULL;
     FdoPtr<FdoClassDefinition> classDef = fdoReader? fdoReader->GetClassDefinition() : FdoClass::Create();
     FdoExpressionEngine* exec = FdoExpressionEngine::Create(fdoReader, classDef, userDefinedFunctions);
 

Added: sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.cpp	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,436 @@
+//
+//  Copyright (C) 2007-2018 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 "ExpressionHelper.h"
+#include "FdoExpressionEvaluator.h"
+
+FdoExpressionEvaluator::FdoExpressionEvaluator(Renderer * renderer, RS_FeatureReader * reader)
+{
+    m_exec = ExpressionHelper::GetExpressionEngine(renderer, reader);
+}
+
+FdoExpressionEvaluator::~FdoExpressionEvaluator()
+{
+    // 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 FdoExpressionEvaluator::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__);
+    }
+    catch (...)
+    {
+    }
+
+    return false;
+}
+
+bool FdoExpressionEvaluator::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__);
+    }
+    catch (...)
+    {
+    }
+
+    // value was expression, so not cacheable
+    return false;
+}
+
+bool FdoExpressionEvaluator::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__);
+    }
+    catch (...)
+    {
+    }
+
+    // if we are here, the value was not constant so it is not cacheable
+    return false;
+}
+
+bool FdoExpressionEvaluator::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__);
+    }
+    catch (...)
+    {
+    }
+
+    // not cacheable
+    return false;
+}
+
+bool FdoExpressionEvaluator::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__);
+            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 FdoExpressionEvaluator::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__);
+            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__);
+    }
+
+    return res;
+}
+
+void FdoExpressionEvaluator::ProcessStylizerException(FdoException* exception, int line, wchar_t* file)
+{
+
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// 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* FdoExpressionEvaluator::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;
+}

Added: sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.h	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluator.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,47 @@
+//
+//  Copyright (C) 2007-2018 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_EXPRESSIONEVALUATOR_H_
+#define FDO_EXPRESSIONEVALUATOR_H_
+
+#include "Renderer.h"
+#include "SE_ExpressionEvaluator.h"
+
+class FdoExpressionEvaluator : public SE_ExpressionEvaluator
+{
+public:
+    FdoExpressionEvaluator(Renderer* renderer, RS_FeatureReader* reader);
+    virtual ~FdoExpressionEvaluator();
+
+    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);
+private:
+    FdoExpression* ObtainFdoExpression(const MdfModel::MdfString* pExprstr);
+    void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
+
+    FdoPtr<FdoExpressionEngine> m_exec;
+    // FdoFilter cache
+    std::map<const void*, FdoFilter*> m_hFilterCache;
+    // FdoExpression cache
+    std::map<const void*, FdoExpression*> m_hExpressionCache; 
+};
+
+#endif
\ No newline at end of file

Added: sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.cpp	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,23 @@
+//
+//  Copyright (C) 2007-2018 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 "FdoExpressionEvaluator.h"
+#include "FdoExpressionEvaluatorFactory.h"
+
+STYLIZATION_API SE_ExpressionEvaluator * FdoExpressionEvaluatorFactory::CreateEvaluator(Renderer * renderer, RS_FeatureReader * reader)
+{
+    return new FdoExpressionEvaluator(renderer, reader);
+}

Added: sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.h	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/FdoExpressionEvaluatorFactory.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,29 @@
+//
+//  Copyright (C) 2007-2018 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_EXPRESSIONEVALUATORFACTORY_H_
+#define FDO_EXPRESSIONEVALUATORFACTORY_H_
+
+#include "SE_ExpressionEvaluatorFactory.h"
+
+class FdoExpressionEvaluatorFactory : public SE_ExpressionEvaluatorFactory
+{
+public:
+    STYLIZATION_API virtual SE_ExpressionEvaluator* CreateEvaluator(Renderer* renderer, RS_FeatureReader* reader);
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -21,8 +21,8 @@
 #include "SymbolVisitor.h"
 #include "SLDSymbols.h"
 #include "ExpressionHelper.h"
+#include "SE_ExpressionEvaluator.h"
 
-
 extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
 
 //////////////////////////////////////////////////////////////////////////////
@@ -86,31 +86,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_exec->EvalBoolean(exprstr, res);
 }
 
 
@@ -146,31 +123,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_exec->EvalDouble(exprstr, res);
 }
 
 
@@ -187,33 +141,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_exec->EvalString(exprstr, res);
 }
 
 
@@ -260,31 +188,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_exec->EvalColor(exprstr, rscolor);
     }
     else
     {
@@ -679,7 +583,7 @@
 void GeometryAdapter::Stylize(Renderer*                   /*renderer*/,
                               RS_FeatureReader*           /*features*/,
                               bool                        /*initialPass*/,
-                              FdoExpressionEngine*        /*exec*/,
+                              SE_ExpressionEvaluator*     /*exec*/,
                               LineBuffer*                 /*lb*/,
                               MdfModel::FeatureTypeStyle* /*style*/,
                               const MdfModel::MdfString*  /*tooltip*/,
@@ -721,7 +625,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 +637,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);
 
-    bool res = false;
-    try
-    {
-        res = m_exec->ProcessFilter(filter);
-    }
-    catch (FdoException* e)
-    {
-        ProcessStylizerException(e, __LINE__, __WFILE__);
-    }
-
-    return res;
+    return m_exec->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_v2/Common/Stylization/GeometryAdapter.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/GeometryAdapter.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -22,6 +22,7 @@
 #include "RendererStyles.h"
 #include "RS_FeatureReader.h"
 
+class SE_ExpressionEvaluator;
 class LineBuffer;
 class LineBufferPool;
 
@@ -60,7 +61,7 @@
     STYLIZATION_API virtual void Stylize(Renderer*                   renderer,
                                          RS_FeatureReader*           features,
                                          bool                        initialPass,
-                                         FdoExpressionEngine*        exec,
+                                         SE_ExpressionEvaluator*     exec,
                                          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,7 +88,7 @@
 
     double GetClipOffset(RS_LineStroke& lineStroke, double mapScale);
 
-    FdoExpressionEngine* m_exec;
+    SE_ExpressionEvaluator* m_exec;
     LineBufferPool* m_lbPool;
 
     // BOGUS:

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/LabelRendererLocal.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/LabelRendererLocal.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/LabelRendererLocal.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -95,11 +95,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 +177,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);

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/LineBuffer.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/LineBuffer.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/LineBuffer.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -86,43 +86,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 +263,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_v2/Common/Stylization/PointAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/PointAdapter.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/PointAdapter.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -20,8 +20,8 @@
 #include "PointAdapter.h"
 #include "LineBuffer.h"
 #include "FeatureTypeStyleVisitor.h"
+#include "SE_ExpressionEvaluator.h"
 
-
 //////////////////////////////////////////////////////////////////////////////
 PointAdapter::PointAdapter(LineBufferPool* lbp) : GeometryAdapter(lbp)
 {
@@ -46,7 +46,7 @@
 void PointAdapter::Stylize(Renderer*                   renderer,
                            RS_FeatureReader*           features,
                            bool                        initialPass,
-                           FdoExpressionEngine*        exec,
+                           SE_ExpressionEvaluator*     exec,
                            LineBuffer*                 geometry,
                            MdfModel::FeatureTypeStyle* style,
                            const MdfModel::MdfString*  tooltip,
@@ -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_v2/Common/Stylization/PointAdapter.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/PointAdapter.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/PointAdapter.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -29,7 +29,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_ExpressionEvaluator*     exec,
                          LineBuffer*                 geometry,
                          MdfModel::FeatureTypeStyle* style,
                          const MdfModel::MdfString*  tooltip = NULL,

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -20,8 +20,8 @@
 #include "PolygonAdapter.h"
 #include "LineBuffer.h"
 #include "FeatureTypeStyleVisitor.h"
+#include "SE_ExpressionEvaluator.h"
 
-
 //////////////////////////////////////////////////////////////////////////////
 PolygonAdapter::PolygonAdapter(LineBufferPool* lbp) : GeometryAdapter(lbp)
 {
@@ -46,7 +46,7 @@
 void PolygonAdapter::Stylize(Renderer*                   renderer,
                              RS_FeatureReader*           features,
                              bool                        initialPass,
-                             FdoExpressionEngine*        exec,
+                             SE_ExpressionEvaluator*     exec,
                              LineBuffer*                 geometry,
                              MdfModel::FeatureTypeStyle* style,
                              const MdfModel::MdfString*  tooltip,
@@ -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_v2/Common/Stylization/PolygonAdapter.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/PolygonAdapter.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -29,7 +29,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_ExpressionEvaluator*     exec,
                          LineBuffer*                 geometry,
                          MdfModel::FeatureTypeStyle* style,
                          const MdfModel::MdfString*  tooltip = NULL,

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -54,7 +54,7 @@
 void PolylineAdapter::Stylize(Renderer*                   renderer,
                               RS_FeatureReader*           features,
                               bool                        initialPass,
-                              FdoExpressionEngine*        exec,
+                              SE_ExpressionEvaluator*     exec,
                               LineBuffer*                 geometry,
                               MdfModel::FeatureTypeStyle* style,
                               const MdfModel::MdfString*  tooltip,
@@ -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_v2/Common/Stylization/PolylineAdapter.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/PolylineAdapter.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -29,7 +29,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_ExpressionEvaluator*     exec,
                          LineBuffer*                 geometry,
                          MdfModel::FeatureTypeStyle* style,
                          const MdfModel::MdfString*  tooltip = NULL,

Copied: sandbox/jng/common_decouple_v2/Common/Stylization/RS_FdoFeatureReader.h (from rev 9354, sandbox/jng/common_decouple/Common/Stylization/RS_FdoFeatureReader.h)
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/RS_FdoFeatureReader.h	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/RS_FdoFeatureReader.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,29 @@
+//
+//  Copyright (C) 2004-2018 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 RS_FDO_FEATURE_READER_H_
+#define RS_FDO_FEATURE_READER_H_
+
+#include "RS_FeatureReader.h"
+
+// Defines a feature data reader interface with access to the internal FDO feature reader
+class RS_FdoFeatureReader : public RS_FeatureReader 
+{
+public:
+    virtual FdoIFeatureReader* GetInternalReader() = 0;
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/RS_FeatureReader.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/RS_FeatureReader.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/RS_FeatureReader.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -21,7 +21,7 @@
 #include "LineBuffer.h"
 #include "CSysTransformer.h"
 #include "RS_Raster.h"
-#include <Fdo.h>
+#include "RS_Types.h"
 
 // Defines a feature data reader interface.
 class RS_FeatureReader
@@ -33,13 +33,13 @@
 
     virtual bool            IsNull         (const wchar_t* propertyName) = 0;
     virtual bool            GetBoolean     (const wchar_t* propertyName) = 0;
-    virtual FdoInt8         GetByte        (const wchar_t* propertyName) = 0;
-    virtual FdoDateTime     GetDateTime    (const wchar_t* propertyName) = 0;
+    virtual RS_Int8         GetByte        (const wchar_t* propertyName) = 0;
+    virtual RS_DateTime     GetDateTime    (const wchar_t* propertyName) = 0;
     virtual float           GetSingle      (const wchar_t* propertyName) = 0;
     virtual double          GetDouble      (const wchar_t* propertyName) = 0;
-    virtual FdoInt16        GetInt16       (const wchar_t* propertyName) = 0;
-    virtual FdoInt32        GetInt32       (const wchar_t* propertyName) = 0;
-    virtual FdoInt64        GetInt64       (const wchar_t* propertyName) = 0;
+    virtual RS_Int16        GetInt16       (const wchar_t* propertyName) = 0;
+    virtual RS_Int32        GetInt32       (const wchar_t* propertyName) = 0;
+    virtual RS_Int64        GetInt64       (const wchar_t* propertyName) = 0;
     virtual const wchar_t*  GetString      (const wchar_t* propertyName) = 0;
     virtual LineBuffer*     GetGeometry    (const wchar_t* propertyName, LineBuffer* lb, CSysTransformer* xformer) = 0;
     virtual RS_Raster*      GetRaster      (const wchar_t* propertyName) = 0;
@@ -52,8 +52,6 @@
     virtual const wchar_t*        GetRasterPropName()           = 0;
     virtual const wchar_t* const* GetIdentPropNames(int& count) = 0;
     virtual const wchar_t* const* GetPropNames     (int& count) = 0;
-
-    virtual FdoIFeatureReader* GetInternalReader() = 0;
 };
 
 #endif

Copied: sandbox/jng/common_decouple_v2/Common/Stylization/RS_Types.h (from rev 9354, sandbox/jng/common_decouple/Common/Stylization/RS_Types.h)
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/RS_Types.h	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/RS_Types.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,28 @@
+//
+//  Copyright (C) 2004-2018 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 RS_TYPES_H_
+#define RS_TYPES_H_
+
+#include "Fdo.h"
+
+typedef FdoInt8 RS_Int8;
+typedef FdoInt16 RS_Int16;
+typedef FdoInt32 RS_Int32;
+typedef FdoInt64 RS_Int64;
+typedef FdoDateTime RS_DateTime;
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -22,6 +22,7 @@
 #include "GridData.h"
 #include "GridStylizer.h"
 #include "TransformMesh.h"
+#include "SE_ExpressionEvaluator.h"
 
 //////////////////////////////////////////////////////////////////////////////
 RasterAdapter::RasterAdapter(LineBufferPool* lbp) : GeometryAdapter(lbp)
@@ -42,7 +43,7 @@
 void RasterAdapter::Stylize(Renderer*                   renderer,
                             RS_FeatureReader*           features,
                             bool                        initialPass,
-                            FdoExpressionEngine*        exec,
+                            SE_ExpressionEvaluator*     exec,
                             RS_Raster*                  raster,
                             MdfModel::GridColorStyle*   style,
                             MdfModel::GridSurfaceStyle* surfStyle,

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/RasterAdapter.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -20,6 +20,7 @@
 
 #include "GeometryAdapter.h"
 
+class SE_ExpressionEvaluator;
 class GridData;
 class GridStylizer;
 
@@ -32,7 +33,7 @@
     virtual void Stylize(Renderer*                   renderer,
                          RS_FeatureReader*           features,
                          bool                        initialPass,
-                         FdoExpressionEngine*        exec,
+                         SE_ExpressionEvaluator*     exec,
                          RS_Raster*                  raster,
                          MdfModel::GridColorStyle*   style,
                          MdfModel::GridSurfaceStyle* surfStyle = NULL,

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -134,7 +134,7 @@
 void SE_ExpressionBase::ParseColorExpression(const MdfModel::MdfString& exprstr, SE_Color& val, unsigned int defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
+    val.expression = L"";
     val.defValue.argb = defaultValue;
 
     // process any parameters in the expression
@@ -169,16 +169,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 +176,7 @@
 void SE_ExpressionBase::ParseDoubleExpression(const MdfModel::MdfString& exprstr, SE_Double& val, const double defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
+    val.expression = L"";
     val.defValue = defaultValue;
 
     // process any parameters in the expression
@@ -220,16 +211,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 +218,7 @@
 void SE_ExpressionBase::ParseIntegerExpression(const MdfModel::MdfString& exprstr, SE_Integer& val, const int defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
+    val.expression = L"";
     val.defValue = defaultValue;
 
     // process any parameters in the expression
@@ -271,16 +253,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 +260,7 @@
 void SE_ExpressionBase::ParseBooleanExpression(const MdfModel::MdfString& exprstr, SE_Boolean& val, const bool defaultValue)
 {
     // set to schema default
-    val.expression = NULL;
+    val.expression = L"";
     val.defValue = defaultValue;
 
     // process any parameters in the expression
@@ -322,16 +295,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;
 }
 
 
@@ -390,7 +354,7 @@
 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;
+    val.expression = L"";
 
     // process any parameters in the expression
     const wchar_t* defValue = ReplaceParameters(exprstr);
@@ -424,14 +388,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_v2/Common/Stylization/SE_ExpressionBase.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionBase.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -19,7 +19,7 @@
 #define SE_EXPRESSIONBASE_H_
 
 #include "Stylization.h"
-#include "ExpressionHelper.h"
+#include "SE_ExpressionEvaluator.h"
 #include <map>
 #include <string>
 
@@ -56,26 +56,22 @@
         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_ExpressionEvaluator* exec)
     {
-        if (expression)
+        if (!expression.empty())
         {
-            value.argb = defValue.argb;
-            try
+            if (!expression.empty())
             {
-                FdoPtr<FdoLiteralValue> lval = exec->Evaluate(expression);
-                value.argb = (unsigned int)ExpressionHelper::GetAsInt32(lval.p);
+                RS_Color color = RS_Color::FromARGB(defValue.argb);
+                exec->EvalColor(expression, color);
+                value.argb = color.argb();
             }
-            catch (FdoException* e)
-            {
-                e->Release();
-            }
         }
 
         // return the value
@@ -84,7 +80,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 +87,7 @@
     {
         defValue.argb = c.defValue.argb;
         value.argb = c.value.argb;
-        expression = FDO_SAFE_ADDREF(c.expression);
+        expression = c.expression;
     }
 };
 
@@ -101,25 +97,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_ExpressionEvaluator* exec)
     {
-        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;
+            exec->EvalDouble(expression, d);
+            value = d;
         }
 
         // return the value
@@ -130,7 +119,7 @@
     {
         defValue = d.defValue;
         value = d.value;
-        expression = FDO_SAFE_ADDREF(d.expression);
+        expression = d.expression;
     }
 };
 
@@ -140,25 +129,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_ExpressionEvaluator* exec)
     {
-        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;
+            exec->EvalInt32(expression, i);
+            value = i;
         }
 
         // return the value
@@ -169,7 +151,7 @@
     {
         defValue = i.defValue;
         value = i.value;
-        expression = FDO_SAFE_ADDREF(i.expression);
+        expression = i.expression;
     }
 };
 
@@ -179,25 +161,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_ExpressionEvaluator* exec)
     {
-        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;
+            exec->EvalBoolean(expression, b);
+            value = b;
         }
 
         // return the value
@@ -208,7 +183,7 @@
     {
         defValue = b.defValue;
         value = b.value;
-        expression = FDO_SAFE_ADDREF(b.expression);
+        expression = b.expression;
     }
 };
 
@@ -218,15 +193,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 +233,23 @@
         return sEmpty;
     }
 
-    SE_INLINE const wchar_t* evaluate(FdoExpressionEngine* exec)
+    SE_INLINE const wchar_t* evaluate(SE_ExpressionEvaluator* exec)
     {
-        if (expression)
+        if (!expression.empty())
         {
             delete[] value;
             value = NULL;
 
-            try
+            RS_String str;
+            exec->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 +294,7 @@
         else
             value = NULL;
 
-        expression = FDO_SAFE_ADDREF(s.expression);
+        expression = s.expression;
     }
 };
 

Added: sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluator.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluator.h	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluator.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,35 @@
+//
+//  Copyright (C) 2007-2018 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"
+
+class SE_ExpressionEvaluator
+{
+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

Added: sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluatorFactory.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluatorFactory.h	                        (rev 0)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_ExpressionEvaluatorFactory.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -0,0 +1,33 @@
+//
+//  Copyright (C) 2007-2018 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_EXPRESSIONEVALUATORFACTORY_H_
+#define SE_EXPRESSIONEVALUATORFACTORY_H_
+
+#include "Stylization.h"
+
+class Renderer;
+class SE_ExpressionEvaluator;
+class RS_FeatureReader;
+
+class SE_ExpressionEvaluatorFactory
+{
+public:
+    STYLIZATION_API virtual SE_ExpressionEvaluator* CreateEvaluator(Renderer* renderer, RS_FeatureReader* reader) = 0;
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineBuffer.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineBuffer.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineBuffer.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -301,7 +301,7 @@
         }
     }
 
-    m_xf_buf->SetGeometryType(LineBuffer::GeometryType_LineString);
+    m_xf_buf->SetGeometryType(GeometryType_LineString);
 }
 
 

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineRenderer.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_LineRenderer.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -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_v2/Common/Stylization/SE_PositioningAlgorithms.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_PositioningAlgorithms.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_PositioningAlgorithms.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -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_v2/Common/Stylization/SE_Renderer.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_Renderer.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_Renderer.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -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;
     }
 

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/SE_StyleVisitor.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_StyleVisitor.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_StyleVisitor.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -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_v2/Common/Stylization/SE_SymbolDefProxies.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -340,8 +340,8 @@
         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);

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/SE_SymbolDefProxies.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -37,7 +37,7 @@
 public:
     RS_FontEngine* fonte;
     SE_Matrix* xform;
-    FdoExpressionEngine* exec;
+    SE_ExpressionEvaluator* exec;
     SE_SymbolManager* resources;
     double mm2su;
     double mm2sud;      // number of screen units per mm device
@@ -286,16 +286,11 @@
 {
     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_v2/Common/Stylization/Stylization.vcxproj
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj	2018-03-04 15:49:24 UTC (rev 9357)
@@ -235,6 +235,8 @@
     <ClCompile Include="ExpressionFunctionSession.cpp" />
     <ClCompile Include="ExpressionFunctionUrlEncode.cpp" />
     <ClCompile Include="ExpressionHelper.cpp" />
+    <ClCompile Include="FdoExpressionEvaluator.cpp" />
+    <ClCompile Include="FdoExpressionEvaluatorFactory.cpp" />
     <ClCompile Include="LineBuffer.cpp" />
     <ClCompile Include="Matrix3D.cpp" />
     <ClCompile Include="Point2D.cpp" />
@@ -325,11 +327,17 @@
     <ClInclude Include="ExpressionHelper.h" />
     <ClInclude Include="Bounds.h" />
     <ClInclude Include="DataValueStack.h" />
+    <ClInclude Include="FdoExpressionEvaluator.h" />
+    <ClInclude Include="FdoExpressionEvaluatorFactory.h" />
     <ClInclude Include="LineBuffer.h" />
     <ClInclude Include="Matrix3D.h" />
     <ClInclude Include="Point2D.h" />
     <ClInclude Include="Point3D.h" />
     <ClInclude Include="PolygonUtils.h" />
+    <ClInclude Include="RS_FdoFeatureReader.h" />
+    <ClInclude Include="RS_Types.h" />
+    <ClInclude Include="SE_ExpressionEvaluator.h" />
+    <ClInclude Include="SE_ExpressionEvaluatorFactory.h" />
     <ClInclude Include="Vector2D.h" />
     <ClInclude Include="Vector3D.h" />
     <ClInclude Include="CSysTransformer.h" />

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj.filters
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj.filters	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/Stylization.vcxproj.filters	2018-03-04 15:49:24 UTC (rev 9357)
@@ -25,6 +25,9 @@
     <Filter Include="Shared">
       <UniqueIdentifier>{b9f208c0-414d-4567-84e7-1d2c1439bc00}</UniqueIdentifier>
     </Filter>
+    <Filter Include="FdoImpl">
+      <UniqueIdentifier>{9579ad35-429e-45c2-a0a6-63f3dc66bd9a}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="ExpressionFunctionArgb.cpp">
@@ -283,6 +286,12 @@
     <ClCompile Include="ExpressionFunctionMapScale.cpp">
       <Filter>ExpressionEngine</Filter>
     </ClCompile>
+    <ClCompile Include="FdoExpressionEvaluator.cpp">
+      <Filter>FdoImpl</Filter>
+    </ClCompile>
+    <ClCompile Include="FdoExpressionEvaluatorFactory.cpp">
+      <Filter>FdoImpl</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="ExpressionFunctionArgb.h">
@@ -608,6 +617,24 @@
     <ClInclude Include="ExpressionFunctionMapScale.h">
       <Filter>ExpressionEngine</Filter>
     </ClInclude>
+    <ClInclude Include="RS_Types.h">
+      <Filter>Interfaces</Filter>
+    </ClInclude>
+    <ClInclude Include="RS_FdoFeatureReader.h">
+      <Filter>Interfaces</Filter>
+    </ClInclude>
+    <ClInclude Include="SE_ExpressionEvaluator.h">
+      <Filter>StyleEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="SE_ExpressionEvaluatorFactory.h">
+      <Filter>StyleEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="FdoExpressionEvaluator.h">
+      <Filter>FdoImpl</Filter>
+    </ClInclude>
+    <ClInclude Include="FdoExpressionEvaluatorFactory.h">
+      <Filter>FdoImpl</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Stylization.rc" />

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/StylizationDefs.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/StylizationDefs.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/StylizationDefs.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -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_v2/Common/Stylization/StylizationEngine.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -24,6 +24,7 @@
 #include "SE_PositioningAlgorithms.h"
 #include "SE_SymbolDefProxies.h"
 #include "FeatureTypeStyleVisitor.h"
+#include "SE_ExpressionEvaluatorFactory.h"
 
 #include <algorithm>
 #include <functional>
@@ -57,6 +58,7 @@
 //       possibilities to avoid filter execution on subsequent passes
 void StylizationEngine::StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                                            MdfModel::VectorScaleRange*      range,
+                                           SE_ExpressionEvaluatorFactory*   evFactory,
                                            SE_Renderer*                     se_renderer,
                                            RS_FeatureReader*                reader,
                                            CSysTransformer*                 xformer,
@@ -122,12 +124,12 @@
         if (numPasses > 1)
             reader->Reset();
 
-        // create an expression engine with our custom functions
-        // NOTE: We must create a new engine with each rendering pass.  The engine
+        // create an expression evaluator with our custom functions
+        // NOTE: We must create a new evaluator with each rendering pass.  The evaluator
         //       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);
+        std::auto_ptr<SE_ExpressionEvaluator> exec(evFactory->CreateEvaluator(se_renderer, reader));
 
         while (reader->ReadNext())
         {
@@ -136,7 +138,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 +170,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, exec.get(), lb, compTypeStyles[i], &seTip, &seUrl, NULL,
                         initialPass, instanceRenderingPass, symbolRenderingPass,
                         nextInstanceRenderingPass, nextSymbolRenderingPass);
             }
@@ -242,6 +244,7 @@
 
 void StylizationEngine::StylizeWatermark(SE_Renderer* se_renderer,
                                          WatermarkDefinition* watermark,
+                                         SE_ExpressionEvaluatorFactory* evFactory,
                                          int drawWidth, int drawHeight,
                                          int saveWidth, int saveHeight)
 {
@@ -455,12 +458,13 @@
     {
         ++numPasses;
 
-        // create an expression engine with our custom functions
-        // NOTE: We must create a new engine with each rendering pass.  The engine
+        // create an expression evaluator with our custom functions
+        // NOTE: We must create a new evaluator with each rendering pass.  The evaluator
         //       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);
+        std::auto_ptr<SE_ExpressionEvaluator> spExec(evFactory->CreateEvaluator(se_renderer, NULL));
+        SE_ExpressionEvaluator* exec = spExec.get();
 
         std::auto_ptr<LineBuffer> spLB;
         size_t nPos = watermarkPosList.size();
@@ -467,7 +471,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)
@@ -749,7 +753,7 @@
 
 
 void StylizationEngine::Stylize(RS_FeatureReader* reader,
-                                FdoExpressionEngine* exec,
+                                SE_ExpressionEvaluator* exec,
                                 LineBuffer* geometry,
                                 CompositeTypeStyle* style,
                                 SE_String* seTip,
@@ -777,17 +781,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,13 +796,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);
+                match = exec->ExecFilter(&rules[i].filter);
             }
             catch (FdoException* e)
             {
@@ -826,9 +822,9 @@
 
     // we found a valid rule - send a StartFeature notification
     RS_String rs_tip, rs_url;
-    if (seTip->expression || wcslen(seTip->getValue()) > 0)
+    if (!seTip->expression.empty() || wcslen(seTip->getValue()) > 0)
         rs_tip = seTip->evaluate(exec);
-    if (seUrl->expression || wcslen(seUrl->getValue()) > 0)
+    if (!seUrl->expression.empty() || wcslen(seUrl->getValue()) > 0)
         rs_url = seUrl->evaluate(exec);
     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);
@@ -965,29 +961,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;
             }
@@ -1134,29 +1130,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;
                 }
@@ -1246,7 +1242,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_ExpressionEvaluator* exec, double mm2suX, double mm2suY)
 {
     double clipOffsetSU = 0.0;
 

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/StylizationEngine.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -29,6 +29,8 @@
 class SE_BufferPool;
 class SE_StyleVisitor;
 class SE_ApplyContext;
+class SE_ExpressionEvaluator;
+class SE_ExpressionEvaluatorFactory;
 class RS_FeatureReader;
 class RS_ElevationSettings;
 class LineBuffer;
@@ -63,6 +65,7 @@
     // Stylizes the supplied layer using all composite type styles in the given scale.
     void StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                             MdfModel::VectorScaleRange*      range,
+                            SE_ExpressionEvaluatorFactory*   evFactory,
                             SE_Renderer*                     se_renderer,
                             RS_FeatureReader*                reader,
                             CSysTransformer*                 xformer,
@@ -72,6 +75,7 @@
     //Stylize the supplied watermark
     void StylizeWatermark(SE_Renderer* se_renderer,
                           WatermarkDefinition* watermark,
+                          SE_ExpressionEvaluatorFactory* evFactory,
                           int drawWidth,
                           int drawHeight,
                           int saveWidth,
@@ -79,7 +83,7 @@
 
     // Stylizes the current feature on the reader using the supplied composite type style.
     void Stylize(RS_FeatureReader* reader,
-                 FdoExpressionEngine* exec,
+                 SE_ExpressionEvaluator* exec,
                  LineBuffer* geometry,
                  CompositeTypeStyle* style,
                  SE_String* seTip,
@@ -95,7 +99,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_ExpressionEvaluator* exec, double mm2suX, double mm2suY);
 
 private:
     SE_Renderer* m_serenderer;

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -23,6 +23,7 @@
 #include "SLDSymbols.h"
 #include "SE_StyleVisitor.h"
 #include "SE_BufferPool.h"
+#include "SE_ExpressionEvaluatorFactory.h"
 #include <cmath>
 
 extern void ProcessStylizerException(FdoException* exception, int line, wchar_t* file);
@@ -91,7 +92,8 @@
                                        int themeCategory,
                                        FeatureTypeStyle* fts,
                                        SE_Renderer* pSERenderer,
-                                       SE_SymbolManager* sman)
+                                       SE_SymbolManager* sman,
+                                       SE_ExpressionEvaluatorFactory* evFactory)
 {
     if (!fts)
         return;
@@ -136,7 +138,7 @@
 
                 // render the symbolization
                 CompositeSymbolization* csym = rule->GetSymbolization();
-                StylizationUtil::RenderCompositeSymbolization(csym, pSERenderer, sman, 0.0, 0.0, imgWidth, imgHeight);
+                StylizationUtil::RenderCompositeSymbolization(csym, pSERenderer, sman, evFactory, 0.0, 0.0, imgWidth, imgHeight);
 
                 break;
             }
@@ -508,6 +510,7 @@
 void StylizationUtil::RenderCompositeSymbolization(CompositeSymbolization* csym,
                                                    SE_Renderer* pSERenderer,
                                                    SE_SymbolManager* sman,
+                                                   SE_ExpressionEvaluatorFactory* evFactory,
                                                    double x, double y,
                                                    double width, double height)
 {
@@ -518,114 +521,115 @@
     visitor.Convert(symbolInstances, csym);
 
     // create an expression engine with our custom functions
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(pSERenderer, NULL);
+    std::auto_ptr<SE_ExpressionEvaluator> spExec(evFactory->CreateEvaluator(pSERenderer, NULL));
+    {
+        SE_ExpressionEvaluator* exec = spExec.get();
+        //-------------------------------------------------------
+        // step 1 - get the preview bounds for the symbolization
+        //-------------------------------------------------------
 
-    //-------------------------------------------------------
-    // step 1 - get the preview bounds for the symbolization
-    //-------------------------------------------------------
+        RS_Bounds symBounds(DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX);
+        GetCompositeSymbolizationPreviewBounds(symbolInstances, pSERenderer, sman, exec, symBounds);
 
-    RS_Bounds symBounds(DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX);
-    GetCompositeSymbolizationPreviewBounds(symbolInstances, pSERenderer, sman, exec, symBounds);
+        //-------------------------------------------------------
+        // step 2 - bounds processing
+        //-------------------------------------------------------
 
-    //-------------------------------------------------------
-    // step 2 - bounds processing
-    //-------------------------------------------------------
+        if (!symBounds.IsValid())
+            return;
 
-    if (!symBounds.IsValid())
-        return;
+        double mm2sud = pSERenderer->GetScreenUnitsPerMillimeterDevice();
+        double mm2suw = pSERenderer->GetScreenUnitsPerMillimeterWorld();
+        double drawingScale = pSERenderer->GetDrawingScale();
+        bool yUp = pSERenderer->YPointsUp();
 
-    double mm2sud = pSERenderer->GetScreenUnitsPerMillimeterDevice();
-    double mm2suw = pSERenderer->GetScreenUnitsPerMillimeterWorld();
-    double drawingScale = pSERenderer->GetDrawingScale();
-    bool yUp = pSERenderer->YPointsUp();
+        // check for degenerate bounds
+        if (symBounds.width() == 0.0 && symBounds.height() == 0.0)
+        {
+            // make the bounds have the same width and height as the image
+            symBounds.minx -= 0.5 * width / drawingScale;
+            symBounds.maxx += 0.5 * width / drawingScale;
+            symBounds.miny -= 0.5 * height / drawingScale;
+            symBounds.maxy += 0.5 * height / drawingScale;
+        }
 
-    // check for degenerate bounds
-    if (symBounds.width() == 0.0 && symBounds.height() == 0.0)
-    {
-        // make the bounds have the same width and height as the image
-        symBounds.minx -= 0.5 * width / drawingScale;
-        symBounds.maxx += 0.5 * width / drawingScale;
-        symBounds.miny -= 0.5 * height / drawingScale;
-        symBounds.maxy += 0.5 * height / drawingScale;
-    }
+        // make the aspect ratio of the symbol bounds match that of the supplied
+        // rectangle - this is needed to properly center the symbol in the rectangle
+        double arDisplay = width / height;
+        if (symBounds.width() > symBounds.height() * arDisplay)
+        {
+            double dHeight = symBounds.width() / arDisplay - symBounds.height();
+            symBounds.miny -= 0.5*dHeight;
+            symBounds.maxy += 0.5*dHeight;
+        }
+        else
+        {
+            double dWidth = symBounds.height() * arDisplay - symBounds.width();
+            symBounds.minx -= 0.5*dWidth;
+            symBounds.maxx += 0.5*dWidth;
+        }
 
-    // make the aspect ratio of the symbol bounds match that of the supplied
-    // rectangle - this is needed to properly center the symbol in the rectangle
-    double arDisplay = width / height;
-    if (symBounds.width() > symBounds.height() * arDisplay)
-    {
-        double dHeight = symBounds.width() / arDisplay - symBounds.height();
-        symBounds.miny -= 0.5*dHeight;
-        symBounds.maxy += 0.5*dHeight;
-    }
-    else
-    {
-        double dWidth = symBounds.height() * arDisplay - symBounds.width();
-        symBounds.minx -= 0.5*dWidth;
-        symBounds.maxx += 0.5*dWidth;
-    }
+        // make the bounds slightly larger to avoid having missing pixels at the edges
+        double w = symBounds.width();
+        double h = symBounds.height();
+        symBounds.minx -= 0.00001*w;
+        symBounds.miny -= 0.00001*h;
+        symBounds.maxx += 0.00001*w;
+        symBounds.maxy += 0.00001*h;
 
-    // make the bounds slightly larger to avoid having missing pixels at the edges
-    double w = symBounds.width();
-    double h = symBounds.height();
-    symBounds.minx -= 0.00001*w;
-    symBounds.miny -= 0.00001*h;
-    symBounds.maxx += 0.00001*w;
-    symBounds.maxy += 0.00001*h;
+        //-------------------------------------------------------
+        // step 3 - pre-draw preparation
+        //-------------------------------------------------------
 
-    //-------------------------------------------------------
-    // step 3 - pre-draw preparation
-    //-------------------------------------------------------
+        // From the bounds we can compute how much to scale and translate the symbols so
+        // that they fill the supplied rectangle.  We could then apply the scaling and
+        // translation directly to the current world-to-screen transform, and if we drew
+        // the currently evaluated symbols using it they would fill the supplied rectangle.
 
-    // From the bounds we can compute how much to scale and translate the symbols so
-    // that they fill the supplied rectangle.  We could then apply the scaling and
-    // translation directly to the current world-to-screen transform, and if we drew
-    // the currently evaluated symbols using it they would fill the supplied rectangle.
+        // The problem is that any text heights, line weights, and image sizes in the
+        // currently evaluated symbols are not adjusted when we draw using this updated
+        // transform.  To fix this we need to re-evaluate the symbols using a transform
+        // which includes the scale factor from the updated world-to-screen transform.
+        //
+        // Borrowing the notation from StylizationEngine::Stylize we have:
+        //
+        //   [T_fe] [S_mm] [T_si] [R_pu] [S_si] [T_pu] {Geom}
+        //
+        // We'll add an additional scale factor [S_a] and translation [T_a] (point symbols
+        // only) as follows:
+        //
+        //   [T_a] [T_fe] [S_a] [S_mm] [T_si] [R_pu] [S_si] [T_pu] {Geom}
+        //
+        // Reworking this then gives:
+        //
+        //   [T_a] [T_fe] [T_si*] [R_pu*] [T_pu*] [S_a] [S_mm] [S_si] {Geom}
+        //
+        // where:
+        //   T_si* = symbol instance insertion offset, using offsets scaled by S_a and S_mm
+        //   R_pu* = point usage rotation, with angle accounting for y-up or y-down
+        //   T_pu* = point usage origin offset, using offsets scaled by S_a, S_mm, and S_si
 
-    // The problem is that any text heights, line weights, and image sizes in the
-    // currently evaluated symbols are not adjusted when we draw using this updated
-    // transform.  To fix this we need to re-evaluate the symbols using a transform
-    // which includes the scale factor from the updated world-to-screen transform.
-    //
-    // Borrowing the notation from StylizationEngine::Stylize we have:
-    //
-    //   [T_fe] [S_mm] [T_si] [R_pu] [S_si] [T_pu] {Geom}
-    //
-    // We'll add an additional scale factor [S_a] and translation [T_a] (point symbols
-    // only) as follows:
-    //
-    //   [T_a] [T_fe] [S_a] [S_mm] [T_si] [R_pu] [S_si] [T_pu] {Geom}
-    //
-    // Reworking this then gives:
-    //
-    //   [T_a] [T_fe] [T_si*] [R_pu*] [T_pu*] [S_a] [S_mm] [S_si] {Geom}
-    //
-    // where:
-    //   T_si* = symbol instance insertion offset, using offsets scaled by S_a and S_mm
-    //   R_pu* = point usage rotation, with angle accounting for y-up or y-down
-    //   T_pu* = point usage origin offset, using offsets scaled by S_a, S_mm, and S_si
+        // compute the scale factor we need to apply to the symbols to ensure they fully
+        // display in the preview
+        double scaleF = width / (drawingScale * symBounds.width());
 
-    // compute the scale factor we need to apply to the symbols to ensure they fully
-    // display in the preview
-    double scaleF = width / (drawingScale * symBounds.width());
+        //-------------------------------------------------------
+        // step 4 - re-evaluate and draw all the symbol instances
+        //-------------------------------------------------------
 
-    //-------------------------------------------------------
-    // step 4 - re-evaluate and draw all the symbol instances
-    //-------------------------------------------------------
+        for (std::vector<SE_SymbolInstance*>::const_iterator iter = symbolInstances.begin(); iter != symbolInstances.end(); ++iter)
+        {
+            // one per symbol instance
+            SE_SymbolInstance* sym = *iter;
 
-    for (std::vector<SE_SymbolInstance*>::const_iterator iter = symbolInstances.begin(); iter != symbolInstances.end(); ++iter)
-    {
-        // one per symbol instance
-        SE_SymbolInstance* sym = *iter;
+            // skip labels
+            if (sym->drawLast.evaluate(exec))
+                continue;
 
-        // skip labels
-        if (sym->drawLast.evaluate(exec))
-            continue;
-
-        // get the actual amount to scale the symbol instance
-        double scale = scaleF;
-        switch (sym->geomContext)
-        {
+            // get the actual amount to scale the symbol instance
+            double scale = scaleF;
+            switch (sym->geomContext)
+            {
             case SymbolInstance::gcPolygon:
             {
                 // in the case of polygon data don't scale down the area symbols
@@ -634,52 +638,52 @@
 
                 break;
             }
-        }
+            }
 
-        double mm2suX = (sym->sizeContext == MappingUnits)? mm2suw : mm2sud;
-        double mm2suY = yUp? mm2suX : -mm2suX;
+            double mm2suX = (sym->sizeContext == MappingUnits) ? mm2suw : mm2sud;
+            double mm2suY = yUp ? mm2suX : -mm2suX;
 
-        // 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(mm2suX, mm2suY);
-        xformScale.scale(scale, scale);
+            // 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(mm2suX, mm2suY);
+            xformScale.scale(scale, scale);
 
-        // initialize the style evaluation context
-        // NOTE: do not adjust the mm2su values by the scale factor
-        SE_EvalContext evalCtx;
-        evalCtx.exec = exec;
-        evalCtx.mm2su = mm2suX;
-        evalCtx.mm2sud = mm2sud;
-        evalCtx.mm2suw = mm2suw;
-        evalCtx.px2su = pSERenderer->GetScreenUnitsPerPixel();
-        evalCtx.pool = pool;
-        evalCtx.fonte = pSERenderer->GetRSFontEngine();
-        evalCtx.xform = &xformScale;
-        evalCtx.resources = sman;
+            // initialize the style evaluation context
+            // NOTE: do not adjust the mm2su values by the scale factor
+            SE_EvalContext evalCtx;
+            evalCtx.exec = exec;
+            evalCtx.mm2su = mm2suX;
+            evalCtx.mm2sud = mm2sud;
+            evalCtx.mm2suw = mm2suw;
+            evalCtx.px2su = pSERenderer->GetScreenUnitsPerPixel();
+            evalCtx.pool = pool;
+            evalCtx.fonte = pSERenderer->GetRSFontEngine();
+            evalCtx.xform = &xformScale;
+            evalCtx.resources = sman;
 
-        // initialize the style application context
-        SE_Matrix xform;
-        SE_ApplyContext applyCtx;
-        applyCtx.geometry = NULL;   // gets set below
-        applyCtx.renderer = pSERenderer;
-        applyCtx.xform = &xform;
-        applyCtx.sizeContext = sym->sizeContext;
+            // initialize the style application context
+            SE_Matrix xform;
+            SE_ApplyContext applyCtx;
+            applyCtx.geometry = NULL;   // gets set below
+            applyCtx.renderer = pSERenderer;
+            applyCtx.xform = &xform;
+            applyCtx.sizeContext = sym->sizeContext;
 
-        for (std::vector<SE_Style*>::const_iterator siter = sym->styles.begin(); siter != sym->styles.end(); ++siter)
-        {
-            // have one style per simple symbol definition
-            SE_Style* style = *siter;
+            for (std::vector<SE_Style*>::const_iterator siter = sym->styles.begin(); siter != sym->styles.end(); ++siter)
+            {
+                // have one style per simple symbol definition
+                SE_Style* style = *siter;
 
-            // since the render styles are cached we need to reset these before
-            // re-evaluating the style
-            style->reset();
-            style->evaluate(&evalCtx);
+                // since the render styles are cached we need to reset these before
+                // re-evaluating the style
+                style->reset();
+                style->evaluate(&evalCtx);
 
-            SE_RenderStyle* rStyle = style->rstyle;
-            switch (rStyle->type)
-            {
+                SE_RenderStyle* rStyle = style->rstyle;
+                switch (rStyle->type)
+                {
                 case SE_RenderStyle_Point:
                 {
                     // don't call style->apply() since we do some special processing
@@ -699,7 +703,7 @@
                     // get the translation matrix which centers the symbol in the image rectangle
                     SE_Matrix xformTrans;
                     xformTrans.translate(mapCtrX, mapCtrY);
-                    xformTrans.translate(-symCtrX, yUp? -symCtrY : symCtrY);
+                    xformTrans.translate(-symCtrX, yUp ? -symCtrY : symCtrY);
 
                     // point usage offset (already scaled by [S_si], [S_mm], and [S_a])
                     SE_Matrix xformStyle;
@@ -713,7 +717,7 @@
 
                     // 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);
+                        sym->absOffset[1].evaluate(exec) * mm2suY * scale);
 
                     // factor the translation into the transform and draw the symbol
                     xformStyle.premultiply(xformTrans);
@@ -728,28 +732,28 @@
                     LineBuffer lb(5);
                     switch (sym->geomContext)
                     {
-                        case SymbolInstance::gcUnspecified:
-                        case SymbolInstance::gcLineString:
-                        {
-                            // a horizontal line centered vertically in the preview image
-                            lb.SetGeometryType(FdoGeometryType_LineString);
-                            lb.MoveTo(x        , y + 0.5*height);
-                            lb.LineTo(x + width, y + 0.5*height);
-                            break;
-                        }
+                    case SymbolInstance::gcUnspecified:
+                    case SymbolInstance::gcLineString:
+                    {
+                        // a horizontal line centered vertically in the preview image
+                        lb.SetGeometryType(GeometryType_LineString);
+                        lb.MoveTo(x, y + 0.5*height);
+                        lb.LineTo(x + width, y + 0.5*height);
+                        break;
+                    }
 
-                        case SymbolInstance::gcPolygon:
-                        {
-                            // a rectangle around the border of the preview image
-                            lb.SetGeometryType(FdoGeometryType_LineString);
-                            lb.MoveTo(x        , y         );
-                            lb.LineTo(x + width, y         );
-                            lb.LineTo(x + width, y + height);
-                            lb.LineTo(x        , y + height);
-                            lb.Close();
-                            break;
-                        }
+                    case SymbolInstance::gcPolygon:
+                    {
+                        // a rectangle around the border of the preview image
+                        lb.SetGeometryType(GeometryType_LineString);
+                        lb.MoveTo(x, y);
+                        lb.LineTo(x + width, y);
+                        lb.LineTo(x + width, y + height);
+                        lb.LineTo(x, y + height);
+                        lb.Close();
+                        break;
                     }
+                    }
 
                     // if the the line style uses parametric units control reconfigure
                     // it so you just get one symbol at the middle
@@ -773,11 +777,11 @@
                 {
                     // set the preview geometry to a rectangle filling the preview image
                     LineBuffer lb(5);
-                    lb.SetGeometryType(FdoGeometryType_Polygon);
-                    lb.MoveTo(x        , y         );
-                    lb.LineTo(x + width, y         );
+                    lb.SetGeometryType(GeometryType_Polygon);
+                    lb.MoveTo(x, y);
+                    lb.LineTo(x + width, y);
                     lb.LineTo(x + width, y + height);
-                    lb.LineTo(x        , y + height);
+                    lb.LineTo(x, y + height);
                     lb.Close();
 
                     // just apply the style to the preview geometry
@@ -788,10 +792,10 @@
 
                 default:
                     break;
+                }
             }
         }
     }
-
     //-------------------------------------------------------
     // step 5 - final clean up
     //-------------------------------------------------------
@@ -810,7 +814,7 @@
 void StylizationUtil::GetCompositeSymbolizationPreviewBounds(std::vector<SE_SymbolInstance*> symbolInstances,
                                                              SE_Renderer* pSERenderer,
                                                              SE_SymbolManager* sman,
-                                                             FdoExpressionEngine* exec,
+                                                             SE_ExpressionEvaluator* exec,
                                                              RS_Bounds& bounds)
 {
     // make sure we have symbol instances
@@ -974,7 +978,8 @@
 // the resource file) in order for this method to work.
 RS_Bounds StylizationUtil::GetCompositeSymbolizationBounds(CompositeSymbolization* csym,
                                                            SE_Renderer* pSERenderer,
-                                                           SE_SymbolManager* sman)
+                                                           SE_SymbolManager* sman,
+                                                           SE_ExpressionEvaluatorFactory* evFactory)
 {
     SE_BufferPool* pool = pSERenderer->GetBufferPool();
     SE_StyleVisitor visitor(sman, pool);
@@ -983,11 +988,11 @@
     visitor.Convert(symbolInstances, csym);
 
     // create an expression engine with our custom functions
-    FdoPtr<FdoExpressionEngine> exec = ExpressionHelper::GetExpressionEngine(pSERenderer, NULL);
+    std::auto_ptr<SE_ExpressionEvaluator> exec(evFactory->CreateEvaluator(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, exec.get(), symBounds);
 
     // clean up
     for (std::vector<SE_SymbolInstance*>::iterator iter = symbolInstances.begin(); iter != symbolInstances.end(); ++iter)
@@ -1005,7 +1010,7 @@
 void StylizationUtil::GetCompositeSymbolizationBoundsInternal(std::vector<SE_SymbolInstance*> symbolInstances,
                                                               SE_Renderer* pSERenderer,
                                                               SE_SymbolManager* sman,
-                                                              FdoExpressionEngine* exec,
+                                                              SE_ExpressionEvaluator* exec,
                                                               RS_Bounds& bounds)
 {
     // make sure we have symbol instances

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/StylizationUtil.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -27,6 +27,8 @@
 class Renderer;
 class SE_Renderer;
 class SE_SymbolManager;
+class SE_ExpressionEvaluator;
+class SE_ExpressionEvaluatorFactory;
 struct SE_SymbolInstance;
 
 // Provides helper methods for:
@@ -39,7 +41,7 @@
     static bool ParseDouble(const MdfString& valstr, double& val);
 
     static void DrawStylePreview(int imgWidth, int imgHeight, int themeCategory, FeatureTypeStyle* fts,
-                                 SE_Renderer* pSERenderer, SE_SymbolManager* sman);
+                                 SE_Renderer* pSERenderer, SE_SymbolManager* sman, SE_ExpressionEvaluatorFactory* evFactory);
 
     static void RenderPointSymbolization(PointSymbolization2D* psym,
                                          SE_Renderer* pSERenderer,
@@ -60,12 +62,14 @@
     static void RenderCompositeSymbolization(CompositeSymbolization* csym,
                                              SE_Renderer* pSERenderer,
                                              SE_SymbolManager* sman,
+                                             SE_ExpressionEvaluatorFactory* evFactory,
                                              double x, double y,
                                              double width, double height);
 
     static RS_Bounds GetCompositeSymbolizationBounds(CompositeSymbolization* csym,
                                                      SE_Renderer* pSERenderer,
-                                                     SE_SymbolManager* sman);
+                                                     SE_SymbolManager* sman,
+                                                     SE_ExpressionEvaluatorFactory* evFactory);
 
     static double GetMaxMappingSpaceLineWidth(FeatureTypeStyle* fts, int themeCategory);
 
@@ -73,13 +77,13 @@
     static void GetCompositeSymbolizationBoundsInternal(std::vector<SE_SymbolInstance*> symbolInstances,
                                                         SE_Renderer* pSERenderer,
                                                         SE_SymbolManager* sman,
-                                                        FdoExpressionEngine* exec,
+                                                        SE_ExpressionEvaluator* exec,
                                                         RS_Bounds& bounds);
 
     static void GetCompositeSymbolizationPreviewBounds(std::vector<SE_SymbolInstance*> symbolInstances,
                                                        SE_Renderer* pSERenderer,
                                                        SE_SymbolManager* sman,
-                                                       FdoExpressionEngine* exec,
+                                                       SE_ExpressionEvaluator* exec,
                                                        RS_Bounds& bounds);
 };
 

Modified: sandbox/jng/common_decouple_v2/Common/Stylization/Stylizer.h
===================================================================
--- sandbox/jng/common_decouple_v2/Common/Stylization/Stylizer.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Common/Stylization/Stylizer.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -28,6 +28,8 @@
 class GeometryAdapter;
 class CSysTransformer;
 
+class SE_ExpressionEvaluatorFactory;
+
 ///<summary>
 ///Stylization interrupt callback -- return true to cancel stylization
 ///</summary>
@@ -48,6 +50,7 @@
     virtual void StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                                     Renderer*                        renderer,
                                     RS_FeatureReader*                features,
+                                    SE_ExpressionEvaluatorFactory*   evFactory,
                                     CSysTransformer*                 xformer,
                                     double                           mapScale,
                                     CancelStylization                cancel,
@@ -60,6 +63,7 @@
     virtual void StylizeGridLayer(MdfModel::GridLayerDefinition* layer,
                                   Renderer*                      renderer,
                                   RS_FeatureReader*              features,
+                                  SE_ExpressionEvaluatorFactory* evFactory,
                                   CSysTransformer*               xformer,
                                   double                         mapScale,
                                   CancelStylization              cancel,
@@ -80,6 +84,7 @@
     ///</summary>
     virtual void StylizeWatermark(Renderer* renderer,
                                   MdfModel::WatermarkDefinition* watermark,
+                                  SE_ExpressionEvaluatorFactory* evFactory,
                                   int drawWidth,
                                   int drawHeight,
                                   int saveWidth,
@@ -88,7 +93,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_v2/Server/src/Services/Kml/ServerKmlService.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Server/src/Services/Kml/ServerKmlService.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Server/src/Services/Kml/ServerKmlService.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -28,6 +28,7 @@
 #include "Bounds.h"
 #include "MgCSTrans.h"
 #include "SAX2Parser.h"
+#include "FdoExpressionEvaluatorFactory.h"
 
 //Zip support from DWF toolkit
 #include "dwfcore/ZipFileDescriptor.h"
@@ -492,7 +493,8 @@
             SEMgSymbolManager sman(m_svcResource);
             DefaultStylizer stylizer(&sman);
             renderer.StartLayer(&layerInfo, &fcInfo);
-            stylizer.StylizeVectorLayer(vl, &renderer, rsReader, csTrans, scale, NULL, NULL);
+            FdoExpressionEvaluatorFactory evFactory;
+            stylizer.StylizeVectorLayer(vl, &renderer, rsReader, &evFactory, csTrans, scale, NULL, NULL);
             renderer.EndLayer();
         }
     }

Modified: sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/MappingUtil.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/MappingUtil.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -33,6 +33,8 @@
 #include "TransformCache.h"
 #include "CacheManager.h"
 
+#include "FdoExpressionEvaluatorFactory.h"
+
 #include <algorithm>
 
 //For logging
@@ -380,6 +382,7 @@
     // Cache coordinate system transforms for the life of the
     // stylization operation.
     TransformCacheMap transformCache;
+    FdoExpressionEvaluatorFactory evFactory;
 
     // Get the layers' resource content in a single request by adding them to a collection
     for (int i = layers->GetCount()-1; i >= 0; i--)
@@ -581,7 +584,7 @@
                     {
                         // stylize into output format
                         dr->StartLayer(&layerInfo, &fcinfo);
-                        ds->StylizeVectorLayer(vl, dr, rsReader, xformer, scale, NULL, NULL);
+                        ds->StylizeVectorLayer(vl, dr, rsReader, &evFactory, xformer, scale, NULL, NULL);
                         dr->EndLayer();
 
                         // color extraction for RFC60 only when needed
@@ -749,7 +752,7 @@
                     {
                         //stylize grid layer
                         dr->StartLayer(&layerInfo, &fcinfo);
-                        ds->StylizeGridLayer(gl, dr, rsReader, xformer, scale, NULL, NULL);
+                        ds->StylizeGridLayer(gl, dr, rsReader, &evFactory, xformer, scale, NULL, NULL);
                         dr->EndLayer();
                     }
                 }
@@ -1223,8 +1226,9 @@
     RSMgSymbolManager rs_sman(svcResource);
     er.SetSymbolManager(&rs_sman);
 
+    FdoExpressionEvaluatorFactory evFactory;
     // draw the preview
-    StylizationUtil::DrawStylePreview(imgWidth, imgHeight, themeCategory, fts, &er, &se_sman);
+    StylizationUtil::DrawStylePreview(imgWidth, imgHeight, themeCategory, fts, &er, &se_sman, &evFactory);
 
     auto_ptr<RS_ByteData> data;
     data.reset(er.Save(format, imgWidth, imgHeight));

Modified: sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/RSMgFeatureReader.h
===================================================================
--- sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/RSMgFeatureReader.h	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Server/src/Services/Mapping/RSMgFeatureReader.h	2018-03-04 15:49:24 UTC (rev 9357)
@@ -18,7 +18,7 @@
 #ifndef RSMGFEATUREREADER_H
 #define RSMGFEATUREREADER_H
 
-#include "RS_FeatureReader.h"
+#include "RS_FdoFeatureReader.h"
 
 struct PropertyStub
 {
@@ -34,7 +34,7 @@
 class RS_InputStream;
 
 //RS_FeatureReader implementation based on an MgFeatureReader
-class MG_SERVER_MAPPING_API RSMgFeatureReader : public RS_FeatureReader
+class MG_SERVER_MAPPING_API RSMgFeatureReader : public RS_FdoFeatureReader
 {
 public:
     RSMgFeatureReader(MgFeatureReader* reader, MgFeatureService* svcFeature, MgResourceIdentifier* featResId, MgFeatureQueryOptions* options, const STRING& geomPropName);

Modified: sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/FeaturePropRenderer.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/FeaturePropRenderer.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/FeaturePropRenderer.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -95,10 +95,11 @@
         featureProps->Add(boundingBoxProperty);
     }
 
+    RS_FdoFeatureReader* frdr = dynamic_cast<RS_FdoFeatureReader*>(feature);
     //Add geometry if we're instructed to capture it
-    if (m_bCaptureGeometry)
+    if (m_bCaptureGeometry && NULL != frdr)
     {
-        FdoPtr<FdoIFeatureReader> fr = feature->GetInternalReader();
+        FdoPtr<FdoIFeatureReader> fr = frdr->GetInternalReader();
         const FdoString* geomName = m_fcInfo->geometry().c_str();
         Ptr<MgGeometryProperty> geomProp = new MgGeometryProperty();
         //Not using geometry prop name here as we want to specially denote the designated geometry value

Modified: sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/ServerRenderingService.cpp	2018-03-04 12:59:58 UTC (rev 9356)
+++ sandbox/jng/common_decouple_v2/Server/src/Services/Rendering/ServerRenderingService.cpp	2018-03-04 15:49:24 UTC (rev 9357)
@@ -31,6 +31,7 @@
 #include "TransformCache.h"
 #include "CacheManager.h"
 #include "Box2D.h"
+#include "FdoExpressionEvaluatorFactory.h"
 #include <cmath>
 
 // Profile
@@ -1929,7 +1930,8 @@
                     selRenderer->StartLayer(&layerinfo, &fcinfo);
                     //Pass current layer xformer to renderer so it can transform any bbox data
                     selRenderer->SetLayerToMapTransform(xformer);
-                    ds.StylizeVectorLayer(vl, selRenderer, rsrdr.get(), NULL, scale, StylizeThatMany, selRenderer);
+                    FdoExpressionEvaluatorFactory evFactory;
+                    ds.StylizeVectorLayer(vl, selRenderer, rsrdr.get(), &evFactory, NULL, scale, StylizeThatMany, selRenderer);
 
                     // Clear the readers in case they are reused below
                     rdr = NULL;
@@ -1996,7 +1998,7 @@
                                 rdr = m_svcFeature->SelectFeatures(featResId, vl->GetFeatureName(), options);
                                 rsrdr.reset(new RSMgFeatureReader(rdr, m_svcFeature, featResId, options, vl->GetGeometry()));
                                 selRenderer->PointTest(true);
-                                ds.StylizeVectorLayer(vl, selRenderer, rsrdr.get(), xformer, scale, StylizeThatMany, selRenderer);
+                                ds.StylizeVectorLayer(vl, selRenderer, rsrdr.get(), &evFactory, xformer, scale, StylizeThatMany, selRenderer);
 
                                 // Clear the readers
                                 rdr = NULL;
@@ -2315,6 +2317,7 @@
             pPRWsResult->SetRenderTime(MgTimerUtil::GetTime());
         }
 
+        FdoExpressionEvaluatorFactory evFactory;
         for (int i=watermarkInstances.GetCount()-1; i>=0; i--)
         {
             WatermarkInstance* instance = watermarkInstances.GetAt(i);
@@ -2359,7 +2362,7 @@
                 {
                     wdef->AdoptAppearance(instance->OrphanAppearanceOverride());
                 }
-                ds->StylizeWatermark(dr, wdef, drawWidth, drawHeight, saveWidth, saveHeight);
+                ds->StylizeWatermark(dr, wdef, &evFactory, drawWidth, drawHeight, saveWidth, saveHeight);
                 
                 if(NULL != pPRWsResult)
                 {



More information about the mapguide-commits mailing list