• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CityModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: writeCityModel

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
private void writeCityModel(WriteMode mode) throws FeatureWriteException {
	try {
		SAXFragmentWriter fragmentWriter = new SAXFragmentWriter(
				new QName(version.getCityGMLModule(CityGMLModuleType.CORE).getNamespaceURI(), "CityModel"), 
				saxWriter, 
				mode);

		JAXBElement<?> jaxbElement = jaxbMarshaller.marshalJAXBElement(new CityModel());
		if (jaxbElement != null) {
			Marshaller marshaller = cityGMLBuilder.getJAXBContext().createMarshaller();
			marshaller.marshal(jaxbElement, fragmentWriter);
		}
	} catch (JAXBException e) {
		throw new FeatureWriteException("Failed to write CityGML document header.", e);
	}
}
 
开发者ID:3dcitydb,项目名称:importer-exporter,代码行数:17,代码来源:CityGMLWriter.java


示例2: getElementMapper

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
private TypeMapper<JAXBElement<?>> getElementMapper() {
	if (elementMapper == null) {
		lock.lock();
		try {
			if (elementMapper == null) {
				elementMapper = TypeMapper.<JAXBElement<?>>create()
						.with(Address.class, this::createAddress)
						.with(CityModel.class, this::createCityModel)
						.with(CityObjectMember.class, this::createCityObjectMember)
						.with(ImplicitGeometry.class, this::createImplicitGeometry);
			}
		} finally {
			lock.unlock();
		}
	}

	return elementMapper;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:19,代码来源:Core100Marshaller.java


示例3: getTypeMapper

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
private TypeMapper<Object> getTypeMapper() {
	if (typeMapper == null) {
		lock.lock();
		try {
			if (typeMapper == null) {
				typeMapper = TypeMapper.create()
						.with(Address.class, this::marshalAddress)
						.with(AddressProperty.class, this::marshalAddressProperty)
						.with(CityModel.class, this::marshalCityModel)
						.with(CityObjectMember.class, this::marshalCityObjectMember)
						.with(ExternalObject.class, this::marshalExternalObject)
						.with(ExternalReference.class, this::marshalExternalReference)
						.with(GeneralizationRelation.class, this::marshalGeneralizationRelation)
						.with(ImplicitGeometry.class, this::marshalImplicitGeometry)
						.with(ImplicitRepresentationProperty.class, this::marshalImplicitRepresentationProperty)
						.with(XalAddressProperty.class, this::marshalXalAddressProperty);
			}
		} finally {
			lock.unlock();
		}
	}

	return typeMapper;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:25,代码来源:Core100Marshaller.java


示例4: getTypeMapper

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
private TypeMapper<Object> getTypeMapper() {
	if (typeMapper == null) {
		lock.lock();
		try {
			if (typeMapper == null) {
				typeMapper = TypeMapper.create()
						.with(Address.class, this::marshalAddress)
						.with(AddressProperty.class, this::marshalAddressProperty)
						.with(CityModel.class, this::marshalCityModel)
						.with(CityObjectMember.class, this::marshalCityObjectMember)
						.with(ExternalObject.class, this::marshalExternalObject)
						.with(ExternalReference.class, this::marshalExternalReference)
						.with(GeneralizationRelation.class, this::marshalGeneralizationRelation)
						.with(ImplicitGeometry.class, this::marshalImplicitGeometry)
						.with(ImplicitRepresentationProperty.class, this::marshalImplicitRepresentationProperty)
						.with(RelativeToTerrain.class, this::marshalRelativeToTerrain)
						.with(RelativeToWater.class, this::marshalRelativeToWater)
						.with(XalAddressProperty.class, this::marshalXalAddressProperty);
			}
		} finally {
			lock.unlock();
		}
	}

	return typeMapper;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:27,代码来源:Core200Marshaller.java


示例5: assignGenericProperty

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public boolean assignGenericProperty(ADEGenericElement genericProperty, QName substitutionGroup, CityGML dest) {
	String name = substitutionGroup.getLocalPart();
	boolean success = true;

	if (dest instanceof AbstractCityObject && name.equals("_GenericApplicationPropertyOfCityObject"))
		((AbstractCityObject)dest).addGenericApplicationPropertyOfCityObject(genericProperty);
	else if (dest instanceof AbstractSite && name.equals("_GenericApplicationPropertyOfSite"))
		((AbstractSite)dest).addGenericApplicationPropertyOfSite(genericProperty);
	else if (dest instanceof Address && name.equals("_GenericApplicationPropertyOfAddress"))
		((Address)dest).addGenericApplicationPropertyOfAddress(genericProperty);
	else if (dest instanceof CityModel && name.equals("_GenericApplicationPropertyOfCityModel"))
		((CityModel)dest).addGenericApplicationPropertyOfCityModel(genericProperty);
	else 
		success = false;

	return success;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:18,代码来源:Core200Unmarshaller.java


示例6: write

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public void write(CityModel cityModel) throws CityJSONWriteException {
	CityJSON cityJSON = marshaller.marshal(cityModel);
	if (cityJSON != null) {
		MetadataType metadata = this.metadata != null ? this.metadata : new MetadataType();

		if (!metadata.isSetBBox() && !cityJSON.getVertices().isEmpty()) {
			List<Double> bbox = cityJSON.calcBoundingBox();
			if (cityJSON.isSetTransform()) {
				TransformType transform = cityJSON.getTransform();
				for (int i = 0; i < bbox.size(); i++)
					bbox.set(i, bbox.get(i) * transform.getScale().get(i%3) + transform.getTranslate().get(i%3));
			}
			
			metadata.setBBox(bbox);
		}

		if (!metadata.isSetPresentLoDs() && cityJSON.hasCityObjects()) {
			List<Number> lods = cityJSON.calcPresentLoDs();
			if (!lods.isEmpty())
				metadata.setPresentLoDs(lods);
		}

		cityJSON.setMetadata(metadata);			
		gson.toJson(cityJSON, CityJSON.class, writer);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:27,代码来源:CityJSONWriter.java


示例7: unmarshalCityModel

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public void unmarshalCityModel(CityJSON src, CityModel dest) {
	for (AbstractCityObjectType type : src.getCityObjects()) {	
		AbstractCityObject cityObject = citygml.unmarshal(type, src);
		if (cityObject != null)
			dest.addCityObjectMember(new CityObjectMember(cityObject));
	}
	
	if (src.isSetMetadata()) {
		MetadataType metadata = src.getMetadata();

		if (metadata.isSetBBox()) {
			List<Double> bbox = metadata.getBBox();
			if (bbox.size() > 5) {
				BoundingShape boundedBy = new BoundingShape(new BoundingBox(
						new Point(bbox.get(0), bbox.get(1), bbox.get(2)),
						new Point(bbox.get(3), bbox.get(4), bbox.get(5))));
				
				if (metadata.isSetCRS())
					boundedBy.getEnvelope().setSrsName("EPSG:" + metadata.getCRS().getEpsg());
				
				dest.setBoundedBy(boundedBy);
			}
		}
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:26,代码来源:CoreUnmarshaller.java


示例8: 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;
}
 
开发者ID:SteuerHorst,项目名称:Voluminator,代码行数:45,代码来源:BuildingReader.java


示例9: CityModelInfo

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public CityModelInfo(CityModel cityModel) {
	if (cityModel == null)
		throw new IllegalArgumentException("cityModel may not be null.");
	
	DeepCopyBuilder builder = new DeepCopyBuilder();
	
	if (cityModel.isSetId())
		setId(cityModel.getId());
	
	if (cityModel.isSetName())
		setName((List<Code>)builder.copy(cityModel.getName()));
	
	if (cityModel.isSetDescription())
		setDescription((StringOrRef)builder.copy(cityModel.getDescription()));
	
	if (cityModel.isSetMetaDataProperty())
		setMetaDataProperty((List<MetaDataProperty>)builder.copy(cityModel.getMetaDataProperty()));
	
	if (cityModel.isSetBoundedBy())
		setBoundedBy((BoundingShape)builder.copy(cityModel.getBoundedBy()));
	
	if (cityModel.isSetLocation())
		setLocation((LocationProperty)builder.copy(cityModel.getLocation()));
	
	if (cityModel.isSetGenericApplicationPropertyOfCityModel())
		setGenericApplicationPropertyOfCityModel((List<ADEComponent>)builder.copy(cityModel.getGenericApplicationPropertyOfCityModel()));
	
	if (cityModel.isSetGenericADEElement())
		setGenericADEElement((List<ADEGenericElement>)builder.copy(cityModel.getGenericADEElement()));
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:32,代码来源:CityModelInfo.java


示例10: toCityModel

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public CityModel toCityModel() {
	CityModel cityModel = new CityModel();
	
	if (isSetId())
		cityModel.setId(getId());

	if (isSetName())
		cityModel.setName(getName());

	if (isSetDescription())
		cityModel.setDescription(getDescription());

	if (isSetMetaDataProperty())
		cityModel.setMetaDataProperty(getMetaDataProperty());

	if (isSetBoundedBy())
		cityModel.setBoundedBy(getBoundedBy());

	if (isSetLocation())
		cityModel.setLocation(getLocation());
	
	if (isSetGenericApplicationPropertyOfCityModel())
		cityModel.setGenericApplicationPropertyOfCityModel(getGenericApplicationPropertyOfCityModel());
	
	if (isSetGenericADEElement())
		cityModel.setGenericADEElement(getGenericADEElement());
	
	return cityModel;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:30,代码来源:CityModelInfo.java


示例11: 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;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:32,代码来源:GMLFunctionWalker.java


示例12: isSetAppearance

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public boolean isSetAppearance() {
	if (feature instanceof AbstractCityObject)
		return ((AbstractCityObject)feature).isSetAppearance();
	else if (feature instanceof CityModel)
		return ((CityModel)feature).isSetAppearanceMember();

	return false;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:9,代码来源:XMLChunkImpl.java


示例13: getAppearance

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public List<? extends AppearanceProperty> getAppearance() {
	if (feature instanceof AbstractCityObject)
		return ((AbstractCityObject)feature).getAppearance();
	else if (feature instanceof CityModel)
		return ((CityModel)feature).getAppearanceMember();

	return null;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:9,代码来源:XMLChunkImpl.java


示例14: unmarshalCityModel

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public void unmarshalCityModel(CityModelType src, CityModel dest) throws MissingADESchemaException {
	jaxb.getGMLUnmarshaller().unmarshalAbstractFeatureCollection(src, dest);

	if (src.isSet_GenericApplicationPropertyOfCityModel()) {
		for (JAXBElement<Object> elem : src.get_GenericApplicationPropertyOfCityModel()) {
			ADEModelObject ade = jaxb.getADEUnmarshaller().unmarshal(elem);
			if (ade != null)
				dest.addGenericApplicationPropertyOfCityModel(ade);
		}
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:12,代码来源:Core200Unmarshaller.java


示例15: read

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public CityModel read() {
	CityJSON cityJSON = builder.create().fromJson(reader, CityJSON.class);
	if (cityJSON != null) {
		metadata = cityJSON.getMetadata();
		CityModel cityModel = unmarshaller.unmarshal(cityJSON);
		
		if (metadata != null) {
			if (metadata.isSetBBox()) {
				List<Double> bbox = metadata.getBBox();
				if (bbox.size() > 5) {
					BoundingShape boundedBy = new BoundingShape();
					boundedBy.setEnvelope(new BoundingBox(
							new Point(bbox.get(0), bbox.get(1), bbox.get(2)), 
							new Point(bbox.get(3), bbox.get(4), bbox.get(5))));
					
					if (metadata.isSetCRS())
						boundedBy.getEnvelope().setSrsName(new StringBuilder("EPSG:").append(metadata.getCRS().getEpsg()).toString());
					
					cityModel.setBoundedBy(boundedBy);
				}
			}
		}
		
		return cityModel;
	}
	
	return null;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:29,代码来源:CityJSONReader.java


示例16: 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;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:12,代码来源:CoreMarshaller.java


示例17: marshal

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public CityJSON marshal(CityModel src) {
	xlinkResolver.resolve(src);
	appearanceResolver.resolve(src);

	CityJSON dest = new CityJSON();

	List<AbstractCityObjectType> cityObjects = citygml.marshal(src);
	if (!cityObjects.isEmpty()) {
		dest.setCityObjects(cityObjects);
		
		List<List<Double>> vertices = verticesBuilder.build();
		if (verticesTransformer != null) {
			TransformType transform = verticesTransformer.applyTransformation(vertices);
			if (transform != null)
				dest.setTransform(transform);
		}
		
		dest.setVertices(vertices);

		if (appearanceResolver.hasTextures() || appearanceResolver.hasMaterials()) {
			AppearanceType appearance = new AppearanceType();
			dest.setAppearance(appearance);

			if (appearanceResolver.hasMaterials())
				appearance.setMaterials(appearanceResolver.getMaterials());			

			if (appearanceResolver.hasTextures()) {
				List<List<Double>> textureVertices = textureVerticesBuilder.build();
				if (textureVertices.size() > 0) {
					appearance.setTextures(appearanceResolver.getTextures());
					appearance.setTextureVertices(textureVertices);
				}
			}
		}
	}

	return dest;
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:39,代码来源:CityJSONMarshaller.java


示例18: unmarshal

import org.citygml4j.model.citygml.core.CityModel; //导入依赖的package包/类
public CityModel unmarshal(CityJSON src) {
	gml.setVertices(src.getVertices());
	if (src.isSetTransform())
		gml.applyTransformation(src.getTransform());
	
	if (src.isSetAppearance())
		citygml.getAppearanceUnmarshaller().setAppearanceInfo(src.getAppearance());

	return citygml.getCoreUnmarshaller().unmarshalCityModel(src);
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:11,代码来源:CityJSONUnmarshaller.java


示例19: 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");
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:35,代码来源:SimpleReader.java


示例20: 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();
	
	// creating example (and simple) CityGML object tree
	System.out.println(df.format(new Date()) + "creating simple city model with invalid content");
	Building building = new Building();
	
	// set invalid gml:id
	building.setId("1st-Building");
	
	// set empty and thus invalid generic attribute set
	building.addGenericAttribute(new GenericAttributeSet());
	
	CityModel cityModel = new CityModel();
	cityModel.addCityObjectMember(new CityObjectMember(building));
	
	System.out.println(df.format(new Date()) + "creating citygml4j Validator and validating city model against CityGML 2.0.0");
	SchemaHandler schemaHandler = SchemaHandler.newInstance();
	Validator validator = builder.createValidator(schemaHandler);
	
	validator.setValidationEventHandler(new ValidationEventHandler() {			
		public boolean handleEvent(ValidationEvent event) {
			System.out.println(event.getMessage());
			return true;
		}
	});		
	
	validator.validate(cityModel, CityGMLVersion.v2_0_0);
	System.out.println(df.format(new Date()) + "sample citygml4j application successfully finished");
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:35,代码来源:ObjectTreeValidation.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Event类代码示例发布时间:2022-05-22
下一篇:
Java PlayerListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap