[mapguide-commits] r6111 - in trunk/MgDev:
Common/MapGuideCommon/Services Common/MdfModel
Common/MdfParser Common/Schema Server
Server/src/Services/Mapping Server/src/Services/Profiling
Server/src/Services/Rendering
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Sep 2 01:43:13 EDT 2011
Author: liuar
Date: 2011-09-01 22:43:13 -0700 (Thu, 01 Sep 2011)
New Revision: 6111
Added:
trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.cpp
trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.h
Modified:
trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h
trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h
trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.h
trunk/MgDev/Common/MdfModel/Makefile.am
trunk/MgDev/Common/MdfModel/MdfModel.vcproj
trunk/MgDev/Common/MdfModel/MdfModel.vcxproj
trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters
trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.cpp
trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.h
trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.cpp
trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.h
trunk/MgDev/Common/MdfParser/IOProfileRenderSelectionResult.cpp
trunk/MgDev/Common/MdfParser/SAX2Parser.cpp
trunk/MgDev/Common/MdfParser/SAX2Parser.h
trunk/MgDev/Common/Schema/ProfileResult-2.4.0.xsd
trunk/MgDev/Server/Server.sln
trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
trunk/MgDev/Server/src/Services/Mapping/MappingUtil.h
trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp
trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.vcxproj
trunk/MgDev/Server/src/Services/Rendering/OpRenderDynamicOverlay.cpp
trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
Log:
The RFC 110 Profiling Service (VI).
Implement the ProfileRenderDynamicOverlay API in Server.
1. Add a new internal used API for RenderingService to accept the profile result parameter
2. Add an abstract class ProfileRenderLayersResultBase as base class of ProfileRenderLayersResult and ProfileRenderSelectionResult
3. Inject profile code into ServerRenderingService and MappingUtil.
4. Enhance the SAX2Parser to serialize profile result.
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -815,3 +815,51 @@
{
m_connProp = SAFE_ADDREF(connProp);
}
+
+/////////////////////////////////////////////////////////////////
+/// \brief
+/// Renders all dynamic layers in the specified MgMap to a dynamic overlay image
+/// with a transparent background. The center, scale, size, and layers to be
+/// rendered are defined by the specified map instance. The format parameter
+/// must be set to an image format that supports transparency. Profile result will
+/// be recorded.
+///
+/// \param map
+/// Input
+/// map object containing current state of map.
+/// \param selection
+/// Input
+/// map feature selection. Specifies the selected features on the map
+/// \param options
+/// Input
+/// rendering options
+/// \param profileRenderMapResult
+/// Input&Output
+/// profile result of rendering dynamic overlay
+///
+/// \return
+/// A byte reader containing the rendered image
+///
+MgByteReader* MgProxyRenderingService::RenderDynamicOverlay(
+ MgMap* map,
+ MgSelection* selection,
+ MgRenderingOptions* options,
+ ProfileRenderMapResult* profileRenderMapResult)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knObject, // Return type expected
+ MgRenderingServiceOpId::RenderDynamicOverlay, // Command Code
+ 4, // No of arguments
+ Rendering_Service, // Service Id
+ BUILD_VERSION(2,1,0), // Operation version
+ MgCommand::knObject, map, // Argument#1
+ MgCommand::knObject, selection, // Argument#2
+ MgCommand::knObject, options, // Argument#3
+ MgCommand::knObject, profileRenderMapResult, // Argument#4
+ MgCommand::knNone); // End of arguments
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
+}
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyRenderingService.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -588,6 +588,36 @@
///
void SetConnectionProperties(MgConnectionProperties* connProp);
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Renders all dynamic layers in the specified MgMap to a dynamic overlay image
+ /// with a transparent background. The center, scale, size, and layers to be
+ /// rendered are defined by the specified map instance. The format parameter
+ /// must be set to an image format that supports transparency. Profile result will
+ /// be recorded.
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param selection
+ /// Input
+ /// map feature selection. Specifies the selected features on the map
+ /// \param options
+ /// Input
+ /// rendering options
+ /// \param profileRenderMapResult
+ /// Input&Output
+ /// profile result of rendering dynamic overlay
+ ///
+ /// \return
+ /// A byte reader containing the rendered image
+ ///
+ virtual MgByteReader* RenderDynamicOverlay(
+ MgMap* map,
+ MgSelection* selection,
+ MgRenderingOptions* options,
+ ProfileRenderMapResult* profileRenderMapResult);
+
protected:
//////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MapGuideCommon/Services/RenderingService.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -26,6 +26,11 @@
class MgMap;
class MgRenderingOptions;
+namespace MdfModel
+{
+ class ProfileRenderMapResult;
+}
+
/// \brief
/// This class provides services to render a map into an image
class MG_MAPGUIDE_API MgRenderingService : public MgService
@@ -582,6 +587,36 @@
///
MgRenderingService();
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Renders all dynamic layers in the specified MgMap to a dynamic overlay image
+ /// with a transparent background. The center, scale, size, and layers to be
+ /// rendered are defined by the specified map instance. The format parameter
+ /// must be set to an image format that supports transparency. Profile result will
+ /// be recorded.
+ ///
+ /// \param map
+ /// Input
+ /// map object containing current state of map.
+ /// \param selection
+ /// Input
+ /// map feature selection. Specifies the selected features on the map
+ /// \param options
+ /// Input
+ /// rendering options
+ /// \param profileRenderMapResult
+ /// Input&Output
+ /// profile result of rendering dynamic overlay
+ ///
+ /// \return
+ /// A byte reader containing the rendered image
+ ///
+ virtual MgByteReader* RenderDynamicOverlay(
+ MgMap* map,
+ MgSelection* selection,
+ MgRenderingOptions* options,
+ ProfileRenderMapResult* profileRenderMapResult) = 0;
+
protected:
/////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -42,7 +42,8 @@
{ MgServiceType::KmlService , L"KmlService" , MgServiceFlag::KmlService },
{ MgServiceType::ServerAdminService, L"ServerAdminService", MgServiceFlag::ServerAdminService },
{ MgServiceType::SiteService , L"SiteService" , MgServiceFlag::SiteService },
- { MgServiceType::ProfilingService , L"ProfilingService" , MgServiceFlag::ProfilingService },
+ { MgServiceType::PrintLayoutService, L"PrintLayoutService", MgServiceFlag::PrintLayoutService },
+ { MgServiceType::ProfilingService , L"ProfilingService" , MgServiceFlag::ProfilingService }
};
//////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ServerInformation.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -69,8 +69,12 @@
static const INT32 SiteService = 0x00000100;
////////////////////////////////////////////////////////////////
+ /// PrintLayout Service
+ static const INT32 PrintLayoutService = 0x00000102;
+
+ ////////////////////////////////////////////////////////////////
/// Profiling Service
- static const INT32 ProfilingService = 0x00000200;
+ static const INT32 ProfilingService = 0x00000104;
};
/// \cond INTERNAL
@@ -401,7 +405,7 @@
/// NOTES: The numeric values of all the service types are also used by
/// sequential containers for fast indexed-based lookups.
- static const INT32 sm_knMaxNumberServices = 10;
+ static const INT32 sm_knMaxNumberServices = 11;
private:
Modified: trunk/MgDev/Common/MdfModel/Makefile.am
===================================================================
--- trunk/MgDev/Common/MdfModel/Makefile.am 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/Makefile.am 2011-09-02 05:43:13 UTC (rev 6111)
@@ -80,6 +80,7 @@
ProfileRenderLabelsResult.cpp \
ProfileRenderLayerResult.cpp \
ProfileRenderLayersResult.cpp \
+ ProfileRenderLayersResultBase.cpp \
ProfileRenderMapResult.cpp \
ProfileRenderSelectionResult.cpp \
ProfileRenderWatermarkResult.cpp \
@@ -199,6 +200,7 @@
ProfileRenderLabelsResult.h \
ProfileRenderLayerResult.h \
ProfileRenderLayersResult.h \
+ ProfileRenderLayersResultBase.h \
ProfileRenderMapResult.h \
ProfileRenderSelectionResult.h \
ProfileRenderWatermarkResult.h \
Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcproj
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcproj 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcproj 2011-09-02 05:43:13 UTC (rev 6111)
@@ -1209,6 +1209,14 @@
>
</File>
<File
+ RelativePath=".\ProfileRenderLayersResultBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ProfileRenderLayersResultBase.h"
+ >
+ </File>
+ <File
RelativePath=".\ProfileRenderMapResult.cpp"
>
</File>
Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcxproj
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcxproj 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcxproj 2011-09-02 05:43:13 UTC (rev 6111)
@@ -203,6 +203,7 @@
<ClCompile Include="ProfileRenderLabelsResult.cpp" />
<ClCompile Include="ProfileRenderLayerResult.cpp" />
<ClCompile Include="ProfileRenderLayersResult.cpp" />
+ <ClCompile Include="ProfileRenderLayersResultBase.cpp" />
<ClCompile Include="ProfileRenderMapResult.cpp" />
<ClCompile Include="ProfileRenderSelectionResult.cpp" />
<ClCompile Include="ProfileRenderWatermarkResult.cpp" />
@@ -316,6 +317,7 @@
<ClInclude Include="PointUsage.h" />
<ClInclude Include="ProfileRenderLayerResult.h" />
<ClInclude Include="ProfileRenderLayersResult.h" />
+ <ClInclude Include="ProfileRenderLayersResultBase.h" />
<ClInclude Include="ProfileRenderMapResult.h" />
<ClInclude Include="ProfileRenderLabelsResult.h" />
<ClInclude Include="ProfileRenderSelectionResult.h" />
Modified: trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters
===================================================================
--- trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/MdfModel.vcxproj.filters 2011-09-02 05:43:13 UTC (rev 6111)
@@ -120,8 +120,8 @@
<ClCompile Include="VectorScaleRange.cpp">
<Filter>VectorLayer</Filter>
</ClCompile>
- <ClCompile Include="URLData.cpp">
- <Filter>VectorLayer</Filter>
+ <ClCompile Include="URLData.cpp">
+ <Filter>VectorLayer</Filter>
</ClCompile>
<ClCompile Include="AttributeRelate.cpp">
<Filter>VectorLayer\Joins</Filter>
@@ -334,15 +334,9 @@
<ClCompile Include="ProfileRenderLayerResult.cpp">
<Filter>ProfileResult</Filter>
</ClCompile>
- <ClCompile Include="ProfileRenderLayersResult.cpp">
- <Filter>ProfileResult</Filter>
- </ClCompile>
<ClCompile Include="ProfileRenderMapResult.cpp">
<Filter>ProfileResult</Filter>
</ClCompile>
- <ClCompile Include="ProfileRenderSelectionResult.cpp">
- <Filter>ProfileResult</Filter>
- </ClCompile>
<ClCompile Include="ProfileRenderWatermarkResult.cpp">
<Filter>ProfileResult</Filter>
</ClCompile>
@@ -352,6 +346,15 @@
<ClCompile Include="ProfileResult.cpp">
<Filter>ProfileResult</Filter>
</ClCompile>
+ <ClCompile Include="ProfileRenderLayersResultBase.cpp">
+ <Filter>ProfileResult</Filter>
+ </ClCompile>
+ <ClCompile Include="ProfileRenderLayersResult.cpp">
+ <Filter>ProfileResult</Filter>
+ </ClCompile>
+ <ClCompile Include="ProfileRenderSelectionResult.cpp">
+ <Filter>ProfileResult</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AreaUsage.h">
@@ -432,8 +435,8 @@
<ClInclude Include="VectorScaleRange.h">
<Filter>VectorLayer</Filter>
</ClInclude>
- <ClInclude Include="URLData.h">
- <Filter>VectorLayer</Filter>
+ <ClInclude Include="URLData.h">
+ <Filter>VectorLayer</Filter>
</ClInclude>
<ClInclude Include="AttributeRelate.h">
<Filter>VectorLayer\Joins</Filter>
@@ -680,6 +683,9 @@
<ClInclude Include="ProfileRenderLabelsResult.h">
<Filter>ProfileResult</Filter>
</ClInclude>
+ <ClInclude Include="ProfileRenderLayersResultBase.h">
+ <Filter>ProfileResult</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MdfModel.rc" />
Modified: trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -30,8 +30,6 @@
//-------------------------------------------------------------------------
ProfileRenderLayersResult::ProfileRenderLayersResult()
{
- this->m_dRenderTime = 0.0;
-
}
//-------------------------------------------------------------------------
@@ -42,35 +40,6 @@
}
//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the RenderTime property.
-// RETURNS: The time of stylizing all layers in the map.
-//-------------------------------------------------------------------------
-const double ProfileRenderLayersResult::GetRenderTime() const
-{
- return this->m_dRenderTime;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method to the RenderTime property.
-// PARAMETERS:
-// Input:
-// dRenderTime - The time of stylizing all layers in the map.
-//-------------------------------------------------------------------------
-void ProfileRenderLayersResult::SetRenderTime(const double& dRenderTime)
-{
- this->m_dRenderTime = dRenderTime;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the ProfileRenderLayerResults property.
-// RETURNS: A collection of ProfileRenderLayerResult.
-//-------------------------------------------------------------------------
-ProfileRenderLayerResultCollection* ProfileRenderLayersResult::GetProfileRenderLayerResults()
-{
- return &this->m_profileRenderLayerResults;
-}
-
-//-------------------------------------------------------------------------
// PURPOSE: For memory leak testing.
//-------------------------------------------------------------------------
#ifdef _WIN32
Modified: trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.h
===================================================================
--- trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/ProfileRenderLayersResult.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -20,7 +20,7 @@
#include "MdfModel.h"
#include "MdfRootObject.h"
-#include "ProfileRenderLayerResult.h"
+#include "ProfileRenderLayersResultBase.h"
BEGIN_NAMESPACE_MDFMODEL
@@ -30,7 +30,7 @@
// The ProfileRenderLayersResult is a profiling result which records
// information during layer rendering processes.
//------------------------------------------------------------------------
- class MDFMODEL_API ProfileRenderLayersResult : public MdfRootObject
+ class MDFMODEL_API ProfileRenderLayersResult : public ProfileRenderLayersResultBase
{
public:
// Construction, destruction, initialization.
@@ -39,15 +39,6 @@
// Operations
- // Property: RenderTime
- // The time of stylizing all layers in the map.
- const double GetRenderTime() const;
- void SetRenderTime(const double& dRenderTime);
-
- // Property: ProfileRenderLayerResults
- // A collection of ProfileRenderLayerResult.
- ProfileRenderLayerResultCollection* GetProfileRenderLayerResults();
-
//#ifdef _WIN32
#if _DEBUG
// for memory leak testing
@@ -61,9 +52,6 @@
ProfileRenderLayersResult& operator=(const ProfileRenderLayersResult&);
// Data members
- // See corresponding properties for descriptions
- double m_dRenderTime;
- ProfileRenderLayerResultCollection m_profileRenderLayerResults;
};
END_NAMESPACE_MDFMODEL
Added: trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.cpp (rev 0)
+++ trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -0,0 +1,83 @@
+//
+// Copyright (C) 2011 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
+//
+
+//-------------------------------------------------------------------------
+// DESCRIPTION:
+// The ProfileRenderLayersResultBase class implementation.
+//-------------------------------------------------------------------------
+
+#include "stdafx.h"
+#include "ProfileRenderLayersResultBase.h"
+
+using namespace MDFMODEL_NAMESPACE;
+
+//-------------------------------------------------------------------------
+// PURPOSE: Construct and initialize an instance of the ProfileRenderLayersResultBase class.
+//-------------------------------------------------------------------------
+ProfileRenderLayersResultBase::ProfileRenderLayersResultBase()
+{
+ this->m_dRenderTime = 0.0;
+
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Destructor. Release any dynamically allocated resources.
+//-------------------------------------------------------------------------
+ProfileRenderLayersResultBase::~ProfileRenderLayersResultBase()
+{
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the RenderTime property.
+// RETURNS: The time of stylizing all layers.
+//-------------------------------------------------------------------------
+const double ProfileRenderLayersResultBase::GetRenderTime() const
+{
+ return this->m_dRenderTime;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method to the RenderTime property.
+// PARAMETERS:
+// Input:
+// dRenderTime - The time of stylizing all layers.
+//-------------------------------------------------------------------------
+void ProfileRenderLayersResultBase::SetRenderTime(const double& dRenderTime)
+{
+ this->m_dRenderTime = dRenderTime;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: Accessor method for the ProfileRenderLayerResults property.
+// RETURNS: A collection of ProfileRenderLayerResult.
+//-------------------------------------------------------------------------
+ProfileRenderLayerResultCollection* ProfileRenderLayersResultBase::GetProfileRenderLayerResults()
+{
+ return &this->m_profileRenderLayerResults;
+}
+
+//-------------------------------------------------------------------------
+// PURPOSE: For memory leak testing.
+//-------------------------------------------------------------------------
+#ifdef _WIN32
+#ifdef _DEBUG
+int ProfileRenderLayersResultBase::DumpMemoryLeaks()
+{
+ return _CrtDumpMemoryLeaks();
+}
+#endif
+#endif
Added: trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.h
===================================================================
--- trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.h (rev 0)
+++ trunk/MgDev/Common/MdfModel/ProfileRenderLayersResultBase.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -0,0 +1,70 @@
+//
+// Copyright (C) 2011 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 PROFILERENDERLAYERSRESULTBASE_H_
+#define PROFILERENDERLAYERSRESULTBASE_H_
+
+#include "MdfModel.h"
+#include "MdfRootObject.h"
+#include "ProfileRenderLayerResult.h"
+
+
+BEGIN_NAMESPACE_MDFMODEL
+
+ //-------------------------------------------------------------------------
+ // DESCRIPTION:
+ // The ProfileRenderLayersResultBase is a base class which records
+ // information during layer rendering processes.
+ //------------------------------------------------------------------------
+ class MDFMODEL_API ProfileRenderLayersResultBase : public MdfRootObject
+ {
+ public:
+ // Construction, destruction, initialization.
+ ProfileRenderLayersResultBase();
+ virtual ~ProfileRenderLayersResultBase();
+
+ // Operations
+
+ // Property: RenderTime
+ // The time of stylizing all layers.
+ virtual const double GetRenderTime() const;
+ virtual void SetRenderTime(const double& dRenderTime);
+
+ // Property: ProfileRenderLayerResults
+ // A collection of ProfileRenderLayerResult.
+ virtual ProfileRenderLayerResultCollection* GetProfileRenderLayerResults();
+
+//#ifdef _WIN32
+#if _DEBUG
+ // for memory leak testing
+ static int DumpMemoryLeaks();
+#endif
+//#endif
+
+ private:
+ // Hidden ProfileRenderLayersResult copy constructor and assignment operator.
+ ProfileRenderLayersResultBase(const ProfileRenderLayersResultBase&);
+ ProfileRenderLayersResultBase& operator=(const ProfileRenderLayersResultBase&);
+
+ // Data members
+ // See corresponding properties for descriptions
+ double m_dRenderTime;
+ ProfileRenderLayerResultCollection m_profileRenderLayerResults;
+ };
+
+END_NAMESPACE_MDFMODEL
+#endif // PROFILERENDERLAYERSRESULTBASE_H_
Modified: trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.cpp
===================================================================
--- trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -40,50 +40,13 @@
}
//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the RenderTime property.
-// RETURNS: The time of stylizing all selected layers in the map.
+// PURPOSE: For memory leak testing.
//-------------------------------------------------------------------------
-const double ProfileRenderSelectionResult::GetRenderTime() const
+#ifdef _WIN32
+#ifdef _DEBUG
+int ProfileRenderSelectionResult::DumpMemoryLeaks()
{
- return this->m_dRenderTime;
+ return _CrtDumpMemoryLeaks();
}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method to the RenderTime property.
-// PARAMETERS:
-// Input:
-// dRenderTime - The time of stylizing all selected layers in the map.
-//-------------------------------------------------------------------------
-void ProfileRenderSelectionResult::SetRenderTime(const double& dRenderTime)
-{
- this->m_dRenderTime = dRenderTime;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the Filter property.
-// RETURNS: A boolean FDO expression that specifies which features to return.
-//-------------------------------------------------------------------------
-const MdfString& ProfileRenderSelectionResult::GetFilter() const
-{
- return this->m_strFilter;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method to the Filter property.
-// PARAMETERS:
-// Input:
-// pstrFilter - A boolean FDO expression that specifies which features to return.
-//-------------------------------------------------------------------------
-void ProfileRenderSelectionResult::SetFilter(const MdfString& pstrFilter)
-{
- this->m_strFilter = pstrFilter;
-}
-
-//-------------------------------------------------------------------------
-// PURPOSE: Accessor method for the ProfileRenderLayerResults property.
-// RETURNS: A collection of ProfileRenderLayerResult.
-//-------------------------------------------------------------------------
-ProfileRenderLayerResultCollection* ProfileRenderSelectionResult::GetProfileRenderSelectedLayerResults()
-{
- return &this->m_profileRenderSelectedLayerResults;
-}
+#endif
+#endif
\ No newline at end of file
Modified: trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.h
===================================================================
--- trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfModel/ProfileRenderSelectionResult.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -20,7 +20,7 @@
#include "MdfModel.h"
#include "MdfRootObject.h"
-#include "ProfileRenderLayersResult.h"
+#include "ProfileRenderLayersResultBase.h"
BEGIN_NAMESPACE_MDFMODEL
@@ -30,7 +30,7 @@
// The ProfileRenderSelectionResult is a profiling result which records
// information during selected layer rendering processes.
//------------------------------------------------------------------------
- class MDFMODEL_API ProfileRenderSelectionResult : public MdfRootObject
+ class MDFMODEL_API ProfileRenderSelectionResult : public ProfileRenderLayersResultBase
{
public:
// Construction, destruction, initialization.
@@ -39,20 +39,6 @@
// Operations
- // Property: RenderTime
- // The time of stylizing all selected layers in the map.
- const double GetRenderTime() const;
- void SetRenderTime(const double& dRenderTime);
-
- // Property: Filter
- // A boolean FDO expression that specifies which features to return. No filter means pass all features through.
- const MdfString& GetFilter() const;
- void SetFilter(const MdfString& pstrFilter);
-
- // Property: ProfileRenderSelectedLayerResults
- // A collection of ProfileRenderSelectedLayerResult.
- ProfileRenderLayerResultCollection* GetProfileRenderSelectedLayerResults();
-
//#ifdef _WIN32
#if _DEBUG
// for memory leak testing
@@ -66,10 +52,6 @@
ProfileRenderSelectionResult& operator=(const ProfileRenderSelectionResult&);
// Data members
- // See corresponding properties for descriptions
- double m_dRenderTime;
- MdfString m_strFilter;
- ProfileRenderLayerResultCollection m_profileRenderSelectedLayerResults;
};
END_NAMESPACE_MDFMODEL
Modified: trunk/MgDev/Common/MdfParser/IOProfileRenderSelectionResult.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOProfileRenderSelectionResult.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfParser/IOProfileRenderSelectionResult.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -27,9 +27,8 @@
CREATE_ELEMENT_MAP;
ELEM_MAP_ENTRY(1, ProfileRenderSelectionResult);
ELEM_MAP_ENTRY(2, RenderTime);
-ELEM_MAP_ENTRY(3, Filter);
-ELEM_MAP_ENTRY(4, ProfileRenderLayerResult);
-ELEM_MAP_ENTRY(5, ExtendedData1);
+ELEM_MAP_ENTRY(3, ProfileRenderLayerResult);
+ELEM_MAP_ENTRY(4, ExtendedData1);
IOProfileRenderSelectionResult::IOProfileRenderSelectionResult(Version& version) : SAX2ElementHandler(version)
@@ -78,8 +77,8 @@
fd << endStr(sRenderTime) << std::endl;
// Property: ProfileRenderLayerResult
- for (int i=0; i<profileRenderSelectionResult->GetProfileRenderSelectedLayerResults()->GetCount(); ++i)
- IOProfileRenderLayerResult::Write(fd, profileRenderSelectionResult->GetProfileRenderSelectedLayerResults()->GetAt(i), version, tab);
+ for (int i=0; i<profileRenderSelectionResult->GetProfileRenderLayerResults()->GetCount(); ++i)
+ IOProfileRenderLayerResult::Write(fd, profileRenderSelectionResult->GetProfileRenderLayerResults()->GetAt(i), version, tab);
// Write any unknown XML / extended data
IOUnknown::Write(fd, profileRenderSelectionResult->GetUnknownXml(), version, tab);
Modified: trunk/MgDev/Common/MdfParser/SAX2Parser.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/SAX2Parser.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfParser/SAX2Parser.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -28,6 +28,7 @@
#include "PrintLayout/IOPrintLayoutElementDefinition.h"
#include "PrintLayout/IOMapViewportDefinition.h"
#include "IOWatermarkDefinition.h"
+#include "IOProfileResult.h"
using namespace XERCES_CPP_NAMESPACE;
using namespace MDFMODEL_NAMESPACE;
@@ -76,6 +77,7 @@
delete m_printLayout;
delete m_mapViewport;
delete m_watermark;
+ delete m_profileResult;
}
@@ -91,6 +93,7 @@
m_printLayout = NULL;
m_mapViewport = NULL;
m_watermark = NULL;
+ m_profileResult = NULL;
m_succeeded = false;
}
@@ -253,6 +256,14 @@
return ret;
}
+// Returns a reference to the parser's profile result
+// After this call the parser no longer owns the object.
+ProfileResult* SAX2Parser::DetachProfileResult()
+{
+ ProfileResult* ret = m_profileResult;
+ m_profileResult = NULL;
+ return ret;
+}
bool SAX2Parser::GetSucceeded() const
{
@@ -419,7 +430,21 @@
fd.close();
}
+void SAX2Parser::WriteToFile(std::string name, ProfileResult* profileResult, Version* version)
+{
+ std::ofstream fd;
+ fd.open(name.c_str());
+ if (fd.is_open())
+ {
+ MgTab tab;
+ fd << tab.tab() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; // NOXLATE
+ if (NULL != profileResult)
+ IOProfileResult::Write(fd, profileResult, version, tab);
+ }
+ fd.close();
+}
+
std::string SAX2Parser::SerializeToXML(MapDefinition* map, Version* version)
{
MdfStringStream fd;
@@ -506,7 +531,17 @@
return fd.str();
}
+std::string SAX2Parser::SerializeToXML(ProfileResult* profileResult, Version* version)
+{
+ MdfStringStream fd;
+ MgTab tab;
+ if (NULL != profileResult)
+ IOProfileResult::Write(fd, profileResult, version, tab);
+
+ return fd.str();
+}
+
void SAX2Parser::startElement(const XMLCh* const uri,
const XMLCh* const localname,
const XMLCh* const qname,
@@ -825,7 +860,31 @@
}
}
+void SAX2Parser::SetProfileResultVersion(const Attributes& attributes)
+{
+ // Although right now we only have 1.0.0 here, this function is still
+ // needed for future expansion.
+ // check for a version attribute
+ int index = attributes.getIndex(W2X(L"version"));
+ const XMLCh* verValue = (index >= 0)? attributes.getValue(index) : NULL;
+
+ // according to the schema watermark definition elements require a version
+ // attribute, but users may generate XML which is missing this attribute
+ if (verValue)
+ {
+ std::wstring version = X2W(verValue);
+
+ if (_wcsicmp(version.c_str(), L"2.4.0") == 0)
+ m_version = MdfModel::Version(2, 4, 0);
+ }
+ else
+ {
+ // assume the latest version if the attribute is missing
+ m_version = MdfModel::Version(2, 4, 0);
+ }
+}
+
MapDefinition* SAX2Parser::CreateClone(MapDefinition* map)
{
_ASSERT(NULL != map);
@@ -914,3 +973,17 @@
return parser.DetachWatermarkDefinition();
}
+
+ProfileResult* SAX2Parser::CreateClone(ProfileResult* profileResult)
+{
+ _ASSERT(NULL != profileResult);
+ if (NULL == profileResult)
+ return NULL;
+
+ SAX2Parser parser;
+ std::string xmlOfWD("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); // NOXLATE
+ xmlOfWD.append(parser.SerializeToXML(profileResult, NULL));
+ parser.ParseString(xmlOfWD.c_str(), xmlOfWD.size());
+
+ return parser.DetachProfileResult();
+}
Modified: trunk/MgDev/Common/MdfParser/SAX2Parser.h
===================================================================
--- trunk/MgDev/Common/MdfParser/SAX2Parser.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/MdfParser/SAX2Parser.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -28,6 +28,7 @@
#include "PrintLayout/PrintLayoutElementDefinition.h"
#include "PrintLayout/MapViewportDefinition.h"
#include "WatermarkDefinition.h"
+#include "ProfileResult.h"
// disable C4244 of XSerializeEngine about __w64 int assigned to unsigned long
// disable C4267 of XmlScanner about size_t assigned to unsigned int
@@ -84,6 +85,7 @@
MdfModel::Version* version);
void WriteToFile(std::string name, SymbolDefinition* symbol, MdfModel::Version* version);
void WriteToFile(std::string name, WatermarkDefinition* watermark, MdfModel::Version* version);
+ void WriteToFile(std::string name, ProfileResult* profileResult, MdfModel::Version* version);
// Serialization functions for the various Definitions the parser supports
std::string SerializeToXML(MapDefinition* map, MdfModel::Version* version);
@@ -92,6 +94,7 @@
std::string SerializeToXML(PrintLayoutDefinition* printLayout, MdfModel::Version* version);
std::string SerializeToXML(PrintLayoutElementDefinition* printLayoutElem, MdfModel::Version* version);
std::string SerializeToXML(WatermarkDefinition* watermark, MdfModel::Version* version);
+ std::string SerializeToXML(ProfileResult* profileResult, MdfModel::Version* version);
// Detaches the most recently parsed object from the parser.
// The calling method is then responsible for disposing the object,
@@ -108,6 +111,7 @@
PrintLayoutElementDefinition* DetachPrintLayoutElementDefinition();
MapViewportDefinition* DetachMapViewportDefinition();
WatermarkDefinition* DetachWatermarkDefinition();
+ ProfileResult* DetachProfileResult();
// Creates a clone of the given map/layer/symbol/print layout/print layout element definition.
// The object is serialized and parsed into a new object, which is returned.
@@ -117,6 +121,7 @@
static PrintLayoutDefinition* CreateClone(PrintLayoutDefinition* printLayout);
static PrintLayoutElementDefinition* CreateClone(PrintLayoutElementDefinition* printLayoutElem);
static WatermarkDefinition* CreateClone(WatermarkDefinition* watermark);
+ static ProfileResult* CreateClone(ProfileResult* profileResult);
// Success State
bool GetSucceeded() const;
@@ -156,6 +161,7 @@
void SetPrintLayoutDefinitionVersion(const Attributes& attributes);
void SetPrintLayoutElementDefinitionVersion(const Attributes& attributes);
void SetWatermarkDefinitionVersion(const Attributes& attributes);
+ void SetProfileResultVersion(const Attributes& attributes);
protected:
// The objects to be generated by the parser.
@@ -168,6 +174,7 @@
PrintLayoutDefinition* m_printLayout;
MapViewportDefinition* m_mapViewport;
WatermarkDefinition* m_watermark;
+ ProfileResult* m_profileResult;
// Succeeded is true if the parse has succeeded. As of now,
// there are very loose constraints on this boolean.
Modified: trunk/MgDev/Common/Schema/ProfileResult-2.4.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/ProfileResult-2.4.0.xsd 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Common/Schema/ProfileResult-2.4.0.xsd 2011-09-02 05:43:13 UTC (rev 6111)
@@ -129,11 +129,6 @@
<xs:documentation>The time of stylizing all selected layers in the map.</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="Filter" type="xs:string">
- <xs:annotation>
- <xs:documentation>A boolean FDO expression that specifies which features to return. No filter means pass all features through.</xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element name="ProfileSelectedRenderLayer" type="ProfileRenderLayerType" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Profiling result which records information for a particular selected layer rendering process.</xs:documentation>
Modified: trunk/MgDev/Server/Server.sln
===================================================================
--- trunk/MgDev/Server/Server.sln 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/Server.sln 2011-09-02 05:43:13 UTC (rev 6111)
@@ -298,11 +298,13 @@
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerProfilingService", "src\Services\Profiling\ServerProfilingService.vcproj", "{899E41F5-A58F-4C93-A623-666DCE6C1536}"
ProjectSection(ProjectDependencies) = postProject
{F7334B1B-0EFA-47E3-8E66-DF158E61B7E4} = {F7334B1B-0EFA-47E3-8E66-DF158E61B7E4}
+ {85882748-DD71-4D2B-9E5A-03AF8C8D91B7} = {85882748-DD71-4D2B-9E5A-03AF8C8D91B7}
{A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425} = {A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425}
{5287A594-4D4F-43FE-A281-E279AB708CF1} = {5287A594-4D4F-43FE-A281-E279AB708CF1}
{D954DAAC-E305-40CE-B3F3-C229A0BEF4F0} = {D954DAAC-E305-40CE-B3F3-C229A0BEF4F0}
{A4F7F6B2-0E74-4DFD-B283-C7E380BD6F58} = {A4F7F6B2-0E74-4DFD-B283-C7E380BD6F58}
{ADBF25E2-C629-4832-B315-F12ABDE05632} = {ADBF25E2-C629-4832-B315-F12ABDE05632}
+ {C50254F2-654A-48DE-AF5B-20605AEF8D10} = {C50254F2-654A-48DE-AF5B-20605AEF8D10}
EndProjectSection
EndProject
Global
Modified: trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -39,6 +39,10 @@
#include "LogManager.h"
#include "LogDetail.h"
+//For profiling
+#include "ProfileRenderLayerResult.h"
+#include "ScaleRange.h"
+
#ifndef _WIN32
#define _wcsnicmp wcsncasecmp
@@ -364,7 +368,8 @@
bool checkRefreshFlag,
double scale,
bool selection,
- bool extractColors)
+ bool extractColors,
+ ProfileRenderLayersResultBase* pPRLsResult)
{
#ifdef _DEBUG
long dwStart = GetTickCount();
@@ -411,7 +416,21 @@
MG_SERVER_MAPPING_SERVICE_TRY()
+ // Just profile visible layers?
+ TransformCache* TCForProfile = NULL;
+ double minScale_Profile = 0.0;
+ double maxScale_Profile = MdfModel::VectorScaleRange::MAX_MAP_SCALE;
+ if(NULL != pPRLsResult)
+ {
+ ProfileRenderLayerResult* pPRLResult = new ProfileRenderLayerResult(); // points points to Profile Render Layers Result
+
+ // Set the start time of stylizing layer
+ pPRLResult->SetRenderTime(MgTimerUtil::GetTime());
+ ProfileRenderLayerResultCollection* pPRLResultColl = pPRLsResult->GetProfileRenderLayerResults();
+ pPRLResultColl->Adopt(pPRLResult);
+ }
+
//get layer definition
Ptr<MgResourceIdentifier> layerid = mapLayer->GetLayerDefinition();
ldf.reset(MgLayerBase::GetLayerDefinition(svcResource, layerid));
@@ -470,6 +489,9 @@
if (scaleRange)
{
+ minScale_Profile = scaleRange->GetMinScale();
+ maxScale_Profile = scaleRange->GetMaxScale();
+
#ifdef _DEBUG
ACE_DEBUG((LM_INFO, L"(%t) StylizeLayers(%d) **Stylizing** Name:%W\n", i, (mapLayer->GetName()).c_str()));
#endif
@@ -498,6 +520,7 @@
//get a transform from layer coord sys to map coord sys
TransformCache* item = TransformCache::GetLayerToMapTransform(transformCache, vl->GetFeatureName(), featResId, dstCs, csFactory, svcFeature);
+ TCForProfile = item;
Ptr<MgCoordinateSystem> layerCs = item? item->GetCoordSys() : NULL;
MgCSTrans* xformer = item? item->GetTransform() : NULL;
@@ -581,6 +604,9 @@
if (scaleRange)
{
+ minScale_Profile = scaleRange->GetMinScale();
+ maxScale_Profile = scaleRange->GetMaxScale();
+
//get feature source id
STRING sfeatResId = gl->GetResourceID();
Ptr<MgResourceIdentifier> featResId = new MgResourceIdentifier(sfeatResId);
@@ -605,6 +631,7 @@
ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sg_fdoRfpMutex));
item = TransformCache::GetLayerToMapTransform(transformCache, gl->GetFeatureName(), featResId, dstCs, csFactory, svcFeature);
}
+ TCForProfile = item;
Ptr<MgCoordinateSystem> layerCs = item? item->GetCoordSys() : NULL;
MgCSTrans* xformer = item? item->GetTransform() : NULL;
@@ -715,6 +742,9 @@
}
else if (dl) //############################################################################ drawing layer
{
+ minScale_Profile = dl->GetMinScale();
+ maxScale_Profile = dl->GetMaxScale();
+
// make sure we have a valid scale range
if (scale >= dl->GetMinScale() && scale < dl->GetMaxScale())
{
@@ -757,6 +787,7 @@
}
}
}
+ TCForProfile = cached;
//get DWF from drawing service
Ptr<MgByteReader> reader = svcDrawing->GetSection(resId, dl->GetSheet());
@@ -773,6 +804,60 @@
#endif
} // end layer switch
+ if(NULL != pPRLsResult)
+ {
+ ProfileRenderLayerResultCollection* pPRLResultColl = pPRLsResult->GetProfileRenderLayerResults();
+
+ // Get current ProfileRenderLayerResult
+ ProfileRenderLayerResult* pPRLResult = pPRLResultColl->GetAt(pPRLResultColl->GetCount()-1); //TODO: check index
+
+ // Calculate the time spent on stylizing layer
+ double stylizeLayerTime = MgTimerUtil::GetTime() - pPRLResult->GetRenderTime();
+ pPRLResult->SetRenderTime(stylizeLayerTime);
+
+ pPRLResult->SetResourceId(layerid->ToString());
+ pPRLResult->SetLayerName(mapLayer->GetName());
+
+ if(vl)
+ {
+ pPRLResult->SetLayerType(L"Vector Layer"); //NOXLATE?
+ }
+ else if(dl)
+ {
+ pPRLResult->SetLayerType(L"Drawing Layer"); //NOXLATE?
+ }
+ else if(gl)
+ {
+ pPRLResult->SetLayerType(L"Grid Layer"); //NOXLATE?
+ }
+ else
+ {
+ pPRLResult->SetLayerType(L"Unknown Type"); //NOXLATE?
+ }
+
+ pPRLResult->SetFeatureClassName(mapLayer->GetFeatureClassName());
+
+ STRING layerCSWkt = L"";
+ if(NULL != TCForProfile)
+ {
+ Ptr<MgCoordinateSystem> layerCS = TCForProfile->GetCoordSys();
+ layerCSWkt = csFactory->ConvertCoordinateSystemCodeToWkt(layerCS->GetCsCode());
+ }
+ pPRLResult->SetCoordinateSystem(layerCSWkt);
+
+ ScaleRange* pScaleRange = new ScaleRange();
+ pScaleRange->SetMinScale(minScale_Profile);
+ pScaleRange->SetMaxScale(maxScale_Profile);
+ pPRLResult->AdoptScaleRange(pScaleRange);
+
+ STRING filter = L""; // NOXLATE
+ if (overrideFilters)
+ {
+ filter = overrideFilters->GetItem(i);
+ }
+ pPRLResult->SetFilter(filter.empty()? mapLayer->GetFilter() : filter);
+ }
+
MG_SERVER_MAPPING_SERVICE_CATCH(L"MgMappingUtil.StylizeLayers");
delete rsReader;
@@ -815,6 +900,7 @@
} // if exception
} // for all layers
+
#ifdef _DEBUG
ACE_DEBUG((LM_INFO, L"(%t)StylizeLayers() **MAPDONE** Layers:%d Total Time:%6.4f (s)\n\n", layers->GetCount(), (GetTickCount()-dwStart)/1000.0));
#endif
Modified: trunk/MgDev/Server/src/Services/Mapping/MappingUtil.h
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/MappingUtil.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Mapping/MappingUtil.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -21,6 +21,9 @@
#include "ServerMappingDllExport.h"
#include "MapGuideCommon.h"
+//For profiling
+#include "ProfileRenderLayersResult.h"
+
//fwd declare
class MgResourceService;
class MgFeatureService;
@@ -35,6 +38,7 @@
class RSMgFeatureReader;
class TransformCache;
class SE_SymbolManager;
+
namespace MdfModel
{
class SymbolDefinition;
@@ -60,7 +64,8 @@
bool checkRefreshFlag,
double scale,
bool selection = false,
- bool extractColors = false);
+ bool extractColors = false,
+ ProfileRenderLayersResultBase* = NULL);
static RSMgFeatureReader* ExecuteFeatureQuery(MgFeatureService* svcFeature,
RS_Bounds& extent,
Modified: trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -17,8 +17,9 @@
#include "MapGuideCommon.h"
#include "ServerProfilingService.h"
-//#include "MapProfileResult.h"
-#include "SAX2Parser.h"
+#include "ProfileResult.h"
+#include "ProfileRenderMapResult.h"
+#include "SAX2Parser.h"
IMPLEMENT_CREATE_SERVICE(MgServerProfilingService)
@@ -54,15 +55,33 @@
MgRenderingOptions* options)
{
Ptr<MgByteReader> ret;
+
+ MG_TRY()
- /*MG_TRY()
-
- if (NULL == map)
+ // selection is an optional and nullable parameter
+ if (NULL == map || NULL == options)
throw new MgNullArgumentException(L"MgServerProfilingService.ProfileRenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"", NULL);
+ auto_ptr<ProfileRenderMapResult> pPRMResult; // a pointer points to Profile Render Map Result
+ pPRMResult.reset(new ProfileRenderMapResult());
- MG_CATCH_AND_THROW(L"MgServerProfilingService.ProfileRenderDynamicOverlay")*/
+ // Start to profile the RenderDynamicOverlay process
+ double renderMapStart = MgTimerUtil::GetTime();
+ m_svcRendering->RenderDynamicOverlay(map, selection, options, pPRMResult.get());
+ double renderMapEnd = MgTimerUtil::GetTime();
+ pPRMResult->SetRenderTime(renderMapEnd - renderMapStart);
+ pPRMResult->SetProfileResultType(ProfileResult::ProfileRenderDynamicOverlay);
+
+ // Serialize the ProfileRenderMapResult to xml
+ MdfParser::SAX2Parser parser;
+ auto_ptr<Version> version;
+ version.reset(new Version(2,4,0));
+ string content = parser.SerializeToXML(pPRMResult.get(),version.get());
+ ret = new MgByteReader(MgUtil::MultiByteToWideChar(content), MgMimeType::Xml);
+
+ MG_CATCH_AND_THROW(L"MgServerProfilingService.ProfileRenderDynamicOverlay")
+
return ret.Detach();
}
@@ -92,24 +111,7 @@
return ret.Detach();
}
-///////////////////////////////////////////////////////////////////////////////
-// Profile RenderMapLegend API
-//MgByteReader* MgServerProfilingService::ProfileRenderMapLegend(MgMap* map,
-// INT32 width,
-// INT32 height,
-// MgColor* backgroundColor,
-// CREFSTRING format)
-//{
-// Ptr<MgByteReader> ret;
-//
-// MG_TRY()
-//
-//
-// MG_CATCH_AND_THROW(L"MgServerRenderingService.RenderMapLegend")
-// return ret.Detach();
-//}
-
///////////////////////////////////////////////////////////////////////////////
void MgServerProfilingService::SetConnectionProperties(MgConnectionProperties*)
{
Modified: trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.vcxproj
===================================================================
--- trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.vcxproj 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Profiling/ServerProfilingService.vcxproj 2011-09-02 05:43:13 UTC (rev 6111)
@@ -259,6 +259,12 @@
<ProjectReference Include="..\..\..\..\Common\MapGuideCommon\MapGuideCommon.vcxproj">
<Project>{5287a594-4d4f-43fe-a281-e279ab708cf1}</Project>
</ProjectReference>
+ <ProjectReference Include="..\..\..\..\Common\MdfModel\MDFModel.vcxproj">
+ <Project>{c50254f2-654a-48de-af5b-20605aef8d10}</Project>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\Common\MDFParser\MDFParser.vcxproj">
+ <Project>{85882748-dd71-4d2b-9e5a-03af8c8d91b7}</Project>
+ </ProjectReference>
<ProjectReference Include="..\..\..\..\Common\PlatformBase\PlatformBase.vcxproj">
<Project>{f7334b1b-0efa-47e3-8e66-df158e61b7e4}</Project>
</ProjectReference>
Modified: trunk/MgDev/Server/src/Services/Rendering/OpRenderDynamicOverlay.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/OpRenderDynamicOverlay.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Rendering/OpRenderDynamicOverlay.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -91,6 +91,41 @@
Ptr<MgByteReader> byteReader = m_service->RenderDynamicOverlay(map, selection, options);
EndExecution(byteReader);
}
+ else if (4 == m_packet.m_NumArguments)
+ {
+ Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+ Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+ map->SetDelayedLoadResourceService(m_resourceService);
+
+ Ptr<MgSelection> selection = (MgSelection*)m_stream->GetObject();
+ if(selection)
+ selection->SetMap(map);
+
+ Ptr<MgRenderingOptions> options = (MgRenderingOptions*)m_stream->GetObject();
+
+ auto_ptr<ProfileRenderMapResult> pProfileRenderMapResult;
+ pProfileRenderMapResult.reset((ProfileRenderMapResult*)m_stream->GetObject());
+ 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(L"MgSelection");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(options->GetImageFormat().c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(options->GetBehavior());
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgColor");
+ MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"ProfileRenderMapResult");
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ Ptr<MgByteReader> byteReader = m_service->RenderDynamicOverlay(map, selection, options, pProfileRenderMapResult.get());
+ EndExecution(byteReader);
+ }
else
{
MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp 2011-09-02 05:43:13 UTC (rev 6111)
@@ -28,8 +28,13 @@
#include "MappingUtil.h"
#include "LegendPlotUtil.h"
#include "TransformCache.h"
+#include "Box2D.h"
+// Profile
+#include "ProfileRenderMapResult.h"
+
+
// the maximum number of allowed pixels for rendered images
static const INT32 MAX_PIXELS = 16384*16384;
static const INT32 FILTER_VISIBLE = 1;
@@ -305,10 +310,24 @@
///////////////////////////////////////////////////////////////////////////////
// called from API (first call of AjaxPgPViewerSampleApplication)
+// default arg pPRMResult = NULL
MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
MgSelection* selection,
MgRenderingOptions* options)
{
+ // Call updated RenderDynamicOverlay API
+ return RenderDynamicOverlay(map, selection, options, NULL);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Non-published RenderDynamicOverlay API with profile result parameter
+// pPRMResult - a pointer points to Profile Render Map Result.
+MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
+ MgSelection* selection,
+ MgRenderingOptions* options,
+ ProfileRenderMapResult* pPRMResult)
+{
Ptr<MgByteReader> ret;
MG_TRY()
@@ -373,15 +392,24 @@
roLayers->Add(layer);
}
+ if(NULL != pPRMResult)
+ {
+ Ptr<MgResourceIdentifier> mapResId = map->GetResourceId();
+ pPRMResult->SetResourceId(mapResId ? mapResId->ToString() : L"");
+ pPRMResult->SetScale(scale);
+ pPRMResult->SetExtents(Box2D(extent.minx, extent.miny, extent.maxx, extent.maxy));
+ pPRMResult->SetLayerCount(layers->GetCount());
+ pPRMResult->SetCoordinateSystem(map->GetMapSRS());
+ }
+
// call the internal helper API to do all the stylization overhead work
- ret = RenderMapInternal(map, selection, roLayers, dr.get(), width, height, width, height, scale, extent, false, options, true);
+ ret = RenderMapInternal(map, selection, roLayers, dr.get(), width, height, width, height, scale, extent, false, options, true, pPRMResult);
MG_CATCH_AND_THROW(L"MgServerRenderingService.RenderDynamicOverlay")
return ret.Detach();
}
-
///////////////////////////////////////////////////////////////////////////////
// default arg bKeepSelection = true
MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
@@ -826,7 +854,8 @@
RS_Bounds& b,
bool expandExtents,
bool bKeepSelection,
- bool renderWatermark)
+ bool renderWatermark,
+ ProfileRenderMapResult* pPRMResult)
{
MgRenderingOptions options(format, MgRenderingOptions::RenderSelection |
MgRenderingOptions::RenderLayers | (bKeepSelection? MgRenderingOptions::KeepSelection : 0), NULL);
@@ -853,7 +882,8 @@
RS_Bounds& b,
bool expandExtents,
MgRenderingOptions* options,
- bool renderWatermark)
+ bool renderWatermark,
+ ProfileRenderMapResult* pPRMResult)
{
// set the map scale to the requested scale
map->SetViewScale(scale);
@@ -917,14 +947,45 @@
INT32 behavior = options->GetBehavior();
if (behavior & MgRenderingOptions::RenderLayers) // this is for tiles so observer colormaps
{
+ ProfileRenderLayersResult* pPRLsResult = NULL; // pointer points to Profile Render Layers Result
+
+ if(NULL != pPRMResult)
+ {
+ pPRLsResult = new ProfileRenderLayersResult();
+ pPRMResult->AdoptProfileRenderLayersResult(pPRLsResult);
+
+ // Set the start time of stylizing layers
+ pPRLsResult->SetRenderTime(MgTimerUtil::GetTime());
+ }
+
MgMappingUtil::StylizeLayers(m_svcResource, m_svcFeature, m_svcDrawing, m_pCSFactory, map,
tempLayers, NULL, &ds, dr, dstCs, expandExtents, false, scale,
- false, hasColorMap(format));
+ false, hasColorMap(format), pPRLsResult);
+
+ if(NULL != pPRMResult)
+ {
+ pPRLsResult = pPRMResult->GetProfileRenderLayersResult();
+
+ // Calculate the time spent on stylizing layers
+ double stylizeLayersTime = MgTimerUtil::GetTime() - pPRLsResult->GetRenderTime();
+ pPRLsResult->SetRenderTime(stylizeLayersTime);
+ }
}
// now we need to stylize the selection on top (this is not for tiles!)
if (selection && (behavior & MgRenderingOptions::RenderSelection))
{
+ ProfileRenderSelectionResult* pPRSResult = NULL; // pointer points to Profile Render Selection Result
+
+ if(NULL != pPRMResult)
+ {
+ pPRSResult = new ProfileRenderSelectionResult();
+ pPRMResult->AdoptProfileRenderSelectionResult(pPRSResult);
+
+ // Set the start time of stylizing selected layers
+ pPRSResult->SetRenderTime(MgTimerUtil::GetTime());
+ }
+
Ptr<MgReadOnlyLayerCollection> selLayers = selection->GetLayers();
#ifdef _DEBUG
@@ -972,15 +1033,35 @@
}
MgMappingUtil::StylizeLayers(m_svcResource, m_svcFeature, m_svcDrawing, m_pCSFactory, map,
- modLayers, overrideFilters, &ds, dr, dstCs, false, false, scale, (behavior & MgRenderingOptions::KeepSelection) != 0);
+ modLayers, overrideFilters, &ds, dr, dstCs, false, false, scale, (behavior & MgRenderingOptions::KeepSelection) != 0,false,pPRSResult);
// Set selection mode to false to avoid affecting following code
dr->SetRenderSelectionMode(false);
}
+
+ if(NULL != pPRMResult)
+ {
+ pPRSResult = pPRMResult->GetProfileRenderSelectionResult();
+
+ // Calculate the time spent on stylizing selected layers
+ double stylizeSelectionTime = MgTimerUtil::GetTime() - pPRSResult->GetRenderTime();
+ pPRSResult->SetRenderTime(stylizeSelectionTime);
+ }
}
if (renderWatermark && (behavior & MgRenderingOptions::RenderLayers) && map->GetWatermarkUsage() != 0)
{
+ ProfileRenderWatermarksResult* pPRWsResult = NULL; // pointer points to Profile Render Watermarks Result
+
+ if(NULL != pPRMResult)
+ {
+ pPRWsResult = new ProfileRenderWatermarksResult();
+ pPRMResult->AdoptProfileRenderWatermarksResult(pPRWsResult);
+
+ // Set the start time of stylizing watermarks
+ pPRWsResult->SetRenderTime(MgTimerUtil::GetTime());
+ }
+
// Rendering watermark only when:
// 1. rendering layers
// 2. not set renderWatermark to false (not render tile)
@@ -1087,6 +1168,18 @@
break;
}
}
+
+ if(NULL != pPRWsResult)
+ {
+ ProfileRenderWatermarkResult* pPRWResult = new ProfileRenderWatermarkResult(); // pointer points to Render Watermark Result
+
+ // Set the start time of stylizing watermark
+ pPRWResult->SetRenderTime(MgTimerUtil::GetTime());
+
+ ProfileRenderWatermarkResultCollection* pPRWResultColl = pPRWsResult->GetProfileRenderWatermarkResults();
+ pPRWResultColl->Adopt(pPRWResult);
+ }
+
if(wdef == NULL)
{
Ptr<MgResourceIdentifier> resId = new MgResourceIdentifier(resourceId);
@@ -1107,6 +1200,28 @@
}
ds.StylizeWatermark(dr, wdef, drawWidth, drawHeight, saveWidth, saveHeight);
+ if(NULL != pPRWsResult)
+ {
+ ProfileRenderWatermarkResultCollection* pPRWResultColl = pPRWsResult->GetProfileRenderWatermarkResults();
+ ProfileRenderWatermarkResult* pPRWResult = pPRWResultColl->GetAt(pPRWResultColl->GetCount()-1); // TODO: check index
+
+ // Calculate the time spent on stylizing watermark
+ double stylizeWatermarkTime = MgTimerUtil::GetTime() - pPRWResult->GetRenderTime();
+ pPRWResult->SetRenderTime(stylizeWatermarkTime);
+
+ pPRWResult->SetResourceId(resourceId);
+
+ WatermarkPosition* position = wdef->GetPosition();
+ if(NULL != dynamic_cast<XYWatermarkPosition*>(position))
+ {
+ pPRWResult->SetPositionType(L"XY");
+ }
+ else // No other position types
+ {
+ pPRWResult->SetPositionType(L"Tile");
+ }
+ }
+
MG_CATCH(L"MgServerRenderingService.RenderMapInternal")
if(mgException.p)
{
@@ -1149,12 +1264,38 @@
}
}
}
+
+ if(NULL != pPRWsResult)
+ {
+ // Calculate the time spent on stylizing watermarks
+ double stylizeRenderWatermarksTime = MgTimerUtil::GetTime() - pPRWsResult->GetRenderTime();
+ pPRWsResult->SetRenderTime(stylizeRenderWatermarksTime);
+ }
}
MG_CATCH(L"MgServerRenderingService.RenderMapInternal")
+ if(NULL != pPRMResult)
+ {
+ ProfileRenderLabelsResult* pPRLablesResult = new ProfileRenderLabelsResult(); // pointer points to Render Labels Result
+
+ // Set the start time of stylizing labels
+ pPRLablesResult->SetRenderTime(MgTimerUtil::GetTime());
+
+ pPRMResult->AdoptProfileRenderLabelsResult(pPRLablesResult);
+ }
+
dr->EndMap();
+ if(NULL != pPRMResult)
+ {
+ ProfileRenderLabelsResult* pPRLablesResult = pPRMResult->GetProfileRenderLabelsResult();
+
+ // Calculate the time spent on stylizing labels
+ double stylizeLabelsTime = MgTimerUtil::GetTime() - pPRLablesResult->GetRenderTime();
+ pPRLablesResult->SetRenderTime(stylizeLabelsTime);
+ }
+
MG_THROW() // to skip a faulty tile we need to rethrow the exception which could be thrown in StylizeLayers
/*
//-------------------------------------------------------
@@ -1177,6 +1318,13 @@
dr->ProcessPolyline(&lb, ls);
//-------------------------------------------------------
*/
+
+ if(NULL != pPRMResult)
+ {
+ // Set the start time of creating map image
+ pPRMResult->SetCreateImageTime(MgTimerUtil::GetTime());
+ }
+
Ptr<MgByteReader> ret;
// get a byte representation of the image
@@ -1233,7 +1381,17 @@
}
else
throw new MgNullReferenceException(L"MgServerRenderingService.RenderMapInternal", __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(m_rendererName);
+ }
+
return ret.Detach();
}
Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h 2011-09-02 03:42:31 UTC (rev 6110)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h 2011-09-02 05:43:13 UTC (rev 6111)
@@ -24,6 +24,11 @@
class FeatureInfoRenderer;
class MgFeatureInformation;
+namespace MdfModel
+{
+ class ProfileRenderMapResult;
+}
+
class MG_SERVER_RENDERING_API MgServerRenderingService : public MgRenderingService
{
DECLARE_CLASSNAME(MgServerRenderingService)
@@ -54,6 +59,11 @@
MgSelection* selection,
MgRenderingOptions* options);
+ virtual MgByteReader* RenderDynamicOverlay(MgMap* map,
+ MgSelection* selection,
+ MgRenderingOptions* options,
+ ProfileRenderMapResult* pPRMResult);
+
virtual MgByteReader* RenderMap(MgMap* map,
MgSelection* selection,
CREFSTRING format);
@@ -178,7 +188,8 @@
RS_Bounds& b,
bool expandExtents,
bool bKeepSelection,
- bool renderWatermark);
+ bool renderWatermark,
+ ProfileRenderMapResult* pPRMResult = NULL);
MgByteReader* RenderMapInternal(MgMap* map,
MgSelection* selection,
@@ -192,7 +203,8 @@
RS_Bounds& b,
bool expandExtents,
MgRenderingOptions* options,
- bool renderWatermark);
+ bool renderWatermark,
+ ProfileRenderMapResult* pPRMResult = NULL);
void RenderForSelection(MgMap* map,
MgStringCollection* layerNames,
More information about the mapguide-commits
mailing list