• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ExternalRenderTheme类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadExternalRenderTheme

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的package包/类
protected void loadExternalRenderTheme(File xmlRenderThemeFile) throws FileNotFoundException {

		XmlRenderThemeMenuCallback callBack = new XmlRenderThemeMenuCallback() {

			@Override
			public Set<String> getCategories(XmlRenderThemeStyleMenu styleMenu) {
				renderThemeStyleMenu = styleMenu;
				String id = styleMenu.getDefaultValue();
				XmlRenderThemeStyleLayer baseLayer = styleMenu.getLayer(id);
				Set<String> result = baseLayer.getCategories();

				for (XmlRenderThemeStyleLayer overlay : baseLayer.getOverlays()) {
					LOG.trace("Overlay " + overlay.getId() + " enabled: " + overlay.isEnabled());
					if (overlay.isEnabled()) {
						result.addAll(overlay.getCategories());
					}
				}

				return result;
			}

		};
		this.xmlRenderTheme = new ExternalRenderTheme(xmlRenderThemeFile, callBack);
	}
 
开发者ID:bh4017,项目名称:mobac,代码行数:25,代码来源:MapsforgeMapSource.java


示例2: validRenderThemeTest

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的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: onStart

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的package包/类
@Override public void onStart() {
	super.onStart();
	if (DEBUG) { Log.d(TAG, "Map.onStart"); }
	// warp to 'unter den linden'
	mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
	mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
	MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
	tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
		false, true, AndroidGraphicFactory.INSTANCE);
	tileLayer.setTextScale(1.5f);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
	multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
	try {
		tileLayer.setXmlRenderTheme(new ExternalRenderTheme(new File(THEMEFILE))); // set a different render theme
	}
	catch (FileNotFoundException ignore) {
		tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER); // fallback if not founr
	}
	mapView.getLayerManager().getLayers().add(tileLayer);
	mapView.getLayerManager().getLayers().add( // add a grid around each tile
		new TileGridLayer(AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel));
	mapView.getLayerManager().getLayers().add( // add text to show x/y/z of each tile
		new TileCoordinatesLayer(AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel));
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:26,代码来源:Map.java


示例4: getRenderThemeFuture

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的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


示例5: initialize

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的package包/类
public static boolean initialize(String locationOfMapFile,String renderThemeAddr, Context _context) {
		Log.i(TAG, "Initilizing started");
		mapFilePath = locationOfMapFile;
		androidGraphicFactory = AndroidGraphicFactory.INSTANCE;
		
		mapFile = new File(mapFilePath);
		
		displayModel = new DisplayModel();

		
		mapViewPosition = new MapViewPosition(displayModel);
		
		mapDataStore = new MapFile(mapFile);

		displayModel.setFixedTileSize(256);
		
		TileCache tileCache = AndroidUtil.createTileCache(context, "111", 256, 1.0f, 1d);
//		TileCache tileCache = null;

		databaseRenderer = new DatabaseRenderer(mapDataStore, androidGraphicFactory, tileCache);
		context = _context;
		
		try {
			xmlRenderTheme = new ExternalRenderTheme(new File(renderThemeAddr	));
			Log.i(TAG, "xmlRenderTheme initialized successfully");
		}
		catch(Throwable e)
		{
			Log.i(TAG, "xmlRenderTheme error initializing ");
			e.printStackTrace();
		}

		renderThemeFuture = new RenderThemeFuture(AndroidGraphicFactory.INSTANCE, xmlRenderTheme, displayModel);
		new Thread(renderThemeFuture).run();

		Log.i(TAG, "Mapsforge Initializing Ended");
		
		return true;
	}
 
开发者ID:Arman92,项目名称:Mapsforge-OsmDroid-GraphHopper,代码行数:40,代码来源:MFTileSource.java


示例6: initialize

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的package包/类
@Override
public void initialize() throws MapSourceInitializationException {
	xmlRenderThemeFileName = xmlRenderThemeFileName.trim();

	// The custom map xml file used for loading this map
	MapSourceLoaderInfo loaderInfo = getLoaderInfo();
	File mapSourceXmlDir = null;
	if (loaderInfo != null) {
		File mapSourceXmlFile = this.getLoaderInfo().getSourceFile();
		mapSourceXmlDir = mapSourceXmlFile.getParentFile();
	}

	this.mapFile = Utilities.findFile(mapFileName, mapSourceXmlDir, DirectoryManager.currentDir,
			DirectoryManager.mapSourcesDir, DirectoryManager.userAppDataDir);
	if (mapFile == null) {
		JOptionPane.showMessageDialog(null, "Unable to find map file \"" + mapFileName + "\"",
				I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
		return;
	}

	if (xmlRenderThemeFileName.length() > 0) {
		File renderFile = Utilities.findFile(xmlRenderThemeFileName, mapSourceXmlDir, DirectoryManager.currentDir,
				DirectoryManager.mapSourcesDir, DirectoryManager.userAppDataDir);
		if (renderFile == null) {
			JOptionPane.showMessageDialog(null, "Unable to find xmlRenderTheme file \"" + xmlRenderThemeFileName
					+ "\"", I18nUtils.localizedStringForKey("Error"), JOptionPane.ERROR_MESSAGE);
			return;
		}

		try {
			this.xmlRenderTheme = new ExternalRenderTheme(renderFile);
		} catch (FileNotFoundException e) {
			log.error("", e);
			return;
		}
	}
	super.initialize();
}
 
开发者ID:bh4017,项目名称:mobac,代码行数:39,代码来源:CustomMapsforge.java


示例7: verifyInvalid

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的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


示例8: getRenderTheme

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的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


示例9: setRenderTheme

import org.mapsforge.map.rendertheme.ExternalRenderTheme; //导入依赖的package包/类
/**
 * Sets the XML file which is used for rendering the map.
 * 
 * @param renderThemeFile
 *            the XML file which defines the rendering theme.
 * @throws IllegalArgumentException
 *             if the supplied internalRenderTheme is null.
 * @throws FileNotFoundException
 *             if the supplied file does not exist, is a directory or cannot be read.
 */
public void setRenderTheme(File renderThemeFile) throws FileNotFoundException {
	if (renderThemeFile == null) {
		throw new IllegalArgumentException("render theme file must not be null");
	}

	org.mapsforge.map.rendertheme.XmlRenderTheme jobTheme = new ExternalRenderTheme(renderThemeFile);
	this.jobParameters = new JobParameters(jobTheme, this.jobParameters.textScale);
	clearAndRedrawMapView();
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:20,代码来源:MapView.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContentApplication类代码示例发布时间:2022-05-22
下一篇:
Java RefreshAdminAclsResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap