本文整理汇总了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;
}
示例2: getCityGMLBuilder
import org.citygml4j.builder.CityGMLBuilder; //导入依赖的package包/类
public CityGMLBuilder getCityGMLBuilder() {
return cityGMLBuilder;
}
示例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;
}
示例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;
}
示例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");
}