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


Java Config类代码示例

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


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

示例1: osmToNetwork

import org.matsim.core.config.Config; //导入依赖的package包/类
/**
 * 2. A MATSim network of the area is required. If no such network is already available,
 * the PT2MATSim package provides the possibility to use OSM-maps as data-input.
 *
 * Here as an example, the OSM-extract of the city centre of Waterloo, Canada, is converted.
 */
public static void osmToNetwork() {
	// Create a default osmToNetwork-Config:
	CreateDefaultOsmConfig.main(new String[]{output + "OsmConverterConfigDefault.xml"});

	// Open the osmToNetwork Config and set the parameters to the required values
	// (usually done manually by opening the config with a simple editor)
	Config osmConverterConfig = ConfigUtils.loadConfig(
			output + "OsmConverterConfigDefault.xml",
			new OsmConverterConfigGroup());
	OsmConverterConfigGroup osmConfig = ConfigUtils.addOrGetModule(osmConverterConfig, OsmConverterConfigGroup.class);
	osmConfig.setOsmFile(example + "osm/addison.osm");
	osmConfig.setOutputCoordinateSystem(addisonCountyEPSG);
	osmConfig.setOutputNetworkFile(example + "network/addison.xml.gz");

	// Save the osmToNetwork config (usually done manually)
	new ConfigWriter(osmConverterConfig).write(output + "OsmConverterConfig.xml");

	// Convert the OSM file to a MATSim network using the config
	Osm2MultimodalNetwork.main(new String[]{output + "OsmConverterConfig.xml"});
}
 
开发者ID:matsim-org,项目名称:pt2matsim,代码行数:27,代码来源:PT2MATSimExample.java

示例2: mapScheduleToNetwork

import org.matsim.core.config.Config; //导入依赖的package包/类
/**
 * 	3. The core of the PT2MATSim-package is the mapping process of the schedule to the network.
 *
 * 	Here as an example, the unmapped schedule of GrandRiverTransit (previously converted from GTFS) is mapped
 * 	to the converted OSM network of the Waterloo Area, Canada.
 */
public static void mapScheduleToNetwork() {
	// Create a mapping config:
	CreateDefaultPTMapperConfig.main(new String[]{output + "MapperConfig.xml"});
	// Open the mapping config and set the parameters to the required values
	// (usually done manually by opening the config with a simple editor)
	Config config = ConfigUtils.loadConfig(
			output + "MapperConfig.xml",
			PublicTransitMappingConfigGroup.createDefaultConfig());
	PublicTransitMappingConfigGroup ptmConfig = ConfigUtils.addOrGetModule(config, PublicTransitMappingConfigGroup.class);

	ptmConfig.setInputNetworkFile(example + "network/addison.xml.gz");
	ptmConfig.setOutputNetworkFile(output + "addison_multimodalnetwork.xml.gz");
	ptmConfig.setOutputScheduleFile(output + "addison_schedule.xml.gz");
	ptmConfig.setOutputStreetNetworkFile(output + "addison_streetnetwork.xml.gz");
	ptmConfig.setInputScheduleFile(outputUnmapped + "schedule_unmapped.xml.gz");
	ptmConfig.setScheduleFreespeedModes(CollectionUtils.stringToSet("rail, light_rail"));
	// Save the mapping config
	// (usually done manually)
	new ConfigWriter(config).write(output + "MapperConfigAdjusted.xml");

	// Map the schedule to the network using the config
	PublicTransitMapper.main(new String[]{output + "MapperConfigAdjusted.xml"});
}
 
开发者ID:matsim-org,项目名称:pt2matsim,代码行数:30,代码来源:PT2MATSimExample.java

示例3: run

import org.matsim.core.config.Config; //导入依赖的package包/类
/**
 * Routes the unmapped MATSim Transit Schedule to the network using the file
 * paths specified in the config. Writes the resulting schedule and network to xml files.<p/>
 *
 * @see CreateDefaultPTMapperConfig
 *
 * @param configFile the PublicTransitMapping config file
 */
