Java Code Examples for org.mapsforge.map.android.graphics.AndroidGraphicFactory#INSTANCE
The following examples show how to use
org.mapsforge.map.android.graphics.AndroidGraphicFactory#INSTANCE .
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: MapCreator.java From EasyVPN-Free with GNU General Public License v3.0 | 6 votes |
private void createPolygons(JSONArray coordinates) { Polygon polygon = new Polygon(paintFill, paintStroke, AndroidGraphicFactory.INSTANCE); List<LatLong> polygonList = polygon.getLatLongs(); for (int j = 0; j < coordinates.length(); j++) { try { JSONArray arrLatLong = new JSONArray(coordinates.get(j).toString()); polygonList.add(new LatLong(arrLatLong.getDouble(1), arrLatLong.getDouble(0))); } catch (JSONException e) { e.printStackTrace(); } } layers.add(polygon); }
Example 2
Source File: ForgeMap.java From Androzic with GNU General Public License v3.0 | 5 votes |
@Override public synchronized void activate(OnMapTileStateChangeListener listener, double mpp, boolean current) throws Throwable { Log.e("FM", "activate(): " + name); synchronized (MAGIC) { mapRedrawer.setListener(listener); if (tileCache == null) { tileCache = new MutableTwoLevelTileCache(); tileCache.setSecondLevelCache(getSecondLevelCache()); } if (databaseRenderer == null) databaseRenderer = new DatabaseRenderer(mapDataStore, AndroidGraphicFactory.INSTANCE, tileCache); if (jobQueue == null) jobQueue = new JobQueue<>(mapViewPosition, displayModel); if (mapWorker == null) { mapWorker = new MapWorker(tileCache, jobQueue, databaseRenderer, new ForgeLayer(mapRedrawer)); mapWorker.start(); } activeCount++; if (Math.abs(1 - mpp / getMPP()) < 0.1) mpp = getMPP(); super.activate(listener, mpp, current); } }
Example 3
Source File: ForgeMap.java From Androzic with GNU General Public License v3.0 | 5 votes |
private static TileCache getSecondLevelCache() { if (fileSystemTileCache != null) return fileSystemTileCache; BaseApplication application = BaseApplication.getApplication(); if (application == null) return null; File cache = application.getCacheDir(); if (cache == null) // cache is not available now return null; File cacheDirectory = new File(cache, "mapsforge"); if (!cacheDirectory.exists() && !cacheDirectory.mkdirs()) return null; int tileCacheFiles = 2000; //estimateSizeOfFileSystemCache(cacheDirectoryName, firstLevelSize, tileSize); if (! cacheDirectory.canWrite() || tileCacheFiles == 0) return null; try { fileSystemTileCache = new FileSystemTileCache(tileCacheFiles, cacheDirectory, AndroidGraphicFactory.INSTANCE, false); return fileSystemTileCache; } catch (IllegalArgumentException e) { e.printStackTrace(); } return null; }
Example 4
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(); }