本文整理汇总了Java中org.citygml4j.model.citygml.core.CityModel.getCityObjectMember方法的典型用法代码示例。如果您正苦于以下问题:Java CityModel.getCityObjectMember方法的具体用法?Java CityModel.getCityObjectMember怎么用?Java CityModel.getCityObjectMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.citygml4j.model.citygml.core.CityModel
的用法示例。
在下文中一共展示了CityModel.getCityObjectMember方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readCityGMLFile
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的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: apply
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的package包/类
public T apply(CityModel cityModel) {
T object = apply((AbstractFeatureCollection)cityModel);
if (object != null)
return object;
if (cityModel.isSetCityObjectMember()) {
for (CityObjectMember cityObjectMember : new ArrayList<CityObjectMember>(cityModel.getCityObjectMember())) {
object = apply(cityObjectMember);
if (object != null)
return object;
}
}
if (cityModel.isSetAppearanceMember()) {
for (AppearanceMember appearanceMember : new ArrayList<AppearanceMember>(cityModel.getAppearanceMember())) {
object = apply(appearanceMember);
if (object != null)
return object;
}
}
if (cityModel.isSetGenericApplicationPropertyOfCityModel()) {
for (ADEComponent ade : new ArrayList<ADEComponent>(cityModel.getGenericApplicationPropertyOfCityModel())) {
object = apply(ade);
if (object != null)
return object;
}
}
return null;
}
示例3: marshalCityModel
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的package包/类
public List<AbstractCityObjectType> marshalCityModel(CityModel src) {
List<AbstractCityObjectType> dest = new ArrayList<>();
if (src.isSetCityObjectMember()) {
for (CityObjectMember property : src.getCityObjectMember()) {
if (property.isSetCityObject())
dest.addAll(citygml.marshal(property.getCityObject()));
}
}
return dest;
}
示例4: main
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
SimpleDateFormat df = new SimpleDateFormat("[HH:mm:ss] ");
System.out.println(df.format(new Date()) + "setting up citygml4j context and CityGML builder");
CityGMLContext ctx = CityGMLContext.getInstance();
CityGMLBuilder builder = ctx.createCityGMLBuilder();
System.out.println(df.format(new Date()) + "reading CityGML file LOD2_Buildings_v100.gml completely into main memory");
CityGMLInputFactory in = builder.createCityGMLInputFactory();
CityGMLReader reader = in.createCityGMLReader(new File("datasets/LOD2_Buildings_v100.gml"));
while (reader.hasNext()) {
CityGML citygml = reader.nextFeature();
if (citygml.getCityGMLClass() == CityGMLClass.CITY_MODEL) {
CityModel cityModel = (CityModel)citygml;
System.out.println(df.format(new Date()) + "Found " + citygml.getCityGMLClass() + " version " + cityModel.getCityGMLModule().getVersion());
System.out.println(df.format(new Date()) + "going through city model and counting building instances");
int count = 0;
for (CityObjectMember cityObjectMember : cityModel.getCityObjectMember()) {
AbstractCityObject cityObject = cityObjectMember.getCityObject();
if (cityObject.getCityGMLClass() == CityGMLClass.BUILDING)
count++;
}
System.out.println(df.format(new Date()) + "The city model contains " + count + " building features");
}
}
reader.close();
System.out.println(df.format(new Date()) + "sample citygml4j application successfully finished");
}
示例5: main
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
SimpleDateFormat df = new SimpleDateFormat("[HH:mm:ss] ");
System.out.println(df.format(new Date()) + "setting up citygml4j context and CityGML builder");
CityGMLContext ctx = CityGMLContext.getInstance();
CityGMLBuilder builder = ctx.createCityGMLBuilder();
System.out.println(df.format(new Date()) + "reading CityGML file LOD2_CityObjectGroup_v100.gml");
CityGMLInputFactory in = builder.createCityGMLInputFactory();
CityGMLReader reader = in.createCityGMLReader(new File("datasets/LOD2_CityObjectGroup_v100.gml"));
CityModel cityModel = (CityModel)reader.nextFeature();
reader.close();
System.out.println(df.format(new Date()) + "creating XLinkResolver");
XLinkResolver xLinkResolver = new XLinkResolver();
for (CityObjectMember member : cityModel.getCityObjectMember()) {
if (member.isSetCityObject() &&
member.getCityObject().getCityGMLClass() == CityGMLClass.CITY_OBJECT_GROUP) {
CityObjectGroup group = (CityObjectGroup)member.getCityObject();
for (CityObjectGroupMember groupMember : group.getGroupMember()) {
System.out.println(df.format(new Date()) + "processing group member with role: " + groupMember.getGroupRole());
System.out.println(df.format(new Date()) + "resolving XLink to " + groupMember.getHref());
AbstractCityObject cityObject = xLinkResolver.getAbstractGML(groupMember.getHref(), cityModel, AbstractCityObject.class);
System.out.println(" Referenced city object: " + cityObject.getCityGMLClass() +
", gml:id='" + cityObject.getId() +"'");
if (cityObject.getId().equals("ID_76")) {
Road road = (Road)cityObject;
TrafficArea trafficArea = road.getTrafficArea().get(2).getTrafficArea();
System.out.println(df.format(new Date()) + "resolving XLink to " + trafficArea.getLod2MultiSurface().getHref());
ModelObject object = xLinkResolver.getObject(trafficArea.getLod2MultiSurface().getHref(), road);
if (object instanceof MultiSurface) {
MultiSurface multiSurface = (MultiSurface)object;
System.out.println(" Referenced geometry: " + multiSurface.getGMLClass() +
", gml:id='" + multiSurface.getId() + "'");
}
}
}
}
}
System.out.println(df.format(new Date()) + "sample citygml4j application successfully finished");
}
示例6: main
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
SimpleDateFormat df = new SimpleDateFormat("[HH:mm:ss] ");
System.out.println(df.format(new Date()) + "setting up citygml4j context and CityJSON builder");
CityGMLContext ctx = CityGMLContext.getInstance();
CityJSONBuilder builder = ctx.createCityJSONBuilder();
System.out.println(df.format(new Date()) + "reading only city furniture objects from CityJSON file LOD3_Railway.json");
CityJSONInputFactory in = builder.createCityJSONInputFactory();
CityJSONReader reader = in.createCityJSONReader(new File("datasets/LOD3_Railway.json"));
reader = in.createFilteredCityJSONReader(reader, new CityObjectTypeFilter() {
// return true if you want to consume the CityJSON feature
// of the given "type"
public boolean accept(String type) {
// CityObjectTypeName is an enum of the predefined "type" values in CityJSON
// but any other String can be used as well
return type.equals(CityObjectTypeName.CITY_FURNITURE.getValue());
}
});
CityModel cityModel = reader.read();
reader.close();
// iterate over all city objects of the city model
for (CityObjectMember member : cityModel.getCityObjectMember()) {
if (member.isSetCityObject()) {
AbstractCityObject cityObject = member.getCityObject();
System.out.println("Found " + cityObject.getCityGMLClass() + " feature");
System.out.println("\tgml:id '" + cityObject.getId() + "'");
// check and print LoD geometries
LodRepresentation lods = cityObject.getLodRepresentation();
for (int lod = 0; lod < 5; lod++) {
if (lods.isSetGeometry(lod))
System.out.println("\thas LoD " + lod + " geometry");
}
}
}
System.out.println(df.format(new Date()) + "sample citygml4j application successfully finished");
}
示例7: CG_CityModel
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的package包/类
public CG_CityModel(CityModel impl) {
super();
int nbElem = impl.getCityObjectMember().size();
System.out.println(nbElem);
if (impl.isSetBoundedBy()) {
Envelope bS = impl.getBoundedBy().getEnvelope();
if (bS.getLowerCorner() != null) {
this.dpLL = new DirectPosition(bS.getLowerCorner().getValue().get(0),
bS.getLowerCorner().getValue().get(1), bS.getLowerCorner().getValue().get(2));
this.dpUR = new DirectPosition(bS.getUpperCorner().getValue().get(0),
bS.getUpperCorner().getValue().get(1), bS.getUpperCorner().getValue().get(2));
} else {
List<org.citygml4j.model.gml.geometry.primitives.DirectPosition> lPos = bS.getPos();
this.dpLL = new DirectPosition(lPos.get(0).getValue().get(0), lPos.get(0).getValue().get(1),
lPos.get(0).getValue().get(2));
this.dpUR = new DirectPosition(lPos.get(1).getValue().get(0), lPos.get(1).getValue().get(1),
lPos.get(1).getValue().get(2));
}
}
if (impl.isSetAppearanceMember()) {
int nbApp = impl.getAppearanceMember().size();
for (int i = 0; i < nbApp; i++) {
Appearance ap = impl.getAppearanceMember().get(i).getFeature();
if (ap.isSetSurfaceDataMember()) {
int nbDataMember = ap.getSurfaceDataMember().size();
for (int j = 0; j < nbDataMember; j++) {
AbstractSurfaceData abs = ap.getSurfaceDataMember().get(j).getSurfaceData();
this.getlCGA().add(CG_AbstractSurfaceData.generateAbstractSurfaceData(abs));
}
}
}
}
int count = 0;
for(CityObjectMember cityObjectMember : impl.getCityObjectMember()){
CG_CityObject object = CG_CityObject.generateCityObject(cityObjectMember.getObject());
this.add(object);
System.out.println("Object added ("+(++count)+"/"+ nbElem+") : " + object);
}
System.out.println("The end");
}
示例8: convert
import org.citygml4j.model.citygml.core.CityModel; //导入方法依赖的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");
}