public synchronized void draw(GraphicContext graphicContext) { graphicContext.fillColor(this.displayModel.getBackgroundColor()); if (this.odBitmap != null) { graphicContext.drawBitmap(this.odBitmap, this.matrix); } }
public void draw(GraphicContext graphicContext) { if (!this.visible) { return; } long currentTime = System.nanoTime(); long elapsedTime = currentTime - this.lastTime; if (elapsedTime > ONE_SECOND) { this.fps = String.valueOf(Math.round((float) (this.frameCounter * ONE_SECOND) / elapsedTime)); this.lastTime = currentTime; this.frameCounter = 0; } int x = (int) (20 * displayModel.getScaleFactor()); int y = (int) (40 * displayModel.getScaleFactor()); graphicContext.drawText(this.fps, x, y, this.paintBack); graphicContext.drawText(this.fps, x, y, this.paintFront); ++this.frameCounter; }
/** * Called from {@link MapView} * * @param graphicContext The graphicContext to use to draw the MapScaleBar */ public void draw(GraphicContext graphicContext) { if (!this.visible) { return; } if (this.mapViewDimension.getDimension() == null) { return; } if (this.isRedrawNecessary()) { redraw(this.mapScaleCanvas); this.redrawNeeded = false; } int positionLeft = calculatePositionLeft(0, this.mapViewDimension.getDimension().width, this.mapScaleBitmap.getWidth()); int positionTop = calculatePositionTop(0, this.mapViewDimension.getDimension().height, this.mapScaleBitmap.getHeight()); graphicContext.drawBitmap(this.mapScaleBitmap, positionLeft, positionTop); }
@Override public void draw(GraphicContext graphicContext) { if (!this.isVisible()) { return; } if (this.mapViewDimension.getDimension() == null) { return; } if (this.isRedrawNecessary()) { redraw(this.mapScaleCanvas); this.redrawNeeded = false; } graphicContext.drawBitmap(this.mapScaleBitmap, 0, 0); }
/** * This is called from (Android) <code>MapView.onDraw()</code>. */ @Override public void draw(GraphicContext graphicContext) { graphicContext.fillColor(this.displayModel.getBackgroundColor()); // Swap bitmaps before the Canvas.drawBitmap to prevent flickering as much as possible swapBitmaps(); if (this.odBitmap != null) { graphicContext.drawBitmap(this.odBitmap, this.matrix); } }
/** * Called from {@link MapView} * * @param graphicContext The graphicContext to use to draw the MapScaleBar */ public void draw(GraphicContext graphicContext) { if (!this.visible) { return; } if (this.mapViewDimension.getDimension() == null) { return; } if (this.isRedrawNecessary()) { redraw(this.mapScaleCanvas); this.redrawNeeded = false; } int positionLeft = calculatePositionLeft(0, this.mapViewDimension.getDimension().width, this.mapScaleBitmap.getWidth()); int positionTop = calculatePositionTop(0, this.mapViewDimension.getDimension().height, this.mapScaleBitmap.getHeight()); graphicContext.drawBitmap(this.mapScaleBitmap, positionLeft, positionTop); }
public void draw(GraphicContext graphicContext) { if (!this.visible) { return; } long currentTime = System.nanoTime(); long elapsedTime = currentTime - this.lastTime; if (elapsedTime > ONE_SECOND) { this.fps = String.valueOf(Math.round((float) (this.frameCounter * ONE_SECOND) / elapsedTime)); this.lastTime = currentTime; this.frameCounter = 0; } int x = (int) (20 * displayModel.getScaleFactor()); int y = (int) (40 * displayModel.getScaleFactor()); graphicContext.drawText(this.fps, x, y, this.paintBack); graphicContext.drawText(this.fps, x, y, this.paintFront); ++this.frameCounter; }
/** * This is called from (Android) <code>MapView.onDraw</code> * and (Desktop) <code>MapView.paint</code>. */ public void draw(GraphicContext graphicContext) { /* * Swap bitmaps here (and only here). * Swapping is done when layer manager has finished. Else draw old bitmap again. * This draw() is always called when layer manager has finished. This ensures that the * last generated frame is always put on screen. */ // FIXME: resetting the background color is redundant if the background color of the map view is already set graphicContext.fillColor(this.displayModel.getBackgroundColor()); swapBitmaps(); synchronized (this.matrix) { Bitmap b = this.odBitmap.lock(); if (b != null) { graphicContext.drawBitmap(b, this.matrix); } } /* * Release here so destroy() can free resources */ this.odBitmap.release(); }
public synchronized void draw(GraphicContext graphicContext) { graphicContext.fillColor(this.displayModel.getBackgroundColor()); if (this.odBitmap != null) { graphicContext.drawBitmap(this.odBitmap, this.matrix); } }
/** * This is called from (Android) <code>MapView.onDraw()</code>. */ @Override public void draw(GraphicContext graphicContext) { graphicContext.fillColor(this.displayModel.getBackgroundColor()); // Swap bitmaps before the Canvas.drawBitmap to prevent flickering as much as possible swapBitmaps(); if (this.odBitmap != null) { graphicContext.drawBitmap(this.odBitmap, this.matrix); } }
/** * This is called from (Android) <code>MapView.onDraw</code> * and (Desktop) <code>MapView.paint</code>. */ public void draw(GraphicContext graphicContext) { /* * Swap bitmaps here (and only here). * Swapping is done when layer manager has finished. Else draw old bitmap again. * This draw() is always called when layer manager has finished. This ensures that the * last generated frame is always put on screen. */ // FIXME: resetting the background color is redundant if the background color of the map view is already set graphicContext.fillColor(this.displayModel.getBackgroundColor()); swapBitmaps(); synchronized (this.matrix) { Bitmap b = this.odBitmap.lock(); if (b != null) { graphicContext.drawBitmap(b, this.matrix); } } /* * Release here so destroy() can free resources */ this.odBitmap.release(); }