[mapguide-commits] r4273 - in sandbox/adsk/2.1: Common/PlatformBase/Services Server/src/Services/Feature

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Sep 29 11:51:03 EDT 2009


Author: brucedechant
Date: 2009-09-29 11:51:01 -0400 (Tue, 29 Sep 2009)
New Revision: 4273

Modified:
   sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.cpp
   sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.h
   sandbox/adsk/2.1/Server/src/Services/Feature/JoinFeatureReader.cpp
   sandbox/adsk/2.1/Server/src/Services/Feature/ServerDescribeSchema.cpp
   sandbox/adsk/2.1/Server/src/Services/Feature/ServerGetFeatures.cpp
   sandbox/adsk/2.1/Server/src/Services/Feature/ServerGwsGetFeatures.cpp
   sandbox/adsk/2.1/Server/src/Services/Feature/TransformCache.cpp
Log:
Fix for trac ticket 600 - WMS - coordinate system overriding fails
http://trac.osgeo.org/mapguide/ticket/600

Submitted on behalf of Troy Louden

Notes:
- Added spatial context association for raster properties


Modified: sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.cpp
===================================================================
--- sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.cpp	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.cpp	2009-09-29 15:51:01 UTC (rev 4273)
@@ -73,6 +73,19 @@
 }
 
 /// <summary>
+/// Gets the Spatial Context name associated to this raster property.
+/// </summary>
+/// <returns>
+/// Returns a String value representing the Spatial Context name.
+/// If empty then the geometric property is associated with all the Spatial Contexts
+/// in the datastore.
+/// </returns>
+STRING MgRasterPropertyDefinition::GetSpatialContextAssociation()
+{
+    return m_associatedSCName;
+}
+
+/// <summary>
 /// Sets a Boolean value that specifies whether this geometric property is read-only.
 /// </summary>
 /// <param name="value">
@@ -115,6 +128,19 @@
     m_sizeY = size;
 }
 
+/// <summary>
+/// Sets/add a Spatial Context association to this raster property.
+/// </summary>
+/// <param name="value">
+/// Input the Spatial Context name to be added/set.
+/// Defaults to the active Spatial Context.
+/// </param>
+/// <returns>Returns nothing</returns>
+void MgRasterPropertyDefinition::SetSpatialContextAssociation(CREFSTRING spatialContextName)
+{
+    m_associatedSCName = spatialContextName;
+}
+
 MgRasterPropertyDefinition::MgRasterPropertyDefinition()
 {
     Initialize();
@@ -128,6 +154,7 @@
     stream->WriteInt32(m_sizeX);
     stream->WriteInt32(m_sizeY);
     stream->WriteString(m_serializedXml);
+    stream->WriteString(m_associatedSCName);
 }
 
 void MgRasterPropertyDefinition::Deserialize(MgStream* stream)
@@ -138,6 +165,7 @@
     stream->GetInt32(m_sizeX);
     stream->GetInt32(m_sizeY);
     stream->GetString(m_serializedXml);
+    stream->GetString(m_associatedSCName);
 }
 
 void MgRasterPropertyDefinition::Initialize()
@@ -146,8 +174,11 @@
     m_nullable = false;
     m_sizeX = 0;
     m_sizeY = 0;
+    m_serializedXml = L"";
+    m_associatedSCName = L"";
 }
 
 void MgRasterPropertyDefinition::ToXml(string& xmlStr, bool includeType)
 {
 }
+

Modified: sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.h
===================================================================
--- sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.h	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Common/PlatformBase/Services/RasterPropertyDefinition.h	2009-09-29 15:51:01 UTC (rev 4273)
@@ -141,7 +141,32 @@
     /// rows).
     ///
     INT32 GetDefaultImageYSize();   /// __get, __set
