[mapguide-commits] r1267 - in trunk/MgDev: Common/MapGuideCommon/Services Common/MapGuideCommon/System Server/src/Core Server/src/Services/Tile Web/src/mapviewernet Web/src/mapviewerphp Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Mar 16 19:34:31 EDT 2007


Author: trevorwekel
Date: 2007-03-16 19:34:30 -0400 (Fri, 16 Mar 2007)
New Revision: 1267

Added:
   trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp
   trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.h
   trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp
   trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.h
Modified:
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.cpp
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.h
   trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.cpp
   trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.h
   trunk/MgDev/Common/MapGuideCommon/Services/TileService.h
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
   trunk/MgDev/Server/src/Core/serverconfig.ini
   trunk/MgDev/Server/src/Services/Tile/Makefile.am
   trunk/MgDev/Server/src/Services/Tile/ServerTileService.cpp
   trunk/MgDev/Server/src/Services/Tile/ServerTileService.h
   trunk/MgDev/Server/src/Services/Tile/ServerTileService.vcproj
   trunk/MgDev/Server/src/Services/Tile/ServerTileServiceBuild.cpp
   trunk/MgDev/Server/src/Services/Tile/TileCache.cpp
   trunk/MgDev/Server/src/Services/Tile/TileOperationFactory.cpp
   trunk/MgDev/Web/src/mapviewernet/mapframe.aspx
   trunk/MgDev/Web/src/mapviewerphp/mapframe.php
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
MapGuide RFC 13 - Configurable tile size

Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -212,6 +212,44 @@
 
 //////////////////////////////////////////////////////////////////
 /// \brief
+/// Returns the default width of a tile.
+INT32 MgProxyTileService::GetDefaultTileSizeX()
+{
+    MgCommand cmd;
+    cmd.ExecuteCommand(m_connProp,                                      // Connection
+                        MgCommand::knInt32,                             // Return type expected
+                        MgTileServiceOpId::GetDefaultTileSizeX,         // Command Code
+                        0,                                              // No of arguments
+                        Tile_Service,                                   // Service Id
+                        BUILD_VERSION(1,2,0),                           // Operation version
+                        MgCommand::knNone);                             // End of arguments
+
+    SetWarning(cmd.GetWarningObject());
+
+    return cmd.GetReturnValue().val.m_i32;
+}
+
+//////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the default height of a tile.
+INT32 MgProxyTileService::GetDefaultTileSizeY()
+{
+    MgCommand cmd;
+    cmd.ExecuteCommand(m_connProp,                                      // Connection
+                        MgCommand::knInt32,                             // Return type expected
+                        MgTileServiceOpId::GetDefaultTileSizeY,         // Command Code
+                        0,                                              // No of arguments
+                        Tile_Service,                                   // Service Id
+                        BUILD_VERSION(1,2,0),                           // Operation version
+                        MgCommand::knNone);                             // End of arguments
+
+    SetWarning(cmd.GetWarningObject());
+
+    return cmd.GetReturnValue().val.m_i32;
+}
+
+//////////////////////////////////////////////////////////////////
+/// \brief
 /// Sets the connection properties for the Proxy Service.  This
 /// information tells the proxy object where to connect.
 ///

Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.h	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyTileService.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -99,6 +99,24 @@
     ///
     virtual void ClearCache(MgMap* map);
 
+    //////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the default width of a tile.
+    ///
+    /// \return
+    /// Default width of a tile in pixels.
+    ///
+    virtual INT32 GetDefaultTileSizeX();
+
+    //////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the default height of a tile.
+    ///
+    /// \return
+    /// Default height of a tile in pixels.
+    ///
+    virtual INT32 GetDefaultTileSizeY();
+
 INTERNAL_API:
 
     /////////////////////////////////////////////////////////////////

Modified: trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -21,10 +21,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 /// Tile parameters.
 ///
-/// NOTE: Any changes to these values must be accounted for in the
-///       HTML/AJAX viewer.
+/// NOTE: Changes to tileDPI must be accounted for in the HTML/AJAX viewer.
+///       tileWidth and tileHeight are requested by the viewer during initialization.
+///       The AJAX viewer supports both JPG and PNG tiles.
 ///
