[mapguide-commits] r6169 - in sandbox/rfc90.2/MgDev: . Common/MapGuideCommon/Resources Common/Renderers Server/src/Core Server/src/Services/Rendering Server/src/Services/Tile

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Oct 7 11:26:59 EDT 2011


Author: uvlite
Date: 2011-10-07 08:26:59 -0700 (Fri, 07 Oct 2011)
New Revision: 6169

Modified:
   sandbox/rfc90.2/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
   sandbox/rfc90.2/MgDev/Common/Renderers/AGGRenderer.cpp
   sandbox/rfc90.2/MgDev/Server/src/Core/serverconfig.ini
   sandbox/rfc90.2/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
   sandbox/rfc90.2/MgDev/Server/src/Services/Tile/ServerTileService.cpp
   sandbox/rfc90.2/MgDev/build.bat
Log:
rfc90 minor fixes

Modified: sandbox/rfc90.2/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
===================================================================
--- sandbox/rfc90.2/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res	2011-10-07 08:36:18 UTC (rev 6168)
+++ sandbox/rfc90.2/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res	2011-10-07 15:26:59 UTC (rev 6169)
@@ -314,9 +314,6 @@
 MgStringEmpty                                         = The string cannot be empty.
 MgStringTooLong                                       = The string is too long.
 MgTagFieldNotFound                                    = The tag contained no fields.
-MgUnableToLockTileFile                                = Unable to lock the tile file.
-MgUnableToOpenLockFile                                = Unable to open the tile lock file.
-MgUnableToOpenTileFile                                = Unable to open the tile file.
 MgUnsupportedService                                  = The site/resource services cannot be enabled/disabled.
 MgUserAndGroupNotEmpty                                = Both the user and group are not empty.
 MgUserAndRoleNotEmpty                                 = Both the user and role are not empty.
@@ -412,7 +409,16 @@
 # T I L E  S E R V I C E
 # *****************************************************************************
 [TileService]
-MgUnableToLockMetaTileFile                            = Cannot create lockfile for current metatile
+MgFoundBlockingLockFile                               = Found a lock file for the current tile.
+MgGetTileWithOutMapSpecified                          = Calling GetTile without a valid mapdefinition or baselayer name.
+MgPermissionDeniedForResource                         = No permission to access the resource service for the current mapDefinition.
+MgNoMapSpecified                                      = Clearcache has been called with an empty map reference.
+MgTooLargeMetaTilingFactor                            = The specified metatiling Factor is too big, change serverconfig.ini.
+MgUnableToLockMetaTileFile                            = Unable to lock the current metatile file.
+MgUnableToLockTileFile                                = Unable to lock the tile file.
+MgUnableToOpenLockFile                                = Unable to open the tile lock file.
+MgUnableToOpenTileFile                                = Unable to open the tile file.
+MgWrongSizeOfMetaTile                                 = Metatile has wrong size.
 
 # *****************************************************************************
 # S T Y L I Z A T I O N

Modified: sandbox/rfc90.2/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- sandbox/rfc90.2/MgDev/Common/Renderers/AGGRenderer.cpp	2011-10-07 08:36:18 UTC (rev 6168)
+++ sandbox/rfc90.2/MgDev/Common/Renderers/AGGRenderer.cpp	2011-10-07 15:26:59 UTC (rev 6169)
@@ -257,8 +257,8 @@
 
 //////////////////////////////////////////////////////////////////////////////
 // Return the rendered image passed in via the imagebuffer (m_rows) as
