[mapguide-commits] r6043 - in trunk/MgDev: Common/MdfModel Common/MdfParser Common/PlatformBase/MapLayer Common/Schema Common/Stylization Server/src/Services/Mapping Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Aug 8 02:24:37 EDT 2011


Author: hubu
Date: 2011-08-07 23:24:37 -0700 (Sun, 07 Aug 2011)
New Revision: 6043

Added:
   trunk/MgDev/Common/MdfModel/URLData.cpp
   trunk/MgDev/Common/MdfModel/URLData.h
   trunk/MgDev/Common/MdfParser/IOURLData.cpp
   trunk/MgDev/Common/MdfParser/IOURLData.h
Modified:
   trunk/MgDev/Common/MdfModel/Makefile.am
   trunk/MgDev/Common/MdfModel/MdfModel.vcproj
   trunk/MgDev/Common/MdfModel/MdfModel.vcxproj
   trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters
   trunk/MgDev/Common/MdfModel/VectorLayerDefinition.cpp
   trunk/MgDev/Common/MdfModel/VectorLayerDefinition.h
   trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp
   trunk/MgDev/Common/MdfParser/Makefile.am
   trunk/MgDev/Common/MdfParser/MdfParser.vcproj
   trunk/MgDev/Common/MdfParser/MdfParser.vcxproj
   trunk/MgDev/Common/MdfParser/MdfParser.vcxproj.filters
   trunk/MgDev/Common/PlatformBase/MapLayer/LayerBase.cpp
   trunk/MgDev/Common/Schema/LayerDefinition-2.4.0.xsd
   trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
   trunk/MgDev/Common/Stylization/StylizationEngine.cpp
   trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
Log:
Ticket #1737 (Submit on behalf of Sam Wang)

This submission implements MapGuide RFC 119: Enhance URL information in vector layer definition.
To change the layer definition, corresponding Mdf model and parser code has also to be changed so that the new version of layer definition(mdf model) and parser can be compatible with the old version without problem.
Unit tests have be run to verify that.

Modified: trunk/MgDev/Common/MdfModel/Makefile.am
===================================================================
--- trunk/MgDev/Common/MdfModel/Makefile.am	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfModel/Makefile.am	2011-08-08 06:24:37 UTC (rev 6043)
@@ -94,6 +94,7 @@
   ThemeLabel.cpp \
   TileWatermarkPosition.cpp \
   UnicodeString.cpp \
+  URLData.cpp \
   VectorLayerDefinition.cpp \
   VectorScaleRange.cpp \
   Version.cpp \
@@ -204,6 +205,7 @@
   ThemeLabel.h \
   TileWatermarkPosition.h \
   UnicodeString.h \
+  URLData.h \
   VectorLayerDefinition.h \
   VectorScaleRange.h \
   Version.h \

Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcproj
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcproj	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcproj	2011-08-08 06:24:37 UTC (rev 6043)
@@ -594,6 +594,14 @@
 				RelativePath=".\VectorScaleRange.h"
 				>
 			</File>
+			<File
+				RelativePath=".\URLData.h"
+				>
+			</File>
+			<File
+				RelativePath=".\URLData.cpp"
+				>
+			</File>
 			<Filter
 				Name="Joins"
 				>

Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcxproj
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcxproj	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcxproj	2011-08-08 06:24:37 UTC (rev 6043)
@@ -216,6 +216,7 @@
     <ClCompile Include="HillShade.cpp" />
     <ClCompile Include="FeatureSource.cpp" />
     <ClCompile Include="SupplementalSpatialContextInfo.cpp" />
+    <ClCompile Include="URLData.cpp" />
     <ClCompile Include="VectorLayerDefinition.cpp" />
     <ClCompile Include="VectorScaleRange.cpp" />
     <ClCompile Include="AttributeRelate.cpp" />
@@ -320,6 +321,7 @@
     <ClInclude Include="HillShade.h" />
     <ClInclude Include="FeatureSource.h" />
     <ClInclude Include="SupplementalSpatialContextInfo.h" />
+    <ClInclude Include="URLData.h" />
     <ClInclude Include="VectorLayerDefinition.h" />
     <ClInclude Include="VectorScaleRange.h" />
     <ClInclude Include="AttributeRelate.h" />

Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters	2011-08-08 06:24:37 UTC (rev 6043)
@@ -117,6 +117,9 @@
     <ClCompile Include="VectorScaleRange.cpp">
       <Filter>VectorLayer</Filter>
     </ClCompile>
