This project has moved. For the latest updates, please go here.

How to draw line(as path or polygon) between Vectors?

Jul 7 at 9:20 AM
Hello Guys,

I have created a .kml file which includes 3 vectors in c# as windows form application. I can make them as a placemark but I can't draw lines between vectors. Here is my code. Thanks you already.
public partial class Form1 : Form
    {
        SharpKml.Dom.Point a= new SharpKml.Dom.Point();
       SharpKml.Dom.Point b=new SharpKml.Dom.Point();
       SharpKml.Dom.Point c= new SharpKml.Dom.Point();
       
        Document document = new Document();
 
        public Form1()
        {
            InitializeComponent();
        }

       
        private void button1_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Google File(*kml)|*.kml";
            sfd.DefaultExt = ".kml";
            if (sfd.ShowDialog()==DialogResult.OK);
            {
                SharpKml.Dom.Point[] curvePoints = { a, b, c };
                a.Coordinate = new Vector(40.921, 29.313, 30.78);
                b.Coordinate = new Vector(40.922, 29.314, 30.78);
                c.Coordinate = new Vector(40.923, 29.315, 30.78);
                LineString linestring = new LineString();
                CoordinateCollection coordinates = new CoordinateCollection();
                Vector[] myVector = { a.Coordinate, b.Coordinate, c.Coordinate };

                foreach (var item in myVector)
                {
                    SharpKml.Dom.Point point = new SharpKml.Dom.Point();
                    point.Coordinate = new Vector(item.Latitude, item.Longitude);
                    Polygon polygon = new Polygon();
                    polygon.Extrude = true;
                    Placemark placemark = new Placemark();
                    placemark.Geometry = point;                  
                    document.AddFeature(placemark);
                }             
                Kml root = new Kml();
                root.Feature = document;
                KmlFile kml = KmlFile.Create(root, false);                      
                string filename = System.IO.Path.GetFullPath(sfd.FileName);
               using (var stream = File.OpenWrite(filename))
                {
                    kml.Save(stream);
                }
                MessageBox.Show("done");
            }
           
        }
              
  }