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


Java GraphHopper.hasElevation方法代码示例

本文整理汇总了Java中com.graphhopper.GraphHopper.hasElevation方法的典型用法代码示例。如果您正苦于以下问题:Java GraphHopper.hasElevation方法的具体用法?Java GraphHopper.hasElevation怎么用?Java GraphHopper.hasElevation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.graphhopper.GraphHopper的用法示例。


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

示例1: init

import com.graphhopper.GraphHopper; //导入方法依赖的package包/类
public GraphExtension init(GraphHopper graphhopper) throws Exception {
	if (_storage != null)
		throw new Exception("GraphStorageBuilder has been already initialized.");
	
	_arrayBuffer = new ByteArrayBuffer();
	if (graphhopper.hasElevation())
	{
		_storage = new HillIndexGraphStorage(_parameters);
		_hillIndexCalc = new HillIndexCalculator();
		
		return _storage;
	}
	else 
		return null;
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:16,代码来源:HillIndexGraphStorageBuilder.java

示例2: createStorage

import com.graphhopper.GraphHopper; //导入方法依赖的package包/类
@Override
public GraphHopperStorage createStorage(GHDirectory dir, GraphHopper gh) {
	EncodingManager encodingManager = gh.getEncodingManager();
	GraphExtension geTurnCosts = null;
	ArrayList<GraphExtension> graphExtensions = new ArrayList<GraphExtension>();
	
	if (encodingManager.needsTurnCostsSupport())
	{
		Path path = Paths.get(dir.getLocation(), "turn_costs");
		File fileEdges  = Paths.get(dir.getLocation(), "edges").toFile();
		File fileTurnCosts = path.toFile();
		
		// First we need to check if turncosts are available. This check is required when we introduce a new feature, but an existing graph does not have it yet.
		if ((!hasGraph(gh) && !fileEdges.exists()) || (fileEdges.exists() && fileTurnCosts.exists()))
			geTurnCosts =  new TurnCostExtension();
	}

	if (_graphStorageBuilders != null && _graphStorageBuilders.size() > 0)
	{
		for(GraphStorageBuilder builder : _graphStorageBuilders)
		{
			try
			{
				GraphExtension ext = builder.init(gh);
				if (ext != null)
					graphExtensions.add(ext);
			}
			catch(Exception ex)
			{
				LOGGER.error(ex);
			}
		}
	}

	GraphExtension graphExtension = null;
	
	if (geTurnCosts == null && graphExtensions.size() == 0)
		graphExtension =  new GraphExtension.NoOpExtension();
	else if (geTurnCosts != null && graphExtensions.size() > 0)
	{
		ArrayList<GraphExtension> seq = new ArrayList<GraphExtension>();
		seq.add(geTurnCosts);
		seq.addAll(graphExtensions);
		
		graphExtension = getExtension(seq);
	} 
	else if (geTurnCosts != null)
	{
		graphExtension = geTurnCosts;
	}
	else if (graphExtensions.size() > 0)
	{
		graphExtension = getExtension(graphExtensions);
	}
	
    if (gh.getLMFactoryDecorator().isEnabled())
         	gh.initLMAlgoFactoryDecorator();

    if (gh.getCHFactoryDecorator().isEnabled()) 
           gh.initCHAlgoFactoryDecorator();
     
	if (gh.isCHEnabled())
           return new GraphHopperStorage(gh.getCHFactoryDecorator().getWeightings(), dir, encodingManager, gh.hasElevation(), graphExtension);
	else
		return new GraphHopperStorage(dir, encodingManager, gh.hasElevation(), graphExtension);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:67,代码来源:ORSGraphStorageFactory.java


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