[mapguide-commits] r7457 - in sandbox/jng/extra_stylization_funcs: Common/Stylization Server/src/PostBuild Server/src/Services/Kml Server/src/Services/Mapping Server/src/Services/Rendering Server/src/UnitTesting UnitTest/TestData/TileService

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Apr 11 06:27:37 PDT 2013


Author: jng
Date: 2013-04-11 06:27:37 -0700 (Thu, 11 Apr 2013)
New Revision: 7457

Added:
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.h
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.h
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.h
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.h
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.h
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.h
   sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_StylizationFuncs.mdf
   sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_VotingDistrictsFunctions.ldf
Modified:
   sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionHelper.cpp
   sandbox/jng/extra_stylization_funcs/Common/Stylization/RendererStyles.h
   sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj
   sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj.filters
   sandbox/jng/extra_stylization_funcs/Server/src/PostBuild/PostBuild.mak
   sandbox/jng/extra_stylization_funcs/Server/src/Services/Kml/ServerKmlService.cpp
   sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/MappingUtil.cpp
   sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/ServerMappingService.cpp
   sandbox/jng/extra_stylization_funcs/Server/src/Services/Rendering/ServerRenderingService.cpp
   sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.cpp
   sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.h
Log:
Initial cut of implementation of extra stylization functions. This submission adds the following functions to the suite of FDO stylization expression functions:

 * HTMLCOLOR(r, g, b) - Generates a HTML color string from the given RGB values. This is a MapGuide-only stylization function.
 * FEATURESOURCE() - Returns the resource id of the Feature Source that the currently stylized feature originates from
 * LAYERDEFINITION() - Returns the resource id of the Layer Definition that the stylizer is currently using to stylize this feature
 * MAPSCALE() - Returns the scale of the currently stylized map
 * MAPCENTERX() - Returns the X coordinate of the view center of the currently stylized map
 * MAPCENTERY() - Returns the Y coordinate of the view center of the currently stylized map

All these functions return information contained within the RS_MapUIInfo, RS_LayerUIInfo and RS_FeatureClassInfo context classes, that the ExpressionHelper class injects in during stylization. Where applicable, such classes have been modified to include any missing properties, and calling code has been updated to pass in these extra missing values.

A new rendering test has been added to the test suite to render out a the voting districts test data with labels. The label is an FDO expression containing all the stylization functions in question (and the existing ones too), allowing for easy visual verification that our new/existing stylization expression functions are working as intended by looking at the rendered labels. The voting districts data store was chosen due to its low number of features, which means less clash of rendered labels.

