[mapguide-commits] r9206 - in sandbox/jng/geoprocessing: Common/PlatformBase/Services UnitTest/WebTier/MapAgent/MapAgentForms Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Jun 10 02:44:55 PDT 2017
Author: jng
Date: 2017-06-10 02:44:55 -0700 (Sat, 10 Jun 2017)
New Revision: 9206
Added:
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/geoprocessingapi.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/spatialpredicateform.html
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.h
Modified:
sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp
sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/services.html
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj.filters
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandlerBuild.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpRequest.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/Makefile.am
Log:
Implement mapagent operations for geo-processing:
- GEO.BUFFER
- Buffers the given input geometry (in WKT) with the desired distance as WKT or GeoJSON with optional transformation
- GEO.SIMPLIFY
- Simplifies the given input geometry (in WKT) with the simplification algorithm (Douglas-Peucker or Topology-Preserving) as WKT or GeoJSON with optional transformation
- GEO.SPATIALPREDICATE
- Tests if the given 2 input geometries (in WKT) satisifes the given spatial predicate operator
- GEO.BINARYOPERATION
- Performs the given operation against the 2 input geometries (in WKT) as WKT or GeoJSON with optional transformation
This includes mapagent forms to exercise said operations
Modified: sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp
===================================================================
--- sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -166,6 +166,24 @@
return ret;
}
+STRING MgGeoJsonWriter::GeometryToGeoJson(MgGeometry* geom)
+{
+ STRING ret;
+ MG_TRY()
+
+ ret = L"{ \"type\": \"Feature\", "; //START FEATURE
+ ret += L"\"properties\": {}, "; //PROPERTIES
+
+ STRING geomVal;
+ ToGeoJson(geom, geomVal);
+ ret += geomVal; //GEOMETRY
+
+ ret += L"}"; //END FEATURE
+
+ MG_CATCH_AND_THROW(L"MgGeoJsonWriter.GeometryToGeoJson")
+ return ret;
+}
+
void MgGeoJsonWriter::ValueToString(MgReader* reader, INT32 index, REFSTRING str)
{
INT32 propType = reader->GetPropertyType(index);
Modified: sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h
===================================================================
--- sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h 2017-06-10 09:44:55 UTC (rev 9206)
@@ -108,6 +108,9 @@
///
STRING FeatureToGeoJson(MgReader* reader, MgTransform* transform, CREFSTRING idPropertyName, CREFSTRING geomPropName);
+INTERNAL_API:
+ STRING GeometryToGeoJson(MgGeometry* geom);
+
protected:
virtual void Dispose();
Added: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html (rev 0)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<script type="text/javascript" src="setactiontarget.js" >
+</script>
+</head>
+<body>
+<form name="input" action="" method="get">
+<b>Operation:</b>
+<input type="text" name="OPERATION" value="GEO.BINARYOPERATION" size="50">
+<p> Version:
+<input type="text" name="VERSION" value="3.3.0" size="10">
+<p> Locale:
+<input type="text" name="LOCALE" value="en" size="10">
+<p> Client Agent:
+<input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
+<p> Geometry A (WKT):
+<input type="text" name="GEOMETRYA" value="" size="100">
+<p> Geometry B (WKT):
+<input type="text" name="GEOMETRYB" value="" size="100">
+<p> Operator:
+<select name="OPERATOR">
+ <option value="UNION">Union</option>
+ <option value="DIFFERENCE">Difference</option>
+ <option value="INTERSECTION">Intersection</option>
+ <option value="SYMMETRICDIFFERENCE">SymmetricDifference</option>
+</select>
+<p> Output Format:
+<select name="FORMAT">
+ <option value="WKT">Geometry Well-Known Text</option>
+ <option value="GEOJSON">GeoJSON</option>
+</select>
+<p> Input Coordinate System (CS-Map Code):
+<input type="text" name="COORDINATESYSTEM" value="" size="10">
+<p> Output Coordinate System (CS-Map Code):
+<input type="text" name="TRANSFORMTO" value="" size="10">
+<p>
+<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
+</form>
+</body>
+</html>
+<html>
Added: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html (rev 0)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<script type="text/javascript" src="setactiontarget.js" >
+</script>
+</head>
+<body>
+<form name="input" action="" method="get">
+<b>Operation:</b>
+<input type="text" name="OPERATION" value="GEO.BUFFER" size="50">
+<p> Version:
+<input type="text" name="VERSION" value="3.3.0" size="10">
+<p> Locale:
+<input type="text" name="LOCALE" value="en" size="10">
+<p> Client Agent:
+<input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
+<p> Geometry (WKT):
+<input type="text" name="GEOMETRY" value="" size="100">
+<p> Buffer Distance:
+<input type="text" name="DISTANCE" value="" size="10">
+<p> Buffer Units:
+<select name="UNITS">
+ <option value="mi">Miles</option>
+ <option value="km">Kilometers</option>
+ <option value="ft">Feet</option>
+ <option value="m">Meters</option>
+</select>
+<p> Output Format:
+<select name="FORMAT">
+ <option value="WKT">Geometry Well-Known Text</option>
+ <option value="GEOJSON">GeoJSON</option>
+</select>
+<p> Input Coordinate System (CS-Map Code):
+<input type="text" name="COORDINATESYSTEM" value="" size="10">
+<p> Output Coordinate System (CS-Map Code):
+<input type="text" name="TRANSFORMTO" value="" size="10">
+<p>
+<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
+</form>
+</body>
+</html>
+<html>
Added: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/geoprocessingapi.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/geoprocessingapi.html (rev 0)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/geoprocessingapi.html 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title></title>
+ <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
+ <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ </head>
+ <body>
+ <UL>
+ <LI>
+ <A href="bufferform.html" target="showform">Buffer</A>
+ <LI>
+ <A href="simplifyform.html" target="showform">Simplify</A>
+ <LI>
+ <A href="binaryoperationform.html" target="showform">BinaryOperation</A>
+ <LI>
+ <A href="spatialpredicateform.html" target="showform">SpatialPredicate</A>
+ </UL>
+ </body>
+</html>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/services.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/services.html 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/services.html 2017-06-10 09:44:55 UTC (rev 9206)
@@ -11,6 +11,7 @@
<b>Services API</b>
<li><a href="drawingserviceapi.html" target="apilist">Drawing</a></li>
<li><a href="featureserviceapi.html" target="apilist">Feature</a></li>
+<li><a href="geoprocessingapi.html" target="apilist">Geo-Processing</a></li>
<li><a href="mappingserviceapi.html" target="apilist">Mapping</a></li>
<li><a href="renderingserviceapi.html" target="apilist">Rendering</a></li>
<li><a href="resourceserviceapi.html" target="apilist">Resource</a></li>
Added: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html (rev 0)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,40 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<script type="text/javascript" src="setactiontarget.js" >
+</script>
+</head>
+<body>
+<form name="input" action="" method="get">
+<b>Operation:</b>
+<input type="text" name="OPERATION" value="GEO.SIMPLIFY" size="50">
+<p> Version:
+<input type="text" name="VERSION" value="3.3.0" size="10">
+<p> Locale:
+<input type="text" name="LOCALE" value="en" size="10">
+<p> Client Agent:
+<input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
+<p> Geometry (WKT):
+<input type="text" name="GEOMETRY" value="" size="100">
+<p> Algorithm:
+<select name="ALGORITHM">
+ <option value="0">Douglas-Peucker</option>
+ <option value="1">Topology Preserving</option>
+</select>
+<p> Tolerance:
+<input type="text" name="TOLERANCE" value="" size="10">
+<p> Output Format:
+<select name="FORMAT">
+ <option value="WKT">Geometry Well-Known Text</option>
+ <option value="GEOJSON">GeoJSON</option>
+</select>
+<p> Input Coordinate System (CS-Map Code):
+<input type="text" name="COORDINATESYSTEM" value="" size="10">
+<p> Output Coordinate System (CS-Map Code):
+<input type="text" name="TRANSFORMTO" value="" size="10">
+<p>
+<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
+</form>
+</body>
+</html>
+<html>
Added: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/spatialpredicateform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/spatialpredicateform.html (rev 0)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/spatialpredicateform.html 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,37 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<script type="text/javascript" src="setactiontarget.js" >
+</script>
+</head>
+<body>
+<form name="input" action="" method="get">
+<b>Operation:</b>
+<input type="text" name="OPERATION" value="GEO.SPATIALPREDICATE" size="50">
+<p> Version:
+<input type="text" name="VERSION" value="3.3.0" size="10">
+<p> Locale:
+<input type="text" name="LOCALE" value="en" size="10">
+<p> Client Agent:
+<input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
+<p> Geometry A (WKT):
+<input type="text" name="GEOMETRYA" value="" size="100">
+<p> Geometry B (WKT):
+<input type="text" name="GEOMETRYB" value="" size="100">
+<p> Operator:
+<select name="OPERATOR">
+ <option value="CONTAINS">Contains</option>
+ <option value="CROSSES">Crosses</option>
+ <option value="DISJOINT">Disjoint</option>
+ <option value="EQUALS">Equals</option>
+ <option value="INTERSECTS">Intersects</option>
+ <option value="OVERLAPS">Overlaps</option>
+ <option value="TOUCHES">Touches</option>
+ <option value="WITHIN">Within</option>
+</select>
+<p>
+<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
+</form>
+</body>
+</html>
+<html>
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,117 @@
+//
+// Copyright (C) 2004-2017 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 "HttpHandler.h"
+#include "HttpGeoBinaryOperation.h"
+
+HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpGeoBinaryOperation)
+
+MgHttpGeoBinaryOperation::MgHttpGeoBinaryOperation(MgHttpRequest* hRequest)
+{
+ InitializeCommonParameters(hRequest);
+
+ Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
+ m_geomWKT_A = params->GetParameterValue(MgHttpResourceStrings::reqGeoA);
+ m_geomWKT_B = params->GetParameterValue(MgHttpResourceStrings::reqGeoB);
+ m_operator = params->GetParameterValue(MgHttpResourceStrings::reqGeoOperator);
+ m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
+ m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
+ m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+}
+
+void MgHttpGeoBinaryOperation::Execute(MgHttpResponse & hResponse)
+{
+ Ptr<MgHttpResult> hResult = hResponse.GetResult();
+
+ MG_HTTP_HANDLER_TRY()
+
+ // Check common parameters
+ ValidateCommonParameters();
+
+ Ptr<MgWktReaderWriter> wktRw = new MgWktReaderWriter();
+ Ptr<MgGeometry> geomA = wktRw->Read(m_geomWKT_A);
+ Ptr<MgGeometry> geomB = wktRw->Read(m_geomWKT_B);
+ Ptr<MgGeometry> result;
+
+ if (m_operator == L"UNION")
+ result = geomA->Union(geomB);
+ else if (m_operator == L"DIFFERENCE")
+ result = geomA->Difference(geomB);
+ else if (m_operator == L"INTERSECTION")
+ result = geomA->Intersection(geomB);
+ else if (m_operator == L"SYMMETRICDIFFERENCE")
+ result = geomA->SymetricDifference(geomB);
+ else
+ {
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqGeoOperator);
+ arguments.Add(m_operator);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoBinaryOperation.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgInvalidFeatureSpatialOperation", NULL);
+ }
+
+ if (!m_transformTo.empty())
+ {
+ Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
+ Ptr<MgCoordinateSystem> cs = csFactory->CreateFromCode(m_coordinateSystem);
+ Ptr<MgCoordinateSystem> target = csFactory->CreateFromCode(m_transformTo);
+
+ Ptr<MgCoordinateSystemTransform> xform = csFactory->GetTransform(cs, target);
+ Ptr<MgGeometry> xGeom = (MgGeometry*)result->Transform(xform);
+
+ result = xGeom;
+ }
+
+ if (m_format == L"WKT")
+ {
+ STRING wkt = wktRw->Write(result);
+ Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(wkt);
+ hResult->SetResultObject(value, MgMimeType::Text);
+ }
+ else if (m_format == L"GEOJSON")
+ {
+ MgGeoJsonWriter gw;
+ STRING geoJson = gw.GeometryToGeoJson(result);
+
+ std::string mbGeoJson;
+ MgUtil::WideCharToMultiByte(geoJson, mbGeoJson);
+
+ Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)mbGeoJson.c_str(), (INT32)mbGeoJson.length());
+ byteSource->SetMimeType(MgMimeType::Json);
+ Ptr<MgByteReader> byteReader = byteSource->GetReader();
+
+ hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGeoBinaryOperation.Execute")
+}
+
+void MgHttpGeoBinaryOperation::ValidateOperationVersion()
+{
+ MG_HTTP_HANDLER_TRY()
+
+ // There are multiple supported versions
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version != MG_API_VERSION(3, 3, 0))
+ {
+ throw new MgInvalidOperationVersionException(
+ L"MgHttpGeoBinaryOperation.ValidateOperationVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW(L"MgHttpGeoBinaryOperation.ValidateOperationVersion");
+}
\ No newline at end of file
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,64 @@
+//
+// Copyright (C) 2004-2017 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_HTTP_GEO_BINARY_OPERATION_H
+#define MG_HTTP_GEO_BINARY_OPERATION_H
+
+class MgHttpGeoBinaryOperation : public MgHttpRequestResponseHandler
+{
+ HTTP_DECLARE_CREATE_OBJECT()
+
+public:
+ /// <summary>
+ /// Initializes the common parameters of the request.
+ /// </summary>
+ /// <param name="name">Input
+ /// MgHttpRequest
+ /// This contains all the parameters of the request.
+ /// </param>
+ /// <returns>
+ /// nothing
+ /// </returns>
+ MgHttpGeoBinaryOperation(MgHttpRequest *hRequest);
+
+ /// <summary>
+ /// Executes the specific request.
+ /// </summary>
+ /// <param name="hResponse">Input
+ /// This contains the response (including MgHttpResult and StatusCode) from the server.
+ /// </param>
+ void Execute(MgHttpResponse& hResponse);
+
+ /// <summary>
+ /// Returns the classification of this request/response handler
+ /// </summary>
+ /// <returns>
+ /// Classification of handler
+ /// </returns>
+ MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcViewer; }
+
+ virtual void ValidateOperationVersion();
+private:
+ STRING m_geomWKT_A;
+ STRING m_geomWKT_B;
+ STRING m_operator;
+ STRING m_format;
+ STRING m_coordinateSystem;
+ STRING m_transformTo;
+};
+
+#endif
\ No newline at end of file
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,139 @@
+//
+// Copyright (C) 2004-2017 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 "HttpHandler.h"
+#include "HttpGeoBuffer.h"
+
+HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpGeoBuffer)
+
+MgHttpGeoBuffer::MgHttpGeoBuffer(MgHttpRequest* hRequest)
+{
+ InitializeCommonParameters(hRequest);
+
+ Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
+ m_geomWKT = params->GetParameterValue(MgHttpResourceStrings::reqFeatGeometry);
+ m_units = params->GetParameterValue(MgHttpResourceStrings::reqGeoBufferUnits);
+ m_distance = MgUtil::StringToDouble(params->GetParameterValue(MgHttpResourceStrings::reqGeoBufferDistance));
+ m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
+ m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
+ m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+}
+
+void MgHttpGeoBuffer::Execute(MgHttpResponse & hResponse)
+{
+ Ptr<MgHttpResult> hResult = hResponse.GetResult();
+
+ MG_HTTP_HANDLER_TRY()
+
+ // Check common parameters
+ ValidateCommonParameters();
+
+ if (m_geomWKT.empty())
+ {
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqFeatGeometry);
+ arguments.Add(MgResources::BlankArgument);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoBuffer.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
+ }
+
+ if (m_coordinateSystem.empty())
+ {
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqGeoCoordinateSystem);
+ arguments.Add(MgResources::BlankArgument);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoBuffer.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
+ }
+
+ if (m_format != L"WKT" && m_format != L"GEOJSON")
+ {
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqGeoFormat);
+ arguments.Add(m_format);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoBuffer.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgInvalidValueOutsideRange", NULL);
+ }
+
+ //Convert distance to meters
+ if (m_units == L"mi") //miles
+ m_distance *= 1609.35;
+ else if (m_units == L"km") //kilometers
+ m_distance *= 1000;
+ else if (m_units == L"ft") //feet
+ m_distance *= 0.30480;
+
+ Ptr<MgWktReaderWriter> wktRw = new MgWktReaderWriter();
+ Ptr<MgGeometry> input = wktRw->Read(m_geomWKT);
+
+ Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
+ Ptr<MgCoordinateSystem> cs = csFactory->CreateFromCode(m_coordinateSystem);
+ Ptr<MgMeasure> measure = cs->GetMeasure();
+
+ double bufDist = cs->ConvertMetersToCoordinateSystemUnits(m_distance);
+ Ptr<MgGeometry> result = input->Buffer(bufDist, measure);
+
+ if (!m_transformTo.empty())
+ {
+ Ptr<MgCoordinateSystem> target = csFactory->CreateFromCode(m_transformTo);
+ Ptr<MgCoordinateSystemTransform> xform = csFactory->GetTransform(cs, target);
+ Ptr<MgGeometry> xGeom = (MgGeometry*)result->Transform(xform);
+
+ result = xGeom;
+ }
+
+ if (m_format == L"WKT")
+ {
+ STRING wkt = wktRw->Write(result);
+ Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(wkt);
+ hResult->SetResultObject(value, MgMimeType::Text);
+ }
+ else if (m_format == L"GEOJSON")
+ {
+ MgGeoJsonWriter gw;
+ STRING geoJson = gw.GeometryToGeoJson(result);
+
+ std::string mbGeoJson;
+ MgUtil::WideCharToMultiByte(geoJson, mbGeoJson);
+
+ Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)mbGeoJson.c_str(), (INT32)mbGeoJson.length());
+ byteSource->SetMimeType(MgMimeType::Json);
+ Ptr<MgByteReader> byteReader = byteSource->GetReader();
+
+ hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGeoBuffer.Execute")
+}
+
+void MgHttpGeoBuffer::ValidateOperationVersion()
+{
+ MG_HTTP_HANDLER_TRY()
+
+ // There are multiple supported versions
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version != MG_API_VERSION(3, 3, 0))
+ {
+ throw new MgInvalidOperationVersionException(
+ L"MgHttpGeoBuffer.ValidateOperationVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW(L"MgHttpGeoBuffer.ValidateOperationVersion");
+}
\ No newline at end of file
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,65 @@
+//
+// Copyright (C) 2004-2017 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_HTTP_GEO_BUFFER_H
+#define MG_HTTP_GEO_BUFFER_H
+
+class MgHttpGeoBuffer : public MgHttpRequestResponseHandler
+{
+ HTTP_DECLARE_CREATE_OBJECT()
+
+public:
+ /// <summary>
+ /// Initializes the common parameters of the request.
+ /// </summary>
+ /// <param name="name">Input
+ /// MgHttpRequest
+ /// This contains all the parameters of the request.
+ /// </param>
+ /// <returns>
+ /// nothing
+ /// </returns>
+ MgHttpGeoBuffer(MgHttpRequest *hRequest);
+
+ /// <summary>
+ /// Executes the specific request.
+ /// </summary>
+ /// <param name="hResponse">Input
+ /// This contains the response (including MgHttpResult and StatusCode) from the server.
+ /// </param>
+ void Execute(MgHttpResponse& hResponse);
+
+ /// <summary>
+ /// Returns the classification of this request/response handler
+ /// </summary>
+ /// <returns>
+ /// Classification of handler
+ /// </returns>
+ MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcViewer; }
+
+ virtual void ValidateOperationVersion();
+
+private:
+ STRING m_geomWKT;
+ STRING m_units;
+ double m_distance;
+ STRING m_format;
+ STRING m_coordinateSystem;
+ STRING m_transformTo;
+};
+
+#endif
\ No newline at end of file
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,121 @@
+//
+// Copyright (C) 2004-2017 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 "HttpHandler.h"
+#include "HttpGeoSimplify.h"
+
+HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpGeoSimplify)
+
+MgHttpGeoSimplify::MgHttpGeoSimplify(MgHttpRequest* hRequest)
+{
+ InitializeCommonParameters(hRequest);
+ Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
+ m_geomWKT = params->GetParameterValue(MgHttpResourceStrings::reqFeatGeometry);
+ m_algorithm = MgUtil::StringToInt32(params->GetParameterValue(MgHttpResourceStrings::reqGeoAlgorithm));
+ m_tolerance = MgUtil::StringToDouble(params->GetParameterValue(MgHttpResourceStrings::reqGeoTolerance));
+ m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
+ m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
+ m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+}
+
+void MgHttpGeoSimplify::Execute(MgHttpResponse & hResponse)
+{
+ Ptr<MgHttpResult> hResult = hResponse.GetResult();
+
+ MG_HTTP_HANDLER_TRY()
+
+ // Check common parameters
+ ValidateCommonParameters();
+
+ if (m_geomWKT.empty())
+ {
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqFeatGeometry);
+ arguments.Add(MgResources::BlankArgument);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoSimplify.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
+ }
+
+ if (m_algorithm != MgGeometrySimplificationAlgorithmType::DouglasPeucker &&
+ m_algorithm != MgGeometrySimplificationAlgorithmType::TopologyPreserving)
+ {
+ STRING arg;
+ MgUtil::Int32ToString(m_algorithm, arg);
+
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqGeoAlgorithm);
+ arguments.Add(arg);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoSimplify.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgInvalidValueOutsideRange", NULL);
+ }
+
+ Ptr<MgWktReaderWriter> wktRw = new MgWktReaderWriter();
+ Ptr<MgGeometry> input = wktRw->Read(m_geomWKT);
+ Ptr<MgGeometrySimplifier> simp = new MgGeometrySimplifier();
+ Ptr<MgGeometry> result = simp->Simplify(input, m_tolerance, m_algorithm);
+
+ if (!m_transformTo.empty())
+ {
+ Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
+ Ptr<MgCoordinateSystem> cs = csFactory->CreateFromCode(m_coordinateSystem);
+ Ptr<MgCoordinateSystem> target = csFactory->CreateFromCode(m_transformTo);
+ Ptr<MgCoordinateSystemTransform> xform = csFactory->GetTransform(cs, target);
+ Ptr<MgGeometry> xGeom = (MgGeometry*)result->Transform(xform);
+
+ result = xGeom;
+ }
+
+ if (m_format == L"WKT")
+ {
+ STRING wkt = wktRw->Write(result);
+ Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(wkt);
+ hResult->SetResultObject(value, MgMimeType::Text);
+ }
+ else if (m_format == L"GEOJSON")
+ {
+ MgGeoJsonWriter gw;
+ STRING geoJson = gw.GeometryToGeoJson(result);
+
+ std::string mbGeoJson;
+ MgUtil::WideCharToMultiByte(geoJson, mbGeoJson);
+
+ Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)mbGeoJson.c_str(), (INT32)mbGeoJson.length());
+ byteSource->SetMimeType(MgMimeType::Json);
+ Ptr<MgByteReader> byteReader = byteSource->GetReader();
+
+ hResult->SetResultObject(byteReader, byteReader->GetMimeType());
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGeoSimplify.Execute")
+}
+
+void MgHttpGeoSimplify::ValidateOperationVersion()
+{
+ MG_HTTP_HANDLER_TRY()
+
+ // There are multiple supported versions
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version != MG_API_VERSION(3, 3, 0))
+ {
+ throw new MgInvalidOperationVersionException(
+ L"MgHttpGeoSimplify.ValidateOperationVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW(L"MgHttpGeoSimplify.ValidateOperationVersion");
+}
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,65 @@
+//
+// Copyright (C) 2004-2017 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_HTTP_GEO_SIMPLIFY_H
+#define MG_HTTP_GEO_SIMPLIFY_H
+
+class MgHttpGeoSimplify : public MgHttpRequestResponseHandler
+{
+ HTTP_DECLARE_CREATE_OBJECT()
+
+public:
+ /// <summary>
+ /// Initializes the common parameters of the request.
+ /// </summary>
+ /// <param name="name">Input
+ /// MgHttpRequest
+ /// This contains all the parameters of the request.
+ /// </param>
+ /// <returns>
+ /// nothing
+ /// </returns>
+ MgHttpGeoSimplify(MgHttpRequest *hRequest);
+
+ /// <summary>
+ /// Executes the specific request.
+ /// </summary>
+ /// <param name="hResponse">Input
+ /// This contains the response (including MgHttpResult and StatusCode) from the server.
+ /// </param>
+ void Execute(MgHttpResponse& hResponse);
+
+ /// <summary>
+ /// Returns the classification of this request/response handler
+ /// </summary>
+ /// <returns>
+ /// Classification of handler
+ /// </returns>
+ MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcViewer; }
+
+ virtual void ValidateOperationVersion();
+
+private:
+ STRING m_geomWKT;
+ INT32 m_algorithm;
+ double m_tolerance;
+ STRING m_format;
+ STRING m_coordinateSystem;
+ STRING m_transformTo;
+};
+
+#endif
\ No newline at end of file
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.cpp (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,93 @@
+//
+// Copyright (C) 2004-2017 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 "HttpHandler.h"
+#include "HttpGeoSpatialPredicate.h"
+
+HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpGeoSpatialPredicate)
+
+MgHttpGeoSpatialPredicate::MgHttpGeoSpatialPredicate(MgHttpRequest* hRequest)
+{
+ InitializeCommonParameters(hRequest);
+
+ Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
+ m_geomWKT_A = params->GetParameterValue(MgHttpResourceStrings::reqGeoA);
+ m_geomWKT_B = params->GetParameterValue(MgHttpResourceStrings::reqGeoB);
+ m_operator = params->GetParameterValue(MgHttpResourceStrings::reqGeoOperator);
+}
+
+
+void MgHttpGeoSpatialPredicate::Execute(MgHttpResponse & hResponse)
+{
+ Ptr<MgHttpResult> hResult = hResponse.GetResult();
+
+ MG_HTTP_HANDLER_TRY()
+
+ // Check common parameters
+ ValidateCommonParameters();
+
+ Ptr<MgWktReaderWriter> wktRw = new MgWktReaderWriter();
+ Ptr<MgGeometry> geomA = wktRw->Read(m_geomWKT_A);
+ Ptr<MgGeometry> geomB = wktRw->Read(m_geomWKT_B);
+ bool result = false;
+
+ if (m_operator == L"CONTAINS")
+ result = geomA->Contains(geomB);
+ else if (m_operator == L"CROSSES")
+ result = geomA->Crosses(geomB);
+ else if (m_operator == L"DISJOINT")
+ result = geomA->Disjoint(geomB);
+ else if (m_operator == L"EQUALS")
+ result = geomA->Equals(geomB);
+ else if (m_operator == L"INTERSECTS")
+ result = geomA->Intersects(geomB);
+ else if (m_operator == L"OVERLAPS")
+ result = geomA->Overlaps(geomB);
+ else if (m_operator == L"TOUCHES")
+ result = geomA->Touches(geomB);
+ else if (m_operator == L"WITHIN")
+ result = geomA->Within(geomB);
+ else
+ {
+ MgStringCollection arguments;
+ arguments.Add(MgHttpResourceStrings::reqGeoOperator);
+ arguments.Add(m_operator);
+
+ throw new MgInvalidArgumentException(L"MgHttpGeoSpatialPredicate.Execute",
+ __LINE__, __WFILE__, &arguments, L"MgInvalidFeatureSpatialOperation", NULL);
+ }
+
+ Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(result);
+ hResult->SetResultObject(value, MgMimeType::Text);
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGeoSpatialPredicate.Execute")
+}
+
+void MgHttpGeoSpatialPredicate::ValidateOperationVersion()
+{
+ MG_HTTP_HANDLER_TRY()
+
+ // There are multiple supported versions
+ INT32 version = m_userInfo->GetApiVersion();
+ if (version != MG_API_VERSION(3, 3, 0))
+ {
+ throw new MgInvalidOperationVersionException(
+ L"MgHttpGeoSpatialPredicate.ValidateOperationVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW(L"MgHttpGeoSpatialPredicate.ValidateOperationVersion");
+}
\ No newline at end of file
Added: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.h (rev 0)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSpatialPredicate.h 2017-06-10 09:44:55 UTC (rev 9206)
@@ -0,0 +1,62 @@
+//
+// Copyright (C) 2004-2017 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_HTTP_GEO_SPATIAL_PREDICATE_H
+#define MG_HTTP_GEO_SPATIAL_PREDICATE_H
+
+class MgHttpGeoSpatialPredicate : public MgHttpRequestResponseHandler
+{
+ HTTP_DECLARE_CREATE_OBJECT()
+
+public:
+ /// <summary>
+ /// Initializes the common parameters of the request.
+ /// </summary>
+ /// <param name="name">Input
+ /// MgHttpRequest
+ /// This contains all the parameters of the request.
+ /// </param>
+ /// <returns>
+ /// nothing
+ /// </returns>
+ MgHttpGeoSpatialPredicate(MgHttpRequest *hRequest);
+
+ /// <summary>
+ /// Executes the specific request.
+ /// </summary>
+ /// <param name="hResponse">Input
+ /// This contains the response (including MgHttpResult and StatusCode) from the server.
+ /// </param>
+ void Execute(MgHttpResponse& hResponse);
+
+ /// <summary>
+ /// Returns the classification of this request/response handler
+ /// </summary>
+ /// <returns>
+ /// Classification of handler
+ /// </returns>
+ MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcViewer; }
+
+ virtual void ValidateOperationVersion();
+
+private:
+ STRING m_geomWKT_A;
+ STRING m_geomWKT_B;
+ STRING m_operator;
+};
+
+#endif
\ No newline at end of file
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj 2017-06-10 09:44:55 UTC (rev 9206)
@@ -282,6 +282,30 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="HttpGeoBinaryOperation.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="HttpGeoBuffer.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="HttpGeoSimplify.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="HttpGeoSpatialPredicate.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="HttpGetRepositoryContent.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -957,6 +981,10 @@
<ClInclude Include="HttpEnumerateResourceReferences.h" />
<ClInclude Include="HttpEnumerateResources.h" />
<ClInclude Include="HttpEnumerateUnmanagedData.h" />
+ <ClInclude Include="HttpGeoBuffer.h" />
+ <ClInclude Include="HttpGeoBinaryOperation.h" />
+ <ClInclude Include="HttpGeoSimplify.h" />
+ <ClInclude Include="HttpGeoSpatialPredicate.h" />
<ClInclude Include="HttpGetRepositoryContent.h" />
<ClInclude Include="HttpGetRepositoryHeader.h" />
<ClInclude Include="HttpGetResourceContent.h" />
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj.filters
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj.filters 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandler.vcxproj.filters 2017-06-10 09:44:55 UTC (rev 9206)
@@ -40,6 +40,9 @@
<Filter Include="Byte Source Adapters">
<UniqueIdentifier>{0f2e34d9-18f7-49af-b11f-8d3c874192ec}</UniqueIdentifier>
</Filter>
+ <Filter Include="GeoProcessing">
+ <UniqueIdentifier>{d7514524-5f3c-40fd-8b93-45a3020d8614}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="HttpApplyResourcePackage.cpp">
@@ -386,6 +389,18 @@
<ClCompile Include="HttpDescribeRuntimeMap.cpp">
<Filter>Mapping Service</Filter>
</ClCompile>
+ <ClCompile Include="HttpGeoBuffer.cpp">
+ <Filter>GeoProcessing</Filter>
+ </ClCompile>
+ <ClCompile Include="HttpGeoBinaryOperation.cpp">
+ <Filter>GeoProcessing</Filter>
+ </ClCompile>
+ <ClCompile Include="HttpGeoSimplify.cpp">
+ <Filter>GeoProcessing</Filter>
+ </ClCompile>
+ <ClCompile Include="HttpGeoSpatialPredicate.cpp">
+ <Filter>GeoProcessing</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="HttpApplyResourcePackage.h">
@@ -757,6 +772,18 @@
<ClInclude Include="HttpDescribeRuntimeMap.h">
<Filter>Mapping Service</Filter>
</ClInclude>
+ <ClInclude Include="HttpGeoBuffer.h">
+ <Filter>GeoProcessing</Filter>
+ </ClInclude>
+ <ClInclude Include="HttpGeoSimplify.h">
+ <Filter>GeoProcessing</Filter>
+ </ClInclude>
+ <ClInclude Include="HttpGeoSpatialPredicate.h">
+ <Filter>GeoProcessing</Filter>
+ </ClInclude>
+ <ClInclude Include="HttpGeoBinaryOperation.h">
+ <Filter>GeoProcessing</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="HttpHandler.rc" />
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandlerBuild.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandlerBuild.cpp 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpHandlerBuild.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -55,6 +55,10 @@
#include "HttpEnumerateApplicationTemplates.cpp"
#include "HttpEnumerateApplicationWidgets.cpp"
#include "HttpEnumerateApplicationContainers.cpp"
+#include "HttpGeoBuffer.cpp"
+#include "HttpGeoBinaryOperation.cpp"
+#include "HttpGeoSimplify.cpp"
+#include "HttpGeoSpatialPredicate.cpp"
#include "HttpGetCapabilities.cpp"
#include "HttpGetConnectionPropertyValues.cpp"
#include "HttpGetDefaultTileSizeX.cpp"
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpRequest.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpRequest.cpp 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpRequest.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -124,6 +124,12 @@
#include "HttpCsGetBaseLibrary.h"
#include "HttpCsIsValid.h"
+// Geo-Processing
+#include "HttpGeoBuffer.h"
+#include "HttpGeoBinaryOperation.h"
+#include "HttpGeoSimplify.h"
+#include "HttpGeoSpatialPredicate.h"
+
#include <algorithm>
using namespace std;
@@ -431,6 +437,10 @@
httpClassCreators[MgHttpResourceStrings::opEnumerateApplicationContainers] = MgHttpEnumerateApplicationContainers::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetDefaultTileSizeX] = MgHttpGetDefaultTileSizeX::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetDefaultTileSizeY] = MgHttpGetDefaultTileSizeY::CreateObject;
+ httpClassCreators[MgHttpResourceStrings::opGeoBuffer] = MgHttpGeoBuffer::CreateObject;
+ httpClassCreators[MgHttpResourceStrings::opGeoBinaryOperation] = MgHttpGeoBinaryOperation::CreateObject;
+ httpClassCreators[MgHttpResourceStrings::opGeoSimplify] = MgHttpGeoSimplify::CreateObject;
+ httpClassCreators[MgHttpResourceStrings::opGeoSpatialPredicate] = MgHttpGeoSpatialPredicate::CreateObject;
httpPostHandlerCreators.push_back(MgHttpWfsGetCapabilities::ProcessPostRequest);
httpPostHandlerCreators.push_back(MgHttpWfsDescribeFeatureType::ProcessPostRequest);
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp 2017-06-10 09:44:55 UTC (rev 9206)
@@ -363,6 +363,23 @@
const STRING MgHttpResourceStrings::opEnumerateApplicationWidgets = L"ENUMERATEAPPLICATIONWIDGETS";
const STRING MgHttpResourceStrings::opEnumerateApplicationContainers = L"ENUMERATEAPPLICATIONCONTAINERS";
+// Geo-Processing Operations
+const STRING MgHttpResourceStrings::opGeoBuffer = L"GEO.BUFFER";
+const STRING MgHttpResourceStrings::opGeoSimplify = L"GEO.SIMPLIFY";
+const STRING MgHttpResourceStrings::opGeoSpatialPredicate = L"GEO.SPATIALPREDICATE";
+const STRING MgHttpResourceStrings::opGeoBinaryOperation = L"GEO.BINARYOPERATION";
+
+const STRING MgHttpResourceStrings::reqGeoA = L"GEOMETRYA";
+const STRING MgHttpResourceStrings::reqGeoB = L"GEOMETRYB";
+const STRING MgHttpResourceStrings::reqGeoBufferDistance = L"DISTANCE";
+const STRING MgHttpResourceStrings::reqGeoBufferUnits = L"UNITS";
+const STRING MgHttpResourceStrings::reqGeoOperator = L"OPERATOR";
+const STRING MgHttpResourceStrings::reqGeoCoordinateSystem = L"COORDINATESYSTEM";
+const STRING MgHttpResourceStrings::reqGeoFormat = L"FORMAT";
+const STRING MgHttpResourceStrings::reqGeoTransformTo = L"TRANSFORMTO";
+const STRING MgHttpResourceStrings::reqGeoAlgorithm = L"ALGORITHM";
+const STRING MgHttpResourceStrings::reqGeoTolerance = L"TOLERANCE";
+
// Coordinate System Request Parameters
const STRING MgHttpResourceStrings::reqCsWkt = L"CSWKT";
const STRING MgHttpResourceStrings::reqCsCode = L"CSCODE";
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h 2017-06-10 09:44:55 UTC (rev 9206)
@@ -367,7 +367,23 @@
static const STRING opEnumerateApplicationWidgets;
static const STRING opEnumerateApplicationContainers;
+ // Geo-Processing Operations
+ static const STRING opGeoBuffer;
+ static const STRING opGeoSimplify;
+ static const STRING opGeoSpatialPredicate;
+ static const STRING opGeoBinaryOperation;
+ static const STRING reqGeoA;
+ static const STRING reqGeoB;
+ static const STRING reqGeoBufferDistance;
+ static const STRING reqGeoBufferUnits;
+ static const STRING reqGeoOperator;
+ static const STRING reqGeoCoordinateSystem;
+ static const STRING reqGeoFormat;
+ static const STRING reqGeoTransformTo;
+ static const STRING reqGeoAlgorithm;
+ static const STRING reqGeoTolerance;
+
// Coordinate System Request Parameters
static const STRING reqCsWkt;
static const STRING reqCsCode;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/Makefile.am
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/Makefile.am 2017-06-09 13:54:30 UTC (rev 9205)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/Makefile.am 2017-06-10 09:44:55 UTC (rev 9206)
@@ -54,6 +54,10 @@
HttpEnumerateApplicationContainers.cpp \
HttpEnumerateApplicationWidgets.cpp \
HttpEnumerateApplicationTemplates.cpp \
+ HttpGeoBinaryOperation.cpp \
+ HttpGeoBuffer.cpp \
+ HttpGeoSimplify.cpp \
+ HttpGeoSpatialPredicate.cpp \
HttpGetCapabilities.cpp \
HttpGetClassDefinition.cpp \
HttpGetClasses.cpp \
@@ -179,6 +183,10 @@
HttpEnumerateApplicationContainers.h \
HttpEnumerateApplicationWidgets.h \
HttpEnumerateApplicationTemplates.h \
+ HttpGeoBinaryOperation.h \
+ HttpGeoBuffer.h \
+ HttpGeoSimplify.h \
+ HttpGeoSpatialPredicate.h \
HttpGetCapabilities.h \
HttpGetClassDefinition.h \
HttpGetClasses.h \
More information about the mapguide-commits
mailing list