public void TestEquals9()
        {
            WKTReader       reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
            MultiLineString l1     = (MultiLineString)reader.Read("MULTILINESTRING((1732328800 519578384, 1732026179 519976285, 1731627364 519674014, 1731929984 519276112, 1732328800 519578384))");
            MultiLineString l2     = (MultiLineString)reader.Read("MULTILINESTRING((1731627364 519674014, 1731929984 519276112, 1732328800 519578384, 1732026179 519976285, 1731627364 519674014))");

            Assert.IsTrue(l1.Equals(l2));
        }
        public void test_Clone()
        {
            //create a geometry collection
            MultiLineString multiLS1 = CreateMLS();
            MultiLineString multiLS2 = multiLS1.Clone() as MultiLineString;

            Assertion.AssertEquals("Clone: ", true, multiLS1.Equals(multiLS2));
        }
        public void test_EqualExact()
        {
            //create a geomerty collection
            MultiLineString multiLS1 = CreateMLS();
            //create another geometry collection that is null
            GeometryFactory gf       = new GeometryFactory(_precMod, _sRID);
            MultiLineString multiLS2 = gf.CreateMultiLineString(null);
            //create another geometry collection that is different
            MultiLineString multiLS3 = CreateMLS1();
            //create another geometry collection that is different
            MultiLineString multiLS4 = closedMLS();
            //create another geometry collection that is the same as the first
            MultiLineString multiLS5 = CreateMLS();

            Assertion.AssertEquals("Equals-1: ", true, multiLS1.Equals(multiLS5));
            Assertion.AssertEquals("Equals-2: ", false, multiLS1.Equals(multiLS2));
            Assertion.AssertEquals("Equals-3: ", false, multiLS1.Equals(multiLS3));
            Assertion.AssertEquals("Equals-4: ", false, multiLS1.Equals(multiLS4));
        }
示例#4
0
        public void Equals_GetHashCode_Contract()
        {
            var rnd    = new System.Random();
            var offset = rnd.NextDouble() * 60;

            if (rnd.NextDouble() < 0.5)
            {
                offset *= -1;
            }

            var leftLine = new List <LineString>
            {
                GetLineString(offset + 1),
                GetLineString(offset + 2)
            };

            var left = new MultiLineString(leftLine);

            var rightLine = new List <LineString>
            {
                GetLineString(offset + 1),
                GetLineString(offset + 2)
            };

            var right = new MultiLineString(rightLine);

            Assert.AreEqual(left, right);
            Assert.AreEqual(right, left);

            Assert.IsTrue(left.Equals(right));
            Assert.IsTrue(left.Equals(left));
            Assert.IsTrue(right.Equals(left));
            Assert.IsTrue(right.Equals(right));

            Assert.IsTrue(left == right);
            Assert.IsTrue(right == left);

            Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
        }
示例#5
0
        public void MultiLineStringTest()
        {
            // ARRANGE
            string Content = File.ReadAllText("multilinestring.json").Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace(" ", "");

            // ACT
            MultiLineString Geo = MultiLineString.FromJson(Content);

            string Content2 = Geo.ToJson();

            MultiLineString Geo2 = MultiLineString.FromJson(Content2);

            // ASSERT
            Assert.True(Geo.Equals(Geo2));
        }