本文整理汇总了Java中org.citygml4j.model.citygml.core.CityModel类的典型用法代码示例。如果您正苦于以下问题:Java CityModel类的具体用法?Java CityModel怎么用?Java CityModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CityModel类属于org.citygml4j.model.citygml.core包,在下文中一共展示了CityModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
}
示例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;
}
示例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()));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}