Commit 96135fe8 authored by Rushikesh Padsala's avatar Rushikesh Padsala
Browse files

addeded citygml4j

parent d94d86d1
Pipeline #4532 passed with stage
in 15 seconds
# Created by https://www.toptal.com/developers/gitignore/api/java,linux,windows,maven,git,eclipse
# Edit at https://www.toptal.com/developers/gitignore?templates=java,linux,windows,maven,git,eclipse
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/java,linux,windows,maven,git,eclipse
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>foodwaterenergycitygml4j</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hft.stuttgart.ade</groupId>
<artifactId>foodwaterenergycitygml4j</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>foodwaterenergycitygml4j</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<citygml4j.version>2.10.2</citygml4j.version>
<jakarta.xml.bind>2.3.2</jakarta.xml.bind>
<junit.jupiter.version>5.7.0</junit.jupiter.version>
</properties>
<dependencies>
<dependency>
<groupId>org.citygml4j</groupId>
<artifactId>citygml4j</artifactId>
<version>${citygml4j.version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.xml.bind}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
/*-
* Copyright 2021 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.ade.foodwaterenergycitygml4j;
import java.util.Collections;
import java.util.List;
import org.citygml4j.model.citygml.ade.binding.ADEContext;
import org.citygml4j.model.citygml.ade.binding.ADEMarshaller;
import org.citygml4j.model.citygml.ade.binding.ADEUnmarshaller;
import org.citygml4j.model.module.ade.ADEModule;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.bind.FoodWaterEnergyLandUseADEMarshaller;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.bind.FoodWaterEnergyLandUseADEUnMarshaller;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.module.FoodWaterEnergyLandUseADEModule;
public class FoodWaterEnergyLandUseADEContext implements ADEContext {
private final List<ADEModule> modules = Collections.singletonList(FoodWaterEnergyLandUseADEModule.V0_1);
@Override
public List<ADEModule> getADEModules() {
return modules;
}
@Override
public List<String> getModelPackageNames() {
return Collections.singletonList("de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model");
}
@Override
public ADEMarshaller createADEMarshaller() {
return new FoodWaterEnergyLandUseADEMarshaller();
}
@Override
public ADEUnmarshaller createADEUnmarshaller() {
return new FoodWaterEnergyLandUseADEUnMarshaller();
}
}
/*-
* Copyright 2021 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.bind;
import javax.xml.bind.JAXBElement;
import org.citygml4j.builder.jaxb.marshal.citygml.ade.ADEMarshallerHelper;
import org.citygml4j.model.citygml.ade.binding.ADEMarshaller;
import org.citygml4j.model.citygml.ade.binding.ADEModelObject;
import org.citygml4j.util.mapper.TypeMapper;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.ConsistsOfFWESurvey;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.EnergySurvey;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.FoodSurvey;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.FoodWaterEnergy;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.LandUseSurvey;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.WaterSurvey;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.ConsistsOfFWESurveyType;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.EnergySurveyType;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.FoodSurveyType;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.FoodWaterEnergyType;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.LandUseSurveyType;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.ObjectFactory;
import de.hft.stuttgart.ade.foodwaterenergycitygml4j.landuse.model.xsd.WaterSurveyType;
public class FoodWaterEnergyLandUseADEMarshaller implements ADEMarshaller {
private final ObjectFactory factory = new ObjectFactory();
private final TypeMapper<JAXBElement<?>> elementMapper;
private final TypeMapper<Object> typeMapper;
private ADEMarshallerHelper helper;
public FoodWaterEnergyLandUseADEMarshaller() {
elementMapper = TypeMapper.<JAXBElement<?>>create()
.with(FoodWaterEnergy.class, this::createFoodWaterEnergy)
.with(ConsistsOfFWESurvey.class, this::createConsistsOfFWESurvey)
.with(LandUseSurvey.class, this::createLandUseSurvey)
.with(FoodSurvey.class, this::createFoodSurvey)
.with(WaterSurvey.class, this::createWaterSurvey)
.with(EnergySurvey.class, this::createEnergySurvey);
typeMapper = TypeMapper.create()
.with(FoodWaterEnergy.class, this::marshalFoodWaterEnergy)
.with(ConsistsOfFWESurvey.class, this::marshalConsistsOfFWESurvey)
.with(LandUseSurvey.class, this::marshalLandUseSurvey)
.with(FoodSurvey.class, this::marshalFoodSurvey)
.with(WaterSurvey.class, this::marshalWaterSurvey)
.with(EnergySurvey.class, this::marshalEnergySurvey);
}
@Override
public void setADEMarshallerHelper(ADEMarshallerHelper helper) {
this.helper = helper;
}
@Override
public JAXBElement<?> marshalJAXBElement(ADEModelObject src) {
return elementMapper.apply(src);
}
@Override
public Object marshal(ADEModelObject src) {
return typeMapper.apply(src);
}
private JAXBElement<?> createFoodWaterEnergy(FoodWaterEnergy src) {
return factory.createFoodWaterEnergyType(marshalFoodWaterEnergy(src));
}
private FoodWaterEnergyType marshalFoodWaterEnergy(FoodWaterEnergy src) {
FoodWaterEnergyType dest = new FoodWaterEnergyType();
/*
helper.getGMLMarshaller().marshalAbstractFeature(src, dest);
if(src.isSetId()) {
dest.setId(src.getId());
}
*/
if(src.isAreaName()) {
dest.setAreaName(src.getAreaName());
}
if(src.isSystemName()) {
dest.setSystemName(src.getSystemName());
}
if(src.isConsistsOfFWESurvey()) {
dest.setConsistsOfFWESurveyType(marshalConsistsOfFWESurvey(src.getConsistsOfFWESurvey()));;
}
helper.getGMLMarshaller().marshalAbstractGML(src, dest);
return dest;
}
private JAXBElement<?> createConsistsOfFWESurvey(ConsistsOfFWESurvey src) {
return factory.createFConsistsOfFWESurveyType(marshalConsistsOfFWESurvey(src));
}
private ConsistsOfFWESurveyType marshalConsistsOfFWESurvey(ConsistsOfFWESurvey src) {
ConsistsOfFWESurveyType dest = new ConsistsOfFWESurveyType();
/*
helper.getGMLMarshaller().marshalAbstractFeature(src, dest);
if(src.isSetId()) {
dest.setId(src.getId());
}
*/
if(src.isLandUseSurvey()) {
for(LandUseSurvey lus : src.getLandUseSurvey()) {
dest.getLandUseSurveyType().add(marshalLandUseSurvey(lus));
}
}
helper.getGMLMarshaller().marshalAbstractGML(src, dest);
return dest;
}
private JAXBElement<?> createLandUseSurvey(LandUseSurvey src) {
return factory.createLandUseSurveyType(marshalLandUseSurvey(src));
}
private LandUseSurveyType marshalLandUseSurvey(LandUseSurvey src) {
LandUseSurveyType dest = new LandUseSurveyType();
/*
helper.getGMLMarshaller().marshalAbstractFeature(src, dest);
if(src.isSetId()) {
dest.setId(src.getId());
}
*/
if(src.isBuildingFootprintArea()) {
dest.setBuildingFootprintArea(helper.getGMLMarshaller().marshalArea(src.getBuildingFootprintArea()));
}
if(src.isPopulation()) {
dest.setPopulation(src.getPopulation());
}
if(src.isSurfaceArea()) {
dest.setSurfaceArea(helper.getGMLMarshaller().marshalArea(src.getSurfaceArea()));
}
if(src.isSurveyDescription()) {
dest.setSurveyDescription(src.getSurveyDescription());
}
if(src.isSurveyYear()) {
dest.setSurveyYear(src.getSurveyYear());
}
if(src.isSurveyYearVersion()) {
dest.setSurveyYearVersion(src.getSurveyYearVersion());
}
if(src.isFoodsurvey()) {
dest.setFoodSurveyType(marshalFoodSurvey(src.getFoodsurvey()));
}
if(src.isWatersurvey()) {
dest.setWaterSurveyType(marshalWaterSurvey(src.getWatersurvey()));
}
if(src.isEnergySurvey()) {
dest.setEnergySurveyType(marshalEnergySurvey(src.getEnergySurvey()));
}
helper.getGMLMarshaller().marshalAbstractGML(src, dest);
return dest;
}
private JAXBElement<?> createFoodSurvey(FoodSurvey src) {
return factory.createFoodSurveyType(marshalFoodSurvey(src));
}
private FoodSurveyType marshalFoodSurvey(FoodSurvey src) {
FoodSurveyType dest = new FoodSurveyType();
/*
helper.getGMLMarshaller().marshalAbstractFeature(src, dest);
if(src.isSetId()) {
dest.setId(src.getId());
}
*/
if(src.isFoodCategory()) {
dest.setFoodCategory(helper.getGMLMarshaller().marshalCode(src.getFoodCategory()));
}
if(src.isFoodConsumption()) {
dest.setFoodConsumption(helper.getGMLMarshaller().marshalScale(src.getFoodConsumption()));
}
if(src.isFoodDemand()) {
dest.setFoodDemand(helper.getGMLMarshaller().marshalScale(src.getFoodDemand()));
}
if(src.isFoodProduction()) {
dest.setFoodProduction(helper.getGMLMarshaller().marshalScale(src.getFoodProduction()));
}
if(src.isFoodProductionEnergyDemand()) {
dest.setFoodProductionEnergyDemand(helper.getGMLMarshaller().marshalScale(src.getFoodProductionEnergyDemand()));
}
if(src.isFoodProductionWaterDemand()) {
dest.setFoodProductionWaterDemand(helper.getGMLMarshaller().marshalScale(src.getFoodProductionWaterDemand()));
}
helper.getGMLMarshaller().marshalAbstractGML(src, dest);
return dest;
}
private JAXBElement<?> createWaterSurvey(WaterSurvey src) {
return factory.createWaterSurveyType(marshalWaterSurvey(src));
}
private WaterSurveyType marshalWaterSurvey(WaterSurvey src) {
WaterSurveyType dest = new WaterSurveyType();
/*
helper.getGMLMarshaller().marshalAbstractFeature(src, dest);
if(src.isSetId()) {
dest.setId(src.getId());
}
*/
if(src.isDomesticHotWaterDemand()) {
dest.setDomesticHotWaterDemand(helper.getGMLMarshaller().marshalScale(src.getDomesticHotWaterDemand()));
}
if(src.isDomesticHotWaterEnergyDemand()) {
dest.setDomesticHotWaterEnergyDemand(helper.getGMLMarshaller().marshalScale(src.getDomesticHotWaterEnergyDemand()));
}
if(src.isDomesticWaterDemand()) {
dest.setDomesticWaterDemand(helper.getGMLMarshaller().marshalScale(src.getDomesticWaterDemand()));
}
if(src.isDomesticSolidWaste()) {
dest.setDomesticSolidWaste(helper.getGMLMarshaller().marshalScale(src.getDomesticSolidWaste()));
}
if(src.isDomesticWaterWaste()) {
dest.setDomesticWaterWaste(helper.getGMLMarshaller().marshalScale(src.getDomesticWaterWaste()));
}
if(src.isTotalDomesticWaste()) {
dest.setTotalDomesticWaste(helper.getGMLMarshaller().marshalScale(src.getTotalDomesticWaste()));
}
helper.getGMLMarshaller().marshalAbstractGML(src, dest);