-const INT32  MgTileParameters::tileWidth  = 300;                    // width for all tiles
-const INT32  MgTileParameters::tileHeight = 300;                    // height for all tiles
-const INT32  MgTileParameters::tileDPI    =  96;                    // assumed DPI for all tiles
-const STRING MgTileParameters::tileFormat = MgImageFormats::Png;    // image format for all tiles
+INT32  MgTileParameters::tileWidth  = 300;                    // width for all tiles
+INT32  MgTileParameters::tileHeight = 300;                    // height for all tiles
+const INT32  MgTileParameters::tileDPI    =  96;              // assumed DPI for all tiles
+STRING MgTileParameters::tileFormat = MgImageFormats::Png;    // image format for all tiles

Modified: trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.h	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/Services/TileDefs.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -30,6 +30,8 @@
     static const int GetTile    = 0x1111E801;
     static const int SetTile    = 0x1111E802;
     static const int ClearCache = 0x1111E803;
+    static const int GetDefaultTileSizeX  = 0x1111E804; 
+    static const int GetDefaultTileSizeY  = 0x1111E805;
 };
 /// \endcond
 
@@ -43,10 +45,10 @@
 class MG_MAPGUIDE_API MgTileParameters
 {
 INTERNAL_API:
-    static const INT32 tileWidth;       // width for all tiles
-    static const INT32 tileHeight;      // height for all tiles
+    static INT32 tileWidth;       // width for all tiles
+    static INT32 tileHeight;      // height for all tiles
     static const INT32 tileDPI;         // assumed DPI for all tiles
-    static const STRING tileFormat;     // image format for all tiles
+    static STRING tileFormat;     // image format for all tiles
 };
 /// \endcond
 

Modified: trunk/MgDev/Common/MapGuideCommon/Services/TileService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/TileService.h	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/Services/TileService.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -102,6 +102,24 @@
     ///
     virtual void ClearCache(MgMap* map) = 0;
 
+    //////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the default width of a tile.
+    ///
+    /// \return
+    /// Default width of a tile in pixels.
+    ///
+    virtual INT32 GetDefaultTileSizeX() = 0;
+
+    //////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns the default height of a tile.
+    ///
+    /// \return
+    /// Default height of a tile in pixels.
+    ///
+    virtual INT32 GetDefaultTileSizeY() = 0;
+
 INTERNAL_API:
 
     /////////////////////////////////////////////////////////////////

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -329,6 +329,12 @@
 const INT32  MgConfigProperties::DefaultTileServicePropertyPollingInterval                  = 1;
 const STRING MgConfigProperties::TileServicePropertyTiledMapCacheSize                       = L"TiledMapCacheSize"; // for internal use only
 const INT32  MgConfigProperties::DefaultTileServicePropertyTiledMapCacheSize                = 10;
+const STRING MgConfigProperties::TileServicePropertyTileSizeX                               = L"DefaultTileSizeX";
+const INT32 MgConfigProperties::DefaultTileServicePropertyTileSizeX                         = 300;
+const STRING MgConfigProperties::TileServicePropertyTileSizeY                               = L"DefaultTileSizeY";
+const INT32 MgConfigProperties::DefaultTileServicePropertyTileSizeY                         = 300;
+const STRING MgConfigProperties::TileServicePropertyImageFormat                             = L"ImageFormat";
+const STRING MgConfigProperties::DefaultTileServicePropertyImageFormat                      = L"PNG";
 
 // ******************************************************************
 // Access Log Properties
@@ -567,6 +573,9 @@
     { MgConfigProperties::TileServicePropertyCreationCutoffTime                     , MgPropertyType::Int32     , 1                                     , 600                                   , L""                                       },
     { MgConfigProperties::TileServicePropertyPollingInterval                        , MgPropertyType::Int32     , 1                                     , 60                                    , L""                                       },
     { MgConfigProperties::TileServicePropertyTiledMapCacheSize                      , MgPropertyType::Int32     , MG_CONFIG_MIN_CACHE_SIZE              , MG_CONFIG_MAX_CACHE_SIZE              , L""                                       },
+    { MgConfigProperties::TileServicePropertyTileSizeX                              , MgPropertyType::Int32     , 50                                    , 10000                                 , L""                                       },
+    { MgConfigProperties::TileServicePropertyTileSizeY                              , MgPropertyType::Int32     , 50                                    , 10000                                 , L""                                       },
+    { MgConfigProperties::TileServicePropertyImageFormat                            , MgPropertyType::String    , 2                                     , 4                                     , L""                                       },
     { L""                                                                           , 0                         , 0.0                                   , 0.0                                   , L""                                       }
 };
 

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -419,6 +419,14 @@
     // Sets the number of rows of tiles per folder
     static const STRING TileServicePropertyTileRowsPerFolder;          /// value("TileRowsPerFolder")
     static const INT32 DefaultTileServicePropertyTileRowsPerFolder;    /// value(30)
