org.citygml4j.model.module.citygml.CityGMLVersion Java Examples
The following examples show how to use
org.citygml4j.model.module.citygml.CityGMLVersion.
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: CityGMLWriter.java From web-feature-service with Apache License 2.0 | 6 votes |
public CityGMLWriter(SAXWriter saxWriter, CityGMLVersion version, TransformerChainFactory transformerChainFactory, GeometryStripper geometryStripper, UIDCacheManager uidCacheManager, Object eventChannel, Config config) throws DatatypeConfigurationException { this.saxWriter = saxWriter; this.version = version; this.transformerChainFactory = transformerChainFactory; this.geometryStripper = geometryStripper; this.uidCacheManager = uidCacheManager; this.config = config; cityGMLBuilder = ObjectRegistry.getInstance().getCityGMLBuilder(); jaxbMarshaller = cityGMLBuilder.createJAXBMarshaller(version); wfsFactory = new ObjectFactory(); datatypeFactory = DatatypeFactory.newInstance(); additionalObjectsHandler = new AdditionalObjectsHandler(saxWriter, version, cityGMLBuilder, transformerChainFactory, eventChannel); int queueSize = config.getProject().getExporter().getResources().getThreadPool().getDefaultPool().getMaxThreads() * 2; writerPool = new SingleWorkerPool<>( "citygml_writer_pool", new XMLWriterWorkerFactory(saxWriter, ObjectRegistry.getInstance().getEventDispatcher()), queueSize, false); writerPool.setEventSource(eventChannel); writerPool.prestartCoreWorkers(); }
Example #2
Source File: XMLQueryView.java From importer-exporter with Apache License 2.0 | 6 votes |
private void setEmptyQuery() { Query query = new Query(); query.setFeatureTypeFilter(new FeatureTypeFilter()); query.setAppearanceFilter(new AppearanceFilter()); query.setCounterFilter(new CounterFilter()); query.setLodFilter(new LodFilter()); query.setProjectionFilter(new ProjectionFilter()); query.setSelectionFilter(new SelectionFilter()); query.setSorting(new Sorting()); query.setTiling(new Tiling()); CityGMLNamespaceContext namespaceContext = new CityGMLNamespaceContext(); namespaceContext.setPrefixes(new ModuleContext(CityGMLVersion.v2_0_0)); namespaceContext.setDefaultNamespace(ConfigUtil.CITYDB_CONFIG_NAMESPACE_URI); xmlText.setText(marshalQuery(query, namespaceContext)); }
Example #3
Source File: DescribeFeatureTypeHandler.java From web-feature-service with Apache License 2.0 | 6 votes |
private SchemaReader getSchemaReader(DescribeFeatureTypeType wfsRequest, Set<FeatureType> featureTypes, CityGMLVersion version, ServletContext servletContext) throws SchemaReaderException { OutputFormat outputFormat = wfsConfig.getOperations().getDescribeFeatureType().getOutputFormat(wfsRequest.isSetOutputFormat() ? wfsRequest.getOutputFormat() : DescribeFeatureTypeOutputFormat.GML3_1.value()); SchemaReader schemaReader = null; switch (outputFormat.getName()) { case "application/gml+xml; version=3.1": schemaReader = new CityGMLSchemaReader(); break; case "application/json": schemaReader = new CityJSONSchemaReader(); break; default: throw new SchemaReaderException("No schema reader has been registered for the output format '" + outputFormat.getName() + "'."); } schemaReader.initializeContext(featureTypes, version, servletContext); return schemaReader; }
Example #4
Source File: FeatureTypeFilterBuilder.java From importer-exporter with Apache License 2.0 | 6 votes |
protected void buildFeatureTypeFilter(FeatureTypeFilter typeFilter, CityGMLVersion targetVersion, SQLQueryContext queryContext) throws QueryBuildException { if (targetVersion == null) targetVersion = CityGMLVersion.DEFAULT; List<FeatureType> featureTypes = typeFilter.getFeatureTypes(targetVersion); if (featureTypes.isEmpty()) return; Set<Integer> ids = new HashSet<>(featureTypes.size()); for (FeatureType featureType : featureTypes) ids.add(featureType.getObjectClassId()); Select select = queryContext.getSelect(); Table cityObject = builder.joinCityObjectTable(queryContext); Column objectClassId = cityObject.getColumn(MappingConstants.OBJECTCLASS_ID); if (ids.size() == 1) select.addSelection(ComparisonFactory.equalTo(objectClassId, new IntegerLiteral(ids.iterator().next()))); else select.addSelection(ComparisonFactory.in(objectClassId, new LiteralList(ids.toArray(new Integer[0])))); }
Example #5
Source File: FeatureTypeHandler.java From web-feature-service with Apache License 2.0 | 6 votes |
public Set<FeatureType> getFeatureTypes(Collection<QName> featureTypeNames, boolean onlyAdvertised, boolean canBeEmpty, String handle) throws WFSException { Set<FeatureType> result = new HashSet<FeatureType>(); CityGMLVersion featureVersion = null; for (QName featureTypeName : featureTypeNames) { FeatureType featureType = getFeatureType(featureTypeName, onlyAdvertised, handle); // check whether all feature types share the same CityGML version if (featureVersion == null) featureVersion = version; else if (version != featureVersion) throw new WFSException(WFSExceptionCode.OPERATION_PROCESSING_FAILED, "Mixing feature types from different CityGML versions is not supported.", handle); result.add(featureType); } // check whether the query must contain at least one feature type name if (!canBeEmpty && result.isEmpty()) throw new WFSException(WFSExceptionCode.INVALID_PARAMETER_VALUE, "The operation requires at least one feature type name to be provided.", handle); return result; }
Example #6
Source File: Util.java From importer-exporter with Apache License 2.0 | 6 votes |
public static AbstractGML createObject(int objectClassId, CityGMLVersion version) { ADEExtension extension = ADEExtensionManager.getInstance().getExtensionByObjectClassId(objectClassId); if (extension != null) return extension.getADEObjectMapper().createObject(objectClassId, version); else { for (Entry<Class<? extends AbstractGML>, Integer> entry : objectClassIds.entrySet()) { if (entry.getValue() == objectClassId && !Modifier.isAbstract(entry.getKey().getModifiers())) { try { return entry.getKey().newInstance(); } catch (InstantiationException | IllegalAccessException e) { // } } } } return null; }
Example #7
Source File: CityGMLWriter.java From importer-exporter with Apache License 2.0 | 6 votes |
CityGMLWriter(SAXWriter saxWriter, CityGMLVersion version, TransformerChainFactory transformerChainFactory, boolean useSequentialWriting) { this.saxWriter = saxWriter; this.version = version; this.transformerChainFactory = transformerChainFactory; this.useSequentialWriting = useSequentialWriting; cityGMLBuilder = ObjectRegistry.getInstance().getCityGMLBuilder(); jaxbMarshaller = cityGMLBuilder.createJAXBMarshaller(version); eventDispatcher = ObjectRegistry.getInstance().getEventDispatcher(); eventDispatcher.addEventHandler(EventType.INTERRUPT, this); writerPool = new SingleWorkerPool<>( "citygml_writer_pool", new XMLWriterWorkerFactory(saxWriter, eventDispatcher), 100, false); writerPool.prestartCoreWorkers(); if (useSequentialWriting) sequentialWriter = new SequentialWriter<>(writerPool); }
Example #8
Source File: XMLQueryView.java From importer-exporter with Apache License 2.0 | 5 votes |
private String wrapQuery(String query) { StringBuilder wrapper = new StringBuilder("<wrapper xmlns=\"") .append(ConfigUtil.CITYDB_CONFIG_NAMESPACE_URI).append("\" "); ModuleContext context = new ModuleContext(CityGMLVersion.v2_0_0); for (Module module : context.getModules()) { wrapper.append("xmlns:").append(module.getNamespacePrefix()).append("=\"") .append(module.getNamespaceURI()).append("\" "); } wrapper.append(">\n").append(query).append("</wrapper>"); return wrapper.toString(); }
Example #9
Source File: FeatureTypeFilterBuilder.java From importer-exporter with Apache License 2.0 | 5 votes |
protected FeatureTypeFilter buildFeatureTypeFilter(org.citydb.config.project.query.filter.type.FeatureTypeFilter featureTypeFilterConfig, CityGMLVersion version) throws QueryBuildException { FeatureTypeFilter featureTypeFilter = new FeatureTypeFilter(); try { for (QName typeName : featureTypeFilterConfig.getTypeNames()) { if (typeName == null) continue; FeatureType featureType = schemaMapping.getFeatureType(typeName); if (featureType == null) continue; if (!featureType.isAvailableForCityGML(version)) continue; ADEExtension extension = adeManager.getExtensionByObjectClassId(featureType.getObjectClassId()); if (extension != null && !extension.isEnabled()) continue; featureTypeFilter.addFeatureType(featureType); } } catch (FilterException e) { throw new QueryBuildException("Failed to build the feature type filter.", e); } return featureTypeFilter; }
Example #10
Source File: FeatureTypeFilterBuilder.java From importer-exporter with Apache License 2.0 | 5 votes |
protected FeatureTypeFilter buildFeatureTypeFilter(org.citydb.config.project.query.filter.type.FeatureTypeFilter featureTypeFilterConfig) throws QueryBuildException { FeatureTypeFilter featureTypeFilter = new FeatureTypeFilter(); CityGMLVersion version = null; try { for (QName typeName : featureTypeFilterConfig.getTypeNames()) { if (typeName == null) throw new QueryBuildException("Failed to parse the qualified names of the feature types."); FeatureType featureType = schemaMapping.getFeatureType(typeName); if (featureType == null) throw new QueryBuildException("'" + typeName + "' is not a valid feature type."); // check whether all feature types share the same CityGML version CityGMLVersion featureVersion = featureType.getSchema().getCityGMLVersion(typeName.getNamespaceURI()); if (featureVersion == null) throw new QueryBuildException("Failed to find CityGML version of the feature type '" + typeName + "'."); if (version == null) version = featureVersion; else if (version != featureVersion) throw new QueryBuildException("Mixing feature types from different CityGML versions is not supported."); featureTypeFilter.addFeatureType(featureType); } } catch (FilterException e) { throw new QueryBuildException("Failed to build the feature type filter.", e); } // set the CityGML target version query.setTargetVersion(version); return featureTypeFilter; }
Example #11
Source File: FeatureTypeTree.java From importer-exporter with Apache License 2.0 | 5 votes |
public void updateCityGMLVersion(CityGMLVersion version, boolean refresh) { this.version = version; if (refresh) { setPathsEnabled(true); repaint(); } }
Example #12
Source File: CityJSONSchemaReader.java From web-feature-service with Apache License 2.0 | 5 votes |
@Override public void initializeContext(Set<FeatureType> featureTypes, CityGMLVersion version, ServletContext servletContext) throws SchemaReaderException { this.featureTypes = featureTypes; this.servletContext = servletContext; List<String> unsupported = Arrays.asList("TransportationComplex", "Track"); for (FeatureType featureType : featureTypes) { if (unsupported.contains(featureType.getPath())) throw new SchemaReaderException("The feature type '" + featureType.getPath() + "' is not supported by CityJSON."); } }
Example #13
Source File: ObjectTreeValidation.java From citygml4j with Apache License 2.0 | 5 votes |
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"); }
Example #14
Source File: VersionPanel.java From importer-exporter with Apache License 2.0 | 5 votes |
private void initGui() { ButtonGroup group = new ButtonGroup(); cityGMLVersionBox = new JRadioButton[CityGMLVersionType.values().length]; for (int i = 0; i < CityGMLVersionType.values().length; i++) { cityGMLVersionBox[i] = new JRadioButton(); cityGMLVersionBox[i].setText(CityGMLVersionType.values()[i].toString()); cityGMLVersionBox[i].setIconTextGap(10); group.add(cityGMLVersionBox[i]); if (Util.toCityGMLVersion(CityGMLVersionType.values()[i]) == CityGMLVersion.DEFAULT) cityGMLVersionBox[i].setSelected(true); // fire property change event cityGMLVersionBox[i].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { for (int i = 0; i < CityGMLVersionType.values().length; i++) { if (cityGMLVersionBox[i] == e.getSource()) { ObjectRegistry.getInstance().getEventDispatcher().triggerEvent( new PropertyChangeEvent("citygml.version", null, Util.toCityGMLVersion(CityGMLVersionType.values()[i]), VersionPanel.this)); break; } } } }); } setLayout(new GridBagLayout()); block1 = new JPanel(); add(block1, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,5,0,5,0)); block1.setBorder(BorderFactory.createTitledBorder("")); block1.setLayout(new GridBagLayout()); { for (int i = 0; i < cityGMLVersionBox.length; i++) block1.add(cityGMLVersionBox[i], GuiUtil.setConstraints(0,i,1.0,1.0,GridBagConstraints.BOTH,0,5,0,5)); } }
Example #15
Source File: ConfigNamespaceFilter.java From importer-exporter with Apache License 2.0 | 5 votes |
public ConfigNamespaceFilter(XMLReader reader) { super(reader); prefixToUri = new HashMap<>(); uriToPrefix = new HashMap<>(); // bind default CityGML and ADE namespaces ModuleContext modules = new ModuleContext(CityGMLVersion.DEFAULT); for (Module module : modules.getModules()) bindNamespace(module.getNamespacePrefix(), module.getNamespaceURI()); // bind 3DCityDB ADE namespace bindNamespace("citydb", "http://www.3dcitydb.org/citygml-ade/3.0/citygml/2.0"); }
Example #16
Source File: FeatureTypes.java From web-feature-service with Apache License 2.0 | 5 votes |
public CityGMLVersion getDefaultVersion() { for (CityGMLVersionType version : versions) if (version.isDefault()) return version.getValue().getCityGMLVersion(); return versions.size() == 1 ? versions.iterator().next().getValue().getCityGMLVersion() : CityGMLVersion.DEFAULT; }
Example #17
Source File: FeatureTypes.java From web-feature-service with Apache License 2.0 | 5 votes |
public List<CityGMLVersion> getVersions() { List<CityGMLVersion> result = new ArrayList<>(); for (CityGMLVersionType version : versions) { if (version.getValue() == null) continue; result.add(version.getValue().getCityGMLVersion()); } return result; }
Example #18
Source File: FeatureTypeFilter.java From importer-exporter with Apache License 2.0 | 5 votes |
public List<FeatureType> getFeatureTypes(CityGMLVersion version) { ArrayList<FeatureType> result = new ArrayList<>(); for (FeatureType featureType : featureTypes) { if (featureType.isAvailableForCityGML(version)) result.add(featureType); } return result; }
Example #19
Source File: SchemaMapping.java From importer-exporter with Apache License 2.0 | 5 votes |
public Map<String, String> getNamespaceContext(CityGMLVersion version) { Map<String, String> context = new HashMap<>(); // register app schema namespaces for (AppSchema schema : schemas) { for (Namespace namespace : schema.namespaces) { if (namespace.isSetContext() && namespace.getContext().getCityGMLVersion() == version) context.put(schema.getXMLPrefix(), namespace.getURI()); } } return context; }
Example #20
Source File: AppSchema.java From importer-exporter with Apache License 2.0 | 5 votes |
public Namespace getNamespace(CityGMLVersion version) { for (Namespace namespace : namespaces) { if (namespace.getContext() != null && namespace.getContext().getCityGMLVersion() == version) return namespace; } return null; }
Example #21
Source File: AppSchema.java From importer-exporter with Apache License 2.0 | 5 votes |
public CityGMLVersion getCityGMLVersion(String namespaceURI) { for (Namespace namespace : namespaces) { if (namespace.getURI().equals(namespaceURI) && namespace.getContext() != null) return namespace.getContext().getCityGMLVersion(); } return null; }
Example #22
Source File: Util.java From importer-exporter with Apache License 2.0 | 5 votes |
public static CityGMLVersion toCityGMLVersion(CityGMLVersionType version) { switch (version) { case v1_0_0: return CityGMLVersion.v1_0_0; default: return CityGMLVersion.v2_0_0; } }
Example #23
Source File: ModuleContext.java From citygml4j with Apache License 2.0 | 5 votes |
public ModuleContext(CityGMLVersion version) { this.version = version; for (Module module : version.getModules()) modules.put(module.getType(), module); addADEModules(); }
Example #24
Source File: ModuleContext.java From citygml4j with Apache License 2.0 | 5 votes |
public void setCityGMLVersion(CityGMLVersion version) { this.version = version; modules = new HashMap<>(); adeModules = null; for (Module module : version.getModules()) modules.put(module.getType(), module); addADEModules(); }
Example #25
Source File: ADEModule.java From citygml4j with Apache License 2.0 | 5 votes |
public ADEModule ( ModuleType type, ModuleVersion version, String namespaceURI, String namespacePrefix, String schemaLocation, CityGMLVersion cityGMLVersion) { super(type, version, namespaceURI, namespacePrefix, schemaLocation, (Module)null); this.cityGMLVersion = cityGMLVersion; adeDependencies = new ArrayList<>(cityGMLVersion.getModules()); }
Example #26
Source File: ADEModule.java From citygml4j with Apache License 2.0 | 5 votes |
public ADEModule ( String namespaceURI, String namespacePrefix, String schemaLocation, CityGMLVersion cityGMLVersion) { this(new ADEModuleType(), new ADEModuleVersion(), namespaceURI, namespacePrefix, schemaLocation, cityGMLVersion); }
Example #27
Source File: AbstractJAXBWriter.java From citygml4j with Apache License 2.0 | 5 votes |
public void setSchemaLocations(CityGMLVersion version) { for (CityGMLModule module : version.getCityGMLModules()) { if (module instanceof CoreModule) continue; setSchemaLocation(module); } }
Example #28
Source File: SplittingFeature.java From citygml4j with Apache License 2.0 | 5 votes |
private static void setContext(AbstractCityGMLWriter writer) { writer.setPrefixes(CityGMLVersion.v1_0_0); writer.setPrefix("sub", "http://www.citygml.org/ade/sub/0.9.0"); writer.setDefaultNamespace(CoreModule.v1_0_0); writer.setSchemaLocation("http://www.citygml.org/ade/sub/0.9.0", "../datasets/schemas/CityGML-SubsurfaceADE-0_9_0.xsd"); writer.setIndentString(" "); }
Example #29
Source File: AdditionalObjectsHandler.java From web-feature-service with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected AdditionalObjectsHandler(SAXWriter saxWriter, CityGMLVersion version, CityGMLBuilder cityGMLBuilder, TransformerChainFactory transformerChainFactory, Object eventChannel) { this.saxWriter = saxWriter; this.version = version; this.cityGMLBuilder = cityGMLBuilder; this.transformerChainFactory = transformerChainFactory; this.eventChannel = eventChannel; cacheCleanerPool = (WorkerPool<CacheCleanerWork>) ObjectRegistry.getInstance().lookup(CacheCleanerWorker.class.getName()); eventDispatcher = ObjectRegistry.getInstance().getEventDispatcher(); }
Example #30
Source File: CityGMLBuilder.java From citygml4j with Apache License 2.0 | 4 votes |
public CityGMLOutputFactory createCityGMLOutputFactory(CityGMLVersion version, SchemaHandler schemaHandler) { return new JAXBOutputFactory(this, new ModuleContext(version), schemaHandler); }