TransformToImage() public method

Transforms the linestring to image coordinates, based on the map
public TransformToImage ( Map map ) : System.Drawing.PointF[]
map Map Map to base coordinates on
return System.Drawing.PointF[]
Ejemplo n.º 1
0
 /// <summary>
 /// Function that actually renders the linestring
 /// </summary>
 /// <param name="map"></param>
 /// <param name="lineString"></param>
 /// <param name="g"></param>
 protected override void OnRenderInternal(Map map, LineString lineString, Graphics g)
 {
     var gp = new GraphicsPath();
     gp.AddLines(/*LimitValues(*/lineString.TransformToImage(map)/*)*/);
     if (ImmediateMode)
     {
         var tmp = new List<GraphicsPath>(new[] {gp});
         Symbolize(g, map, tmp);
     }
     else
         _graphicsPaths.Add(gp);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Function that actually renders the linestring
 /// </summary>
 /// <param name="map"></param>
 /// <param name="lineString"></param>
 /// <param name="g"></param>
 protected override void OnRenderInternal(Map map, LineString lineString, Graphics g)
 {
     var gp = new GraphicsPath();
     gp.AddLines(/*LimitValues(*/lineString.TransformToImage(map)/*)*/);
     _graphicsPaths.Add(gp);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Renders a LineString to the map.
        /// </summary>
        /// <param name="g">Graphics reference</param>
        /// <param name="line">LineString to render</param>
        /// <param name="pen">Pen style used for rendering</param>
        /// <param name="map">Map reference</param>
        /// <param name="offset">Offset by which line will be moved to right</param>
        public static void DrawLineString(Graphics g, LineString line, Pen pen, Map map, float offset)
        {
            if (line.Vertices.Count > 1)
            {
                GraphicsPath gp = new GraphicsPath();
                if (offset == 0)
                    gp.AddLines(/*LimitValues(*/line.TransformToImage(map)/*, ExtremeValueLimit)*/);
                else
                    gp.AddLines(OffsetRight(/*LimitValues(*/line.TransformToImage(map)/*, ExtremeValueLimit)*/, offset));

                g.DrawPath(pen, gp);
            }
        }
Ejemplo n.º 4
0
        //private static void WarpedLabel(MultiLineString line, ref BaseLabel baseLabel, Map map)
        //{
        //    var path = MultiLineStringToPath(line, map, true);

        //    var pathLabel = new PathLabel(baseLabel.Text, path, 0f, baseLabel.Priority, new LabelBox(path.GetBounds()), baseLabel.Style);
        //    baseLabel = pathLabel;
        //}

        //private static void WarpedLabel(LineString line, ref BaseLabel baseLabel, Map map)
        //{
            
        //    var path = LineStringToPath(line, map, false);

        //    var pathLabel = new PathLabel(baseLabel.Text, path, 0f, baseLabel.Priority, new LabelBox(path.GetBounds()), baseLabel.Style);
        //    baseLabel = pathLabel;
        //}


        /// <summary>
        /// Function to transform a linestring to a graphics path for further processing
        /// </summary>
        /// <param name="lineString">The Linestring</param>
        /// <param name="map">The map</param>
        ///// <param name="useClipping">A value indicating whether clipping should be applied or not</param>
        /// <returns>A GraphicsPath</returns>
        public static GraphicsPath LineStringToPath(LineString lineString, Map map/*, bool useClipping*/)
        {
            var gp = new GraphicsPath(FillMode.Alternate);
            //if (!useClipping)
                gp.AddLines(lineString.TransformToImage(map));
            //else
            //{
            //    var bb = map.Envelope;
            //    var cohenSutherlandLineClipping = new CohenSutherlandLineClipping(bb.Left, bb.Bottom, bb.Right, bb.Top);
            //    var clippedLineStrings = cohenSutherlandLineClipping.ClipLineString(lineString);
            //    foreach (var clippedLineString in clippedLineStrings.LineStrings)
            //    {
            //        var s = clippedLineString.StartPoint;
            //        var e = clippedLineString.EndPoint;
                    
            //        var dx = e.X - s.X;
            //        //var dy = e.Y - s.Y;

            //        LineString revcls = null;
            //        if (dx < 0)
            //            revcls = ReverseLineString(clippedLineString);
                    
            //        gp.StartFigure();
            //        gp.AddLines(revcls == null ? clippedLineString.TransformToImage(map) : revcls.TransformToImage(map));
            //    }
            //}
            return gp;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Function to transform a linestring to a graphics path for further processing
 /// </summary>
 /// <param name="lineString">The Linestring</param>
 /// <param name="map">The map</param>
 ///// <param name="useClipping">A value indicating whether clipping should be applied or not</param>
 /// <returns>A GraphicsPath</returns>
 public static GraphicsPath LineStringToPath(LineString lineString, Map map)
 {
     var gp = new GraphicsPath(FillMode.Alternate);
     gp.AddLines(lineString.TransformToImage(map));
     return gp;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Renders a LineString to the map.
 /// </summary>
 /// <param name="g">Graphics reference</param>
 /// <param name="line">LineString to render</param>
 /// <param name="pen">Pen style used for rendering</param>
 /// <param name="map">Map reference</param>
 public static void DrawLineString(Graphics g, LineString line, Pen pen, Map map)
 {
     if (line.Vertices.Count > 1)
     {
         GraphicsPath gp = new GraphicsPath();
         gp.AddLines(LimitValues(line.TransformToImage(map), ExtremeValueLimit));
         g.DrawPath(pen, gp);
     }
 }
Ejemplo n.º 7
0
 protected override void OnRenderInternal(Map map, LineString linestring, Graphics g)
 {
     var pts = /*LimitValues(*/ linestring.TransformToImage(map) /*)*/;
     g.DrawLines(Line, pts);
 }