-
+    
+    ////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Gets the Spatial Context name associated with this raster
+    /// property.
+    ///
+    /// <!-- Syntax in .Net, Java, and PHP -->
+    /// \htmlinclude DotNetSyntaxTop.html
+    /// string GetSpatialContextAssociation();
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude JavaSyntaxTop.html
+    /// String GetSpatialContextAssociation();
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude PHPSyntaxTop.html
+    /// string GetSpatialContextAssociation();
+    /// \htmlinclude SyntaxBottom.html
+    ///
+    /// \return
+    /// Returns a String value representing the Spatial Context
+    /// name. If the value is empty then the raster property is
+    /// associated with all the spatial contexts in the datastore.
+    ///
+    /// \see
+    /// MgFeatureService::GetSpatialContexts.
+    STRING GetSpatialContextAssociation();   /// __get, __set
+    
     /////////////////////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Sets a Boolean value that specifies whether this property is
@@ -244,6 +269,36 @@
     ///
     void SetDefaultImageYSize (INT32 size);
 
+
+    //////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Sets a Spatial Context association for this raster
+    /// property.
+    ///
+    /// \remarks
+    /// If not set, this name defaults to the Spatial Context name
+    /// active in the datastore.
+    ///
+    /// <!-- Syntax in .Net, Java, and PHP -->
+    /// \htmlinclude DotNetSyntaxTop.html
+    /// void SetSpatialContextAssociation(string spatialContextName);
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude JavaSyntaxTop.html
+    /// void SetSpatialContextAssociation(String spatialContextName);
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude PHPSyntaxTop.html
+    /// void SetSpatialContextAssociation(string spatialContextName);
+    /// \htmlinclude SyntaxBottom.html
+    ///
+    /// \param spatialContextName (String/string)
+    /// The Spatial Context name to
+    /// be set.
+    ///
+    /// \return
+    /// Returns nothing.
+    ///
+    void SetSpatialContextAssociation(CREFSTRING spatialContextName);
+
 INTERNAL_API:
 
     MgRasterPropertyDefinition();
@@ -259,6 +314,7 @@
     INT32        m_sizeX;
     INT32        m_sizeY;
     STRING       m_serializedXml;
+    STRING       m_associatedSCName;
 
 INTERNAL_API:
 

Modified: sandbox/adsk/2.1/Server/src/Services/Feature/JoinFeatureReader.cpp
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Feature/JoinFeatureReader.cpp	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Server/src/Services/Feature/JoinFeatureReader.cpp	2009-09-29 15:51:01 UTC (rev 4273)
@@ -838,7 +838,7 @@
     fdoPropDef->SetHasMeasure(hasMeasure);
 
     fdoPropDef->SetReadOnly(isReadOnly);
-    if(spatialContextName.empty())
+    if(!spatialContextName.empty())
     {
         fdoPropDef->SetSpatialContextAssociation((FdoString*)spatialContextName.c_str());
     }
@@ -868,6 +868,7 @@
     bool isNullable = mgPropDef->GetNullable();
     STRING qname = mgPropDef->GetQualifiedName();
     bool isReadOnly = mgPropDef->GetReadOnly();
+    STRING spatialContextName = mgPropDef->GetSpatialContextAssociation();
 
     //Set it for Fdo
     if (!desc.empty())
@@ -881,6 +882,11 @@
 
     //Cannot set qualified name in fdo
     fdoPropDef->SetReadOnly(isReadOnly);
