[mapguide-commits] r5266 - in trunk/MgDev: Common/MapGuideCommon/System Server/src/Wms Web/src Web/src/CgiAgent Web/src/HttpHandler Web/src/MapAgentCommon

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Oct 10 22:55:25 EDT 2010


Author: liuar
Date: 2010-10-10 19:55:25 -0700 (Sun, 10 Oct 2010)
New Revision: 5266

Modified:
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
   trunk/MgDev/Server/src/Wms/1.3.0.xml.awd
   trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp
   trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
   trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp
   trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp
   trunk/MgDev/Web/src/webconfig.ini
Log:
Ticket #1458 Incorrect initial view of published WMS layers

This defect is caused by the parent layer in the GetCapabilities response document. Because the parent layer's boundingbox is hard coded to (-90,-180,90,180), so while the children layers inherit from the parent layer, their default boundingbox will be set to the parent layer's boudingbox. 

This submission also adds CITEWmsEnabled to handle the OGC WMS CITE test requests.

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2010-10-11 02:55:25 UTC (rev 5266)
@@ -504,6 +504,8 @@
 const STRING MgConfigProperties::WmsPassword                                                = L"WmsPassword";
 const STRING MgConfigProperties::CITEWfsEnabled                                             = L"CITEWfsEnabled";
 const bool   MgConfigProperties::DefaultCITEWfsEnabled                                      = false;
+const STRING MgConfigProperties::CITEWmsEnabled                                             = L"CITEWmsEnabled";
+const bool   MgConfigProperties::DefaultCITEWmsEnabled                                      = false;
 
 // ******************************************************************
 // Web Application Properties
@@ -754,5 +756,6 @@
     { MgConfigProperties::WfsPassword                                               , MgPropertyType::String    , MG_CONFIG_MIN_PASSWORD_LENGTH         , MG_CONFIG_MAX_PASSWORD_LENGTH         , MG_CONFIG_PASSWORD_RESERVED_CHARACTERS    },
     { MgConfigProperties::WmsPassword                                               , MgPropertyType::String    , MG_CONFIG_MIN_PASSWORD_LENGTH         , MG_CONFIG_MAX_PASSWORD_LENGTH         , MG_CONFIG_PASSWORD_RESERVED_CHARACTERS    },
     { MgConfigProperties::CITEWfsEnabled                                            , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
+    { MgConfigProperties::CITEWmsEnabled                                            , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
     { L""                                                                           , 0                         , 0.0                                   , 0.0                                   , L""                                       }
 };

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2010-10-11 02:55:25 UTC (rev 5266)
@@ -872,6 +872,10 @@
     static const STRING CITEWfsEnabled;                                 /// value("CITEWfsEnabled")
     static const bool DefaultCITEWfsEnabled;                            /// value(false)
 
+    /// Enable OGC CITE Test for WMS 
+    static const STRING CITEWmsEnabled;                                 /// value("CITEWmsEnabled") 
+    static const bool DefaultCITEWmsEnabled;                            /// value(false)
+
     /// WEB APPLICATION PROPERTIES SECTION -------------------------------------------------------------------------------------------
 
     /// Viewer framework properties

Modified: trunk/MgDev/Server/src/Wms/1.3.0.xml.awd
===================================================================
--- trunk/MgDev/Server/src/Wms/1.3.0.xml.awd	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Server/src/Wms/1.3.0.xml.awd	2010-10-11 02:55:25 UTC (rev 5266)
@@ -254,12 +254,6 @@
     <Layer>
      <Title>&Service.Title;</Title>
      <?Enum list="&ReferenceSystems;" using="&RS_CRS.xml;"?>
-     <EX_GeographicBoundingBox>
-        <westBoundLongitude>-180</westBoundLongitude>
-        <eastBoundLongitude>180</eastBoundLongitude>
-        <southBoundLatitude>-90</southBoundLatitude>
-        <northBoundLatitude>90</northBoundLatitude>
-    </EX_GeographicBoundingBox>
      <?EnumLayers using="&Layer.xml;" ?>
     </Layer>
    </Capability>

Modified: trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp
===================================================================
--- trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp	2010-10-11 02:55:25 UTC (rev 5266)
@@ -293,8 +293,10 @@
     MgConfiguration* cfg = MgConfiguration::GetInstance();
     bool bCITEWfsEnabled = false;
     cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+    bool bCITEWmsEnabled = false;
+    cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWmsEnabled, bCITEWmsEnabled, MgConfigProperties::DefaultCITEWmsEnabled);
 
