[mapguide-commits] r7739 - branches/2.5/MgDev/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Aug 6 05:24:38 PDT 2013
Author: jng
Date: 2013-08-06 05:24:38 -0700 (Tue, 06 Aug 2013)
New Revision: 7739
Modified:
branches/2.5/MgDev/Web/src/HttpHandler/OgcWmsServer.cpp
branches/2.5/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp
Log:
#2323: Backport to 2.5
Modified: branches/2.5/MgDev/Web/src/HttpHandler/OgcWmsServer.cpp
===================================================================
--- branches/2.5/MgDev/Web/src/HttpHandler/OgcWmsServer.cpp 2013-08-05 17:02:09 UTC (rev 7738)
+++ branches/2.5/MgDev/Web/src/HttpHandler/OgcWmsServer.cpp 2013-08-06 12:24:38 UTC (rev 7739)
@@ -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: branches/2.5/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp
===================================================================
--- branches/2.5/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp 2013-08-05 17:02:09 UTC (rev 7738)
+++ branches/2.5/MgDev/Web/src/HttpHandler/WmsMapUtil.cpp 2013-08-06 12:24:38 UTC (rev 7739)
@@ -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