In the process of building out the new rendering test, a defect was found in TestRenderingService setup (resource data was being set from the wrong feature sources). This submission fixes this defect as well.

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.cpp	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,91 @@
+//
+//  Copyright (C) 2007-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "ExpressionFunctionFeatureSource.h"
+#include "Foundation.h"
+
+
+ExpressionFunctionFeatureSource::ExpressionFunctionFeatureSource(const wchar_t* featureSourceId)
+{
+    m_featureSourceIdValue = FdoStringValue::Create(featureSourceId);
+    m_functionDefinition = NULL;
+}
+
+
+ExpressionFunctionFeatureSource::~ExpressionFunctionFeatureSource()
+{
+    FDO_SAFE_RELEASE(m_featureSourceIdValue);
+    FDO_SAFE_RELEASE(m_functionDefinition);
+}
+
+
+ExpressionFunctionFeatureSource* ExpressionFunctionFeatureSource::Create(const wchar_t* featureSourceId)
+{
+    return new ExpressionFunctionFeatureSource(featureSourceId);
+}
+
+
+FdoFunctionDefinition* ExpressionFunctionFeatureSource::GetFunctionDefinition()
+{
+    if (!m_functionDefinition)
+    {
+        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionFEATURESOURCE_Description");
+
+        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
+        m_functionDefinition = FdoFunctionDefinition::Create(L"FEATURESOURCE", // NOXLATE
+                                                             funcDesc.c_str(),
+                                                             FdoDataType_String,
+                                                             args,
+                                                             FdoFunctionCategoryType_String,
+                                                             false);
+    }
+
+    return FDO_SAFE_ADDREF(m_functionDefinition);
+}
+
+
+FdoLiteralValue* ExpressionFunctionFeatureSource::Evaluate(FdoLiteralValueCollection* literalValues)
+{
+    // make sure we have zero arguments
+    if (literalValues->GetCount() != 0)
+    {
+        MgResources* resources = MgResources::GetInstance();
+        assert(NULL != resources);
+
+        STRING message = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgIncorrectNumberOfArguments");
+        MgStringCollection arguments;
+        arguments.Add(L"FEATURESOURCE"); // NOXLATE
+        message = resources->FormatMessage(message, &arguments);
+
+        throw FdoExpressionException::Create(message.c_str());
+    }
+
+    return FDO_SAFE_ADDREF(m_featureSourceIdValue);
+}
+
+
+FdoExpressionEngineIFunction* ExpressionFunctionFeatureSource::CreateObject()
+{
+    return ExpressionFunctionFeatureSource::Create(m_featureSourceIdValue->GetString());
+}
+
+
+void ExpressionFunctionFeatureSource::Dispose()
+{
+    delete this;
+}

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.h	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionFeatureSource.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,51 @@
+//
+//  Copyright (C) 2007-2011 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 EXPRESSION_FUNCTION_FEATURESOURCE_H_
+#define EXPRESSION_FUNCTION_FEATURESOURCE_H_
+
+#include "Stylization.h"
+
+class ExpressionFunctionFeatureSource : public FdoExpressionEngineINonAggregateFunction
+{
+public:
+    ExpressionFunctionFeatureSource(const wchar_t* featureSourceId);
+    ~ExpressionFunctionFeatureSource();
+
+    static ExpressionFunctionFeatureSource* Create(const wchar_t* featureSourceId);
+
+    //--------------------------------------------
+    // FdoExpressionEngineINonAggregateFunction implementation
+    //--------------------------------------------
+    virtual FdoLiteralValue* Evaluate(FdoLiteralValueCollection* literalValues);
+
+    //--------------------------------------------
+    // FdoExpressionEngineIFunction implementation
+    //--------------------------------------------
+    virtual FdoFunctionDefinition* GetFunctionDefinition();
+    virtual FdoExpressionEngineIFunction* CreateObject();
+
+    //--------------------------------------------
+    // FdoIDisposable implementation
+    //--------------------------------------------
+    virtual void Dispose();
+
+private:
+    FdoStringValue* m_featureSourceIdValue;
+    FdoFunctionDefinition* m_functionDefinition;
+};
+#endif

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.cpp	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,127 @@
+//
+//  Copyright (C) 2007-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "ExpressionFunctionHtmlColor.h"
+#include "ExpressionHelper.h"
+#include "Foundation.h"
+
+
+ExpressionFunctionHtmlColor::ExpressionFunctionHtmlColor()
+{
+    m_htmlColorValue = FdoStringValue::Create();
+    m_functionDefinition = NULL;
+}
+
+
+ExpressionFunctionHtmlColor::~ExpressionFunctionHtmlColor()
+{
+    FDO_SAFE_RELEASE(m_htmlColorValue);
+    FDO_SAFE_RELEASE(m_functionDefinition);
+}
+
+
+ExpressionFunctionHtmlColor* ExpressionFunctionHtmlColor::Create()
+{
+    return new ExpressionFunctionHtmlColor();
+}
+
+
+FdoFunctionDefinition* ExpressionFunctionHtmlColor::GetFunctionDefinition()
+{
+    if (!m_functionDefinition)
+    {
+        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionHTMLCOLOR_Description");
+        STRING rValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionHTMLCOLOR_RValueDescription");
+        STRING gValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionHTMLCOLOR_GValueDescription");
+        STRING bValDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionHTMLCOLOR_BValueDescription");
+
+        FdoPtr<FdoArgumentDefinition> arg1 = FdoArgumentDefinition::Create(L"rValue", rValDesc.c_str(), FdoDataType_Int32); // NOXLATE
+        FdoPtr<FdoArgumentDefinition> arg2 = FdoArgumentDefinition::Create(L"gValue", gValDesc.c_str(), FdoDataType_Int32); // NOXLATE
+        FdoPtr<FdoArgumentDefinition> arg3 = FdoArgumentDefinition::Create(L"bValue", bValDesc.c_str(), FdoDataType_Int32); // NOXLATE
+
+        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
+        args->Add(arg1);
+        args->Add(arg2);
+        args->Add(arg3);
+
+        m_functionDefinition = FdoFunctionDefinition::Create(L"HTMLCOLOR", // NOXLATE
+                                                             funcDesc.c_str(),
+                                                             FdoDataType_Int32,
+                                                             args,
+                                                             FdoFunctionCategoryType_String,
+                                                             false);
+    }
+
+    return FDO_SAFE_ADDREF(m_functionDefinition);
+}
+
+
+FdoLiteralValue* ExpressionFunctionHtmlColor::Evaluate(FdoLiteralValueCollection* literalValues)
+{
+    // make sure we have four arguments
+    if (literalValues->GetCount() != 3)
+    {
+        MgResources* resources = MgResources::GetInstance();
+        assert(NULL != resources);
+
+        STRING message = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgIncorrectNumberOfArguments");
+        MgStringCollection arguments;
+        arguments.Add(L"HTMLCOLOR"); // NOXLATE
+        message = resources->FormatMessage(message, &arguments);
+
+        throw FdoExpressionException::Create(message.c_str());
+    }
+
+    FdoPtr<FdoLiteralValue> arg1 = literalValues->GetItem(0);
+    FdoPtr<FdoLiteralValue> arg2 = literalValues->GetItem(1);
+    FdoPtr<FdoLiteralValue> arg3 = literalValues->GetItem(2);
+
+    FdoInt32   red = ExpressionHelper::GetAsInt32(arg1);
+    FdoInt32 green = ExpressionHelper::GetAsInt32(arg2);
+    FdoInt32  blue = ExpressionHelper::GetAsInt32(arg3);
+
+    // clean up
+    red   &= 0xFF;
+    green &= 0xFF;
+    blue  &= 0xFF;
+
+    wchar_t tmp[32] = { 0 };
+    std::wstring str;
+    swprintf(tmp, L"%0.2x", red);
+    str.append(&tmp[0]);
+    swprintf(tmp, L"%0.2x", green);
+    str.append(&tmp[0]);
+    swprintf(tmp, L"%0.2x", blue);
+    str.append(&tmp[0]);
+
+    m_htmlColorValue->SetString(str.c_str());
+
+    return FDO_SAFE_ADDREF(m_htmlColorValue);
+}
+
+
+FdoExpressionEngineIFunction* ExpressionFunctionHtmlColor::CreateObject()
+{
+    return ExpressionFunctionHtmlColor::Create();
+}
+
+
+void ExpressionFunctionHtmlColor::Dispose()
+{
+    delete this;
+}

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.h	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionHtmlColor.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,52 @@
+//
+//  Copyright (C) 2007-2011 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 EXPRESSION_FUNCTION_HTMLCOLOR_H_
+#define EXPRESSION_FUNCTION_HTMLCOLOR_H_
+
+#include "Stylization.h"
+
+class ExpressionFunctionHtmlColor : public FdoExpressionEngineINonAggregateFunction
+{
+public:
+    ExpressionFunctionHtmlColor();
+    ~ExpressionFunctionHtmlColor();
+
+    static ExpressionFunctionHtmlColor* Create();
+
+    //--------------------------------------------
+    // FdoExpressionEngineINonAggregateFunction implementation
+    //--------------------------------------------
+    virtual FdoLiteralValue* Evaluate(FdoLiteralValueCollection* literalValues);
+
+    //--------------------------------------------
+    // FdoExpressionEngineIFunction implementation
+    //--------------------------------------------
+    virtual FdoFunctionDefinition* GetFunctionDefinition();
+    virtual FdoExpressionEngineIFunction* CreateObject();
+
+    //--------------------------------------------
+    // FdoIDisposable implementation
+    //--------------------------------------------
+    virtual void Dispose();
+
+private:
+    FdoStringValue* m_htmlColorValue;
+    FdoFunctionDefinition* m_functionDefinition;
+};
+
+#endif
\ No newline at end of file

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.cpp	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,91 @@
+//
+//  Copyright (C) 2007-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "ExpressionFunctionLayerDefinition.h"
+#include "Foundation.h"
+
+
+ExpressionFunctionLayerDefinition::ExpressionFunctionLayerDefinition(const wchar_t* layerDefinitionId)
+{
+    m_layerDefinitionIdValue = FdoStringValue::Create(layerDefinitionId);
+    m_functionDefinition = NULL;
+}
+
+
+ExpressionFunctionLayerDefinition::~ExpressionFunctionLayerDefinition()
+{
+    FDO_SAFE_RELEASE(m_layerDefinitionIdValue);
+    FDO_SAFE_RELEASE(m_functionDefinition);
+}
+
+
+ExpressionFunctionLayerDefinition* ExpressionFunctionLayerDefinition::Create(const wchar_t* layerDefinitionId)
+{
+    return new ExpressionFunctionLayerDefinition(layerDefinitionId);
+}
+
+
+FdoFunctionDefinition* ExpressionFunctionLayerDefinition::GetFunctionDefinition()
+{
+    if (!m_functionDefinition)
+    {
+        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionLAYERDEFINITION_Description");
+
+        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
+        m_functionDefinition = FdoFunctionDefinition::Create(L"LAYERDEFINITION", // NOXLATE
+                                                             funcDesc.c_str(),
+                                                             FdoDataType_String,
+                                                             args,
+                                                             FdoFunctionCategoryType_String,
+                                                             false);
+    }
+
+    return FDO_SAFE_ADDREF(m_functionDefinition);
+}
+
+
+FdoLiteralValue* ExpressionFunctionLayerDefinition::Evaluate(FdoLiteralValueCollection* literalValues)
+{
+    // make sure we have zero arguments
+    if (literalValues->GetCount() != 0)
+    {
+        MgResources* resources = MgResources::GetInstance();
+        assert(NULL != resources);
+
+        STRING message = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgIncorrectNumberOfArguments");
+        MgStringCollection arguments;
+        arguments.Add(L"LAYERDEFINITION"); // NOXLATE
+        message = resources->FormatMessage(message, &arguments);
+
+        throw FdoExpressionException::Create(message.c_str());
+    }
+
+    return FDO_SAFE_ADDREF(m_layerDefinitionIdValue);
+}
+
+
+FdoExpressionEngineIFunction* ExpressionFunctionLayerDefinition::CreateObject()
+{
+    return ExpressionFunctionLayerDefinition::Create(m_layerDefinitionIdValue->GetString());
+}
+
+
+void ExpressionFunctionLayerDefinition::Dispose()
+{
+    delete this;
+}

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.h	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionLayerDefinition.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,51 @@
+//
+//  Copyright (C) 2007-2011 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 EXPRESSION_FUNCTION_LAYERDEFINITION_H_
+#define EXPRESSION_FUNCTION_LAYERDEFINITION_H_
+
+#include "Stylization.h"
+
+class ExpressionFunctionLayerDefinition : public FdoExpressionEngineINonAggregateFunction
+{
+public:
+    ExpressionFunctionLayerDefinition(const wchar_t* layerDefinitionId);
+    ~ExpressionFunctionLayerDefinition();
+
+    static ExpressionFunctionLayerDefinition* Create(const wchar_t* layerDefinitionId);
+
+    //--------------------------------------------
+    // FdoExpressionEngineINonAggregateFunction implementation
+    //--------------------------------------------
+    virtual FdoLiteralValue* Evaluate(FdoLiteralValueCollection* literalValues);
+
+    //--------------------------------------------
+    // FdoExpressionEngineIFunction implementation
+    //--------------------------------------------
+    virtual FdoFunctionDefinition* GetFunctionDefinition();
+    virtual FdoExpressionEngineIFunction* CreateObject();
+
+    //--------------------------------------------
+    // FdoIDisposable implementation
+    //--------------------------------------------
+    virtual void Dispose();
+
+private:
+    FdoStringValue* m_layerDefinitionIdValue;
+    FdoFunctionDefinition* m_functionDefinition;
+};
+#endif

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.cpp	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,91 @@
+//
+//  Copyright (C) 2007-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "ExpressionFunctionMapCenterX.h"
+#include "Foundation.h"
+
+
+ExpressionFunctionMapCenterX::ExpressionFunctionMapCenterX(const double xValue)
+{
+    m_xValue = FdoDoubleValue::Create(xValue);
+    m_functionDefinition = NULL;
+}
+
+
+ExpressionFunctionMapCenterX::~ExpressionFunctionMapCenterX()
+{
+    FDO_SAFE_RELEASE(m_xValue);
+    FDO_SAFE_RELEASE(m_functionDefinition);
+}
+
+
+ExpressionFunctionMapCenterX* ExpressionFunctionMapCenterX::Create(const double xValue)
+{
+    return new ExpressionFunctionMapCenterX(xValue);
+}
+
+
+FdoFunctionDefinition* ExpressionFunctionMapCenterX::GetFunctionDefinition()
+{
+    if (!m_functionDefinition)
+    {
+        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionMAPCENTERX_Description");
+
+        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
+        m_functionDefinition = FdoFunctionDefinition::Create(L"MAPCENTERX", // NOXLATE
+                                                             funcDesc.c_str(),
+                                                             FdoDataType_Double,
+                                                             args,
+                                                             FdoFunctionCategoryType_Numeric,
+                                                             false);
+    }
+
+    return FDO_SAFE_ADDREF(m_functionDefinition);
+}
+
+
+FdoLiteralValue* ExpressionFunctionMapCenterX::Evaluate(FdoLiteralValueCollection* literalValues)
+{
+    // make sure we have zero arguments
+    if (literalValues->GetCount() != 0)
+    {
+        MgResources* resources = MgResources::GetInstance();
+        assert(NULL != resources);
+
+        STRING message = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgIncorrectNumberOfArguments");
+        MgStringCollection arguments;
+        arguments.Add(L"MAPCENTERX"); // NOXLATE
+        message = resources->FormatMessage(message, &arguments);
+
+        throw FdoExpressionException::Create(message.c_str());
+    }
+
+    return FDO_SAFE_ADDREF(m_xValue);
+}
+
+
+FdoExpressionEngineIFunction* ExpressionFunctionMapCenterX::CreateObject()
+{
+    return ExpressionFunctionMapCenterX::Create(m_xValue->GetDouble());
+}
+
+
+void ExpressionFunctionMapCenterX::Dispose()
+{
+    delete this;
+}

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.h	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterX.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,52 @@
+//
+//  Copyright (C) 2007-2011 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 EXPRESSION_FUNCTION_MAPCENTERX_H_
+#define EXPRESSION_FUNCTION_MAPCENTERX_H_
+
+#include "Stylization.h"
+
+class ExpressionFunctionMapCenterX : public FdoExpressionEngineINonAggregateFunction
+{
+public:
+    ExpressionFunctionMapCenterX(const double xValue);
+    ~ExpressionFunctionMapCenterX();
+
+    static ExpressionFunctionMapCenterX* Create(const double xValue);
+
+    //--------------------------------------------
+    // FdoExpressionEngineINonAggregateFunction implementation
+    //--------------------------------------------
+    virtual FdoLiteralValue* Evaluate(FdoLiteralValueCollection* literalValues);
+
+    //--------------------------------------------
+    // FdoExpressionEngineIFunction implementation
+    //--------------------------------------------
+    virtual FdoFunctionDefinition* GetFunctionDefinition();
+    virtual FdoExpressionEngineIFunction* CreateObject();
+
+    //--------------------------------------------
+    // FdoIDisposable implementation
+    //--------------------------------------------
+    virtual void Dispose();
+
+private:
+    FdoDoubleValue* m_xValue;
+    FdoFunctionDefinition* m_functionDefinition;
+};
+
+#endif

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.cpp	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,91 @@
+//
+//  Copyright (C) 2007-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "ExpressionFunctionMapCenterY.h"
+#include "Foundation.h"
+
+
+ExpressionFunctionMapCenterY::ExpressionFunctionMapCenterY(const double yValue)
+{
+    m_yValue = FdoDoubleValue::Create(yValue);
+    m_functionDefinition = NULL;
+}
+
+
+ExpressionFunctionMapCenterY::~ExpressionFunctionMapCenterY()
+{
+    FDO_SAFE_RELEASE(m_yValue);
+    FDO_SAFE_RELEASE(m_functionDefinition);
+}
+
+
+ExpressionFunctionMapCenterY* ExpressionFunctionMapCenterY::Create(const double yValue)
+{
+    return new ExpressionFunctionMapCenterY(yValue);
+}
+
+
+FdoFunctionDefinition* ExpressionFunctionMapCenterY::GetFunctionDefinition()
+{
+    if (!m_functionDefinition)
+    {
+        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionMAPCENTERY_Description");
+
+        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
+        m_functionDefinition = FdoFunctionDefinition::Create(L"MAPCENTERY", // NOXLATE
+                                                             funcDesc.c_str(),
+                                                             FdoDataType_Double,
+                                                             args,
+                                                             FdoFunctionCategoryType_Numeric,
+                                                             false);
+    }
+
+    return FDO_SAFE_ADDREF(m_functionDefinition);
+}
+
+
+FdoLiteralValue* ExpressionFunctionMapCenterY::Evaluate(FdoLiteralValueCollection* literalValues)
+{
+    // make sure we have zero arguments
+    if (literalValues->GetCount() != 0)
+    {
+        MgResources* resources = MgResources::GetInstance();
+        assert(NULL != resources);
+
+        STRING message = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgIncorrectNumberOfArguments");
+        MgStringCollection arguments;
+        arguments.Add(L"MAPCENTERY"); // NOXLATE
+        message = resources->FormatMessage(message, &arguments);
+
+        throw FdoExpressionException::Create(message.c_str());
+    }
+
+    return FDO_SAFE_ADDREF(m_yValue);
+}
+
+
+FdoExpressionEngineIFunction* ExpressionFunctionMapCenterY::CreateObject()
+{
+    return ExpressionFunctionMapCenterY::Create(m_yValue->GetDouble());
+}
+
+
+void ExpressionFunctionMapCenterY::Dispose()
+{
+    delete this;
+}

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.h	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapCenterY.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,52 @@
+//
+//  Copyright (C) 2007-2011 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 EXPRESSION_FUNCTION_MAPCENTERY_H_
+#define EXPRESSION_FUNCTION_MAPCENTERY_H_
+
+#include "Stylization.h"
+
+class ExpressionFunctionMapCenterY : public FdoExpressionEngineINonAggregateFunction
+{
+public:
+    ExpressionFunctionMapCenterY(const double yValue);
+    ~ExpressionFunctionMapCenterY();
+
+    static ExpressionFunctionMapCenterY* Create(const double yValue);
+
+    //--------------------------------------------
+    // FdoExpressionEngineINonAggregateFunction implementation
+    //--------------------------------------------
+    virtual FdoLiteralValue* Evaluate(FdoLiteralValueCollection* literalValues);
+
+    //--------------------------------------------
+    // FdoExpressionEngineIFunction implementation
+    //--------------------------------------------
+    virtual FdoFunctionDefinition* GetFunctionDefinition();
+    virtual FdoExpressionEngineIFunction* CreateObject();
+
+    //--------------------------------------------
+    // FdoIDisposable implementation
+    //--------------------------------------------
+    virtual void Dispose();
+
+private:
+    FdoDoubleValue* m_yValue;
+    FdoFunctionDefinition* m_functionDefinition;
+};
+
+#endif

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.cpp	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,91 @@
+//
+//  Copyright (C) 2007-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "stdafx.h"
+#include "ExpressionFunctionMapScale.h"
+#include "Foundation.h"
+
+
+ExpressionFunctionMapScale::ExpressionFunctionMapScale(const double scaleValue)
+{
+    m_scaleValue = FdoDoubleValue::Create(scaleValue);
+    m_functionDefinition = NULL;
+}
+
+
+ExpressionFunctionMapScale::~ExpressionFunctionMapScale()
+{
+    FDO_SAFE_RELEASE(m_scaleValue);
+    FDO_SAFE_RELEASE(m_functionDefinition);
+}
+
+
+ExpressionFunctionMapScale* ExpressionFunctionMapScale::Create(const double scaleValue)
+{
+    return new ExpressionFunctionMapScale(scaleValue);
+}
+
+
+FdoFunctionDefinition* ExpressionFunctionMapScale::GetFunctionDefinition()
+{
+    if (!m_functionDefinition)
+    {
+        STRING funcDesc = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgFunctionMAPSCALE_Description");
+
+        FdoPtr<FdoArgumentDefinitionCollection> args = FdoArgumentDefinitionCollection::Create();
+        m_functionDefinition = FdoFunctionDefinition::Create(L"MAPSCALE", // NOXLATE
+                                                             funcDesc.c_str(),
+                                                             FdoDataType_Double,
+                                                             args,
+                                                             FdoFunctionCategoryType_Numeric,
+                                                             false);
+    }
+
+    return FDO_SAFE_ADDREF(m_functionDefinition);
+}
+
+
+FdoLiteralValue* ExpressionFunctionMapScale::Evaluate(FdoLiteralValueCollection* literalValues)
+{
+    // make sure we have zero arguments
+    if (literalValues->GetCount() != 0)
+    {
+        MgResources* resources = MgResources::GetInstance();
+        assert(NULL != resources);
+
+        STRING message = MgUtil::GetResourceMessage(MgResources::Stylization, L"MgIncorrectNumberOfArguments");
+        MgStringCollection arguments;
+        arguments.Add(L"MAPSCALE"); // NOXLATE
+        message = resources->FormatMessage(message, &arguments);
+
+        throw FdoExpressionException::Create(message.c_str());
+    }
+
+    return FDO_SAFE_ADDREF(m_scaleValue);
+}
+
+
+FdoExpressionEngineIFunction* ExpressionFunctionMapScale::CreateObject()
+{
+    return ExpressionFunctionMapScale::Create(m_scaleValue->GetDouble());
+}
+
+
+void ExpressionFunctionMapScale::Dispose()
+{
+    delete this;
+}

