org.mapsforge.map.rendertheme.rule.RenderThemeFuture Java Examples
The following examples show how to use
org.mapsforge.map.rendertheme.rule.RenderThemeFuture.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OsmTilegenerator.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public OsmTilegenerator( MapDataStore mapDatabase, final DatabaseRenderer renderer, final RenderThemeFuture renderTheme, final DisplayModel displayModel, int tileSize ) { this.mapDatabase = mapDatabase; this.renderer = renderer; this.theme = renderTheme; this.model = displayModel; this.tileSize = tileSize; }
Example #2
Source File: Mapsforge2MbtilesConverter.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
private OsmTilegenerator getGenerator( ReferencedEnvelope llBounds ) { // MapWorkerPool.NUMBER_OF_THREADS = 4; // // Map buffer size // ReadBuffer.setMaximumBufferSize(6500000); // // Square frame buffer // FrameBufferController.setUseSquareFrameBuffer(false); DisplayModel model = new DisplayModel(); model.setUserScaleFactor(pScaleFactor); model.setFixedTileSize(pTilesize); DataPolicy dataPolicy = DataPolicy.RETURN_ALL; MultiMapDataStore mapDatabase = new MultiMapDataStore(dataPolicy); for( int i = 0; i < inMapFiles.length; i++ ) mapDatabase.addMapDataStore(new MapFile(inMapFiles[i]), false, false); if (llBounds != null) { BoundingBox bb = mapDatabase.boundingBox(); llBounds.expandToInclude(new Envelope(bb.minLongitude, bb.maxLongitude, bb.minLatitude, bb.maxLatitude)); } InMemoryTileCache tileCache = new InMemoryTileCache(200); DatabaseRenderer renderer = new DatabaseRenderer(mapDatabase, AwtGraphicFactory.INSTANCE, tileCache, new TileBasedLabelStore(tileCache.getCapacityFirstLevel()), true, true, null); InternalRenderTheme xmlRenderTheme = InternalRenderTheme.DEFAULT; RenderThemeFuture theme = new RenderThemeFuture(AwtGraphicFactory.INSTANCE, xmlRenderTheme, model); // super important!! without the following line, all rendering // activities will block until the theme is created. new Thread(theme).start(); OsmTilegenerator osmTilegenerator = new OsmTilegenerator(mapDatabase, renderer, theme, model, pTilesize); return osmTilegenerator; }
Example #3
Source File: MapsforgeTilesGenerator.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Constructor. * * @param mapsforgeFiles mapsforge map files. * @param tileSize optional tilesize, defaults to 256. * @param scaleFactor optional scale factor for labels, defaults to 1. * @param cacheDir optional cachdir. If null, in-memory is used. * @param theme optional rendertheme. * @throws IOException */ public MapsforgeTilesGenerator( File[] mapsforgeFiles, Integer tileSize, Float scaleFactor, File cacheDir, XmlRenderTheme theme ) throws IOException { if (tileSize != null) this.tileSize = tileSize; if (scaleFactor != null) this.scaleFactor = scaleFactor; if (theme == null) { theme = InternalRenderTheme.DEFAULT; } DataPolicy dataPolicy = DataPolicy.RETURN_ALL; mapDataStore = new MultiMapDataStore(dataPolicy); for( int i = 0; i < mapsforgeFiles.length; i++ ) mapDataStore.addMapDataStore(new MapFile(mapsforgeFiles[i]), false, false); GraphicFactory graphicFactory = AwtGraphicFactory.INSTANCE; displayModel = new FixedTileSizeDisplayModel(this.tileSize); renderTheme = new RenderThemeFuture(graphicFactory, theme, displayModel); if (cacheDir == null) { tileCache = new InMemoryTileCache(200); } else { tileCache = new FileSystemTileCache(10, cacheDir, graphicFactory, false); } TileBasedLabelStore tileBasedLabelStore = new TileBasedLabelStore(tileCache.getCapacityFirstLevel()); renderer = new DatabaseRenderer(mapDataStore, graphicFactory, tileCache, tileBasedLabelStore, true, true, null); new Thread(renderTheme).start(); }
Example #4
Source File: MapsforgeNwwLayer.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
private static OsmTilegenerator getTilegenerator(File[] mapsforgeFiles, Integer tileSize, Float scaleFactor) { if (tileSize == null || tileSize < 256) { tileSize = TILESIZE; } if (scaleFactor == null) scaleFactor = 1.5f; // MapWorkerPool.NUMBER_OF_THREADS = 4; // // Map buffer size // ReadBuffer.setMaximumBufferSize(6500000); // // Square frame buffer // FrameBufferController.setUseSquareFrameBuffer(false); DisplayModel model = new DisplayModel(); model.setUserScaleFactor(scaleFactor); model.setFixedTileSize(tileSize); DataPolicy dataPolicy = DataPolicy.RETURN_ALL; MultiMapDataStore mapDatabase = new MultiMapDataStore(dataPolicy); for (int i = 0; i < mapsforgeFiles.length; i++) mapDatabase.addMapDataStore(new MapFile(mapsforgeFiles[i]), false, false); InMemoryTileCache tileCache = new InMemoryTileCache(200); DatabaseRenderer renderer = new DatabaseRenderer(mapDatabase, AwtGraphicFactory.INSTANCE, tileCache, new TileBasedLabelStore(tileCache.getCapacityFirstLevel()), true, true, null); InternalRenderTheme xmlRenderTheme = InternalRenderTheme.DEFAULT; RenderThemeFuture theme = new RenderThemeFuture(AwtGraphicFactory.INSTANCE, xmlRenderTheme, model); // super important!! without the following line, all rendering // activities will block until the theme is created. new Thread(theme).start(); // TODO get back external themes // DatabaseRenderer dbRenderer = null; // XmlRenderTheme xmlRenderTheme = null; // DisplayModel displayModel = null; // if (mapsforgeFile.exists()) { // mapDatabase.openFile(mapsforgeFile); // dbRenderer = new DatabaseRenderer(mapDatabase, graphicFactory); // // String mapName = // FileUtilities.getNameWithoutExtention(mapsforgeFiles[0]); // File xmlStyleFile = new File(mapsforgeFiles[0].getParentFile(), // mapName + ".xml"); // if (xmlStyleFile.exists()) { // try { // xmlRenderTheme = new ExternalRenderTheme(xmlStyleFile); // } catch (Exception e) { // xmlRenderTheme = InternalRenderTheme.OSMARENDER; // } // } else { // xmlRenderTheme = InternalRenderTheme.OSMARENDER; // } // displayModel = new DisplayModel(); // displayModel.setUserScaleFactor(tileSize / 256f); // } return new OsmTilegenerator(mapDatabase, renderer, theme, model, tileSize); }
Example #5
Source File: ForgeMap.java From Androzic with GNU General Public License v3.0 | 4 votes |
private static void compileRenderTheme(XmlRenderTheme xmlRenderTheme) { renderTheme = new RenderThemeFuture(AndroidGraphicFactory.INSTANCE, xmlRenderTheme, displayModel); new Thread(renderTheme).run(); }