[mapguide-commits] r8356 - in trunk/MgDev: . Common/Renderers Server/src/Services/Kml
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Sep 23 23:28:13 PDT 2014
Author: jng
Date: 2014-09-23 23:28:12 -0700 (Tue, 23 Sep 2014)
New Revision: 8356
Modified:
trunk/MgDev/
trunk/MgDev/Common/Renderers/KmlRenderer.cpp
trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp
Log:
Merged revision(s) 8354-8355 from branches/2.6/MgDev:
#2485: Clamp 0 line thickness to [some very small value > 0] for the KML renderer. This is what happens with the existing image-based renderers. The KML renderer should behave the same way. This way, when a layer is exported to KML, and 0 line/border thickness is specified, it will be clamped to some very small value so that Google Earth will still draw said lines.
Reviewed by Andy Zhang.
........
#2486: Don't hard-code the WKT of the LL84 coordinate system for KML Service operations. History has shown this WKT string may change (even if slightly). We should use something that will never change (the CS-Map coordinate system code) and use that to create our MgCoordinateSystem objects.
Reviewed by Andy Zhang.
........
Property changes on: trunk/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340
/sandbox/jng/convenience_apis:8263
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
+ /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355
/sandbox/jng/convenience_apis:8263
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
Modified: trunk/MgDev/Common/Renderers/KmlRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/KmlRenderer.cpp 2014-09-24 06:25:20 UTC (rev 8355)
+++ trunk/MgDev/Common/Renderers/KmlRenderer.cpp 2014-09-24 06:28:12 UTC (rev 8356)
@@ -26,9 +26,9 @@
#include "RenderUtil.h"
+const double MIN_KML_THICKNESS = 0.00001;
const double ELEV_FACTOR = 0.1;
-
//default constructor
KmlRenderer::KmlRenderer(KmlContent* kmlContent,
RS_Bounds& extents,
@@ -685,7 +685,11 @@
scale_factor = 1.0 / m_mapScale / m_pixelSize;
}
- return number * scale_factor;
+ double result = number * scale_factor;
+ //We cannot apply a thickness of 0 as this will cause Google Earth to draw nothing
+ //so if the thickness computes to 0, replace it with a very small value that's greater
+ //than 0
+ return result == 0.0 ? MIN_KML_THICKNESS : result;
}
Modified: trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp 2014-09-24 06:25:20 UTC (rev 8355)
+++ trunk/MgDev/Server/src/Services/Kml/ServerKmlService.cpp 2014-09-24 06:28:12 UTC (rev 8356)
@@ -32,8 +32,7 @@
//Zip support from DWF toolkit
#include "dwfcore/ZipFileDescriptor.h"
-const STRING LL84_WKT = L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degrees\",0.01745329252]]";
-const STRING GOOGLE_EARTH_WKT = LL84_WKT;
+const STRING GOOGLE_EARTH_CS = L"LL84";
IMPLEMENT_CREATE_SERVICE(MgServerKmlService)
@@ -103,7 +102,7 @@
if(!mapWkt.empty())
{
Ptr<MgCoordinateSystem> mapCs = (mapWkt.empty()) ? NULL : m_csFactory->Create(mapWkt);
- Ptr<MgCoordinateSystem> llCs = m_csFactory->Create(GOOGLE_EARTH_WKT);
+ Ptr<MgCoordinateSystem> llCs = m_csFactory->CreateFromCode(GOOGLE_EARTH_CS);
Ptr<MgCoordinateSystemTransform> trans = m_csFactory->GetTransform(mapCs, llCs);
trans->IgnoreDatumShiftWarning(true);
trans->IgnoreOutsideDomainWarning(true);
@@ -159,7 +158,7 @@
KmlContent kmlContent;
kmlContent.StartDocument();
kmlContent.WriteString("<visibility>1</visibility>");
- Ptr<MgCoordinateSystem> destCs = m_csFactory->Create(GOOGLE_EARTH_WKT);
+ Ptr<MgCoordinateSystem> destCs = m_csFactory->CreateFromCode(GOOGLE_EARTH_CS);
Ptr<MgEnvelope> destExtent = GetLayerExtent(ldf.get(), destCs);
if(destExtent != NULL)
{
@@ -264,7 +263,8 @@
Ptr<MgUserInformation> userInfo = MgUserInformation::GetCurrentUserInfo();
siteConn->Open(userInfo);
Ptr<MgMap> map = new MgMap(siteConn);
- map->Create(GOOGLE_EARTH_WKT, extents, L"Google Earth Map");
+ STRING mapWkt = m_csFactory->ConvertCoordinateSystemCodeToWkt(GOOGLE_EARTH_CS);
+ map->Create(mapWkt, extents, L"Google Earth Map");
map->SetDisplayWidth(width);
map->SetDisplayHeight(height);
map->SetDisplayDpi((int)dpi);
@@ -465,7 +465,7 @@
layer->GetExpandInLegend(),
-layer->GetDisplayOrder(),
uig);
- Ptr<MgCoordinateSystem> destCs = m_csFactory->Create(GOOGLE_EARTH_WKT);
+ Ptr<MgCoordinateSystem> destCs = m_csFactory->CreateFromCode(GOOGLE_EARTH_CS);
double metersPerUnit = (destCs.p != NULL)? destCs->ConvertCoordinateSystemUnitsToMeters(1.0) : 1.0;
Ptr<MgCoordinate> ll = extents->GetLowerLeftCoordinate();
@@ -551,7 +551,7 @@
double MgServerKmlService::GetScale(MgEnvelope* llExtents, int width, int height, double dpi)
{
- Ptr<MgCoordinateSystem> destCs = m_csFactory->Create(GOOGLE_EARTH_WKT);
+ Ptr<MgCoordinateSystem> destCs = m_csFactory->CreateFromCode(GOOGLE_EARTH_CS);
double mapWidth = destCs->ConvertCoordinateSystemUnitsToMeters(llExtents->GetWidth());
double mapHeight = destCs->ConvertCoordinateSystemUnitsToMeters(llExtents->GetHeight());
double screenWidth = width / dpi * METERS_PER_INCH;
More information about the mapguide-commits
mailing list