Beispiel #1
0
        public void PolygonMValuesAreStoredAndRetrievedCorrectly()
        {
            // Arrange
            const string wkt = "POLYGONM ((0 0 1, 0 100 2, 100 100 3, 100 0 4, 0 0 5))";

            using (var session = sessions.OpenSession())
            {
                var obj = new PolygonM
                {
                    Id   = 1,
                    Geom = Wkt.Read(wkt)
                };
                session.Save(obj);
                session.Flush();
            }
            var expected      = Wkt.Read(wkt);
            var expectedCoord = expected.Coordinate;

            // Act
            var polygonM      = _session.Load <PolygonM>(1);
            var polygonMCoord = polygonM.Geom.Coordinate;

            // Assert
            // NOTE: Cannot use EqualsTopologically or EqualsExact here since
            //       both ignore Z/M components
            Assert.AreEqual(expectedCoord.X, polygonMCoord.X);
            Assert.AreEqual(expectedCoord.Y, polygonMCoord.Y);
            Assert.AreEqual(expectedCoord.M, polygonMCoord.M);
        }
Beispiel #2
0
            private void _read()
            {
                _shapeType = ((ShapefileMain.ShapeType)m_io.ReadS4le());
                if (ShapeType != ShapefileMain.ShapeType.NullShape)
                {
                    switch (ShapeType)
                    {
                    case ShapefileMain.ShapeType.PointM: {
                        _shapeParameters = new PointM(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.PolygonZ: {
                        _shapeParameters = new PolygonZ(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.MultiPointM: {
                        _shapeParameters = new MultiPointM(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.PolyLineZ: {
                        _shapeParameters = new PolyLineZ(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.MultiPointZ: {
                        _shapeParameters = new MultiPointZ(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.MultiPoint: {
                        _shapeParameters = new MultiPoint(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.PolygonM: {
                        _shapeParameters = new PolygonM(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.Polygon: {
                        _shapeParameters = new Polygon(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.Point: {
                        _shapeParameters = new Point(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.PolyLineM: {
                        _shapeParameters = new PolyLineM(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.PolyLine: {
                        _shapeParameters = new PolyLine(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.PointZ: {
                        _shapeParameters = new PointZ(m_io, this, m_root);
                        break;
                    }

                    case ShapefileMain.ShapeType.MultiPatch: {
                        _shapeParameters = new MultiPatch(m_io, this, m_root);
                        break;
                    }
                    }
                }
            }