Problem with FeatureGeometryFactory when create DirectPositionCollection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with FeatureGeometryFactory when create DirectPositionCollection

Monepa84
This post has NOT been accepted by the mailing list yet.
Hi all, i've try and success to get array of a selected lwpolyline vertices by this code :

[CommandMethod("ListVer")]
static public void ListVertices()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Editor ed = doc.Editor;
    Database db = doc.Database;
           
    PromptEntityResult per = ed.GetEntity("Select a polyline"); <-- need to select multiple polylines
    if (per.Status == PromptStatus.OK)
    {
       Transaction tr = db.TransactionManager.StartTransaction();
       using (tr)
       {
          DBObject obj = tr.GetObject(per.ObjectId, OpenMode.ForRead);
          //if lw polyline
          Polyline lwp = obj as Polyline;
          if (lwp != null)
          {
              int vn = lwp.NumberOfVertices;
              for (int i = 0; i < vn; i++)
              {
                  Point2d pt = lwp.GetPoint2dAt(i);
                  ed.WriteMessage("\n"+"lwpPt: " + pt.ToString()); //results array
                           
               }
           }                    
               tr.Commit();
        }
    }
 }

my question is how can i create DirectPositionCollection from that results array (get x,y coordinates), so i can create IlinearRing and then create Ipolygon and then i can use IInsert to save it into my oracle spatial by King-SL FDO. thanks.