Added: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.h	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionFunctionMapScale.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,52 @@
+//
+//  Copyright (C) 2007-2011 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 EXPRESSION_FUNCTION_MAPCENTERSCALE_H_
+#define EXPRESSION_FUNCTION_MAPCENTERSCALE_H_
+
+#include "Stylization.h"
+
+class ExpressionFunctionMapScale : public FdoExpressionEngineINonAggregateFunction
+{
+public:
+    ExpressionFunctionMapScale(const double scaleValue);
+    ~ExpressionFunctionMapScale();
+
+    static ExpressionFunctionMapScale* Create(const double scaleValue);
+
+    //--------------------------------------------
+    // FdoExpressionEngineINonAggregateFunction implementation
+    //--------------------------------------------
+    virtual FdoLiteralValue* Evaluate(FdoLiteralValueCollection* literalValues);
+
+    //--------------------------------------------
+    // FdoExpressionEngineIFunction implementation
+    //--------------------------------------------
+    virtual FdoFunctionDefinition* GetFunctionDefinition();
+    virtual FdoExpressionEngineIFunction* CreateObject();
+
+    //--------------------------------------------
+    // FdoIDisposable implementation
+    //--------------------------------------------
+    virtual void Dispose();
+
+private:
+    FdoDoubleValue* m_scaleValue;
+    FdoFunctionDefinition* m_functionDefinition;
+};
+
+#endif
\ No newline at end of file

Modified: sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionHelper.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionHelper.cpp	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/ExpressionHelper.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -21,14 +21,22 @@
 #include "ExpressionFunctionDecap.h"
 #include "ExpressionFunctionFeatureClass.h"
 #include "ExpressionFunctionFeatureId.h"
+#include "ExpressionFunctionFeatureSource.h"
+#include "ExpressionFunctionHtmlColor.h"
 #include "ExpressionFunctionLayerId.h"
+#include "ExpressionFunctionLayerDefinition.h"
+#include "ExpressionFunctionMapCenterX.h"
+#include "ExpressionFunctionMapCenterY.h"
 #include "ExpressionFunctionMapName.h"
+#include "ExpressionFunctionMapScale.h"
 #include "ExpressionFunctionSession.h"
 #include "ExpressionFunctionUrlEncode.h"
 #include "ExpressionFunctionIf.h"
 #include "ExpressionFunctionLookup.h"
 #include "ExpressionFunctionRange.h"
 
+
+
 #include "RS_FeatureReader.h"
 
 
@@ -45,7 +53,15 @@
     // common functions
     RS_FeatureClassInfo* featInfo = renderer? renderer->GetFeatureClassInfo() : NULL;
     const RS_String& featCls = (featInfo != NULL)? featInfo->name() : s_Empty;
+    const RS_String& featSource = (featInfo != NULL) ? featInfo->source() : s_Empty;
 
