Returns the appropriate SymbolType for the indicated GeometryType.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public static SymbolType GeometryTypeToSymbolType(
	GeometryType geometryType
)
Visual Basic (Declaration)
Public Shared Function GeometryTypeToSymbolType ( _
	geometryType As GeometryType _
) As SymbolType

Return Value

Remarks

This method tells you what kind of symbol is appropriate for any Geometry, e.g. Envelope and Polygon both use Fill; Multipoint and Point both use Marker. This method allows you to find out the appropriate SymbolType without having to write your own switch statement with every type of Geometry.

Examples

The code below demonstrates how to obtain the appropriate SymbolType for a specific GeometryType, by using the Symbol.GeometryTypeToSymbolType method.
CopyC#
    //Create a list of geometries
    List<Geometry> geometryList = new List<Geometry>();

    //Create a point
    ESRI.ArcGISExplorer.Geometry.Point point = new ESRI.ArcGISExplorer.Geometry.Point(1, 1);

    //Create a polyline
    Polyline polyline = new Polyline(CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid);
    polyline.AddPoints(new ESRI.ArcGISExplorer.Geometry.Point[] { 
new ESRI.ArcGISExplorer.Geometry.Point(326872.482358681, 673940.581779784), 
new ESRI.ArcGISExplorer.Geometry.Point(326937.296501129, 673957.506541019), 
new ESRI.ArcGISExplorer.Geometry.Point(326953.836608697, 673895.000320552)});

    //Create a polygon
    Polygon polygon = new Polygon();
    // Add a series of points to the Polygon (overloads are available to add multiple Points.
    polygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33434596343321, 48.8628885302916));
    polygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33269733037166, 48.8603451299656));
    polygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33659764618658, 48.8594678571346));
    polygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33960511237599, 48.8591968205275));
    polygon.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.340578062027, 48.8608773611669));
    // Ensure the Polygon is a closed shape.
    polygon.Close();

    //Add to the list of geometries
    geometryList.Add(point);
    geometryList.Add(polyline);
    geometryList.Add(polygon);

    //Loop through the list of geometries
    foreach (Geometry geometry in geometryList)
    {

        Graphic graphic = new Graphic(geometry);

        //Get symbol type for the geometry type
        switch (Symbol.GeometryTypeToSymbolType(geometry.GeometryType))
        {
            case SymbolType.Fill:
                graphic.Symbol = Symbol.Fill.Solid.Blue;
                break;
            case SymbolType.Line:
                graphic.Symbol = Symbol.Line.Solid.LightBlue;
                break;
            case SymbolType.Marker:
                graphic.Symbol = Symbol.Marker.Pushpin.Blue;
                break;
            case SymbolType.Unknown:
                break;
        }

        ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Graphics.Add(graphic);
    }
CopyVB.NET
'Create a list of geometries
Dim geometryList As New List(Of Geometry)()

'Create a point
Dim point As New ESRI.ArcGISExplorer.Geometry.Point(1, 1)

'Create a polyline
Dim polyline As New ESRI.ArcGISExplorer.Geometry.Polyline(CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid)
polyline.AddPoints(New ESRI.ArcGISExplorer.Geometry.Point() {New ESRI.ArcGISExplorer.Geometry.Point(326872.482358681, 673940.581779784), New ESRI.ArcGISExplorer.Geometry.Point(326937.296501129, 673957.506541019), New ESRI.ArcGISExplorer.Geometry.Point(326953.836608697, 673895.000320552)})

'Create a polygon
Dim polygon As New ESRI.ArcGISExplorer.Geometry.Polygon()
' Add a series of points to the Polygon (overloads are available to add multiple Points.
polygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33434596343321, 48.8628885302916))
polygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33269733037166, 48.8603451299656))
polygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33659764618658, 48.8594678571346))
polygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33960511237599, 48.8591968205275))
polygon.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.340578062027, 48.8608773611669))
' Ensure the Polygon is a closed shape.
polygon.Close()

'Add to the list of geometries
geometryList.Add(point)
geometryList.Add(polyline)
geometryList.Add(polygon)

'Loop through the list of geometries
For Each geometry As ESRI.ArcGISExplorer.Geometry.Geometry In geometryList

    Dim graphic As New Graphic(geometry)

    'Get symbol type for the geometry type
    Select Case Symbol.GeometryTypeToSymbolType(geometry.GeometryType)
        Case SymbolType.Fill
            graphic.Symbol = Symbol.Fill.Solid.Blue
            Exit Select
        Case SymbolType.Line
            graphic.Symbol = Symbol.Line.Solid.LightBlue
            Exit Select
        Case SymbolType.Marker
            graphic.Symbol = Symbol.Marker.Pushpin.Blue
            Exit Select
        Case SymbolType.Unknown
            Exit Select
    End Select

    ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Graphics.Add(graphic)
Next

See Also