Example #1
0
        public void TestLineStringSegment()
        {
            FdoDirectPositionCollection positions = FdoDirectPositionCollection.Create();
            FdoFgfGeometryFactory       fact      = FdoFgfGeometryFactory.GetInstance();
            FdoIDirectPosition          pos1      = fact.CreatePositionXY(0.0, 0.0);
            FdoIDirectPosition          pos2      = fact.CreatePositionXY(1.0, 0.0);
            FdoIDirectPosition          pos3      = fact.CreatePositionXY(1.0, 1.0);
            FdoIDirectPosition          pos4      = fact.CreatePositionXY(0.0, 1.0);
            FdoIDirectPosition          pos5      = fact.CreatePositionXY(0.0, 0.0);

            positions.Add(pos1);
            positions.Add(pos2);
            positions.Add(pos3);
            positions.Add(pos4);
            positions.Add(pos5);

            FdoILineStringSegment       lineStringSegment = fact.CreateLineStringSegment(positions);
            FdoDirectPositionCollection positions2        = lineStringSegment.GetPositions();

            Assert.Equal(positions.Count, positions2.Count);
            for (int i = 0; i < positions.Count; i++)
            {
                FdoIDirectPosition posExpect = positions.GetItem(i);
                FdoIDirectPosition posActual = positions2.GetItem(i);

                Assert.Equal(posExpect.Dimensionality, posActual.Dimensionality);
                CheckPositionXY(posExpect, posActual.X, posActual.Y);
            }
        }
Example #2
0
        public void TestEnvelope()
        {
            FdoFgfGeometryFactory gf = FdoFgfGeometryFactory.GetInstance();

            FdoIDirectPosition pos1  = gf.CreatePositionXY(5.0, 6.0);
            FdoIDirectPosition pos2  = gf.CreatePositionXY(10.0, 13.0);
            FdoIEnvelope       envl2 = gf.CreateEnvelope(pos1, pos2);

            //DumpEnvelope(envl2);
            CheckEnvelope(envl2, pos1, pos2);

            FdoIEnvelope envl3 = gf.CreateEnvelopeXY(4.0, 3.0, 12.0, 120.0);

            //DumpEnvelope(envl3);
            CheckEnvelopeXY(envl3, 4.0, 3.0, 12.0, 120.0);

            FdoIEnvelope envl4 = gf.CreateEnvelopeXYZ(12.0, 45.0, 1.0, 34.0, 39.0, 2.0);

            //DumpEnvelope(envl4);
            CheckEnvelopeXYZ(envl4, 12.0, 45.0, 1.0, 34.0, 39.0, 2.0);

            /*
             * FdoIEnvelope envl5 = gf.CreateEnvelope(envl4);
             * //DumpEnvelope(envl5);
             * CheckEqualEnvelopes(envl4, envl5);
             *
             * FdoIEnvelope envl6 = gf.CreateEnvelope(envl5);
             * //DumpEnvelope(envl5);
             * CheckEqualEnvelopes(envl6, envl5);
             */
        }
Example #3
0
 void CheckEnvelope(FdoIEnvelope envl, FdoIDirectPosition pos1, FdoIDirectPosition pos2)
 {
     Assert.Equal(pos1.X, envl.MinX);
     Assert.Equal(pos1.Y, envl.MinY);
     Assert.True((pos1.Dimensionality & (int)FdoDimensionality.FdoDimensionality_Z) == 0 || envl.MinZ == pos1.Z, "MinZ mismatch");
     Assert.Equal(pos2.X, envl.MaxX);
     Assert.Equal(pos2.Y, envl.MaxY);
     Assert.True((pos2.Dimensionality & (int)FdoDimensionality.FdoDimensionality_Z) == 0 || envl.MaxZ == pos2.Z, "MaxZ mismatch");
 }
Example #4
0
        public void TestDirectPosition()
        {
            FdoFgfGeometryFactory factory = FdoFgfGeometryFactory.GetInstance();

            FdoIDirectPosition pointXY = factory.CreatePositionXY(5.0, 6.0);

            //DumpPosition("", pointXY);
            CheckPositionXY(pointXY, 5.0, 6.0);

            FdoIDirectPosition pointXYM = factory.CreatePositionXYM(1.0, 3.0, 5.0);

            //DumpPosition("", pointXYM);
            CheckPositionXYM(pointXYM, 1.0, 3.0, 5.0);

            FdoIDirectPosition pointXYZ = factory.CreatePositionXYZ(2.0, 7.0, 10.0);

            //DumpPosition("", pointXYZ);
            CheckPositionXYZ(pointXYZ, 2.0, 7.0, 10.0);

            FdoIDirectPosition pointXYZM = factory.CreatePositionXYZM(1.23, 4.26, 3.67, 3.14);

            //DumpPosition("", pointXYZM);
            CheckPositionXYZM(pointXYZM, 1.23, 4.26, 3.67, 3.14);
        }
Example #5
0
 void CheckPositionXYZM(FdoIDirectPosition pos, double x, double y, double z, double m)
 {
     CheckPositionXYZ(pos, x, y, z);
     Assert.Equal(m, pos.M);
 }
Example #6
0
 void CheckPositionXYZ(FdoIDirectPosition pos, double x, double y, double z)
 {
     CheckPositionXY(pos, x, y);
     Assert.Equal(z, pos.Z);
 }
Example #7
0
 void CheckPositionXY(FdoIDirectPosition pos, double x, double y)
 {
     Assert.Equal(x, pos.X);
     Assert.Equal(y, pos.Y);
 }