+    RS_MapUIInfo* mapInfo = renderer? renderer->GetMapInfo() : NULL;
+    RS_LayerUIInfo* layerInfo = renderer? renderer->GetLayerInfo() : NULL;
+    const double mapScale = (mapInfo != NULL) ? mapInfo->scale() : 0.0;
+    const double mapX = (mapInfo != NULL) ? mapInfo->viewx() : 0.0;
+    const double mapY = (mapInfo != NULL) ? mapInfo->viewy() : 0.0;
+    const RS_String& layerDef = (layerInfo != NULL) ? layerInfo->layerdef() : s_Empty;
+
     FdoPtr<ExpressionFunctionArgb> funcArgb = ExpressionFunctionArgb::Create();
     FdoPtr<ExpressionFunctionDecap> funcDecap = ExpressionFunctionDecap::Create();
     FdoPtr<ExpressionFunctionFeatureClass> funcFeatureClass = ExpressionFunctionFeatureClass::Create(featCls.c_str());
@@ -53,6 +69,11 @@
     FdoPtr<ExpressionFunctionIf> funcIf = ExpressionFunctionIf::Create();
     FdoPtr<ExpressionFunctionLookup> funcLookup = ExpressionFunctionLookup::Create();
     FdoPtr<ExpressionFunctionRange> funcRange = ExpressionFunctionRange::Create();
+    FdoPtr<ExpressionFunctionFeatureSource> funcFeatureSource = ExpressionFunctionFeatureSource::Create(featSource.c_str());
+    FdoPtr<ExpressionFunctionLayerDefinition> funcLayerDefinition = ExpressionFunctionLayerDefinition::Create(layerDef.c_str());
+    FdoPtr<ExpressionFunctionMapCenterX> funcMapCenterX = ExpressionFunctionMapCenterX::Create(mapX);
+    FdoPtr<ExpressionFunctionMapCenterY> funcMapCenterY = ExpressionFunctionMapCenterY::Create(mapY);
+    FdoPtr<ExpressionFunctionMapScale> funcMapScale = ExpressionFunctionMapScale::Create(mapScale);
 
     userDefinedFunctions->Add(funcIf);      // make IF the first one to optimize search in GetExpressionEngine
     userDefinedFunctions->Add(funcArgb);
@@ -61,20 +82,25 @@
     userDefinedFunctions->Add(funcUrlEncode);
     userDefinedFunctions->Add(funcLookup);
     userDefinedFunctions->Add(funcRange);
+    userDefinedFunctions->Add(funcFeatureSource);
+    userDefinedFunctions->Add(funcLayerDefinition);
+    userDefinedFunctions->Add(funcMapCenterX);
+    userDefinedFunctions->Add(funcMapCenterY);
+    userDefinedFunctions->Add(funcMapScale);
 
     // MapGuide-specific functions
 #ifndef MG_EXCLUDE_EXPRESSION_FUNCTIONS
-    RS_MapUIInfo* mapInfo = renderer? renderer->GetMapInfo() : NULL;
-    RS_LayerUIInfo* layerInfo = renderer? renderer->GetLayerInfo() : NULL;
     const RS_String& session = (  mapInfo != NULL)?   mapInfo->session() : s_Empty;
     const RS_String& mapName = (  mapInfo != NULL)?   mapInfo->name()    : s_Empty;
     const RS_String& layerId = (layerInfo != NULL)? layerInfo->guid()    : s_Empty;
 
+    FdoPtr<ExpressionFunctionHtmlColor> funcHtmlColor = ExpressionFunctionHtmlColor::Create();
     FdoPtr<ExpressionFunctionFeatureId> funcFeatureId = ExpressionFunctionFeatureId::Create(reader);
     FdoPtr<ExpressionFunctionLayerId> funcLayerId = ExpressionFunctionLayerId::Create(layerId.c_str());
     FdoPtr<ExpressionFunctionMapName> funcMapName = ExpressionFunctionMapName::Create(mapName.c_str());
     FdoPtr<ExpressionFunctionSession> funcSession = ExpressionFunctionSession::Create(session.c_str());
 
+    userDefinedFunctions->Add(funcHtmlColor);
     userDefinedFunctions->Add(funcFeatureId);
     userDefinedFunctions->Add(funcLayerId);
     userDefinedFunctions->Add(funcMapName);

Modified: sandbox/jng/extra_stylization_funcs/Common/Stylization/RendererStyles.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/RendererStyles.h	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/RendererStyles.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -582,6 +582,7 @@
 public:
     RS_LayerUIInfo() :
         m_name(L""),
+        m_layerdef(L""),
         m_guid(L""),
         m_selectable(true),
         m_visible(true),
@@ -598,6 +599,7 @@
     }
 
     RS_LayerUIInfo(const RS_String& name,
+                   const RS_String& layerdef,
                    const RS_String& guid,
                    bool             selectable,
                    bool             visible,
@@ -611,6 +613,7 @@
                    bool             hastooltips = false,
                    bool             hashyperlinks = false) :
         m_name(name),
+        m_layerdef(layerdef),
         m_guid(guid),
         m_selectable(selectable),
         m_visible(visible),
@@ -627,6 +630,7 @@
     }
 
     inline RS_String&    name()          { return m_name; }
+    inline RS_String&    layerdef()      { return m_layerdef; }
     inline RS_String&    guid()          { return m_guid; }
     inline bool&         selectable()    { return m_selectable; }
     inline bool&         visible()       { return m_visible; }
@@ -642,6 +646,7 @@
 
 private:
     RS_String m_name;
+    RS_String m_layerdef;
     RS_String m_guid;
     bool m_selectable;
     bool m_visible;
@@ -667,7 +672,10 @@
         m_guid(L""),
         m_coordsys(L""),
         m_units(L""),
-        m_bgcolor(255, 255, 255, 255)
+        m_bgcolor(255, 255, 255, 255),
+        m_viewx(0.0),
+        m_viewy(0.0),
+        m_scale(0.0)
     {
     }
 
@@ -676,13 +684,19 @@
                  const RS_String& guid,
                  const RS_String& coordsys,
                  const RS_String& units,
-                 const RS_Color&  bgcolor) :
+                 const RS_Color&  bgcolor,
+                 const double viewx = 0.0,
+                 const double viewy = 0.0,
+                 const double scale = 0.0) :
         m_session(session),
         m_name(name),
         m_guid(guid),
         m_coordsys(coordsys),
         m_units(units),
-        m_bgcolor(bgcolor)
+        m_bgcolor(bgcolor),
+        m_viewx(viewx),
+        m_viewy(viewy),
+        m_scale(scale)
     {
     }
 
@@ -692,6 +706,9 @@
     inline RS_String& coordsys() { return m_coordsys; }
     inline RS_String& units()    { return m_units; }
     inline RS_Color&  bgcolor()  { return m_bgcolor; }
+    inline double&    scale()    { return m_scale; }
+    inline double&    viewx()    { return m_viewx; }
+    inline double&    viewy()    { return m_viewy; }
 
 private:
     RS_String m_session;
@@ -700,6 +717,9 @@
     RS_String m_coordsys;
     RS_String m_units;
     RS_Color  m_bgcolor;
+    double    m_scale;
+    double    m_viewx;
+    double    m_viewy;
 };
 
 
@@ -708,12 +728,12 @@
 {
 public:
     RS_FeatureClassInfo() :
-        m_name(L"")
+        m_name(L""), m_source(L"")
     {
     }
 
-    RS_FeatureClassInfo(const RS_String& name) :
-        m_name(name)
+    RS_FeatureClassInfo(const RS_String& name, const RS_String& source) :
+        m_name(name), m_source(source)
     {
     }
 
@@ -730,8 +750,10 @@
 
     inline RS_String&              name()     { return m_name; }
     inline std::vector<RS_String>& mappings() { return m_propMappings; }
+    inline RS_String&              source()   { return m_source; }
 
 private:
+    RS_String m_source;
     RS_String m_name;
     std::vector<RS_String> m_propMappings;
 };

Modified: sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj	2013-04-11 13:27:37 UTC (rev 7457)
@@ -215,10 +215,16 @@
     <ClCompile Include="ExpressionFunctionDecap.cpp" />
     <ClCompile Include="ExpressionFunctionFeatureClass.cpp" />
     <ClCompile Include="ExpressionFunctionFeatureId.cpp" />
+    <ClCompile Include="ExpressionFunctionFeatureSource.cpp" />
+    <ClCompile Include="ExpressionFunctionHtmlColor.cpp" />
     <ClCompile Include="ExpressionFunctionIf.cpp" />
+    <ClCompile Include="ExpressionFunctionLayerDefinition.cpp" />
     <ClCompile Include="ExpressionFunctionLayerId.cpp" />
     <ClCompile Include="ExpressionFunctionLookup.cpp" />
+    <ClCompile Include="ExpressionFunctionMapCenterX.cpp" />
+    <ClCompile Include="ExpressionFunctionMapCenterY.cpp" />
     <ClCompile Include="ExpressionFunctionMapName.cpp" />
+    <ClCompile Include="ExpressionFunctionMapScale.cpp" />
     <ClCompile Include="ExpressionFunctionRange.cpp" />
     <ClCompile Include="ExpressionFunctionSession.cpp" />
     <ClCompile Include="ExpressionFunctionUrlEncode.cpp" />
@@ -297,10 +303,16 @@
     <ClInclude Include="ExpressionFunctionDecap.h" />
     <ClInclude Include="ExpressionFunctionFeatureClass.h" />
     <ClInclude Include="ExpressionFunctionFeatureId.h" />
+    <ClInclude Include="ExpressionFunctionFeatureSource.h" />
+    <ClInclude Include="ExpressionFunctionHtmlColor.h" />
     <ClInclude Include="ExpressionFunctionIf.h" />
+    <ClInclude Include="ExpressionFunctionLayerDefinition.h" />
     <ClInclude Include="ExpressionFunctionLayerId.h" />
     <ClInclude Include="ExpressionFunctionLookup.h" />
