[mapguide-commits] r1173 - in trunk/MgDev: Common/MdfModel Common/MdfParser Common/Schema Common/Stylization Server/src/Services/Kml Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Mar 7 17:35:39 EST 2007


Author: chrisclaydon
Date: 2007-03-07 17:35:38 -0500 (Wed, 07 Mar 2007)
New Revision: 1173

Added:
   trunk/MgDev/Common/MdfModel/ElevationSettings.cpp
   trunk/MgDev/Common/MdfModel/ElevationSettings.h
   trunk/MgDev/Common/MdfParser/IOElevationSettings.cpp
   trunk/MgDev/Common/MdfParser/IOElevationSettings.h
Modified:
   trunk/MgDev/Common/MdfModel/Makefile.am
   trunk/MgDev/Common/MdfModel/MdfModel.vcproj
   trunk/MgDev/Common/MdfModel/VectorScaleRange.cpp
   trunk/MgDev/Common/MdfModel/VectorScaleRange.h
   trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp
   trunk/MgDev/Common/MdfParser/Makefile.am
   trunk/MgDev/Common/MdfParser/MdfParser.vcproj
   trunk/MgDev/Common/MdfParser/SAX2ElementHandler.h
   trunk/MgDev/Common/Schema/LayerDefinition-1.1.0.xsd
   trunk/MgDev/Common/Stylization/DWFRenderer.cpp
   trunk/MgDev/Common/Stylization/DWFRenderer.h
   trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
   trunk/MgDev/Common/Stylization/GDRenderer.cpp
   trunk/MgDev/Common/Stylization/GDRenderer.h
   trunk/MgDev/Common/Stylization/GeometryAdapter.cpp
   trunk/MgDev/Common/Stylization/GeometryAdapter.h
   trunk/MgDev/Common/Stylization/KmlRenderer.cpp
   trunk/MgDev/Common/Stylization/KmlRenderer.h
   trunk/MgDev/Common/Stylization/PointAdapter.cpp
   trunk/MgDev/Common/Stylization/PointAdapter.h
   trunk/MgDev/Common/Stylization/PolygonAdapter.cpp
   trunk/MgDev/Common/Stylization/PolygonAdapter.h
   trunk/MgDev/Common/Stylization/PolylineAdapter.cpp
   trunk/MgDev/Common/Stylization/PolylineAdapter.h
   trunk/MgDev/Common/Stylization/RasterAdapter.cpp
   trunk/MgDev/Common/Stylization/RasterAdapter.h
   trunk/MgDev/Common/Stylization/Renderer.h
   trunk/MgDev/Common/Stylization/RendererStyles.h
   trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp
   trunk/MgDev/Server/src/Services/Kml/ServerKmlService.h
   trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp
   trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.h
   trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.cpp
   trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.h
Log:
RFC16 - KML Extrusion / Elevation Support

