Java Code Examples for org.citygml4j.CityGMLContext#hasADEContexts()

The following examples show how to use org.citygml4j.CityGMLContext#hasADEContexts() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuleContext.java    From citygml4j with Apache License 2.0 6 votes vote down vote up
private void addADEModules() {
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : context.getADEContexts()) {
			for (ADEModule module : adeContext.getADEModules()) {
				if (module.getCityGMLVersion() != version)
					continue;

				for (Module dependency : module.getDependencies()) {
					if (contains(dependency)) {
						if (adeModules == null)
							adeModules = new HashSet<>();

						adeModules.add(module);
						break;
					}
				}
			}
		}
	}
}
 
Example 2
Source File: ADEMarshaller.java    From citygml4j with Apache License 2.0 6 votes vote down vote up
public void reset(JAXBMarshaller jaxb) {
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		this.marshallers = new HashMap<>();
		ADEMarshallerHelper helper = new ADEMarshallerHelper(jaxb);

		for (ADEContext adeContext : context.getADEContexts()) {
			boolean supportsTargetVersion = false;
			for (ADEModule module : adeContext.getADEModules()) {
				if (module.getCityGMLVersion() == jaxb.getModuleContext().getCityGMLVersion()) {
					supportsTargetVersion = true;
					break;
				}
			}

			if (supportsTargetVersion) {
				org.citygml4j.model.citygml.ade.binding.ADEMarshaller marshaller = adeContext.createADEMarshaller();
				if (marshaller != null) {
					marshaller.setADEMarshallerHelper(helper);
					for (String packageName : adeContext.getModelPackageNames())
						this.marshallers.put(packageName, marshaller);
				}
			}
		}
	}
}
 
Example 3
Source File: ADEUnmarshaller.java    From citygml4j with Apache License 2.0 6 votes vote down vote up
public ADEUnmarshaller(JAXBUnmarshaller jaxb) {
	this.jaxb = jaxb;

	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		this.unmarshallers = new HashMap<>();
		ADEUnmarshallerHelper helper = new ADEUnmarshallerHelper(jaxb);

		for (ADEContext adeContext : context.getADEContexts()) {
			org.citygml4j.model.citygml.ade.binding.ADEUnmarshaller unmarshaller = adeContext.createADEUnmarshaller();
			if (unmarshaller != null) {
				unmarshaller.setADEUnmarshallerHelper(helper);
				for (ADEModule module : adeContext.getADEModules())
					this.unmarshallers.put(module.getNamespaceURI(), unmarshaller);
			}
		}
	}
}
 
Example 4
Source File: SchemaHandler.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public static synchronized SchemaHandler newInstance() throws SAXException {
	if (instance == null) {
		instance = new SchemaHandler();

		URL schemaURL = SchemaHandler.class.getResource("/org/citygml4j/schemas/citygml4j.xsd");
		if (schemaURL == null)
			throw new SAXException("Failed to parse CityGML schemas. Could not find '/org/citygml4j/schemas/citygml4j.xsd' on classpath.");

		instance.parse(schemaURL.toString());
	}

	SchemaHandler schemaHandler = new SchemaHandler();
	schemaHandler.schemaSets.addAll(instance.schemaSets);
	schemaHandler.visited.putAll(instance.visited);

	// CityGML 0.4.0
	schemaHandler.schemaLocations.put("http://www.citygml.org/citygml/1/0/0", CityGMLContext.class.getResource("/org/citygml4j/schemas/citygml/0.4.0/CityGML.xsd").toString());

	// parse local schemas provided by ADE modules
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : CityGMLContext.getInstance().getADEContexts()) {
			for (ADEModule adeModule : adeContext.getADEModules()) {
				URL schemaResource = adeModule.getSchemaResource();
				if (schemaResource != null) {
					try {
						schemaHandler.parse(schemaResource.toURI().toString());
					} catch (URISyntaxException e) {
						throw new SAXException("Failed to parse XML schema file for ADE namespace '" + adeModule.getNamespaceURI() + "'.", e);
					}
				}
			}
		}
	}

	return schemaHandler;
}
 
Example 5
Source File: GMLFunctionWalker.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public GMLFunctionWalker() {
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : CityGMLContext.getInstance().getADEContexts())
			useADEWalker(adeContext.createDefaultGMLFunctionWalker());
	}
}
 
Example 6
Source File: GMLWalker.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public GMLWalker() {
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : CityGMLContext.getInstance().getADEContexts())
			useADEWalker(adeContext.createDefaultGMLWalker());
	}
}
 
Example 7
Source File: FeatureWalker.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public FeatureWalker() {
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : CityGMLContext.getInstance().getADEContexts())
			useADEWalker(adeContext.createDefaultFeatureWalker());
	}
}
 
Example 8
Source File: FeatureFunctionWalker.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public FeatureFunctionWalker() {
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : CityGMLContext.getInstance().getADEContexts())
			useADEWalker(adeContext.createDefaultFeatureFunctionWalker());
	}
}
 
Example 9
Source File: JAXBContextPath.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
private static StringJoiner buildContextPath() {
	StringJoiner joiner = new StringJoiner(":");

	// CityGML 2.0
	joiner.add("net.opengis.citygml._2");
	joiner.add("net.opengis.citygml.appearance._2");
	joiner.add("net.opengis.citygml.bridge._2");
	joiner.add("net.opengis.citygml.building._2");
	joiner.add("net.opengis.citygml.cityfurniture._2");
	joiner.add("net.opengis.citygml.cityobjectgroup._2");
	joiner.add("net.opengis.citygml.generics._2");
	joiner.add("net.opengis.citygml.landuse._2");
	joiner.add("net.opengis.citygml.relief._2");
	joiner.add("net.opengis.citygml.texturedsurface._2");
	joiner.add("net.opengis.citygml.transportation._2");
	joiner.add("net.opengis.citygml.tunnel._2");
	joiner.add("net.opengis.citygml.vegetation._2");
	joiner.add("net.opengis.citygml.waterbody._2");

	// CityGML 1.0
	joiner.add("net.opengis.citygml._1");
	joiner.add("net.opengis.citygml.appearance._1");
	joiner.add("net.opengis.citygml.building._1");
	joiner.add("net.opengis.citygml.cityfurniture._1");
	joiner.add("net.opengis.citygml.cityobjectgroup._1");
	joiner.add("net.opengis.citygml.generics._1");
	joiner.add("net.opengis.citygml.landuse._1");
	joiner.add("net.opengis.citygml.relief._1");
	joiner.add("net.opengis.citygml.texturedsurface._1");
	joiner.add("net.opengis.citygml.transportation._1");
	joiner.add("net.opengis.citygml.vegetation._1");
	joiner.add("net.opengis.citygml.waterbody._1");

	// GML 3.1.1 and xAL 2.0
	joiner.add("net.opengis.gml");
	joiner.add("oasis.names.tc.ciq.xsdschema.xal._2");

	// ADE context paths
	CityGMLContext context = CityGMLContext.getInstance();
	if (context.hasADEContexts()) {
		for (ADEContext adeContext : CityGMLContext.getInstance().getADEContexts()) {
			for (ADEModule module : adeContext.getADEModules()) {
				for (String contextPath : module.getJAXBPackageNames())
					joiner.add(contextPath);
			}
		}
	}

	return joiner;
}