Ejemplo n.º 1
0
        public void ReadFile()
        {
            Contour contour = new ContourSurferCommaFile().Read(FILE_IN1);

            Assert.True(contour.Polygons.Count == 2);
            if (contour.Polygons.Count == 2)
            {
                Assert.True(contour.Polygons[0].Points.Count == 6);
                Assert.True(contour.Polygons[1].Points.Count == 2);

                Assert.True(contour.Polygons[0].Points[4].X == 573413.882478);
                Assert.True(contour.Polygons[0].Points[4].Y == 547412.896476);

                Assert.True(contour.Polygons[1].Points[0].X == 575042.238886);
                Assert.True(contour.Polygons[1].Points[0].Y == 548419.51651);
            }

            contour = new ContourSurferCommaFile().Read(FILE_IN2);

            Assert.True(contour.Polygons.Count == 2);
            if (contour.Polygons.Count == 2)
            {
                Assert.True(contour.Polygons[0].Points.Count == 6);
                Assert.True(contour.Polygons[1].Points.Count == 2);

                Assert.True(contour.Polygons[0].Points[5].X == 573828.373394);
                Assert.True(contour.Polygons[0].Points[5].Y == 549159.678352);
                Assert.True(contour.Polygons[0].Points[5].Z == 1.0);

                Assert.True(contour.Polygons[1].Points[1].X == 577055.478954);
                Assert.True(contour.Polygons[1].Points[1].Y == 548212.271052);
                Assert.True(contour.Polygons[1].Points[1].Z == 2.0);
            }
        }
Ejemplo n.º 2
0
        public void WriteFile()
        {
            Contour contour = new Contour();

            Polygon polygon = new Polygon();

            polygon.Points.Add(new PointD(1.1, 1.2, 1.3));
            polygon.Points.Add(new PointD(2.1, 2.2, 2.3));
            polygon.Points.Add(new PointD(3.1, 3.2, 3.3));
            contour.Polygons.Add(polygon);

            polygon = new Polygon();
            polygon.Points.Add(new PointD(10, 20, 0));
            polygon.Points.Add(new PointD(20, 10, 0));
            contour.Polygons.Add(polygon);

            polygon = new Polygon();
            polygon.Points.Add(new PointD(1, 2, 3));
            polygon.Points.Add(new PointD(4, 5, 6));
            contour.Polygons.Add(polygon);

            new ContourSurferCommaFile().Write(FILE_OUT, contour);

            contour = new ContourSurferCommaFile().Read(FILE_OUT);
            Assert.True(contour.Polygons.Count == 3);
            if (contour.Polygons.Count == 3)
            {
                Assert.True(contour.Polygons[0].Points.Count == 3);
                Assert.True(contour.Polygons[1].Points.Count == 2);
                Assert.True(contour.Polygons[2].Points.Count == 2);

                Assert.True(contour.Polygons[0].Points[2].X == 3.1);
                Assert.True(contour.Polygons[0].Points[2].Y == 3.2);
                Assert.True(contour.Polygons[0].Points[2].Z == 3.3);

                Assert.True(contour.Polygons[2].Points[1].X == 4);
                Assert.True(contour.Polygons[2].Points[1].Y == 5);
                Assert.True(contour.Polygons[2].Points[1].Z == 6);
            }
        }
Ejemplo n.º 3
0
        public void ReadWriteFile()
        {
            var     roxarFile = new ContourRoxarFile();
            Contour contour   = roxarFile.Read(FILE_ORIG);

            CheckContour(contour);

            var surferSpaceFile = new ContourSurferSpaceFile();

            surferSpaceFile.Write(FILE_TEST, contour);
            contour = surferSpaceFile.Read(FILE_TEST);
            CheckContour(contour);

            var surferCommaFile = new ContourSurferCommaFile();

            surferCommaFile.Write(FILE_TEST, contour);
            contour = surferCommaFile.Read(FILE_TEST);
            CheckContour(contour);

            roxarFile.Write(FILE_TEST, contour);
            contour = roxarFile.Read(FILE_ORIG);
            CheckContour(contour);
        }