ArcGIS Explorer Component Help |
SoapConverter..::.GeometryToSoap<(Of <(TExplorer, TSoap>)>) Method (TExplorer) |
SoapConverter Class Example See Also |
Converts an ArcGIS Explorer Geometry object to an ArcGIS Server SOAP object.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static TSoap GeometryToSoap<TExplorer, TSoap>( TExplorer explorerGeometry ) where TExplorer : Geometry |
Visual Basic (Declaration) |
---|
Public Shared Function GeometryToSoap(Of TExplorer As Geometry, TSoap) ( _ explorerGeometry As TExplorer _ ) As TSoap |
Parameters
- explorerGeometry
- Type: TExplorer
The ArcGIS Explorer Geometry object to convert to a SOAP object.
Type Parameters
- TExplorer
- The Type of the ArcGIS Explorer Geometry class passed in to this method in the explorerGeometry parameter.
- TSoap
- The Type of SOAP object to convert the explorerGeometry to. Must be the appropriate SOAP Type to match the TExplorer type parameter.
Return Value
A SOAP geometry object of type TSoap based on the properties of the explorerGeometry.Remarks
Use this method to convert ArcGIS Explorer Point, Multipoint, Polyline, Polygon or Envelope objects into corresponding SOAP objects. You must specify the Type of both ArcGIS Explorer object and returned SOAP type as the type parameters for this generic method. Specify the SOAP Type by passing in the Type defined in your web service reference.
You must always specify the most-derived Type - for example specify a SOAP Type of PointN, and not Point. This method cannot be used to convert binary SOAP objects (those Types ending in 'B', for example PointB, EnvelopeB).
This method cannot be used to convert Multipatch objects.
Examples
The code below shows you how to convert ArcGIS Explorer geometry objects to SOAP geometry objects
by using the GeometryToSoap generic method. ArcGIS Explorer Types are fully-qualified to avoid confusion, with
the exception of the SOAP types - you must ensure you have a using/Imports statement to your
SOAP web reference namespace or fully-qualify the SOAP types in your own code.
CopyC#
// Remember you will need a using (Imports in Visual Basic) statement to the namespace of the SOAP definitions // for your web references, e.g. the namespace containing the PointN SOAP type. // Create an ArcGIS Explorer Point. ESRI.ArcGISExplorer.Geometry.Point xoPoint = new ESRI.ArcGISExplorer.Geometry.Point(3, 4, 5); // Convert to a SOAP PointN with GeometryToSoap<Explorer Type, SOAP Type>. PointN soapPointN = SoapConverter.GeometryToSoap<ESRI.ArcGISExplorer.Geometry.Point, PointN>(xoPoint); // Create an ArcGIS Explorer Multipoint. ESRI.ArcGISExplorer.Geometry.Multipoint xoMultipoint = new ESRI.ArcGISExplorer.Geometry.Multipoint(); xoMultipoint.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(3, 4, 5)); xoMultipoint.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(6, 6, 10)); xoMultipoint.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2, 3, 0)); // Convert to a SOAP MultipointN with GeometryToSoap<Explorer Type, SOAP Type>. MultipointN soapMultipointN = SoapConverter.GeometryToSoap<ESRI.ArcGISExplorer.Geometry.Multipoint, MultipointN>(xoMultipoint); // Create an ArcGIS Explorer Envelope. ESRI.ArcGISExplorer.Geometry.Envelope xoEnvelope = new ESRI.ArcGISExplorer.Geometry.Envelope(2, 2, 4, 4); // Convert to a SOAP EnvelopeN with GeometryToSoap<Explorer Type, SOAP Type>. EnvelopeN soapEnvelopeN = SoapConverter.GeometryToSoap<ESRI.ArcGISExplorer.Geometry.Envelope, EnvelopeN>(xoEnvelope); // Create an ArcGIS Explorer Polyline. ESRI.ArcGISExplorer.Geometry.Polyline xoPolyline = new ESRI.ArcGISExplorer.Geometry.Polyline(); xoPolyline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(0, 0, 0)); xoPolyline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(1, 1, 0)); xoPolyline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(1, 2, 0)); // Convert to a SOAP PolylineN with GeometryToSoap<Explorer Type, SOAP Type>. PolylineN soapPolylineN = SoapConverter.GeometryToSoap<ESRI.ArcGISExplorer.Geometry.Polyline, PolylineN>(xoPolyline); // Create an ArcGIS Explorer Polygon. ESRI.ArcGISExplorer.Geometry.Polygon xoPolygon = new ESRI.ArcGISExplorer.Geometry.Polygon(); xoPolygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(0, 0, 0)); xoPolygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(1, 0, 0)); xoPolygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(1, 1, 0)); xoPolygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(0, 1, 0)); xoPolygon.Close(); // Convert to a SOAP PolygonN with GeometryToSoap<Explorer Type, SOAP Type>. PolygonN soapPolygonN = SoapConverter.GeometryToSoap<ESRI.ArcGISExplorer.Geometry.Polygon, PolygonN>(xoPolygon);
CopyVB.NET
' Remember you will need a using (Imports in Visual Basic) statement to the namespace of the SOAP definitions ' for your web references, e.g. the namespace containing the PointN SOAP type. ' Create an ArcGIS Explorer Point. Dim xoPoint As ESRI.ArcGISExplorer.Geometry.Point = New ESRI.ArcGISExplorer.Geometry.Point(3, 4, 5) ' Convert to a SOAP PointN with GeometryToSoap(Of Explorer Type, SOAP Type). Dim soapPointN As PointN = SoapConverter.GeometryToSoap(Of ESRI.ArcGISExplorer.Geometry.Point, PointN)(xoPoint) ' Create an ArcGIS Explorer Multipoint. Dim xoMultipoint As ESRI.ArcGISExplorer.Geometry.Multipoint = New ESRI.ArcGISExplorer.Geometry.Multipoint() xoMultipoint.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(3, 4, 5)) xoMultipoint.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(6, 6, 10)) xoMultipoint.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2, 3, 0)) ' Convert to a SOAP MultipointN with GeometryToSoap(Of Explorer Type, SOAP Type). Dim soapMultipointN As MultipointN = SoapConverter.GeometryToSoap(Of ESRI.ArcGISExplorer.Geometry.Multipoint, MultipointN)(xoMultipoint) ' Create an ArcGIS Explorer Envelope. Dim xoEnvelope As ESRI.ArcGISExplorer.Geometry.Envelope = New ESRI.ArcGISExplorer.Geometry.Envelope(2, 2, 4, 4) ' Convert to a SOAP EnvelopeN with GeometryToSoap(Of Explorer Type, SOAP Type). Dim soapEnvelopeN As EnvelopeN = SoapConverter.GeometryToSoap(Of ESRI.ArcGISExplorer.Geometry.Envelope, EnvelopeN)(xoEnvelope) ' Create an ArcGIS Explorer Polyline. Dim xoPolyline As ESRI.ArcGISExplorer.Geometry.Polyline = New ESRI.ArcGISExplorer.Geometry.Polyline() xoPolyline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(0, 0, 0)) xoPolyline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(1, 1, 0)) xoPolyline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(1, 2, 0)) ' Convert to a SOAP PolylineN with GeometryToSoap(Of Explorer Type, SOAP Type). Dim soapPolylineN As PolylineN = SoapConverter.GeometryToSoap(Of ESRI.ArcGISExplorer.Geometry.Polyline, PolylineN)(xoPolyline) ' Create an ArcGIS Explorer Polygon. Dim xoPolygon As ESRI.ArcGISExplorer.Geometry.Polygon = New ESRI.ArcGISExplorer.Geometry.Polygon() xoPolygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(0, 0, 0)) xoPolygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(1, 0, 0)) xoPolygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(1, 1, 0)) xoPolygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(0, 1, 0)) xoPolygon.Close() ' Convert to a SOAP PolygonN with GeometryToSoap(Of Explorer Type, SOAP Type). Dim soapPolygonN As PolygonN = SoapConverter.GeometryToSoap(Of ESRI.ArcGISExplorer.Geometry.Polygon, PolygonN)(xoPolygon)