+    <ClInclude Include="ExpressionFunctionMapCenterX.h" />
+    <ClInclude Include="ExpressionFunctionMapCenterY.h" />
     <ClInclude Include="ExpressionFunctionMapName.h" />
+    <ClInclude Include="ExpressionFunctionMapScale.h" />
     <ClInclude Include="ExpressionFunctionRange.h" />
     <ClInclude Include="ExpressionFunctionSession.h" />
     <ClInclude Include="ExpressionFunctionUrlEncode.h" />

Modified: sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj.filters
===================================================================
--- sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj.filters	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Common/Stylization/Stylization.vcxproj.filters	2013-04-11 13:27:37 UTC (rev 7457)
@@ -265,6 +265,24 @@
       <Filter>Shared</Filter>
     </ClCompile>
     <ClCompile Include="ThemeParameters.cpp" />
+    <ClCompile Include="ExpressionFunctionHtmlColor.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
+    <ClCompile Include="ExpressionFunctionFeatureSource.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
+    <ClCompile Include="ExpressionFunctionLayerDefinition.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
+    <ClCompile Include="ExpressionFunctionMapCenterX.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
+    <ClCompile Include="ExpressionFunctionMapCenterY.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
+    <ClCompile Include="ExpressionFunctionMapScale.cpp">
+      <Filter>ExpressionEngine</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="ExpressionFunctionArgb.h">
@@ -572,6 +590,24 @@
     <ClInclude Include="StylizationAPI.h" />
     <ClInclude Include="StylizationDefs.h" />
     <ClInclude Include="ThemeParameters.h" />
+    <ClInclude Include="ExpressionFunctionHtmlColor.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="ExpressionFunctionFeatureSource.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="ExpressionFunctionLayerDefinition.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="ExpressionFunctionMapCenterX.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="ExpressionFunctionMapCenterY.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
+    <ClInclude Include="ExpressionFunctionMapScale.h">
+      <Filter>ExpressionEngine</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Stylization.rc" />

Modified: sandbox/jng/extra_stylization_funcs/Server/src/PostBuild/PostBuild.mak
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/PostBuild/PostBuild.mak	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/PostBuild/PostBuild.mak	2013-04-11 13:27:37 UTC (rev 7457)
@@ -164,6 +164,7 @@
         ..\..\bin\UnitTestFiles\TEST.FeatureSource \
         ..\..\bin\UnitTestFiles\TEST.sdf \
         ..\..\bin\UnitTestFiles\UT_BaseMap.mdf \
+		..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf \
         ..\..\bin\UnitTestFiles\UT_Parcels.fs \
         ..\..\bin\UnitTestFiles\UT_Parcels.ldf \
         ..\..\bin\UnitTestFiles\UT_Parcels.sdf \
@@ -172,6 +173,7 @@
         ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf \
         ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs \
         ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf \
+		..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf \
         ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf \
         ..\..\bin\UnitTestFiles\UT_AllElements.pl \
         ..\..\bin\UnitTestFiles\UT_NoLegend.pl \
@@ -421,6 +423,7 @@
         ..\..\bin\UnitTestFiles\TEST.FeatureSource \
         ..\..\bin\UnitTestFiles\TEST.sdf \
         ..\..\bin\UnitTestFiles\UT_BaseMap.mdf \
+		..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf \
         ..\..\bin\UnitTestFiles\UT_Parcels.fs \
         ..\..\bin\UnitTestFiles\UT_Parcels.ldf \
         ..\..\bin\UnitTestFiles\UT_Parcels.sdf \
@@ -429,6 +432,7 @@
         ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf \
         ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs \
         ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf \
+		..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf \
         ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf \
         ..\..\bin\UnitTestFiles\UT_AllElements.pl \
         ..\..\bin\UnitTestFiles\UT_NoLegend.pl \
@@ -678,6 +682,7 @@
           ..\..\bin\UnitTestFiles\TEST.FeatureSource \
           ..\..\bin\UnitTestFiles\TEST.sdf \
           ..\..\bin\UnitTestFiles\UT_BaseMap.mdf \
+		  ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf \
           ..\..\bin\UnitTestFiles\UT_Parcels.fs \
           ..\..\bin\UnitTestFiles\UT_Parcels.ldf \
           ..\..\bin\UnitTestFiles\UT_Parcels.sdf \
@@ -686,6 +691,7 @@
           ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf \
           ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs \
           ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf \
+		  ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf \
           ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf \
           ..\..\bin\UnitTestFiles\UT_AllElements.pl \
           ..\..\bin\UnitTestFiles\UT_NoLegend.pl \
@@ -935,6 +941,7 @@
           ..\..\bin\UnitTestFiles\TEST.FeatureSource \
           ..\..\bin\UnitTestFiles\TEST.sdf \
           ..\..\bin\UnitTestFiles\UT_BaseMap.mdf \
+		  ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf \
           ..\..\bin\UnitTestFiles\UT_Parcels.fs \
           ..\..\bin\UnitTestFiles\UT_Parcels.ldf \
           ..\..\bin\UnitTestFiles\UT_Parcels.sdf \
@@ -943,6 +950,7 @@
           ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf \
           ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs \
           ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf \
+		  ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf \
           ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf \
           ..\..\bin\UnitTestFiles\UT_AllElements.pl \
           ..\..\bin\UnitTestFiles\UT_NoLegend.pl \
@@ -1065,6 +1073,7 @@
     if EXIST ..\..\bin\UnitTestFiles\TEST.FeatureSource             del /F ..\..\bin\UnitTestFiles\TEST.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\TEST.sdf                       del /F ..\..\bin\UnitTestFiles\TEST.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_BaseMap.mdf                 del /F ..\..\bin\UnitTestFiles\UT_BaseMap.mdf
+	if EXIST ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf del /F ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.fs                  del /F ..\..\bin\UnitTestFiles\UT_Parcels.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.ldf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.sdf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.sdf
@@ -1073,6 +1082,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf         del /F ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs          del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf
+	if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf del /F ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_AllElements.pl              del /F ..\..\bin\UnitTestFiles\UT_AllElements.pl
     if EXIST ..\..\bin\UnitTestFiles\UT_NoLegend.pl                 del /F ..\..\bin\UnitTestFiles\UT_NoLegend.pl
@@ -1190,6 +1200,7 @@
     if EXIST ..\..\bin\UnitTestFiles\TEST.FeatureSource             del /F ..\..\bin\UnitTestFiles\TEST.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\TEST.sdf                       del /F ..\..\bin\UnitTestFiles\TEST.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_BaseMap.mdf                 del /F ..\..\bin\UnitTestFiles\UT_BaseMap.mdf
+	if EXIST ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf del /F ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.fs                  del /F ..\..\bin\UnitTestFiles\UT_Parcels.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.ldf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.sdf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.sdf
@@ -1198,6 +1209,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf         del /F ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs          del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf
+	if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf del /F ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_AllElements.pl              del /F ..\..\bin\UnitTestFiles\UT_AllElements.pl
     if EXIST ..\..\bin\UnitTestFiles\UT_NoLegend.pl                 del /F ..\..\bin\UnitTestFiles\UT_NoLegend.pl
@@ -1315,6 +1327,7 @@
     if EXIST ..\..\bin\UnitTestFiles\TEST.FeatureSource             del /F ..\..\bin\UnitTestFiles\TEST.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\TEST.sdf                       del /F ..\..\bin\UnitTestFiles\TEST.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_BaseMap.mdf                 del /F ..\..\bin\UnitTestFiles\UT_BaseMap.mdf
+	if EXIST ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf del /F ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.fs                  del /F ..\..\bin\UnitTestFiles\UT_Parcels.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.ldf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.sdf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.sdf
@@ -1323,6 +1336,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf         del /F ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs          del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf
+	if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf del /F ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_AllElements.pl              del /F ..\..\bin\UnitTestFiles\UT_AllElements.pl
     if EXIST ..\..\bin\UnitTestFiles\UT_NoLegend.pl                 del /F ..\..\bin\UnitTestFiles\UT_NoLegend.pl
@@ -1438,6 +1452,7 @@
     if EXIST ..\..\bin\UnitTestFiles\TEST.FeatureSource             del /F ..\..\bin\UnitTestFiles\TEST.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\TEST.sdf                       del /F ..\..\bin\UnitTestFiles\TEST.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_BaseMap.mdf                 del /F ..\..\bin\UnitTestFiles\UT_BaseMap.mdf
+	if EXIST ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf del /F ..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.fs                  del /F ..\..\bin\UnitTestFiles\UT_Parcels.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.ldf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_Parcels.sdf                 del /F ..\..\bin\UnitTestFiles\UT_Parcels.sdf
@@ -1446,6 +1461,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf         del /F ..\..\bin\UnitTestFiles\UT_RoadCenterLines.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs          del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.ldf
+	if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf del /F ..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf
     if EXIST ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf         del /F ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_AllElements.pl              del /F ..\..\bin\UnitTestFiles\UT_AllElements.pl
     if EXIST ..\..\bin\UnitTestFiles\UT_NoLegend.pl                 del /F ..\..\bin\UnitTestFiles\UT_NoLegend.pl
@@ -1558,6 +1574,7 @@
 "..\..\..\UnitTest\TestData\MappingService\UT_Rail.fs" :
 "..\..\..\UnitTest\TestData\MappingService\UT_Rail.ldf" :
 "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf" :
+"..\..\..\UnitTest\TestData\TileService\UT_StylizationFuncs.mdf" :
 "..\..\..\UnitTest\TestData\TileService\UT_Parcels.fs" :
 "..\..\..\UnitTest\TestData\TileService\UT_Parcels.ldf" :
 "..\..\..\UnitTest\TestData\TileService\UT_Parcels.sdf" :
@@ -1566,6 +1583,7 @@
 "..\..\..\UnitTest\TestData\TileService\UT_RoadCenterLines.sdf" :
 "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.fs" :
 "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.ldf" :