+	<ClCompile Include="URLData.cpp">
+		<Filter>VectorLayer</Filter>
+    </ClCompile>
     <ClCompile Include="AttributeRelate.cpp">
       <Filter>VectorLayer\Joins</Filter>
     </ClCompile>
@@ -399,6 +402,9 @@
     <ClInclude Include="VectorScaleRange.h">
       <Filter>VectorLayer</Filter>
     </ClInclude>
+	<ClInclude Include="URLData.h">
+		<Filter>VectorLayer</Filter>
+    </ClInclude>
     <ClInclude Include="AttributeRelate.h">
       <Filter>VectorLayer\Joins</Filter>
     </ClInclude>
@@ -614,6 +620,9 @@
     <ClInclude Include="stdafx.h" />
     <ClInclude Include="UnicodeString.h" />
     <ClInclude Include="Version.h" />
+    <ClInclude Include="URLData.h">
+      <Filter>VectorLayer</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MdfModel.rc" />

Added: trunk/MgDev/Common/MdfModel/URLData.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/URLData.cpp	                        (rev 0)
+++ trunk/MgDev/Common/MdfModel/URLData.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -0,0 +1,107 @@
+//
+//  Copyright (C) 2004-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
+//
+
+//-------------------------------------------------------------------------
+// DESCRIPTION:
+// The URLData class implementation.
+//-------------------------------------------------------------------------
+#include "stdafx.h"
+#include "URLData.h"
+
+using namespace MDFMODEL_NAMESPACE;
+
+//-------------------------------------------------------------------------
+// PURPOSE: Construct and initialize an instance of the URLData
+// class.
+// PARAMETERS:
+//-------------------------------------------------------------------------
+URLData::URLData()
+{
+}
+
+URLData::~URLData()
+{
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL content property.
+// RETURNS: A string representing the URL content.
+//-------------------------------------------------------------------------
+const MdfString& URLData::GetUrlContent() const
+{
+    return this->m_strUrlContent;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL content property.
+//-------------------------------------------------------------------------
+void URLData::SetUrlContent(const MdfString& urlContent)
+{
+    this->m_strUrlContent = urlContent;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL content override property.
+// RETURNS: A string representing the URL content override.
+//-------------------------------------------------------------------------
+const MdfString& URLData::GetUrlContentOverride() const
+{
+    return this->m_strUrlContentOverride;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL content override property.
+//-------------------------------------------------------------------------
+void URLData::SetUrlContentOverride(const MdfString& urlContentOverride)
+{
+    this->m_strUrlContentOverride = urlContentOverride;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL description property.
+// RETURNS: A string representing the URL description.
+//-------------------------------------------------------------------------
+const MdfString& URLData::GetUrlDescription() const
+{
+    return this->m_strUrLDescription;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL description property.
+//-------------------------------------------------------------------------
+void URLData::SetUrlDescription(const MdfString& urlDescription)
+{
+    this->m_strUrLDescription = urlDescription;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL description override property.
+// RETURNS: A string representing the URL description override.
+//-------------------------------------------------------------------------
+const MdfString& URLData::GetUrlDescriptionOverrride() const
+{
+    return this->m_strUrlDescriptionOverride;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the URL description override property.
+//-------------------------------------------------------------------------
+void URLData::SetUrlDescriptionOverrride(const MdfString& urlDescriptionOverride)
+{
+    this->m_strUrlDescriptionOverride = urlDescriptionOverride;
+}
+

Added: trunk/MgDev/Common/MdfModel/URLData.h
===================================================================
--- trunk/MgDev/Common/MdfModel/URLData.h	                        (rev 0)
+++ trunk/MgDev/Common/MdfModel/URLData.h	2011-08-08 06:24:37 UTC (rev 6043)
@@ -0,0 +1,70 @@
+//  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 URLDATA_H_
+#define URLDATA_H_
+
+#include "MdfModel.h"
+#include "MdfRootObject.h"
+
+BEGIN_NAMESPACE_MDFMODEL
+    //-------------------------------------------------------------------------
+    // DESCRIPTION:
+    // The URLData class is used by a layer to provide URL information for each 
+    // feature.
+    //-------------------------------------------------------------------------
+class MDFMODEL_API URLData : public MdfRootObject
+    {
+        public:
+            // Construction, destruction, initialization
+            URLData();
+            ~URLData();
+
+            // Operations
+            // Property : URL content
+            const MdfString& GetUrlContent() const;
+            void SetUrlContent(const MdfString &urlContent);
+
+            // Property : URL content override
+            const MdfString& GetUrlContentOverride() const;
+            void SetUrlContentOverride(const MdfString &urlContentOverride);
+
+            //Property : URL description
+            const MdfString& GetUrlDescription() const;
+            void SetUrlDescription(const MdfString &urlDescription);
+
+            //Property : URL description override
+            const MdfString& GetUrlDescriptionOverrride() const;
+            void SetUrlDescriptionOverrride(const MdfString &urlDescriptionOverride);
+
+        private:
+            // Hidden copy constructor and assignment operator.
+            URLData(const URLData&);
+            URLData& operator = (const URLData&);
+
+            //URL content
+            MdfString m_strUrlContent;
+
+            //URL content override
+            MdfString m_strUrlContentOverride;
+
+            //URL description
+            MdfString m_strUrLDescription;
+
+            //URL description override
+            MdfString m_strUrlDescriptionOverride;
+    };
+END_NAMESPACE_MDFMODEL
+#endif
+

Modified: trunk/MgDev/Common/MdfModel/VectorLayerDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/VectorLayerDefinition.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfModel/VectorLayerDefinition.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -37,6 +37,7 @@
 {
     // default values
     this->m_featureNameType = FeatureClass;
+    this->m_urlData = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -44,6 +45,10 @@
 //-------------------------------------------------------------------------
 VectorLayerDefinition::~VectorLayerDefinition()
 {
+    if(m_urlData != NULL)
+    {
+        delete this->m_urlData;
+    }
 }
 
 //-------------------------------------------------------------------------
@@ -120,20 +125,23 @@
 }
 
 //-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the Url property.
-// RETURNS: A string representing the Url.
+// PURPOSE: Retrieves the URL data for this layer definition
+// RETURNS: A pointer to the URLData object
 //-------------------------------------------------------------------------
-const MdfString& VectorLayerDefinition::GetUrl() const
+URLData* VectorLayerDefinition::GetUrlData()
 {
-    return this->m_strUrl;
+    return this->m_urlData;
 }
 
 //-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the Url property.
+// PURPOSE: Method to adopt an URLData object
+// PARAMETERS:
+//      Input:
+//         urlData - A pointer to the URLData object
 //-------------------------------------------------------------------------
-void VectorLayerDefinition::SetUrl(const MdfString&  strUrl)
+void VectorLayerDefinition::AdoptUrlData(URLData* urlData)
 {
-    this->m_strUrl = strUrl;
+    this->m_urlData = urlData;
 }
 
 //-------------------------------------------------------------------------

Modified: trunk/MgDev/Common/MdfModel/VectorLayerDefinition.h
===================================================================
--- trunk/MgDev/Common/MdfModel/VectorLayerDefinition.h	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfModel/VectorLayerDefinition.h	2011-08-08 06:24:37 UTC (rev 6043)
@@ -21,6 +21,7 @@
 #include "LayerDefinition.h"
 #include "VectorScaleRange.h"
 #include "NameStringPair.h"
+#include "URLData.h"
 
 BEGIN_NAMESPACE_MDFMODEL
 
@@ -61,8 +62,8 @@
         void SetGeometry(const MdfString&  strGeometry);
 
         // Property : Url
-        const MdfString& GetUrl() const;
-        void SetUrl(const MdfString&  strUrl);
+        URLData* GetUrlData();
+        void AdoptUrlData(URLData* urlData);
 
         // Property : ToolTip
         const MdfString& GetToolTip() const;
@@ -100,7 +101,7 @@
         MdfString m_strGeometry;
 
         // Url
-        MdfString m_strUrl;
+        URLData* m_urlData;
 
         // ToolTip
         MdfString m_strToolTip;

Added: trunk/MgDev/Common/MdfParser/IOURLData.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOURLData.cpp	                        (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOURLData.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -0,0 +1,163 @@
+//
+//  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 "IOURLData.h"
+#include "IOUnknown.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+CREATE_ELEMENT_MAP;
+ELEM_MAP_ENTRY(1, UrlData);
+ELEM_MAP_ENTRY(2, Content);
+ELEM_MAP_ENTRY(3, ContentOverride);
+ELEM_MAP_ENTRY(4, Description);
+ELEM_MAP_ENTRY(5, DescriptionOverride);
+ELEM_MAP_ENTRY(6, ExtendedData1);
+
+IOURLData::IOURLData(Version& version) : SAX2ElementHandler(version)
+{
+    this->m_urlData = NULL;
+    this->m_vectorLayerDef = NULL;
+}
+
+
+IOURLData::IOURLData(VectorLayerDefinition* vectorLayerDefinition, Version& version) : SAX2ElementHandler(version)
+{
+    this->m_urlData = NULL;
+    this->m_vectorLayerDef = vectorLayerDefinition;
+}
+
+
+IOURLData::~IOURLData()
+{
+}
+
+
+void IOURLData::StartElement(const wchar_t* name, HandlerStack* handlerStack)
+{
+    this->m_currElemName = name;
+    this->m_currElemId = _ElementIdFromName(name);
+
+    switch (this->m_currElemId)
+    {
+    case eUrlData:
+        this->m_startElemName = name;
+        if(m_urlData == NULL)
+        {
+            this->m_urlData = new URLData();
+        }
+        break;
+
+    case eExtendedData1:
+        this->m_procExtData = true;
+        break;
+
+    case eUnknown:
+        ParseUnknownXml(name, handlerStack);
+        break;
+    }
+}
+
+
+void IOURLData::ElementChars(const wchar_t* ch)
+{
+    switch (this->m_currElemId)
+    {
+    case eContent:
+        this->m_urlData->SetUrlContent(ch);
+        break;
+
+    case eContentOverride:
+        this->m_urlData->SetUrlContentOverride(ch);
+        break;
+
+    case eDescription:
+        this->m_urlData->SetUrlDescription(ch);
+        break;
+
+    case eDescriptionOverride:
+        this->m_urlData->SetUrlDescriptionOverrride(ch);
+        break;
+    }
+}
+
+
+void IOURLData::EndElement(const wchar_t* name, HandlerStack* handlerStack)
+{
+    if (this->m_startElemName == name)
+    {
+        this->m_urlData->SetUnknownXml(this->m_unknownXml);
+
+        this->m_vectorLayerDef->AdoptUrlData(this->m_urlData);
+        this->m_vectorLayerDef = NULL;
+        this->m_urlData = NULL;
+        this->m_startElemName = L"";
+        handlerStack->pop();
+        delete this;
+    }
+    else if (eExtendedData1 == _ElementIdFromName(name))
+    {
+        this->m_procExtData = false;
+    }
+}
+
+
+void IOURLData::Write(MdfStream& fd, URLData* urlData, Version* version, MgTab& tab)
+{
+    fd << tab.tab() << startStr(sUrlData) << std::endl;
+    tab.inctab();
+
+    // Property: Content
+    if(!urlData->GetUrlContent().empty())
+    {
+        fd << tab.tab() << startStr(sContent);
+        fd << EncodeString(urlData->GetUrlContent());
+        fd << endStr(sContent) << std::endl;
+    }
+
+    // Property: Content Override
+    if(!urlData->GetUrlContentOverride().empty())
+    {
+        fd << tab.tab() << startStr(sContent);
+        fd << EncodeString(urlData->GetUrlContentOverride());
+        fd << endStr(sContentOverride) << std::endl;
+    }
+
+    // Property: Description
+    if(!urlData->GetUrlDescription().empty())
+    {
+        fd << tab.tab() << startStr(sDescription);
+        fd << EncodeString(urlData->GetUrlDescription());
+        fd << endStr(sDescription) << std::endl;
+    }
+
+    // Property: Description Override
+    if(!urlData->GetUrlDescriptionOverrride().empty())
+    {
+        fd << tab.tab() << startStr(sDescriptionOverride);
+        fd << EncodeString(urlData->GetUrlDescriptionOverrride());
+        fd << endStr(sDescriptionOverride) << std::endl;
+    }
+
+    // Write any unknown XML / extended data
+    IOUnknown::Write(fd, urlData->GetUnknownXml(), version, tab);
+
+    tab.dectab();
+    fd << tab.tab() << endStr(sUrlData) << std::endl;
+}

Added: trunk/MgDev/Common/MdfParser/IOURLData.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOURLData.h	                        (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOURLData.h	2011-08-08 06:24:37 UTC (rev 6043)
@@ -0,0 +1,50 @@
+//
+//  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 _IOURLDATA_H
+#define _IOURLDATA_H
+
+#include "SAX2ElementHandler.h"
+#include "URLData.h"
+#include "VectorLayerDefinition.h"
+#include "Version.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOURLData : public SAX2ElementHandler
+{
+    public:
+        IOURLData(Version& version);
+        IOURLData(VectorLayerDefinition* vectorLayerDefinition, Version& version);
+        virtual ~IOURLData();
+
+        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);
+
+        static void Write(MdfStream& fd, URLData* urlData, Version* version, MgTab& tab);
+
+    private:
+        URLData* m_urlData;
+        VectorLayerDefinition* m_vectorLayerDef;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOURLDATA_H

Modified: trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -20,6 +20,7 @@
 #include "IONameStringPair.h"
 #include "IOVectorScaleRange.h"
 #include "IOWatermarkInstance.h"
+#include "IOURLData.h"
 #include "IOUnknown.h"
 
 using namespace XERCES_CPP_NAMESPACE;
@@ -41,6 +42,7 @@
 ELEM_MAP_ENTRY(12, ExtendedData1);
 ELEM_MAP_ENTRY(13, Watermarks);
 ELEM_MAP_ENTRY(14, Watermark);
+ELEM_MAP_ENTRY(15, UrlData);
 
 
 IOVectorLayerDefinition::IOVectorLayerDefinition(Version& version) : SAX2ElementHandler(version)
@@ -93,6 +95,14 @@
         }
         break;
 
+    case eUrlData:
+        {
+            IOURLData* IO = new IOURLData(this->m_layer, this->m_version);
+            handlerStack->push(IO);
+            IO->StartElement(name, handlerStack);
+        }
+        break;
+
     case eVectorScaleRange:
         {
             IOVectorScaleRange* IO = new IOVectorScaleRange(this->m_layer, this->m_version);
@@ -139,14 +149,24 @@
         this->m_layer->SetFilter(ch);
         break;
 
+    case eUrl:
+        //Handle layer definition <= 2.3.0
+        if(m_version < Version(2, 4, 0))
+        {
+            URLData* urlData =  this->m_layer->GetUrlData();
+            if(!urlData)
+            {
+                urlData = new URLData();
+            }
+            urlData->SetUrlContent(ch);
+            this->m_layer->AdoptUrlData(urlData);
+        }
+        break;
+
     case eGeometry:
         this->m_layer->SetGeometry(ch);
         break;
 
-    case eUrl:
-        this->m_layer->SetUrl(ch);
-        break;
-
     case eToolTip:
         this->m_layer->SetToolTip(ch);
         break;
@@ -299,11 +319,27 @@
     fd << endStr(sGeometry) << std::endl;
 
     // Property: Url
-    if (!vectorLayer->GetUrl().empty())
+    URLData* urlData = vectorLayer->GetUrlData();
+    if(urlData)
     {
-        fd << tab.tab() << startStr(sUrl);
-        fd << EncodeString(vectorLayer->GetUrl());
-        fd << endStr(sUrl) << std::endl;
+        if(!version || (*version >= Version(2, 4, 0)))
+        {
+            IOURLData::Write(fd, urlData, version, tab);
+        }
+        else
+        {
+            // For layer definition version <= 2.3.0
+            if(!urlData->GetUrlContent().empty())
+            {
+                fd << tab.tab() << startStr(sUrl);
+                fd << EncodeString(urlData->GetUrlContent());
+                fd << endStr(sUrl) << std::endl;
+            }
+            //In extended data
+            tab.inctab();
+            IOURLData::Write(fdExtData, urlData, version, tab);
+            tab.dectab();
+        }
     }
 
     // Property: ToolTip

Modified: trunk/MgDev/Common/MdfParser/Makefile.am
===================================================================
--- trunk/MgDev/Common/MdfParser/Makefile.am	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfParser/Makefile.am	2011-08-08 06:24:37 UTC (rev 6043)
@@ -95,6 +95,7 @@
   IOThemeLabel.cpp \
   IOTileWatermarkPosition.cpp \
   IOUnknown.cpp \
+  IOURLData.cpp \
   IOUtil.cpp \
   IOVectorLayerDefinition.cpp \
   IOVectorScaleRange.cpp \
@@ -196,6 +197,7 @@
   IOThemeLabel.h \
   IOTileWatermarkPosition.h \
   IOUnknown.h \
+  IOURLData.h \
   IOUtil.h \
   IOVectorLayerDefinition.h \
   IOVectorScaleRange.h \

Modified: trunk/MgDev/Common/MdfParser/MdfParser.vcproj
===================================================================
--- trunk/MgDev/Common/MdfParser/MdfParser.vcproj	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfParser/MdfParser.vcproj	2011-08-08 06:24:37 UTC (rev 6043)
@@ -1033,6 +1033,14 @@
 			>
 		</File>
 		<File
+			RelativePath=".\IOURLData.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\IOURLData.h"
+			>
+		</File>
+		<File
 			RelativePath=".\IOUtil.cpp"
 			>
 		</File>

Modified: trunk/MgDev/Common/MdfParser/MdfParser.vcxproj
===================================================================
--- trunk/MgDev/Common/MdfParser/MdfParser.vcxproj	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfParser/MdfParser.vcxproj	2011-08-08 06:24:37 UTC (rev 6043)
@@ -195,6 +195,7 @@
     <ClCompile Include="Common\IOSize2D.cpp" />
     <ClCompile Include="Common\IOStringObjectCollection.cpp" />
     <ClCompile Include="Common\IOVector3D.cpp" />
+    <ClCompile Include="IOURLData.cpp" />
     <ClCompile Include="PrintLayout\IODataConfiguration.cpp" />
     <ClCompile Include="PrintLayout\IOMapView.cpp" />
     <ClCompile Include="PrintLayout\IOMapViewportDefinition.cpp" />
@@ -297,6 +298,7 @@
     <ClInclude Include="Common\IOSize2D.h" />
     <ClInclude Include="Common\IOStringObjectCollection.h" />
     <ClInclude Include="Common\IOVector3D.h" />
+    <ClInclude Include="IOURLData.h" />
     <ClInclude Include="PrintLayout\IODataConfiguration.h" />
     <ClInclude Include="PrintLayout\IOMapView.h" />
     <ClInclude Include="PrintLayout\IOMapViewportDefinition.h" />

Modified: trunk/MgDev/Common/MdfParser/MdfParser.vcxproj.filters
===================================================================
--- trunk/MgDev/Common/MdfParser/MdfParser.vcxproj.filters	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/MdfParser/MdfParser.vcxproj.filters	2011-08-08 06:24:37 UTC (rev 6043)
@@ -141,6 +141,7 @@
     <ClCompile Include="MdfParser.cpp" />
     <ClCompile Include="SAX2ElementHandler.cpp" />
     <ClCompile Include="SAX2Parser.cpp" />
+    <ClCompile Include="IOURLData.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Common\IOColor.h">
@@ -275,6 +276,7 @@
     <ClInclude Include="SAX2ElementHandler.h" />
     <ClInclude Include="SAX2Parser.h" />
     <ClInclude Include="stdafx.h" />
+    <ClInclude Include="IOURLData.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MdfParser.rc" />

Modified: trunk/MgDev/Common/PlatformBase/MapLayer/LayerBase.cpp
===================================================================
--- trunk/MgDev/Common/PlatformBase/MapLayer/LayerBase.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/PlatformBase/MapLayer/LayerBase.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -680,7 +680,8 @@
             //does the layer have tooltips?
             //we include layers with hyperlinks, since the presence of a hyperlink
             //results in a tooltip
-            m_hasTooltips = (!vl->GetToolTip().empty()) || (!vl->GetUrl().empty());
+            bool hasUrl = vl->GetUrlData() && (!vl->GetUrlData()->GetUrlContent().empty());
+            m_hasTooltips = (!vl->GetToolTip().empty()) || hasUrl;
 
             //store the scale ranges
             MdfModel::VectorScaleRangeCollection* scaleRanges = vl->GetScaleRanges();

Modified: trunk/MgDev/Common/Schema/LayerDefinition-2.4.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/LayerDefinition-2.4.0.xsd	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/Schema/LayerDefinition-2.4.0.xsd	2011-08-08 06:24:37 UTC (rev 6043)
@@ -134,9 +134,9 @@
               <xs:documentation>Specifies the geometry property that should be used to get the geometries.</xs:documentation>
             </xs:annotation>
           </xs:element>
-          <xs:element name="Url" type="xs:string" minOccurs="0">
+          <xs:element name="UrlData" type="URLDataType" minOccurs="0">
             <xs:annotation>
-              <xs:documentation>An optional URL associated with each feature.  This is a string FDO expression.</xs:documentation>
+              <xs:documentation>The optional URL information associated with each feature.</xs:documentation>
             </xs:annotation>
           </xs:element>
           <xs:element name="ToolTip" type="xs:string" minOccurs="0">
@@ -163,6 +163,34 @@
       <xs:enumeration value="NamedExtension"/>
     </xs:restriction>
   </xs:simpleType>
+  <xs:complexType name="URLDataType">
+    <xs:annotation>
+      <xs:documentation>URL information for features.</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="Content" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>The real address of the URL. This can be a string FDO expression.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="Description" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>The description of the URL. This can be a string FDO expression.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ContentOverride" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>Specify the the override of URL content for a specific feature which can be a string FDO expression.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="DescriptionOverride" type="xs:string" minOccurs="0">
+        <xs:annotation>
+          <xs:documentation>Specify the override of URL description for a specific feature which can be a string FDO expression.</xs:documentation>
+        </xs:annotation>
+      </xs:element>
+      <xs:element name="ExtendedData1" type="ExtendedDataType" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
   <xs:complexType name="VectorScaleRangeType">
     <xs:annotation>
       <xs:documentation>The stylization to be applied to the vector features for a given scale range.</xs:documentation>

Modified: trunk/MgDev/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/DefaultStylizer.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/Stylization/DefaultStylizer.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -274,9 +274,13 @@
     }
     if (renderer->SupportsHyperlinks())
     {
-        const MdfModel::MdfString& mdfUrl = layer->GetUrl();
-        if (!mdfUrl.empty())
-            lrUrl = &mdfUrl;
+        MdfModel::URLData* urlData = layer->GetUrlData();
+        if(urlData)
+        {
+            const MdfModel::MdfString& mdfUrl = urlData->GetUrlContent();
+            if (!mdfUrl.empty())
+                lrUrl = &mdfUrl;
+        }
     }
 
     // elevation settings - also invariant

Modified: trunk/MgDev/Common/Stylization/StylizationEngine.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -78,7 +78,7 @@
     if (se_renderer->SupportsTooltips())
         m_visitor->ParseStringExpression(layer->GetToolTip(), seTip, L"");
     if (se_renderer->SupportsHyperlinks())
-        m_visitor->ParseStringExpression(layer->GetUrl(), seUrl, L"");
+        m_visitor->ParseStringExpression(layer->GetUrlData() ? layer->GetUrlData()->GetUrlContent(): L"", seUrl, L"");
 
     // extract all the composite styles once
     MdfModel::FeatureTypeStyleCollection* ftsc = range->GetFeatureTypeStyles();

Modified: trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -503,7 +503,7 @@
 
                     //extract hyperlink and tooltip info
                     if (!vl->GetToolTip().empty()) layerInfo.hastooltips() = true;
-                    if (!vl->GetUrl().empty()) layerInfo.hashyperlinks() = true;
+                    if (!vl->GetUrlData() && !vl->GetUrlData()->GetUrlContent().empty()) layerInfo.hashyperlinks() = true;
 
                     //set up the property name mapping -- it tells us what
                     //string the viewer should be displaying as the name of each

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2011-08-08 06:19:51 UTC (rev 6042)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2011-08-08 06:24:37 UTC (rev 6043)
@@ -1577,7 +1577,7 @@
 
                     //extract hyperlink and tooltip info
                     if (!vl->GetToolTip().empty()) layerinfo.hastooltips() = true;
-                    if (!vl->GetUrl().empty()) layerinfo.hashyperlinks() = true;
+                    if (!vl->GetUrlData()->GetUrlContent().empty()) layerinfo.hashyperlinks() = true;
 
                     //set up the property name mapping -- it tells us what
                     //string the viewer should be displaying as the name of each



More information about the mapguide-commits mailing list