[mapguide-commits] r5620 - in sandbox/adsk/2.2gp:
Common/MapGuideCommon/Services Common/Renderers
Server/src/Services/Kml Server/src/Services/Mapping
Server/src/UnitTesting Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Mar 13 22:39:49 EDT 2011
Author: liuar
Date: 2011-03-13 19:39:49 -0700 (Sun, 13 Mar 2011)
New Revision: 5620
Added:
sandbox/adsk/2.2gp/Common/Renderers/KmlIconStyle.h
Modified:
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/KmlService.h
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.cpp
sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.h
sandbox/adsk/2.2gp/Common/Renderers/KmlContent.h
sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.cpp
sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.h
sandbox/adsk/2.2gp/Common/Renderers/Makefile.am
sandbox/adsk/2.2gp/Common/Renderers/Renderers.vcproj
sandbox/adsk/2.2gp/Server/src/Services/Kml/OpGetFeaturesKml.cpp
sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.cpp
sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.h
sandbox/adsk/2.2gp/Server/src/Services/Mapping/ServerMappingService.cpp
sandbox/adsk/2.2gp/Server/src/UnitTesting/TestKmlService.cpp
sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.cpp
sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.h
Log:
Port to adsk branch
Fix ticket #1619 Lack of point style in KML service
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/KmlService.h
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/KmlService.h 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/KmlService.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -153,6 +153,55 @@
INT32 drawOrder,
CREFSTRING format) = 0;
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns a layer definition in KML format
+ ///
+ /// \param layer
+ /// Input
+ /// layer object for which to generate KML.
+ ///
+ /// \param extents
+ /// Input
+ /// required spatial data extents
+ ///
+ /// \param width
+ /// Input
+ /// map width in pixels
+ ///
+ /// \param height
+ /// Input
+ /// map height in pixels
+ ///
+ /// \param dpi
+ /// Input
+ /// resolution in dots per inch
+ ///
+ /// \param drawOrder
+ /// Input
+ /// the draw order for the layer containing these features
+ ///
+ /// \param agentUri
+ /// Input
+ /// URI of map agent that issued request
+ ///
+ /// \param format
+ /// Input
+ /// requested response format
+ ///
+ /// \return
+ /// A byte reader containing the generated KML.
+ ///
+ virtual MgByteReader* GetFeaturesKml(
+ MgLayer* layer,
+ MgEnvelope* extents,
+ INT32 width,
+ INT32 height,
+ double dpi,
+ INT32 drawOrder,
+ CREFSTRING agentUri,
+ CREFSTRING format) = 0;
+
INTERNAL_API:
//////////////////////////////////////////////////////////////////
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -149,6 +149,39 @@
return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
+// Retrieve feature geometries in KML format
+MgByteReader* MgProxyKmlService::GetFeaturesKml(
+ MgLayer* layer,
+ MgEnvelope* extents,
+ INT32 width,
+ INT32 height,
+ double dpi,
+ INT32 drawOrder,
+ CREFSTRING agentUri,
+ CREFSTRING format)
+{
+ MgCommand cmd;
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knObject, // Return type expected
+ MgKmlServiceOpId::GetFeaturesKml, // Command Code
+ 8, // No of arguments
+ Kml_Service, // Service Id
+ BUILD_VERSION(1,0,0), // Operation version
+ MgCommand::knObject, layer, // Argument#1
+ MgCommand::knObject, extents, // Argument#2
+ MgCommand::knInt32, width, // Argument#3
+ MgCommand::knInt32, height, // Argument#4
+ MgCommand::knDouble, dpi, // Argument#5
+ MgCommand::knInt32, drawOrder, // Argument#6
+ MgCommand::knString, &agentUri, // Argument#7
+ MgCommand::knString, &format, // Argument#8
+ MgCommand::knNone); // End of arguments
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
+}
+
//////////////////////////////////////////////////////////////////
/// \brief
/// Sets the connection properties for the Proxy Service. This
Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.h
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.h 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyKmlService.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -146,7 +146,56 @@
INT32 drawOrder,
CREFSTRING format);
+ /////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Returns a layer definition in KML format
+ ///
+ /// \param layer
+ /// Input
+ /// layer object for which to generate KML.
+ ///
+ /// \param extents
+ /// Input
+ /// required spatial data extents
+ ///
+ /// \param width
+ /// Input
+ /// map width in pixels
+ ///
+ /// \param height
+ /// Input
+ /// map height in pixels
+ ///
+ /// \param dpi
+ /// Input
+ /// resolution in dots per inch
+ ///
+ /// \param drawOrder
+ /// Input
+ /// the draw order for the layer containing these features
+ ///
+ /// \param agentUri
+ /// Input
+ /// URI of map agent that issued request
+ ///
+ /// \param format
+ /// Input
+ /// requested response format
+ ///
+ /// \return
+ /// A byte reader containing the generated KML.
+ ///
+ virtual MgByteReader* GetFeaturesKml(
+ MgLayer* layer,
+ MgEnvelope* extents,
+ INT32 width,
+ INT32 height,
+ double dpi,
+ INT32 drawOrder,
+ CREFSTRING agentUri,
+ CREFSTRING format);
+
INTERNAL_API:
//////////////////////////////////////////////////////////////////
Modified: sandbox/adsk/2.2gp/Common/Renderers/KmlContent.h
===================================================================
--- sandbox/adsk/2.2gp/Common/Renderers/KmlContent.h 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/Renderers/KmlContent.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -22,6 +22,7 @@
#include "RendererStyles.h"
#include "KmlLineStyle.h"
#include "KmlPolyStyle.h"
+#include "KmlIconStyle.h"
#include <sstream>
class KmlContent
Added: sandbox/adsk/2.2gp/Common/Renderers/KmlIconStyle.h
===================================================================
--- sandbox/adsk/2.2gp/Common/Renderers/KmlIconStyle.h (rev 0)
+++ sandbox/adsk/2.2gp/Common/Renderers/KmlIconStyle.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2004-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 KML_ICONSTYLE_H
+#define KML_ICONSTYLE_H
+
+#include "Renderers.h"
+#include "RendererStyles.h"
+
+class KmlIconStyle
+{
+public:
+ double m_scale;
+ std::wstring m_href;
+
+ KmlIconStyle(double scale, std::wstring href);
+ bool operator<(const KmlIconStyle& other) const;
+};
+
+#endif KML_ICONSTYLE_H
Modified: sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -369,6 +369,16 @@
void KmlRenderer::ProcessOneMarker(double x, double y, RS_MarkerDef& mdef, bool /*allowOverpost*/)
{
+ //write style
+ RS_UIGraphic& uig = m_layerInfo->graphic();
+ unsigned char* data = uig.data();
+ if(NULL != data)
+ {
+ wchar_t * legendImage = new wchar_t[4096];
+ mbstowcs(legendImage,(const char*)data,4096);
+ WriteStyle(0.5,legendImage);
+ }
+
char buffer[256];
m_kmlContent->WriteString("<name><![CDATA[", false);
m_kmlContent->WriteString(mdef.name(), false);
@@ -676,6 +686,16 @@
}
+void KmlRenderer::DrawScreenRaster(unsigned char* data, int length,
+ RS_ImageFormat format, int native_width, int native_height,
+ double x, double y, double w, double h, double angleDeg,
+ double alpha)
+{
+ RenderUtil::DrawScreenRaster(this, data, length, format, native_width, native_height,
+ x, y, w, h, angleDeg, alpha);
+}
+
+
void KmlRenderer::DrawScreenText(const RS_TextMetrics& /*tm*/,
RS_TextDef& /*tdef*/,
double /*insx*/,
Modified: sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.h
===================================================================
--- sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.h 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/Renderers/KmlRenderer.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -29,6 +29,7 @@
typedef std::map<RS_String, KmlContent*> ThemeMap;
typedef std::map<KmlLineStyle, int> KmlLineStyleIdMap;
typedef std::map<KmlPolyStyle, int> KmlPolyStyleIdMap;
+typedef std::map<KmlIconStyle, int> KmlIconStyleIdMap;
class TransformMesh;
@@ -163,6 +164,7 @@
void ProcessOneMarker(double x, double y, RS_MarkerDef& mdef, bool allowOverpost);
void WriteStyle(RS_FillStyle& fill);
void WriteStyle(RS_LineStroke& lsym);
+ void WriteStyle(double scale, const std::wstring& href);
void WriteLinearRing(LineBuffer* plb, int contour);
void WriteLinearRing(LineBuffer* plb);
void WriteCoordinates(LineBuffer* plb);
@@ -185,6 +187,7 @@
int m_styleId;
KmlLineStyleIdMap m_lineStyleMap;
KmlPolyStyleIdMap m_polyStyleMap;
+ KmlIconStyleIdMap m_iconStyleMap;
double m_pixelSize;
int m_drawOrder;
double m_elevation;
Modified: sandbox/adsk/2.2gp/Common/Renderers/Makefile.am
===================================================================
--- sandbox/adsk/2.2gp/Common/Renderers/Makefile.am 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/Renderers/Makefile.am 2011-03-14 02:39:49 UTC (rev 5620)
@@ -36,6 +36,7 @@
KmlContent.cpp \
KmlLineStyle.cpp \
KmlPolyStyle.cpp \
+ KmlIconStyle.cpp \
KmlRenderer.cpp \
ObservationMesh.cpp \
RS_ByteData.cpp \
@@ -64,6 +65,7 @@
KmlContent.h \
KmlLineStyle.h \
KmlPolyStyle.h \
+ KmlIconStyle.h \
KmlRenderer.h \
ObservationMesh.h \
Renderers.h \
Modified: sandbox/adsk/2.2gp/Common/Renderers/Renderers.vcproj
===================================================================
--- sandbox/adsk/2.2gp/Common/Renderers/Renderers.vcproj 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Common/Renderers/Renderers.vcproj 2011-03-14 02:39:49 UTC (rev 5620)
@@ -503,6 +503,14 @@
>
</File>
<File
+ RelativePath=".\KmlIconStyle.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\KmlIconStyle.h"
+ >
+ </File>
+ <File
RelativePath=".\KmlLineStyle.cpp"
>
</File>
Modified: sandbox/adsk/2.2gp/Server/src/Services/Kml/OpGetFeaturesKml.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Kml/OpGetFeaturesKml.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Server/src/Services/Kml/OpGetFeaturesKml.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -94,6 +94,43 @@
EndExecution(kml);
}
+ else if (8 == m_packet.m_NumArguments)
+ {
+ Ptr<MgLayer> layer = (MgLayer*)m_stream->GetObject();
+ Ptr<MgResourceIdentifier> resource = layer->GetLayerDefinition();
+ Ptr<MgEnvelope> extents = (MgEnvelope*)m_stream->GetObject();
+ INT32 width;
+ m_stream->GetInt32(width);
+ INT32 height;
+ m_stream->GetInt32(height);
+ double dpi;
+ m_stream->GetDouble(dpi);
+ INT32 drawOrder;
+ m_stream->GetInt32(drawOrder);
+ STRING agentUri;
+ m_stream->GetString(agentUri);
+ STRING format;
+ m_stream->GetString(format);
+ 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_STRING(L"MgEnvelope");
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(width);
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(height);
+ MG_LOG_OPERATION_MESSAGE_ADD_DOUBLE(dpi);
+ MG_LOG_OPERATION_MESSAGE_ADD_INT32(drawOrder);
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(agentUri.c_str());
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(format.c_str());
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ Ptr<MgByteReader> kml =
+ m_service->GetFeaturesKml(layer, extents, width, height, dpi, drawOrder, agentUri, format);
+
+ EndExecution(kml);
+ }
else
{
MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
Modified: sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -32,7 +32,7 @@
//Zip support from DWF toolkit
#include "dwfcore/ZipFileDescriptor.h"
-const STRING LL84_WKT = L"GEOGCS[\"LL84\",DATUM[\"WGS 84\",SPHEROID[\"WGS 84\",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degrees\",0.01745329252]]";
+const STRING LL84_WKT = L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degrees\",0.01745329252]]";
const STRING GOOGLE_EARTH_WKT = LL84_WKT;
IMPLEMENT_CREATE_SERVICE(MgServerKmlService)
@@ -233,6 +233,12 @@
MgByteReader* MgServerKmlService::GetFeaturesKml(MgLayer* layer, MgEnvelope* extents,
INT32 width, INT32 height, double dpi, INT32 drawOrder, CREFSTRING format)
{
+ return GetFeaturesKml(layer, extents, width, height, dpi, drawOrder, L"", format);
+}
+
+MgByteReader* MgServerKmlService::GetFeaturesKml(MgLayer* layer, MgEnvelope* extents,
+ INT32 width, INT32 height, double dpi, INT32 drawOrder, CREFSTRING agentUri, CREFSTRING format)
+{
Ptr<MgByteReader> byteReader;
MG_TRY()
@@ -280,7 +286,8 @@
KmlContent kmlContent;
kmlContent.StartDocument();
kmlContent.WriteString("<visibility>1</visibility>");
- AppendFeatures(layer, ldf.get(), extents, scale, dpi, drawOrder, kmlContent);
+ STRING sessionId = GetSessionId();
+ AppendFeatures(layer, ldf.get(), extents, agentUri, scale, dpi, drawOrder, sessionId, kmlContent);
kmlContent.EndDocument();
Ptr<MgByteSource> byteSource = GetByteSource(kmlContent, format);
if(byteSource != NULL)
@@ -424,17 +431,27 @@
void MgServerKmlService::AppendFeatures(MgLayer* layer,
MdfModel::LayerDefinition* layerDef,
MgEnvelope* extents,
+ CREFSTRING agentUri,
double scale,
double dpi,
INT32 drawOrder,
+ CREFSTRING sessionId,
KmlContent& kmlContent)
{
MgCSTrans* csTrans = NULL;
RSMgFeatureReader* rsReader = NULL;
+ char* legendImage = NULL;
MG_TRY()
-
- RS_UIGraphic uig(NULL, 0, layer->GetLegendLabel());
+
+ if(!agentUri.empty())
+ {
+ STRING strLegendImage = GetPointStyleImageUrl(agentUri,layer,scale,sessionId);
+ legendImage = new char[4096];
+ wcstombs(legendImage, strLegendImage.c_str(), 4096 );
+ }
+
+ RS_UIGraphic uig((unsigned char*)legendImage, 0, layer->GetLegendLabel());
RS_LayerUIInfo layerInfo(layer->GetName(),
layer->GetObjectId(),
layer->GetSelectable(),
@@ -523,7 +540,7 @@
}*/
MG_CATCH(L"MgServerKmlService.AppendFeatures")
-
+ delete[] legendImage;
delete rsReader;
delete csTrans;
@@ -871,3 +888,84 @@
}
return sessionId;
}
+
+STRING MgServerKmlService::GetPointStyleImageUrl(STRING agentUri, MgLayer* layer, double scale, CREFSTRING sessionId)
+{
+ STRING strLegendImage = agentUri + L"?OPERATION=GetLegendImage&LAYERDEFINITION=";
+ strLegendImage += layer->GetLayerDefinition()->ToString();
+ strLegendImage += L"&SCALE=" ;
+
+ STRING strScale;
+ MgUtil::DoubleToString(scale,strScale);
+ strLegendImage += strScale;
+
+ STRING strGeomType;
+ STRING strCategoryIndex = L"-1";
+ //get layer definition
+ Ptr<MgResourceIdentifier> resId = layer->GetLayerDefinition();
+ auto_ptr<MdfModel::LayerDefinition> ldf(MgLayerBase::GetLayerDefinition(m_svcResource, resId));
+
+ MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
+ if(vl != NULL)
+ {
+ //get the scale ranges
+ MdfModel::VectorScaleRangeCollection* scaleRanges = vl->GetScaleRanges();
+ MdfModel::VectorScaleRange* range = NULL;
+
+ for (int i = 0; i < scaleRanges->GetCount(); i++)
+ {
+ range = scaleRanges->GetAt(i);
+ double minScale = range->GetMinScale();
+ double maxScale = range->GetMaxScale();
+ if(scale > minScale && scale <= maxScale)
+ {
+ int categoryIndex = -1;
+ MdfModel::FeatureTypeStyleCollection* styleCollection = range->GetFeatureTypeStyles();
+ MdfModel::FeatureTypeStyle* style = NULL;
+ for (int j = 0; j < styleCollection->GetCount(); j++)
+ {
+ style = styleCollection->GetAt(j);
+ MdfModel::RuleCollection* ruleCollection = style->GetRules();
+ for(int k = 0; k < ruleCollection->GetCount(); k++)
+ {
+ MdfModel::PointRule* pointRule = dynamic_cast<MdfModel::PointRule*>(ruleCollection->GetAt(k));
+ MdfModel::CompositeRule* compositeRule = dynamic_cast<MdfModel::CompositeRule*>(ruleCollection->GetAt(k));
+
+ if(NULL != pointRule)
+ {
+ strGeomType = L"1"; // FeatureTypeStyleVisitor::ftsPoint
+ }
+ else if(NULL != compositeRule)
+ {
+ strGeomType = L"4"; //FeatureTypeStyleVisitor::ftsComposite
+
+ MdfModel::CompositeSymbolization* symbolization = compositeRule->GetSymbolization();
+ MdfModel::SymbolInstanceCollection* symbolInstanceCollection = symbolization->GetSymbolCollection();
+ for(int l = 0; l < symbolInstanceCollection->GetCount(); l++)
+ {
+ MdfModel::SymbolInstance* symbolInstance = symbolInstanceCollection->GetAt(l);
+ if(symbolInstance->GetGeometryContext() == MdfModel::SymbolInstance::GeometryContext::gcPoint)
+ {
+ MgUtil::Int32ToString(++categoryIndex,strCategoryIndex);
+ }
+ else
+ {
+ ++categoryIndex;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ strLegendImage += L"&THEMECATEGORY=";
+ strLegendImage += strCategoryIndex;
+ strLegendImage += L"&TYPE=";
+ strLegendImage += strGeomType;
+ strLegendImage += L"&SESSION=";
+ strLegendImage += sessionId;
+ strLegendImage += L"&VERSION=1";
+
+ return strLegendImage;
+}
Modified: sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.h
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.h 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Server/src/Services/Kml/ServerKmlService.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -70,6 +70,8 @@
virtual MgByteReader* GetFeaturesKml(MgLayer* layer, MgEnvelope* extents, INT32 width, INT32 height, double dpi, INT32 drawOrder, CREFSTRING format);
+ virtual MgByteReader* GetFeaturesKml(MgLayer* layer, MgEnvelope* extents, INT32 width, INT32 height, double dpi, INT32 drawOrder, CREFSTRING agentUri, CREFSTRING format);
+
private:
void AppendLayer(MgLayer* layer,
@@ -112,6 +114,16 @@
INT32 drawOrder,
KmlContent& kmlContent);
+ void AppendFeatures(MgLayer* layer,
+ MdfModel::LayerDefinition* layerDef,
+ MgEnvelope* extents,
+ CREFSTRING agentUri,
+ double scale,
+ double dpi,
+ INT32 drawOrder,
+ CREFSTRING sessionId,
+ KmlContent& kmlContent);
+
MgByteSource* GetByteSource(KmlContent& kmlContent, CREFSTRING format);
void InitializeResourceService();
@@ -128,6 +140,8 @@
double GetScale(MgEnvelope* llExtents, int width, int height, double dpi);
STRING GetSessionId();
+ STRING GetPointStyleImageUrl(STRING agentUri, MgLayer* layer, double scale, CREFSTRING sessionId);
+
Ptr<MgResourceService> m_svcResource;
Ptr<MgFeatureService> m_svcFeature;
Ptr<MgDrawingService> m_svcDrawing;
Modified: sandbox/adsk/2.2gp/Server/src/Services/Mapping/ServerMappingService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Mapping/ServerMappingService.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Server/src/Services/Mapping/ServerMappingService.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -45,7 +45,7 @@
//for use by observation mesh transformation
-const STRING SRS_LL84 = L"GEOGCS[\"LL84\",DATUM[\"WGS 84\",SPHEROID[\"WGS 84\",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degrees\",0.01745329252]]";
+const STRING SRS_LL84 = L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degrees\",0.01745329252]]";
IMPLEMENT_CREATE_SERVICE(MgServerMappingService)
Modified: sandbox/adsk/2.2gp/Server/src/UnitTesting/TestKmlService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/UnitTesting/TestKmlService.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Server/src/UnitTesting/TestKmlService.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -385,10 +385,11 @@
INT32 height = 717;
double dpi = 96;
INT32 drawOrder = 0;
+ STRING agentUri = L"http://myserver/mapguide/mapagent/mapagent.fcgi";
STRING format = L"KML";
//call GetLayerKml
- Ptr<MgByteReader> reader = m_svcKml->GetFeaturesKml(layer, extents, width, height, dpi, drawOrder, format);
+ Ptr<MgByteReader> reader = m_svcKml->GetFeaturesKml(layer, extents, width, height, dpi, drawOrder, agentUri, format);
STRING mimeType = reader->GetMimeType();
CPPUNIT_ASSERT(mimeType.compare(MgMimeType::Kml) == 0);
Modified: sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.cpp
===================================================================
--- sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.cpp 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.cpp 2011-03-14 02:39:49 UTC (rev 5620)
@@ -42,6 +42,9 @@
// Get the bounding box
m_boundingBox = params->GetParameterValue(MgHttpResourceStrings::reqKmlBoundingBox);
+ // Get the map agent Uri
+ m_agentUri = hRequest->GetAgentUri();
+
// Get the requested format
m_format = params->GetParameterValue(MgHttpResourceStrings::reqKmlFormat);
@@ -117,7 +120,7 @@
Ptr<MgKmlService> kmlService = dynamic_cast<MgKmlService*>(CreateService(MgServiceType::KmlService));
// Get the KML geometries
- Ptr<MgByteReader> reader = kmlService->GetFeaturesKml(layer, extents, m_width, m_height, m_dpi, m_drawOrder, m_format);
+ Ptr<MgByteReader> reader = kmlService->GetFeaturesKml(layer, extents, m_width, m_height, m_dpi, m_drawOrder, m_agentUri, m_format);
// Set the result
hResult->SetResultObject(reader, reader->GetMimeType());
Modified: sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.h
===================================================================
--- sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.h 2011-03-14 02:39:37 UTC (rev 5619)
+++ sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpKmlGetFeatures.h 2011-03-14 02:39:49 UTC (rev 5620)
@@ -61,6 +61,7 @@
double m_dpi;
INT32 m_width;
INT32 m_height;
+ STRING m_agentUri;
INT32 m_drawOrder;
};
More information about the mapguide-commits
mailing list