+"..\..\..\UnitTest\TestData\TileService\UT_VotingDistrictsFunctions.ldf" :
 "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.sdf" :
 "..\..\..\UnitTest\TestData\ServerAdmin\1.1.1.mgd" :
 "..\..\..\UnitTest\TestData\CoordinateSystems\epsgcodes.txt" :
@@ -1755,6 +1773,10 @@
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf" ..\..\bin\UnitTestFiles\
 
+..\..\bin\UnitTestFiles\UT_StylizationFuncs.mdf : "..\..\..\UnitTest\TestData\TileService\UT_StylizationFuncs.mdf"
+    if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
+    if EXIST "..\..\..\UnitTest\TestData\TileService\UT_StylizationFuncs.mdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_StylizationFuncs.mdf" ..\..\bin\UnitTestFiles\
+
 ..\..\bin\UnitTestFiles\UT_Parcels.fs : "..\..\..\UnitTest\TestData\TileService\UT_Parcels.fs"
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\TileService\UT_Parcels.fs" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_Parcels.fs" ..\..\bin\UnitTestFiles\
@@ -1787,6 +1809,10 @@
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.ldf" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.ldf" ..\..\bin\UnitTestFiles\
 
+..\..\bin\UnitTestFiles\UT_VotingDistrictsFunctions.ldf : "..\..\..\UnitTest\TestData\TileService\UT_VotingDistrictsFunctions.ldf"
+    if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
+    if EXIST "..\..\..\UnitTest\TestData\TileService\UT_VotingDistrictsFunctions.ldf" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_VotingDistrictsFunctions.ldf" ..\..\bin\UnitTestFiles\
+
 ..\..\bin\UnitTestFiles\UT_VotingDistricts.sdf : "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.sdf"
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.sdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_VotingDistricts.sdf" ..\..\bin\UnitTestFiles\

Modified: sandbox/jng/extra_stylization_funcs/Server/src/Services/Kml/ServerKmlService.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/Services/Kml/ServerKmlService.cpp	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/Services/Kml/ServerKmlService.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -451,8 +451,10 @@
         wcstombs(legendImage, strLegendImage.c_str(), 4096 );
     }
     
