当前位置: 首页>>代码示例>>Java>>正文


Java XmlRenderTheme类代码示例

本文整理汇总了Java中org.mapsforge.map.rendertheme.XmlRenderTheme的典型用法代码示例。如果您正苦于以下问题:Java XmlRenderTheme类的具体用法?Java XmlRenderTheme怎么用?Java XmlRenderTheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XmlRenderTheme类属于org.mapsforge.map.rendertheme包,在下文中一共展示了XmlRenderTheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MapsforgeTileSource

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
/**
     * The reason this constructor is protected is because all parameters,
     * except file should be determined from the archive file. Therefore a
     * factory method is necessary.
     *
     * @param file
     * @param xmlRenderTheme the themeFuture to render tiles with
     */
    protected MapsforgeTileSource(Application app,
                                  File file,
                                  XmlRenderTheme xmlRenderTheme,
                                  MultiMapDataStore.DataPolicy dataPolicy) {

        AndroidGraphicFactory.createInstance(app);

//        model.setFixedTileSize(256);

        mapDatabase = new MultiMapDataStore(dataPolicy);
        mapDatabase.addMapDataStore(new MapFile(file), false, false);

        InMemoryTileCache tileCache = new InMemoryTileCache(5);
        renderer = new DatabaseRenderer(mapDatabase, factory, tileCache,
                new TileBasedLabelStore(tileCache.getCapacityFirstLevel()), true, true, null);

        Log.d(TAG, "min=" + MIN_ZOOM + " max=" + MAX_ZOOM + " tilesize=" + TILE_SIZE_PIXELS);

        themeFuture = new RenderThemeFuture(factory, xmlRenderTheme, model);
        //super important!! without the following line, all rendering activities will block until the themeFuture is created.
        new Thread(themeFuture).start();

    }
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:32,代码来源:MapsforgeTileSource.java