Added: trunk/MgDev/Common/MdfModel/ElevationSettings.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/ElevationSettings.cpp	                        (rev 0)
+++ trunk/MgDev/Common/MdfModel/ElevationSettings.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -0,0 +1,126 @@
+//
+//  Copyright (C) 2004-2006  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
+//
+
+//-------------------------------------------------------------------------
+// DESCRIPTION:
+// The ElevationSettings class implementation.
+//-------------------------------------------------------------------------
+
+#include "stdafx.h"
+#include "ElevationSettings.h"
+
+using namespace MDFMODEL_NAMESPACE;
+
+//-------------------------------------------------------------------------
+// PURPOSE: Construct and initialize an instance of the ElevationSettings class.
+//-------------------------------------------------------------------------
+ElevationSettings::ElevationSettings()
+{
+    //Default Settings
+    this->m_strZExtrusionExpression = L"";
+    this->m_strZOffsetExpression = L"";
+    this->m_elevationType = RelativeToGround;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Destructor.
+//-------------------------------------------------------------------------
+ElevationSettings::~ElevationSettings()
+{
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the ZOffsetExpression property.
+// RETURNS: String representation of the ZOffsetExpression property.
+//-------------------------------------------------------------------------
+const MdfString& ElevationSettings::GetZOffsetExpression()const
+{
+    return this->m_strZOffsetExpression;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Sets the ZOffsetExpression property.
+// PARAMETERS:
+//      Input:
+//          strElevationProperty - The ZOffsetExpression property.
+//-------------------------------------------------------------------------
+void ElevationSettings::SetZOffsetExpression(const MdfString& strZOffsetExpression)
+{
+    this->m_strZOffsetExpression = strZOffsetExpression;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the ZExtrusionExpression property.
+// RETURNS: String representation of the ZExtrusionExpression property.
+//-------------------------------------------------------------------------
+const MdfString& ElevationSettings::GetZExtrusionExpression()const
+{
+    return this->m_strZExtrusionExpression;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Sets the ZExtrusionExpression property.
+// PARAMETERS:
+//      Input:
+//          strElevationProperty - The ZExtrusionExpression property.
+//-------------------------------------------------------------------------
+void ElevationSettings::SetZExtrusionExpression(const MdfString& strZExtrusionExpression)
+{
+    this->m_strZExtrusionExpression = strZExtrusionExpression;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the Unit property
+//          The Unit enum defines the measurement unit for the offset and extrusion properties.
+// RETURNS: The Unit enum value.
+//-------------------------------------------------------------------------
+LengthUnit ElevationSettings::GetUnit()const
+{
+    return this->m_eUnit;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method to the Unit property
+//          The Unit enum defines the measurement unit for the offset and extrusion properties.
+// PARAMETERS:
+//      Input:
+//          eUnit - the measurement unit for the offset and extrusion properties.
+//-------------------------------------------------------------------------
+void ElevationSettings::SetUnit(LengthUnit eUnit)
+{
+    this->m_eUnit = eUnit;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the ElevationType value of this ElevationSettings.
+// RETURNS: The elevation type
+//-------------------------------------------------------------------------
+MdfModel::ElevationSettings::ElevationType ElevationSettings::GetElevationType() const
+{
+    return this->m_elevationType;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Sets the ElevationType value of this ElevationSettings.
+// PARAMETERS:
+//      Input:
+//          elevationType - The value for the ElevationType
+//-------------------------------------------------------------------------
+void ElevationSettings::SetElevationType(ElevationType elevationType)
+{
+    this->m_elevationType = elevationType;
+}

Added: trunk/MgDev/Common/MdfModel/ElevationSettings.h
===================================================================
--- trunk/MgDev/Common/MdfModel/ElevationSettings.h	                        (rev 0)
+++ trunk/MgDev/Common/MdfModel/ElevationSettings.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -0,0 +1,75 @@
+//
+//  Copyright (C) 2004-2006  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 ElevationSettings_H_
+#define ElevationSettings_H_
+
+#include "MdfModel.h"
+#include "MdfRootObject.h"
+#include "LengthConverter.h"
+
+BEGIN_NAMESPACE_MDFMODEL
+
+    //-------------------------------------------------------------------------
+    // DESCRIPTION:
+    // The ElevationSettings class is used to store elevation properties
+    // used for rendering 2.5D objects.
+    //-------------------------------------------------------------------------
+class MDFMODEL_API ElevationSettings : public MdfRootObject
+    {
+    public:
+        enum ElevationType
+        {
+            Absolute,
+            RelativeToGround
+        };
+
+        // Construction, destruction, initialization
+        ElevationSettings();
+        virtual ~ElevationSettings();
+
+        // Operations
+        // Property : ZOffset
+        const MdfString& GetZOffsetExpression() const;
+        void SetZOffsetExpression(const MdfString& strZOffsetExpression);
+
+        // Property : ZOffsetExpression
+        const MdfString& GetZExtrusionExpression() const;
+        void SetZExtrusionExpression(const MdfString& strZExtrusionExpression);
+
+        // Property : ElevationType
+        ElevationType GetElevationType() const;
+        void SetElevationType(ElevationType elevationType);
+
+        // Property : Unit
+        LengthUnit GetUnit() const;
+        void SetUnit(LengthUnit eUnit);
+
+    private:
+        // Hidden copy constructor and assignment operator.
+        ElevationSettings(const ElevationSettings&);
+        ElevationSettings& operator=(const ElevationSettings&);
+
+        // Data members
+        MdfString m_strZOffsetExpression;
+        MdfString m_strZExtrusionExpression;
+        LengthUnit m_eUnit;
+        ElevationType m_elevationType;
+    };
+
+END_NAMESPACE_MDFMODEL
+#endif //ElevationSettings_H_

Modified: trunk/MgDev/Common/MdfModel/Makefile.am
===================================================================
--- trunk/MgDev/Common/MdfModel/Makefile.am	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfModel/Makefile.am	2007-03-07 22:35:38 UTC (rev 1173)
@@ -23,6 +23,7 @@
   ConvertUTF.c \
   DisplayScale.cpp \
   DrawingLayerDefinition.cpp \
+  ElevationSettings.cpp \
   Extension.cpp \
   FeatureSource.cpp \
   FeatureTypeStyle.cpp \
@@ -100,6 +101,7 @@
   ConvertUTF.h \
   DisplayScale.h \
   DrawingLayerDefinition.h \
+  ElevationSettings.h \
   Extension.h \
   FeatureSource.h \
   FeatureTypeStyle.h \

Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcproj
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcproj	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcproj	2007-03-07 22:35:38 UTC (rev 1173)
@@ -803,6 +803,14 @@
 			>
 		</File>
 		<File
+			RelativePath=".\ElevationSettings.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\ElevationSettings.h"
+			>
+		</File>
+		<File
 			RelativePath=".\LayerDefinition.cpp"
 			>
 		</File>

Modified: trunk/MgDev/Common/MdfModel/VectorScaleRange.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/VectorScaleRange.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfModel/VectorScaleRange.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -43,6 +43,7 @@
     //Default Settings
     this->m_dMinScale = 0.0;
     this->m_dMaxScale = MAX_MAP_SCALE;
+    this->m_elevationSettings = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -113,3 +114,30 @@
 {
     return &this->m_collFeatureTypeStyles;
 }
+
+//-------------------------------------------------------------------------
+// PURPOSE: Retrieves the elevation settings for this scale range
+// RETURNS: A pointer to the ElevationSettings object
+//-------------------------------------------------------------------------
+ElevationSettings* VectorScaleRange::GetElevationSettings()
+{
+    return this->m_elevationSettings;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Method to adopt an ElevationSettings object
+// PARAMETERS:
+//      Input:
+//         elevationSettings - A pointer to the ElevationSettings object
+//-------------------------------------------------------------------------
+void VectorScaleRange::AdoptElevationSettings(ElevationSettings* elevationSettings)
+{
+    if (this->m_elevationSettings != elevationSettings)
+    {
+        if (this->m_elevationSettings != NULL)
+        {
+            delete this->m_elevationSettings;
+        }
+        this->m_elevationSettings = elevationSettings;
+    }
+}

Modified: trunk/MgDev/Common/MdfModel/VectorScaleRange.h
===================================================================
--- trunk/MgDev/Common/MdfModel/VectorScaleRange.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfModel/VectorScaleRange.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -21,6 +21,7 @@
 #include "MdfModel.h"
 #include "MdfOwnerCollection.h"
 #include "FeatureTypeStyle.h"
+#include "ElevationSettings.h"
 #include "MdfRootObject.h"
 
 BEGIN_NAMESPACE_MDFMODEL
@@ -57,6 +58,10 @@
         // Property : FeatureTypeStyles
         FeatureTypeStyleCollection* GetFeatureTypeStyles();
 
+        // Property : ElevationSettings
+        ElevationSettings* GetElevationSettings();
+        void AdoptElevationSettings(ElevationSettings* elevationSettings);
+
     private:
         // Hidden copy constructor and assignment operator.
         VectorScaleRange(const VectorScaleRange&);
@@ -71,6 +76,9 @@
 
         // The collection of FeatureTypeStyle objects.
         FeatureTypeStyleCollection m_collFeatureTypeStyles;
+
+        // Extended data
+        ElevationSettings* m_elevationSettings;
     };
 
     typedef MdfOwnerCollection<VectorScaleRange> VectorScaleRangeCollection;

Added: trunk/MgDev/Common/MdfParser/IOElevationSettings.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOElevationSettings.cpp	                        (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOElevationSettings.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -0,0 +1,162 @@
+//
+//  Copyright (C) 2004-2006  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 "IOElevationSettings.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+CREATE_ELEMENT_MAP;
+ELEM_MAP_ENTRY(1, ElevationSettings);
+ELEM_MAP_ENTRY(2, ZOffset);
+ELEM_MAP_ENTRY(3, ZExtrusion);
+ELEM_MAP_ENTRY(4, Unit);
+ELEM_MAP_ENTRY(5, ZOffsetType);
+
+const wchar_t * ELEV_TYPE_ABSOLUTE = L"Absolute"; //NOXLATE
+const wchar_t * ELEV_TYPE_RELATIVE_TO_GROUND = L"RelativeToGround"; //NOXLATE
+
+IOElevationSettings::IOElevationSettings()
+{
+    this->_elevationSettings = NULL;
+    this->scaleRange = NULL;
+}
+
+IOElevationSettings::IOElevationSettings(VectorScaleRange *scaleRange)
+{
+    this->_elevationSettings = NULL;
+    this->scaleRange = scaleRange;
+}
+
+IOElevationSettings::~IOElevationSettings()
+{
+}
+
+void IOElevationSettings::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+    m_currElemName = name;
+    m_currElemId = _ElementIdFromName(name);
+
+    switch (m_currElemId)
+    {
+    case eElevationSettings:
+        m_startElemName = name;
+        this->_elevationSettings = new ElevationSettings();
+        break;
+
+    case eUnknown:
+        ParseUnknownXml(name, handlerStack);
+        break;
+
+    default:
+        break;
+    }
+}
+
+void IOElevationSettings::ElementChars(const wchar_t *ch)
+{
+    if (m_currElemName == swZOffset) 
+    {
+        (this->_elevationSettings)->SetZOffsetExpression(ch);
+    }
+    else if (m_currElemName == swZExtrusion) 
+    {
+        (this->_elevationSettings)->SetZExtrusionExpression(ch);
+    }
+    else if (this->m_currElemName == swUnit) 
+    {
+        LengthUnit unit = LengthConverter::EnglishToUnit(ch);
+        (this->_elevationSettings)->SetUnit(unit);
+    }
+    else if (m_currElemName == swZOffsetType) 
+    {
+        ElevationSettings::ElevationType elevType;
+        if(::wcscmp(ch, ELEV_TYPE_ABSOLUTE) == 0)
+        {
+            elevType = ElevationSettings::Absolute;
+        }
+        else
+        {
+            elevType = ElevationSettings::RelativeToGround;
+        }
+        (this->_elevationSettings)->SetElevationType(elevType);
+    }
+}
+
+void IOElevationSettings::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+    if (m_startElemName == name)
+    {
+        if (!UnknownXml().empty())
+            this->_elevationSettings->SetUnknownXml(UnknownXml());
+
+        this->scaleRange->AdoptElevationSettings(this->_elevationSettings);
+        handlerStack->pop();
+        this->scaleRange = NULL;
+        this->_elevationSettings = NULL;
+        m_startElemName = L"";
+        delete this;
+    }
+}
+
+void IOElevationSettings::Write(MdfStream &fd, ElevationSettings *elevationSettings)
+{
+    fd << tab() << "<ElevationSettings>" << std::endl; // NOXLATE
+    inctab();
+
+    fd << tab() << "<ZOffset>"; // NOXLATE
+    fd << EncodeString(elevationSettings->GetZOffsetExpression());
+    fd << "</ZOffset>" << std::endl; // NOXLATE
+
+    fd << tab() << "<ZExtrusion>"; // NOXLATE
+    fd << EncodeString(elevationSettings->GetZExtrusionExpression());
+    fd << "</ZExtrusion>" << std::endl; // NOXLATE
+
+    fd << tab() << "<Unit>"; // NOXLATE
+    std::auto_ptr<MdfString> str(LengthConverter::UnitToEnglish(elevationSettings->GetUnit()));
+    fd << EncodeString(*str);
+    fd << "</Unit>" << std::endl; // NOXLATE
+
+    fd << tab() << "<ZOffsetType>"; // NOXLATE
+    ElevationSettings::ElevationType elevType = elevationSettings->GetElevationType();
+    switch(elevType)
+    {
+    case ElevationSettings::Absolute:
+        {
+            fd << ELEV_TYPE_ABSOLUTE; 
+            break;
+        }
+    case ElevationSettings::RelativeToGround:
+    default:
+        {
+            fd << ELEV_TYPE_RELATIVE_TO_GROUND; 
+            break;
+        }
+    }
+    fd << "</ZOffsetType>" << std::endl; // NOXLATE
+
+    // Write any previously found unknown XML
+    if (!elevationSettings->GetUnknownXml().empty())
+    {
+        fd << toCString(elevationSettings->GetUnknownXml()); 
+    }
+
+    dectab();
+    fd << tab() << "</ElevationSettings>" << std::endl; // NOXLATE
+}

Added: trunk/MgDev/Common/MdfParser/IOElevationSettings.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOElevationSettings.h	                        (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOElevationSettings.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -0,0 +1,48 @@
+//
+//  Copyright (C) 2004-2006  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 _IOElevationSettings_H
+#define _IOElevationSettings_H
+
+#include "SAX2ElementHandler.h"
+#include "ElevationSettings.h"
+#include "VectorScaleRange.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOElevationSettings : public SAX2ElementHandler
+{
+    private:
+        ElevationSettings * _elevationSettings;
+        VectorScaleRange * scaleRange;
+
+    public:
+        IOElevationSettings();
+        IOElevationSettings(VectorScaleRange * scaleRange);
+        ~IOElevationSettings();
+        void Write(MdfStream &fd, ElevationSettings * elevationSettings);
+
+        virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+        virtual void ElementChars(const wchar_t *ch);
+        virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOElevationSettings_H

Modified: trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -22,6 +22,7 @@
 #include "IOPointTypeStyle.h"
 #include "IOCompositeTypeStyle.h"
 #include "IFeatureTypeStyleVisitor.h"
+#include "IOElevationSettings.h"
 
 using namespace XERCES_CPP_NAMESPACE;
 using namespace MDFMODEL_NAMESPACE;
@@ -35,7 +36,9 @@
 ELEM_MAP_ENTRY(5, CompositeTypeStyle);
 ELEM_MAP_ENTRY(6, MinScale);
 ELEM_MAP_ENTRY(7, MaxScale);
+ELEM_MAP_ENTRY(8, ElevationSettings);
 
+
 IOVectorScaleRange::IOVectorScaleRange()
 {
     this->_scaleRange = NULL;
@@ -88,6 +91,14 @@
         }
         break;
 
+    case eElevationSettings:
+        {
+            IOElevationSettings *IO = new IOElevationSettings(this->_scaleRange);
+            handlerStack->push(IO);
+            IO->StartElement(name, handlerStack);
+        }
+        break;
+
     case eCompositeTypeStyle:
         {
             IOCompositeTypeStyle *IO = new IOCompositeTypeStyle(this->_scaleRange);
@@ -177,6 +188,14 @@
         }
     }
 
+    ElevationSettings* elevationSettings = scaleRange->GetElevationSettings();
+    if(elevationSettings != NULL)
+    {
+        IOElevationSettings * IO = new IOElevationSettings();
+        IO->Write(fd, elevationSettings);
+        delete IO;
+    }
+
     // Write any previously found unknown XML
     if (!scaleRange->GetUnknownXml().empty())
     {

Modified: trunk/MgDev/Common/MdfParser/Makefile.am
===================================================================
--- trunk/MgDev/Common/MdfParser/Makefile.am	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfParser/Makefile.am	2007-03-07 22:35:38 UTC (rev 1173)
@@ -26,6 +26,7 @@
   IOCompositeTypeStyle.cpp \
   IOCompoundSymbolDefinition.cpp \
   IODrawingLayerDefinition.cpp \
+  IOElevationSettings.cpp \
   IOExtension.cpp \
   IOExtra.cpp \
   IOFeatureSource.cpp \
@@ -105,6 +106,7 @@
   IOCompositeTypeStyle.h \
   IOCompoundSymbolDefinition.h \
   IODrawingLayerDefinition.h \
+  IOElevationSettings.h \
   IOExtension.h \
   IOExtra.h \
   IOFeatureSource.h \

Modified: trunk/MgDev/Common/MdfParser/MdfParser.vcproj
===================================================================
--- trunk/MgDev/Common/MdfParser/MdfParser.vcproj	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfParser/MdfParser.vcproj	2007-03-07 22:35:38 UTC (rev 1173)
@@ -320,6 +320,14 @@
 			>
 		</File>
 		<File
+			RelativePath=".\IOElevationSettings.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\IOElevationSettings.h"
+			>
+		</File>
+		<File
 			RelativePath=".\IOExtension.cpp"
 			>
 		</File>

Modified: trunk/MgDev/Common/MdfParser/SAX2ElementHandler.h
===================================================================
--- trunk/MgDev/Common/MdfParser/SAX2ElementHandler.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/MdfParser/SAX2ElementHandler.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -96,7 +96,8 @@
 
 #define ELEM_MAP_ENTRY(ID, NAME)                                                \
     static const std::string s##NAME = _CreateMapEntry(L###NAME, #NAME);        \
-    static const int e##NAME = ID
+    static const int e##NAME = ID;                                              \
+    static const std::wstring sw##NAME = L###NAME
 
 END_NAMESPACE_MDFPARSER
 #endif // _SAX2ELEMENTHANDLER_H

Modified: trunk/MgDev/Common/Schema/LayerDefinition-1.1.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/LayerDefinition-1.1.0.xsd	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Schema/LayerDefinition-1.1.0.xsd	2007-03-07 22:35:38 UTC (rev 1173)
@@ -196,9 +196,28 @@
           </xs:annotation>
         </xs:element>
       </xs:choice>
+      <xs:element name="ElevationSettings" type="ElevationSettingsType" minOccurs="0" />
       <xs:element name="ExtendedData1" type="ExtendedDataType" minOccurs="0"/>
     </xs:sequence>
   </xs:complexType>
+  <xs:complexType name="ElevationSettingsType">
+    <xs:sequence>
+        <xs:element name="ZOffset" type="xs:string" minOccurs="0" />
+        <xs:element name="ZExtrusion" type="xs:string" minOccurs="0" />
+        <xs:element name="ZOffsetType" type="ElevationTypeType" minOccurs="0" />
+        <xs:element name="Unit" type="LengthUnitType" minOccurs="0"/>
+        <xs:element name="ExtendedData1" type="ExtendedDataType" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:simpleType name="ElevationTypeType">
+    <xs:annotation>
+        <xs:documentation>The possible interpretations of a z offset value.</xs:documentation>
+    </xs:annotation>
+    <xs:restriction base="xs:string">
+        <xs:enumeration value="RelativeToGround"/>
+        <xs:enumeration value="Absolute"/>
+    </xs:restriction>
+  </xs:simpleType>
   <xs:complexType name="PointTypeStyleType">
     <xs:annotation>
       <xs:documentation>Style specification of a point geometry type. </xs:documentation>

Modified: trunk/MgDev/Common/Stylization/DWFRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/DWFRenderer.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/DWFRenderer.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -519,7 +519,11 @@
 void DWFRenderer::StartFeature(RS_FeatureReader* feature,
                                const RS_String* tooltip,
                                const RS_String* url,
-                               const RS_String* /*theme*/)
+                               const RS_String* /*theme*/,
+                               double /*zOffset*/,
+                               double /*zExtrusion*/,
+                               RS_ElevationType /*zOffsetType*/)
+
 {
     //attributes and selection support
     StoreAttributes(feature, tooltip, url);

Modified: trunk/MgDev/Common/Stylization/DWFRenderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/DWFRenderer.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/DWFRenderer.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -84,7 +84,10 @@
     STYLIZATION_API virtual void StartFeature (RS_FeatureReader* feature,
                                                const RS_String*  tooltip = NULL,
                                                const RS_String*  url = NULL,
-                                               const RS_String* theme = NULL);
+                                               const RS_String* theme = NULL,
+                                               double zOffset = 0,
+                                               double zExtrusion = 0,
+                                               RS_ElevationType zOffsetType = RS_ElevationType_RelativeToGround);
 
     STYLIZATION_API virtual void ProcessPolygon (LineBuffer* lb,
                                                  RS_FillStyle& fill);

Modified: trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/DefaultStylizer.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/DefaultStylizer.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -25,6 +25,7 @@
 #include "FilterExecutor.h"
 #include "Renderer.h"
 #include "LineBuffer.h"
+#include "ElevationSettings.h"
 #include "StylizationEngine.h"
 #include "FeatureTypeStyleVisitor.h"
 #include "SE_Renderer.h"
@@ -212,7 +213,36 @@
 
                 //if we know how to stylize this type of geometry, then go ahead
                 if (adapter)
-                    adapter->Stylize(m_renderer, features, exec, lb, fts, lr_tooltip, lr_url);
+                {
+                    RS_ElevationSettings* elevSettings = NULL; 
+                    MdfModel::ElevationSettings* modelElevSettings = range->GetElevationSettings();
+                    if(modelElevSettings != NULL)
+                    {
+                        RS_ElevationType elevType;
+                        switch(modelElevSettings->GetElevationType())
+                        {
+                        case MdfModel::ElevationSettings::Absolute:
+                            {
+                                elevType = RS_ElevationType_Absolute;
+                                break;
+                            }
+                        case MdfModel::ElevationSettings::RelativeToGround:
+                        default:
+                            {
+                                elevType = RS_ElevationType_RelativeToGround;
+                                break;
+                            }
+                        }
+                        elevSettings = new RS_ElevationSettings(modelElevSettings->GetZOffsetExpression(),
+                            modelElevSettings->GetZExtrusionExpression(),
+                            MdfModel::LengthConverter::UnitToMeters(modelElevSettings->GetUnit(), 1.0),
+                            elevType);
+                    }
+                    adapter->Stylize(m_renderer, features, exec, lb, fts, lr_tooltip, lr_url, elevSettings);
+                    
+                    delete elevSettings;
+                    elevSettings = NULL;
+                }
             }
         }
 

Modified: trunk/MgDev/Common/Stylization/GDRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/GDRenderer.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/GDRenderer.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -395,7 +395,10 @@
 void GDRenderer::StartFeature(RS_FeatureReader* /*feature*/,
                               const RS_String* /*tooltip*/,
                               const RS_String* /*url*/,
-                              const RS_String* /*theme*/ )
+                              const RS_String* /*theme*/,
+                              double /*zOffset*/,
+                              double /*zExtrusion*/,
+                              RS_ElevationType /*zOffsetType*/)
 {
 }
 

Modified: trunk/MgDev/Common/Stylization/GDRenderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/GDRenderer.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/GDRenderer.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -80,8 +80,12 @@
     STYLIZATION_API virtual void StartFeature(RS_FeatureReader* feature,
                                               const RS_String*  tooltip = NULL,
                                               const RS_String*  url = NULL,
-                                              const RS_String* theme = NULL);
+                                              const RS_String* theme = NULL,
+                                              double zOffset = 0,
+                                              double zExtrusion = 0,
+                                              RS_ElevationType zOffsetType = RS_ElevationType_RelativeToGround);
 
+
     STYLIZATION_API virtual void ProcessPolygon(LineBuffer* lb, RS_FillStyle& fill);
 
     STYLIZATION_API virtual void ProcessPolyline(LineBuffer* lb, RS_LineStroke& lsym);

Modified: trunk/MgDev/Common/Stylization/GeometryAdapter.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/GeometryAdapter.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/GeometryAdapter.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -763,3 +763,31 @@
 
     return expr;
 }
+
+bool GeometryAdapter::GetElevationParams(RS_ElevationSettings* elevSettings, 
+    double& zOffset, double& zExtrusion, RS_ElevationType& elevType)
+{
+    // Elevation Settings
+    elevType = RS_ElevationType_RelativeToGround;
+    zOffset = 0;
+    zExtrusion = 0;
+    if(elevSettings != NULL)
+    {
+        RS_String zExtrusionExpression = elevSettings->zExtrusionExpression();;
+        RS_String zOffsetExpression = elevSettings->zOffsetExpression();
+        elevType = elevSettings->elevType();
+        double metersPerUnit = elevSettings->metersPerUnit();
+        if (!zOffsetExpression.empty())
+        {
+            EvalDouble(zOffsetExpression, zOffset);
+            zOffset *= metersPerUnit;
+        }
+        if(!zExtrusionExpression.empty())
+        {
+            EvalDouble(zExtrusionExpression, zExtrusion);
+            zExtrusion *= metersPerUnit;
+        }
+    }
+    return true;
+}
+

Modified: trunk/MgDev/Common/Stylization/GeometryAdapter.h
===================================================================
--- trunk/MgDev/Common/Stylization/GeometryAdapter.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/GeometryAdapter.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -52,7 +52,8 @@
                          LineBuffer*                    /*lb*/,
                          MdfModel::FeatureTypeStyle*    /*style*/,
                          const MdfModel::MdfString*     /*tooltip = NULL*/,
-                         const MdfModel::MdfString*     /*url = NULL*/
+                         const MdfModel::MdfString*     /*url = NULL*/,
+                         RS_ElevationSettings*          /*elevSettings = NULL*/
                          )
     {
     };
@@ -107,6 +108,8 @@
     bool EvalDouble(const MdfModel::MdfString& expr, double& res);
     bool EvalBoolean(const MdfModel::MdfString& expr, bool& res);
     bool EvalString(const MdfModel::MdfString& exprstr, RS_String& res);
+    bool GetElevationParams(RS_ElevationSettings* elevationSettings, 
+        double& zOffset, double& zExtrusion, RS_ElevationType& elevType);
 
     RS_FilterExecutor* m_exec;
     LineBufferPool* m_lbPool;

Modified: trunk/MgDev/Common/Stylization/KmlRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/KmlRenderer.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/KmlRenderer.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -29,7 +29,8 @@
 const double ELEV_FACTOR = 0.1;
 
 //default constructor
-KmlRenderer::KmlRenderer(KmlContent* kmlContent, RS_Bounds& extents, double scale, double dpi, int drawOrder) :
+KmlRenderer::KmlRenderer(KmlContent* kmlContent, RS_Bounds& extents, 
+        double scale, double dpi, int drawOrder) :
     m_mainContent(kmlContent),
     m_kmlContent(kmlContent),
     m_styleContent(NULL),
@@ -39,7 +40,10 @@
     m_scale(scale),
     m_styleId(0),
     m_extents(extents),
-    m_drawOrder(drawOrder)
+    m_drawOrder(drawOrder),
+    m_elevation(0),
+    m_extrude(false),
+    m_elevType(RS_ElevationType_RelativeToGround)
 {
     m_kmlContent = m_mainContent;
     m_pixelSize = METERS_PER_INCH / dpi;
@@ -112,7 +116,10 @@
 void KmlRenderer::StartFeature(RS_FeatureReader* /*feature*/,
                               const RS_String* tooltip,
                               const RS_String* url, 
-                              const RS_String* theme)
+                              const RS_String* theme,
+                              double zOffset,
+                              double zExtrusion,
+                              RS_ElevationType zOffsetType)
 {
     if(m_featureCount > 0)
     {
@@ -163,8 +170,41 @@
         m_kmlContent->WriteString("</description>");
     }
     m_featureCount++;
+
+    // Elevation / Extrusion settings
+    m_elevation = zExtrusion + zOffset;
+    m_extrude = (zExtrusion > 0);
+    m_elevType = zOffsetType;
 }
 
+void KmlRenderer::WriteElevationSettings()
+{
+    if(m_elevation == 0)
+    {
+        m_kmlContent->WriteString("<altitudeMode>clampToGround</altitudeMode>");
+        m_kmlContent->WriteString("<tesselate>1</tesselate>");
+    }
+    else
+    {
+        if(m_extrude)
+        {
+            m_kmlContent->WriteString("<extrude>1</extrude>");
+        }
+        switch(m_elevType)
+        {
+        case RS_ElevationType_RelativeToGround:
+            {
+                m_kmlContent->WriteString("<altitudeMode>relativeToGround</altitudeMode>");
+                break;
+            }
+        case RS_ElevationType_Absolute:
+            {
+                m_kmlContent->WriteString("<altitudeMode>absolute</altitudeMode>");
+                break;
+            }
+        }
+    }
+}
 
 void KmlRenderer::ProcessPolygon(LineBuffer* lb,
                                 RS_FillStyle& fill)
@@ -177,7 +217,7 @@
         if(lb->cntr_count() == 1)
         {
             m_kmlContent->WriteString("<Polygon>");
-            m_kmlContent->WriteString("<altitudeMode>clampToGround</altitudeMode>");
+            WriteElevationSettings();
             m_kmlContent->WriteString("<outerBoundaryIs>");
             WriteLinearRing(lb->points(), 0, lb->point_count());
             m_kmlContent->WriteString("</outerBoundaryIs>");
@@ -186,7 +226,7 @@
         else
         {
             m_kmlContent->WriteString("<MultiGeometry>");
-            m_kmlContent->WriteString("<altitudeMode>clampToGround</altitudeMode>");
+            WriteElevationSettings();
             PolygonUtils::SORTEDRINGS rings;
             PolygonUtils::DetermineInteriorAndExteriorPolygons(lb, rings);
             for (PolygonUtils::SORTEDRINGS::iterator sIter = rings.begin(); sIter != rings.end(); sIter++)
@@ -201,6 +241,7 @@
                 {
                     // write the outer ring
                     m_kmlContent->WriteString("<Polygon>");
+                    WriteElevationSettings();
                     m_kmlContent->WriteString("<outerBoundaryIs>");
                     WriteLinearRing(pRingData->m_ringPoints, pRingData->m_ringPointOffset, pRingData->m_ringPointCount);
                     m_kmlContent->WriteString("</outerBoundaryIs>");
@@ -238,11 +279,10 @@
     char buffer[256];
     m_kmlContent->WriteString("<coordinates>");
     int pointOffset;
-    double elevation = ELEV_FACTOR * m_drawOrder;
     for(int i = 0; i < numPoints; i ++)
     {
         pointOffset = offset + (i * 2);
-        sprintf(buffer, "%f, %f, %f%s", points[pointOffset], points[pointOffset + 1], elevation, (i < numPoints - 1) ? "," : "");
+        sprintf(buffer, "%f, %f, %f%s", points[pointOffset], points[pointOffset + 1], m_elevation, (i < numPoints - 1) ? "," : "");
         m_kmlContent->WriteString(buffer);
     }
     m_kmlContent->WriteString("</coordinates>");
@@ -255,7 +295,7 @@
     WriteStyle(lsym);
 
     m_kmlContent->WriteString("<MultiGeometry>");
-    m_kmlContent->WriteString("<altitudeMode>clampToGround</altitudeMode>");
+    WriteElevationSettings();
     int offset = 0;
     int numCntrs = srclb->cntr_count();
     for(int i = 0; i < numCntrs; i++)
@@ -298,9 +338,9 @@
     m_kmlContent->WriteString(mdef.name(), false);
     m_kmlContent->WriteString("]]></name>");
     m_kmlContent->WriteString("<Point>");
-    m_kmlContent->WriteString("<altitudeMode>clampToGround</altitudeMode>");
+    WriteElevationSettings();
     m_kmlContent->WriteString("<coordinates>");
-    sprintf(buffer, "%f, %f, %f", x, y, ELEV_FACTOR * m_drawOrder);
+    sprintf(buffer, "%f, %f, %f", x, y, m_elevation);
     m_kmlContent->WriteString(buffer);
     m_kmlContent->WriteString("</coordinates>");
     m_kmlContent->WriteString("</Point>");
@@ -538,3 +578,4 @@
 
 
 
+

Modified: trunk/MgDev/Common/Stylization/KmlRenderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/KmlRenderer.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/KmlRenderer.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -41,7 +41,9 @@
 class KmlRenderer : public Renderer
 {
 public:
-    STYLIZATION_API KmlRenderer(KmlContent* kmlContent, RS_Bounds& extents, double scale, double dpi, int drawOrder);
+
+    STYLIZATION_API KmlRenderer(KmlContent* kmlContent, RS_Bounds& extents, 
+        double scale, double dpi, int drawOrder);
     STYLIZATION_API ~KmlRenderer();
 
     ///////////////////////////////////
@@ -64,8 +66,12 @@
     STYLIZATION_API virtual void StartFeature(RS_FeatureReader* feature,
                                               const RS_String*  tooltip = NULL,
                                               const RS_String*  url = NULL, 
-                                              const RS_String* theme = NULL);
+                                              const RS_String* theme = NULL,
+                                              double zOffset = 0,
+                                              double zExtrusion = 0,
+                                              RS_ElevationType zOffsetType = RS_ElevationType_RelativeToGround);
 
+
     STYLIZATION_API virtual void ProcessPolygon(LineBuffer* lb, RS_FillStyle& fill);
 
     STYLIZATION_API virtual void ProcessPolyline(LineBuffer* lb, RS_LineStroke& lsym);
@@ -126,6 +132,7 @@
     void WriteStyle(RS_LineStroke& lsym);
     void WriteLinearRing(double* points, int offset, int numPoints);
     void WriteCoordinates(double* points, int offset, int numPoints);
+    void WriteElevationSettings();
     void ClearThemes();
     void ClearStyles();
 
@@ -143,6 +150,9 @@
     KmlPolyStyleIdMap m_polyStyleMap;
     double m_pixelSize;
     int m_drawOrder;
+    double m_elevation;
+    bool m_extrude;
+    RS_ElevationType m_elevType;
 };
 
 #endif

Modified: trunk/MgDev/Common/Stylization/PointAdapter.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/PointAdapter.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/PointAdapter.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -50,7 +50,8 @@
                            LineBuffer*                 lb,
                            MdfModel::FeatureTypeStyle* style,
                            const MdfModel::MdfString*  tooltip,
-                           const MdfModel::MdfString*  url)
+                           const MdfModel::MdfString*  url,
+                           RS_ElevationSettings*       elevSettings) 
 {
     m_exec = exec;
 
@@ -95,6 +96,12 @@
     if (url && !url->empty())
         EvalString(*url, eurl);
 
+    // Elevation Settings
+    RS_ElevationType elevType = RS_ElevationType_RelativeToGround;
+    double zOffset = 0;
+    double zExtrusion = 0;
+    GetElevationParams(elevSettings, zOffset, zExtrusion, elevType);
+
     //send the geometry to the rendering pipeline
 
     //process point symbol, if any.
@@ -116,7 +123,8 @@
 
     if (psym && psym->GetSymbol())
     {
-        renderer->StartFeature(features, tip.empty()? NULL : &tip, eurl.empty()? NULL : &eurl, theme.empty() ? NULL : &theme);
+        renderer->StartFeature(features, tip.empty()? NULL : &tip, eurl.empty()? NULL : &eurl, 
+            theme.empty() ? NULL : &theme, zOffset, zExtrusion, elevType);
 
         //quick check if style is already cached
         RS_MarkerDef* cachedStyle = m_hPointSymCache[psym];

Modified: trunk/MgDev/Common/Stylization/PointAdapter.h
===================================================================
--- trunk/MgDev/Common/Stylization/PointAdapter.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/PointAdapter.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -33,7 +33,8 @@
                          LineBuffer*                    lb,
                          MdfModel::FeatureTypeStyle*    style,
                          const MdfModel::MdfString*     tooltip = NULL,
-                         const MdfModel::MdfString*     url = NULL
+                         const MdfModel::MdfString*     url = NULL,
+                         RS_ElevationSettings*          elevSettings = NULL
                          );
 
     void ObtainStyle(   MdfModel::PointSymbolization2D*    psym,

Modified: trunk/MgDev/Common/Stylization/PolygonAdapter.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/PolygonAdapter.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/PolygonAdapter.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -50,7 +50,8 @@
                              LineBuffer*                 lb,
                              MdfModel::FeatureTypeStyle* style,
                              const MdfModel::MdfString*  tooltip,
-                             const MdfModel::MdfString*  url)
+                             const MdfModel::MdfString*  url,
+                             RS_ElevationSettings*       elevSettings)
 {
     m_exec = exec;
 
@@ -88,13 +89,19 @@
     RS_String tip; //TODO: this should be quick since we are not assigning
     RS_String eurl;
     const RS_String &theme = rule->GetLegendLabel();
-
+    
+    // Elevation Settings
+    RS_ElevationType elevType = RS_ElevationType_RelativeToGround;
+    double zOffset = 0;
+    double zExtrusion = 0;
+    GetElevationParams(elevSettings, zOffset, zExtrusion, elevType);
+    
     if (tooltip && !tooltip->empty())
         EvalString(*tooltip, tip);
     if (url && !url->empty())
         EvalString(*url, eurl);
 
-    renderer->StartFeature(features, tip.empty()? NULL : &tip, eurl.empty()? NULL : &eurl, theme.empty() ? NULL : &theme);
+    renderer->StartFeature(features, tip.empty()? NULL : &tip, eurl.empty()? NULL : &eurl, theme.empty() ? NULL : &theme, zOffset, zExtrusion, elevType);
 
     //quick check if style is already cached
     RS_FillStyle* cachedStyle = m_hAreaSymCache[asym];

Modified: trunk/MgDev/Common/Stylization/PolygonAdapter.h
===================================================================
--- trunk/MgDev/Common/Stylization/PolygonAdapter.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/PolygonAdapter.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -33,7 +33,8 @@
                          LineBuffer*                    lb,
                          MdfModel::FeatureTypeStyle*    style,
                          const MdfModel::MdfString*     tooltip = NULL,
-                         const MdfModel::MdfString*     url = NULL
+                         const MdfModel::MdfString*     url = NULL,
+                         RS_ElevationSettings*          elevSettings = NULL
                          );
 
 private:

Modified: trunk/MgDev/Common/Stylization/PolylineAdapter.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/PolylineAdapter.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/PolylineAdapter.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -50,7 +50,8 @@
                               LineBuffer*                 lb,
                               MdfModel::FeatureTypeStyle* style,
                               const MdfModel::MdfString*  tooltip,
-                              const MdfModel::MdfString*  url)
+                              const MdfModel::MdfString*  url,
+                              RS_ElevationSettings*       elevSettings)
 {
     m_exec = exec;
 
@@ -93,8 +94,15 @@
     if (url && !url->empty())
         EvalString(*url, eurl);
 
-    renderer->StartFeature(features, tip.empty()? NULL : &tip, eurl.empty()? NULL : &eurl, theme.empty() ? NULL : &theme);
+    // Elevation Settings
+    RS_ElevationType elevType = RS_ElevationType_RelativeToGround;
+    double zOffset = 0;
+    double zExtrusion = 0;
+    GetElevationParams(elevSettings, zOffset, zExtrusion, elevType);
 
+    renderer->StartFeature(features, tip.empty()? NULL : &tip, eurl.empty()? NULL : &eurl, 
+        theme.empty() ? NULL : &theme, zOffset, zExtrusion, elevType);
+
     for (int i=0; i<lsymc->GetCount(); i++)
     {
         MdfModel::LineSymbolization2D* lsym = lsymc->GetAt(i);

Modified: trunk/MgDev/Common/Stylization/PolylineAdapter.h
===================================================================
--- trunk/MgDev/Common/Stylization/PolylineAdapter.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/PolylineAdapter.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -33,7 +33,8 @@
                          LineBuffer*                    lb,
                          MdfModel::FeatureTypeStyle*    style,
                          const MdfModel::MdfString*     tooltip = NULL,
-                         const MdfModel::MdfString*     url = NULL
+                         const MdfModel::MdfString*     url = NULL,
+                         RS_ElevationSettings*          elevSettings = NULL
                          );
 
 private:

Modified: trunk/MgDev/Common/Stylization/RasterAdapter.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/RasterAdapter.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/RasterAdapter.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -38,7 +38,8 @@
                             RS_Raster*                  raster,
                             MdfModel::GridColorStyle*   style,
                             const MdfModel::MdfString*  /*tooltip*/,
-                            const MdfModel::MdfString*  /*url*/
+                            const MdfModel::MdfString*  /*url*/,
+                            RS_ElevationSettings*       /*elevSettings*/
                             )
 {
     m_exec = exec;

Modified: trunk/MgDev/Common/Stylization/RasterAdapter.h
===================================================================
--- trunk/MgDev/Common/Stylization/RasterAdapter.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/RasterAdapter.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -30,7 +30,8 @@
                          RS_Raster*                  raster,
                          MdfModel::GridColorStyle*   style,
                          const MdfModel::MdfString*  tooltip = NULL,
-                         const MdfModel::MdfString*  url = NULL
+                         const MdfModel::MdfString*  url = NULL,
+                         RS_ElevationSettings*       elevSettings = NULL
                          );
 
     void DecodeRGBA(RS_InputStream* is, unsigned char* dst, int w, int h);

Modified: trunk/MgDev/Common/Stylization/Renderer.h
===================================================================
--- trunk/MgDev/Common/Stylization/Renderer.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/Renderer.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -77,7 +77,10 @@
     virtual void StartFeature (RS_FeatureReader* feature,
                                const RS_String*  tooltip = NULL,
                                const RS_String*  url = NULL,
-                               const RS_String* theme = NULL) = 0;
+                               const RS_String* theme = NULL,
+                               double zOffset = 0,
+                               double zExtrusion = 0,
+                               RS_ElevationType zOffsetType = RS_ElevationType_RelativeToGround) = 0;
 
     ///<summary>
     /// Done processing current feature.