+    Ptr<MgResourceIdentifier> layerDefId = layer->GetLayerDefinition();
     RS_UIGraphic uig((unsigned char*)legendImage, 0, layer->GetLegendLabel());
     RS_LayerUIInfo layerInfo(layer->GetName(),
+                             layerDefId->ToString(),
                              layer->GetObjectId(),
                              layer->GetSelectable(),
                              layer->GetVisible(),
@@ -487,7 +489,7 @@
 
         if (NULL != fdoReader.p)
         {
-            RS_FeatureClassInfo fcInfo(vl->GetFeatureName());
+            RS_FeatureClassInfo fcInfo(vl->GetFeatureName(), vl->GetResourceID());
             MdfModel::NameStringPairCollection* pmappings = vl->GetPropertyMappings();
             for (int j=0; j<pmappings->GetCount(); j++)
             {

Modified: sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/MappingUtil.cpp	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/MappingUtil.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -451,6 +451,7 @@
             //layer legend and ui specific information
             RS_UIGraphic uig(NULL, 0, mapLayer->GetLegendLabel());
             RS_LayerUIInfo layerInfo( mapLayer->GetName(),
+                                      layerid->ToString(),
                                       mapLayer->GetObjectId(),
                                       mapLayer->GetSelectable(),
                                       mapLayer->GetVisible(),
@@ -546,7 +547,7 @@
                     //string the viewer should be displaying as the name of each
                     //feature property
                     // TODO: check to see if name is FeatureClass or Extension name
-                    RS_FeatureClassInfo fcinfo(vl->GetFeatureName());
+                    RS_FeatureClassInfo fcinfo(vl->GetFeatureName(), vl->GetResourceID());
 
                     MdfModel::NameStringPairCollection* pmappings = vl->GetPropertyMappings();
                     for (int j=0; j<pmappings->GetCount(); j++)
@@ -658,7 +659,7 @@
                     //string the viewer should be displaying as the name of each
                     //feature property
                     // TODO: check to see if name is FeatureClass or Extension name
-                    RS_FeatureClassInfo fcinfo(gl->GetFeatureName());
+                    RS_FeatureClassInfo fcinfo(gl->GetFeatureName(), gl->GetResourceID());
 
                     //check for overridden feature query filter and remember it.
                     //we will use this when making feature queries

Modified: sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/ServerMappingService.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/ServerMappingService.cpp	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/Services/Mapping/ServerMappingService.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -223,10 +223,12 @@
     StylizationUtil::ParseColor( mdf->GetBackgroundColor(), bgcolor);
 
     //These should not matter for GenerateMap
+    Ptr<MgPoint> ptCenter = map->GetViewCenter();
+    Ptr<MgCoordinate> coord = ptCenter->GetCoordinate();
     double dMapScale = map->GetViewScale();
     double dpi = map->GetDisplayDpi();
 
-    RS_MapUIInfo mapInfo(sessionId, mapResId->GetName(), map->GetObjectId(), srs, units, bgcolor);
+    RS_MapUIInfo mapInfo(sessionId, mapResId->GetName(), map->GetObjectId(), srs, units, bgcolor, coord->GetX(), coord->GetY(), dMapScale);
 
     dr.StartMap(&mapInfo, b, dMapScale, dpi, metersPerUnit);
 
@@ -244,6 +246,7 @@
         //layer legend and ui specific information
         RS_UIGraphic uig(NULL, 0, mggroup->GetLegendLabel());
         RS_LayerUIInfo layerInfo( mggroup->GetName(),
+                                  L"",
                                   mggroup->GetObjectId(),
                                   false,   // selectable - does not apply to groups
                                   mggroup->GetVisible(),
@@ -277,8 +280,10 @@
             bEditable = false;
 
         //layer legend and ui specific information
+        Ptr<MgResourceIdentifier> layerDefId = mglayer->GetLayerDefinition();
         RS_UIGraphic uig(NULL, 0, mglayer->GetLegendLabel());
         RS_LayerUIInfo layerInfo( mglayer->GetName(),
+                                  layerDefId->ToString(),
                                   mglayer->GetObjectId(),
                                   mglayer->GetSelectable(),
                                   mglayer->GetVisible(),
@@ -475,6 +480,8 @@
     RS_Color bgcolor;
     StylizationUtil::ParseColor( map->GetBackgroundColor(), bgcolor);
 
+    Ptr<MgPoint> ptCenter = map->GetViewCenter();
+    Ptr<MgCoordinate> coord = ptCenter->GetCoordinate();
     double dMapScale = map->GetViewScale();
     double dpi       = map->GetDisplayDpi();
 
@@ -499,7 +506,7 @@
     SEMgSymbolManager semgr(m_svcResource);
     DefaultStylizer ds(&semgr);
 
-    RS_MapUIInfo mapInfo(sessionId, map->GetName(), map->GetObjectId(), srs, units, bgcolor);
+    RS_MapUIInfo mapInfo(sessionId, map->GetName(), map->GetObjectId(), srs, units, bgcolor, coord->GetX(), coord->GetY(), dMapScale);
 
     //begin map stylization
     dr.StartMap(&mapInfo, b, dMapScale, dpi, metersPerUnit, xformToLL);
@@ -517,6 +524,7 @@
             //layer legend and ui specific information
             RS_UIGraphic uig(NULL, 0, mggroup->GetLegendLabel());
             RS_LayerUIInfo layerInfo( mggroup->GetName(),
+                                      L"",
                                       mggroup->GetObjectId(),
                                       false,   // selectable - does not apply to groups
                                       mggroup->GetVisible(),
@@ -547,9 +555,11 @@
             if (mglayer->GetLayerType() == MgLayerType::BaseMap)
                 bEditable = false;
 
+            Ptr<MgResourceIdentifier> layerDefId = mglayer->GetLayerDefinition();
             //layer legend and ui specific information
             RS_UIGraphic uig(NULL, 0, mglayer->GetLegendLabel());
             RS_LayerUIInfo layerInfo( mglayer->GetName(),
+                                      layerDefId->ToString(),
                                       mglayer->GetObjectId(),
                                       mglayer->GetSelectable(),
                                       mglayer->GetVisible(),
@@ -1222,7 +1232,7 @@
         if (userInfo != NULL)
             sessionId = userInfo->GetMgSessionId();
 
-        RS_MapUIInfo mapInfo(sessionId, map->GetName(), L"", srs, units, layoutColor);
+        RS_MapUIInfo mapInfo(sessionId, map->GetName(), L"", srs, units, layoutColor, center->GetX(), center->GetY(), dMapScale);
 
         // Dynamically adjust the width and height of the map
         printLayout->ComputeMapOffsetAndSize(dMapScale, extents, metersPerUnit, dr.mapOffsetX(), dr.mapOffsetY(), dr.mapWidth(), dr.mapHeight(), mapPlot->GetExpandToFit());
@@ -1419,8 +1429,12 @@
     double metersPerUnit = (dstCs.p) ? dstCs->ConvertCoordinateSystemUnitsToMeters(1.0) : 1.0;
     RS_String units = (dstCs.p) ? dstCs->GetUnits() : L"";
 
+    Ptr<MgPoint> ptCenter = map->GetViewCenter();
+    Ptr<MgCoordinate> coord = ptCenter->GetCoordinate();
+    double dMapScale = map->GetViewScale();
+
     RS_Color mapBgColor(255, 255, 255, 0);
-    RS_MapUIInfo mapInfo(L"", map->GetName(), L"", srs, units, mapBgColor);
+    RS_MapUIInfo mapInfo(L"", map->GetName(), L"", srs, units, mapBgColor, coord->GetX(), coord->GetY(), dMapScale);
 
     double dpi = map->GetDisplayDpi();
     dr.StartMap(&mapInfo, b, scale, dpi, metersPerUnit);

Modified: sandbox/jng/extra_stylization_funcs/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/Services/Rendering/ServerRenderingService.cpp	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/Services/Rendering/ServerRenderingService.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -985,7 +985,9 @@
 
     STRING format = options->GetImageFormat();
 
-    RS_MapUIInfo mapInfo(sessionId, map->GetName(), map->GetObjectId(), srs, units, bgcolor);
+    Ptr<MgPoint> ptCenter = map->GetViewCenter();
+    Ptr<MgCoordinate> coord = ptCenter->GetCoordinate();
+    RS_MapUIInfo mapInfo(sessionId, map->GetName(), map->GetObjectId(), srs, units, bgcolor, coord->GetX(), coord->GetY(), scale);
 
     // begin map stylization
     dr->StartMap(&mapInfo, b, scale, map->GetDisplayDpi(), map->GetMetersPerUnit(), NULL);
@@ -1228,7 +1230,7 @@
     // begin map stylization
     RS_Color bgcolor(0, 0, 0, 255); // not used
     STRING srs = map->GetMapSRS();
-    RS_MapUIInfo mapInfo(sessionId, map->GetName(), map->GetObjectId(), srs, L"", bgcolor);
+    RS_MapUIInfo mapInfo(sessionId, map->GetName(), map->GetObjectId(), srs, L"", bgcolor, center->GetX(), center->GetY(), scale);
 
     // initialize the stylizer
     SEMgSymbolManager semgr(m_svcResource);
@@ -1384,7 +1386,9 @@
                     //for the first feature hit
 
                     RS_UIGraphic uig(NULL, 0, L"");
+                    Ptr<MgResourceIdentifier> layerDefId = layer->GetLayerDefinition();
                     RS_LayerUIInfo layerinfo(layer->GetName(),
+                                             layerDefId->ToString(),
                                              layer->GetObjectId(), // object ID
                                              true,   // selectable
                                              true,   // visible
@@ -1406,7 +1410,7 @@
                     //string the viewer should be displaying as the name of each
                     //feature property
                     // TODO: can FeatureName be an extension name rather than a FeatureClass?
-                    RS_FeatureClassInfo fcinfo(vl->GetFeatureName());
+                    RS_FeatureClassInfo fcinfo(vl->GetFeatureName(), vl->GetResourceID());
 
                     MdfModel::NameStringPairCollection* pmappings = vl->GetPropertyMappings();
                     for (int i=0; i<pmappings->GetCount(); i++)

Modified: sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.cpp
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.cpp	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.cpp	2013-04-11 13:27:37 UTC (rev 7457)
@@ -359,12 +359,22 @@
         // publish the resource data
         Ptr<MgByteSource> dataSource6 = new MgByteSource(L"../UnitTestFiles/UT_RoadCenterLines.sdf", false);
         Ptr<MgByteReader> dataReader6 = dataSource6->GetReader();
-        m_svcResource->SetResourceData(fsres5, L"UT_RoadCenterLines.sdf", L"File", dataReader6);
+        m_svcResource->SetResourceData(fsres6, L"UT_RoadCenterLines.sdf", L"File", dataReader6);
 
         Ptr<MgByteSource> dataSource7 = new MgByteSource(L"../UnitTestFiles/UT_VotingDistricts.sdf", false);
         Ptr<MgByteReader> dataReader7 = dataSource7->GetReader();
-        m_svcResource->SetResourceData(fsres6, L"UT_VotingDistricts.sdf", L"File", dataReader7);
+        m_svcResource->SetResourceData(fsres7, L"UT_VotingDistricts.sdf", L"File", dataReader7);
 
+        // Data related to stylization function tests
+        Ptr<MgResourceIdentifier> ldfres14 = new MgResourceIdentifier(L"Library://UnitTests/Layers/StylizationFuncs.LayerDefinition");
+        Ptr<MgByteSource> ldfsrc14 = new MgByteSource(L"../UnitTestFiles/UT_VotingDistrictsFunctions.ldf", false);
+        Ptr<MgByteReader> ldfrdr14 = ldfsrc14->GetReader();
+        m_svcResource->SetResource(ldfres14, ldfrdr14, NULL);
+
+        Ptr<MgResourceIdentifier> mapres15 = new MgResourceIdentifier(L"Library://UnitTests/Maps/StylizationFuncs.MapDefinition");
+        Ptr<MgByteSource> mdfsrc15 = new MgByteSource(L"../UnitTestFiles/UT_StylizationFuncs.mdf", false);
+        Ptr<MgByteReader> mdfrdr15 = mdfsrc15->GetReader();
+        m_svcResource->SetResource(mapres15, mdfrdr15, NULL);
     }
     catch (MgException* e)
     {
@@ -490,6 +500,13 @@
         Ptr<MgResourceIdentifier> fsres7 = new MgResourceIdentifier(L"Library://UnitTests/Data/VotingDistricts.FeatureSource");
         m_svcResource->DeleteResource(fsres7);
 
+        // Data related to stylization function tests
+        Ptr<MgResourceIdentifier> ldfres14 = new MgResourceIdentifier(L"Library://UnitTests/Layers/StylizationFuncs.LayerDefinition");
+        m_svcResource->GetResourceHeader(ldfres14);
+
+        Ptr<MgResourceIdentifier> mapres15 = new MgResourceIdentifier(L"Library://UnitTests/Maps/StylizationFuncs.MapDefinition");
+        m_svcResource->GetResourceHeader(mapres15);
+
         #ifdef _DEBUG
         MgFdoConnectionManager* pFdoConnectionManager = MgFdoConnectionManager::GetInstance();
         if(pFdoConnectionManager)
@@ -727,7 +744,42 @@
     }
 }
 
+void TestRenderingService::TestCase_StylizationFunctions(CREFSTRING imageFormat, CREFSTRING extension)
+{
+    try
+    {
+        Ptr<MgMap> map = CreateTestStylizationFunctionMap();
+        
+        // call the API using a scale of 75000
+        map->SetViewScale(75000.0);
 
+        Ptr<MgByteReader> rdr1 = m_svcRendering->RenderDynamicOverlay(map, NULL, imageFormat);
+        rdr1->ToFile(GetPath(L"../UnitTestFiles/StylizationFunc_75k", imageFormat, extension));
+
+        // call the API using a scale of 12000
+        map->SetViewScale(12000);
+        Ptr<MgByteReader> rdr2 = m_svcRendering->RenderDynamicOverlay(map, NULL, imageFormat);
+        rdr2->ToFile(GetPath(L"../UnitTestFiles/StylizationFunc_12k", imageFormat, extension));
+
+        // Move around
+        Ptr<MgCoordinate> coordNewCenter = new MgCoordinateXY(-87.733753, 43.746899);
+        Ptr<MgPoint> ptNewCenter = new MgPoint(coordNewCenter);
+        map->SetViewCenter(ptNewCenter);
+        Ptr<MgByteReader> rdr3 = m_svcRendering->RenderDynamicOverlay(map, NULL, imageFormat);
+        rdr3->ToFile(GetPath(L"../UnitTestFiles/StylizationFunc_12k_Moved", imageFormat, extension));
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TEST_LOCALE);
+        SAFE_RELEASE(e);
+        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+    catch (...)
+    {
+        throw;
+    }
+}
+
 void TestRenderingService::TestCase_QueryFeatures()
 {
     try
@@ -735,8 +787,8 @@
         // make a runtime map
         Ptr<MgMap> map = CreateTestMap();
 
-        // call the API using a scale of 75000
-        map->SetViewScale(75000.0);
+        // call the API using a scale of 60000
+        map->SetViewScale(60000.0);
 
         Ptr<MgStringCollection> layerNames1 = new MgStringCollection();
         layerNames1->Add(L"Rail");
@@ -799,6 +851,23 @@
     return map;
 }
 
+MgMap* TestRenderingService::CreateTestStylizationFunctionMap()
+{
+    Ptr<MgResourceIdentifier> mdfres = new MgResourceIdentifier(L"Library://UnitTests/Maps/StylizationFuncs.MapDefinition");
+    MgMap* map = new MgMap(m_siteConnection);
+    map->Create(mdfres, L"StylizationFuncs");
+
+    Ptr<MgCoordinate> coordNewCenter = new MgCoordinateXY(-87.733253, 43.746199);
+    Ptr<MgPoint> ptNewCenter = new MgPoint(coordNewCenter);
+    map->SetViewCenter(ptNewCenter);
+    map->SetViewScale(60000.0);
+    map->SetDisplayDpi(96);
+    map->SetDisplayWidth(1024);
+    map->SetDisplayHeight(1024);
+
+    return map;
+}
+
 MgMap* TestRenderingService::CreateTestTiledMap()
 {
     Ptr<MgResourceIdentifier> mdfres = new MgResourceIdentifier(L"Library://UnitTests/Maps/BaseMap.MapDefinition");

Modified: sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.h
===================================================================
--- sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.h	2013-04-10 10:08:30 UTC (rev 7456)
+++ sandbox/jng/extra_stylization_funcs/Server/src/UnitTesting/TestRenderingService.h	2013-04-11 13:27:37 UTC (rev 7457)
@@ -25,6 +25,8 @@
     CPPUNIT_TEST_SUITE(TestRenderingService);
     CPPUNIT_TEST(TestStart); // This must be the very first unit test
 
+    CPPUNIT_TEST(TestCase_StylizationFunctionsPNG);
+
     CPPUNIT_TEST(TestCase_SymbologyPointsPNG);
     CPPUNIT_TEST(TestCase_SymbologyPointsParamPNG);
     CPPUNIT_TEST(TestCase_SymbologyLinesPNG);
@@ -41,6 +43,8 @@
     CPPUNIT_TEST(TestCase_RenderMapWithWatermarkPNG);
     CPPUNIT_TEST(TestCase_RenderLegendPNG);
 
+    CPPUNIT_TEST(TestCase_StylizationFunctionsPNG8);
+
 	CPPUNIT_TEST(TestCase_SymbologyPointsPNG8);
     CPPUNIT_TEST(TestCase_SymbologyPointsParamPNG8);
     CPPUNIT_TEST(TestCase_SymbologyLinesPNG8);
@@ -57,6 +61,8 @@
     CPPUNIT_TEST(TestCase_RenderMapWithWatermarkPNG8);
     CPPUNIT_TEST(TestCase_RenderLegendPNG8);
 
+    CPPUNIT_TEST(TestCase_StylizationFunctionsGIF);
+
 	CPPUNIT_TEST(TestCase_SymbologyPointsGIF);
     CPPUNIT_TEST(TestCase_SymbologyPointsParamGIF);
     CPPUNIT_TEST(TestCase_SymbologyLinesGIF);
@@ -73,6 +79,8 @@
     CPPUNIT_TEST(TestCase_RenderMapWithWatermarkGIF);
     CPPUNIT_TEST(TestCase_RenderLegendGIF);
 
+    CPPUNIT_TEST(TestCase_StylizationFunctionsJPG);
+
 	CPPUNIT_TEST(TestCase_SymbologyPointsJPG);
     CPPUNIT_TEST(TestCase_SymbologyPointsParamJPG);
     CPPUNIT_TEST(TestCase_SymbologyLinesJPG);
@@ -124,6 +132,8 @@
     void TestCase_Annotation2(CREFSTRING imageFormat, CREFSTRING extension);
     void TestCase_Annotation3(CREFSTRING imageFormat, CREFSTRING extension);
 
+    void TestCase_StylizationFunctions(CREFSTRING imageFormat, CREFSTRING extension);
+
 	//PNG output tests
 	void TestCase_RenderDynamicOverlayPNG() { TestCase_RenderDynamicOverlay(L"PNG", L"png"); }
     void TestCase_RenderDynamicOverlayTiledMapPNG() { TestCase_RenderDynamicOverlayTiledMap(L"PNG", L"png"); }
@@ -138,6 +148,7 @@
     void TestCase_Annotation1PNG() { TestCase_Annotation1(L"PNG", L"png"); }
     void TestCase_Annotation2PNG() { TestCase_Annotation2(L"PNG", L"png"); }
     void TestCase_Annotation3PNG() { TestCase_Annotation3(L"PNG", L"png"); }
+    void TestCase_StylizationFunctionsPNG() { TestCase_StylizationFunctions(L"PNG", L"png"); }
 
 	//PNG8 output tests
 	void TestCase_RenderDynamicOverlayPNG8() { TestCase_RenderDynamicOverlay(L"PNG8", L"png"); }
@@ -153,6 +164,7 @@
     void TestCase_Annotation1PNG8() { TestCase_Annotation1(L"PNG8", L"png"); }
     void TestCase_Annotation2PNG8() { TestCase_Annotation2(L"PNG8", L"png"); }
     void TestCase_Annotation3PNG8() { TestCase_Annotation3(L"PNG8", L"png"); }
+    void TestCase_StylizationFunctionsPNG8() { TestCase_StylizationFunctions(L"PNG8", L"png"); }
 
 	//GIF output tests
 	void TestCase_RenderDynamicOverlayGIF() { TestCase_RenderDynamicOverlay(L"GIF", L"gif"); }
@@ -168,6 +180,7 @@
     void TestCase_Annotation1GIF() { TestCase_Annotation1(L"GIF", L"gif"); }
     void TestCase_Annotation2GIF() { TestCase_Annotation2(L"GIF", L"gif"); }
     void TestCase_Annotation3GIF() { TestCase_Annotation3(L"GIF", L"gif"); }
+    void TestCase_StylizationFunctionsGIF() { TestCase_StylizationFunctions(L"GIF", L"gif"); }
 
 	//JPG output tests
 	void TestCase_RenderDynamicOverlayJPG() { TestCase_RenderDynamicOverlay(L"JPG", L"jpg"); }
@@ -183,12 +196,14 @@
     void TestCase_Annotation1JPG() { TestCase_Annotation1(L"JPG", L"jpg"); }
     void TestCase_Annotation2JPG() { TestCase_Annotation2(L"JPG", L"jpg"); }
     void TestCase_Annotation3JPG() { TestCase_Annotation3(L"JPG", L"jpg"); }
+    void TestCase_StylizationFunctionsJPG() { TestCase_StylizationFunctions(L"JPG", L"jpg"); }
 
     //void TestCase_RendererPerformance();
 
 private:
     MgMap* CreateTestMap();
     MgMap* CreateTestTiledMap();
+    MgMap* CreateTestStylizationFunctionMap();
     MgMap* CreateTestMapWithWatermark();
     MgPolygon* CreateSelectionPolygon(MgMap* map, double width, double height);
 	static STRING GetPath(CREFSTRING basePath, CREFSTRING imageFormat, CREFSTRING extension);

Added: sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_StylizationFuncs.mdf
===================================================================
--- sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_StylizationFuncs.mdf	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_StylizationFuncs.mdf	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.4.0" xsi:noNamespaceSchemaLocation="MapDefinition-2.4.0.xsd">
+  <Name />
+  <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+  <Extents>
+    <MinX>-87.764986236796631</MinX>
+    <MaxX>-87.695517537538109</MaxX>
+    <MinY>43.691398447253356</MinY>
+    <MaxY>43.7975198255836</MaxY>
+  </Extents>
+  <BackgroundColor>ffffffff</BackgroundColor>
+  <MapLayer>
+    <Name>StylizationTest</Name>
+    <ResourceId>Library://UnitTests/Layers/StylizationFuncs.LayerDefinition</ResourceId>
+    <Selectable>true</Selectable>
+    <ShowInLegend>true</ShowInLegend>
+    <LegendLabel>StylizationTest</LegendLabel>
+    <ExpandInLegend>true</ExpandInLegend>
+    <Visible>true</Visible>
+    <Group />
+  </MapLayer>
+  <Watermarks />
+</MapDefinition>
\ No newline at end of file

Added: sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_VotingDistrictsFunctions.ldf
===================================================================
--- sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_VotingDistrictsFunctions.ldf	                        (rev 0)
+++ sandbox/jng/extra_stylization_funcs/UnitTest/TestData/TileService/UT_VotingDistrictsFunctions.ldf	2013-04-11 13:27:37 UTC (rev 7457)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerDefinition-1.2.0.xsd" version="1.2.0">
+  <VectorLayerDefinition>
+    <ResourceId>Library://UnitTests/Data/VotingDistricts.FeatureSource</ResourceId>
+    <FeatureName>Default:VotingDistricts</FeatureName>
+    <FeatureNameType>FeatureClass</FeatureNameType>
+    <PropertyMapping>
+      <Name>NAME</Name>
+      <Value>NAME</Value>
+    </PropertyMapping>
+    <Geometry>Geometry</Geometry>
+    <VectorScaleRange>
+      <AreaTypeStyle>
+        <AreaRule>
+          <LegendLabel></LegendLabel>
+          <Label>
+            <Unit>Centimeters</Unit>
+            <SizeContext>DeviceUnits</SizeContext>
+            <SizeX>0.3</SizeX>
+            <SizeY>0.3</SizeY>
+            <Text>concat('HTML Color: ', HTMLCOLOR(255, 0, 14), '\nFeature Source: ', FEATURESOURCE(), '\nLayer Definition: ', LAYERDEFINITION(), '\nMap Scale: ', MAPSCALE(), '\nMap Center (X): ', MAPCENTERX(), '\nMap Center (Y): ', MAPCENTERY(), '\nColor: ', ARGB(0, 255, 0, 255), '\nDecap: ', DECAP('HELLO WORLD'), '\nFeature Class: ', FEATURECLASS(), '\nFeature ID: ', FEATUREID(), '\nIf result (Built after 1980?): ', IF('YRBUILT &gt; 1980', 'Yes', 'No'), '\nLayer ID: ', LAYERID(), '\nLookup Example (based on FeatId): ', Lookup( FeatId , 'FeatId unknown or empty', 1, 'one', 2, 'two', 3, 'three', 4, 'four', 5, 'five', 6, 'six', 7, 'seven', 8, 'eight', 9, 'nine', 10, 'ten'), '\nMap Name: ', MAPNAME(), '\nSession ID: ', SESSION(), '\nRange Example (FeatId): ', RANGE( FeatId , 'Unknown', 1, 3, '1-3', 3, 6,'3-6', 6, 10, '6 - 10'), '\nURL Encode example: ', URLENCODE('http://www.google.com/?foo=bar'))</Text>
+            <FontName>Arial</FontName>
+            <ForegroundColor>ff000000</ForegroundColor>
+            <BackgroundColor>ffffffff</BackgroundColor>
+            <BackgroundStyle>Ghosted</BackgroundStyle>
+            <VerticalAlignment>'Halfline'</VerticalAlignment>
+            <AdvancedPlacement>
+              <ScaleLimit>0.5</ScaleLimit>
+            </AdvancedPlacement>
+          </Label>
+          <AreaSymbolization2D>
+            <Fill>
+              <FillPattern>Solid</FillPattern>
+              <ForegroundColor>ffffffff</ForegroundColor>
+              <BackgroundColor>ffffffff</BackgroundColor>
+            </Fill>
+            <Stroke>
+              <LineStyle>Solid</LineStyle>
+              <Thickness>1</Thickness>
+              <Color>ff000000</Color>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+            </Stroke>
+          </AreaSymbolization2D>
+        </AreaRule>
+      </AreaTypeStyle>
+    </VectorScaleRange>
+  </VectorLayerDefinition>
+</LayerDefinition>



More information about the mapguide-commits mailing list