Implementing a schematic digitizing tool


Purpose
This sample shows how to implement a tool that can be used in ArcMap to digitize schematic features in schematic diagrams. This sample includes a configuration file to work with a specific type of diagram (a diagram in the DigitizingSample schematic dataset). The Extensible Markup Language (XML) configuration file can be modified to work with other schematic datasets as well.
This sample also shows how to use the Schematic library to create schematic features and how to use an add-in dockable window.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample.

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/Schematics/GenericDigitizing.gdb and <Your ArcGIS Developer Kit Install directory>/Samples/data/Schematics/DigitizeProperties.xml.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

Building the project
  1. Start Visual Studio, open the solution file, and build the project.

Adding the new tool to the ArcMap toolbar and opening the sample schematic diagram
  1. Navigate to <ArcGIS DeveloperKit install location>\Samples\data\Schematics, and copy both the GenericDigitizing.gdb geodatabase and DigitizeProperties.xml file in a folder for which you have full rights.
  2. Start ArcMap and open a new empty map.
  3. Click Customize, and click Customize Mode. The Customize dialog box opens.
  4. Click the Commands tab, select the Schematic Samples category, and drag the DigitTool tool onto the Schematic Editor toolbar.
  5. Click Close on the Customize dialog box.
  6. Click Open Schematic Diagrams on the Schematic toolbar and browse to and select the Crime1 schematic diagram contained in the DigitizingSample schematic dataset in the GenericDigitizing sample geodatabase you copied at step#1.
  7. Click Start Editing Diagram on the Schematic Editor drop-down menu.
  8. Click the schematic digitizing tool (DigitTool). The Schematic Digitize dockable window opens. This window is organized in two sections: the first section concerns the digitizing of schematic nodes, the second section concerns the digitizing of schematic links.

Digitizing schematic nodes
  1. On the Schematic Digitize dialog box's first section, click the Node Type drop-down list
  2. Choose the type of node you want to digitize in the active diagram; for this example, choose Person.
  3. Fill in the Name text box; for example, type PersonA. The name is a mandatory parameter that needs to be specified before digitizing the related node in the active schematic diagram.
  4. Click anywhere in the background of the schematic diagram. The new PersonA schematic node appears at the clicked location.

Digitizing schematic links
  1. On the Schematic Digitize dialog box's second section, click the Link Type drop-down list.
  2. Choose the type of link you want to digitize in the active diagram; for this example, choose Relation.
  3. Using the Relation Type drop-down list, specify the type of relation you want to create. This is a mandatory parameter that needs to be specified before going further. For this example, choose person-person-friend.
  4. Click two persons nodes in the active diagram. A link connecting the two clicked nodes is created.

Stopping the digitizing operations
  1. Click Stop Editing Diagram on the Schematic Editor drop-down menu.
  2. Click Yes to save the edits. The newly digitized schematic features are saved in the schematic dataset.

Additional information

If you want to use this add-in tool to digitize schematic features in your own schematic database, you only need to configure the DigitizeProperties.xml file.
  1. Navigate to <ArcGIS DeveloperKit install location>\Samples\data\Schematics, and copy the DigitizeProperties.xml file in the same folder your schematic database is.
  2. Edit this copied DigitizeProperties.xml file with a text editor.
    1. REQUIRED—Set up the node and link schematic feature classes you want to digitize:
      1. Create a NodeFeature item for each node schematic feature class you want to digitize and type the exact name of the node schematic feature class in your schematic dataset for the FeatureClassName parameter.
        For example, if you want to digitize Valves schematic nodes, you must configure a NodeFeature item as follows:
        <NodeFeature FeatureClassName="Valves">
        </NodeFeature>
      2. Create a LinkFeature item for each link schematic feature class you want to digitize and type the exact name of the link schematic feature class in your schematic dataset for the FeatureClassName parameter.
        For example, if you want to digitize PrimaryLines schematic links, you must configure a LinkFeature item as follows:
        <LinkFeature FeatureClassName="PrimaryLines">
        </LinkFeature>
    2. OPTIONAL—Set up the attributes you want to edit for each digitized schematic feature:
      1. Create a Field item for each attribute you want to be editable through the digitizing form.
      2. Specify the DisplayName parameter. This is the label that will display for this attribute on the digitizing form.
      3. Specify the DBColumnName parameter. This is name of the related field in the schematic feature class.
      4. Specify the Type parameter—Text, Date, Combo or MaskText. This is the type of attribute values the user will edit.
        • With a Text type, a regular text box will be automatically added to the digitizing form.
          In this case, when configuring the Length parameter, you can also limit the number of characters the user can type in the text box.
        • With a Date type, a drop down date pick list will be automatically added to the digitizing form.
        • With a Combo type, a combo box will be automatically added to the digitizing form.
          In this case, you must also configure a list of Value parameters, for each possible value you want to display in the combo box.
        • With a MaskText type, a text box will be automatically added to the digitizing form to allow users typing a specific type of text value that will have to verify a specific format. For example, a field that will be used to have the user enter their social security number.
          In this case, you must provide the expected format—Mask parameter. For example, "###-##-###". See the Appendix section above for more details on Mask.
      5. Specify when the attribute is mandatory or not—Mandatory parameter, True  or False. With Mandatory="True", it forces the user to specify the field value.