-    return bCITEWfsEnabled;
+    return (bCITEWfsEnabled || bCITEWmsEnabled);
 }
 
 bool ParseAuth(char* auth, MgHttpRequestParam* params)
@@ -399,6 +401,7 @@
     if(!isWms && !isWfs)
     {
         cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, isWfs, MgConfigProperties::DefaultCITEWfsEnabled);
+        cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWmsEnabled, isWms, MgConfigProperties::DefaultCITEWmsEnabled);
     }
 
     // Get WMS/WFS password from configuration.

Modified: trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp	2010-10-11 02:55:25 UTC (rev 5266)
@@ -203,6 +203,10 @@
     hResponse = new MgHttpResponse();
     result = hResponse->GetResult();
 
+    MgConfiguration* cfg = MgConfiguration::GetInstance();
+    bool bCITEWfsEnabled = false;
+    bool bCITEWmsEnabled = false;
+
     // Get operation request value
     STRING sParamValue = m_requestParam->GetParameterValue(MgHttpResourceStrings::reqOperation);
     if(sParamValue.length() == 0)
@@ -218,7 +222,17 @@
             }
             else
             {
-                sParamValue = L"WFS";
+                cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+                cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWmsEnabled, bCITEWmsEnabled, MgConfigProperties::DefaultCITEWmsEnabled);
+                
+                if(bCITEWfsEnabled)
+                {
+                    sParamValue = L"WFS";
+                }
+                else if(bCITEWmsEnabled)
+                {
+                    sParamValue = L"WMS";
+                }
             }
             sParamValue.append(L".");
             sParamValue.append(sRequestValue);
@@ -228,14 +242,17 @@
             // Error handling for OGC certification.
             // MapGuide should generate an WFS exception while receiveing following request:
             // http://locahost/mapguide/mapagent/mapagent.fcgi??request~GetCapabilities!service~WFS!version~1.1.0
-            MgConfiguration* cfg = MgConfiguration::GetInstance();
-            bool bCITEWfsEnabled = false;
-
             cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+            cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWmsEnabled, bCITEWmsEnabled, MgConfigProperties::DefaultCITEWmsEnabled);
+            
             if(bCITEWfsEnabled)
             {
                 sParamValue = L"WFS.GETCAPABILITIES";
             }
+            else if(bCITEWmsEnabled)
+            {
+                sParamValue = L"WMS.GETCAPABILITIES";
+            }
         }
     }
     if(sParamValue.length() > 0)

Modified: trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWmsGetMap.cpp	2010-10-11 02:55:25 UTC (rev 5266)
@@ -157,18 +157,20 @@
     // Create the WMS handler
     MgHttpResponseStream responseStream;
     MgOgcWmsServer wms(requestParams, responseStream);
