Ejemplo n.º 1
0
        /// <summary>
        /// Transforms a <see cref="Polygon"/> to an array of <see cref="PointF"/>s
        /// </summary>
        /// <param name="self">The polygon</param>
        /// <param name="map">The map that defines the affine coordinate transformation.</param>
        /// <param name="useClipping">Use clipping for the polygon</param>
        /// <returns>An array of PointFs</returns>
        public static GraphicsPath TransformToImage(this Polygon self, MapViewport map, bool useClipping = false)
        {
            var res = new GraphicsPath(FillMode.Alternate);

            if (useClipping)
            {
                res.AddPolygon(VectorRenderer.ClipPolygon(
                                   VectorRenderer.LimitValues(self.ExteriorRing.TransformToImage(map), VectorRenderer.ExtremeValueLimit),
                                   map.Size.Width, map.Size.Height));
                for (var i = 0; i < self.NumInteriorRings; i++)
                {
                    res.AddPolygon(VectorRenderer.ClipPolygon(
                                       VectorRenderer.LimitValues(self.GetInteriorRingN(i).TransformToImage(map), VectorRenderer.ExtremeValueLimit),
                                       map.Size.Width, map.Size.Height));
                }
            }
            else
            {
                res.AddPolygon(self.ExteriorRing.TransformToImage(map));
                for (var i = 0; i < self.NumInteriorRings; i++)
                {
                    res.AddPolygon(self.GetInteriorRingN(i).TransformToImage(map));
                }
            }
            return(res);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Function that actually renders the linestring
        /// </summary>
        /// <param name="map"></param>
        /// <param name="lineString"></param>
        /// <param name="graphics"></param>
        protected override void OnRenderInternal(MapViewport map, ILineString lineString, Graphics graphics)
        {
            var gp = new GraphicsPath();

            gp.AddLines(VectorRenderer.LimitValues(lineString.TransformToImage(map), VectorRenderer.ExtremeValueLimit));
            if (ImmediateMode)
            {
                var tmp = new List <GraphicsPath>(new[] { gp });
                Symbolize(graphics, map, tmp);
            }
            else
            {
                _graphicsPaths.Add(gp);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Method that does the actual rendering of individual features.
        /// </summary>
        /// <param name="map">The map</param>
        /// <param name="lineString">The linestring</param>
        /// <param name="graphics">The graphics object</param>
        protected override void OnRenderInternal(MapViewport map, ILineString lineString, Graphics graphics)
        {
            var pts = VectorRenderer.LimitValues(VectorRenderer.OffsetRight(lineString.TransformToImage(map), Offset), VectorRenderer.ExtremeValueLimit);

            graphics.DrawLines(Line, pts);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Method that does the actual rendering of individual features.
 /// </summary>
 /// <param name="map">The map</param>
 /// <param name="lineString">The linestring</param>
 /// <param name="graphics">The graphics object</param>
 protected override void OnRenderInternal(MapViewport map, ILineString lineString, Graphics graphics)
 {
     graphics.DrawLines(Line, VectorRenderer.LimitValues(lineString.TransformToImage(map), VectorRenderer.ExtremeValueLimit));
 }