T
The type of the data to be used for assigning features to renderer groups (values).
ESRI.ArcGIS.ADF.Web Send comments on this topic.
Generic ValueMapRenderer Class
See Also  Members   Example 
ESRI.ArcGIS.ADF.Web.Display.Renderer Namespace : Generic ValueMapRenderer Class


A renderer that can display features in a graphics layer with multiple symbol types.

Object Model



Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class ValueMapRenderer(Of T As IComparable(Of T)) 
   Implements IOverlayableRenderer, IRendererIJsonSerializable 
Visual Basic (Usage)Copy Code
Dim instance As ValueMapRenderer(Of T)
C# 
[SerializableAttribute()]
public class ValueMapRenderer<T> : IOverlayableRenderer, IRendererIJsonSerializable  where T: IComparable(Of T)

Type Parameters

T
The type of the data to be used for assigning features to renderer groups (values).

Example

This example creates a new ValueMapRenderer, adds two symbol classes to it, and then uses the renderer for a new graphics layer added to the map. To run this sample on a page:

  • Create a new ASPX page.
  • Add MapResourceManager, Map and Toc controls and set required properties (Map's MapResourceManager, Toc's Map properties).
  • Add a resource item to the MapResourceManager with a map service, then add a second resource item with type GraphicsLayer with a name of "graphicsLayer0". Move the graphics resource to the top of the list of resources.
  • Add the sample code into the Page_PreRender event handler method (create this method if necessary).
  • Change the point x and y locations if necessary to fit within your map service's extent.
  • Run the sample page. Two point symbols will be added to the map display.
C#Copy Code
// Create new ValueMapRenderer 
ValueMapRenderer<int> vMapRend = new ValueMapRenderer<int>(); 
  
// Column in data table with data for rendering 
vMapRend.ValueColumnName = "Population"; 
  
SimpleMarkerSymbol sms; 
  
// Create a ValueRange for the first class 
ValueRange<int> valRange; 
valRange = new ValueRange<int>(); 
valRange.MinValue = 0; 
valRange.MaxValue = 100; 
valRange.Bounds = RangeBounds.Lower; 
sms = new SimpleMarkerSymbol 
    (System.Drawing.Color.Blue, 12); 
valRange.SymbolLabel = "Low"; 
valRange.Symbol = sms; 
vMapRend.Values.Add(valRange); 
  
// Create a ValueRange for the second class 
valRange = new ValueRange<int>(); 
valRange.MinValue = 100; 
valRange.MaxValue = 1000; 
valRange.Bounds = RangeBounds.Upper; 
sms = new SimpleMarkerSymbol( 
    System.Drawing.Color.Red, 15); 
valRange.Symbol = sms; 
valRange.SymbolLabel = "High"; 
vMapRend.Values.Add(valRange); 
  
// Create new graphics layer with two points 
FeatureGraphicsLayer grLayer = new FeatureGraphicsLayer( 
    "MyGraphicsLayer", 
    ESRI.ArcGIS.ADF.Web.FeatureType.Point, 
    vMapRend); 
grLayer.GeometryColumnName = "geom"; 
  
grLayer.Columns.Add("Population", typeof(int)); 
  
DataRow graphicFeature; 
// First point 
graphicFeature = grLayer.NewRow(); 
graphicFeature["Population"] = 52; 
graphicFeature["geom"] =  
    new ESRI.ArcGIS.ADF.Web.Geometry.Point(-92.0, 45.0); 
grLayer.Rows.Add(graphicFeature); 
  
// Second point 
graphicFeature = grLayer.NewRow(); 
graphicFeature["Population"] = 389; 
graphicFeature["geom"] = 
    new ESRI.ArcGIS.ADF.Web.Geometry.Point(36.0, -12.0); 
grLayer.Rows.Add(graphicFeature); 
  
// Get the graphics resource from the Map/MapResourceManager 
ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality graphicsFunct = 
    Map1.GetFunctionality("graphicsLayer0") 
    as ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality; 
