地圖操作的工具,大部分arcengine都有現成的,但是這些工具不太好用,比如提示和名稱都是英文,地圖操作中沒有右鍵,無法和vs提供的工具條控制項或第三方工具條控制項整合等,還是自己實現比較靈活方便。
我們就從最簡單的放大工具開始來實現地圖操作常用的工具吧!
廢話少說,先上**
1:using system;
2:using esri.arcgis.carto;
3:using esri.arcgis.geometry;
4:using esri.arcgis.controls;
5:using esri.arcgis.display;
6:using esri.arcgis.systemui;
7:using esri.arcgis.adf.catids;
8:using system.runtime.interopservices;
9:
10:namespace techfront.tpis2.giscommfun
11:
39: }
40: m_phookhelper = new hookhelperclass();
41: }
42:
43: ~zoomin()
44:
52:
53:#region icommand members
54:
55:public
void onclick()
56:
58:
59:public
string message
60:
65: }
66:
67:public
int bitmap
68:
73: }
74:
75:public
void oncreate(object hook)
76:
81:
82:public
string caption
83:
88: }
89:
90:public
string tooltip
91:
96: }
97:
98:public
int helpcontextid
99:
105: }
106:
107:public
string name
108:
113: }
114:
115:public
bool checked
116:
121: }
122:
123:public
bool enabled
124:
131: }
132:
133:public
string helpfile
134:
140: }
141:
142:public
string category
143:
148: }
149:
150:#endregion
151:
152:#region itool members
153:
154:public
void onmousedown(int button, int shift, int x, int y)
155:
175: }
176://create a point in map coordinates
177: iactiveview pactiveview = (iactiveview)m_phookhelper.focusmap;
179:
180: m_ismousedown = true;
181:
182: }
183:
184:public
void onmousemove(int button, int shift, int x, int y)
185:
198:
199://move the envelope feedback
201: }
202:
203:public
void onmouseup(int button, int shift, int x, int y)
204:
220:else
221:
231: }
232://set the new extent
233: pactiveview.extent = penvelope;
234://refresh the active view
235: pactiveview.refresh();
236: m_feedback = null;
237: m_ismousedown = false;
238: }
239:
240:public
void onkeydown(int keycode, int shift)
241:
250: }
251: }
252:
253:public
void onkeyup(int keycode, int shift)
254:
257:
258:public
int cursor
259:
267: }
268:
269:public
bool oncontextmenu(int x, int y)
270:
274:
275:public
bool deactivate()
276:
279:
280:public
void refresh(int hdc)
281:
284:
285:public
void ondblclick()
286:
289:
290:#endregion
291: }
292: }
其實,放大工具 主要是實現itool的onmousedown、onmousemove、onmouseup三個方法,設定icommand的caption,tooltip、message、bitmap屬性,實現oncreate方法。
itool的三個方法由名稱就可以知道,三個方法分別是在滑鼠按下左鍵時、按下左鍵移動時、滑鼠彈起時執行。
caption屬性是設定工具顯示的文字;tooltip是設定滑鼠移到工具上時,提示的資訊;bitmap是設定工具的圖示資訊
一起學習ArcEngine(4)平移
地圖平移,可以說是最重要的功能之一,許多地圖的預設工具就是平移。ae實現平移,比較簡單,如下 1 2 地圖漫遊工具3 4 public class pan gistools.base.toolbase5 12 13 public pan axmapcontrol mapctl 14 base map...
開源一起學習
要想自己學習機器學習,3本 聖經 是一定要看的 花書,西瓜書,和統計學習方法 但不是剛入門就要看的,首先啊,我們必須學好學校教的c語言,對程式設計有乙個初步的了解,其次,我們都知道python的厲害,可以幹很多事,也很出名,這就出現了人人都知道py,但不是人人都懂py的現象。確實要想搞機器學習,你最...
一起學習extjs( )
可以說,extjs是系統類專案最好的ui 前端使用者介面 選擇,特別是自從extjs4.0出來後,不管是 美觀還是效能的提高,及其功能之強大,說它排第一,無可厚非。當然,最近也蠻流行easyui這個輕量級的,據說是國人開發的ui。其實,也是很不錯的。大家可以根據自己專案的情況來進行選擇。然後,我們自...