+
+    // Sets the image size and format (PNG/JPG) of the tiles
+    static const STRING TileServicePropertyTileSizeX;                   /// value("DefaultTileSizeX");
+    static const INT32 DefaultTileServicePropertyTileSizeX;             /// value(300);
+    static const STRING TileServicePropertyTileSizeY;                   /// value("DefaultTileSizeY");
+    static const INT32 DefaultTileServicePropertyTileSizeY;             /// value(300);
+    static const STRING TileServicePropertyImageFormat;                 /// value("ImageFormat")
+    static const STRING DefaultTileServicePropertyImageFormat;          /// value("PNG")
     
 INTERNAL_API:
 

Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini	2007-03-16 23:34:30 UTC (rev 1267)
@@ -349,11 +349,20 @@
 #                                       0 < Value <= 1000
 # TileRowsPerFolder                Number of rows of tiles per folder
 #                                       0 < Value <= 1000
+# DefaultTileSizeX                 Width of generated tiles in pixels
+#                                       50 < value <= 10000
+# DefaultTileSizeY                 Height of generated tiles in pixels
+#                                       50 < value <= 10000
+# ImageFormat                      Image format for generated tiles
+#                                       PNG or JPG
 # *****************************************************************************
 RenderOnly                         = 0
 TileCachePath                      = Repositories/TileCache/
 TileColumnsPerFolder               = 30
 TileRowsPerFolder                  = 30
+DefaultTileSizeX                   = 300
+DefaultTileSizeY                   = 300
+ImageFormat                        = PNG
 
 [AccessLogProperties]
 # *****************************************************************************
@@ -455,4 +464,4 @@
 # *****************************************************************************
 # U N M A N A G E D  D A T A  M A P P I N G S
 # This section is used to map a mapping name to an unmanaged data folder.
-# *****************************************************************************
\ No newline at end of file
+# *****************************************************************************

Modified: trunk/MgDev/Server/src/Services/Tile/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/Makefile.am	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/Makefile.am	2007-03-16 23:34:30 UTC (rev 1267)
@@ -23,6 +23,8 @@
 include_SOURCES = \
   OpClearCache.cpp \
   OpGetTile.cpp \
+  OpGetDefaultTileSizeX.cpp \
+  OpGetDefaultTileSizeY.cpp \
   OpSetTile.cpp \
   ServerTileService.cpp \
   TileCache.cpp \
@@ -33,6 +35,8 @@
 noinst_HEADERS = $(include_SOURCES) \
   OpClearCache.h \
   OpGetTile.h \
+  OpGetDefaultTileSizeX.h \
+  OpGetDefaultTileSizeY.h \
   OpSetTile.h \
   ServerTileDllExport.h \
   ServerTileService.h \

