Ejemplo n.º 1
0
        /// <summary>
        /// 画注记
        /// </summary>
        /// <param name="g"></param>
        /// <param name="bounds"></param>
        /// <param name="centerPos"></param>
        /// <param name="scale"></param>
        /// <param name="fid2Text"></param>
        internal override void DrawLabel(Graphics g, Rectangle bounds, PointF centerPos, double scale, Dictionary <int, string> fid2Text, TextSymbol textSymbol)
        {
            MyPoint xyCenter = ETCProjection.LngLat2XY(new MyPoint(centerPos.X, centerPos.Y));
            double  xmin     = xyCenter.X - scale * bounds.Width / 2;
            double  xmax     = xyCenter.X + scale * bounds.Width / 2;
            double  ymin     = xyCenter.Y - scale * bounds.Height / 2;
            double  ymax     = xyCenter.Y + scale * bounds.Height / 2;

            for (int i = 0; i < polylines.Count; i++)
            {
                string        text    = fid2Text[polylines[i].FID];
                List <PointF> pointfs = new List <PointF>();
                for (int j = 0; j < polylines[i].PointCount; j++)
                {
                    MyPoint xyProjection = ETCProjection.LngLat2XY(polylines[i].Points[j]);
                    double  xScreen      = bounds.Width * (xyProjection.X - xmin) / (xmax - xmin);
                    double  yScreen      = bounds.Height * (xyProjection.Y - ymin) / (ymax - ymin);
                    PointF  p            = new PointF((float)xScreen, bounds.Height - (float)yScreen);
                    pointfs.Add(p);
                }
                TextSymbol.LineLabel(pointfs.ToArray(), g, textSymbol, text);  //此处注记样式不能修改。待完善
            }
        }