[mapguide-commits] r9192 - in sandbox/jng/utfgrid: Common/Renderers Server/src/UnitTesting UnitTest/TestData/TileService
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 30 09:24:16 PDT 2017
Author: jng
Date: 2017-05-30 09:24:16 -0700 (Tue, 30 May 2017)
New Revision: 9192
Modified:
sandbox/jng/utfgrid/Common/Renderers/UTFGridContent.cpp
sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.cpp
sandbox/jng/utfgrid/UnitTest/TestData/TileService/UT_Parcels.ldf
Log:
With the utfgrid renderer nearly complete it's time to reign in the scope (and not go too overboard) so that we have a solid story for what we want to enable with the initial implementation. Namely, it is to allow for pre-rendering of tooltip data for layers that have tooltips/urls defined. Nothing more, nothing less.
- UTFGridContent::AddFeature now only considers layers with tooltips and/or hyperlinks defined
- They are rendered out as specially named properties:
- MG_TOOLTIP: For the tooltip content
- MG_URL: For the hyperlink content
- Rework the UTFGrid rendering test so that we're rendering at closer zoom levels (where parcels, and their tooltips/urls would be visible)
- Render XYZ png image tiles at that spot as a visual baseline
- Render UTF grid tiles at that spot to allow for easy comparison
- Set the URL property for the test Parcels layer (to verify that UTFGrid rendering will render content out as MG_URL)
Modified: sandbox/jng/utfgrid/Common/Renderers/UTFGridContent.cpp
===================================================================
--- sandbox/jng/utfgrid/Common/Renderers/UTFGridContent.cpp 2017-05-30 15:19:47 UTC (rev 9191)
+++ sandbox/jng/utfgrid/Common/Renderers/UTFGridContent.cpp 2017-05-30 16:24:16 UTC (rev 9192)
@@ -5,7 +5,7 @@
//Uncomment this line below to render UTFGrid content with extra debugging information attached to each
//feature
-#define DEBUG_UTFGRID
+//#define DEBUG_UTFGRID
#define EMPTY_ENCODED_CHAR 32
@@ -48,7 +48,12 @@
bool UTFGridContent::AddFeature(RS_LayerUIInfo* layer, unsigned int decodedColor, RS_FeatureReader* feature, const RS_String * tooltip, const RS_String * url)
{
- static const size_t MAX_STRING = 64;
+ // For this initial implementation of UTFGrid rendering, we will honor the original intent that UTFGrids in MapGuide
+ // are meant to serve: As pre-rendered tooltip data for layers with tooltips enabled.
+ if (!layer->hastooltips() && !layer->hashyperlinks())
+ {
+ return false;
+ }
std::string key = m_keyEncode.EncodeKey(feature);
//No key, not selectable. Not selectable, don't bother encoding.
@@ -56,6 +61,38 @@
{
std::wstring wVal = L"{";
+ wVal.append(L"\"MG_TOOLTIP\": ");
+ if (NULL != tooltip)
+ {
+ std::wstring oPropVal;
+ std::wstring iPropVal = *tooltip;
+ EscapeJsonString(iPropVal, oPropVal);
+
+ wVal.append(L"\"");
+ wVal.append(oPropVal);
+ wVal.append(L"\"");
+ }
+ else
+ {
+ wVal.append(L"null");
+ }
+ wVal.append(L",\"MG_URL\": ");
+ if (NULL != url)
+ {
+ std::wstring oPropVal;
+ std::wstring iPropVal = *url;
+ EscapeJsonString(iPropVal, oPropVal);
+
+ wVal.append(L"\"");
+ wVal.append(oPropVal);
+ wVal.append(L"\"");
+ }
+ else
+ {
+ wVal.append(L"null");
+ }
+
+ /*
const wchar_t * geomName = feature->GetGeomPropName();
const wchar_t * rasterName = feature->GetRasterPropName();
@@ -109,7 +146,7 @@
bFirst = false;
}
-
+ */
#ifdef DEBUG_UTFGRID
wVal.append(L",\"_MGLAYER_NAME\": ");
wVal.append(L"\"");
Modified: sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.cpp
===================================================================
--- sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.cpp 2017-05-30 15:19:47 UTC (rev 9191)
+++ sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.cpp 2017-05-30 16:24:16 UTC (rev 9192)
@@ -1766,15 +1766,28 @@
try
{
Ptr<MgMap> map = CreateTestTiledMap();
- Ptr<MgByteReader> tileTL = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 2099, 2985, 13, 96);
- Ptr<MgByteReader> tileTR = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 2100, 2985, 13, 96);
- Ptr<MgByteReader> tileBL = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 2099, 2986, 13, 96);
- Ptr<MgByteReader> tileBR = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 2100, 2986, 13, 96);
- tileTL->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_TopLeft.utfgrid");
- tileTR->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_TopRight.utfgrid");
- tileBL->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_BottomLeft.utfgrid");
- tileBR->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_BottomRight.utfgrid");
+ //For ease of visual verfication, render the XYZ image tiles as baseline
+ Ptr<MgByteReader> imgTL = m_svcRendering->RenderTileXYZ(map, L"BaseLayers", 16797, 23893, 16, 96, MgImageFormats::Png);
+ Ptr<MgByteReader> imgTR = m_svcRendering->RenderTileXYZ(map, L"BaseLayers", 16798, 23893, 16, 96, MgImageFormats::Png);
+ Ptr<MgByteReader> imgBL = m_svcRendering->RenderTileXYZ(map, L"BaseLayers", 16797, 23894, 16, 96, MgImageFormats::Png);
+ Ptr<MgByteReader> imgBR = m_svcRendering->RenderTileXYZ(map, L"BaseLayers", 16798, 23894, 16, 96, MgImageFormats::Png);
+
+ imgTL->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_TopLeft_ImageBaseline.png");
+ imgTR->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_TopRight_ImageBaseline.png");
+ imgBL->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_BottomLeft_ImageBaseline.png");
+ imgBR->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_BottomRight_ImageBaseline.png");
+
+ //Now render the utf grids at the same place
+ Ptr<MgByteReader> utfTL = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 16797, 23893, 16, 96);
+ Ptr<MgByteReader> utfTR = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 16798, 23893, 16, 96);
+ Ptr<MgByteReader> utfBL = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 16797, 23894, 16, 96);
+ Ptr<MgByteReader> utfBR = m_svcRendering->RenderTileUTFGrid(map, L"BaseLayers", 16798, 23894, 16, 96);
+
+ utfTL->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_TopLeft.utfgrid");
+ utfTR->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_TopRight.utfgrid");
+ utfBL->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_BottomLeft.utfgrid");
+ utfBR->ToFile(L"../UnitTestFiles/RenderTileUTFGrid_BottomRight.utfgrid");
}
catch (MgException* e)
{
Modified: sandbox/jng/utfgrid/UnitTest/TestData/TileService/UT_Parcels.ldf
===================================================================
--- sandbox/jng/utfgrid/UnitTest/TestData/TileService/UT_Parcels.ldf 2017-05-30 15:19:47 UTC (rev 9191)
+++ sandbox/jng/utfgrid/UnitTest/TestData/TileService/UT_Parcels.ldf 2017-05-30 16:24:16 UTC (rev 9192)
@@ -45,6 +45,7 @@
<Value>Description4</Value>
</PropertyMapping>
<Geometry>SHPGEOM</Geometry>
+ <Url>concat('http://localhost/parcels/report/', Autogenerated_SDF_ID)</Url>
<ToolTip>concat('Parcel\nName: ', concat(RNAME, concat('\nAddress: ', RBILAD)))</ToolTip>
<VectorScaleRange>
<MaxScale>13000</MaxScale>
More information about the mapguide-commits
mailing list