Added: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp	                        (rev 0)
+++ trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -0,0 +1,88 @@
+//
+//  Copyright (C) 2004-2007 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 "OpGetDefaultTileSizeX.h"
+#include "LogManager.h"
+
+
+MgOpGetDefaultTileSizeX::MgOpGetDefaultTileSizeX()
+{
+}
+
+
+MgOpGetDefaultTileSizeX::~MgOpGetDefaultTileSizeX()
+{
+}
+
+
+void MgOpGetDefaultTileSizeX::Execute()
+{
+    ACE_DEBUG((LM_DEBUG, ACE_TEXT("  (%t) MgOpGetDefaultTileSizeX::Execute()\n")));
+    
+
+
+    MG_LOG_OPERATION_MESSAGE(L"GetDefaultTileSizeX");
+
+    MG_TRY()
+
+    MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+    ACE_ASSERT(m_stream != NULL);
+
+    if (0 == m_packet.m_NumArguments)
+    {
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        INT32 size = m_service->GetDefaultTileSizeX();
+        
+        EndExecution(size);
+    }
+    else
+    {
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+    }
+
+    if (!m_argsRead)
+    {
+        throw new MgOperationProcessingException(L"MgOpGetDefaultTileSizeX.Execute",
+            __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgOpGetDefaultTileSizeX.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()
+}


Property changes on: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.h
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.h	                        (rev 0)
+++ trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -0,0 +1,35 @@
+//
+//  Copyright (C) 2004-2007 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_GET_DEFAULT_TILE_SIZE_X_H
+#define MG_OP_GET_DEFAULT_TILE_SIZE_X_H
+
+#include "TileOperation.h"
+
+class MgOpGetDefaultTileSizeX : public MgTileOperation
+{
+    public:
+        MgOpGetDefaultTileSizeX();
+        virtual ~MgOpGetDefaultTileSizeX();
+
+    public:
+        virtual void Execute();
+
+    private:
+};
+
+#endif


Property changes on: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeX.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp	                        (rev 0)
+++ trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -0,0 +1,88 @@
+//
+//  Copyright (C) 2004-2007 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 "OpGetDefaultTileSizeY.h"
+#include "LogManager.h"
+
+
+MgOpGetDefaultTileSizeY::MgOpGetDefaultTileSizeY()
+{
+}
+
+
+MgOpGetDefaultTileSizeY::~MgOpGetDefaultTileSizeY()
+{
+}
+
+
+void MgOpGetDefaultTileSizeY::Execute()
+{
+    ACE_DEBUG((LM_DEBUG, ACE_TEXT("  (%t) MgOpGetDefaultTileSizeY::Execute()\n")));
+    
+
+
+    MG_LOG_OPERATION_MESSAGE(L"GetDefaultTileSizeY");
+
+    MG_TRY()
+
+    MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+    ACE_ASSERT(m_stream != NULL);
+
+    if (0 == m_packet.m_NumArguments)
+    {
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        INT32 size = m_service->GetDefaultTileSizeY();
+        
+        EndExecution(size);
+    }
+    else
+    {
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+    }
+
+    if (!m_argsRead)
+    {
+        throw new MgOperationProcessingException(L"MgOpGetDefaultTileSizeY.Execute",
+            __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgOpGetDefaultTileSizeY.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()
+}


Property changes on: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.h
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.h	                        (rev 0)
+++ trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -0,0 +1,35 @@
+//
+//  Copyright (C) 2004-2007 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_GET_DEFAULT_TILE_SIZE_Y_H
+#define MG_OP_GET_DEFAULT_TILE_SIZE_Y_H
+
+#include "TileOperation.h"
+
+class MgOpGetDefaultTileSizeY : public MgTileOperation
+{
+    public:
+        MgOpGetDefaultTileSizeY();
+        virtual ~MgOpGetDefaultTileSizeY();
+
+    public:
+        virtual void Execute();
+
+    private:
+};
+
+#endif


Property changes on: trunk/MgDev/Server/src/Services/Tile/OpGetDefaultTileSizeY.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/MgDev/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/ServerTileService.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/ServerTileService.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -581,3 +581,13 @@
         }
     }
 }
+
+INT32 MgServerTileService::GetDefaultTileSizeX()
+{
+    return MgTileParameters::tileWidth;
+}
+
+INT32 MgServerTileService::GetDefaultTileSizeY()
+{
+    return MgTileParameters::tileHeight;
+}

Modified: trunk/MgDev/Server/src/Services/Tile/ServerTileService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/ServerTileService.h	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/ServerTileService.h	2007-03-16 23:34:30 UTC (rev 1267)
@@ -50,6 +50,10 @@
 
     virtual void ClearCache(MgMap* map);
 
+    virtual INT32 GetDefaultTileSizeX();
+
+    virtual INT32 GetDefaultTileSizeY();
+
     virtual void NotifyResourcesChanged(MgSerializableCollection* resources);
 
     void SetConnectionProperties(MgConnectionProperties* connProp);

Modified: trunk/MgDev/Server/src/Services/Tile/ServerTileService.vcproj
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/ServerTileService.vcproj	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/ServerTileService.vcproj	2007-03-16 23:34:30 UTC (rev 1267)
@@ -213,6 +213,54 @@
 				>
 			</File>
 			<File
+				RelativePath=".\OpGetDefaultTileSizeX.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\OpGetDefaultTileSizeX.h"
+				>
+			</File>
+			<File
+				RelativePath=".\OpGetDefaultTileSizeY.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\OpGetDefaultTileSizeY.h"
+				>
+			</File>
+			<File
 				RelativePath=".\OpGetTile.cpp"
 				>
 				<FileConfiguration

Modified: trunk/MgDev/Server/src/Services/Tile/ServerTileServiceBuild.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/ServerTileServiceBuild.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/ServerTileServiceBuild.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -21,6 +21,8 @@
 #include "OpClearCache.cpp"
 #include "OpGetTile.cpp"
 #include "OpSetTile.cpp"
+#include "OpGetDefaultTileSizeX.cpp"
+#include "OpGetDefaultTileSizeY.cpp"
 #include "TileCache.cpp"
 #include "TileOperation.cpp"
 #include "TileOperationFactory.cpp"

Modified: trunk/MgDev/Server/src/Services/Tile/TileCache.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/TileCache.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/TileCache.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -66,6 +66,32 @@
             MgConfigProperties::TileServicePropertyTileRowsPerFolder,
             sm_tileRowsPerFolder,
             MgConfigProperties::DefaultTileServicePropertyTileRowsPerFolder);
