Common_CustomEditorTask_CSharp\CustomEditorTask_CSharp\CustomEditExistingFeaturePanel.cs
// Copyright 2011 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and use restrictions. // // See the use restrictions. // namespace CustomEditorTask_CSharp { public class CustomEditExistingFeaturePanel : ESRI.ArcGIS.ADF.ArcGISServer.Editor.EditExistingFeaturePanel { public CustomEditExistingFeaturePanel(ESRI.ArcGIS.ADF.ArcGISServer.Editor.EditorTask editorTask) : base(editorTask) { } // Add custom tools to the standard toolbar on the EditExistingFeaturePanel protected override System.Collections.Generic.List<ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar> CreateToolbars() { System.Collections.Generic.List<ESRI.ArcGIS.ADF.Web.UI.WebControls.Toolbar> editorToolbarList = base.CreateToolbars(); // Add the ClipFeatures tool to the standard toolbar on the EditExistingFeaturePanel ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorTool clipEditorTool = new ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorTool("Clip", this.ParentEditor.MapID, false, ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.ToolGeometry.Line | ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.ToolGeometry.Polygon, 1); clipEditorTool.ClientAction = ESRI.ArcGIS.ADF.Web.UI.WebControls.Constants.HTML_DRAG_RECTANGLE; clipEditorTool.DefaultImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.clip.png"); clipEditorTool.SelectedImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.clip_ON.png"); clipEditorTool.HoverImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.clip_OVER.png"); clipEditorTool.ToolTip = "Clip feature(s)"; clipEditorTool.ServerActionAssembly = "CustomEditorTask_CSharp"; clipEditorTool.ServerActionClass = "CustomEditorTask_CSharp.ClipFeatures"; editorToolbarList[0].ToolbarItems.Add(clipEditorTool); // Add the PolygonToLine command to the standard toolbar on the EditExistingFeaturePanel ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorCommand polygonToLineCommand = new ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.EditorCommand("PolygonToLine", ESRI.ArcGIS.ADF.ArcGISServer.Editor.Tools.ToolGeometry.Polygon, 1); polygonToLineCommand.DefaultImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.polygon2line.png"); polygonToLineCommand.SelectedImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.polygon2line_ON.png"); polygonToLineCommand.HoverImage = this.Page.ClientScript.GetWebResourceUrl(typeof(CustomEditorTask), "CustomEditorTask_CSharp.images.polygon2line_OVER.png"); polygonToLineCommand.ToolTip = "Convert polygon feature(s) to polylines"; polygonToLineCommand.ServerActionAssembly = "CustomEditorTask_CSharp"; polygonToLineCommand.ServerActionClass = "CustomEditorTask_CSharp.PolygonToLine"; editorToolbarList[0].ToolbarItems.Add(polygonToLineCommand); // Increase toolbar width to accommodate the added tools double oldWidth = editorToolbarList[0].Width.Value; editorToolbarList[0].Width = new System.Web.UI.WebControls.Unit(oldWidth + 70, System.Web.UI.WebControls.UnitType.Pixel); return editorToolbarList; } } }