public static void run(String configFile) {
	// Load config, input schedule and input network
	Config configAll = ConfigUtils.loadConfig(configFile, new PublicTransitMappingConfigGroup());
	PublicTransitMappingConfigGroup config = ConfigUtils.addOrGetModule(configAll, PublicTransitMappingConfigGroup.class);
	TransitSchedule schedule = config.getInputScheduleFile() == null ? null : ScheduleTools.readTransitSchedule(config.getInputScheduleFile());
	Network network = config.getInputNetworkFile() == null ? null : NetworkTools.readNetwork(config.getInputNetworkFile());

	// Run PTMapper
	PTMapper.mapScheduleToNetwork(schedule, network, config);
	// or: new PTMapper(schedule, network).run(config);

	// Write the schedule and network to output files (if defined in config)
	if(config.getOutputNetworkFile() != null && config.getOutputScheduleFile() != null) {
		log.info("Writing schedule and network to file...");
		try {
			ScheduleTools.writeTransitSchedule(schedule, config.getOutputScheduleFile());
			NetworkTools.writeNetwork(network, config.getOutputNetworkFile());
		} catch (Exception e) {
			log.error("Cannot write to output directory!");
		}
		if(config.getOutputStreetNetworkFile() != null) {
			NetworkTools.writeNetwork(NetworkTools.createFilteredNetworkByLinkMode(network, Collections.singleton(TransportMode.car)), config.getOutputStreetNetworkFile());
		}
	} else {
		log.info("No output paths defined, schedule and network are not written to files.");
	}
}
 
开发者ID:matsim-org,项目名称:pt2matsim,代码行数:36,代码来源:PublicTransitMapper.java

示例4: main

import org.matsim.core.config.Config; //导入依赖的package包/类
/**
 * Creates a default publicTransitMapping config file.
 * @param args [0] default config filename
 */
public static void main(final String[] args) {
	Config config = ConfigUtils.createConfig();

	config.addModule(PublicTransitMappingConfigGroup.createDefaultConfig());

	Set<String> toRemove = config.getModules().keySet().stream().filter(module -> !module.equals(PublicTransitMappingConfigGroup.GROUP_NAME)).collect(Collectors.toSet());
	toRemove.forEach(config::removeModule);

	new ConfigWriter(config).write(args[0]);
}
 
开发者ID:matsim-org,项目名称:pt2matsim,代码行数:15,代码来源:CreateDefaultPTMapperConfig.java

示例5: main

import org.matsim.core.config.Config; //导入依赖的package包/类
/**
 * Creates a default publicTransitMapping config file.
 * @param args [0] default config filename
 */
public static void main(final String[] args) {
	Config config = ConfigUtils.createConfig();

	config.addModule(OsmConverterConfigGroup.createDefaultConfig());

	Set<String> toRemove = config.getModules().keySet().stream().filter(module -> !module.equals(OsmConverterConfigGroup.GROUP_NAME)).collect(Collectors.toSet());
	toRemove.forEach(config::removeModule);

	new ConfigWriter(config).write(args[0]);
}
 
开发者ID:matsim-org,项目名称:pt2matsim,代码行数:15,代码来源:CreateDefaultOsmConfig.java

示例6: run

import org.matsim.core.config.Config; //导入依赖的package包/类
/**
 * Converts an osm file to a MATSim network. The input and output file as well
 * as conversion parameters are defined in the config file. Run {@link CreateDefaultOsmConfig}
 * to create a default config.
 *
 * @param configFile the config.xml file
 */
public static void run(String configFile) {
	Config configAll = ConfigUtils.loadConfig(configFile, new OsmConverterConfigGroup());
	OsmConverterConfigGroup config = ConfigUtils.addOrGetModule(configAll, OsmConverterConfigGroup.GROUP_NAME, OsmConverterConfigGroup.class );

	run(config);
}
 
开发者ID:matsim-org,项目名称:pt2matsim,代码行数:14,代码来源:Osm2MultimodalNetwork.java


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