Consuming custom feature renderers


Summary
When deployed to ArcGIS, the custom feature renderer can be consumed in ArcGIS Desktop, ArcGIS Engine, and ArcGIS Server applications like other custom feature renderers. This topic discusses the details of consuming a custom feature renderer in ArcGIS Desktop and in a Java application.

In this topic


Consuming custom feature renderers in ArcGIS Desktop

The custom feature renderer that you've developed and deployed in ArcGIS can be applied to a layer in ArcMap. It is essential that the associated property page of the custom feature renderer is also registered with ArcGIS to access (consume) custom feature renderers in ArcGIS Desktop.
 
The following steps show how to apply the custom feature renderer  created in the PointDispersalRenderer sample.
  1. Start ArcMap.
  2. Open a .mxd or .lyr file.
  3. Click Add Data Command and add %AGSDEVKITJAVA%/java/samples/data/AirportsAndGolf/GOLF.shp (some of the rendered point features will be cluttered). See the following screen shot:


  1. Right-click the Golf layer, then select Properties. See the following screen shot:

  1. When Properties is selected, the Layer Properties dialog box appears. The Dispersal Renderer shows on the left pane of the dialog box with other feature renderers. Click the PointDispersal renderer. The graphical user interface (GUI) form that you created is embedded on the Symbology tab. Type the dispersal ratio and click Apply, then click OK and close the dialog box. See the following screen shot:

  1. The custom renderer is applied to the Golf layer and the points are not cluttered. The custom table of contents (TOC) legend implemented for the custom renderer is applied to the Golf layers legend. See the following screen shot:

Applying the custom renderer to a feature layer on the Layer Properties dialog box requires you to implement a custom renderer property page and deploy it to ArcGIS. For more information, see How to implement custom property pages for custom feature renderers.

Consuming custom feature renderers in ArcGIS Engine

Custom feature renderers can be consumed in Java ArcGIS Engine and ArcGIS Server applications. A property page is not required to consume custom feature renderers in Java applications.
The following code example shows how to consume custom feature renderers by creating a dispersal render and applying it to the feature layer:
[Java]
/**
 * The method creates a custom renderer and sets properties depending on
 * the feature type.
 */

private MapBean mapBean = new MapBean();
private TOCBean tocBean = new TocBean()

private void setCustomRenderer(IGeoFeatureLayer geoFeatureLayer){
    try{
        // Create PointDispersalRenderer using EngineContext.
        IFeatureRenderer rend = (IFeatureRenderer)EngineContext.createObject
            (PointDispersalRenderer.class);
        // Set the new renderer to the layer and refresh the map.
        geoFeatureLayer.setRendererByRef(rend);

        //Refresh the map to view the applied changes.

        this.mapBean.refresh(esriViewDrawPhase.esriViewBackground, null, null);

        //Refresh tocBean to update the legends in the TOC.
        this.tocBean.update();
    }
    catch (java.lang.Exception ex){
        ex.printStackTrace();
    }
}


See Also:

Sample: PointDispersalRenderer
How to implement custom property pages for custom feature renderers




Development licensingDeployment licensing
Engine Developer KitEngine
ServerArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced
Server