How to create a multipoint object from the vertices of a polyline
Development licensing
Deployment licensing
ArcView
ArcView
ArcEditor
ArcEditor
ArcInfo
ArcInfo
Engine Developer Kit
Engine Runtime
Creating a multipoint object from the vertices of a polyline
The following code example creates a multipoint with point elements being copies of the vertices of an existing polyline. It then offsets those elements five units to the right using one transformation method, then offsets them up another five units.
[C#]
privatevoid TransformPoint(IPolyline polyline)
{
IPointCollection polylinePoints = polyline as IPointCollection;
IGeometry multipoint = new MultipointClass();
multipoint.SpatialReference = polyline.SpatialReference;
IPointCollection multipointPoints = multipoint as IPointCollection;
//Add copies of the polyline vertices to the multipoint.
multipointPoints.AddPointCollection(polylinePoints);
IAffineTransformation2D affineTransformation = new AffineTransformation2DClass();
affineTransformation.Move(5,0);
ITransform2D transformee = multipoint as ITransform2D;
transformee.Transform(esriTransformDirection.esriTransformForward, affineTransformation);
//Shift up by 5.
transformee.Move(0, 5);
transformee.Transform(esriTransformDirection.esriTransformForward, affineTransformation);
}
[VB.NET]
PrivateSub TransformPoint(ByVal polyline As IPolyline)
Dim polylinePoints As IPointCollection = CType(polyline, IPointCollection)
Dim multipoint As IGeometry = New MultipointClass()
multipoint.SpatialReference = polyline.SpatialReference
Dim multipointPoints As IPointCollection = CType(multipoint, IPointCollection)
'Add copies of the polyline vertices to the multipoint.
multipointPoints.AddPointCollection(polylinePoints)
Dim affineTransformation As IAffineTransformation2D = New AffineTransformation2DClass()
affineTransformation.Move(5, 0)
Dim transformee As ITransform2D = CType(multipoint, ITransform2D)
transformee.Transform(esriTransformDirection.esriTransformForward, affineTransformation)
'Shift up by 5.
transformee.Move(0, 5)
transformee.Transform(esriTransformDirection.esriTransformForward, affineTransformation)
EndSub