Problem Using PixelTOProj

Mar 2, 2011 at 11:12 PM

 hello everyone,

I'm new in map window 6 , I want to plot points using an interractive way, so ive provided  the user with text boxes   to type in the coordinates X,Y, and since I wanted the program to join the points automatically I decided to use polygon...my problem is that anytime I plot onto the map for the first one, it will plot nicely but when I want to add another polygon u will see that the two polygons are positioned afar from each other which shd not be so,beneath is my code ,i want the to display all two polygon at a time    

                  Dim x1 As Integer = txtx1.Text
                    Dim x2 As Integer = txtx2.Text
                    Dim x3 As Integer = txtx3.Text
                    Dim y1 As Integer = txty1.Text
                    Dim y2 As Integer = txty2.Text
                    Dim y3 As Integer = txty3.Text
                    Dim cord1 As MapWindow.Geometries.Coordinate
                    Dim pnt As System.Drawing.Point
                    pnt.X = x1
                    pnt.Y = y1
                    cord1 = GeoDataMan.Map.PixelToProj(pnt)

                    Dim cord2 As MapWindow.Geometries.Coordinate
                    Dim pnt2 As System.Drawing.Point
                    pnt2.X = x2
                    pnt2.Y = y2
                    cord2 = GeoDataMan.Map.PixelToProj(pnt2)

                    Dim cord3 As MapWindow.Geometries.Coordinate
                    Dim pnt3 As System.Drawing.Point
                    pnt3.X = x3
                    pnt3.Y = y3
                    cord3 = GeoDataMan.Map.PixelToProj(pnt3)
                    'Dim cord4 As MapWindow.Geometries.Coordinate
                    'Dim pnt4 As System.Drawing.Point
                    'pnt4.X = x4
                    'pnt4.Y = y4
                    'cord4 = Map.PixelToProj(pnt4)
                    Dim cords As New System.Collections.Generic.List(Of MapWindow.Geometries.Coordinate)
                    cords.Add(cord1)
                    cords.Add(cord2)
                    cords.Add(cord3)
                    'cords.Add(cord4)

                    Dim poly As MapWindow.Geometries.IBasicPolygon
                    Dim gf As New MapWindow.Geometries.GeometryFactory
                    Dim lr As MapWindow.Geometries.ILinearRing
                    lr = gf.CreateLinearRing(cords)
                    Dim lrr(0) As MapWindow.Geometries.ILinearRing
                    lrr(0) = gf.CreateLinearRing(cords)

                    poly = gf.CreatePolygon(lr, lrr)
                    Dim fs As New MapWindow.Data.FeatureSet
                    fs.Projection = GeoDataMan.Map.Projection
                    fs.AddFeature(poly)
                    GeoDataMan.Map.Layers.Add(fs)
                  
                    Me.Close()

thanks

Patrick