+
+        configuration->GetIntValue(MgConfigProperties::TileServicePropertiesSection,
+            MgConfigProperties::TileServicePropertyTileSizeX,
+            MgTileParameters::tileWidth,
+            MgConfigProperties::DefaultTileServicePropertyTileSizeX);
+
+        configuration->GetIntValue(MgConfigProperties::TileServicePropertiesSection,
+            MgConfigProperties::TileServicePropertyTileSizeY,
+            MgTileParameters::tileHeight,
+            MgConfigProperties::DefaultTileServicePropertyTileSizeY);
+
+        STRING format;
+        configuration->GetStringValue(MgConfigProperties::TileServicePropertiesSection,
+            MgConfigProperties::TileServicePropertyImageFormat,
+            format,
+            MgConfigProperties::DefaultTileServicePropertyImageFormat);
+
+        // Only allow PNG and JPG as tile formats
+        if (format == MgImageFormats::Png || format == MgImageFormats::Jpeg)
+        {
+            MgTileParameters::tileFormat = format;
+        }
+        else
+        {
+            MgTileParameters::tileFormat = MgImageFormats::Png;
+        }
     }
 }
 
@@ -90,11 +116,19 @@
     }
 
     // Generate the tile and lock pathnames
-    //     <tilePathname> = <fullPath>/<row>_<column>.png
+    //     <tilePathname> = <fullPath>/<row>_<column>.png/jpg
     //     <lockPathname> = <fullPath>/<row>_<column>.lck
     tilePathname += fileName;
     lockPathname = tilePathname;
-    tilePathname += L"png";
+    if (MgTileParameters::tileFormat == MgImageFormats::Jpeg) 
+    {
+        tilePathname += L"jpg";
+    }
+    else
+    {
+        tilePathname += L"png";
+    }
+
     lockPathname += L"lck";
 }
 
@@ -120,7 +154,15 @@
     {
         Ptr<MgByteSource> byteSource = new MgByteSource(tilePathname, false);
 
-        byteSource->SetMimeType(MgMimeType::Png);
+        if (MgTileParameters::tileFormat == MgImageFormats::Jpeg)
+        {
+            byteSource->SetMimeType(MgMimeType::Jpeg);
+        }
+        else
+        {
+            byteSource->SetMimeType(MgMimeType::Png);
+        }
+
         ret = byteSource->GetReader();
     }
 

Modified: trunk/MgDev/Server/src/Services/Tile/TileOperationFactory.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Tile/TileOperationFactory.cpp	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Server/src/Services/Tile/TileOperationFactory.cpp	2007-03-16 23:34:30 UTC (rev 1267)
@@ -98,6 +98,30 @@
         }
         break;
 