if (graphicsFunct != null) 

    ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource mapResource = 
        graphicsFunct.Resource as 
        ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource; 
    // Add the graphics layer to the map 
    mapResource.Graphics.Tables.Add(grLayer); 

    
Visual BasicCopy Code
' Create new ValueMapRenderer
Dim vMapRend As New ValueMapRenderer(Of Integer)()

' Column in data table with data for rendering
vMapRend.ValueColumnName = "Population"

Dim sms As SimpleMarkerSymbol

' Create a ValueRange for the first class
Dim valRange As New ValueRange(Of Integer)()
valRange.MinValue = 0
valRange.MaxValue = 100
valRange.Bounds = RangeBounds.Lower
sms = New SimpleMarkerSymbol(System.Drawing.Color.Blue, 12)
valRange.SymbolLabel = "Low"
valRange.Symbol = sms
vMapRend.Values.Add(valRange)

' Create a ValueRange for the second class
valRange = New ValueRange(Of Integer)()
valRange.MinValue = 100
valRange.MaxValue = 1000
valRange.Bounds = RangeBounds.Upper
sms = New SimpleMarkerSymbol(System.Drawing.Color.Red, 15)
valRange.Symbol = sms
valRange.SymbolLabel = "High"
vMapRend.Values.Add(valRange)

' Create new graphics layer with two points
FeatureGraphicsLayer grLayer = New FeatureGraphicsLayer( _
    "MyGraphicsLayer", _
    ESRI.ArcGIS.ADF.Web.FeatureType.Point, _
    vMapRend)
grLayer.GeomeTryColumnName = "geom"

grLayer.Columns.Add("Population", Type.GetType(Integer))

Dim graphicFeature As DataRow
' First point
graphicFeature = grLayer.NewRow()
graphicFeature("Population") = 52
graphicFeature("geom") = _
    New ESRI.ArcGIS.ADF.Web.GeomeTry.Point(-92.0, 45.0)
grLayer.Rows.Add(graphicFeature)

' Second point
graphicFeature = grLayer.NewRow()
graphicFeature("Population") = 389
graphicFeature("geom") = _
    New ESRI.ArcGIS.ADF.Web.GeomeTry.Point(36.0, -12.0)
grLayer.Rows.Add(graphicFeature)

' Get the graphics resource from the Map/MapResourceManager
Dim graphicsFunct As ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality
graphicsFunct = CType(Map1.GetFunctionality("graphicsLayer0"), _
    ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapFunctionality)
If graphicsFunct IsNot Nothing Then
    Dim mapResource As ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource
    mapResource = CType(graphicsFunct.Resource, _
        ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource)
    ' Add the graphics layer to the map
    mapResource.Graphics.Tables.Add(grLayer)
End If

Remarks

A ValueMapRenderer is used to symbolize a FeatureGraphicsLayer with multiple symbol types. Features in the graphics layer are assigned to symbol classes based on the value in a column of the graphics layer. The name of this column in the graphics layer must be copied to the ValueColumnName of the ValueMapRenderer.

At least two value classes should be added to the Values collection of the ValueMapRenderer. Each class is of a type derived from Value: either ValueRange, StringValue or UniqueValue. The value classes in a single ValueMapRenderer should be all of the same type. A ValueRange has upper and lower boundaries for assigning features based on a numeric-type column. A StringValue is used to assign features based on a string-type column. A UniqueValue is used to assign features based on exact matches to values.

Each value class needs a Symbol to enable rendering the features in the graphics layer. The symbols used must be appropriate for the FeatureType of the FeatureGraphicsLayer. For example, a graphics layer with polygons may be symbolized using a SimpleFillSymbol.

A ValueMapRenderer may optionally have a default symbol and label. The default symbol is used to display features that do not fall into one of the categories covered in the Values collection.

The Values classes will also appear in the Toc (table of contents) when it has been buddied to the Map control. The symbol and label for each value will be displayed.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.Web.Display.Renderer.ValueMapRenderer
      ESRI.ArcGIS.ADF.Web.Display.Renderer.UniqueValueRenderer

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.