ArcGIS Server.Net Web ADF之几何类型的相互转换
数据类型之间的转换来源于Web ADF支持多元数据。支持多种数据源表示
Web应用可能会在同一个应用中和不同的数据源打交道。总的来说,每一种数
据源都可以脱离Web ADF而独立进行工作,只需要维护自己的Specific APIs。但
是由于Web ADF把他们结合在了一起,因此不同数据类型之间的转换就会频繁
的在开发中遇到。
Web ADF中提供了各种转换类,在不同的命名空间中以静态方法的方式提供。
ESRI.ArcGIS.ADF.ArcGISServer.Converter:提供从COM对象到Value对象
之间的转换。
ESRI.ArcGIS.ADF.Converter:
ESRI.ArcGIS.ADF.Web.Converter:
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter:
ESRI.ArcGIS.ADF.Web.DataSources.IMS.Converter:
ESRI.ArcGIS.ADF.Web.UI.WebControls.Converter:
因为GIS应用和服务的功能都是和空间数据相关的,都是处理和分析空间数
据为主的。比如获得鼠标点击的点,或者是获得空间的要素等,那在实现这些功
能的过程中,经常会和Geometry打交道,而且Geometry也将会是在应用的各
个层中互相转换。本文中就主要来介绍Web ADF中Common APIs和各个Specific
APIs之间的几何类型的转换。
这里有好几种转换,参与的三方有:
?.NET的几何类型:
?Web ADF的几何类型:这里的Web ADF的几何类型是指的ADF中的
Common API中的几何类型。
?Specific API的几何类型。
对于ArcGIS Server来说,对应的Specific API中的对象有两种:一种是是指的
ESRI.ArcGIS.ADF.ArcGISServer中的Value Objects,另一种是ArcObjects中的对象。
各种类型之间的转换下面都有详细的例子,先来看看点:3.1点的转换示例
1).NET Drawing到Web ADF
System.Drawing.Point DotNet_point;。。。。。。。。。
ESRI.ArcGIS.ADF.Web.Geometry.Point adf_point=
ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(DotNet_point.X,DotNet
_point.Y,adf_map.Extent,(int)adf_map.Width.Value,(int)adf_map.Height.Value);
2).NET Drawing到ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay imgDisp=new
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay();
imgDisp.ImageHeight=(int)adf_map.Height.Value;
imgDisp.ImageWidth=(int)adf_map.Width.Value;
int[]xvalues=new int[1];
xvalues[0]=DotNet_point.X;
int[]yvalues=new int[1];
yvalues[0]=DotNet_point.Y;
//获得mapfuntionality
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFunc
tionality(0);
//获得Resource
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase ags_mapresource
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase)ags_mapfuncti
onality.Resource;
//获得MapProxy
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy ags_mapserverproxy=
ags_mapresource.MapServerProxy;
//进行转换
ESRI.ArcGIS.ADF.ArcGISServer.MultipointN value_multipoint=
(ESRI.ArcGIS.ADF.ArcGISServer.MultipointN)ags_mapserverproxy.ToMapPoints(ags_m
apfunctionality.MapDescription,imgDisp,xvalues,yvalues);
ESRI.ArcGIS.ADF.ArcGISServer.PointN value_point=
(ESRI.ArcGIS.ADF.ArcGISServer.PointN)value_multipoint.PointArray[0];
3).NET Drawing到ArcIMS
//获得MapFunctionality
ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality ims_mapfunctionality
=(ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)adf_map.GetFunctionality(0);
ESRI.ArcGIS.ADF.IMS.Carto.MapView mapview=ims_mapfunctionality.MapView;
ESRI.ArcGIS.ADF.IMS.Geometry.Envelope ims_extent=mapview.Extent;
//进行转换
ESRI.ArcGIS.ADF.IMS.Geometry.Point ims_point=
ESRI.ArcGIS.ADF.IMS.Geometry.Point.ToMapPoint(DotNet_point,ims_extent,
mapview.ImageDescriptor.Width,mapview.ImageDescriptor.Height);
4)Web ADF到ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.PointN value_point=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPoint(adf_point);
5)Web ADF到ArcGIS Server ArcObjects
//获得MapFunctionality
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFun
ctionality(ags_local_resource_index);
//获得Resouce
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal
ags_mapresourcelocal
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)ags_mapfuncti
onality.Resource;
//进行转换
ESRI.ArcGIS.Geometry.IPoint com_point=(ESRI.ArcGIS.Geometry.IPoint)
ESRI.ArcGIS.ADF.WebDataSources.ArcGISServer.Converter.ToIGeometry(adf_point,ags
_mapresourcelocal.ServerContextInfo.ServerContext);
6)Web ADF到ArcIMS
//直接进行转换
ESRI.ArcGIS.ADF.IMS.Geometry.Point ims_point=
(ESRI.ArcGIS.ADF.IMS.Geometry.Point)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Convert
er.ToIMSGeometry(adf_point);
7)ArcGIS Server SOAP到Web ADF
//直接进行转换
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPoint(value_point);8)ArcGIS Server ArcObjects到Web ADF
//直接进行转换
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromIPoint(com_point);
9)ArcIMS到Web ADF
//直接进行转换
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point=
(ESRI.ArcGIS.ADF.Web.Geometry.Point)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Conver
ter.ToADFGeometry(ims_point);
3.2线的转换示例
1).NET Drawing到Web ADF
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection adf_pointcollection=new
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection();
foreach(System.Drawing.Point DotNet_point in DotNet_points)
{
adf_pointcollection.Add(ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint
(DotNet_point,map.Extent,(int)map.Width.Value,(int)map.Height.Value));
}
ESRI.ArcGIS.ADF.Web.Geometry.Path adf_path=new
ESRI.ArcGIS.ADF.Web.Geometry.Path();
adf_path.Points=adf_pointcollection;
ESRI.ArcGIS.ADF.Web.Geometry.PathCollection adf_paths=new
ESRI.ArcGIS.ADF.Web.Geometry.PathCollection();
adf_paths.Add(adf_path);
ESRI.ArcGIS.ADF.Web.Geometry.Polyline adf_polyline=new
ESRI.ArcGIS.ADF.Web.Geometry.Polyline();
adf_polyline.Paths=adf_paths;
2).NET Drawing to ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay imgDisp=new
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay();
imgDisp.ImageHeight=(int)adf_map.Height.Value;
imgDisp.ImageWidth=(int)adf_map.Width.Value;
int[]xvalues=new int[DotNet_points.Length];int[]yvalues=new int[DotNet_points.Length];
for(int i=0;i<DotNet_points.Length;i++)
{
xvalues=DotNet_points.X;
yvalues=DotNet_points.Y;
}
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFunc
tionality(0);
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase ags_mapresource
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase)ags_mapfuncti
onality.Resource;
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy ags_mapserverproxy=
ags_mapresource.MapServerProxy;
ESRI.ArcGIS.ADF.ArcGISServer.MultipointN value_multipoint=
(ESRI.ArcGIS.ADF.ArcGISServer.MultipointN)ags_mapserverproxy.ToMapPoints(ags_m
apfunctionality.MapDescription,imgDisp,xvalues,yvalues);
ESRI.ArcGIS.ADF.ArcGISServer.Path value_path=new
ESRI.ArcGIS.ADF.ArcGISServer.Path();
value_path.PointArray=value_multipoint.PointArray;
ESRI.ArcGIS.ADF.ArcGISServer.Path[]value_paths=new
ESRI.ArcGIS.ADF.ArcGISServer.Path[1];
value_paths.SetValue(value_path,0);
ESRI.ArcGIS.ADF.ArcGISServer.PolylineN value_polyline=new
ESRI.ArcGIS.ADF.ArcGISServer.PolylineN();
value_polyline.PathArray=value_paths;
3).net drawing到ArcIMS
ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality ims_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)adf_map.GetFunctionality(
0);
ESRI.ArcGIS.ADF.IMS.Carto.MapView mapview=ims_mapfunctionality.MapView;
ESRI.ArcGIS.ADF.IMS.Geometry.Envelope ims_extent=mapview.Extent;
ESRI.ArcGIS.ADF.IMS.Geometry.PointCollection ims_pointcollection=new
ESRI.ArcGIS.ADF.IMS.Geometry.PointCollection();
foreach(System.Drawing.Point DotNet_point in DotNet_points)
{
ESRI.ArcGIS.ADF.IMS.Geometry.Point ims_point=ESRI.ArcGIS.ADF.IMS.Geometry.Point.ToMapPoint(DotNet_point,ims_extent,
mapview.ImageDescriptor.Width,mapview.ImageDescriptor.Height);
ims_pointcollection.Add(ims_point);
}
ESRI.ArcGIS.ADF.IMS.Geometry.Path ims_path=new
ESRI.ArcGIS.ADF.IMS.Geometry.Path();
ims_path.Points=ims_pointcollection;
ESRI.ArcGIS.ADF.IMS.Geometry.Polyline ims_polyline=new
ESRI.ArcGIS.ADF.IMS.Geometry.Polyline();
ims_polyline.Paths.Add(ims_path);
4)Web ADF to ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.PolylineN value_polyline=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPolyline(adf_polyl
ine);
5)Web ADF to ArcGIS Server ArcObjects
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFunc
tionality(0);
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal
ags_mapresourcelocal=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)ags_mapfunctio
nality.Resource;
ESRI.ArcGIS.Geometry.IPointCollection com_polyline_pointcollection=
(ESRI.ArcGIS.Geometry.IPointCollection)ags_mapresourcelocal.ServerContextInfo.Ser
verContext.CreateObject("esriGeometry.Polyline");
object Missing=Type.Missing;
foreach(ESRI.ArcGIS.ADF.Web.Geometry.Path new_adf_path in adf_polyline.Paths)
{
ESRI.ArcGIS.Geometry.IPointCollection com_pointcollection=
(ESRI.ArcGIS.Geometry.IPointCollection)ags_mapresourcelocal.ServerContextInfo.Ser
verContext.CreateObject("esriGeometry.Path");
foreach(ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point in
new_adf_path.Points){
ESRI.ArcGIS.Geometry.IPoint com_point=
(ESRI.ArcGIS.Geometry.IPoint)ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Conver
ter.ToIGeometry(new_adf_point,ags_mapresourcelocal.ServerContextInfo.ServerCon
text);
com_pointcollection.AddPoint(com_point,ref Missing,ref Missing);
}
com_polyline_pointcollection.AddPointCollection(com_pointcollection);
}
ESRI.ArcGIS.Geometry.IPolyline com_polyline=
(ESRI.ArcGIS.Geometry.IPolyline)com_polyline_pointcollection;
6)Web ADF to ArcIMS
ESRI.ArcGIS.ADF.IMS.Geometry.Polyline ims_polyline=
(ESRI.ArcGIS.ADF.IMS.Geometry.Polyline)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Conv
erter.ToIMSGeometry(adf_polyline);
7)ArcGIS Server SOAP to Web ADF
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_polyline=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPolyline(value_polyli
ne);
8)ArcGIS Server ArcObjects to Web ADF
ESRI.ArcGIS.Geometry.IPointCollection com_pointcollection=
(ESRI.ArcGIS.Geometry.IPointCollection)com_polyline;
ESRI.ArcGIS.ADF.Web.Geometry.Point[]new_adf_points=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromIPointCollection(com
_pointcollection);
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection new_adf_pointcollection=new
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection();
for(int i=0;i<new_adf_points.Length-1;i++)
{
new_adf_pointcollection.Add(new_adf_points);
}
ESRI.ArcGIS.ADF.Web.Geometry.Path new_adf_path=new
ESRI.ArcGIS.ADF.Web.Geometry.Path();
new_adf_path.Points=new_adf_pointcollection;ESRI.ArcGIS.ADF.Web.Geometry.PathCollection new_adf_pathcollection=new
ESRI.ArcGIS.ADF.Web.Geometry.PathCollection();
adf_pathcollection.Add(new_adf_path);
ESRI.ArcGIS.ADF.Web.Geometry.Polyline new_adf_polyline=new
ESRI.ArcGIS.ADF.Web.Geometry.Polyline();
new_adf_polyline.Paths=new_adf_pathcollection;
9)ArcIMS to Web ADF
ESRI.ArcGIS.ADF.Web.Geometry.Polyline new_adf_polyline=
(ESRI.ArcGIS.ADF.Web.Geometry.Polyline)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Con
verter.ToADFGeometry(ims_polyline);
Web应用可能会在同一个应用中和不同的数据源打交道。总的来说,每一种数
据源都可以脱离Web ADF而独立进行工作,只需要维护自己的Specific APIs。但
是由于Web ADF把他们结合在了一起,因此不同数据类型之间的转换就会频繁
的在开发中遇到。
Web ADF中提供了各种转换类,在不同的命名空间中以静态方法的方式提供。
ESRI.ArcGIS.ADF.ArcGISServer.Converter:提供从COM对象到Value对象
之间的转换。
ESRI.ArcGIS.ADF.Converter:
ESRI.ArcGIS.ADF.Web.Converter:
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter:
ESRI.ArcGIS.ADF.Web.DataSources.IMS.Converter:
ESRI.ArcGIS.ADF.Web.UI.WebControls.Converter:
因为GIS应用和服务的功能都是和空间数据相关的,都是处理和分析空间数
据为主的。比如获得鼠标点击的点,或者是获得空间的要素等,那在实现这些功
能的过程中,经常会和Geometry打交道,而且Geometry也将会是在应用的各
个层中互相转换。本文中就主要来介绍Web ADF中Common APIs和各个Specific
APIs之间的几何类型的转换。
这里有好几种转换,参与的三方有:
?.NET的几何类型:
?Web ADF的几何类型:这里的Web ADF的几何类型是指的ADF中的
Common API中的几何类型。
?Specific API的几何类型。
对于ArcGIS Server来说,对应的Specific API中的对象有两种:一种是是指的
ESRI.ArcGIS.ADF.ArcGISServer中的Value Objects,另一种是ArcObjects中的对象。
各种类型之间的转换下面都有详细的例子,先来看看点:3.1点的转换示例
1).NET Drawing到Web ADF
System.Drawing.Point DotNet_point;。。。。。。。。。
ESRI.ArcGIS.ADF.Web.Geometry.Point adf_point=
ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(DotNet_point.X,DotNet
_point.Y,adf_map.Extent,(int)adf_map.Width.Value,(int)adf_map.Height.Value);
2).NET Drawing到ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay imgDisp=new
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay();
imgDisp.ImageHeight=(int)adf_map.Height.Value;
imgDisp.ImageWidth=(int)adf_map.Width.Value;
int[]xvalues=new int[1];
xvalues[0]=DotNet_point.X;
int[]yvalues=new int[1];
yvalues[0]=DotNet_point.Y;
//获得mapfuntionality
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFunc
tionality(0);
//获得Resource
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase ags_mapresource
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase)ags_mapfuncti
onality.Resource;
//获得MapProxy
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy ags_mapserverproxy=
ags_mapresource.MapServerProxy;
//进行转换
ESRI.ArcGIS.ADF.ArcGISServer.MultipointN value_multipoint=
(ESRI.ArcGIS.ADF.ArcGISServer.MultipointN)ags_mapserverproxy.ToMapPoints(ags_m
apfunctionality.MapDescription,imgDisp,xvalues,yvalues);
ESRI.ArcGIS.ADF.ArcGISServer.PointN value_point=
(ESRI.ArcGIS.ADF.ArcGISServer.PointN)value_multipoint.PointArray[0];
3).NET Drawing到ArcIMS
//获得MapFunctionality
ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality ims_mapfunctionality
=(ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)adf_map.GetFunctionality(0);
ESRI.ArcGIS.ADF.IMS.Carto.MapView mapview=ims_mapfunctionality.MapView;
ESRI.ArcGIS.ADF.IMS.Geometry.Envelope ims_extent=mapview.Extent;
//进行转换
ESRI.ArcGIS.ADF.IMS.Geometry.Point ims_point=
ESRI.ArcGIS.ADF.IMS.Geometry.Point.ToMapPoint(DotNet_point,ims_extent,
mapview.ImageDescriptor.Width,mapview.ImageDescriptor.Height);
4)Web ADF到ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.PointN value_point=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPoint(adf_point);
5)Web ADF到ArcGIS Server ArcObjects
//获得MapFunctionality
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFun
ctionality(ags_local_resource_index);
//获得Resouce
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal
ags_mapresourcelocal
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)ags_mapfuncti
onality.Resource;
//进行转换
ESRI.ArcGIS.Geometry.IPoint com_point=(ESRI.ArcGIS.Geometry.IPoint)
ESRI.ArcGIS.ADF.WebDataSources.ArcGISServer.Converter.ToIGeometry(adf_point,ags
_mapresourcelocal.ServerContextInfo.ServerContext);
6)Web ADF到ArcIMS
//直接进行转换
ESRI.ArcGIS.ADF.IMS.Geometry.Point ims_point=
(ESRI.ArcGIS.ADF.IMS.Geometry.Point)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Convert
er.ToIMSGeometry(adf_point);
7)ArcGIS Server SOAP到Web ADF
//直接进行转换
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPoint(value_point);8)ArcGIS Server ArcObjects到Web ADF
//直接进行转换
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromIPoint(com_point);
9)ArcIMS到Web ADF
//直接进行转换
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point=
(ESRI.ArcGIS.ADF.Web.Geometry.Point)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Conver
ter.ToADFGeometry(ims_point);
3.2线的转换示例
1).NET Drawing到Web ADF
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection adf_pointcollection=new
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection();
foreach(System.Drawing.Point DotNet_point in DotNet_points)
{
adf_pointcollection.Add(ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint
(DotNet_point,map.Extent,(int)map.Width.Value,(int)map.Height.Value));
}
ESRI.ArcGIS.ADF.Web.Geometry.Path adf_path=new
ESRI.ArcGIS.ADF.Web.Geometry.Path();
adf_path.Points=adf_pointcollection;
ESRI.ArcGIS.ADF.Web.Geometry.PathCollection adf_paths=new
ESRI.ArcGIS.ADF.Web.Geometry.PathCollection();
adf_paths.Add(adf_path);
ESRI.ArcGIS.ADF.Web.Geometry.Polyline adf_polyline=new
ESRI.ArcGIS.ADF.Web.Geometry.Polyline();
adf_polyline.Paths=adf_paths;
2).NET Drawing to ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay imgDisp=new
ESRI.ArcGIS.ADF.ArcGISServer.ImageDisplay();
imgDisp.ImageHeight=(int)adf_map.Height.Value;
imgDisp.ImageWidth=(int)adf_map.Width.Value;
int[]xvalues=new int[DotNet_points.Length];int[]yvalues=new int[DotNet_points.Length];
for(int i=0;i<DotNet_points.Length;i++)
{
xvalues=DotNet_points.X;
yvalues=DotNet_points.Y;
}
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFunc
tionality(0);
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase ags_mapresource
=(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase)ags_mapfuncti
onality.Resource;
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy ags_mapserverproxy=
ags_mapresource.MapServerProxy;
ESRI.ArcGIS.ADF.ArcGISServer.MultipointN value_multipoint=
(ESRI.ArcGIS.ADF.ArcGISServer.MultipointN)ags_mapserverproxy.ToMapPoints(ags_m
apfunctionality.MapDescription,imgDisp,xvalues,yvalues);
ESRI.ArcGIS.ADF.ArcGISServer.Path value_path=new
ESRI.ArcGIS.ADF.ArcGISServer.Path();
value_path.PointArray=value_multipoint.PointArray;
ESRI.ArcGIS.ADF.ArcGISServer.Path[]value_paths=new
ESRI.ArcGIS.ADF.ArcGISServer.Path[1];
value_paths.SetValue(value_path,0);
ESRI.ArcGIS.ADF.ArcGISServer.PolylineN value_polyline=new
ESRI.ArcGIS.ADF.ArcGISServer.PolylineN();
value_polyline.PathArray=value_paths;
3).net drawing到ArcIMS
ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality ims_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)adf_map.GetFunctionality(
0);
ESRI.ArcGIS.ADF.IMS.Carto.MapView mapview=ims_mapfunctionality.MapView;
ESRI.ArcGIS.ADF.IMS.Geometry.Envelope ims_extent=mapview.Extent;
ESRI.ArcGIS.ADF.IMS.Geometry.PointCollection ims_pointcollection=new
ESRI.ArcGIS.ADF.IMS.Geometry.PointCollection();
foreach(System.Drawing.Point DotNet_point in DotNet_points)
{
ESRI.ArcGIS.ADF.IMS.Geometry.Point ims_point=ESRI.ArcGIS.ADF.IMS.Geometry.Point.ToMapPoint(DotNet_point,ims_extent,
mapview.ImageDescriptor.Width,mapview.ImageDescriptor.Height);
ims_pointcollection.Add(ims_point);
}
ESRI.ArcGIS.ADF.IMS.Geometry.Path ims_path=new
ESRI.ArcGIS.ADF.IMS.Geometry.Path();
ims_path.Points=ims_pointcollection;
ESRI.ArcGIS.ADF.IMS.Geometry.Polyline ims_polyline=new
ESRI.ArcGIS.ADF.IMS.Geometry.Polyline();
ims_polyline.Paths.Add(ims_path);
4)Web ADF to ArcGIS Server SOAP
ESRI.ArcGIS.ADF.ArcGISServer.PolylineN value_polyline=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPolyline(adf_polyl
ine);
5)Web ADF to ArcGIS Server ArcObjects
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
ags_mapfunctionality=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)adf_map.GetFunc
tionality(0);
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal
ags_mapresourcelocal=
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)ags_mapfunctio
nality.Resource;
ESRI.ArcGIS.Geometry.IPointCollection com_polyline_pointcollection=
(ESRI.ArcGIS.Geometry.IPointCollection)ags_mapresourcelocal.ServerContextInfo.Ser
verContext.CreateObject("esriGeometry.Polyline");
object Missing=Type.Missing;
foreach(ESRI.ArcGIS.ADF.Web.Geometry.Path new_adf_path in adf_polyline.Paths)
{
ESRI.ArcGIS.Geometry.IPointCollection com_pointcollection=
(ESRI.ArcGIS.Geometry.IPointCollection)ags_mapresourcelocal.ServerContextInfo.Ser
verContext.CreateObject("esriGeometry.Path");
foreach(ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_point in
new_adf_path.Points){
ESRI.ArcGIS.Geometry.IPoint com_point=
(ESRI.ArcGIS.Geometry.IPoint)ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Conver
ter.ToIGeometry(new_adf_point,ags_mapresourcelocal.ServerContextInfo.ServerCon
text);
com_pointcollection.AddPoint(com_point,ref Missing,ref Missing);
}
com_polyline_pointcollection.AddPointCollection(com_pointcollection);
}
ESRI.ArcGIS.Geometry.IPolyline com_polyline=
(ESRI.ArcGIS.Geometry.IPolyline)com_polyline_pointcollection;
6)Web ADF to ArcIMS
ESRI.ArcGIS.ADF.IMS.Geometry.Polyline ims_polyline=
(ESRI.ArcGIS.ADF.IMS.Geometry.Polyline)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Conv
erter.ToIMSGeometry(adf_polyline);
7)ArcGIS Server SOAP to Web ADF
ESRI.ArcGIS.ADF.Web.Geometry.Point new_adf_polyline=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPolyline(value_polyli
ne);
8)ArcGIS Server ArcObjects to Web ADF
ESRI.ArcGIS.Geometry.IPointCollection com_pointcollection=
(ESRI.ArcGIS.Geometry.IPointCollection)com_polyline;
ESRI.ArcGIS.ADF.Web.Geometry.Point[]new_adf_points=
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromIPointCollection(com
_pointcollection);
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection new_adf_pointcollection=new
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection();
for(int i=0;i<new_adf_points.Length-1;i++)
{
new_adf_pointcollection.Add(new_adf_points);
}
ESRI.ArcGIS.ADF.Web.Geometry.Path new_adf_path=new
ESRI.ArcGIS.ADF.Web.Geometry.Path();
new_adf_path.Points=new_adf_pointcollection;ESRI.ArcGIS.ADF.Web.Geometry.PathCollection new_adf_pathcollection=new
ESRI.ArcGIS.ADF.Web.Geometry.PathCollection();
adf_pathcollection.Add(new_adf_path);
ESRI.ArcGIS.ADF.Web.Geometry.Polyline new_adf_polyline=new
ESRI.ArcGIS.ADF.Web.Geometry.Polyline();
new_adf_polyline.Paths=new_adf_pathcollection;
9)ArcIMS to Web ADF
ESRI.ArcGIS.ADF.Web.Geometry.Polyline new_adf_polyline=
(ESRI.ArcGIS.ADF.Web.Geometry.Polyline)ESRI.ArcGIS.ADF.Web.DataSources.IMS.Con
verter.ToADFGeometry(ims_polyline);