+    case MgTileServiceOpId::GetDefaultTileSizeX:
+        switch (VERSION_NO_PHASE(operationVersion))
+        {
+        case VERSION_SUPPORTED(1,2):
+            handler.reset(new MgOpGetDefaultTileSizeX());
+            break;
+        default:
+            throw new MgInvalidOperationVersionException(
+                L"MgTileOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+        }
+        break;
+
+    case MgTileServiceOpId::GetDefaultTileSizeY:
+        switch (VERSION_NO_PHASE(operationVersion))
+        {
+        case VERSION_SUPPORTED(1,2):
+            handler.reset(new MgOpGetDefaultTileSizeY());
+            break;
+        default:
+            throw new MgInvalidOperationVersionException(
+                L"MgTileOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);
+        }
+        break;
+
     default:
         throw new MgInvalidOperationException(
             L"MgTileOperationFactory.GetOperation", __LINE__, __WFILE__, NULL, L"", NULL);

Modified: trunk/MgDev/Web/src/mapviewernet/mapframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/mapframe.aspx	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Web/src/mapviewernet/mapframe.aspx	2007-03-16 23:34:30 UTC (rev 1267)
@@ -89,6 +89,11 @@
             MgUserInformation userInfo = new MgUserInformation(sessionId);
             MgSiteConnection site = new MgSiteConnection();
             site.Open(userInfo);
+
+            MgTileService tileSrvc = (MgTileService)site.CreateService(MgServiceType::TileService);
+            int tileSizeX = tileSrvc.GetDefaultTileSizeX();
+            int tileSizeY = tileSrvc.GetDefaultTileSizeY();
+
             MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
 
             MgMap map = new MgMap();
@@ -151,6 +156,8 @@
             String templ = MgLocalizer.Localize(LoadTemplate(Request, "../viewerfiles/ajaxmappane.templ"), locale, GetClientOS(Request));
             String vpath = GetSurroundVirtualPath(Request);
             String[] vals = { GetRootVirtualFolder(Request) + "/mapagent/mapagent.fcgi",
+                        tileSizeX,
+                        tileSizeY,
                         mapName,
                         mapDefinition,
                         IntToString(infoWidth),

Modified: trunk/MgDev/Web/src/mapviewerphp/mapframe.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/mapframe.php	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Web/src/mapviewerphp/mapframe.php	2007-03-16 23:34:30 UTC (rev 1267)
@@ -70,6 +70,12 @@
         $userInfo->SetMgSessionId($sessionId);
         $site = new MgSiteConnection();
         $site->Open($userInfo);
+
+        $tileSrvc = $site->CreateService(MgServiceType::TileService);
+
+        $tileSizeX = $tileSrvc->GetDefaultTileSizeX();
+        $tileSizeY = $tileSrvc->GetDefaultTileSizeY();
+
         $resourceSrvc = $site->CreateService(MgServiceType::ResourceService);
 
         $map = new MgMap();
@@ -119,6 +125,8 @@
         $templ = Localize(file_get_contents("../viewerfiles/ajaxmappane.templ"), $locale, GetClientOS());
         $vpath = GetSurroundVirtualPath();
         printf ($templ,
+                    $tileSizeX,
+                    $tileSizeY,
                     GetRootVirtualFolder() . "/mapagent/mapagent.fcgi",
                     $mapName,
                     $mapDefinition,

Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2007-03-16 22:27:30 UTC (rev 1266)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2007-03-16 23:34:30 UTC (rev 1267)
@@ -246,7 +246,7 @@
 
 var NONE=0, RESIZING=1, RESIZINGLEGEND=2, DRAGGING=3, PANNING=4, DRAGGINGCTRL=5;
 var RECT=1, CIRCLE=2, POLY=3, SLIDER=4, SCALE=6;
-var TILECX = 300, TILECY = 300;
+var TILECX = %s, TILECY = %s;
 var GRIDCX = 15; GRIDCY = 15, DPI = 96;
 var moveType = NONE, dragElt = 0, digitizer;
 var intId;
@@ -3075,7 +3075,7 @@
             return 0;
         cell.loaded = "1";
         url = webAgent + "?OPERATION=GETTILEIMAGE&VERSION=1.2.0&SESSION=" + sessionId + "&MAPDEFINITION=" + encodeComponent(mapDefinitionName) + "&BASEMAPLAYERGROUPNAME=" + encodeComponent(baseGroups[k]) + "&TILECOL=" + tilex + "&TILEROW=" + tiley + "&SCALEINDEX=" + sci;
-        tag = '<img id="' + (imgId) + '" width=' + TILECX + ' height=' + TILECY + ' border=0 vspace=0 hspace=0 src="' + url + '" style="visibility: hidden; width: 300px; height: 300px;" onload="OnTileLoaded(\'' + imgId + '\')">';
+        tag = '<img id="' + (imgId) + '" width=' + TILECX + ' height=' + TILECY + ' border=0 vspace=0 hspace=0 src="' + url + '" style="visibility: hidden; width: ' + TILECX + 'px; height: ' + TILECY + 'px;" onload="OnTileLoaded(\'' + imgId + '\')">';
         imgId ++;
         cell.innerHTML = tag;
     }



More information about the mapguide-commits mailing list