-// a bytestream in the given image format using the provided colorPalette
-// if given.
+// a bytestream in the given image format using the optional provided colorPalette.
+// In MetaTileing mode return the imagebuffer copied in a new  RS_ByteData object.
 RS_ByteData* AGGRenderer::Save(const RS_String& format, int width, int height,
                                RS_ColorVector* baseColorPalette, unsigned int* imagebuffer)
 {

Modified: sandbox/rfc90.2/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- sandbox/rfc90.2/MgDev/Server/src/Core/serverconfig.ini	2011-10-07 08:36:18 UTC (rev 6168)
+++ sandbox/rfc90.2/MgDev/Server/src/Core/serverconfig.ini	2011-10-07 15:26:59 UTC (rev 6169)
@@ -135,7 +135,7 @@
 # *****************************************************************************
 Email                              =
 MaxConnections                     = 10
-Port                               = 2810
+Port                               =2810
 QueueSize                          = 20
 ThreadPoolSize                     = 10
 
@@ -389,16 +389,11 @@
 #                                  are stored
 # SiteRepositoryPath               Path where the Site repository is stored
 # *****************************************************************************
-#LibraryRepositoryPath              =C:\Program Files\OSGeo\MapGuide\Server\Repositories\Library\
-#LibraryResourceDataFilePath        =C:\Program Files\OSGeo\MapGuide\Server\Repositories\Library\DataFiles\
 #LibraryRepositoryPath              = Repositories/Library/
 #LibraryResourceDataFilePath        = Repositories/Library/DataFiles/
 LibraryRepositoryPath              =C:\Program Files\OSGeo\MapGuide\BigLibrary
 LibraryResourceDataFilePath        =C:\Program Files\OSGeo\MapGuide\BigLibrary\DataFiles
 
-
-#LibraryRepositoryPath              = E:/MapGuide/Library
-#LibraryResourceDataFilePath        = E:/MapGuide/Library/DataFiles/
 #PackagesPath                       = Packages/
 PackagesPath                       =C:\Program Files\OSGeo\MapGuide\Server\Packages\
 RepositoryCheckpointsTimerInterval = 600
@@ -464,7 +459,7 @@
 DefaultTileSizeY                   = 300
 ImageFormat                        = PNG8
 UseMetaTiles                       = 3
-LockMethod                         = 2
+LockMethod                         = 0
 
 [AccessLogProperties]
 # *****************************************************************************

Modified: sandbox/rfc90.2/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- sandbox/rfc90.2/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2011-10-07 08:36:18 UTC (rev 6168)
+++ sandbox/rfc90.2/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2011-10-07 15:26:59 UTC (rev 6169)
@@ -29,7 +29,6 @@
 #include "LegendPlotUtil.h"
 #include "TransformCache.h"
 
-
 // the maximum number of allowed pixels for rendered images
 static const INT32 MAX_PIXELS = 16384*16384;
 static const INT32 FILTER_VISIBLE = 1;
@@ -44,6 +43,12 @@
 
 IMPLEMENT_CREATE_SERVICE(MgServerRenderingService)
 
+// TODO get rid of this very messy code copy
+MgByte* ByteSourceMemoryImpl::Bytes()
+{
+//    return (SAFE_ADDREF((MgByte*)m_data));
+    return (MgByte*)m_data;
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // used when we want to process a given number of features
@@ -278,34 +283,22 @@
     return ret.Detach();
 }
 ///////////////////////////////////////////////////////////////////////////////
-// gets called with a bitmap in the bytereader to be split up into 4 images
-MgByteReader* MgServerRenderingService::RenderTileFromMetaTile(MgMap* map, MgByteReader* metaTile, 
-                                                           int subTileX, int subTileY)
+// gets called with a bitmap in the bytereader to be split up into metatile^2 images
+MgByteReader* MgServerRenderingService::RenderTileFromMetaTile(MgMap* map, MgByteReader* metaTileBitMap, 
+                                                            int subTileX, int subTileY)
 {
-    MgByteSource* bs = metaTile->GetByteSource();
-    ByteSourceImpl* bsimp = bs->GetSourceImpl();
+    MgByteSource* bs = metaTileBitMap->GetByteSource();
+    // upcast to bytesource Impl to access bytearray member
+    ByteSourceMemoryImpl* source = dynamic_cast<ByteSourceMemoryImpl*>(bs->GetSourceImpl());
+    assert (source);
     assert (bs->GetMimeType() == MgMimeType::Meta);
-    int size = (int) bsimp->GetLength();
-    class MyByteSource {
-    public:
-        virtual ~MyByteSource() {} ;        // needed to get the correct sizeof for object
-        MgByte* Bytes() { return m_data; }
-        Ptr<MgByte> m_data;
-        INT32   m_pos;
-    } *source = (MyByteSource *) bsimp;
+    int size = (int) source->GetLength();
 
-    // some checking: the complete meta tile should be in the framebuffer handed over
+    // some checking: the complete meta tile of 32b pixels should be in the framebuffer handed over
     int expectedSize = 4 * (sm_useMetaTiles * MgTileParameters::tileWidth) 
             * (sm_useMetaTiles * MgTileParameters::tileHeight);
-    if (size != expectedSize) {
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderTileFromMetaTile",
-          __LINE__, __WFILE__, NULL, L"MgWrongSizeOfMetaTile", NULL);
-    }
+    assert (size == expectedSize);
 
-    MgByte* byteBuffer = source->Bytes();
-    unsigned char* byteBuf = byteBuffer->Bytes();
-    assert(size == byteBuffer->GetLength());            // double check the buffers
-
     // use the map's background color, but always make it fully transparent
     RS_Color bgColor;
     StylizationUtil::ParseColor(map->GetBackgroundColor(), bgColor);
@@ -317,28 +310,30 @@
         MgMappingUtil::ParseColorStrings(&tileColorPalette, map);
     }
 
-    // copy tile from meta framebuffer to new one...
+    // 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
+    assert(size == byteBuffer->GetLength());  // double check the buffer size
 