-    if(wms.ProcessRequest(this))
+    try
     {
-        // Get an instance of the resource service
-        Ptr<MgResourceService> resourceService = (MgResourceService*)CreateService(MgServiceType::ResourceService);
+        if(wms.ProcessRequest(this))
+        {
+            // Get an instance of the resource service
+            Ptr<MgResourceService> resourceService = (MgResourceService*)CreateService(MgServiceType::ResourceService);
 
-        // Get the background color
-        Ptr<MgColor> bkColor = MgWmsMapUtil::GetBackgroundColor(m_bgColor, m_transparent);
+            // Get the background color
+            Ptr<MgColor> bkColor = MgWmsMapUtil::GetBackgroundColor(m_bgColor, m_transparent);
 
-        // Get the extents
-        Ptr<MgEnvelope> extents = MgWmsMapUtil::GetExtents(m_bbox);
+            // Get the extents
+            Ptr<MgEnvelope> extents = MgWmsMapUtil::GetExtents(m_bbox);
 
-        try {
+            
             // Get a map object corresponding to the request parameters
             Ptr<MgMap> map = MgWmsMapUtil::GetMap(wms, m_layerDefIds, m_bbox, m_crs,
                 m_width, m_height, resourceService);
@@ -188,23 +190,24 @@
             // Set the result
             STRING sMimeType = mapImage->GetMimeType();
             hResult->SetResultObject(mapImage, sMimeType.length() > 0 ? sMimeType : m_format);
+            
         }
-        //  Custom catch clauses.  In short, NO, we do NOT want to let MapGuide exceptions
-        //  pass through.  The buck stops here, with an exception report that WE generate
-        //  according to OGC specifications.
-        CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgInvalidCoordinateSystemException,kpszInvalidCRS,   wms)
-        CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgException,                       kpszInternalError,wms)
-        CATCH_ANYTHING_HANDLE_AS_OGC_WMS(                                      kpszInternalError,wms)
-    }
-    else
-    {
-        // Obtain the response byte reader
-        Ptr<MgByteReader> errorResponse = responseStream.Stream().GetReader();
+        else
+        {
+            // Obtain the response byte reader
+            Ptr<MgByteReader> errorResponse = responseStream.Stream().GetReader();
 
-        // Set the result
-        hResult->SetResultObject(errorResponse, errorResponse->GetMimeType());
+            // Set the result
+            hResult->SetResultObject(errorResponse, errorResponse->GetMimeType());
+        }
     }
-
+    //  Custom catch clauses.  In short, NO, we do NOT want to let MapGuide exceptions
+    //  pass through.  The buck stops here, with an exception report that WE generate
+    //  according to OGC specifications.
+    CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgInvalidCoordinateSystemException,   kpszInvalidCRS,   wms)
+    CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgCoordinateSystemLoadFailedException,kpszInvalidCRS,   wms)
+    CATCH_MGEXCEPTION_HANDLE_AS_OGC_WMS(MgException,                          kpszInternalError,wms)
+    CATCH_ANYTHING_HANDLE_AS_OGC_WMS(                                         kpszInternalError,wms)
     MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpWmsGetMap.Execute")
 }
 

Modified: trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp
===================================================================
--- trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp	2010-10-11 02:55:25 UTC (rev 5266)
@@ -37,9 +37,11 @@
 
     MgConfiguration* cfg = MgConfiguration::GetInstance();
     bool bCITEWfsEnabled = false;
+    bool bCITEWmsEnabled = false;
     cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+    cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWmsEnabled, bCITEWmsEnabled, MgConfigProperties::DefaultCITEWmsEnabled);
 
-    return bCITEWfsEnabled;
+    return (bCITEWfsEnabled || bCITEWmsEnabled);
 }
 
 
@@ -146,6 +148,7 @@
     if(!isWms && !isWfs)
     {
         cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, isWfs, MgConfigProperties::DefaultCITEWfsEnabled);
+        cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWmsEnabled, isWms, MgConfigProperties::DefaultCITEWmsEnabled);
     }
 
     // Get WMS/WFS password from configuration.

Modified: trunk/MgDev/Web/src/webconfig.ini
===================================================================
--- trunk/MgDev/Web/src/webconfig.ini	2010-10-11 01:36:57 UTC (rev 5265)
+++ trunk/MgDev/Web/src/webconfig.ini	2010-10-11 02:55:25 UTC (rev 5266)
@@ -171,10 +171,14 @@
 # CITEWfsEnabled                   Enable OGC CITE Test for WFS 
 #                                  Consider unknown requests as OGC Wfs HTTP requests
 #                                        0 = false and 1 = true
+# CITEWmsEnabled                   Enable OGC CITE Test for WMS 
+#                                  Consider unknown requests as OGC Wms HTTP requests
+#                                        0 = false and 1 = true
 # *****************************************************************************
 WfsPassword                        = wfs
 WmsPassword                        = wms
 CITEWfsEnabled                     = 0
+CITEWmsEnabled                     = 0
 
 [WebApplicationProperties]
 # *****************************************************************************



More information about the mapguide-commits mailing list