Example #1
0
        internal static void Populate(IGeometrySink sink, IList<PointNode> points, GeometryType type)
        {
            if (points.Count>0)
            {
                if (type!=GeometryType.LineString)
                    sink.BeginGeometry(GeometryType.Point);

                sink.BeginFigure(points[0].X, points[0].Y, null);
                if (type==GeometryType.MultiPoint)
                    sink.EndFigure();

                for (int i=1; i<points.Count; ++i)
                    if (type==GeometryType.MultiPoint)
                    {
                        sink.BeginFigure(points[i].X, points[i].Y, null);
                        sink.EndFigure();
                    } else
                        sink.AddLine(points[i].X, points[i].Y, null);

                if (type!=GeometryType.MultiPoint)
                    sink.EndFigure();

                if (type!=GeometryType.LineString)
                    sink.EndGeometry();
            }
        }
Example #2
0
        public void Populate(IGeometrySink sink)
        {
            sink.SetCoordinateSystem(CoordinateSystem);

            sink.BeginGeometry(GeometryType.Polygon);

            if (
                (lowerCorner!=null) && (lowerCorner.TypedValue!=null) && (lowerCorner.TypedValue.Count==2) &&
                (upperCorner!=null) && (upperCorner.TypedValue!=null) && (upperCorner.TypedValue.Count==2)
            )
            {
                double minlon=Math.Min(lowerCorner.TypedValue[0], upperCorner.TypedValue[0]);
                double maxlon=Math.Max(lowerCorner.TypedValue[0], upperCorner.TypedValue[0]);
                double minlat=Math.Min(lowerCorner.TypedValue[1], upperCorner.TypedValue[1]);
                double maxlat=Math.Max(lowerCorner.TypedValue[1], upperCorner.TypedValue[1]);

                sink.BeginFigure(minlon, minlat, null);
                sink.AddLine(maxlon, minlat, null);
                sink.AddLine(maxlon, maxlat, null);
                sink.AddLine(minlon, maxlat, null);
                sink.AddLine(minlon, minlat, null);
                sink.EndFigure();
            }

            sink.EndGeometry();
        }
Example #3
0
        private static void CreateFigure(IGeometrySink sink, IList <SmGeometries.Point> points)
        {
            if ((points == null) || (points.Count == 0))
            {
                return;
            }

            var p0  = points[0];
            var p03 = p0 as SmGeometries.Point3D;

            if (p03 != null)
            {
                sink.BeginFigure(p03.X, p03.Y, p03.Z);
            }
            else
            {
                sink.BeginFigure(p0.X, p0.Y, null);
            }

            for (int i = 1; i < points.Count; ++i)
            {
                var pi  = points[i];
                var pi3 = pi as SmGeometries.Point3D;
                if (pi3 != null)
                {
                    sink.AddLine(pi3.X, pi3.Y, pi3.Z);
                }
                else
                {
                    sink.AddLine(pi.X, pi.Y, null);
                }
            }

            sink.EndFigure();
        }
Example #4
0
        public void Populate(IGeometrySink sink)
        {
            sink.SetCoordinateSystem(CoordinateSystem);

            sink.BeginGeometry(GeometryType.Polygon);

            if (
                (lowerCorner != null) && (lowerCorner.TypedValue != null) && (lowerCorner.TypedValue.Count == 2) &&
                (upperCorner != null) && (upperCorner.TypedValue != null) && (upperCorner.TypedValue.Count == 2)
                )
            {
                double minlon = Math.Min(lowerCorner.TypedValue[0], upperCorner.TypedValue[0]);
                double maxlon = Math.Max(lowerCorner.TypedValue[0], upperCorner.TypedValue[0]);
                double minlat = Math.Min(lowerCorner.TypedValue[1], upperCorner.TypedValue[1]);
                double maxlat = Math.Max(lowerCorner.TypedValue[1], upperCorner.TypedValue[1]);

                sink.BeginFigure(minlon, minlat, null);
                sink.AddLine(maxlon, minlat, null);
                sink.AddLine(maxlon, maxlat, null);
                sink.AddLine(minlon, maxlat, null);
                sink.AddLine(minlon, minlat, null);
                sink.EndFigure();
            }

            sink.EndGeometry();
        }
Example #5
0
 public void EndFigure()
 {
     if (m_depth == 0)
     {
         m_sink.EndFigure();
     }
 }
