internal CanvasRasterer(IGraphicFactory graphicFactory) { this.symbolMatrix = graphicFactory.CreateMatrix(); this.path = graphicFactory.CreatePath(); // TODO: Delete this.graphicFactory = graphicFactory; }
public override void Draw(BoundingBox boundingBox, sbyte zoomLevel, ICanvas canvas, Point topLeftPoint) { lock (this) { if (this.latLongs.Count < 2 || (this.paintStroke == null && this.paintFill == null)) { return; } IEnumerator <LatLong> iterator = this.latLongs.GetEnumerator(); IPath path = this.graphicFactory.CreatePath(); LatLong latLong = iterator.Current; long mapSize = MercatorProjection.GetMapSize(zoomLevel, displayModel.TileSize); float x = (float)(MercatorProjection.LongitudeToPixelX(latLong.Longitude, mapSize) - topLeftPoint.X); float y = (float)(MercatorProjection.LatitudeToPixelY(latLong.Latitude, mapSize) - topLeftPoint.Y); path.MoveTo(x, y); while (iterator.MoveNext()) { latLong = iterator.Current; x = (float)(MercatorProjection.LongitudeToPixelX(latLong.Longitude, mapSize) - topLeftPoint.X); y = (float)(MercatorProjection.LatitudeToPixelY(latLong.Latitude, mapSize) - topLeftPoint.Y); path.LineTo(x, y); } if (this.paintStroke != null) { if (this.keepAligned) { this.paintStroke.SetBitmapShaderShift = topLeftPoint; } canvas.DrawPath(path, this.paintStroke); } if (this.paintFill != null) { if (this.keepAligned) { this.paintFill.SetBitmapShaderShift = topLeftPoint; } canvas.DrawPath(path, this.paintFill); } } }
internal CanvasRasterer(IGraphicFactory graphicFactory) { this.canvas = graphicFactory.CreateCanvas(); this.symbolMatrix = graphicFactory.CreateMatrix(); this.path = graphicFactory.CreatePath(); }