[mapguide-commits] r7700 - sandbox/adsk/2.4j/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Jul 30 01:15:36 PDT 2013
Author: christinebao
Date: 2013-07-30 01:15:35 -0700 (Tue, 30 Jul 2013)
New Revision: 7700
Modified:
sandbox/adsk/2.4j/Web/src/HttpHandler/OgcWmsServer.cpp
sandbox/adsk/2.4j/Web/src/HttpHandler/WmsMapUtil.cpp
Log:
#2323: WMS should not throw exception if no coordinate system set up
Fix the exception and create image without coordinate system transformation in this case.
Modified: sandbox/adsk/2.4j/Web/src/HttpHandler/OgcWmsServer.cpp
===================================================================
--- sandbox/adsk/2.4j/Web/src/HttpHandler/OgcWmsServer.cpp 2013-07-26 06:43:31 UTC (rev 7699)
+++ sandbox/adsk/2.4j/Web/src/HttpHandler/OgcWmsServer.cpp 2013-07-30 08:15:35 UTC (rev 7700)
@@ -532,7 +532,7 @@
{
parser.Next();
STRING sText = parser.Current().Contents();
- if(SZ_EQI(sText.c_str(), crs))
+ if(SZ_EQI(sText.c_str(), crs) || SZ_EQI(crs, L"EPSG:0"))
{
bGlobalMatch = true;
break;
Modified: sandbox/adsk/2.4j/Web/src/HttpHandler/WmsMapUtil.cpp
===================================================================
--- sandbox/adsk/2.4j/Web/src/HttpHandler/WmsMapUtil.cpp 2013-07-26 06:43:31 UTC (rev 7699)
+++ sandbox/adsk/2.4j/Web/src/HttpHandler/WmsMapUtil.cpp 2013-07-30 08:15:35 UTC (rev 7700)
@@ -132,8 +132,12 @@
if (NULL != layerDefIds && layerDefIds->GetCount() > 0)
{
Ptr<MgCoordinateSystemFactory> factory = new MgCoordinateSystemFactory();
- Ptr<MgCoordinateSystem> mapCs = factory->Create(sWKT);
Ptr<MgCoordinateSystemTransform> csTrans;
+ Ptr<MgCoordinateSystem> mapCs = NULL;
+ if (sWKT.length() > 0)
+ {
+ mapCs = factory->Create(sWKT);
+ }
Ptr<MgLayerCollection> mapLayers = map->GetLayers();
@@ -153,27 +157,27 @@
if(layerDefs->Next())
{
// Get user defined boundingbox
+ STRING sMinX, sMinY, sMaxX, sMaxY;
+ sMinX = L"0";
+ sMinY = L"0";
+ sMaxX = L"0";
+ sMaxY = L"0";
MgUtilDictionary currentDef(NULL);
layerDefs->GenerateDefinitions(currentDef);
- STRING layerBounds = currentDef[L"Layer.Bounds"];
- Ptr<MgStringCollection> wmsLayerBoundingbox = GetWMSlayerBoundingbox(sSRS, layerBounds);
- STRING sMinX, sMinY, sMaxX, sMaxY;
-
- ASSERT(4 == wmsLayerBoundingbox->GetCount());
- if(4 == wmsLayerBoundingbox->GetCount())
+ //if remove bounds when publish WMS, this currentDef is NULL.
+ if (currentDef.FindName(L"Layer.Bounds") != -1)
{
- sMinX = wmsLayerBoundingbox->GetItem(0);
- sMinY = wmsLayerBoundingbox->GetItem(1);
- sMaxX = wmsLayerBoundingbox->GetItem(2);
- sMaxY = wmsLayerBoundingbox->GetItem(3);
+ STRING layerBounds = currentDef[L"Layer.Bounds"];
+ Ptr<MgStringCollection> wmsLayerBoundingbox = GetWMSlayerBoundingbox(sSRS, layerBounds);
+ ASSERT(4 == wmsLayerBoundingbox->GetCount());
+ if(4 == wmsLayerBoundingbox->GetCount())
+ {
+ sMinX = wmsLayerBoundingbox->GetItem(0);
+ sMinY = wmsLayerBoundingbox->GetItem(1);
+ sMaxX = wmsLayerBoundingbox->GetItem(2);
+ sMaxY = wmsLayerBoundingbox->GetItem(3);
+ }
}
- else
- {
- sMinX = L"0";
- sMinY = L"0";
- sMaxX = L"0";
- sMaxY = L"0";
- }
// User defined Boundingbox under map CS
Ptr<MgEnvelope> wmsLayerExtent = new MgEnvelope(MgUtil::StringToDouble(sMinX), MgUtil::StringToDouble(sMinY), MgUtil::StringToDouble(sMaxX), MgUtil::StringToDouble(sMaxY));
@@ -252,16 +256,20 @@
scReader->Close();
}
+ Ptr<MgEnvelope> layerCsExtent;
Ptr<MgCoordinateSystem> layerCs = (layerCoordSysWkt.empty()) ? NULL : factory->Create(layerCoordSysWkt);
- if(layerCs != NULL)
+ if(layerCs != NULL && mapCs != NULL)
{
csTrans = factory->GetTransform(mapCs,layerCs);
csTrans->IgnoreDatumShiftWarning(true);
csTrans->IgnoreOutsideDomainWarning(true);
+ // Transform user defined boundingbox to layer CS
+ layerCsExtent = csTrans->Transform(wmsLayerExtent);
}
-
- // Transform user defined boundingbox to layer CS
- Ptr<MgEnvelope> layerCsExtent = csTrans->Transform(wmsLayerExtent);
+ else
+ {
+ layerCsExtent = extents;
+ }
Ptr<MgCoordinate> layerCsLowerLeftCoordinate = layerCsExtent->GetLowerLeftCoordinate();
Ptr<MgCoordinate> layerCsUpperRightCoordinate = layerCsExtent->GetUpperRightCoordinate();
MgUtil::DoubleToString(layerCsLowerLeftCoordinate->GetX(),sMinX);
@@ -401,7 +409,7 @@
void MgWmsMapUtil::ProcessBoundingBoxAxes(STRING sSrs,REFSTRING bbox)
{
- if(sSrs.empty() || bbox.empty() ||sSrs == _("CRS:84")) //Workaround
+ if(sSrs.empty() || bbox.empty() || sSrs == _("CRS:84") || SZ_EQI(sSrs.c_str(), L"EPSG:0")) //Workaround
return;
Ptr<MgCoordinateSystemFactory> factory = new MgCoordinateSystemFactory();
More information about the mapguide-commits
mailing list