Example #1
0
        public Extents GetExtents()
        {
            var result = Extents.Empty;

            foreach (VectorLayer layer in Layers)
            {
                result = result.Add(layer.GetExtents());
            }
            return(result.IsEmpty() || result.Area() == 0 ? Extents.Create(0, 1000, 0, 1000) : result); // mod 20140628
        }
        public void TestPointString()
        {
            var poly = new PointString(new[] { Vector.Zero, new Vector(1, 0), new Vector(1, 1) });

            Assert.True(poly.GetExtents().Equals(Extents.Create(0, 1, 0, 1)), "poly.extents().equals(geo.Extents.create(0, 1, 0, 1))");
            Assert.True(poly.Length() == 2, "poly.length() == 2");
            Assert.True(poly.Area() == 0.5, "poly.area() == 0.5");
            Assert.True(poly.Average().Equals(new Vector(2d / 3, 1d / 3)), "poly.average().equals(new geo.Vector(2 / 3, 1 / 3))");
            Assert.True(poly.Centroid().Equals(poly.Average()), "poly.centroid().equals(poly.average())");
            Assert.True(poly.Lerp(1.5).Equals(new Vector(1, 0.5)), "poly.lerp(1.5).equals(new geo.Vector(1, 0.5))");
            Assert.True(poly.IsPointIn(poly.Centroid()), "poly.isPointIn(poly.centroid())");
            Assert.True(!poly.IsPointIn(Vector.YAxis), "!poly.isPointIn(geo.Vector.yAxis())");
        }