Example #6
0
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            int dim = 2;

            if (srsDimension.HasValue)
            {
                dim = Convert.ToInt32(srsDimension.Value);
            }

            sink.BeginGeometry(GeometryType.Point);

            //if (pos!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}pos").Any <XElement>())
            {
                if (pos.srsDimension.HasValue)
                {
                    dim = Convert.ToInt32(pos.srsDimension.Value);
                }

                if ((pos.TypedValue != null) && (pos.TypedValue.Count >= dim))
                {
                    sink.BeginFigure(pos.TypedValue[0], pos.TypedValue[1], dim > 2 ? pos.TypedValue[2] : (double?)null);
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }
Example #7
0
 private void PopulateFigure(IGeometrySink sink)
 {
     m_figure[0].BeginFigure(sink);
     for (int i = 1; i < m_figure.Count; i++)
     {
         m_figure[i].AddLine(sink);
     }
     sink.EndFigure();
 }
Example #8
0
 /// <summary>Applies a geometry type call sequence to the specified <paramref name="sink" />.</summary>
 /// <param name="sink">The sink to populate.</param>
 public void Populate(IGeometrySink sink)
 {
     sink.BeginGeometry(GeometryType.Point);
     if (_Point!=null)
     {
         sink.BeginFigure(_Point.X, _Point.Y, null);
         sink.EndFigure();
     }
     sink.EndGeometry();
 }
Example #9
0
 /// <summary>Applies a geometry type call sequence to the specified <paramref name="sink" />.</summary>
 /// <param name="sink">The sink to populate.</param>
 public void Populate(IGeometrySink sink)
 {
     sink.BeginGeometry(GeometryType.Point);
     if (_Point != null)
     {
         sink.BeginFigure(_Point.X, _Point.Y, null);
         sink.EndFigure();
     }
     sink.EndGeometry();
 }
Example #10
0
        internal static void Populate(IGeometrySink sink, IList <PointNode> points, GeometryType type)
        {
            if (points.Count > 0)
            {
                if (type != GeometryType.LineString)
                {
                    sink.BeginGeometry(GeometryType.Point);
                }

                sink.BeginFigure(points[0].X, points[0].Y, null);
                if (type == GeometryType.MultiPoint)
                {
                    sink.EndFigure();
                }

                for (int i = 1; i < points.Count; ++i)
                {
                    if (type == GeometryType.MultiPoint)
                    {
                        sink.BeginFigure(points[i].X, points[i].Y, null);
                        sink.EndFigure();
                    }
                    else
                    {
                        sink.AddLine(points[i].X, points[i].Y, null);
                    }
                }

                if (type != GeometryType.MultiPoint)
                {
                    sink.EndFigure();
                }

                if (type != GeometryType.LineString)
                {
                    sink.EndGeometry();
                }
            }
        }
Example #11
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            int dim=2;
            if (srsDimension.HasValue)
                dim=Convert.ToInt32(srsDimension.Value);
            if (posList.srsDimension.HasValue)
                dim=Convert.ToInt32(posList.srsDimension.Value);

            sink.BeginFigure(posList.TypedValue[0], posList.TypedValue[1], dim>2 ? posList.TypedValue[2] : (double?)null);
            for (int i=dim; i<posList.TypedValue.Count; i+=dim)
                sink.AddLine(posList.TypedValue[i], posList.TypedValue[i+1], dim>2 ? posList.TypedValue[i+2] : (double?)null);
            sink.EndFigure();
        }
Example #12
0
 public void EndFigure()
 {
     if (m_insidePolygon)
     {
         if (!IsThinRing())
         {
             PopulateFigure(m_sink);
         }
     }
     else
     {
         m_sink.EndFigure();
     }
 }
Example #13
0
 public void EndFigure()
 {
     if (m_insideLineString)
     {
         if (!IsShortLineString())
         {
             PopulateFigure(m_sink);
         }
     }
     else
     {
         m_sink.EndFigure();
     }
 }
