/// <summary> /// Draws a point at the given location. /// </summary> /// <param name="ptX">X-Coordinate of the point, that should be drawn.</param> /// <param name="ptY">Y-Coordinate of the point, that should be drawn.</param> /// <param name="e">MapArgs for calculating the scaleSize.</param> /// <param name="ps">PointSymbolizer with which the point gets drawn.</param> /// <param name="g">Graphics-Object that should be used by the PointSymbolizer.</param> /// <param name="origTransform">The original transformation that is used to position the point.</param> private void DrawPoint(double ptX, double ptY, MapArgs e, IPointSymbolizer ps, Graphics g, Matrix origTransform) { var x = Convert.ToInt32((ptX - e.MinX) * e.Dx); var y = Convert.ToInt32((e.MaxY - ptY) * e.Dy); double scaleSize = ps.GetScale(e); Matrix shift = origTransform.Clone(); shift.Translate(x, y); g.Transform = shift; ps.Draw(g, scaleSize); }
/// <summary> /// Draws a point at the given location. /// </summary> /// <param name="ptX">X-Coordinate of the point, that should be drawn.</param> /// <param name="ptY">Y-Coordinate of the point, that should be drawn.</param> /// <param name="e">MapArgs for calculating the scaleSize.</param> /// <param name="ps">PointSymbolizer with which the point gets drawn.</param> /// <param name="g">Graphics-Object that should be used by the PointSymbolizer.</param> /// <param name="origTransform">The original transformation that is used to position the point.</param> /// <param name="clockwiseAngle">clockwiseAngle.</param> private void DrawPoint(double ptX, double ptY, MapArgs e, IPointSymbolizer ps, Graphics g, Matrix origTransform, float clockwiseAngle) { var pt = new PointF { X = Convert.ToSingle((ptX - e.MinX) * e.Dx), Y = Convert.ToSingle((e.MaxY - ptY) * e.Dy) }; double scaleSize = ps.GetScale(e); Matrix shift = origTransform.Clone(); shift.Translate(pt.X, pt.Y); shift.Rotate(clockwiseAngle); g.Transform = shift; ps.Draw(g, scaleSize); }
/// <summary> /// Draws a point at the given location. /// </summary> /// <param name="ptX">X-Coordinate of the point, that should be drawn.</param> /// <param name="ptY">Y-Coordinate of the point, that should be drawn.</param> /// <param name="e">MapArgs for calculating the scaleSize.</param> /// <param name="ps">PointSymbolizer with which the point gets drawn.</param> /// <param name="g">Graphics-Object that should be used by the PointSymbolizer.</param> /// <param name="origTransform">The original transformation that is used to position the point.</param> private void DrawPoint(double ptX, double ptY, MapArgs e, IPointSymbolizer ps, Graphics g, Matrix origTransform) { var pt = new Point { X = Convert.ToInt32((ptX - e.MinX) * e.Dx), Y = Convert.ToInt32((e.MaxY - ptY) * e.Dy) }; double scaleSize = ps.GetScale(e); // CGX if (MapFrame != null && (MapFrame as IMapFrame).ReferenceScale > 1.0 && (MapFrame as IMapFrame).CurrentScale > 0.0) { double dReferenceScale = (MapFrame as IMapFrame).ReferenceScale; double dCurrentScale = (MapFrame as IMapFrame).CurrentScale; scaleSize = dReferenceScale / dCurrentScale; } // Fin CGX Matrix shift = origTransform.Clone(); shift.Translate(pt.X, pt.Y); g.Transform = shift; ps.Draw(g, scaleSize); }
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; }