Пример #1
0
        public void Linestring()
        {
            LineString l = new LineString();

            Assert.IsTrue(l.IsEmpty());
            Assert.IsNull(l.GetBoundingBox());
            Assert.AreEqual(0, l.Length);
            Assert.IsFalse(l.Equals(null));
            Assert.IsTrue(l.Equals(new LineString()));

            Collection <Point> vertices = new Collection <Point>();

            vertices.Add(new Point(54, 23));
            vertices.Add(new Point(93, 12));
            vertices.Add(new Point(104, 32));
            l.Vertices = vertices;
            Assert.IsFalse(l.IsEmpty());
            Assert.IsFalse(l.IsClosed);
            Assert.AreEqual(3, l.NumPoints);
            Assert.AreEqual(new Point(54, 23), l.StartPoint);
            Assert.AreEqual(new Point(104, 32), l.EndPoint);
            l.Vertices.Add(new Point(54, 23));
            Assert.IsTrue(l.IsClosed);
            Assert.AreEqual(114.15056678325843, l.Length);
            Assert.AreNotSame(l.Clone(), l);
            Assert.AreNotSame(l.Clone().Vertices[0], l.Vertices[0]);
            Assert.AreEqual(l.Clone(), l);
            LineString l2 = l.Clone();

            l2.Vertices[2] = l2.Vertices[2] + new Point(1, 1);
            Assert.AreNotEqual(l2, l);
            l2 = l.Clone();
            l2.Vertices.Add(new Point(34, 23));
            Assert.AreNotEqual(l2, l);
        }
Пример #2
0
        public void test_Clone()
        {
            LineString ls  = SimpleOpen();
            LineString ls2 = ls.Clone() as LineString;

            Assertion.AssertEquals("Clone: ", true, ls.Equals(ls2));
        }
        public override Visual Clone()
        {
            var copy = new VisualLineString(_lineString.Clone() as LineString);

            copy.Prototype(this);
            return(copy);
        }
Пример #4
0
        public void Clone_a_valid_linestring_should_equal()
        {
            var lineString = new LineString(new[] { new Point(120, 50) });

            lineString.Clone().Equals(lineString).ShouldBeTrue();
        }
Пример #5
0
        public void Clone_an_invalid_linestring_should_still_invalid()
        {
            var lineString = new LineString();

            lineString.Clone().IsValid.ShouldBeFalse();
        }