public TileBitmap executeJob ( RendererJob rendererJob ) { RenderContext renderContext = null ; try { renderContext = new RenderContext ( rendererJob , new CanvasRasterer ( graphicFactory ) ) ; if ( renderBitmap ( renderContext ) ) { TileBitmap bitmap = null ; if ( this . mapDataStore != null ) { MapReadResult mapReadResult = this . mapDataStore . readMapData ( rendererJob . tile ) ; processReadMapData ( renderContext , mapReadResult ) ; } if ( ! rendererJob . labelsOnly ) { renderContext . renderTheme . matchHillShadings ( this , renderContext ) ; bitmap = this . graphicFactory . createTileBitmap ( rendererJob . tile . tileSize , rendererJob . hasAlpha ) ; bitmap . setTimestamp ( rendererJob . mapDataStore . getDataTimestamp ( rendererJob . tile ) ) ; renderContext . canvasRasterer . setCanvasBitmap ( bitmap ) ; if ( ! rendererJob . hasAlpha && rendererJob . displayModel . getBackgroundColor ( ) != renderContext . renderTheme . getMapBackground ( ) ) { renderContext . canvasRasterer . fill ( renderContext . renderTheme . getMapBackground ( ) ) ; } renderContext . canvasRasterer . drawWays ( renderContext ) ; } if ( this . renderLabels ) { Set < MapElementContainer > labelsToDraw = processLabels ( renderContext ) ; // now draw the ways and the labels renderContext . canvasRasterer . drawMapElements ( labelsToDraw , rendererJob . tile ) ; } if ( ! rendererJob . labelsOnly && renderContext . renderTheme . hasMapBackgroundOutside ( ) ) { // blank out all areas outside of map Rectangle insideArea = this . mapDataStore . boundingBox ( ) . getPositionRelativeToTile ( rendererJob . tile ) ; if ( ! rendererJob . hasAlpha ) { renderContext . canvasRasterer . fillOutsideAreas ( renderContext . renderTheme . getMapBackgroundOutside ( ) , insideArea ) ; } else { renderContext . canvasRasterer . fillOutsideAreas ( Color . TRANSPARENT , insideArea ) ; } } return bitmap ; } // outside of map area return null ; } catch ( Exception e ) { // #1049: message can be null? LOGGER . warning ( "Exception: " + e . getMessage ( ) ) ; return null ; } finally { if ( renderContext != null ) { renderContext . destroy ( ) ; } } }
Called when a job needs to be executed .