-    // get pointer to metatile framebuf
-    unsigned int *framebuf = (unsigned int*) byteBuf; 
+    // 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 None allocated MgByte auto_ptr object for later destruction
+    // 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[MgTileParameters::tileWidth * MgTileParameters::tileHeight],
                                                 MgTileParameters::tileWidth * MgTileParameters::tileHeight * sizeof(int) , MgByte::New));
     // get the pointer to the internal target buffer
-    unsigned int* subTileBuf = (unsigned int*) subTileBytes->Bytes();    
+    unsigned int* subTileBuf = (unsigned int*) subTileBytes->Bytes();
     for (int y=0; y < MgTileParameters::tileHeight; y++)    // rows
       for (int x=0; x < MgTileParameters::tileWidth; x++)    // columns innerloop
-     {
+     {  // this copies the 32bit pixels from the meta tile framebuffer to the subtile framebuffer
          *(subTileBuf   + x 
-                        + y * MgTileParameters::tileWidth)                 // target address in small tile
+                        + y * MgTileParameters::tileWidth)                 // target address in subtile
              = *(framebuf + (x + (subTileX * MgTileParameters::tileWidth))   // X address in meta tile
-                          + (y + (subTileY * MgTileParameters::tileHeight)) 
+                          + (y + (subTileY * MgTileParameters::tileHeight))  // Y address in meta tile
                              * MgTileParameters::tileWidth * sm_useMetaTiles);  // use width of metaTile here
-     }
-    // we need to pass the optional colortable param to satisfy the overloaded call
+    }
+    // then call the image renderer to convert the framebuffer bitmap into the desired image format
     return SaveBitmap(map, dr.get(), MgTileParameters::tileWidth,MgTileParameters::tileHeight,MgTileParameters::tileFormat, subTileBuf);
 }
 
@@ -1266,7 +1261,7 @@
             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 TODO: find a way to pass the pointer