示例2: validRenderThemeTest

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
@Test
public void validRenderThemeTest() throws SAXException, ParserConfigurationException, IOException {
	XmlRenderTheme xmlRenderTheme = new ExternalRenderTheme(new File(RENDER_THEME_PATH));
	RenderTheme renderTheme = RenderThemeHandler.getRenderTheme(new DummyGraphicAdapter(), xmlRenderTheme);

	Assert.assertEquals(3, renderTheme.getLevels());

	renderTheme.scaleStrokeWidth(12.34f);
	renderTheme.scaleTextSize(56.78f);

	RenderCallback renderCallback = new DummyRenderCallback();

	List<Tag> closedWayTags = Arrays.asList(new Tag("amenity", "parking"));
	List<Tag> linearWayTags = Arrays.asList(new Tag("highway", "primary"), new Tag("oneway", "yes"));
	List<Tag> nodeTags = Arrays.asList(new Tag("place", "city"), new Tag("highway", "turning_circle"));

	for (byte zoomLevel = 0; zoomLevel < 25; ++zoomLevel) {
		renderTheme.matchClosedWay(renderCallback, closedWayTags, zoomLevel);
		renderTheme.matchLinearWay(renderCallback, linearWayTags, zoomLevel);
		renderTheme.matchNode(renderCallback, nodeTags, zoomLevel);
	}

	renderTheme.destroy();
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:25,代码来源:RenderThemeTest.java

示例3: changeRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
void changeRenderTheme() {
	File[] renderThemes = new File("/storage/sdcard1").listFiles(renderThemesFilter);
	if (renderThemes.length > 0) {
		File nextTheme = renderThemes[iteration % renderThemes.length];
		iteration += 1;
		try {
			XmlRenderTheme nextRenderTheme = new ExternalRenderThemeUsingJarResources(nextTheme);
			Log.i(SamplesApplication.TAG, "Loading new render theme " + nextTheme.getName());
			// there should really be a simpler way to just change the
			// render theme safely
			mapView.getLayerManager().getLayers().remove(tileRendererLayer);
			tileRendererLayer.onDestroy();
			tileCaches.get(0).destroy();
			tileRendererLayer = AndroidUtil.createTileRendererLayer(tileCaches.get(0),
					mapView.getModel().mapViewPosition, getMapFile(), nextRenderTheme,
					false, false);
			mapView.getLayerManager().getLayers().add(tileRendererLayer);
			mapView.getLayerManager().redrawLayers();
		} catch (FileNotFoundException e) {
			Log.i(SamplesApplication.TAG, "Could not open file " + nextTheme.getName());
		}
	}
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:24,代码来源:RenderThemeChanger.java

示例4: createLayers

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
@Override
protected void createLayers() {
	super.createLayers();
	try {

		XmlRenderTheme secondRenderTheme = new AssetsRenderTheme(this, "",
				"renderthemes/onlybuildings.xml", null);

		this.mapView.getLayerManager()
				.getLayers()
				.add(AndroidUtil.createTileRendererLayer(this.tileCaches.get(1),
						this.mapView.getModel().mapViewPosition, getMapFile(),
						secondRenderTheme, true, false));

	} catch (IOException e) {
		Log.e(SamplesApplication.TAG, "Rendertheme not found");
	}

}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:20,代码来源:StackedLayersMapViewer.java

示例5: getRenderThemeFuture

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
private synchronized RenderThemeFuture getRenderThemeFuture(String themeName) throws FileNotFoundException {
		if (RENDER_THEME_FUTURE_TABLE.containsKey(themeName)) {
			return RENDER_THEME_FUTURE_TABLE.get(themeName);
		} else {
			String themePath = String.format("res/themes/%s/theme.xml", themeName);
			XmlRenderTheme theme = new ExternalRenderTheme(themePath);
			RenderThemeFuture rtf = new RenderThemeFuture(GRAPHIC_FACTORY, theme, DISPLAY_MODEL);
			RENDER_THEME_FUTURE_TABLE.put(themeName, rtf);
			new Thread(rtf).start();
			return rtf;
		}
}
 
开发者ID:virus-warnning,项目名称:mapsforge-web,代码行数:13,代码来源:HttpServerHandler.java

示例6: getRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
/**
 * Reads custom render theme from assets
 * @return render theme
 */
protected XmlRenderTheme getRenderTheme() {
	try {
		return new AssetsRenderTheme(this.getActivity(), "", "renderthemes/rendertheme-v4.xml");
	} catch (final IOException e) {
		Log.e(TAG, "Render theme failure " + e.toString());
	}
	return null;
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:13,代码来源:WifiDetailsMap.java

示例7: createTileRendererLayer

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
/**
 * Creates a tile layer, which optionally supports long press actions and custom render themes
 * @param tileCache
 * @param mapViewPosition
 * @param mapFile
 * @param renderTheme
 * @return
 */
public static Layer createTileRendererLayer(final TileCache tileCache, final MapViewPosition mapViewPosition,
		final MapFile mapFile, final XmlRenderTheme renderTheme, final onLongPressHandler handler) {

	if (mapFile == null) {
		return null;
	}

	final TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile, mapViewPosition, AndroidGraphicFactory.INSTANCE) {
		@Override
		public boolean onLongPress(LatLong tapLatLong, Point thisXY, Point tapXY) {
               if (handler != null) {
                   ((onLongPressHandler)handler).onLongPress(tapLatLong, thisXY, tapXY);
                   return true;
               } else {
                   return false;
               }
		}
	};

       if (renderTheme == null) {
           Log.i(TAG, "Using default render theme");
           tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
       } else {
           Log.i(TAG, "Using custom theme");
           tileRendererLayer.setXmlRenderTheme(renderTheme);
       }

       tileRendererLayer.setTextScale(1.5f);
       return tileRendererLayer;
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:39,代码来源:MapUtils.java

示例8: getRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
/**
 * Reads custom render theme from assets
 *
 * @return render theme
 */
public static XmlRenderTheme getRenderTheme(final Context ctx) {
	try {
		return new AssetsRenderTheme(ctx, "", Preferences.RENDER_THEME);
	} catch (final IOException e) {
		Log.e(TAG, "Render theme failure " + e.toString());
	}
	return null;
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:14,代码来源:MapUtils.java

示例9: getRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
public static RenderTheme getRenderTheme(GraphicAdapter graphicAdapter, XmlRenderTheme xmlRenderTheme)
		throws SAXException, ParserConfigurationException, IOException {
	RenderThemeHandler renderThemeHandler = new RenderThemeHandler(graphicAdapter,
			xmlRenderTheme.getRelativePathPrefix());
	XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
	xmlReader.setContentHandler(renderThemeHandler);
	InputStream inputStream = null;
	try {
		inputStream = xmlRenderTheme.getRenderThemeAsStream();
		xmlReader.parse(new InputSource(inputStream));
		return renderThemeHandler.renderTheme;
	} finally {
		IOUtils.closeQuietly(inputStream);
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:16,代码来源:RenderThemeHandler.java

示例10: verifyInvalid

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
private static void verifyInvalid(String pathname) throws ParserConfigurationException, IOException {
	XmlRenderTheme xmlRenderTheme = new ExternalRenderTheme(new File(pathname));

	try {
		RenderThemeHandler.getRenderTheme(new DummyGraphicAdapter(), xmlRenderTheme);
		Assert.fail();
	} catch (SAXException e) {
		Assert.assertTrue(true);
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:11,代码来源:RenderThemeTest.java

示例11: getRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
private XmlRenderTheme getRenderTheme() {
    try {
        return InternalRenderTheme.DEFAULT;
    } catch (Exception e) {
        Analytics.sendException(getContext(), e, false);
    }

    return InternalRenderTheme.OSMARENDER;
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:10,代码来源:MapFragment.java

示例12: createTileRendererLayer

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
private TileRendererLayer createTileRendererLayer(TileCache tileCache,
                                                  MapViewPosition mapViewPosition, File mapFile,
                                                  XmlRenderTheme renderTheme) {
    MapDataStore mapDataStore = new MapFile(mapFile);

    TileRendererLayer tileRendererLayer = AndroidUtil.createTileRendererLayer(tileCache,
            mapViewPosition, mapDataStore, renderTheme, false, false, true);
    tileRendererLayer.setTextScale(1.5f);

    return tileRendererLayer;
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:12,代码来源:MapFragment.java

示例13: getRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
@Override
protected XmlRenderTheme getRenderTheme() {
	try {
		return new AssetsRenderTheme(this, getRenderThemePrefix(), getRenderThemeFile(), this);
	} catch (IOException e) {
		Log.e(SamplesApplication.TAG, "Render theme failure " + e.toString());
	}
	return null;
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:10,代码来源:RenderTheme4.java

示例14: getRenderTheme

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
private static XmlRenderTheme getRenderTheme(String xmlRenderThemeFilename){
	if(Strings.isEmpty(xmlRenderThemeFilename)==false){
		File renderThemeFile = RelativeFiles.validateRelativeFiles(xmlRenderThemeFilename, AppConstants.ODL_CONFIG_DIR);
		if (renderThemeFile != null) {
			try {
				return new ExternalRenderTheme(renderThemeFile.getAbsoluteFile());					
			} catch (Exception e) {
				// just return the default theme
			}
		}			
	}		
	return InternalRenderTheme.OSMARENDER;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:14,代码来源:MapsforgeTileFactory.java

示例15: createTileRendererLayer

import org.mapsforge.map.rendertheme.XmlRenderTheme; //导入依赖的package包/类
static TileRendererLayer createTileRendererLayer(TileCache tileCache,
		MapViewPosition mapViewPosition, File mapFile,
		XmlRenderTheme renderTheme, boolean hasAlpha) {
	TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache,
			mapViewPosition, hasAlpha, AndroidGraphicFactory.INSTANCE);
	tileRendererLayer.setMapFile(mapFile);
	tileRendererLayer.setXmlRenderTheme(renderTheme);
	tileRendererLayer.setTextScale(1.5f);
	return tileRendererLayer;
}
 
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:11,代码来源:Utils.java


注:本文中的org.mapsforge.map.rendertheme.XmlRenderTheme类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。