Example #14
0
        /// <summary>Applies a geometry type call sequence to the specified <paramref name="sink" />.</summary>
        /// <param name="sink">The sink to populate.</param>
        /// <remarks>
        ///   <para>The call sequence is a set of figures, lines, and points for geometry types.</para>
        /// </remarks>
        public void Populate(IGeometrySink sink)
        {
            sink.SetCoordinateSystem(CoordinateSystem);

            sink.BeginGeometry(GeometryType.Polygon);

            sink.BeginFigure(_Envelope.MinX, _Envelope.MinY, null);
            sink.AddLine(_Envelope.MaxX, _Envelope.MinY, null);
            sink.AddLine(_Envelope.MaxX, _Envelope.MaxY, null);
            sink.AddLine(_Envelope.MinX, _Envelope.MaxY, null);
            sink.AddLine(_Envelope.MinX, _Envelope.MinY, null);
            sink.EndFigure();

            sink.EndGeometry();
        }
Example #15
0
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.LineString);

            //if (posList!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}posList").Any<XElement>())
                if ((posList.TypedValue!=null) && (posList.TypedValue.Count>=2))
                {
                    sink.BeginFigure(posList.TypedValue[0], posList.TypedValue[1], null);
                    for (int i=2; i<posList.TypedValue.Count; i+=2)
                        sink.AddLine(posList.TypedValue[i], posList.TypedValue[i+1], null);
                    sink.EndFigure();
                }

            sink.EndGeometry();
        }
Example #16
0
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.LineString);

            //if (posList!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}posList").Any <XElement>())
            {
                if ((posList.TypedValue != null) && (posList.TypedValue.Count >= 2))
                {
                    sink.BeginFigure(posList.TypedValue[0], posList.TypedValue[1], null);
                    for (int i = 2; i < posList.TypedValue.Count; i += 2)
                    {
                        sink.AddLine(posList.TypedValue[i], posList.TypedValue[i + 1], null);
                    }
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }
Example #17
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            int dim = 2;

            if (srsDimension.HasValue)
            {
                dim = Convert.ToInt32(srsDimension.Value);
            }
            if (posList.srsDimension.HasValue)
            {
                dim = Convert.ToInt32(posList.srsDimension.Value);
            }

            sink.BeginFigure(posList.TypedValue[0], posList.TypedValue[1], dim > 2 ? posList.TypedValue[2] : (double?)null);
            for (int i = dim; i < posList.TypedValue.Count; i += dim)
            {
                sink.AddLine(posList.TypedValue[i], posList.TypedValue[i + 1], dim > 2 ? posList.TypedValue[i + 2] : (double?)null);
            }
            sink.EndFigure();
        }
