ArcGIS.Server.9.2.DotNet自带例子分析(一、三)
目的:
1.MapIdentify功能,自定义Tool以及TaskResults应用。
准备:
1.(一、二)的工程,具体见前篇。
开始:
1.编辑Toolbar1的ToolbarItems属性添加一个Tool,ClientAction属性为MapIdentify('Map1'); Name属性为MapIdentify Text属性为Identify ToolTip属性为Identify (Ctrl-MouseClick) 具体代码如下:
1.MapIdentify功能,自定义Tool以及TaskResults应用。
准备:
1.(一、二)的工程,具体见前篇。
开始:
1.编辑Toolbar1的ToolbarItems属性添加一个Tool,ClientAction属性为MapIdentify('Map1'); Name属性为MapIdentify Text属性为Identify ToolTip属性为Identify (Ctrl-MouseClick) 具体代码如下:
1
<esri:Tool ClientAction="MapIdentify('Map1');" DefaultImage="~/Images/identify.png"
2
HoverImage="~/Images/identify_HOVER.gif" JavaScriptFile="" Name="MapIdentify" SelectedImage="~/Images/identify_ON.gif" Text="Identify" ToolTip="Identify (Ctrl-MouseClick)" />
2.开始代码部分的编写,添加MapIdentify.cs,用来实现具体的功能。代码和说明如下:![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
1
using System.Web;
2
using System.Web.Security;
3
using System.Web.UI;
4
using System.Web.UI.WebControls;
5
using System.Web.UI.WebControls.WebParts;
6
using System.Web.UI.HtmlControls;
7
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
8
using System.Collections.Specialized;
9
using ESRI.ArcGIS.ADF.Web.DataSources;
10
using System.Collections.Generic;
11
using ESRI.ArcGIS.ADF.Web;
12
using ESRI.ArcGIS.ADF.Web.Display.Graphics;
13![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
namespace MappingApp
15
{
16
public class MapIdentify
17
{
18
private Page m_page;
19
private Map m_map;
20
//客户端脚本段
21
private string m_callbackInvocation = "";
22
//脚本路径
23
private string m_filePath = "";
24![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
25
//保留几位小数
26
private int m_numberDecimals = 3;
27![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28
//可见图层
29
private IdentifyOption m_idOption = IdentifyOption.VisibleLayers;
30
//查询的冗余范围半径
31
public int m_IdentifyTolerance = 5;
32
//用来显示查询结果内容
33
private TaskResults m_resultsDisplay = null;
34![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
35
private DataSet m_dataset;
36![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
37
public MapIdentify()
38
{
39
}
40![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
41
public MapIdentify(Map map)
42
{
43
if (map != null)
44
{
45
m_map = map;
46![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
47
//生成客户端调用方法
48
SetupIdentify();
49
}
50
}
51![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
52
public MapIdentify(Map map, string filePath)
53
{
54
m_map = map;
55
m_filePath = filePath;
56![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
57
//生成客户端调用方法
58
SetupIdentify();
59
}
60![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
61
//生成客户端调用方法
62
public void SetupIdentify()
63
{
64
//获取Map控件所在的页面
65
m_page = m_map.Page;
66
System.Text.StringBuilder sb = new System.Text.StringBuilder();
67
//生产客户端的脚本段
68
m_callbackInvocation = m_page.ClientScript.GetCallbackEventReference(m_page, "message", "processCallbackResult", "context", true);
69
//引用display_mapidentify.js的文件
70
sb.Append("\n<script language=\"javascript\" type=\"text/javascript\" src=\"" + m_filePath + "JavaScript/display_mapidentify.js\" ></script>\n");
71
//
72
sb.Append("<script language=\"javascript\" type=\"text/javascript\">var identifyCallbackFunctionString = \"" + m_callbackInvocation + "\";</script>\n");
73
//把sb的脚本注册到页面中
74
if (!m_page.ClientScript.IsClientScriptBlockRegistered("IdentifyScript"))
75
{
76
m_page.ClientScript.RegisterClientScriptBlock(m_page.GetType(), "IdentifyScript", sb.ToString());
77
}
78
}
79![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
80
//具体的功能实现方法
81
public string Identify(NameValueCollection queryString)
82
{
83
//x,y的坐标
84
string xString = queryString["minx"];
85
string yString = queryString["miny"];
86
string locXString = "";
87
string locYString = "";
88
int x = Convert.ToInt32(xString);
89
int y = Convert.ToInt32(yString);
90![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
91
IGISResource resource;
92
IQueryFunctionality query;
93![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
94
//像素坐标转换成地理坐标
95
ESRI.ArcGIS.ADF.Web.Geometry.Point mapPoint = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(x, y, m_map.GetTransformationParams(ESRI.ArcGIS.ADF.Web.Geometry.TransformationDirection.ToMap));
96
List<DataSet> gdsList = new List<DataSet>();
97
foreach (IMapFunctionality mapFunc in m_map.GetFunctionalities())
98
{
99
if (mapFunc is ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality)
100
{
101
continue;
102
}
103
resource = mapFunc.Resource;
104
//建立查询方法
105
query = resource.CreateFunctionality(typeof(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), "identify_") as IQueryFunctionality;
106
string[] layerIds;
107
string[] layerNames;
108
//查询地图图层id和名称
109
query.GetQueryableLayers(null, out layerIds, out layerNames);
110
//resource类型
111
string resourceType = resource.DataSource.GetType().ToString();
112![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
113
//只显示坐标的3个小数
114
double roundFactor = Math.Pow(10, m_numberDecimals);
115
string pointXString = Convert.ToString(Math.Round(mapPoint.X * roundFactor) / roundFactor);
116
string pointYString = Convert.ToString(Math.Round(mapPoint.Y * roundFactor) / roundFactor);
117![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
118
locXString = pointXString;
119
locYString = pointYString;
120![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
121
DataTable[] ds = null;
122
try
123
{
124
//进行查询并且把查询结果放入DataTable数组
125
// 查询坐标 冗余半径 只查可见图层
126
ds = query.Identify(mapFunc.Name, mapPoint, m_IdentifyTolerance, m_idOption, null);
127
}
128
catch (Exception e)
129
{
130
//出错处理
131
DataTable table = new DataTable();
132
table.TableName = "Identify Error: " + e.Message;
133
ds = new DataTable[] { table };
134
}
135
//判断查询结果
136
if (ds != null && ds.Length > 0)
137
{
138
DataSet gds = new DataSet();
139
DataTable table;
140![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
141
//对查询结果DataTable[]进行遍历添加到DataSet
142
for (int j = ds.Length - 1; j >= 0; j--)
143
{
144
table = ds[j];
145
if (table.Rows.Count == 0 && table.TableName.IndexOf("Error") < 0)
146
{
147
//跳过本次进入下一次循环
148
continue;
149
}
150![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
151
//把DataTable转换成GraphicsLayer
152
GraphicsLayer layer = ESRI.ArcGIS.ADF.Web.Converter.ToGraphicsLayer(table, System.Drawing.Color.Empty, System.Drawing.Color.Aqua);
153
if (layer != null)
154
{
155
gds.Tables.Add(layer);
156
}
157
else
158
{
159
gds.Tables.Add(table);
160
}
161
}
162
if (gds.Tables.Count == 0)
163
{
164
//跳过本次循环
165
continue;
166
}
167
gds.DataSetName = resource.Name + " (" + pointXString + ", " + pointYString + ")";
168
gdsList.Add(gds);
169
}
170
}
171
for (int i = gdsList.Count - 1; i >= 0; i--)
172
{
173
//用TaskResults进行查询内容显示
174
m_resultsDisplay.DisplayResults(null, null, null, gdsList[i]);
175
}
176![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
177
//没有查询到结果
178
if (gdsList.Count == 0)
179
{
180
string heading = "Location (" + locXString + ", " + locYString + ") No results found";
181
string detail = "No results found";
182
SimpleTaskResult str = new SimpleTaskResult(heading, detail);
183
m_resultsDisplay.DisplayResults(null, null, null, str);
184
}
185![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
186
//返回结果
187
return m_resultsDisplay.CallbackResults.ToString();
188
}
189![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
190
public Map Map
191
{
192
get { return m_map; }
193
set { m_map = value; }
194
}
195![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
196
public Page Page
197
{
198
get { return m_page; }
199
set { m_page = value; }
200
}
201![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
202
public DataSet DataSet
203
{
204
get { return m_dataset; }
205
set { m_dataset = value; }
206
}
207![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
208
public IdentifyOption IdentifyOption
209
{
210
get { return m_idOption; }
211
set { m_idOption = value; }
212
}
213![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
214
public string ClientCallbackInvocation
215
{
216
get { return m_callbackInvocation; }
217
set { m_callbackInvocation = value; }
218
}
219![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
220
public string FilePath
221
{
222
get { return m_filePath; }
223
set { m_filePath = value; }
224
}
225![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
226
public TaskResults ResultsDisplay
227
{
228
get { return m_resultsDisplay; }
229
set { m_resultsDisplay = value; }
230
}
231![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
232
public int NumberDecimals
233
{
234
get { return m_numberDecimals; }
235
set { m_numberDecimals = value; }
236
}
237
}
238
}
239![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3.在页面上新增TaskResults控件用来显示查询内容ID为TaskResults1,接着在Page_Load事件里添加实例化上面的MapIdentify类具体代码和说明如下:![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
45
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
46
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
47
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
49
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
50
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
51
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
52
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
53
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
54
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
55
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
56
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
57
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
58
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
59
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
60
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
61
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
62
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
63
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
64
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
65
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
66
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
67
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
68
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
69
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
70
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
71
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
72
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
73
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
74
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
75
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
76
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
77
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
78
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
79
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
80
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
81
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
82
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
83
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
84
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
85
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
86
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
87
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
88
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
89
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
90
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
91
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
92
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
93
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
94
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
95
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
96
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
97
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
98
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
99
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
100
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
101
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
102
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
103
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
104
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
105
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
106
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
107
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
108
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
109
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
110
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
111
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
112
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
113
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
114
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
115
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
116
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
117
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
118
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
119
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
120
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
121
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
122
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
123
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
124
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
125
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
126
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
127
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
128
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
129
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
130
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
131
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
132
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
133
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
134
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
135
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
136
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
137
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
138
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
139
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
140
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
141
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
142
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
143
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
144
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
145
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
146
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
147
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
148
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
149
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
150
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
151
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
152
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
153
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
154
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
155
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
156
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
157
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
158
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
159
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
160
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
161
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
162
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
163
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
164
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
165
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
166
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
167
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
168
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
169
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
170
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
171
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
172
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
173
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
174
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
175
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
176
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
177
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
178
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
179
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
180
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
181
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
182
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
183
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
184
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
185
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
186
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
187
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
188
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
189
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
190
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
191
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
192
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
193
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
194
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
195
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
196
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
197
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
198
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
199
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
200
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
201
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
202
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
203
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
204
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
205
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
206
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
207
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
208
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
209
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
210
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
211
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
212
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
213
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
214
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
215
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
216
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
217
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
218
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
219
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
220
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
221
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
222
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
223
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
224
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
225
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
226
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
227
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
228
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
229
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
230
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
231
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
232
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
233
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
234
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
235
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
236
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
237
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
238
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
239
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
1
//实例化MapIdentify,并且把Map1控件作为参数
2
MapIdentify identify = new MapIdentify(Map1);
3
//显示查询结果的控件
4
identify.ResultsDisplay = TaskResults1;
5
//小数位数
6
identify.NumberDecimals = 4;
4.接着还需要对RaiseCallbackEvent方法进行修改添加对查询结果处理的代码,具体代码和说明如下:![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
1
//对客户端的请求进行处理
2
public virtual string RaiseCallbackEvent(string responseString)
3
{
4
//对请求字符串进行分割以键值的形式放到NameValueCollection m_queryString中,方便接下来的使用
5
Array keyValuePairs = responseString.Split("&".ToCharArray());
6
NameValueCollection m_queryString = new NameValueCollection();
7
string[] keyValue;
8
string response = "";
9
if (keyValuePairs.Length > 0)
10
{
11
for (int i = 0; i < keyValuePairs.Length; i++)
12
{
13
keyValue = keyValuePairs.GetValue(i).ToString().Split("=".ToCharArray());
14
m_queryString.Add(keyValue[0], keyValue[1]);
15
}
16
}
17
else
18
{
19
keyValue = responseString.Split("=".ToCharArray());
20
if (keyValue.Length > 0)
21
{
22
m_queryString.Add(keyValue[0], keyValue[1]);
23
}
24
}
25![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
26
//请求字符串样例:ControlID=Map1&ControlType=Map&EventArg=CloseOutApplication,这样就可以很容易理解了
27
string controlType = m_queryString["ControlType"];
28
string eventArg = m_queryString["EventArg"];
29
if (controlType == null)
30
{
31
controlType = "Map";
32
}
33![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
//根据controlType的不同对请求做不同的处理
35
switch (controlType)
36
{
37
case "Map":
38
if (eventArg == "CloseOutApplication")//关闭页面请求-CloseOut()
39
{
40
//ServerContext对象,需要 ESRI.ArcGIS.Server;
41
IServerContext context;
42
for (int i = 0; i < Session.Count; i++)
43
{
44
//清除session
45
context = Session[i] as IServerContext;
46
if (context != null)
47
{
48
context.RemoveAll();
49
context.ReleaseContext();
50
}
51
}
52
Session.RemoveAll();
53
//从webconfig中获取关闭后的页面地址
54
response = ConfigurationManager.AppSettings["CloseOutUrl"];
55
if (response == null || response.Length == 0)
56
{
57
response = "ApplicationClosed.aspx";
58
}
59
}
60
else if (eventArg == "GetCopyrightText")//显示版权-webMapAppGetCopyrightText()
61
{
62
System.Text.StringBuilder sb = new System.Text.StringBuilder();
63
//webMapAppGetCopyrightText()请求服务器后返回结果由processCallbackResult进行客户端处理
64
//关于processCallbackResult方法的参数格式 控件类型:::控件ID:::内容类型:::内容,如div:::mydiv:::content:::你好,GIS!
65
sb.AppendFormat("///:::{0}:::innercontent:::", "CopyrightTextContents");
66
int sbLength = sb.Length;
67
//获取版权内容
68
sb.Append(GetCopyrightText());
69
if (sb.Length == sbLength)
70
{
71
//没有获取,显示为没有版权
72
sb.Append("No Copyright information available.");
73
}
74
response = sb.ToString();
75
}
76
else if (eventArg == "MapIdentify")//当eventArg == "MapIdentify"是调用identify类的方法进行处理并且返回内容
77
{
78
if (identify != null)
79
{
80
identify.Map = Map1;
81
response = identify.Identify(m_queryString);
82
}
83
}
84
break;
85
default:
86
break;
87
}
88
//输出给客户端的内容
89
return response;
90
}
5.还需要编写客户端的脚本MapIdentify('Map1');响应MapIdentify工具的操作,在javascript目录中新增display_mapidentify.js文件,至于页面对这个文件的引用在前面的MapIdentify类的SetupIdentify()方法已经添加的对这个文件的引用,具体的代码和说明如下: ![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
45
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
46
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
47
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
48
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
49
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
50
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
51
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
52
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
53
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
54
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
55
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
56
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
57
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
58
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
59
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
60
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
61
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
62
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
63
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
64
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
65
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
66
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
67
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
68
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
69
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
70
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
71
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
72
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
73
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
74
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
75
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
76
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
77
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
78
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
79
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
80
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
81
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
82
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
83
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
84
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
85
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
86
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
87
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
88
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
89
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
90
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
1
//路径
2
var identifyFilePath = "";
3
var identifyImageType = "png";
4![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
//Tool MapIdentify的ClientAction
6
function MapIdentify(divid)
7
{
8
//获取地图控件
9
map = Maps[divid];
10
//esri的方法,把工具条状态切换到MapIdentify的状态
11
MapPoint(map.controlName, "MapIdentify", false);
12
13
//设置在地图上按下鼠标后的事件为MapIdClick
14
map.divObject.onmousedown = MapIdClick;
15
}
16![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
//鼠标在地图上按下鼠标后触发的事件
18
function MapIdClick(e)
19
{
20
//鼠标指针显示
21
map.cursor = map.divObject.style.cursor;
22
//map.divObject.style.cursor = "wait";
23
getXY(e);
24
//esri的方法,获取地图控件容器的坐标位置
25
var box = calcElementPosition(map.containerDivId);
26
//鼠标相对与地图控件的x坐标
27
zleft = mouseX - box.left;
28
//鼠标相对与地图控件的y坐标
29
ztop = mouseY - box.top;
30![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
31
map.xMin=zleft;
32
map.yMin=ztop;
33
//查找IdentifyLocation元素
34
var div = document.getElementById("IdentifyLocation");
35
if (div==null) {
36
//调用在地图上添加小图标方法
37
addIdentifyLocation();
38
}
39
40
//查找页面上的TaskResults1控件
41
var fpBody = document.getElementById('Results_TaskResults1');
42
var html = fpBody.innerHTML;
43
//进行载入时的信息提醒
44
fpBody.innerHTML = "<div><img src='images/callbackActivityIndicator.gif' align='middle'/> 正在获取信息. . .</div>" + html;
45
//显示放置TaskResults1的Results控件
46
showFloatingPanel('Results');
47
pBody=document.getElementById('Results_BodyRow');
48
//如果Results控件为关闭状态就切换到展可视状态
49
if (fpBody.style.display=="none")
50
{
51
toggleFloatingPanelState('Results','images/collapse.gif','images/expand.gif');
52
}
53
//传递给服务器端的参数
54
var message = "ControlID=Map1&ControlType=Map&EventArg=MapIdentify&Map1_mode=MapIdentify&minx=" + zleft + "&miny=" + ztop;
55
var context = map.controlName;
56
//用javascript的eval的方法执行identifyCallbackFunctionString字符串
57
eval(map.identifyCallbackFunctionString);
58
59
//考虑小图标的高和宽,一遍小图标的下尖点刚刚在点击的位置上
60
var div = document.getElementById("IdentifyLocation");
61
var cWidth = Math.floor(div.clientWidth / 2);
62
var cHeight = div.clientHeight;
63
if (cWidth==0) cWidth = 12;
64
if (cHeight==0) cHeight = 29;
65
var idLeft = zleft - parseInt(map.divObject.style.left) - cWidth;
66
var idTop = ztop - parseInt(map.divObject.style.top) - cHeight + 2;
67
68
//移动IdentifyLocation的位置,并且显示IdentifyLocation
69
window.setTimeout('moveLayer("IdentifyLocation", ' + idLeft + ', ' + idTop + '); showLayer("IdentifyLocation");', 0);
70
map.mode = map.tempMode;
71
map.actionType = map.tempAction;
72
map.cursor = map.tempCursor;
73
return false;
74
75
}
76![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
77
//在地图上添加小图标
78
function addIdentifyLocation()
79
{
80
var content = '<div id="IdentifyLocation" style="position: absolute; left: 0px; top: 0px; visibility: hidden;">';
81
//根据浏览器的不同进行相应的处理
82
if (isIE && ieVersion < 7 && (identifyImageType.toLowerCase()=="png"))
83
{
84
content += '<img src="' + identifyFilePath + 'images/blank.gif" alt="" border="0" hspace="0" vspace="0" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + identifyFilePath + 'images/identify-map-icon.png\');" />\n';
85
}
86
else
87
{
88
content += '<img src="' + identifyFilePath + 'images/identify-map-icon.png" alt="" border="0" hspace="0" vspace="0" />\n';
89
}
90
91
content += '</div>';
92
//把包含小图标的div添加到地图之上
93
map.overlayObject.insertAdjacentHTML("BeforeEnd", content);
94
}
6.到此为止完成了Identify功能的开发,调试运行查看效果。剩下的下一篇继续写。![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
45
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
46
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
47
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
49
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
50
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
51
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
52
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
53
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
54
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
55
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
56
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
57
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
58
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
59
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
60
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
61
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
62
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
63
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
64
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
65
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
66
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
67
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
68
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
69
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
70
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
71
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
72
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
73
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
74
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
75
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
76
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
77
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
78
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
79
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
80
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
81
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
82
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
83
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
84
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
85
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
86
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
87
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
88
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
89
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
90
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
91
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
92
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
93
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
94
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/images/cnblogs_com/hll2008/112.jpg)