Create a custom GeometricEffect that produces a sine wave effect for linear features


PurposeThis sample demonstrates how to create a geometric effect and adds it to the existing list of geometric effects.

IGeometricEffect and IGraphicAttributes are the two basic interfaces that are required to be implemented by every geometric effect class. IPersistVariant and IEditInteraction interfaces are also implemented here to persist the class and to allow interaction of representation tools with the effect's graphic attributes using the graphical user interface (GUI). In this sample, the graphic attributes are exposed to interact with the Resize tool located in the Representation toolbar using IResizeInteraction interface.

This sample allows a line/polygon geometry to be processed to result in a sine wave effect. The step and height of the sine wave are defined as graphic attributes. Once the class is registered with the Component Object Model (COM) category ESRI Representation geometric effects, the custom class is available for processing linear geometries. See the following screen shot of the Layer Properties dialog box:

The Layer Properties dialog box with highlighted tabs and buttons used in this sample.

Development licensing Deployment licensing
ArcView ArcInfo
ArcEditor ArcEditor
ArcInfo ArcView

Additional Requirements
  • A line or polygon feature class with representations. One has been provided for you if you wish to use it: in the <your install location>/developerkit/SamplesNET/Desktop/data/Representations folder, representations.gdb has a line feature class usa_major_highways which has representations.

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  1. Open the Visual Studio 2005 solution file and build the project. This adds the custom object into the ESRI Representation Geometric Effect component category as SineWaveGE.SineWave.
  2. Click the Add Data button to add a line or polygon feature class with representations to the ArcMap document.
  3. In the Layer Properties dialog box, change the Feature Renderer to Representation Renderer on the Symbology tab.
  4. Select any Representation Rule (for example, RuleA) within the Representation Renderer for which you want to add this custom geometric effect to.
  5. Select a symbol layer (for example, LayerA) within this representation rule or add a new symbol layer.
  6. Click + next to the selected symbol layer to open the Geometric Effects dialog box, which lists all geometric effects. The custom class will be listed under the Line Input and Polygon Input options. Select the SineWave_GeometricEffect custom effect to produce a sine wave effect on the linear geometries.
  7. Change the values for the step and height graphic attributes or accept the default values.
  8. Start an edit session to interactively modify these attributes.
  9. Select a feature representation that uses the rule applied with the custom effect using the Select tool in the Representation toolbar.
  10. Click the Representation Properties tool in the toolbar to open a dialog box. Be sure that the Tool tab is also selected.
  11. Select the Resize tool in the Representation toolbar. All attributes that can be modified interactively using the Resize tool appears in a list under the layer (LayerA). You will see both attributes of sine wave (step and height) listed here.
  12. Select the check boxes for the attributes and use the Resize tool to interactively modify the attributes.
  13. Clear the check boxes, if you do not want to modify these attributes interactively.

SineWave.cs ArcObjects code
AssemblyInfo.cs Assembly information
SineWaveGE.csproj Project file
SineWaveGE.sln Solution file
Download the C# files
SineWave.vb ArcObjects code
SineWaveGE.sln Solution file
SineWaveGE.vbproj Project file
Download the VB.NET files

Download the files for all languages