public void Split()
        {
            PackagedArcs actual = InitializePolygonsSpliter(new PackagedArcs(new int[] {}, new CoordPoint[] {}));

            Assert.AreEqual(0, actual.ArcsLength.Count);
            Assert.AreEqual(0, actual.ArcsPoints.Count);

            actual = InitializePolygonsSpliter(new PackagedArcs(new int[] { 1 }, new CoordPoint[] { new GeoPoint(0, 0) }));
            Assert.AreEqual(new int[] { 1 }, actual.ArcsLength);
            Assert.AreEqual(new CoordPoint[] { new GeoPoint(0, 0) }, actual.ArcsPoints);

            actual = InitializePolygonsSpliter(new PackagedArcs(new int[] { 2, 2 }, new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(3, 3) }));
            Assert.AreEqual(new int[] { 2, 2 }, actual.ArcsLength);
            Assert.AreEqual(new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(3, 3) }, actual.ArcsPoints);

            actual = InitializePolygonsSpliter(new PackagedArcs(new int[] { 5, 5 }, new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2),
                                                                                                       new GeoPoint(3, 3), new GeoPoint(4, 4), new GeoPoint(-5, -5), new GeoPoint(-1, -1), new GeoPoint(2, 2), new GeoPoint(-3, -3), new GeoPoint(-4, -4) }));
            Assert.AreEqual(new int[] { 3, 3, 3, 3 }, actual.ArcsLength);
            Assert.AreEqual(new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(2, 2), new GeoPoint(3, 3), new GeoPoint(4, 4),
                                               new GeoPoint(-5, -5), new GeoPoint(-1, -1), new GeoPoint(2, 2), new GeoPoint(2, 2), new GeoPoint(-3, -3), new GeoPoint(-4, -4) }, actual.ArcsPoints);

            actual = InitializePolygonsSpliter(new PackagedArcs(new int[] { 4 }, new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(0, 0) }));
            Assert.AreEqual(new int[] { 4 }, actual.ArcsLength);
            Assert.AreEqual(new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(0, 0) }, actual.ArcsPoints);

            actual = InitializePolygonsSpliter(new PackagedArcs(new int[] { 4, 4 }, new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(0, 0),
                                                                                                       new GeoPoint(-3, -3), new GeoPoint(-1, -1), new GeoPoint(2, 2), new GeoPoint(-3, -3) }));
            Assert.AreEqual(new int[] { 4, 4 }, actual.ArcsLength);
            Assert.AreEqual(new CoordPoint[] { new GeoPoint(2, 2), new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(2, 2), new GeoPoint(-3, -3),
                                               new GeoPoint(-1, -1), new GeoPoint(2, 2) }, actual.ArcsPoints);

            actual = InitializePolygonsSpliter(new PackagedArcs(new int[] { 5, 5 }, new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(3, 3),
                                                                                                       new GeoPoint(0, 0), new GeoPoint(-3, -3), new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(3, 3), new GeoPoint(-3, -3) }));
            Assert.AreEqual(new int[] { 3, 3, 3 }, actual.ArcsLength);
            Assert.AreEqual(new CoordPoint[] { new GeoPoint(1, 1), new GeoPoint(2, 2), new GeoPoint(3, 3), new GeoPoint(3, 3), new GeoPoint(0, 0), new GeoPoint(1, 1), new GeoPoint(3, 3),
                                               new GeoPoint(-3, -3), new GeoPoint(1, 1) }, actual.ArcsPoints);
        }
Esempio n. 2
0
        public void AddArc()
        {
            this.arcIndex = new ArcIndex(new CoordPoint[] { });
            PackagedArcs      actual         = arcIndex.GetVertexData();
            IList <int>       expectedLength = new List <int>();
            List <CoordPoint> expectedPoints = new List <CoordPoint>();

            Assert.AreEqual(expectedLength, actual.ArcsLength);
            Assert.AreEqual(expectedPoints, actual.ArcsPoints);

            this.arcIndex.AddArc(new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1) });
            expectedLength.Add(2);
            expectedPoints.AddRange(new CoordPoint[] { new GeoPoint(0, 0), new GeoPoint(1, 1) });
            actual = arcIndex.GetVertexData();
            Assert.AreEqual(expectedLength, actual.ArcsLength);
            Assert.AreEqual(expectedPoints, actual.ArcsPoints);

            this.arcIndex.AddArc(new CoordPoint[] { new GeoPoint(3, 3), new GeoPoint(4, 4) });
            expectedLength.Add(2);
            expectedPoints.AddRange(new CoordPoint[] { new GeoPoint(3, 3), new GeoPoint(4, 4) });
            actual = arcIndex.GetVertexData();
            Assert.AreEqual(expectedLength, actual.ArcsLength);
            Assert.AreEqual(expectedPoints, actual.ArcsPoints);
        }
 PackagedArcs InitializePolygonsSpliter(PackagedArcs packagedArcs)
 {
     this.polygonsSpliter = new PolygonsSpliter.PolygonsSpliter(packagedArcs);
     return(this.polygonsSpliter.Split());
 }