In this topic
- Consuming custom feature renderers in ArcGIS Desktop
- Consuming custom feature renderers in ArcGIS Engine
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.
- Start ArcMap.
- Open a .mxd or .lyr file.
- 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:
- Right-click the Golf layer, then select Properties. See the following screen shot:
- 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:
- 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: PointDispersalRendererHow to implement custom property pages for custom feature renderers
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
Server | ArcGIS for Desktop Basic |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced | |
Server |