Common Custom EditorTask



Description:

While the EditorTask includes a comprehensive set of out-of-the-box capabilities, many Web editing solutions will require customizing the behavior of the EditorTask to satisfy user specific requirements. The EditorTask offers two options for developing a custom solution:

1. Using the out-of-the-box EditorTask, add custom functionality by handling EditorTask events in a page.

2. Create a custom Web control by subclassing the EditorTask and its child controls.

Option 1 is designed for convenient access to standard EditorTask events in a Web application. Option 2 is more complex, but provides comprehensive access to the implementation details (which includes events) of the EditorTask and its subcomponents. It also enables you to package a Web ADF editing solution as a redistributable custom EditorTask control. This sample illustrates both options.

Two projects are packaged with the sample:

A class library project (e.g CustomEditorTask_CSharp) that contains the classes and content needed to create a custom EditorTask control. Note the following customizations:


A Web project (e.g. CustomEditorTaskWebApp_CSharp) that contains two pages and a set of custom components (Editor tools and panels) in the App_Code folder. One page includes a reference to the custom EditorTask control created in the aforementioned project. The other page contains an out-of-the-box Editor task which is customized by handling events on the EditorTask. Both pages handle the release of server context for non-pooled services via a callback when the browser is closed. Note the following customizations to the out-of-the-box EditorTask


Data is included with the sample in the "data" directory.
Products:
Server: C#, VB.NET

Platforms: Windows

Minimum ArcGIS Release: 9.2

