org.mapsforge.map.model.DisplayModel Java Examples
The following examples show how to use
org.mapsforge.map.model.DisplayModel.
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: 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); }