Modified: trunk/MgDev/Common/Stylization/RendererStyles.h
===================================================================
--- trunk/MgDev/Common/Stylization/RendererStyles.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Common/Stylization/RendererStyles.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -100,7 +100,13 @@
     RS_OverpostType_FirstFit
 };
 
+enum RS_ElevationType
+{
+    RS_ElevationType_RelativeToGround,
+    RS_ElevationType_Absolute
+};
 
+
 //////////////////////////////////////////////////////////////////////////////
 class RS_Color
 {
@@ -416,7 +422,41 @@
     RS_String      m_label;
 };
 
+//////////////////////////////////////////////////////////////////////////////
+class RS_ElevationSettings
+{
+public:
+    RS_ElevationSettings() :
+        m_zOffsetExpression(L""),
+        m_zExtrusionExpression(L""),
+        m_elevType(RS_ElevationType_RelativeToGround),
+        m_metersPerUnit(1.0)
+    {
+    }
 
+    RS_ElevationSettings(const RS_String& zOffsetExpression,
+        const RS_String& zExtrusionExpression, 
+        double metersPerUnit,
+        RS_ElevationType elevType) :
+        m_zOffsetExpression(zOffsetExpression),
+        m_zExtrusionExpression(zExtrusionExpression),
+        m_metersPerUnit(metersPerUnit),
+        m_elevType(elevType)
+    {
+    }
+
+    inline RS_String&       zOffsetExpression()  { return m_zOffsetExpression; }
+    inline RS_String&       zExtrusionExpression()  { return m_zExtrusionExpression; }
+    inline RS_ElevationType elevType()  { return m_elevType; }
+    inline double           metersPerUnit() {return m_metersPerUnit; }
+
+private:
+    RS_ElevationType m_elevType;
+    RS_String      m_zOffsetExpression;
+    RS_String      m_zExtrusionExpression;
+    double         m_metersPerUnit;
+};
+
 //////////////////////////////////////////////////////////////////////////////
 class RS_LayerUIInfo
 {

Modified: trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -157,7 +157,7 @@
     kmlContent.StartDocument();
     kmlContent.WriteString("<visibility>1</visibility>");
     Ptr<MgCoordinateSystem> destCs = m_csFactory->Create(GOOGLE_EARTH_WKT);
-    Ptr<MgEnvelope> destExtent = GetLayerExtent(layer, destCs);
+    Ptr<MgEnvelope> destExtent = GetLayerExtent(ldf.get(), destCs);
     if(destExtent != NULL)
     {
         double widthMeters = destCs->ConvertCoordinateSystemUnitsToMeters(destExtent->GetWidth());
@@ -273,7 +273,7 @@
         KmlContent kmlContent;
         kmlContent.StartDocument();
         kmlContent.WriteString("<visibility>1</visibility>");
-        AppendFeatures(layer, extents, scale, dpi, drawOrder, kmlContent);
+        AppendFeatures(layer, ldf.get(), extents, scale, dpi, drawOrder, kmlContent);
         kmlContent.EndDocument();
         Ptr<MgByteSource> byteSource = GetByteSource(kmlContent, format);
         if(byteSource != NULL)
@@ -411,21 +411,13 @@
 }
 
 void MgServerKmlService::AppendFeatures(MgLayer* layer,
+                                        MdfModel::LayerDefinition* layerDef,
                                         MgEnvelope* extents,
                                         double scale,
                                         double dpi,
                                         INT32 drawOrder,
                                         KmlContent& kmlContent)
 {
-
-    if(m_svcResource == NULL)
-    {
-        InitializeResourceService();
-    }
-
-    //get layer definition
-    Ptr<MgResourceIdentifier> resId = layer->GetLayerDefinition();
-    auto_ptr<MdfModel::LayerDefinition> ldf(MgStylizationUtil::GetLayerDefinition(m_svcResource, resId));
     MgCSTrans* csTrans = NULL;
     RS_UIGraphic uig(NULL, 0, layer->GetLegendLabel());
     RS_LayerUIInfo layerInfo( layer->GetName(),
@@ -445,14 +437,14 @@
         extents->GetLowerLeftCoordinate()->GetY(),
         extents->GetUpperRightCoordinate()->GetX(),
         extents->GetUpperRightCoordinate()->GetY());
-    KmlRenderer renderer(&kmlContent, bounds, scale, dpi, drawOrder);
-    DefaultStylizer stylizer;
-    stylizer.Initialize(&renderer);
-    MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
-//    MdfModel::DrawingLayerDefinition* dl = dynamic_cast<MdfModel::DrawingLayerDefinition*>(ldf.get());
-//    MdfModel::GridLayerDefinition* gl = dynamic_cast<MdfModel::GridLayerDefinition*>(ldf.get());    
+
+    //    MdfModel::DrawingLayerDefinition* dl = dynamic_cast<MdfModel::DrawingLayerDefinition*>(ldf.get());
+    MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDef);
     if(vl != NULL)
     {
+        KmlRenderer renderer(&kmlContent, bounds, scale, dpi, drawOrder);
+        DefaultStylizer stylizer;
+        stylizer.Initialize(&renderer);
         if(m_svcFeature == NULL)
         {
             InitializeFeatureService();
@@ -483,36 +475,7 @@
         }
         delete rdr;
     }
-/*    else if(gl != NULL)
-    {
-        int widthPix = 600;
-        int heightPix = 300;
-        
-        if(m_svcFeature == NULL)
-        {
-            InitializeFeatureService();
-        }
 
-        Ptr<MgCoordinateSystem> layerCs = GetCoordinateSystem(new MgResourceIdentifier(gl->GetResourceID()));
-        if(layerCs != NULL)
-        {
-            csTrans = new MgCSTrans(layerCs, destCs);
-        }
-        RS_Bounds rsExtent(extents->GetLowerLeftCoordinate()->GetX(),
-            extents->GetLowerLeftCoordinate()->GetY(),
-            extents->GetUpperRightCoordinate()->GetX(),
-            extents->GetUpperRightCoordinate()->GetY());
-        Ptr<MgFeatureReader> featureReader = MgStylizationUtil::ExecuteRasterQuery(m_svcFeature, rsExtent, gl, NULL, destCs, layerCs, widthPix, heightPix);
-        if (featureReader.p)
-        {
-            //wrap in an RS_FeatureReader
-            RSMgFeatureReader rsrdr(featureReader, gl->GetGeometry());
-            RS_FeatureClassInfo fcInfo(gl->GetFeatureName());
-            renderer.StartLayer(&layerInfo, &fcInfo);
-            stylizer.StylizeGridLayer(gl, &rsrdr, csTrans, NULL, NULL);
-            renderer.EndLayer();
-        }
-    }*/
     /*else if(dl != NULL)
     {
         if(m_svcDrawing == NULL)
@@ -566,21 +529,15 @@
     return min(xScale, yScale);
 }
 
-MgEnvelope* MgServerKmlService::GetLayerExtent(MgLayer* layer, MgCoordinateSystem* destCs)
+MgEnvelope* MgServerKmlService::GetLayerExtent(MdfModel::LayerDefinition* layerDef, MgCoordinateSystem* destCs)
 {
     Ptr<MgEnvelope> envelope;
 
-    if(layer != NULL)
+    if(layerDef != NULL)
     {
-        if(m_svcResource == NULL)
-        {
-            InitializeResourceService();
-        }
-        Ptr<MgResourceIdentifier> resId = layer->GetLayerDefinition();
-        auto_ptr<MdfModel::LayerDefinition> ldf(MgStylizationUtil::GetLayerDefinition(m_svcResource, resId));
-        MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
-        MdfModel::DrawingLayerDefinition* dl = dynamic_cast<MdfModel::DrawingLayerDefinition*>(ldf.get());
-        MdfModel::GridLayerDefinition* gl = dynamic_cast<MdfModel::GridLayerDefinition*>(ldf.get());
+        MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDef);
+        MdfModel::DrawingLayerDefinition* dl = dynamic_cast<MdfModel::DrawingLayerDefinition*>(layerDef);
+        MdfModel::GridLayerDefinition* gl = dynamic_cast<MdfModel::GridLayerDefinition*>(layerDef);
         Ptr<MgCoordinateSystemTransform> csTrans;
         if(vl != NULL || gl != NULL)
         {
@@ -618,6 +575,11 @@
         }
         else if(dl != NULL)
         {
+            if(m_svcResource == NULL)
+            {
+                InitializeResourceService();
+            }
+
             Ptr<MgResourceIdentifier> resId = new MgResourceIdentifier(dl->GetResourceID());
 
             //get the resource content to see if there is a coordinate system
@@ -892,3 +854,5 @@
 
 
 
+
+

Modified: trunk/MgDev/Server/src/Services/Kml/ServerKmlService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Kml/ServerKmlService.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Server/src/Services/Kml/ServerKmlService.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -107,6 +107,7 @@
         KmlContent& kmlContent);
 
     void AppendFeatures(MgLayer* layer, 
+        MdfModel::LayerDefinition* layerDef,
         MgEnvelope* extents, 
         double scale, 
         double dpi,
@@ -125,7 +126,7 @@
     MgCoordinateSystem* GetCoordinateSystem(MgResourceIdentifier* featureSourceResId);
 
     STRING ReadElement(STRING input, STRING elementName, size_t& offset);
-    MgEnvelope* GetLayerExtent(MgLayer* layer, MgCoordinateSystem* destCs);
+    MgEnvelope* GetLayerExtent(MdfModel::LayerDefinition* layerDef, MgCoordinateSystem* destCs);
     double GetScale(MgEnvelope* llExtents, int width, int height, double dpi);
     STRING GetSessionId();
     

Modified: trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -52,7 +52,13 @@
 }
 
 
-void FeatureInfoRenderer::StartFeature (RS_FeatureReader* feature, const RS_String* tooltip, const RS_String* url, const RS_String* theme)
+void FeatureInfoRenderer::StartFeature (RS_FeatureReader* feature, 
+                            const RS_String* tooltip, 
+                            const RS_String* url, 
+                            const RS_String* theme,
+                            double /*zOffset*/,
+                            double /*zExtrusion*/,
+                            RS_ElevationType /*zOffsetType*/)
 {
     //add feature ID to the selection set
     if (m_selection)

Modified: trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.h
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Server/src/Services/Rendering/FeatureInfoRenderer.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -101,7 +101,10 @@
     virtual void StartFeature(RS_FeatureReader* feature,
                               const RS_String*  tooltip = NULL,
                               const RS_String*  url = NULL,
-                              const RS_String* theme = NULL);
+                              const RS_String* theme = NULL,
+                              double zOffset = 0,
+                              double zExtrusion = 0,
+                              RS_ElevationType zOffsetType = RS_ElevationType_RelativeToGround);
 
     virtual RS_MapUIInfo* GetMapInfo();
 

