[mapguide-commits] r9505 - in sandbox/jng/tiling_v2: Common/MapGuideCommon/Services Server/src/Services/Rendering Server/src/Services/Tile Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 21 05:25:32 PDT 2019
Author: jng
Date: 2019-05-21 05:25:32 -0700 (Tue, 21 May 2019)
New Revision: 9505
Removed:
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.cpp
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.h
Modified:
sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.cpp
sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.h
sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingDefs.h
sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingService.h
sandbox/jng/tiling_v2/Server/src/Services/Rendering/RenderingOperationFactory.cpp
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.cpp
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.h
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj.filters
sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingServiceBuild.cpp
sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheDefaultProvider.cpp
sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheXYZProvider.cpp
sandbox/jng/tiling_v2/Server/src/UnitTesting/TestRenderingService.cpp
sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp
sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h
Log:
Fold MgImagePreocessor code back into MgServerRenderingService. Bite the bullet and put the metatile APIs in MgRenderingService (with EXTERNAL_API designation). This allows our metatile management code to no longer assume a server-based rendering service implementation (a proxy instance is now acceptable).
Finally, re-neable all tile service tests (they were disabled to speed up the dev/test loop on implementing this feature).
Modified: sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.cpp
===================================================================
--- sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1347,7 +1347,7 @@
INT32 metaTilingFactor)
{
MgCommand cmd;
- cmd.ExecuteCommand(m_connProp, // Connection
+ cmd.ExecuteCommand(m_connProp, // Connection
MgCommand::knObject, // Return type expected
MgRenderingServiceOpId::RenderMetatile, // Command Code
10, // No of arguments
@@ -1382,7 +1382,7 @@
INT32 metaTilingFactor)
{
MgCommand cmd;
- cmd.ExecuteCommand(m_connProp, // Connection
+ cmd.ExecuteCommand(m_connProp, // Connection
MgCommand::knObject, // Return type expected
MgRenderingServiceOpId::RenderTileXYZ2, // Command Code
9, // No of arguments
@@ -1402,4 +1402,30 @@
SetWarning(cmd.GetWarningObject());
return (MgMetatile*)cmd.GetReturnValue().val.m_obj;
+}
+
+MgByteReader* MgProxyRenderingService::RenderTileFromMetaTile(
+ MgMap* map,
+ MgMetatile* metaTile,
+ CREFSTRING rendererName,
+ INT32 subTileX,
+ INT32 subTileY)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knObject, // Return type expected
+ MgRenderingServiceOpId::RenderTileFromMetaTile, // Command Code
+ 9, // No of arguments
+ Rendering_Service, // Service Id
+ BUILD_VERSION(3, 3, 0), // Operation version
+ MgCommand::knObject, map, // Argument#1
+ MgCommand::knObject, metaTile, // Argument#2
+ MgCommand::knString, &rendererName, // Argument#3
+ MgCommand::knInt32, subTileX, // Argument#4
+ MgCommand::knInt32, subTileY, // Argument#5
+ MgCommand::knNone); // End of arguments
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
\ No newline at end of file
Modified: sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.h
===================================================================
--- sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.h 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/ProxyRenderingService.h 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1221,6 +1221,32 @@
double tileExtentOffset,
INT32 metaTilingFactor);
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns the requested sub-tile from the given metatile
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param metaTile
+ /// Input
+ /// The meta-tile from which a subtile is being requested for
+ /// \param rendererName
+ /// Input
+ /// The name of the renderer to create for sub-tile slicing
+ /// \param subTileX
+ /// Input
+ /// The x sub-tile coordinate of the meta-tile to request
+ /// \param subTileY
+ /// Input
+ /// The y sub-tile coordinate of the meta-tile to request
+ ///
+ /// \return
+ /// The requested sub-tile
+ ///
+ /// \since 3.3
+ virtual MgByteReader* RenderTileFromMetaTile(MgMap* map, MgMetatile* metaTile, CREFSTRING rendererName, INT32 subTileX, INT32 subTileY);
+
protected:
//////////////////////////////////////////////////////////////////
Modified: sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingDefs.h
===================================================================
--- sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingDefs.h 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingDefs.h 2019-05-21 12:25:32 UTC (rev 9505)
@@ -48,6 +48,7 @@
static const int RenderTileUTFGrid = 0x1111E914;
static const int QueryFeatureProperties3 = 0x1111E915;
static const int RenderMetatile = 0x1111E916;
+ static const int RenderTileFromMetaTile = 0x1111E917;
};
/// \endcond
Modified: sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingService.h
===================================================================
--- sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingService.h 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Common/MapGuideCommon/Services/RenderingService.h 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1117,6 +1117,8 @@
bool bIncludeFeatureBBOX,
bool bIncludeGeometry) = 0;
+EXTERNAL_API:
+
/////////////////////////////////////////////////////////////////
/// \brief
/// Returns the specified base map tile for the given map.
@@ -1234,6 +1236,33 @@
double tileExtentOffset,
INT32 metaTilingFactor) = 0;
+
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns the requested sub-tile from the given metatile
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param metaTile
+ /// Input
+ /// The meta-tile from which a subtile is being requested for
+ /// \param rendererName
+ /// Input
+ /// The name of the renderer to create for sub-tile slicing
+ /// \param subTileX
+ /// Input
+ /// The x sub-tile coordinate of the meta-tile to request
+ /// \param subTileY
+ /// Input
+ /// The y sub-tile coordinate of the meta-tile to request
+ ///
+ /// \return
+ /// The requested sub-tile
+ ///
+ /// \since 3.3
+ virtual MgByteReader* RenderTileFromMetaTile(MgMap* map, MgMetatile* metaTile, CREFSTRING rendererName, INT32 subTileX, INT32 subTileY) = 0;
+
protected:
/////////////////////////////////////////////////////////////////
Deleted: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1,223 +0,0 @@
-//
-// Copyright (C) 2004-2019 by Autodesk, Inc.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of version 2.1 of the GNU Lesser
-// General Public License as published by the Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-#include "MapGuideCommon.h"
-#include "ImageProcessor.h"
-#include "AGGRenderer.h"
-#include "GDRenderer.h"
-#include "StylizationUtil.h"
-#include "ProfileRenderMapResult.h"
-#include "MappingUtil.h"
-
-bool MgImageProcessor::HasColorMap(CREFSTRING format)
-{
- return format == L"PNG8" || format == L"GIF";
-}
-
-MgByteReader* MgImageProcessor::CreateImageFromRenderer(MgMap* map,
- Renderer* dr,
- INT32 saveWidth,
- INT32 saveHeight,
- CREFSTRING format,
- CREFSTRING rendererName,
- ProfileRenderMapResult* pPRMResult,
- unsigned int* frameBuffer)
-{
- if (NULL != pPRMResult)
- {
- // Set the start time of creating map image
- pPRMResult->SetCreateImageTime(MgTimerUtil::GetTime());
- }
-
- /*
- //-------------------------------------------------------
- // draw a border around the tile - used for debugging
- RS_LineStroke ls;
- ls.color() = RS_Color(128, 128, 128, 64);
-
- LineBuffer lb(5);
- double mcsMinX = b.minx;
- double mcsMaxX = b.maxx;
- double mcsMinY = b.miny;
- double mcsMaxY = b.maxy;
- double incX = (mcsMaxX - mcsMinX) / saveWidth / 10.0;
- double incY = (mcsMaxY - mcsMinY) / saveHeight / 10.0;
- lb.MoveTo(mcsMinX + incX, mcsMinY + incY);
- lb.LineTo(mcsMaxX - incX, mcsMinY + incY);
- lb.LineTo(mcsMaxX - incX, mcsMaxY - incY);
- lb.LineTo(mcsMinX + incX, mcsMaxY - incY);
- lb.LineTo(mcsMinX + incX, mcsMinY + incY);
- dr->ProcessPolyline(&lb, ls);
- //-------------------------------------------------------
- */
-
- // get a byte representation of the image
- auto_ptr<RS_ByteData> data;
- Ptr<MgByteSource> bs;
-
- try
- {
- // call the image renderer to create the image
- if (wcscmp(rendererName.c_str(), L"AGG") == 0)
- {
- if (format == MgImageFormats::Meta) // we dont use the colorPalette here for meta tiling
- { // as this call only returns the framebuffer
- data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, NULL, NULL));
- // copy the framebuffer into the reader, RenderTileFromMetatile is taking it from there
- }
- else
- {
- //-------------------------------------------------------
- /// RFC60 code to correct colormaps by UV
- //-------------------------------------------------------
- // We examine the expressions collected from xml definitions of all layers.
- // The map object has a list from all color entries found in the most recent
- // layer stylization.
- // * TODO - currently they are interpreted as ffffffff 32-bit RGBA string values
- // * adding expresssions and other interpretations should be done in ParseColorStrings
- // * the color Palette for the renderer is a vector<RS_Color>
- if (HasColorMap(format))
- {
- RS_ColorVector tileColorPalette;
- MgMappingUtil::ParseColorStrings(&tileColorPalette, map);
- // printf("<<<<<<<<<<<<<<<<<<<<< MgServerRenderingService::ColorPalette->size(): %d\n", tileColorPalette.size());
- data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, &tileColorPalette, frameBuffer));
- }
- else
- data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, NULL, frameBuffer));
- }
- }
- else
- data.reset(((GDRenderer*)dr)->Save(format, saveWidth, saveHeight));
- }
- catch (exception e)
- {
- ACE_DEBUG((LM_DEBUG, L"(%t) %w caught in RenderingService ColorPaletteGeneration\n", e.what()));
- throw e;
- }
-
- if (NULL != data.get())
- {
- // put this into a byte source
- bs = new MgByteSource(data->GetBytes(), data->GetNumBytes());
-
- if (format == MgImageFormats::Gif)
- bs->SetMimeType(MgMimeType::Gif);
- else if (format == MgImageFormats::Jpeg)
- bs->SetMimeType(MgMimeType::Jpeg);
- else if (format == MgImageFormats::Png || format == MgImageFormats::Png8)
- bs->SetMimeType(MgMimeType::Png);
- else if (format == MgImageFormats::Tiff)
- bs->SetMimeType(MgMimeType::Tiff);
- else if (format == MgImageFormats::Meta) // add a mimetype for our metatile
- bs->SetMimeType(MgMimeType::Meta);
- }
- else
- throw new MgNullReferenceException(L"MgImageProcessor.CreateImageFromRenderer", __LINE__, __WFILE__, NULL, L"MgNoDataFromRenderer", NULL);
-
- if (NULL != pPRMResult)
- {
- // Calculate the time spent on stylizing labels
- double createImageTime = MgTimerUtil::GetTime() - pPRMResult->GetCreateImageTime();
- pPRMResult->SetCreateImageTime(createImageTime);
-
- pPRMResult->SetImageFormat(format);
- pPRMResult->SetRendererType(rendererName);
- }
-
- return bs->GetReader();
-}
-
-MgByteReader* MgImageProcessor::RenderTileFromMetaTile(MgMap * map, MgMetatile * metaTile, CREFSTRING rendererName, MgIRendererFactory* factory, INT32 subTileX, INT32 subTileY)
-{
- Ptr<MgByteReader> image = metaTile->GetImage();
- INT32 metaTileFactor = metaTile->GetMetaTilingFactor();
- INT32 origTileWidth = metaTile->GetRequestedWidth();
- INT32 origTileHeight = metaTile->GetRequestedHeight();
- STRING origTileFormat = metaTile->GetTileImageFormat();
-
- MgByteSource* bs = image->GetByteSource();
- // upcast to bytesource Impl to access bytearray member
- ByteSourceMemoryImpl* source = dynamic_cast<ByteSourceMemoryImpl*>(bs->GetSourceImpl());
- _ASSERT(source);
- _ASSERT(bs->GetMimeType() == MgMimeType::Meta);
- INT32 size = (INT32)source->GetLength();
-
- // some checking: the complete meta tile of 32b pixels should be in the framebuffer handed over
- //INT32 expectedSize = 4 * (metaTileFactor * origTileWidth)
- // * (metaTileFactor * origTileHeight);
- //assert(size == expectedSize);
- INT32 expectedSize = 4 * metaTile->GetWidth() * metaTile->GetHeight();
- _ASSERT(size == expectedSize);
-
- INT32 scaledTileWidth = origTileWidth;
- INT32 scaledTileHeight = origTileHeight;
-
- // For extent-driven tile rendering like XYZ, the raw image frame buffer of the tile may not actually
- // be square which means the meta-tile itself would not be square, so when we sub-divide we must make
- // sure to not sub-divide by the original width/height, but by its *proportially scaled* width/height,
- // which we then pass it down to AGGRenderer::Save() to write the buffer back up to the originally
- // requested size, scaling as appropriate.
- if (metaTileFactor > 1)
- {
- scaledTileWidth = (INT32)(metaTile->GetWidth() / metaTileFactor);
- scaledTileHeight = (INT32)(metaTile->GetHeight() / metaTileFactor);
-
- // This may be the same or may be less, but it can't be more!
- _ASSERT(scaledTileWidth <= origTileWidth);
- _ASSERT(scaledTileHeight <= origTileHeight);
- }
-
- // use the map's background color, but always make it fully transparent
- RS_Color bgColor;
- StylizationUtil::ParseColor(map->GetBackgroundColor(), bgColor);
- bgColor.alpha() = 0;
- // Must create renderer under the scaled width/height and not original
- auto_ptr<SE_Renderer> dr(factory->CreateRenderer(rendererName, scaledTileWidth, scaledTileHeight, bgColor, true));
- RS_ColorVector tileColorPalette;
- if (rendererName == L"AGG" && HasColorMap(origTileFormat))
- {
- MgMappingUtil::ParseColorStrings(&tileColorPalette, map);
- }
-
- // now copy tile from meta framebuffer to new one...
- // use unsigned int pointer arithmetic for pixels!
- //MgByte* byteBuffer = source->Bytes(); // here we access the bytearray inside the bytesource
- MgByte* byteBuffer = source->BytesNoAddRef();
- assert(size == byteBuffer->GetLength()); // double check the buffer size
-
- // get pointer to the framebuffer containing the metatile
- unsigned int *framebuf = (unsigned int*)byteBuffer->Bytes();
-
- // allocate subtile buffer to copy new framebuf with changed dimensions
- // place buffer in allocated MgByte auto_ptr object for destruction at end of scope
- auto_ptr<MgByte> subTileBytes(new MgByte((unsigned char*)new unsigned int[scaledTileWidth * scaledTileHeight],
- scaledTileWidth * scaledTileHeight * sizeof(int), MgByte::New));
- // get the pointer to the internal target buffer
- unsigned int* subTileBuf = (unsigned int*)subTileBytes->Bytes();
- for (int y = 0; y < scaledTileHeight; y++) // rows
- for (int x = 0; x < scaledTileWidth; x++) // columns innerloop
- { // this copies the 32bit pixels from the meta tile framebuffer to the subtile framebuffer
- *(subTileBuf + x
- + y * scaledTileWidth) // target address in subtile
- = *(framebuf + (x + (subTileX * scaledTileWidth)) // X address in meta tile
- + (y + (subTileY * scaledTileHeight)) // Y address in meta tile
- * scaledTileWidth * metaTileFactor); // use width of metaTile here
- }
- // then call the image renderer to convert the framebuffer bitmap into the desired image format
- return CreateImageFromRenderer(map, dr.get(), origTileWidth, origTileHeight, origTileFormat, rendererName, NULL, subTileBuf);
-}
Deleted: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.h
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.h 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ImageProcessor.h 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1,56 +0,0 @@
-//
-// Copyright (C) 2004-2019 by Autodesk, Inc.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of version 2.1 of the GNU Lesser
-// General Public License as published by the Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-#ifndef MGIMAGEPROCESSOR_H
-#define MGIMAGEPROCESSOR_H
-
-class RS_Color;
-class Renderer;
-class SE_Renderer;
-
-class MgIRendererFactory
-{
-public:
- MG_SERVER_RENDERING_API virtual SE_Renderer* CreateRenderer(CREFSTRING rendererName,
- INT32 width,
- INT32 height,
- RS_Color& bgColor,
- bool requiresClipping,
- bool localOverposting = false,
- double tileExtentOffset = 0.0) = 0;
-};
-
-/// \brief
-/// Image processing utils
-class MG_SERVER_RENDERING_API MgImageProcessor
-{
-public:
- static bool HasColorMap(CREFSTRING format);
-
- static MgByteReader* CreateImageFromRenderer(MgMap* map,
- Renderer* dr,
- INT32 saveWidth,
- INT32 saveHeight,
- CREFSTRING format,
- CREFSTRING rendererName,
- ProfileRenderMapResult* pPRMResult,
- unsigned int* frameBuffer = NULL);
-
- static MgByteReader* RenderTileFromMetaTile(MgMap* map, MgMetatile* metaTile, CREFSTRING rendererName, MgIRendererFactory* factory, INT32 subTileX, INT32 subTileY);
-};
-
-#endif
\ No newline at end of file
Modified: sandbox/jng/tiling_v2/Server/src/Services/Rendering/RenderingOperationFactory.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/RenderingOperationFactory.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/RenderingOperationFactory.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -119,6 +119,17 @@
L"MgRenderingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
}
break;
+ case MgRenderingServiceOpId::RenderTileFromMetaTile:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(3, 3):
+ handler.reset(new MgOpRenderTileFromMetatile());
+ break;
+ default:
+ throw new MgInvalidOperationVersionException(
+ L"MgRenderingOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ break;
case MgRenderingServiceOpId::RenderTileUTFGrid:
switch (VERSION_NO_PHASE(operationVersion))
{
Modified: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1289,7 +1289,7 @@
MG_THROW() // to skip a faulty tile we need to rethrow the exception which could be thrown in StylizeLayers
- Ptr<MgByteReader> ret = MgImageProcessor::CreateImageFromRenderer(map, dr, saveWidth, saveHeight, format, m_rendererName, pPRMResult);
+ Ptr<MgByteReader> ret = CreateImageFromRenderer(map, dr, saveWidth, saveHeight, format, m_rendererName, pPRMResult);
return ret.Detach();
}
@@ -1866,7 +1866,7 @@
MgMappingUtil::StylizeLayers(m_svcResource, m_svcFeature, m_svcDrawing, m_pCSFactory, map,
layers, NULL, ds, dr, dstCs, expandExtents, false, scale,
- false, MgImageProcessor::HasColorMap(format), pPRLsResult);
+ false, HasColorMap(format), pPRLsResult);
if(NULL != pPRMResult)
{
@@ -2488,4 +2488,217 @@
MG_CATCH_AND_THROW(L"MgServerRenderingService.RenderMetatileXYZ")
return ret.Detach();
+}
+
+MgByteReader* MgServerRenderingService::RenderTileFromMetaTile(MgMap* map,
+ MgMetatile* metaTile,
+ CREFSTRING rendererName,
+ INT32 subTileX,
+ INT32 subTileY)
+{
+ Ptr<MgByteReader> ret;
+
+ MG_TRY()
+
+ CHECKARGUMENTNULL(map, L"MgServerRenderingService.RenderMetatileXYZ");
+
+ Ptr<MgByteReader> image = metaTile->GetImage();
+ INT32 metaTileFactor = metaTile->GetMetaTilingFactor();
+ INT32 origTileWidth = metaTile->GetRequestedWidth();
+ INT32 origTileHeight = metaTile->GetRequestedHeight();
+ STRING origTileFormat = metaTile->GetTileImageFormat();
+
+ MgByteSource* bs = image->GetByteSource();
+ // upcast to bytesource Impl to access bytearray member
+ ByteSourceMemoryImpl* source = dynamic_cast<ByteSourceMemoryImpl*>(bs->GetSourceImpl());
+ _ASSERT(source);
+ _ASSERT(bs->GetMimeType() == MgMimeType::Meta);
+ INT32 size = (INT32)source->GetLength();
+
+ // some checking: the complete meta tile of 32b pixels should be in the framebuffer handed over
+ //INT32 expectedSize = 4 * (metaTileFactor * origTileWidth)
+ // * (metaTileFactor * origTileHeight);
+ //assert(size == expectedSize);
+ INT32 expectedSize = 4 * metaTile->GetWidth() * metaTile->GetHeight();
+ _ASSERT(size == expectedSize);
+
+ INT32 scaledTileWidth = origTileWidth;
+ INT32 scaledTileHeight = origTileHeight;
+
+ // For extent-driven tile rendering like XYZ, the raw image frame buffer of the tile may not actually
+ // be square which means the meta-tile itself would not be square, so when we sub-divide we must make
+ // sure to not sub-divide by the original width/height, but by its *proportially scaled* width/height,
+ // which we then pass it down to AGGRenderer::Save() to write the buffer back up to the originally
+ // requested size, scaling as appropriate.
+ if (metaTileFactor > 1)
+ {
+ scaledTileWidth = (INT32)(metaTile->GetWidth() / metaTileFactor);
+ scaledTileHeight = (INT32)(metaTile->GetHeight() / metaTileFactor);
+
+ // This may be the same or may be less, but it can't be more!
+ _ASSERT(scaledTileWidth <= origTileWidth);
+ _ASSERT(scaledTileHeight <= origTileHeight);
+ }
+
+ // use the map's background color, but always make it fully transparent
+ RS_Color bgColor;
+ StylizationUtil::ParseColor(map->GetBackgroundColor(), bgColor);
+ bgColor.alpha() = 0;
+ // Must create renderer under the scaled width/height and not original
+ auto_ptr<SE_Renderer> dr(CreateRenderer(rendererName, scaledTileWidth, scaledTileHeight, bgColor, true));
+ RS_ColorVector tileColorPalette;
+ if (rendererName == L"AGG" && HasColorMap(origTileFormat))
+ {
+ MgMappingUtil::ParseColorStrings(&tileColorPalette, map);
+ }
+
+ // now copy tile from meta framebuffer to new one...
+ // use unsigned int pointer arithmetic for pixels!
+ //MgByte* byteBuffer = source->Bytes(); // here we access the bytearray inside the bytesource
+ MgByte* byteBuffer = source->BytesNoAddRef();
+ assert(size == byteBuffer->GetLength()); // double check the buffer size
+
+ // get pointer to the framebuffer containing the metatile
+ unsigned int *framebuf = (unsigned int*)byteBuffer->Bytes();
+
+ // allocate subtile buffer to copy new framebuf with changed dimensions
+ // place buffer in allocated MgByte auto_ptr object for destruction at end of scope
+ auto_ptr<MgByte> subTileBytes(new MgByte((unsigned char*)new unsigned int[scaledTileWidth * scaledTileHeight],
+ scaledTileWidth * scaledTileHeight * sizeof(int), MgByte::New));
+ // get the pointer to the internal target buffer
+ unsigned int* subTileBuf = (unsigned int*)subTileBytes->Bytes();
+ for (int y = 0; y < scaledTileHeight; y++) // rows
+ for (int x = 0; x < scaledTileWidth; x++) // columns innerloop
+ { // this copies the 32bit pixels from the meta tile framebuffer to the subtile framebuffer
+ *(subTileBuf + x
+ + y * scaledTileWidth) // target address in subtile
+ = *(framebuf + (x + (subTileX * scaledTileWidth)) // X address in meta tile
+ + (y + (subTileY * scaledTileHeight)) // Y address in meta tile
+ * scaledTileWidth * metaTileFactor); // use width of metaTile here
+ }
+ // then call the image renderer to convert the framebuffer bitmap into the desired image format
+ ret = CreateImageFromRenderer(map, dr.get(), origTileWidth, origTileHeight, origTileFormat, rendererName, NULL, subTileBuf);
+
+ MG_CATCH_AND_THROW(L"MgServerRenderingService.RenderTileFromMetaTile")
+
+ return ret.Detach();
+}
+
+bool MgServerRenderingService::HasColorMap(CREFSTRING format)
+{
+ return format == L"PNG8" || format == L"GIF";
+}
+
+MgByteReader* MgServerRenderingService::CreateImageFromRenderer(MgMap* map,
+ Renderer* dr,
+ INT32 saveWidth,
+ INT32 saveHeight,
+ CREFSTRING format,
+ CREFSTRING rendererName,
+ ProfileRenderMapResult* pPRMResult,
+ unsigned int* frameBuffer)
+{
+ if (NULL != pPRMResult)
+ {
+ // Set the start time of creating map image
+ pPRMResult->SetCreateImageTime(MgTimerUtil::GetTime());
+ }
+
+ /*
+ //-------------------------------------------------------
+ // draw a border around the tile - used for debugging
+ RS_LineStroke ls;
+ ls.color() = RS_Color(128, 128, 128, 64);
+
+ LineBuffer lb(5);
+ double mcsMinX = b.minx;
+ double mcsMaxX = b.maxx;
+ double mcsMinY = b.miny;
+ double mcsMaxY = b.maxy;
+ double incX = (mcsMaxX - mcsMinX) / saveWidth / 10.0;
+ double incY = (mcsMaxY - mcsMinY) / saveHeight / 10.0;
+ lb.MoveTo(mcsMinX + incX, mcsMinY + incY);
+ lb.LineTo(mcsMaxX - incX, mcsMinY + incY);
+ lb.LineTo(mcsMaxX - incX, mcsMaxY - incY);
+ lb.LineTo(mcsMinX + incX, mcsMaxY - incY);
+ lb.LineTo(mcsMinX + incX, mcsMinY + incY);
+ dr->ProcessPolyline(&lb, ls);
+ //-------------------------------------------------------
+ */
+
+ // get a byte representation of the image
+ auto_ptr<RS_ByteData> data;
+ Ptr<MgByteSource> bs;
+
+ try
+ {
+ // call the image renderer to create the image
+ if (wcscmp(rendererName.c_str(), L"AGG") == 0)
+ {
+ if (format == MgImageFormats::Meta) // we dont use the colorPalette here for meta tiling
+ { // as this call only returns the framebuffer
+ data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, NULL, NULL));
+ // copy the framebuffer into the reader, RenderTileFromMetatile is taking it from there
+ }
+ else
+ {
+ //-------------------------------------------------------
+ /// RFC60 code to correct colormaps by UV
+ //-------------------------------------------------------
+ // We examine the expressions collected from xml definitions of all layers.
+ // The map object has a list from all color entries found in the most recent
+ // layer stylization.
+ // * TODO - currently they are interpreted as ffffffff 32-bit RGBA string values
+ // * adding expresssions and other interpretations should be done in ParseColorStrings
+ // * the color Palette for the renderer is a vector<RS_Color>
+ if (HasColorMap(format))
+ {
+ RS_ColorVector tileColorPalette;
+ MgMappingUtil::ParseColorStrings(&tileColorPalette, map);
+ // printf("<<<<<<<<<<<<<<<<<<<<< MgServerRenderingService::ColorPalette->size(): %d\n", tileColorPalette.size());
+ data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, &tileColorPalette, frameBuffer));
+ }
+ else
+ data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, NULL, frameBuffer));
+ }
+ }
+ else
+ data.reset(((GDRenderer*)dr)->Save(format, saveWidth, saveHeight));
+ }
+ catch (exception e)
+ {
+ ACE_DEBUG((LM_DEBUG, L"(%t) %w caught in RenderingService ColorPaletteGeneration\n", e.what()));
+ throw e;
+ }
+
+ if (NULL != data.get())
+ {
+ // put this into a byte source
+ bs = new MgByteSource(data->GetBytes(), data->GetNumBytes());
+
+ if (format == MgImageFormats::Gif)
+ bs->SetMimeType(MgMimeType::Gif);
+ else if (format == MgImageFormats::Jpeg)
+ bs->SetMimeType(MgMimeType::Jpeg);
+ else if (format == MgImageFormats::Png || format == MgImageFormats::Png8)
+ bs->SetMimeType(MgMimeType::Png);
+ else if (format == MgImageFormats::Tiff)
+ bs->SetMimeType(MgMimeType::Tiff);
+ else if (format == MgImageFormats::Meta) // add a mimetype for our metatile
+ bs->SetMimeType(MgMimeType::Meta);
+ }
+ else
+ throw new MgNullReferenceException(L"MgImageProcessor.CreateImageFromRenderer", __LINE__, __WFILE__, NULL, L"MgNoDataFromRenderer", NULL);
+
+ if (NULL != pPRMResult)
+ {
+ // Calculate the time spent on stylizing labels
+ double createImageTime = MgTimerUtil::GetTime() - pPRMResult->GetCreateImageTime();
+ pPRMResult->SetCreateImageTime(createImageTime);
+
+ pPRMResult->SetImageFormat(format);
+ pPRMResult->SetRendererType(rendererName);
+ }
+
+ return bs->GetReader();
}
\ No newline at end of file
Modified: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.h
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.h 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.h 2019-05-21 12:25:32 UTC (rev 9505)
@@ -19,10 +19,11 @@
#define MGSERVERRENDERINGSERVICE_H
#include "ServerRenderingDllExport.h"
-#include "ImageProcessor.h"
struct RS_Bounds;
+class RS_Color;
class SE_Renderer;
+class Renderer;
class FeatureInfoRenderer;
class MgFeatureInformation;
class Stylizer;
@@ -32,7 +33,7 @@
class ProfileRenderMapResult;
}
-class MG_SERVER_RENDERING_API MgServerRenderingService : public MgRenderingService, public MgIRendererFactory
+class MG_SERVER_RENDERING_API MgServerRenderingService : public MgRenderingService
{
DECLARE_CLASSNAME(MgServerRenderingService)
@@ -285,7 +286,20 @@
double tileExtentOffset,
INT32 metaTilingFactor);
+ virtual MgByteReader* RenderTileFromMetaTile(MgMap* map, MgMetatile* metaTile, CREFSTRING rendererName, INT32 subTileX, INT32 subTileY);
+
private:
+ static bool HasColorMap(CREFSTRING format);
+
+ static MgByteReader* CreateImageFromRenderer(MgMap* map,
+ Renderer* dr,
+ INT32 saveWidth,
+ INT32 saveHeight,
+ CREFSTRING format,
+ CREFSTRING rendererName,
+ ProfileRenderMapResult* pPRMResult,
+ unsigned int* frameBuffer = NULL);
+
static void ComputeScaledDimensions(RS_Bounds& extent, INT32 width, INT32 height, INT32 dpi,
double metersPerUnit, INT32& drawWidth, INT32& drawHeight, double& scale);
Modified: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj 2019-05-21 12:25:32 UTC (rev 9505)
@@ -198,12 +198,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="ImageProcessor.cpp">
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
- </ClCompile>
<ClCompile Include="OpQueryFeatureProperties.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -252,6 +246,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="OpRenderTileFromMetatile.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="OpRenderTileXYZ.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -309,7 +309,6 @@
<ClCompile Include="ServerRenderingServiceBuild.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="ImageProcessor.h" />
<ClInclude Include="OpQueryFeatureProperties.h" />
<ClInclude Include="OpQueryFeatures.h" />
<ClInclude Include="OpRenderDynamicOverlay.h" />
@@ -318,6 +317,7 @@
<ClInclude Include="OpRenderMetatile.h" />
<ClInclude Include="OpRenderMetatileXYZ.h" />
<ClInclude Include="OpRenderTile.h" />
+ <ClInclude Include="OpRenderTileFromMetatile.h" />
<ClInclude Include="OpRenderTileXYZ.h" />
<ClInclude Include="OpRenderTileUTFGrid.h" />
<ClInclude Include="RenderingOperation.h" />
Modified: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj.filters
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj.filters 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingService.vcxproj.filters 2019-05-21 12:25:32 UTC (rev 9505)
@@ -48,7 +48,9 @@
<ClCompile Include="OpRenderMetatileXYZ.cpp">
<Filter>Ops</Filter>
</ClCompile>
- <ClCompile Include="ImageProcessor.cpp" />
+ <ClCompile Include="OpRenderTileFromMetatile.cpp">
+ <Filter>Ops</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="OpQueryFeatureProperties.h">
@@ -93,7 +95,9 @@
<ClInclude Include="OpRenderMetatileXYZ.h">
<Filter>Ops</Filter>
</ClInclude>
- <ClInclude Include="ImageProcessor.h" />
+ <ClInclude Include="OpRenderTileFromMetatile.h">
+ <Filter>Ops</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ServerRenderingService.rc" />
Modified: sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingServiceBuild.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingServiceBuild.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Rendering/ServerRenderingServiceBuild.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -20,11 +20,11 @@
#endif
#include "FeatureInfoRenderer.cpp"
#include "FeaturePropRenderer.cpp"
-#include "ImageProcessor.cpp"
#include "OpRenderDynamicOverlay.cpp"
#include "OpRenderMap.cpp"
#include "OpRenderMapLegend.cpp"
#include "OpRenderMetatile.cpp"
+#include "OpRenderTileFromMetatile.cpp"
#include "OpRenderTile.cpp"
#include "OpRenderTileXYZ.cpp"
#include "OpRenderTileUTFGrid.cpp"
Modified: sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheDefaultProvider.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheDefaultProvider.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheDefaultProvider.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -317,10 +317,9 @@
text << L"(" << ACE_OS::thr_self() << L") METATILE: RenderMetaTile(" << metaTileRow << L", " << metaTileColumn << L") " << metaTileName << " using map 0x" << map << L"\n";
ACE_DEBUG((LM_DEBUG, text.str().c_str()));
#endif
- // Get a server-side rendering Service only...
MgServiceManager* serviceMan = MgServiceManager::GetInstance();
_ASSERT(NULL != serviceMan);
- Ptr<MgServerRenderingService> svcRendering = dynamic_cast<MgServerRenderingService*>(
+ Ptr<MgRenderingService> svcRendering = dynamic_cast<MgRenderingService*>(
serviceMan->RequestService(MgServiceType::RenderingService));
// Bail if no server-side impl exists (we can't use proxy impl)
@@ -342,7 +341,7 @@
for (int x = 0; x < maxX; x++) // columns
{
// Collect the subtile from the metatile
- Ptr<MgByteReader> img = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, m_rendererName, svcRendering, x, y);
+ Ptr<MgByteReader> img = svcRendering->RenderTileFromMetaTile(map, metaTile, m_rendererName, x, y);
#ifdef _DEBUG
INT32 tileLen = img->GetLength();
#endif
Modified: sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheXYZProvider.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheXYZProvider.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/Services/Tile/TileCacheXYZProvider.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -403,18 +403,12 @@
text << L"(" << ACE_OS::thr_self() << L") METATILE: RenderMetaTile(" << metaTileRow << L", " << metaTileColumn << L") " << metaTileName << " using map 0x" << map << L"\n";
ACE_DEBUG((LM_DEBUG, text.str().c_str()));
#endif
- // Get a server-side rendering Service only...
MgServiceManager* serviceMan = MgServiceManager::GetInstance();
_ASSERT(NULL != serviceMan);
- Ptr<MgServerRenderingService> svcRendering = dynamic_cast<MgServerRenderingService*>(
+ Ptr<MgRenderingService> svcRendering = dynamic_cast<MgRenderingService*>(
serviceMan->RequestService(MgServiceType::RenderingService));
+ _ASSERT(NULL != svcRendering);
- // Bail if no server-side impl exists (we can't use proxy impl)
- if (NULL == svcRendering)
- {
- throw new MgServiceNotAvailableException(L"MgTileCacheXYZProvider.GetMetatileForResource", __LINE__, __WFILE__, NULL, L"", NULL);
- }
-
//Ptr<MgByteReader> metaTileBitMap = GetTile(metaTileName, map, scaleIndex, baseMapLayerGroupName, metaTileColumn, metaTileRow);
INT32 tileDpi = map->GetDisplayDpi();
Ptr<MgMetatile> metaTile = svcRendering->RenderMetatileXYZ(map, baseMapLayerGroupName, metaTileRow, metaTileColumn, scaleIndex, tileDpi, m_format, m_tileExtentOffset, m_metaTileFactor);
@@ -428,7 +422,7 @@
for (int x = 0; x < maxX; x++) // columns
{
// Collect the subtile from the metatile (we flip x/y for XYZ)
- Ptr<MgByteReader> img = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, m_rendererName, svcRendering, x, y);
+ Ptr<MgByteReader> img = svcRendering->RenderTileFromMetaTile(map, metaTile, m_rendererName, x, y);
#ifdef _DEBUG
INT32 tileLen = img->GetLength();
#endif
Modified: sandbox/jng/tiling_v2/Server/src/UnitTesting/TestRenderingService.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/UnitTesting/TestRenderingService.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/UnitTesting/TestRenderingService.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -25,8 +25,6 @@
//#include "AGGRenderer.h"
#include "FoundationDefs.h"
#include "SE_Renderer.h"
-#include "ServerRenderingService.h"
-#include "ImageProcessor.h"
const STRING TEST_LOCALE = L"en";
@@ -1733,8 +1731,7 @@
tile5_6_baseline->ToFile(GetPath(L"../UnitTestFiles/RenderTile_5_6_Baseline", imageFormat, extension));
tile5_7_baseline->ToFile(GetPath(L"../UnitTestFiles/RenderTile_5_7_Baseline", imageFormat, extension));
- //This should be a server impl
- MgServerRenderingService* renderSvc = dynamic_cast<MgServerRenderingService*>(m_svcRendering.p);
+ MgRenderingService* renderSvc = dynamic_cast<MgRenderingService*>(m_svcRendering.p);
CPPUNIT_ASSERT(NULL != renderSvc);
// Render a 2x2 metatile which should cover the same tiles as the baseline test.
@@ -1744,10 +1741,10 @@
//CPPUNIT_ASSERT(metaTile->IsRewindable());
//metaTile->Rewind();
STRING rendererName = L"AGG";
- Ptr<MgByteReader> tile4_6 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 0, 0);
- Ptr<MgByteReader> tile4_7 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 0, 1);
- Ptr<MgByteReader> tile5_6 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 1, 0);
- Ptr<MgByteReader> tile5_7 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 1, 1);
+ Ptr<MgByteReader> tile4_6 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 0, 0);
+ Ptr<MgByteReader> tile4_7 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 0, 1);
+ Ptr<MgByteReader> tile5_6 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 1, 0);
+ Ptr<MgByteReader> tile5_7 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 1, 1);
tile4_6->ToFile(GetPath(L"../UnitTestFiles/RenderTile_4_6_Metatiled", imageFormat, extension));
@@ -1779,8 +1776,7 @@
tile_16798_23892_baseline->ToFile(GetPath(L"../UnitTestFiles/RenderTileXYZ_16798_23892_16_Baseline", imageFormat, extension));
tile_16799_23892_baseline->ToFile(GetPath(L"../UnitTestFiles/RenderTileXYZ_16799_23892_16_Baseline", imageFormat, extension));
- //This should be a server impl
- MgServerRenderingService* renderSvc = dynamic_cast<MgServerRenderingService*>(m_svcRendering.p);
+ MgRenderingService* renderSvc = dynamic_cast<MgRenderingService*>(m_svcRendering.p);
CPPUNIT_ASSERT(NULL != renderSvc);
// Render a 2x2 metatile which should cover the same tiles as the baseline test.
@@ -1790,10 +1786,10 @@
//CPPUNIT_ASSERT(metaTile->IsRewindable());
//metaTile->Rewind();
STRING rendererName = L"AGG";
- Ptr<MgByteReader> tile_16798_23891 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 0, 0);
- Ptr<MgByteReader> tile_16799_23891 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 1, 0);
- Ptr<MgByteReader> tile_16798_23892 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 0, 1);
- Ptr<MgByteReader> tile_16799_23892 = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, rendererName, renderSvc, 1, 1);
+ Ptr<MgByteReader> tile_16798_23891 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 0, 0);
+ Ptr<MgByteReader> tile_16799_23891 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 1, 0);
+ Ptr<MgByteReader> tile_16798_23892 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 0, 1);
+ Ptr<MgByteReader> tile_16799_23892 = renderSvc->RenderTileFromMetaTile(map, metaTile, rendererName, 1, 1);
tile_16798_23891->ToFile(GetPath(L"../UnitTestFiles/RenderTileXYZ_16798_23891_16_Metatiled", imageFormat, extension));
tile_16799_23891->ToFile(GetPath(L"../UnitTestFiles/RenderTileXYZ_16799_23891_16_Metatiled", imageFormat, extension));
Modified: sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp 2019-05-21 12:25:32 UTC (rev 9505)
@@ -1777,7 +1777,7 @@
Ptr<MgMap> map = CreateMapLinked(L"MetaTileBaseline");
map->SetViewScale(3125);
- Ptr<MgServerRenderingService> renderSvc = dynamic_cast<MgServerRenderingService*>(m_siteConnection->CreateService(MgServiceType::RenderingService));
+ Ptr<MgRenderingService> renderSvc = dynamic_cast<MgRenderingService*>(m_siteConnection->CreateService(MgServiceType::RenderingService));
CPPUNIT_ASSERT(NULL != renderSvc);
MgFileUtil::CreateDirectory(L"../UnitTestFiles/GetMetatileSingle_Baseline");
@@ -1789,7 +1789,7 @@
{
for (INT32 y = 0; y < metaTile->GetMetaTilingFactor(); y++)
{
- Ptr<MgByteReader> img = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, L"AGG", renderSvc, x, y);
+ Ptr<MgByteReader> img = renderSvc->RenderTileFromMetaTile(map, metaTile, L"AGG", x, y);
INT64 tileLen = img->GetLength();
STRING fileName = L"../UnitTestFiles/GetMetatileSingle_Baseline/";
STRING s;
@@ -1851,7 +1851,7 @@
Ptr<MgMap> map = CreateMapLinked2(L"MetaTileBaseline", ovCsvWkt);
map->SetViewScale(3125);
- Ptr<MgServerRenderingService> renderSvc = dynamic_cast<MgServerRenderingService*>(m_siteConnection->CreateService(MgServiceType::RenderingService));
+ Ptr<MgRenderingService> renderSvc = dynamic_cast<MgRenderingService*>(m_siteConnection->CreateService(MgServiceType::RenderingService));
CPPUNIT_ASSERT(NULL != renderSvc);
MgFileUtil::CreateDirectory(L"../UnitTestFiles/GetMetatileSingleXYZ_Baseline");
@@ -1868,7 +1868,7 @@
{
for (INT32 y1 = 0; y1 < mtFactor; y1++)
{
- Ptr<MgByteReader> img = MgImageProcessor::RenderTileFromMetaTile(map, metaTile, L"AGG", renderSvc, x1, y1);
+ Ptr<MgByteReader> img = renderSvc->RenderTileFromMetaTile(map, metaTile, L"AGG", x1, y1);
INT64 tileLen = img->GetLength();
STRING fileName = L"../UnitTestFiles/GetMetatileSingleXYZ_Baseline/";
STRING s;
Modified: sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h
===================================================================
--- sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h 2019-05-09 12:53:17 UTC (rev 9504)
+++ sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h 2019-05-21 12:25:32 UTC (rev 9505)
@@ -26,9 +26,9 @@
CPPUNIT_TEST(TestStart); // This must be the very first unit test
CPPUNIT_TEST(TestCase_MgMap_CreateFromXYZTileSet);
- //CPPUNIT_TEST(TestCase_GetMetatileSingle);
- //CPPUNIT_TEST(TestCase_GetMetatileXYZSingle);
- /*
+ CPPUNIT_TEST(TestCase_GetMetatileSingle);
+ CPPUNIT_TEST(TestCase_GetMetatileXYZSingle);
+
CPPUNIT_TEST(TestCase_GetTileProviders);
CPPUNIT_TEST(TestCase_MgMap_Inline);
CPPUNIT_TEST(TestCase_MgMap_Linked);
@@ -45,7 +45,7 @@
CPPUNIT_TEST(TestCase_GetTileLinked);
CPPUNIT_TEST(TestCase_GetTileXYZ);
CPPUNIT_TEST(TestCase_ClearCacheLinked);
- */
+
CPPUNIT_TEST(TestEnd); // This must be the very last unit test
CPPUNIT_TEST_SUITE_END();
More information about the mapguide-commits
mailing list