[mapguide-commits] r8358 - in sandbox/adsk/2.6l: Common/Renderers Server/src/Services/Kml
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Sep 24 19:07:25 PDT 2014
Author: hubu
Date: 2014-09-24 19:07:25 -0700 (Wed, 24 Sep 2014)
New Revision: 8358
Modified:
sandbox/adsk/2.6l/Common/Renderers/KmlRenderer.cpp
sandbox/adsk/2.6l/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.
Modified: sandbox/adsk/2.6l/Common/Renderers/KmlRenderer.cpp
===================================================================
--- sandbox/adsk/2.6l/Common/Renderers/KmlRenderer.cpp 2014-09-24 10:06:07 UTC (rev 8357)
+++ sandbox/adsk/2.6l/Common/Renderers/KmlRenderer.cpp 2014-09-25 02:07:25 UTC (rev 8358)
@@ -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: sandbox/adsk/2.6l/Server/src/Services/Kml/ServerKmlService.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Services/Kml/ServerKmlService.cpp 2014-09-24 10:06:07 UTC (rev 8357)
+++ sandbox/adsk/2.6l/Server/src/Services/Kml/ServerKmlService.cpp 2014-09-25 02:07:25 UTC (rev 8358)
@@ -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