Example #18
0
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            int dim=2;
            if (srsDimension.HasValue)
                dim=Convert.ToInt32(srsDimension.Value);

            sink.BeginGeometry(GeometryType.Point);

            //if (pos!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}pos").Any<XElement>())
            {
                if (pos.srsDimension.HasValue)
                    dim=Convert.ToInt32(pos.srsDimension.Value);

                if ((pos.TypedValue!=null) && (pos.TypedValue.Count>=dim))
                {
                    sink.BeginFigure(pos.TypedValue[0], pos.TypedValue[1], dim>2 ? pos.TypedValue[2] : (double?)null);
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }
Example #19
0
        private void AddRandomFigure(IGeometrySink sink, int segmentCount)
        {
            previousPoint = null;
            sink.BeginFigure(
                RandomNearPoint(),
                CoinFlip ? FigureBegin.Filled : FigureBegin.Hollow);
            FigureEnd end = CoinFlip ? FigureEnd.Closed : FigureEnd.Closed;

            if (end == FigureEnd.Closed)
            {
                segmentCount--;
            }
            if (CoinFlip)
            {
                for (int i = 0; i < segmentCount; i++)
                {
                    AddRandomSegment(sink);
                }
            }
            else
            {
                double which = Random.NextDouble();
                if (which < 0.33)
                {
                    sink.AddLines(RandomLines(segmentCount));
                }
                else if (which < 0.67)
                {
                    sink.AddQuadraticBeziers(RandomQuadraticBeziers(segmentCount));
                }
                else
                {
                    sink.AddBeziers(RandomBeziers(segmentCount));
                }
            }
            sink.EndFigure(end);
        }
Example #20
0
        private static void CreateFigure(IGeometrySink sink, FGeometry.DirectPositionCollection positions)
        {
            if ((positions == null) || (positions.Count == 0))
            {
                return;
            }

            using (FGeometry.IDirectPosition p0 = positions[0])
            {
                if (p0.Dimensionality > 2)
                {
                    sink.BeginFigure(p0.X, p0.Y, p0.Z);
                }
                else
                {
                    sink.BeginFigure(p0.X, p0.Y, null);
                }
            }

            for (int i = 1; i < positions.Count; ++i)
            {
                using (FGeometry.IDirectPosition pi = positions[i])
                {
                    if (pi.Dimensionality > 2)
                    {
                        sink.AddLine(pi.X, pi.Y, pi.Z);
                    }
                    else
                    {
                        sink.AddLine(pi.X, pi.Y, null);
                    }
                }
            }

            sink.EndFigure();
        }
 // Just pass through without change.
 public void EndFigure()
 {
     _target.EndFigure();
 }
Example #22
0
        /// <summary>Applies a geometry type call sequence to the specified <paramref name="sink" />.</summary>
        /// <param name="sink">The sink to populate.</param>
        /// <remarks>
        ///   <para>The call sequence is a set of figures, lines, and points for geometry types.</para>
        /// </remarks>
        public void Populate(IGeometrySink sink)
        {
            sink.SetCoordinateSystem(CoordinateSystem);

            sink.BeginGeometry(GeometryType.Polygon);

            sink.BeginFigure(_Envelope.MinX, _Envelope.MinY, null);
            sink.AddLine(_Envelope.MaxX, _Envelope.MinY, null);
            sink.AddLine(_Envelope.MaxX, _Envelope.MaxY, null);
            sink.AddLine(_Envelope.MinX, _Envelope.MaxY, null);
            sink.AddLine(_Envelope.MinX, _Envelope.MinY, null);
            sink.EndFigure();

            sink.EndGeometry();
        }
Example #23
0
 private void AddRandomFigure(IGeometrySink sink, int segmentCount)
 {
     previousPoint = null;
     sink.BeginFigure(
         RandomNearPoint(),
         CoinFlip ? FigureBegin.Filled : FigureBegin.Hollow);
     FigureEnd end = CoinFlip ? FigureEnd.Closed : FigureEnd.Closed;
     if (end == FigureEnd.Closed)
         segmentCount--;
     if (CoinFlip)
         for (int i = 0; i < segmentCount; i++)
             AddRandomSegment(sink);
     else
     {
         double which = Random.NextDouble();
         if (which < 0.33)
             sink.AddLines(RandomLines(segmentCount));
         else if (which < 0.67)
             sink.AddQuadraticBeziers(RandomQuadraticBeziers(segmentCount));
         else
             sink.AddBeziers(RandomBeziers(segmentCount));
     }
     sink.EndFigure(end);
 }
 public void EndFigure()
 {
   _sink.EndFigure();
 }
Example #25
0
        private static void CreateFigure(IGeometrySink sink, FGeometry.DirectPositionCollection positions)
        {
            if ((positions==null) || (positions.Count==0))
                return;

            using (FGeometry.IDirectPosition p0=positions[0])
            {
                if (p0.Dimensionality>2)
                    sink.BeginFigure(p0.X, p0.Y, p0.Z);
                else
                    sink.BeginFigure(p0.X, p0.Y, null);
            }

            for (int i=1; i<positions.Count; ++i)
                using (FGeometry.IDirectPosition pi=positions[i])
                {
                    if (pi.Dimensionality>2)
                        sink.AddLine(pi.X, pi.Y, pi.Z);
                    else
                        sink.AddLine(pi.X, pi.Y, null);
                }

            sink.EndFigure();
        }
Example #26
0
        private static void CreateFigure(IGeometrySink sink, IList<SmGeometries.Point> points)
        {
            if ((points==null) || (points.Count==0))
                return;

            var p0=points[0];
            var p03=p0 as SmGeometries.Point3D;
            if (p03!=null)
                sink.BeginFigure(p03.X, p03.Y, p03.Z);
            else
                sink.BeginFigure(p0.X, p0.Y, null);

            for (int i=1; i<points.Count; ++i)
            {
                var pi=points[i];
                var pi3=pi as SmGeometries.Point3D;
                if (pi3!=null)
                    sink.AddLine(pi3.X, pi3.Y, pi3.Z);
                else
                    sink.AddLine(pi.X, pi.Y, null);
            }

            sink.EndFigure();
        }