Beispiel #1
0
        private void WriteCurvePolygon(CurvePolygon curvePolygon)
        {
            wktBuilder.Append("(");
            Write(curvePolygon.ExteriorRing, curvePolygon.ExteriorRing.GeometryType == GeometryType.LineString);
            wktBuilder.Append(",");

            foreach (Curve interiorRing in curvePolygon.InteriorRings)
            {
                Write(interiorRing, interiorRing.GeometryType == GeometryType.LineString);
                wktBuilder.Append(",");
            }

            wktBuilder.Remove(wktBuilder.Length - 1, 1);
            wktBuilder.Append(")");
        }
Beispiel #2
0
        protected CurvePolygon ReadCurvePolygon(Dimension dimension)
        {
            ExpectGroupStart();
            CurvePolygon curvePolygon = new CurvePolygon((Curve)ReadType(GeometryType.LineString, dimension, GeometryType.LineString, GeometryType.CircularString, GeometryType.CompoundCurve));

            curvePolygon.Dimension = dimension;

            while (IsMatch(","))
            {
                curvePolygon.InteriorRings.Add((Curve)ReadType(GeometryType.LineString, dimension, GeometryType.LineString, GeometryType.CircularString, GeometryType.CompoundCurve));
            }

            ExpectGroupEnd();

            return(curvePolygon);
        }
Beispiel #3
0
        private void WriteCurvePolygon(CurvePolygon curvePolygon)
        {
            if (curvePolygon.IsEmpty)
            {
                wkbWriter.Write(0);
                return;
            }

            wkbWriter.Write(1 + curvePolygon.InteriorRings.Count);

            WriteInternal(curvePolygon.ExteriorRing);

            foreach (Curve interiorRing in curvePolygon.InteriorRings)
            {
                WriteInternal(interiorRing);
            }
        }
Beispiel #4
0
        private CurvePolygon ReadCurvePolygon(Dimension dimension)
        {
            CurvePolygon curvePolygon = new CurvePolygon();

            uint ringCount = wkbReader.ReadUInt32();

            if (ringCount > 0)
            {
                curvePolygon = new CurvePolygon(Read <Curve>());

                for (int i = 1; i < ringCount; i++)
                {
                    curvePolygon.InteriorRings.Add(Read <Curve>());
                }
            }

            return(curvePolygon);
        }
Beispiel #5
0
        protected Geometry CreateGeometry(GeometryType geometryType, Dimension dimension)
        {
            Geometry geometry = null;

            switch (geometryType)
            {
            case GeometryType.Point: geometry = new Point(); break;

            case GeometryType.LineString: geometry = new LineString(); break;

            case GeometryType.Polygon: geometry = new Polygon(); break;

            case GeometryType.MultiPoint: geometry = new MultiPoint(); break;

            case GeometryType.MultiLineString: geometry = new MultiLineString(); break;

            case GeometryType.MultiPolygon: geometry = new MultiPolygon(); break;

            case GeometryType.GeometryCollection: geometry = new GeometryCollection(); break;

            case GeometryType.CircularString: geometry = new CircularString(); break;

            case GeometryType.CompoundCurve: geometry = new CompoundCurve(); break;

            case GeometryType.CurvePolygon: geometry = new CurvePolygon(); break;

            case GeometryType.MultiCurve: geometry = new MultiCurve(); break;

            case GeometryType.MultiSurface: geometry = new MultiSurface(); break;

            case GeometryType.PolyhedralSurface: geometry = new PolyhedralSurface(); break;

            case GeometryType.Tin: geometry = new Tin(); break;

            case GeometryType.Triangle: geometry = new Triangle(); break;

            default: throw new NotSupportedException(geometryType.ToString());
            }

            geometry.Dimension = dimension;

            return(geometry);
        }