public static void Clusters() { // SqlDb sqlDB = new SqlDb(@"c:\Data\rectangle.sdf"); // TODО: Переделать DbMongo sqlDB = new DbMongo(@"c:\Data\SingleFile.sdf"); List <string> jsonOfLines = sqlDB.GetObjectJsonByClassName("AcDbLine"); List <Rectangle> rectangles = new List <Rectangle>(); int i = 0; foreach (string jsonLine in jsonOfLines) { crawlAcDbLine cLine = jsonHelper.From <crawlAcDbLine>(jsonLine); if (cLine.Length > 0) { Rectangle rec = new Rectangle(cLine.StartPoint, cLine.EndPoint); rectangles.Add(rec); DrawLine(cLine.StartPoint.X, cLine.StartPoint.Y, cLine.EndPoint.X, cLine.EndPoint.Y); } i++; } ClusterTree ct = new ClusterTree(rectangles.ToArray()); foreach (ClusterTree.Cluster cluster in ct.Clusters) { if (cluster.Count > 2) { DrawRectangle(cluster.BoundBox.MinPoint.X, cluster.BoundBox.MinPoint.Y, cluster.BoundBox.MaxPoint.X, cluster.BoundBox.MaxPoint.Y); } } }
public void TestGetObjectJsonByClassName() { db.Seed(); List <string> result = db.GetObjectJsonByClassName("AcDbLine"); Assert.IsTrue(result.Count > 0); Assert.IsTrue(result[0].Contains("AcDbLine")); }