Modified: trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.cpp	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.cpp	2007-03-07 22:35:38 UTC (rev 1173)
@@ -37,7 +37,13 @@
 }
 
 
-void FeaturePropRenderer::StartFeature (RS_FeatureReader* feature, const RS_String* tooltip, const RS_String* url, const RS_String* theme)
+void FeaturePropRenderer::StartFeature (RS_FeatureReader* feature, 
+                              const RS_String* tooltip, 
+                              const RS_String* url, 
+                              const RS_String* theme,
+                              double /*zOffset*/,
+                              double /*zExtrusion*/,
+                              RS_ElevationType /*zOffsetType*/)
 {
     /*
     //add feature ID to the selection set

Modified: trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.h
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.h	2007-03-07 19:32:47 UTC (rev 1172)
+++ trunk/MgDev/Server/src/Services/Rendering/FeaturePropRenderer.h	2007-03-07 22:35:38 UTC (rev 1173)
@@ -42,7 +42,10 @@
     virtual void StartFeature(RS_FeatureReader* feature,
                               const RS_String*  tooltip = NULL,
                               const RS_String*  url = NULL, 
-                              const RS_String* theme = NULL);
+                              const RS_String* theme = NULL,
+                              double zOffset = 0,
+                              double zExtrusion = 0,
+                              RS_ElevationType zOffsetType = RS_ElevationType_RelativeToGround);
 
 
     MgBatchPropertyCollection* GetProperties()



More information about the mapguide-commits mailing list