[mapguide-commits] r8182 - in sandbox/jng/tiling/Server/src/Services: Rendering Tile

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jun 3 01:06:01 PDT 2014


Author: jng
Date: 2014-06-03 01:06:01 -0700 (Tue, 03 Jun 2014)
New Revision: 8182

Added:
   sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.cpp
   sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.h
   sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.cpp
   sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.h
Modified:
   sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.cpp
   sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.h
Log:
Add missing files from previous submissions

Added: sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.cpp	                        (rev 0)
+++ sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.cpp	2014-06-03 08:06:01 UTC (rev 8182)
@@ -0,0 +1,176 @@
+//
+//  Copyright (C) 2004-2014 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 "OpRenderTileXYZ.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpRenderTileXYZ::MgOpRenderTileXYZ()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpRenderTileXYZ::~MgOpRenderTileXYZ()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpRenderTileXYZ::Execute()
+{
+    ACE_DEBUG((LM_DEBUG, ACE_TEXT("  (%t) MgOpRenderTileXYZ::Execute()\n")));
+
+    MG_LOG_OPERATION_MESSAGE(L"RenderTileXYZ");
+
+    MG_TRY()
+
+    MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+    ACE_ASSERT(m_stream != NULL);
+
+    if (5 == m_packet.m_NumArguments)
+    {
+        Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+        Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+        map->SetDelayedLoadResourceService(m_resourceService);
+
+        STRING baseMapLayerGroupName;
+        m_stream->GetString(baseMapLayerGroupName);
+
+        INT32 x = 0;
+        m_stream->GetInt32(x);
+
+        INT32 y = 0;
+        m_stream->GetInt32(y);
+
+        INT32 z = 0;
+        m_stream->GetInt32(z);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(x);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(y);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(z);
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        Ptr<MgByteReader> byteReader = m_service->RenderTileXYZ(map, baseMapLayerGroupName, x, y, z);
+
+        EndExecution(byteReader);
+    }
+    else if (7 == m_packet.m_NumArguments)
+    {
+        Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+        Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+        map->SetDelayedLoadResourceService(m_resourceService);
+
+        STRING baseMapLayerGroupName;
+        m_stream->GetString(baseMapLayerGroupName);
+
+        INT32 x = 0;
+        m_stream->GetInt32(x);
+
+        INT32 y = 0;
+        m_stream->GetInt32(y);
+
+        INT32 z = 0;
+        m_stream->GetInt32(z);
+
+        INT32 tileDpi = 0;
+        m_stream->GetInt32(tileDpi);
+
+        STRING tileImageFormat;
+        m_stream->GetString(tileImageFormat);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(x);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(y);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(z);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileDpi);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(tileImageFormat.c_str());
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        Ptr<MgByteReader> byteReader = m_service->RenderTileXYZ(map, baseMapLayerGroupName, x, y, z, tileDpi, tileImageFormat);
+
+        EndExecution(byteReader);
+    }
+    else
+    {
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+    }
+
+    if (!m_argsRead)
+    {
+        throw new MgOperationProcessingException(L"MgOpRenderTileXYZ.Execute",
+            __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgOpRenderTileXYZ.Execute")
+
+    if (mgException != NULL)
+    {
+        // Failed operation
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+    }
+
+    // Add access log entry for operation
+    MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+    MG_THROW()
+}

Added: sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.h
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.h	                        (rev 0)
+++ sandbox/jng/tiling/Server/src/Services/Rendering/OpRenderTileXYZ.h	2014-06-03 08:06:01 UTC (rev 8182)
@@ -0,0 +1,33 @@
+//
+//  Copyright (C) 2004-2014 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 MG_OP_RENDER_TILE_XYZ_H
+#define MG_OP_RENDER_TILE_XYZ_H
+
+#include "RenderingOperation.h"
+
+class MgOpRenderTileXYZ : public MgRenderingOperation
+{
+    public:
+        MgOpRenderTileXYZ();
+        virtual ~MgOpRenderTileXYZ();
+
+    public:
+        virtual void Execute();
+};
+
+#endif

Modified: sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.cpp	2014-06-03 06:14:44 UTC (rev 8181)
+++ sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.cpp	2014-06-03 08:06:01 UTC (rev 8182)
@@ -780,10 +780,10 @@
     {
         resId = SAFE_ADDREF((MgResourceIdentifier*)m_resourceId);
     }
-    return GetBasePathFromResourceId(resId);
+    return GetBasePathFromResourceId(resId, sm_path);
 }
 
