public Polygon GetPolygonByName(string s) { DBase db = new DBase(DataContextConnection); Polygon poly = new Polygon(); // construct polygon Polygons DBpoly = (from c in db.Polygons where c.NAME==s && c.PARENT_ID==null select c).SingleOrDefault<Polygons>(); foreach (Points pnt in DBpoly.Points) { Point p = new Point(pnt.X,pnt.Y); poly.AddVertex(p); } // construct subPolygons IQueryable <Polygons> DBsubpolys = from c in db.Polygons where c.PARENT_ID == DBpoly.ID select c; foreach (Polygons DBsubpoly in DBsubpolys) { Polygon subpoly = new Polygon(); foreach (Points pnt in DBsubpoly.Points) { Point p = new Point(pnt.X, pnt.Y); subpoly.AddVertex(p); } poly.AddSubPolygon(subpoly); } return poly; }
private Polygon InitializePolygon_ForSpecialCases() { Polygon Polyg = new Polygon(); Polyg.AddVertex(new Point(327, 233)); Polyg.AddVertex(new Point(311, 280)); Polyg.AddVertex(new Point(232, 252)); Polyg.AddVertex(new Point(197, 185)); Polyg.AddVertex(new Point(126, 147)); Polyg.AddVertex(new Point(197, 128)); Polyg.AddVertex(new Point(232, 145)); Polyg.AddVertex(new Point(232, 125)); Polyg.AddVertex(new Point(327, 125)); return Polyg; }
private Polygon InitializePolygon_ForGeneralCases() { Polygon Polyg = new Polygon(); Polyg.AddVertex(new Point(235, 47)); Polyg.AddVertex(new Point(408, 47)); Polyg.AddVertex(new Point(370, 195)); Polyg.AddVertex(new Point(238, 113)); Polyg.AddVertex(new Point(112, 208)); Polyg.AddVertex(new Point(112, 158)); Polyg.AddVertex(new Point(152, 115)); Polyg.AddVertex(new Point(112, 105)); Polyg.AddVertex(new Point(112, 76)); return Polyg; }