示例#1
0
        public ImageMapPoint(SharpMap.Geometries.Geometry geom, SharpMap.Map map, ImageMapStyle mapStyle)
            : base(geom, map)
        {
            this.Radius = mapStyle.Point.Radius;

            SharpMap.Geometries.Point P = geom as SharpMap.Geometries.Point;
            PointF pf = map.WorldToImage(P);
            map.MapTransform.TransformPoints(new PointF[] { pf });
            center = new System.Drawing.Point((int)pf.X, (int)pf.Y);

        }
示例#2
0
        public ImageMapLine(SharpMap.Geometries.Geometry geom, SharpMap.Map map, ImageMapStyle mapStyle)
            : base(geom, map)
        {

            PointF[] transLine = (geom as LineString).TransformToImage(map);
            map.MapTransform.TransformPoints(transLine);

            List<PointF> tempPoly = new List<PointF>();

            for (int i = 0; i < transLine.Length; i++)
            {
                PointF p = transLine[i];
                tempPoly.Add(new System.Drawing.PointF((p.X - mapStyle.Line.BufferWidth), (p.Y + mapStyle.Line.BufferWidth)));
                tempPoly.Add(new System.Drawing.PointF((p.X + mapStyle.Line.BufferWidth), (p.Y + mapStyle.Line.BufferWidth)));
            }

            for (int i = transLine.Length - 1; i > -1; i--)
            {
                PointF p = transLine[i];
                tempPoly.Add(new System.Drawing.PointF((p.X - mapStyle.Line.BufferWidth), (p.Y - mapStyle.Line.BufferWidth)));
                tempPoly.Add(new System.Drawing.PointF((p.X + mapStyle.Line.BufferWidth), (p.Y - mapStyle.Line.BufferWidth)));
            }

            if (!tempPoly[0].Equals(tempPoly[tempPoly.Count - 1]))
            {
                tempPoly.Add(tempPoly[0]);
            }

            PointF[] tp = tempPoly.ToArray();
            tp = ImageMapUtilities.ClipPolygon(tp, map.Size.Width, map.Size.Height);
            foreach (PointF pf in tp)
            {
                coords.Add(pf);
            }



        }