-STRING MgTileCacheDefault::GetBasePathFromResourceId(MgResourceIdentifier* resId)
+STRING MgTileCacheDefault::GetBasePathFromResourceId(MgResourceIdentifier* resId, CREFSTRING rootPath)
 {
     STRING mapPath;
     if (resId->GetRepositoryType() == MgRepositoryType::Library)
@@ -822,7 +822,7 @@
 
     // Build the base path using format "%ls%ls":
     //     <basePath> = <tileCachePath><mapPath>
-    STRING basePath = sm_path;
+    STRING basePath = rootPath;
     basePath += mapPath;
 
     return basePath;

Modified: sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.h
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.h	2014-06-03 06:14:44 UTC (rev 8181)
+++ sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefault.h	2014-06-03 08:06:01 UTC (rev 8182)
@@ -67,6 +67,8 @@
                                      INT32 tileRow,
                                      INT32 scaleIndex);
 
+    STRING GetBasePathFromResourceId(MgResourceIdentifier* resId, CREFSTRING rootPath);
+
 private:
     MgByteReader* GetTileForMap(CREFSTRING baseMapLayerGroupName,
                                 INT32 tileColumn,
@@ -82,8 +84,6 @@
         CREFSTRING group, int tileColumn, int tileRow,
         STRING& tilePathname, STRING& lockPathname, bool createFullPath);
 
-    STRING GetBasePathFromResourceId(MgResourceIdentifier* resId);
-
     STRING GetFullPath(int scaleIndex, CREFSTRING group, int tileColumn, int tileRow);
     
     STRING CreateFullPath(int scaleIndex, CREFSTRING group, int tileColumn, int tileRow);

Added: sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.cpp	                        (rev 0)
+++ sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.cpp	2014-06-03 08:06:01 UTC (rev 8182)
@@ -0,0 +1,67 @@
+//
+//  Copyright (C) 2004-2014 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 "TileCacheDefaultProvider.h"
+
+MgTileCacheDefaultProvider::MgTileCacheDefaultProvider(MgResourceIdentifier* tileSetId, CREFSTRING path, INT32 tileWidth, INT32 tileHeight, CREFSTRING format)
+{
+    m_tilesetId = SAFE_ADDREF(tileSetId);
+    m_path = path;
+    m_tileWidth = tileWidth;
+    m_tileHeight = tileHeight;
+    m_format = format;
+}
+
+MgTileCacheDefaultProvider::~MgTileCacheDefaultProvider()
+{
+
+}
+
+MgByteReader* MgTileCacheDefaultProvider::GetTile(CREFSTRING baseMapLayerGroupName,
+                                                  INT32 tileColumn,
+                                                  INT32 tileRow,
+                                                  INT32 scaleIndex)
+{
+    Ptr<MgByteReader> ret;
+    MG_TRY()
+
+    ret = GetTileForResource(m_tilesetId, baseMapLayerGroupName, tileColumn, tileRow, scaleIndex);
+
+    MG_CATCH_AND_THROW(L"MgTileCacheDefaultProvider.GetTile")
+    return ret.Detach();
+}
+
+INT32 MgTileCacheDefaultProvider::GetDefaultTileSizeX()
+{
+    return m_tileWidth;
+}
+
+INT32 MgTileCacheDefaultProvider::GetDefaultTileSizeY()
+{
+    return m_tileHeight;
+}
+
+STRING MgTileCacheDefaultProvider::GetTileFormat()
+{
+    return m_format;
+}
+
+STRING MgTileCacheDefaultProvider::GetBasePath()
+{
+    return GetBasePathFromResourceId(m_tilesetId, m_path);
+}
\ No newline at end of file

Added: sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.h
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.h	                        (rev 0)
+++ sandbox/jng/tiling/Server/src/Services/Tile/TileCacheDefaultProvider.h	2014-06-03 08:06:01 UTC (rev 8182)
@@ -0,0 +1,55 @@
+//
+//  Copyright (C) 2004-2014 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 _MG_TILE_CACHE_DEFAULT_PROVIDER_H_
+#define _MG_TILE_CACHE_DEFAULT_PROVIDER_H_
+
+#include "TileCacheDefault.h"
+
+class MG_SERVER_TILE_API MgTileCacheDefaultProvider : public MgTileCacheDefault
+{
+public:
+    MgTileCacheDefaultProvider(MgResourceIdentifier* tileSetId, CREFSTRING path, INT32 tileWidth, INT32 tileHeight, CREFSTRING format);
+    virtual ~MgTileCacheDefaultProvider();
+
+    virtual MgByteReader* GetTile(CREFSTRING baseMapLayerGroupName,
+                                  INT32 tileColumn,
+                                  INT32 tileRow,
+                                  INT32 scaleIndex);
+
+    virtual INT32 GetDefaultTileSizeX();
+
+    virtual INT32 GetDefaultTileSizeY();
+
+    virtual STRING GetTileFormat();
+
+protected:
+    virtual void Dispose()
+    {
+        delete this;
+    }
+
+    virtual STRING GetBasePath();
+
+private:
+    Ptr<MgResourceIdentifier> m_tilesetId;
+    STRING m_path;
+    INT32 m_tileWidth;
+    INT32 m_tileHeight;
+    STRING m_format;
+};
+
+#endif
\ No newline at end of file



More information about the mapguide-commits mailing list