+    if(!spatialContextName.empty())
+    {
+        fdoPropDef->SetSpatialContextAssociation((FdoString*)spatialContextName.c_str());
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgJoinFeatureReader.GetRasterPropertyDefinition")
 
     return fdoPropDef.Detach();

Modified: sandbox/adsk/2.1/Server/src/Services/Feature/ServerDescribeSchema.cpp
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Feature/ServerDescribeSchema.cpp	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Server/src/Services/Feature/ServerDescribeSchema.cpp	2009-09-29 15:51:01 UTC (rev 4273)
@@ -1133,6 +1133,7 @@
     bool isNullable = mgPropDef->GetNullable();
     STRING qname = mgPropDef->GetQualifiedName();
     bool isReadOnly = mgPropDef->GetReadOnly();
+    STRING spatialContextName = mgPropDef->GetSpatialContextAssociation();
 
     //Set it for Fdo
     if (!desc.empty())
@@ -1146,6 +1147,11 @@
 
     //Cannot set qualified name in fdo
     fdoPropDef->SetReadOnly(isReadOnly);
+    if(!spatialContextName.empty())
+    {
+        fdoPropDef->SetSpatialContextAssociation((FdoString*)spatialContextName.c_str());
+    }
+
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDescribeSchema.GetRasterPropertyDefinition")
 
     return fdoPropDef.Detach();

Modified: sandbox/adsk/2.1/Server/src/Services/Feature/ServerGetFeatures.cpp
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Feature/ServerGetFeatures.cpp	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Server/src/Services/Feature/ServerGetFeatures.cpp	2009-09-29 15:51:01 UTC (rev 4273)
@@ -534,6 +534,7 @@
     bool isNullable = fdoPropDef->GetNullable();
     FdoStringP qname = fdoPropDef->GetQualifiedName();
     bool isReadOnly = fdoPropDef->GetReadOnly();
+    FdoString* spatialContextName = fdoPropDef->GetSpatialContextAssociation();
 
     // Set it for MapGuide
     if (desc != NULL)
@@ -552,6 +553,11 @@
     }
     propDef->SetReadOnly(isReadOnly);
 
+    if (spatialContextName != NULL)
+    {
+        propDef->SetSpatialContextAssociation(STRING(spatialContextName));
+    }
+
     return propDef.Detach();
 }
 

Modified: sandbox/adsk/2.1/Server/src/Services/Feature/ServerGwsGetFeatures.cpp
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Feature/ServerGwsGetFeatures.cpp	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Server/src/Services/Feature/ServerGwsGetFeatures.cpp	2009-09-29 15:51:01 UTC (rev 4273)
@@ -1297,6 +1297,7 @@
     bool isNullable = fdoPropDef->GetNullable();
     FdoStringP qname = fdoPropDef->GetQualifiedName();
     bool isReadOnly = fdoPropDef->GetReadOnly();
+    FdoString* spatialContextName = fdoPropDef->GetSpatialContextAssociation();
 
     // Set it for MapGuide
     if (desc != NULL)
@@ -1315,6 +1316,11 @@
     }
     propDef->SetReadOnly(isReadOnly);
 
+    if (spatialContextName != NULL)
+    {
+        propDef->SetSpatialContextAssociation(STRING(spatialContextName));
+    }
+
     return propDef.Detach();
 }
 

Modified: sandbox/adsk/2.1/Server/src/Services/Feature/TransformCache.cpp
===================================================================
--- sandbox/adsk/2.1/Server/src/Services/Feature/TransformCache.cpp	2009-09-29 09:50:51 UTC (rev 4272)
+++ sandbox/adsk/2.1/Server/src/Services/Feature/TransformCache.cpp	2009-09-29 15:51:01 UTC (rev 4273)
@@ -95,7 +95,7 @@
     Ptr<MgClassDefinition> classDef = svcFeature->GetClassDefinition(resId, schemaName, className, false);
     Ptr<MgPropertyDefinitionCollection> propDefCol = classDef->GetProperties();
 
-    // Find the spatial context for the geometric property. Use the first one if there are many defined.
+    // Find the spatial context for the geometric or raster property. Use the first one if there are many defined.
     for(int index=0;index<propDefCol->GetCount();index++)
     {
         Ptr<MgPropertyDefinition> propDef = propDefCol->GetItem(index);
@@ -106,6 +106,15 @@
             spatialContextAssociation = geomProp->GetSpatialContextAssociation();
             break;
         }
+        else
+        if(propDef->GetPropertyType () == MgFeaturePropertyType::RasterProperty)
+        {
+            // We found the raster property
+            MgRasterPropertyDefinition* rasterProp = static_cast<MgRasterPropertyDefinition*>(propDef.p);
+            spatialContextAssociation = rasterProp->GetSpatialContextAssociation();
+            break;
+        }
+
     }
 
     // We want all of the spatial contexts



More information about the mapguide-commits mailing list