Here are sample parameters to allow the digitizing of nodes based on the Persons schematic feature class and fill some attribute fields for the digitized person:
<NodeFeature FeatureClassName="Persons" />
<Field DisplayName="Your Name" DBColumnName="NAME" Type="Text" Length="30" Mandatory="True">
<Field DisplayName="Date of Birth" DBColumnName="BIRTH_DATE" Type="Date" Mandatory="True">
<Field DisplayName="Sexe" DBColumnName="SEXE" Type="Combo"
<Value Default="True">"M"</Value>
<Value>"F"</Value>
</Field>
<Field DisplayName="Social Security Number" DBColumnName="SS_NUM" Type="MaskText" Mask= "###-##-###"/>
</NodeFeature>
    1. OPTIONAL—Set up the link relationships if you want to enforce that a certain type of link can only connect to and from certain type of nodes.
      Such link relationships must be configured inside a <Relations>…</Relations> tag, surrounding all the individual <Relation…></Relation>.
      1. Specify the LinkType parameter. This is the exact name of the link schematic feature class in your schematic dataset you want to use when digitizing this kind of relation.
      2. Specify the FromType parameter. This is the exact name of the node schematic feature class in your schematic dataset which contains nodes that can be at the start for this kind of relations.
      3. Specify the ToType parameter. This is the exact name of the node schematic feature class in your schematic dataset which contains nodes that can be at the end for this kind of relations.
      4. Specify subtypes for the possible relations if needed.
        For example, if you want to allow a connection from a Persons node to another Persons node, but want to specify if the relationship is as a Friend or Enemy, you can specify two parameters Value.
<Relations>
<Relation LinkType="Link1" FromType="Persons" ToType="Persons">
<Value>Friend</Value>
<Value>Enemy</Value>
</Relation>
</Relations>
    1. REQUIRED—Customize the digitizing form:
      1. Specify the MandatoryColor parameter. This is the background color that will be used for each edited attribute you set up as mandatory during step#4.e.
      2. Specify the FormName parameter. This is the caption of the digitizing form the user will see.
      3. Specify the AutoClearAfterCreate parameter, True or False. This determines whether all edited attributes are cleared after the user digitizes a schematic feature or not.
Those three parameters must be configured at the end of the XML file:
<?xml version="1.0" encoding="utf-8" ?>
<Properties>
<MandatoryColor>Yellow</MandatoryColor>
<FormName>Digitize Inside Plants</FormName>
<AutoClearAfterCreate>True</AutoClearAfterCreate>
</Properties>
    1. Save your DigitizeProperties.xml file.
  1. Set up your schematic dataset so that it knows where the DigitizeProperties.xml file is.
    1. Edit your schematic dataset within Schematic Dataset Editor.
    2. Right-click the schematic diagram template entry related to the diagrams in which you want to allow the digitizing of schematic features, and click New Attribute.
    3. Type DigitizePropertiesLocation for the attribute Name.
    4. Select Constant for the attribute Type.
    5. Type .\DigitizeProperties.xml for the attribute Value.
    6. Click OK.
    7. Save your schematic dataset.

Appendix—Mask Characters Description
  • # Digit placeholder.
  • . Decimal placeholder.
    The actual character used is the one specified as the decimal placeholder in your international settings. This character is treated as a literal for masking purposes.
  • , Thousands separator.
    The actual character used is the one specified as the thousands separator in your international settings. This character is treated as a literal for masking purposes.
  • : Time separator.
    The actual character used is the one specified as the time separator in your international settings. This character is treated as a literal for masking purposes.
  • / Date separator.
    The actual character used is the one specified as the date separator in your international settings. This character is treated as a literal for masking purposes.
  • \ Treat the next character in the mask string as a literal. This allows you to include the '#', '&', 'A', and '?' characters in the mask. This character is treated as a literal for masking purposes.
  • & Character placeholder.
    Valid values for this placeholder are ANSI characters in the following ranges: 32-126 and 128-255.
  • > Convert all the characters that follow to uppercase.
  • < Convert all the characters that follow to lowercase.
  • A Alphanumeric character placeholder (entry required).
    For example: a – z, A – Z, or 0 – 9.
  • a Alphanumeric character placeholder (entry optional).
  • 9 Digit placeholder (entry optional).
    For example: 0 – 9.
  • C Character or space placeholder (entry optional).
    This operates exactly like the & placeholder, and ensures compatibility with Microsoft Access.
  • ? Letter placeholder.
    For example: a – z or A – Z.
Literal All other symbols are displayed as literals; that is, as themselves.
 


DigitTool.vb Class file that implements the digitizing tool.
DockableDigit.vb Class that implements the dockable window with digit properties.
Config.esriaddinx Add-in declarations in XML.
Download the VB.NET files
DigitTool.cs Class file that implements the digitizing tool.
DockableDigit.cs Class that implements the dockable window with digit properties.
Config.esriaddinx Add-in declarations in XML.
Download the C# files

Download the files for all languages

See Also:

ISchematicInMemoryFeatureClass




Development licensing Deployment licensing
ArcGIS for Desktop Basic: Schematics ArcGIS for Desktop Basic: Schematics
ArcGIS for Desktop Standard: Schematics ArcGIS for Desktop Standard: Schematics
ArcGIS for Desktop Advanced: Schematics ArcGIS for Desktop Advanced: Schematics