Exemple #1
0
        private static Bitmap GetSymbolizerBitmap(IPointSymbolizer symbolizer, IProj e)
        {
            if (symbolizer == null) return null;

            var scaleSize = symbolizer.GetScale(e);
            var size = symbolizer.GetSize();
            if (size.Width * scaleSize < 1 || size.Height * scaleSize < 1) return null;

            var bitmap = new Bitmap((int)(size.Width * scaleSize) + 1, (int)(size.Height * scaleSize) + 1);
            var bg = Graphics.FromImage(bitmap);
            bg.SmoothingMode = symbolizer.Smoothing ? SmoothingMode.AntiAlias : SmoothingMode.None;
            var trans = bg.Transform;

            // keenedge:
            // added ' * scaleSize ' to fix a problme when ploted using ScaleMode=Geographic.   however, it still
            // appeared to be shifted up and left by 1 pixel so I also added the one pixel shift to the NW.
            trans.Translate(((float)(size.Width * scaleSize) / 2 - 1), (float)(size.Height * scaleSize) / 2 - 1);
            bg.Transform = trans;
            symbolizer.Draw(bg, 1);

            return bitmap;
        }