To trace a line among two points ???

Topics: General Topics
Jan 31, 2007 at 4:22 PM
As I do to trace a line among two points ???

Thank you

Ibraim Mansur
Br
Coordinator
Jan 31, 2007 at 4:47 PM
Hi Ibraim,

Please take a look at the GeometryProvider.

regards
Christian
Jan 31, 2007 at 6:15 PM
Do you have some example?

Ibraim Mansur
Br
Jan 31, 2007 at 6:56 PM
you have to create a collection of Geometry objects, and then a GeometryProvider from those lines, something like-

SharpMap.Layers.VectorLayer layerLines;
List<SharpMap.Geometries.Geometry> geometryLines;
layerLines = new SharpMap.Layers.VectorLayer(layerName);
geometryLines = new List<SharpMap.Geometries.Geometry>();

// create layer and geometry list
layerLines.DataSource = new SharpMap.Data.Providers.GeometryProvider(geometryLines);
layerLines.Style.Line.Width = 4;
layerLines.Style.Line.Color = System.Drawing.Color.Green;
map.Layers.Add(layerLines);


//Add a single LineString with 2 Points
List<SharpMap.Geometries.Point> PointColl = new List<SharpMap.Geometries.Point>();
PointColl.Add(new SharpMap.Geometries.Point(X, Y));
PointColl.Add(new SharpMap.Geometries.Point(X2, Y2));

SharpMap.Geometries.LineString lineString = new SharpMap.Geometries.LineString(PointColl);

geometryLines.Add(lineString);