阅读:1757回复:2
[求助]AO 新建要素的完成事件
新建了个属性窗体,需要在ArcMap中编辑图层时,添加完新要素后跳出这个窗体,但不知道 ,添加完新要素的响应事件,有高手知道怎么做么?
|
|
1楼#
发布于:2008-08-05 09:46
<P>见意你自己写一个ITool类,实现一下添加的功能和弹出窗口的功能就可以了。很简单。</P>
|
|
|
2楼#
发布于:2008-08-11 09:40
<P>好象可以新建个编辑任务,用到IEditTask接口,在帮助里也找到个例子</P><PRE><PRE><CODE><PRE>/// <summary><BR><SUMMARY>/// This class implements the IEditTask interface.</PRE>/// The class is registered as a new EditTask and appears as Select Features Using Sketch
/// in the EditTask Menu. /// The EditTasks performs a selection by line when the sketch is finished. /// This Example also shows how to use the IEdit.getParent() method. <CODE><PRE>/// </summary><BR></PRE></CODE> </SUMMARY>public class Parent_Example : IEditTask { #region IEditTask Members IEditor m_editor; IEditSketch m_editSketch; public void Activate(IEditor editor, IEditTask oldTask) { m_editor = editor; m_editSketch = m_editor as IEditSketch; //Set the geometry type of the edit sketch to polyline m_editSketch.GeometryType = esriGeometryType.esriGeometryPolyline; } public void Deactivate() { //nothing happens } public string Name { get { return "Select Features Using Sketch"; } } public void OnDeleteSketch() { //nothing happens } public void OnFinishSketch() { //Get the selection environment IMxApplication arcMap = m_editor.Parent as IMxApplication; ISelectionEnvironment selectionEnvironment = arcMap.SelectionEnvironment; //Use IMap.SelectbyShape with the edit sketch geometry to do the selection IMap map = m_editor.Map; IActiveView activeView = map as IActiveView; //get rid of old selection first activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); IGeometry editSketchGeometry = m_editSketch.Geometry; map.SelectByShape(editSketchGeometry, selectionEnvironment, false); //refresh with the new selection activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); } #endregion #region ArcGIS Component Category Registrar generated code<BR> /// <summary><BR> /// Required method for ArcGIS Component Category registration -<BR> /// Do not modify the contents of this method with the code editor.<BR> /// </summary><BR> [ComRegisterFunction()]<BR> private static void Reg(String regKey)<BR> {<BR> //EditTasks.Register(regKey);<BR> }</CODE></PRE><PRE><CODE> [ComUnregisterFunction()]<BR> private static void Unreg(String regKey)<BR> {<BR> EditTasks.Unregister(regKey);<BR> }<BR> #endregion<BR>}</CODE></PRE><PRE><CODE></CODE> </PRE><PRE><CODE>但是不清楚怎么把这个类新建的编辑任务添加到ArcMap中</CODE></PRE></PRE> |
|