+                 // copy the framebuffer into the reader, RenderTileFromMetatile is taking it from there
             } else
             {
                 //-------------------------------------------------------

Modified: sandbox/rfc90.2/MgDev/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- sandbox/rfc90.2/MgDev/Server/src/Services/Tile/ServerTileService.cpp	2011-10-07 08:36:18 UTC (rev 6168)
+++ sandbox/rfc90.2/MgDev/Server/src/Services/Tile/ServerTileService.cpp	2011-10-07 15:26:59 UTC (rev 6169)
@@ -18,8 +18,6 @@
 #include "MapGuideCommon.h"
 #include "ServerTileService.h"
 #include "ServerRenderingService.h"
-//#include <sstream>
-//#include <iostream>
 
 IMPLEMENT_CREATE_SERVICE(MgServerTileService)
 
@@ -370,8 +368,8 @@
    MG_TRY()
 
     // Generate tile and lock pathnames for later use
-    //m_tileCache->GeneratePathnames(mapDefinition, scaleIndex, baseMapLayerGroupName,
-    //    tileColumn, tileRow, tilePathname, lockPathname, false);
+    m_tileCache->GeneratePathnames(mapDefinition, scaleIndex, baseMapLayerGroupName,
+        tileColumn, tileRow, tilePathname, lockPathname, false);
 
     ////// compute additional names and control variables to deal with meta tiles:
     // a meta tile is sm_useMetaTiles^2 larger than the requested subtile so there are less tiles computed per map
@@ -387,7 +385,7 @@
     //// iterate subtiles and create all pathnames of the created tiles
     for (int y=0; y < maxY; y++)    // subtile rows
     for (int x=0; x < maxX; x++)    // subtile columns
-    {   // Generate tile and lock pathnames.
+    {   // Generate tile and lock pathnames (locknames are not used)
         subTileLockFile[x][y] = NULL;
         m_tileCache->GeneratePathnames(mapDefinition, scaleIndex, baseMapLayerGroupName,
             metaTileColumn + x, metaTileRow + y, subTilePathname[x][y], subTileLockPathname[x][y], false);

Modified: sandbox/rfc90.2/MgDev/build.bat
===================================================================
--- sandbox/rfc90.2/MgDev/build.bat	2011-10-07 08:36:18 UTC (rev 6168)
+++ sandbox/rfc90.2/MgDev/build.bat	2011-10-07 15:26:59 UTC (rev 6169)
@@ -186,6 +186,7 @@
 if "%2"=="oem" goto next_param
 if "%2"=="common" goto next_param
 if "%2"=="server" goto next_param
+if "%2"=="csmap" goto next_param
 if "%2"=="web" goto next_param
 if "%2"=="doc" goto next_param
 if "%2"=="all" goto next_param
@@ -291,11 +292,21 @@
 echo [build]: Building Oem
 %MSBUILD% %MG_OEM%\Oem.sln
 if "%errorlevel%"=="1" goto error
-rem CsMap is not in Oem.sln, so we need to build that separately
+if "%TYPECOMPONENT%"=="oem" 	goto quit
+if "%TYPECOMPONENT%"=="csmap" 	goto quit
+if "%TYPECOMPONENT%"=="common" 	goto quit
+if "%TYPECOMPONENT%"=="server" 	goto quit
+if "%TYPECOMPONENT%"=="web" 	goto quit
+if "%TYPECOMPONENT%"=="doc" 	goto quit
+
+:build_csmap
+REM CsMap is not in Oem.sln, so we need to build that separately
+echo [build]: Building CSMap
 echo [build]: Building Oem - CSMap
 %MSBUILD% %MG_OEM%\CsMap\VC90\OpenSource.sln
 if "%errorlevel%"=="1" goto error
 if "%TYPECOMPONENT%"=="oem" 	goto quit
+if "%TYPECOMPONENT%"=="csmap" 	goto quit
 if "%TYPECOMPONENT%"=="common" 	goto quit
 if "%TYPECOMPONENT%"=="server" 	goto quit
 if "%TYPECOMPONENT%"=="web" 	goto quit
@@ -306,6 +317,7 @@
 %MSBUILD% %MG_COMMON%\Common.sln
 if "%errorlevel%"=="1" goto error
 if "%TYPECOMPONENT%"=="oem" 	goto quit
+if "%TYPECOMPONENT%"=="csmap" 	goto quit
 if "%TYPECOMPONENT%"=="common" 	goto quit
 if "%TYPECOMPONENT%"=="server" 	goto quit
 if "%TYPECOMPONENT%"=="web" 	goto quit
@@ -316,6 +328,7 @@
 %MSBUILD% %MG_SERVER%\Server.sln
 if "%errorlevel%"=="1" goto error
 if "%TYPECOMPONENT%"=="oem" 	goto quit
+if "%TYPECOMPONENT%"=="csmap" 	goto quit
 if "%TYPECOMPONENT%"=="common" 	goto quit
 if "%TYPECOMPONENT%"=="server" 	goto quit
 if "%TYPECOMPONENT%"=="web" 	goto quit
@@ -326,6 +339,7 @@
 %MSBUILD% %MG_WEB_SRC%\WebTier.sln
 if "%errorlevel%"=="1" goto error
 if "%TYPECOMPONENT%"=="oem" 	 goto quit
+if "%TYPECOMPONENT%"=="csmap" 	goto quit
 if "%TYPECOMPONENT%"=="common" 	 goto quit
 if "%TYPECOMPONENT%"=="server" 	 goto quit
 if "%TYPECOMPONENT%"=="web" 	 goto quit
@@ -351,6 +365,7 @@
 if "%TYPECOMPONENT%"=="allnodoc" goto install_server
 if "%TYPECOMPONENT%"=="server" goto install_server
 if "%TYPECOMPONENT%"=="web" goto install_web
+if "%TYPECOMPONENT%"=="csmap" goto install_csmap
 if "%TYPECOMPONENT%"=="doc" goto install_doc
 SET ERRORMSG=Unrecognised component: %TYPECOMPONENT%
 goto custom_error
@@ -382,11 +397,18 @@
 copy /Y "%MG_OEM%\%MG_OEM_DBXML%\bin\*.exe" "%MG_OUTPUT_SERVER%\bin"
 echo [install]: Server - RepositoryAdmin
 %XCOPY% "%MG_SERVER%\RepositoryAdmin" "%MG_OUTPUT_SERVER%\RepositoryAdmin" /EXCLUDE:svn_excludes.txt+%TYPEBUILD%_excludes.txt
+
+if "%TYPECOMPONENT%"=="server" goto quit
+if "%TYPECOMPONENT%"=="web" goto quit
+
+:install_csmap
 echo [install]: CsMap Dictionaries
 %XCOPY% "%MG_OEM%\CsMap\Dictionaries" "%MG_OUTPUT_CSMAP%\Dictionaries" /EXCLUDE:svn_excludes.txt+csmap_excludes.txt+%TYPEBUILD%_excludes.txt
 if "%TYPECOMPONENT%"=="server" goto quit
+if "%TYPECOMPONENT%"=="csmap" goto quit
 if "%TYPECOMPONENT%"=="web" goto quit
 
+
 :install_web
 echo [install]: web Tier
 
@@ -472,9 +494,11 @@
 echo                                  install,
 echo                                  clean,
 echo Component:             -w[ith]=all(default),
+echo                                allnodoc,
 echo                                oem,
 echo                                common,
 echo                                server,
+echo                                csmap,
 echo                                web,
 echo                                doc
 echo ************************************************************************
@@ -501,3 +525,5 @@
 SET XCOPY=
 SET MSBUILD=
 SET PATH=%OLDPATH%
+date /t
+time /t
\ No newline at end of file



More information about the mapguide-commits mailing list