How to use:
  1. Design Time:
    1. Verify that the Web ADF for the .NET Framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
    2. In Windows Explorer, navigate to <ArcGIS install location>\DeveloperKit\SamplesNet\Server\Web_Applications and unzip Common_CustomEditorTaskCSharp.zip or Common_CustomEditorTaskVBNet.zip to a location of your choice. You should see either a CSharp or VBNet folder appear where you unzipped the files.
    3. In Windows Explorer, open the directory referencing the language of your choice: CSharp or VBNet. Copy the Common_CustomEditorTask_<language>, to c:\inetpub\wwwroot. The <language> variable may be either CSharp or VBNet.

    4. Setup access to the geodatabase
      1. You must have access to SQLExpress which has been configured for use with ArcSDE workgroup geodatabases to use the data packaged with the sample. If you use your own data, you will need to change some portions of the sample code to function.
      2. Assuming you have access to SQLExpress configured for use with ArcSDE workgroup geodatabases, open ArcCatalog; under Database Servers click Add Database Server and connect to SQLExpress.
      3. Right-click on the SQLExpress instance and select Permissions. Add the ArcGIS Server container account.
      4. Right-click the SQLExpress instance and select Attach. Navigate to the EditParcels.mdf included with the sample (e.g. c:\inetpub\wwwroot\Common_ CustomEditorTask _CSharp\data\EditParcels.mdf). The EditParcels geodatabase should be added to the geodatabase list for the SQLExpress instance in ArcCatalog.
      5. Right-click on the EditParcels geodatabase and select Administration>Permissions. Grant the ArcGIS Server container account read\write privileges.

    5. Configure the map document and create the map service
      1. Open the EditParcelsDemo.mxd in ArcMap. Note that the data source for every layer is invalid, thus a red exclamation point is displayed next to each layer name. Click (single left mouse button click) on the red exclamation point next to the "Address Points" layer to display the Set Data Source dialog.
      2. Navigate to the SQLExpress instance on which the EditParcels geodatabase is available. Select the "EditParcels.DBO.AddressPoints" feature class and select OK. Data sources for all layers in the map document should be repaired. Save the map document. ArcMap should appear as follows
      3. Open ArcCatalog and add a new map service. With the following properties:


        Name: EditParcelsDemo
        Map document: <path to EditParcelsDemo.mxd>
        Pooling: Not Pooled, Min instances: 0, Max instances 6


        When finished, start the service.
    6. Open the IIS Manager from Control Panel > Administrative Tools > Internet Information Services (IIS) Manager or Internet Information Services
    7. In the console tree view on the left, navigate to Local Computer > Web Sites > Default Web Site. Or navigate to the Web site on which you would like to configure the sample.
    8. Open the Common_ CustomEditorTask _<language> folder, right-click the CustomEditorTaskWebApp_<language> folder and click Properties.
    9. On the Directory tab, click the Create button in the Application Settings section of this panel. Click OK to dismiss the Properties dialog.
    10. Launch Microsoft Visual Studio 2005 and open the Common_ CustomEditorTask _<language> solution located where you unzipped the sample content. (e.g. c:\inetpub\wwwroot\Common_CustomEditorTask_CSharp\Common_CustomEditorTask _VBNet.sln).
    11. In the Solution Explorer, right-click the CustomEditorTaskWebApp _<language> project and select 'Set as StartUp Project'. Also, right-click CustomEditorTaskPage.aspx and select 'Set As Start Page'.
    12. Also in Solution Explorer, right-click the custom EditorTask class library project (e.g. CustomEditorTask_<language>) and build the project. The custom EditorTask assembly should be added to the Web project.
    13. If necessary, set the runtime identity of the Web application:
      1. At design-time, the identity of the user running Visual Studio is used to connect to an ArcGIS Server local data source. At runtime, that identity is established by the Web application. Only one identity can be used to define access to all ArcGIS Server local data sources in a single Web application. This identity can be explicitly defined when building the Web ADF application in Visual Studio by right-clicking the Web project in Solution Explorer, and selecting the Add ArcGIS Identity option. Enter the identity credentials which will be used to access ArcGIS Server local resources at runtime. This information will be added to the web.config file within a standard ASP.NET identity tag. If the "Encrypt identity in web.config" checkbox is checked, the identity tag will be encrypted, otherwise the username and password will be stored as clear text.
        -or-
      2. Open the web.config file and add an <identity> element within <system.web>. Set the impersonate attribute to "true". Add a userName and password attribute and set them to a valid user account. Since you will be working with an ArcGIS Server Local data source in this sample, make sure the account has access to the GIS Server resources referenced in the MapResourceManager control.
    14. Open the CustomEditorTaskPage.aspx in design view and define the connection properties for the single ArcGIS Server Local map resource item in the MapResourceManager.
    15. Also in design-view, set CustomEditorTask1 control properties to define the map and resource, editable layers (select all) and editable versions (select all).
    16. Open the StandardEditorTaskPage.aspx and modify the MapResourceManager and EditorTask1 using the same properties defined in the CustomEditorTaskPage.aspx. Save the project.
  2. Run Time:
    1. Browse to the Web page that contains the out of the box EditorTask control, customized via EditorTask events in the page (for example, http://localhost/Common_CustomEditorTask_CSharp/Common_CustomEditorTaskWebApp_CSharp/StandardEditorTaskPage.aspx).
    2. A map containing the sample data and a menu with the option of enabling the EditorTask should display. Click on the menu item to open the EditorTask and select a version to edit.
    3. Start editing features and note the customizations mentioned in the sample description above.
    4. Browse to the Web page that contains the custom EditorTask control (for example, http://localhost/Common_CustomEditorTask_CSharp/Common_CustomEditorTaskWebApp_CSharp/CustomEditorTaskPage.aspx).
    5. Again, note the customizations mentioned in the sample description while editing features.

Download the C# files
CustomEditorTask_CSharp.csproj Custom EditorTask class library project file.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/ClipFeatures.cs Custom editor tool to clip selected features.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/CustomEditExistingFeatureEditor.cs Custom editor panel that subclasses the EditExistingFeaturePanel class.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/CustomEditor.cs Custom Editor class.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/CustomEditorSettingsPanel.cs Custom editor panel that subclasses the SettingsPanel class.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/CustomEditorTask.cs Custom EditorTask that subclasses the out of the box EditorTask.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/CustomSnappingPanel.cs Custom editor panel replacing the out of the box SettingsPanel.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/PolygonToLine.cs Custom editor command to convert selected polygons to lines.
Common_CustomEditorTask_CSharp/CustomEditorTask_CSharp/PolygonToLineLayerEditorPanel.cs Custom editor panel that contains a drop down list to set the line layer for the PolygonToLine command.
Common_CustomEditorTask_CSharp/CustomEditorTaskWebApp_CSharp/CustomEditorTaskPage.aspx Web page containing the custom EditorTask control.
Common_CustomEditorTask_CSharp/CustomEditorTaskWebApp_CSharp/CustomEditorTaskPage.aspx.cs Code behind. Only contains code to release server context for non-pooled services.
Common_CustomEditorTask_CSharp/CustomEditorTaskWebApp_CSharp/StandardEditorTaskPage.aspx Web page containing the out of the box EditorTask control.
Common_CustomEditorTask_CSharp/CustomEditorTaskWebApp_CSharp/StandardEditorTaskPage.aspx.cs Code behind. Contains code that works with EditorTask events to customize functionality.
Download the VB.NET files
CustomEditorTask_VBNet.vbproj Custom EditorTask class library project file.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/ClipFeatures.vb Custom editor tool to clip selected features.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/CustomEditExistingFeatureEditor.vb Custom editor panel that subclasses the EditExistingFeaturePanel class.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/CustomEditor.vb Custom Editor class.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/CustomEditorSettingsPanel.vb Custom editor panel that subclasses the SettingsPanel class.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/CustomEditorTask.vb Custom EditorTask that subclasses the out of the box EditorTask.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/CustomSnappingPanel.vb Custom editor panel replacing the out of the box SettingsPanel.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/PolygonToLine.vb Custom editor command to convert selected polygons to lines.
Common_CustomEditorTask_VBNet/CustomEditorTask_VBNet/PolygonToLineLayerEditorPanel.vb Custom editor panel that contains a drop down list to set the line layer for the PolygonToLine command.
Common_CustomEditorTask_VBNet/CustomEditorTaskWebApp_VBNet/CustomEditorTaskPage.aspx Web page containing the custom EditorTask control.
Common_CustomEditorTask_VBNet/CustomEditorTaskWebApp_VBNet/CustomEditorTaskPage.aspx.vb Code behind. Only contains code to release server context for non-pooled services.
Common_CustomEditorTask_VBNet/CustomEditorTaskWebApp_VBNet/StandardEditorTaskPage.aspx Web page containing the out of the box EditorTask control.
Common_CustomEditorTask_VBNet/CustomEditorTaskWebApp_CSharp/StandardEditorTaskPage.aspx.vb Code behind. Contains code that works with EditorTask events to customize functionality.

Download the files for all languages