ESRI.ArcGIS.ADF.IMS
Polyline Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.IMS.Geometry Namespace : Polyline Class




Represents a grouping of Paths.

Object Model



Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class Polyline 
   Inherits Geometry
Visual Basic (Usage)Copy Code
Dim instance As Polyline
C# 
[SerializableAttribute()]
public class Polyline : Geometry 

Example

This example adds a Polyline to the map in an acetate layer. It first creates a new Polyline, adds two Path objects to it, sets the Polyline as the geometry of an acetate GeometryElement, creates an AcetateLayer to hold the GeometryElement, and finally adds the AcetateLayer to the map. The code assumes an existing MapView object.
C#Copy Code
// Create a new polyline 

ESRI.ArcGIS.ADF.IMS.Geometry.Polyline line = 

    new ESRI.ArcGIS.ADF.IMS.Geometry.Polyline(); 

  

// Create two paths and add them to the line 

ESRI.ArcGIS.ADF.IMS.Geometry.Path path; 

path = new ESRI.ArcGIS.ADF.IMS.Geometry.Path(); 

path.Points.Add(new ESRI.ArcGIS.ADF.IMS.Geometry.Point(11.0, 18.2)); 

path.Points.Add(new ESRI.ArcGIS.ADF.IMS.Geometry.Point(17.3, 22.5)); 

line.Paths.Add(path); 

  

path = new ESRI.ArcGIS.ADF.IMS.Geometry.Path(); 

path.Points.Add(new ESRI.ArcGIS.ADF.IMS.Geometry.Point(18.0, 22.5)); 

path.Points.Add(new ESRI.ArcGIS.ADF.IMS.Geometry.Point(22.3, 32.1)); 

line.Paths.Add(path); 

  

// Create an acetate geometry element and add the polyline to it 

ESRI.ArcGIS.ADF.IMS.Display.Symbol.SimpleLineSymbol lineSymbol = 

    new ESRI.ArcGIS.ADF.IMS.Display.Symbol.SimpleLineSymbol(); 

lineSymbol.Color = System.Drawing.Color.Red; 

ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.GeometryElement acetatePoly = 

    new ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.GeometryElement( 

    ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.AcetateUnits.Database, line, lineSymbol); 

  

// Create an acetate layer for the geometry element, and add it to the map 

ESRI.ArcGIS.ADF.IMS.Carto.Layer.AcetateLayer acetateLayer = 

    new ESRI.ArcGIS.ADF.IMS.Carto.Layer.AcetateLayer("mapGraphics"); 

acetateLayer.AcetateElements.Add(acetatePoly); 

mapView.Layers.Add(acetateLayer); 

    
Visual BasicCopy Code
' Create a new polyline

Dim line As New ESRI.ArcGIS.ADF.IMS.Geometry.Polyline()



' Create two paths and add them to the line

Dim path As ESRI.ArcGIS.ADF.IMS.Geometry.Path

path = New ESRI.ArcGIS.ADF.IMS.Geometry.Path()

path.Points.Add(New ESRI.ArcGIS.ADF.IMS.Geometry.Point(11.0, 18.2))

path.Points.Add(New ESRI.ArcGIS.ADF.IMS.Geometry.Point(17.3, 22.5))

line.Paths.Add(path)



path = New ESRI.ArcGIS.ADF.IMS.Geometry.Path()

path.Points.Add(New ESRI.ArcGIS.ADF.IMS.Geometry.Point(18.0, 22.5))

path.Points.Add(New ESRI.ArcGIS.ADF.IMS.Geometry.Point(22.3, 32.1))

line.Paths.Add(path)



' Create an acetate geometry element and add the polyline to it

Dim lineSymbol As New _

    ESRI.ArcGIS.ADF.IMS.Display.Symbol.SimpleLineSymbol()

lineSymbol.Color = System.Drawing.Color.Red

Dim acetatePoly As New _

    ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.GeometryElement( _

    ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.AcetateUnits.Database, line, lineSymbol)



' Create an acetate layer for the geometry element, and add it to the map

Dim acetateLayer As New _

    ESRI.ArcGIS.ADF.IMS.Carto.Layer.AcetateLayer("mapGraphics")

acetateLayer.AcetateElements.Add(acetatePoly)

mapView.Layers.Add(acetateLayer)

Remarks

A Polyline is a type of geometry, and may be used to add graphics to the map, in a filter to select features in a layer, and may be returned as the geometry of features when performing a query. For details, see Geometry.

A Polyline consists of one or more Path objects, stored as a PathCollection in the Paths property. For example, a road may be represented by a series of linear segments (paths), each path being a highway segment between intersections with other roads.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.IMS.Geometry.Geometry
      ESRI.ArcGIS.ADF.IMS.Geometry.Polyline

See Also

© 2010 All Rights Reserved.