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


Java CityGMLBuilder类代码示例

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


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

示例1: readCityGMLFile

import org.citygml4j.builder.CityGMLBuilder; //导入依赖的package包/类
/**
 * Returns a list for BuildingCallable read by CityGML file
 * 
 * @param pathtocitygmlfile
 * @param options
 * @return List<BuildingCallable>
 * @throws Exception
 */
public List<BuildingCallable> readCityGMLFile(String pathtocitygmlfile, Options options) throws Exception {

	this.options = options;
	
	List<BuildingCallable> buildings = new ArrayList<BuildingCallable>();
	
	CityGMLContext ctx = new CityGMLContext();
	CityGMLBuilder builder = ctx.createCityGMLBuilder();
	CityGMLInputFactory in = builder.createCityGMLInputFactory();
	CityGMLReader reader = in.createCityGMLReader(new File(pathtocitygmlfile));
	
	while (reader.hasNext()) {
		CityGML citygml = reader.nextFeature();
		
		if (citygml.getCityGMLClass() == CityGMLClass.CITY_MODEL) {
			CityModel cityModel = (CityModel)citygml;
			
			for (CityObjectMember cityObjectMember : cityModel.getCityObjectMember()) {
				AbstractCityObject cityObject = cityObjectMember.getCityObject();
				if (cityObject.getCityGMLClass() == CityGMLClass.BUILDING){
					
					Building building = (Building)cityObject;
					String buildingID = building.getId();
					BuildingCallable buildingcallable = new BuildingCallable();
					buildingcallable.setBsp(building.getBoundedBySurface());
					buildingcallable.setBuildingId(buildingID);
					buildingcallable.setOptions(options);
					buildings.add(buildingcallable);
				}	
			}
		}	
	}			
	
	reader.close();
	return buildings;
}
 
开发者ID:SteuerHorst,项目名称:Voluminator,代码行数:45,代码来源:BuildingReader.java

示例2: getCityGMLBuilder

import org.citygml4j.builder.CityGMLBuilder; //导入依赖的package包/类
public CityGMLBuilder getCityGMLBuilder() {
	return cityGMLBuilder;
}
 
开发者ID:3dcitydb,项目名称:importer-exporter-oracle,代码行数:4,代码来源:ObjectRegistry.java

示例3: setCityGMLBuilder

import org.citygml4j.builder.CityGMLBuilder; //导入依赖的package包/类
public void setCityGMLBuilder(CityGMLBuilder cityGMLBuilder) {
	if (this.cityGMLBuilder != null)
		throw new IllegalArgumentException("CityGML Builder is already registered with the object registry.");
	
	this.cityGMLBuilder = cityGMLBuilder;
}
 
开发者ID:3dcitydb,项目名称:importer-exporter-oracle,代码行数:7,代码来源:ObjectRegistry.java

示例4: setCityGMLBuilder

import org.citygml4j.builder.CityGMLBuilder; //导入依赖的package包/类
public void setCityGMLBuilder(CityGMLBuilder cityGMLBuilder) {
	if (this.cityGMLBuilder != null)
		throw new IllegalArgumentException("CityGML Builder is already registered with the object registry.");
		
	this.cityGMLBuilder = cityGMLBuilder;
}
 
开发者ID:3dcitydb,项目名称:importer-exporter-postgis,代码行数:7,代码来源:ObjectRegistry.java

示例5: convert

import org.citygml4j.builder.CityGMLBuilder; //导入依赖的package包/类
/**
 * Converts all files of bliste from CityGML defined in inputfile to an OBJ-file in outputFolder.
 * @param inputfile
 * @param outputFolder
 * @param bliste
 * @throws Exception
 */
public static void convert(String inputfile, String outputFolder, String[] bliste ) throws Exception
{
	
	
	SimpleDateFormat df = new SimpleDateFormat("[HH:mm:ss] ");
	System.out.println(df.format(new Date()) + "setting up citygml4j context and JAXB builder");
	CityGMLContext ctx = new CityGMLContext();
	CityGMLBuilder builder = ctx.createCityGMLBuilder();
	System.out.println(df.format(new Date()) + "reading CityGML file " + inputfile + " completely into main memory");
	CityGMLInputFactory in = builder.createCityGMLInputFactory();
	CityGMLReader reader = in.createCityGMLReader(new File(inputfile));
	
	while (reader.hasNext()) {
		CityGML citygml = reader.nextFeature();
		
		System.out.println("Found " + citygml.getCityGMLClass() + 
				" version " + citygml.getCityGMLModule().getVersion());
		
		if (citygml.getCityGMLClass() == CityGMLClass.CITY_MODEL) {
			CityModel cityModel = (CityModel)citygml;

			System.out.println(df.format(new Date()) + "going through city model and counting building instances");
			
			for (CityObjectMember cityObjectMember : cityModel.getCityObjectMember()) {
				AbstractCityObject cityObject = cityObjectMember.getCityObject();
				if (cityObject.getCityGMLClass() == CityGMLClass.BUILDING)
				{
					
					Building building = (Building)cityObject;
					
					String buildingID = building.getId();

					if(bliste != null && isInList(bliste,buildingID ))
					{

							List<BoundarySurfaceProperty> bsp = building
									.getBoundedBySurface();

						PolygonConstructor pc = new PolygonConstructor();
				
						Polygon temp = new Polygon();
						
						
						String filename = outputFolder+ "/" + buildingID + ".obj";
						temp.saveObj(filename, pc.constructPolygons(bsp));
							
						
						}
				}
					}
						
				}
					
			}
	reader.close();
	System.out.println(df.format(new Date()) + "CityGMLToOBJ successfully finished");
}
 
开发者ID:SteuerHorst,项目名称:Voluminator,代码行数:65,代码来源:CityGMLToOBJ.java


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