Esempio n. 1
0
        /// <summary>
        /// Draws the view within the specified rectangle.
        /// </summary>
        /// <param name="rect">Rect.</param>
        public override void Draw(System.Drawing.RectangleF rect)
        {
            _rect = rect;
            base.Draw(rect);

            lock (_cachedScene) {
                // recreate the view.
                //View2D view = this.CreateView (_rect);
                View2D view = this.CreateView(this.Frame);

                // call the canvas renderer.
                CGContext context = UIGraphics.GetCurrentContext();

                if (context != null)
                {
                    context.InterpolationQuality = CGInterpolationQuality.None;
                    context.SetShouldAntialias(false);
                    context.SetBlendMode(CGBlendMode.Copy);
                    context.SetAlpha(1);

                    long afterViewChanged      = DateTime.Now.Ticks;
                    CGContextRenderer renderer = new CGContextRenderer(1);
//					renderer.Render (new CGContextWrapper (context, _rect),
                    //					                _cachedScene, view);
                    renderer.Render(new CGContextWrapper(context, this.Frame),
                                    _cachedScene, view);
                    long afterRendering = DateTime.Now.Ticks;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Draws the view within the specified rectangle.
        /// </summary>
        /// <param name="rect">Rect.</param>
        public override void Draw(System.Drawing.RectangleF rect)
        {
            _rect = rect;

            base.Draw(rect);

            lock (_cachedScene) {
                // recreate the view.
                View2D view = this.CreateView(_rect);

                // call the canvas renderer.
                CGContext context = UIGraphics.GetCurrentContext();

                if (context != null)
                {
                    context.InterpolationQuality = CGInterpolationQuality.None;
                    context.SetShouldAntialias(false);
                    context.SetBlendMode(CGBlendMode.Copy);
                    context.SetAlpha(1);

                    OsmSharp.Logging.Log.TraceEvent("MapView", System.Diagnostics.TraceEventType.Information,
                                                    "Renderer called in Draw(rect)!");
                    long afterViewChanged      = DateTime.Now.Ticks;
                    CGContextRenderer renderer = new CGContextRenderer();
                    renderer.Render(new CGContextWrapper(context, _rect),
                                    _cachedScene, view);
                    long afterRendering = DateTime.Now.Ticks;

                    OsmSharp.Logging.Log.TraceEvent("OsmSharp.Android.UI.MapView", System.Diagnostics.TraceEventType.Information,
                                                    "Rendering cache took: {0}ms @ zoom level {1}",
                                                    (new TimeSpan(afterRendering - afterViewChanged).TotalMilliseconds), this.MapZoomLevel);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Draws the view within the specified rectangle.
        /// </summary>
        /// <param name="rect">Rect.</param>
        public override void Draw(System.Drawing.RectangleF rect)
        {
            _rect = rect;
            base.Draw(rect);

            lock (_bufferSynchronisation)
            {
                // recreate the view.
                View2D view       = this.CreateView(this.Frame);
                float  zoomFactor = (float)this.Map.Projection.ToZoomFactor(this.MapZoom);

                // call the canvas renderer.
                CGContext context = UIGraphics.GetCurrentContext();

                if (context != null)
                {
                    context.InterpolationQuality = CGInterpolationQuality.None;
                    context.SetShouldAntialias(false);
                    context.SetBlendMode(CGBlendMode.Copy);
                    context.SetAlpha(1);

                    long afterViewChanged      = DateTime.Now.Ticks;
                    CGContextRenderer renderer = new CGContextRenderer(1);
                    renderer.Render(
                        new CGContextWrapper(context, this.Frame),
                        view,
                        zoomFactor,
                        new Primitive2D[] { _onScreenBuffer });
                    long afterRendering = DateTime.Now.Ticks;
                }
            }
        }