Common Custom renderers


Purpose
This sample demonstrates how to create custom Web Application Developer Framework (ADF) renderers for use with Web ADF graphics layers.
 
A single base class provides the minimum required implementation for an ADF renderer. A set of custom renderer classes illustrate how to build on this basic implementation to support rendering features in both the Map and Toc controls. Custom renderer examples include simple image markers, custom line styles and polygon fills, label points, graduated colors, and 3D display. These renderers are used on the pages included with this sample as follows:
  • GraduatedColorRenderer.aspx—Uses a GraduatedColorRenderer, which determines each feature's color by mapping a field value to a gradient
  • LabelPointRenderer.aspx—Uses a LabelPointRenderer, which creates labels at feature points with text specified by a field value
  • LineColorRenderer.aspx—Uses a LineColorRenderer, which determines each feature's color and line width through feature attributes
  • SimplePointRenderer.aspx—Uses a SimplePointRenderer, which renders points with an image specified in a feature attribute
  • SimpleRenderer3D.aspx—Uses a SimpleRenderer3D, which extrudes lines and polygons to render them in 2 1/2D

How to use

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.

At 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>\DeveloperKit10.0\Samples\ServerNET. This folder contains the Common_CustomRenderers CSharp and VBNet folders.
  3. Open the folder of the language you're going to use—CSharp or VBNet—and copy the Common_CustomRenderers_<language> folder to c:\inetpub\wwwroot. The <language> variable can be either CSharp or VBNet.
  4. Open the IIS Manager from Control Panel > Administrative Tools > Internet Information Services (IIS) Manager or Internet Information Services.
  5. In the console tree view on the left, navigate to Local Computer > Web Sites > Default Web Site, expand Default Web Site, right-click the Common_CustomRenderers_<language> folder, and click Properties. The Properties dialog box opens.
  6. Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
  7. Start Microsoft Visual Studio 2008 or 2010, and open the solution for the version of Visual Studio you're using. The Visual Studio version is appended to the solution file name. For example, the Visual Studio 2008 solution file for the Common_CustomRenderers_CSharp sample is Common_CustomRenderers_CSharp2008.sln and is located in the c:\inetpub\wwwroot\Common_CustomRenderers_CSharp folder.
  8. In Solution Explorer, right-click the page you want to view and select Set As Start Page.
  9. Click the Debug drop-down menu and click Start Debugging.

At run time
  1. Browse to the application uniform resource locator (URL) (for example, http://localhost/Common_CustomRenderers_CSharp) or start the application from Visual Studio.
  2. In Default.aspx, click the link to the sample page you want to view.
  3. In GraduatedColorRenderer.aspx and SimplePointRenderer.aspx, observe the graphic features drawn by the custom renderer.
  4. Refresh the page to see a new set of features.
  5. Expand the GraphicsDataSource node of the TOC and any child nodes. Swatches have been created by the custom renderer.
  6. In LabelPointRender.aspx, LineColorRenderer.aspx, and SimpleRenderer3D.aspx, observe the graphic features drawn by the custom renderer.
  7. Refresh the page to see a new set of features.

Common_CustomRenderers_CSharp\Default.aspx Contains links to the other sample pages.
Common_CustomRenderers_CSharp\Default.aspx.cs Code behind the .aspx page.
Common_CustomRenderers_CSharp\GraduatedColorRenderer.aspx Illustrates use of the GraduatedColorRenderer.
Common_CustomRenderers_CSharp\GraduatedColorRenderer.aspx.cs Code behind the .aspx page.
Common_CustomRenderers_CSharp\LabelPointRenderer.aspx Illustrates use of the LabelPointRenderer.
Common_CustomRenderers_CSharp\LabelPointRenderer.aspx.cs Code behind the .aspx page.
Common_CustomRenderers_CSharp\LineColorRenderer.aspx Illustrates use of the LineColorRenderer.
Common_CustomRenderers_CSharp\SimplePointRenderer.aspx.cs Code behind the .aspx page.
Common_CustomRenderers_CSharp\SimpleRenderer3D.aspx Illustrates use of the SimpleRenderer3D.
Common_CustomRenderers_CSharp\SimpleRenderer3D.aspx.cs Code behind the .aspx page.
Common_CustomRenderers_CSharp\App_Code\GenerateGraphicsHelper.cs Contains utility methods for generating graphic features.
Common_CustomRenderers_CSharp\App_Code\GraduatedColorRenderer.cs GraduatedColorRenderer implementation.
Common_CustomRenderers_CSharp\App_Code\LabelPointRenderer.cs LabelPointRenderer implementation.
Common_CustomRenderers_CSharp\App_Code\LineColorRenderer.cs LineColorRenderer implementation.
Common_CustomRenderers_CSharp\App_Code\RendererBase.cs Inheritable base class to simplify implementation of IRenderer.
Common_CustomRenderers_CSharp\App_Code\SimplePointRenderer.cs SimplePointRenderer implementation.
Common_CustomRenderers_CSharp\App_Code\SimpleRenderer3D.cs SimpleRenderer3D implementation.
Common_CustomRenderers_CSharp\App_Code\Utility.cs Contains utility methods for rendering features.
Download the C# files
Common_CustomRenderers_VBNet\Default.aspx Contains links to the other sample pages.
Common_CustomRenderers_VBNet\Default.aspx.vb Code behind the .aspx page.
Common_CustomRenderers_VBNet\GraduatedColorRenderer.aspx Illustrates use of the GraduatedColorRenderer.
Common_CustomRenderers_VBNet\GraduatedColorRenderer.aspx.vb Code behind the .aspx page.
Common_CustomRenderers_VBNet\LabelPointRenderer.aspx Illustrates use of the LabelPointRenderer.
Common_CustomRenderers_VBNet\LabelPointRenderer.aspx.vb Code behind the .aspx page.
Common_CustomRenderers_VBNet\LineColorRenderer.aspx Illustrates use of the LineColorRenderer.
Common_CustomRenderers_VBNet\SimplePointRenderer.aspx.vb Code behind the .aspx page.
Common_CustomRenderers_VBNet\SimpleRenderer3D.aspx Illustrates use of the SimpleRenderer3D.
Common_CustomRenderers_VBNet\SimpleRenderer3D.aspx.vb Code behind the .aspx page.
Common_CustomRenderers_VBNet\App_Code\GenerateGraphicsHelper.vb Contains utility methods for generating graphic features.
Common_CustomRenderers_VBNet\App_Code\GraduatedColorRenderer.vb GraduatedColorRenderer implementation.
Common_CustomRenderers_VBNet\App_Code\LabelPointRenderer.vb LabelPointRenderer implementation.
Common_CustomRenderers_VBNet\App_Code\LineColorRenderer.vb LineColorRenderer implementation.
Common_CustomRenderers_VBNet\App_Code\RendererBase.vb Inheritable base class to simplify implementation of IRenderer.
Common_CustomRenderers_VBNet\App_Code\SimplePointRenderer.vb SimplePointRenderer implementation.
Common_CustomRenderers_VBNet\App_Code\SimpleRenderer3D.vb SimpleRenderer3D implementation.
Common_CustomRenderers_VBNet\App_Code\Utility.vb Contains utility methods for rendering features.
Download the VB.NET files

Download the files for all languages