📄 adddatalayer.txt
字号:
public bool AddDataLayer(System.Data.DataTable dt, System.Drawing.Color dColor, System.Drawing.Color dSelectColor,int SymbolSize, ESRI.ArcGIS.ADF.Web.Display.Symbol.MarkerSymbolType SymbolType)
{
bool bResult = false;
ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality mf = (ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality)m_map.GetFunctionality(0);
if (mf == null) return bResult;
//如果图层已存在,则返回
ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource mr = (ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource)mf.Resource;
string[] layerIds;
string[] layerNames;
mf.GetLayers(out layerIds, out layerNames);
for (int i = 0; i < layerIds.Length; i++)
{
if (layerNames[i] == dt.TableName) return bResult;
}
ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer graphicslayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer(FeatureType.Point);
System.Data.DataColumn cl0 = new System.Data.DataColumn("编码", typeof(System.String));
System.Data.DataColumn cl1 = new System.Data.DataColumn("名称", typeof(System.String));
graphicslayer.Columns.Add(cl0);
graphicslayer.Columns.Add(cl1);
graphicslayer.TableName = dt.TableName;
for (int i = 0; i < dt.Rows.Count; i++)
{
double x = System.Convert.ToDouble(dt.Rows[i]["PosX"]);
double y = System.Convert.ToDouble(dt.Rows[i]["PosY"]);
if (x == null) x = 0;
if (y == null) y = 0;
if ((x > 0) && (y > 0))
{
ESRI.ArcGIS.ADF.Web.Geometry.Point p = new ESRI.ArcGIS.ADF.Web.Geometry.Point(x, y);
System.Data.DataRow lr = graphicslayer.Add(p);
lr["名称"] = dt.Rows[i]["Name"];
lr["编码"] = dt.Rows[i]["Code"];
}
}
mr.Graphics.Tables.Add(graphicslayer);
bResult = true;
return bResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -