ArcGIS Server的最短路径开发系列(2)补充
本文版权归小能所有,转载麻烦标明出处,谢谢! 同时写作过程中也参阅了大量其他网络文档,如果您觉得侵犯版权,请和我联系:chinazhousheng@gmail.com
关于点的查询代码我贴在下面了,里面的代码我可能有部分代码没有用,但我还是写上了,希望大家见谅,大体思想我建议大家先去看看 flyingis的博客,他的那个系列是相当好的,建议大家都是看一下!特别是查询的例子,我也是有一部分照他的来做的,希望大家能从中得到感觉!
网络分析之最短路径查询系列:
ArcGIS Server的最短路径开发系列(1)
ArcGIS Server的最短路径开发系列(2)
ArcGIS Server的最短路径开发系列(2)补充
ArcGIS Server的最短路径开发系列(3)
关于点的查询代码我贴在下面了,里面的代码我可能有部分代码没有用,但我还是写上了,希望大家见谅,大体思想我建议大家先去看看 flyingis的博客,他的那个系列是相当好的,建议大家都是看一下!特别是查询的例子,我也是有一部分照他的来做的,希望大家能从中得到感觉!ArcGIS Server的最短路径开发系列(3)
public PointN Query_Point_Txt(string Point_stirng)
{
AGSBase agsbase = new AGSBase();
CommonFunction Som_connection = new CommonFunction();
Som_connection.Som_Connection();
IEnumerable func_enum = null;
func_enum = CsMap.GetFunctionalities();
System.Data.DataTable mytable = null;
PointN txt_Point = new PointN();
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality gisfunctionality in func_enum)
{
//gisresource = gisfunctionality.Resource;
//对特定的数据库图层进行查询
if (gisfunctionality.Resource.Name == "CsMap")
{
bool supported = false;
ESRI.ArcGIS.ADF.Web.DataSources.IGISResource gisresource = null;
gisresource = gisfunctionality.Resource;
supported = gisresource.SupportsFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality));
//如果支持
if (supported)
{
ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality qfunc;
qfunc = (ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)gisresource.CreateFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), null);
string[] lids;
string[] lnames;
qfunc.GetQueryableLayers(null, out lids, out lnames);
//对查询进行过滤
mytable = qfunc.Query(null, lids[agsbase.mapid], spatialfilter);
}
}
}
DataRowCollection drs = mytable.Rows;
int shpind = -1;
for (int i = 0; i < mytable.Columns.Count; i++)
{
if (mytable.Columns[i].DataType == typeof(ESRI.ArcGIS.ADF.Web.Geometry.Geometry))
{
shpind = i;
break;
}
}
try
{
foreach (DataRow dr in drs)
{
ESRI.ArcGIS.ADF.Web.Geometry.Multipoint geom = (ESRI.ArcGIS.ADF.Web.Geometry.Multipoint)dr[shpind];
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection pointcol = geom.Points;
txt_Point.X = pointcol[0].X;
txt_Point.Y = pointcol[0].Y;
}
}
catch (Exception q)
{
}
return txt_Point;
}
{
AGSBase agsbase = new AGSBase();
CommonFunction Som_connection = new CommonFunction();
Som_connection.Som_Connection();
IEnumerable func_enum = null;
func_enum = CsMap.GetFunctionalities();
System.Data.DataTable mytable = null;
PointN txt_Point = new PointN();
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality gisfunctionality in func_enum)
{
//gisresource = gisfunctionality.Resource;
//对特定的数据库图层进行查询
if (gisfunctionality.Resource.Name == "CsMap")
{
bool supported = false;
ESRI.ArcGIS.ADF.Web.DataSources.IGISResource gisresource = null;
gisresource = gisfunctionality.Resource;
supported = gisresource.SupportsFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality));
//如果支持
if (supported)
{
ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality qfunc;
qfunc = (ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)gisresource.CreateFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), null);
string[] lids;
string[] lnames;
qfunc.GetQueryableLayers(null, out lids, out lnames);
//对查询进行过滤
mytable = qfunc.Query(null, lids[agsbase.mapid], spatialfilter);
}
}
}
DataRowCollection drs = mytable.Rows;
int shpind = -1;
for (int i = 0; i < mytable.Columns.Count; i++)
{
if (mytable.Columns[i].DataType == typeof(ESRI.ArcGIS.ADF.Web.Geometry.Geometry))
{
shpind = i;
break;
}
}
try
{
foreach (DataRow dr in drs)
{
ESRI.ArcGIS.ADF.Web.Geometry.Multipoint geom = (ESRI.ArcGIS.ADF.Web.Geometry.Multipoint)dr[shpind];
ESRI.ArcGIS.ADF.Web.Geometry.PointCollection pointcol = geom.Points;
txt_Point.X = pointcol[0].X;
txt_Point.Y = pointcol[0].Y;
}
}
catch (Exception q)
{
}
return txt_Point;
}
所有版权归小能所有哦!!!