-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34acd5f
commit 52468dd
Showing
13 changed files
with
107 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...src/main/kotlin/io/rtron/transformer/converter/roadspaces2citygml/module/RelationAdder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2019-2023 Chair of Geoinformatics, Technical University of Munich | ||
* | ||
* 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 io.rtron.transformer.converter.roadspaces2citygml.module | ||
|
||
import io.rtron.model.roadspaces.roadspace.objects.RoadspaceObject | ||
import io.rtron.transformer.converter.roadspaces2citygml.Roadspaces2CitygmlParameters | ||
import io.rtron.transformer.converter.roadspaces2citygml.router.RoadspaceObjectRouter | ||
import org.citygml4j.core.model.core.AbstractCityObject | ||
import org.citygml4j.core.model.core.CityObjectRelation | ||
import org.citygml4j.core.model.core.CityObjectRelationProperty | ||
import org.xmlobjects.gml.model.basictypes.Code | ||
|
||
/** | ||
* Adds object identifiers from the RoadSpaces model to an [AbstractCityObject] (CityGML model). | ||
*/ | ||
class RelationAdder( | ||
private val parameters: Roadspaces2CitygmlParameters | ||
) { | ||
|
||
// Methods | ||
fun addRelatedToRelation(roadspaceObject: RoadspaceObject, dstCityObject: AbstractCityObject) { | ||
val relationType = "related" + when (RoadspaceObjectRouter.route(roadspaceObject)) { | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.BUILDING_BUILDING -> "Building" | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.CITYFURNITURE_CITYFURNITURE -> "Furniture" | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.GENERICS_GENERICOCCUPIEDSPACE -> "OccupiedSpace" | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.TRANSPORTATION_TRAFFICSPACE -> return | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.TRANSPORTATION_AUXILIARYTRAFFICSPACE -> return | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.TRANSPORTATION_MARKING -> return | ||
RoadspaceObjectRouter.CitygmlTargetFeatureType.VEGETATION_SOLITARYVEGETATIONOBJECT -> "Vegetation" | ||
} | ||
|
||
// dstCityObject.relatedTo + | ||
// dstCityObject.relatedTo = listOf(createCityObjectRelation(roadspaceObject.id.hashedId, relationType)) | ||
} | ||
|
||
fun addBelongToRelations(roadspaceObject: RoadspaceObject, dstCityObject: AbstractCityObject) { | ||
dstCityObject.relatedTo = roadspaceObject.laneRelations.flatMap { it.getAllLaneIdentifiers() }.map { createCityObjectRelation(it.hashedId, "belongsTo") } | ||
} | ||
|
||
private fun createCityObjectRelation(id: String, type: String): CityObjectRelationProperty { | ||
val relation = CityObjectRelation(parameters.xlinkPrefix + parameters.gmlIdPrefix + id) | ||
relation.relationType = Code(type) | ||
|
||
return CityObjectRelationProperty(relation) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters