FeatureMapper.java 38.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*-
 *  Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
 * 
 *  This file is part of CityDoctor2.
 *
 *  CityDoctor2 is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  CityDoctor2 is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with CityDoctor2.  If not, see <https://www.gnu.org/licenses/>.
 */
package de.hft.stuttgart.citydoctor2.mapper;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.model.citygml.bridge.AbstractBridge;
import org.citygml4j.model.citygml.bridge.Bridge;
import org.citygml4j.model.citygml.bridge.BridgePart;
import org.citygml4j.model.citygml.building.BuildingInstallationProperty;
import org.citygml4j.model.citygml.building.BuildingPartProperty;
import org.citygml4j.model.citygml.building.OpeningProperty;
import org.citygml4j.model.citygml.core.CityModel;
import org.citygml4j.model.citygml.landuse.LandUse;
37
38
39
40
41
import org.citygml4j.model.citygml.relief.AbstractReliefComponent;
import org.citygml4j.model.citygml.relief.ReliefComponentProperty;
import org.citygml4j.model.citygml.relief.ReliefFeature;
import org.citygml4j.model.citygml.relief.TINRelief;
import org.citygml4j.model.citygml.relief.TinProperty;
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import org.citygml4j.model.citygml.transportation.AuxiliaryTrafficArea;
import org.citygml4j.model.citygml.transportation.AuxiliaryTrafficAreaProperty;
import org.citygml4j.model.citygml.transportation.Railway;
import org.citygml4j.model.citygml.transportation.Road;
import org.citygml4j.model.citygml.transportation.Square;
import org.citygml4j.model.citygml.transportation.Track;
import org.citygml4j.model.citygml.transportation.TrafficArea;
import org.citygml4j.model.citygml.transportation.TrafficAreaProperty;
import org.citygml4j.model.citygml.transportation.TransportationComplex;
import org.citygml4j.model.citygml.vegetation.PlantCover;
import org.citygml4j.model.citygml.vegetation.SolitaryVegetationObject;
import org.citygml4j.model.citygml.waterbody.WaterBody;
import org.citygml4j.model.gml.geometry.AbstractGeometry;
import org.citygml4j.model.gml.geometry.GeometryProperty;
import org.citygml4j.model.gml.geometry.complexes.CompositeSurface;
import org.citygml4j.model.gml.geometry.primitives.AbstractSolid;
58
import org.citygml4j.model.gml.geometry.primitives.TriangulatedSurface;
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import org.citygml4j.util.walker.FeatureWalker;

import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurfaceType;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject.BridgeType;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingInstallation;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.LandObject;
76
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
77
78
79
80
import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.datastructure.OpeningType;
81
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
82
import de.hft.stuttgart.citydoctor2.datastructure.ReliefObject;
83
import de.hft.stuttgart.citydoctor2.datastructure.SurfaceFeatureType;
84
import de.hft.stuttgart.citydoctor2.datastructure.TinObject;
85
86
87
88
89
90
91
92
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject.TransportationType;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation.VegetationType;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
import de.hft.stuttgart.citydoctor2.math.graph.KDTree;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
Matthias Betz's avatar
Matthias Betz committed
93
import de.hft.stuttgart.citydoctor2.utils.Localization;
94
95
96
97
98
99
100
101
102
103
104
import de.hft.stuttgart.citydoctor2.utils.Pair;

/**
 * This walker maps all cityGML4j features to the respective CityDoctor data
 * structure.
 * 
 * @author Matthias Betz
 *
 */
public class FeatureMapper extends FeatureWalker {

Matthias Betz's avatar
Matthias Betz committed
105
	private static final Logger logger = LogManager.getLogger(FeatureMapper.class);
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

	private CityDoctorModel model;
	private ParserConfiguration config;

	private double neighborDistance;

	public FeatureMapper(ParserConfiguration config, File file) {
		this.config = config;
		neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
		model = new CityDoctorModel(config, file);
	}

	@Override
	public void visit(WaterBody waterBody) {
		WaterObject wo = new WaterObject();
		model.addWater(wo);
		wo.setGmlObject(waterBody);
		if (waterBody.isSetId()) {
			wo.setGmlId(new GmlId(waterBody.getId()));
		}
		mapWaterBodyGeometries(waterBody, wo);
	}

	private void mapWaterBodyGeometries(WaterBody waterBody, WaterObject wo) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		GeometryMapper.mapLod0MultiSurface(waterBody.getLod0MultiSurface(), wo, config, polygons, linkedPolygons,
				vertexMap);
		waterBody.unsetLod0MultiSurface();
		GeometryMapper.mapLod1MultiSurface(waterBody.getLod1MultiSurface(), wo, config, polygons, linkedPolygons,
				vertexMap);
		waterBody.unsetLod1MultiSurface();
		GeometryMapper.mapLod1Solid(waterBody.getLod1Solid(), wo, config, polygons, linkedPolygons, vertexMap);
		waterBody.unsetLod1Solid();
		GeometryMapper.mapLod2Solid(waterBody.getLod2Solid(), wo, config, polygons, linkedPolygons, vertexMap);
		waterBody.unsetLod2Solid();
		GeometryMapper.mapLod3Solid(waterBody.getLod3Solid(), wo, config, polygons, linkedPolygons, vertexMap);
		waterBody.unsetLod3Solid();
		GeometryMapper.mapLod4Solid(waterBody.getLod4Solid(), wo, config, polygons, linkedPolygons, vertexMap);
		waterBody.unsetLod4Solid();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(wo);
	}

	private void createLinkedPolygons(Map<String, ConcretePolygon> polygons,
			List<Pair<String, Geometry>> linkedPolygons) {
		for (Pair<String, Geometry> link : linkedPolygons) {
			ConcretePolygon concPoly = polygons.get(link.getValue0());
			if (concPoly == null) {
Matthias Betz's avatar
Matthias Betz committed
156
157
158
				if (logger.isWarnEnabled()) {
					logger.warn(Localization.getText("FeatureMapper.polygonUnreferenced"), link.getValue0());
				}
159
160
				continue;
			}
161
162
163
164
165
166
167
168
169
170
			Geometry geom = link.getValue1();
			LinkedPolygon lPoly = new LinkedPolygon(concPoly, geom);
			if (geom.getParent() instanceof BoundarySurface) {
				BoundarySurface bs = (BoundarySurface) geom.getParent();
				lPoly.setPartOfSurface(bs);
				if (bs.getParent() instanceof BuildingInstallation) {
					lPoly.setPartOfInstallation((BuildingInstallation) bs.getParent());
				}
			}
			geom.addPolygon(lPoly);
171
172
173
174
		}
	}

	private void updateEdgesAndVertices(CityObject co) {
175
176
		// searching for neighboring vertices, replacing them with one single vertex to
		// avoid later problems with edges and manifold problems
177
178
		for (Geometry geom : co.getGeometries()) {
			KDTree tree = new KDTree();
179
180
181
182
183
			for (Polygon poly : geom.getPolygons()) {
				LinearRing lr = poly.getExteriorRing();
				updateRing(tree, lr);
				for (LinearRing innerRing : poly.getInnerRings()) {
					updateRing(tree, innerRing);
184
185
				}
			}
186
187
188
189
190
191
192
193
194
195
196
197
198
			if (!config.useLowMemoryConsumption()) {
				// no low memory consumption mode meaning create all meta information in geometry
				geom.updateEdgesAndVertices();
			}
		}
	}

	private void updateRing(KDTree tree, LinearRing lr) {
		for (int i = 0; i < lr.getVertices().size(); i++) {
			Vertex v = lr.getVertices().get(i);
			List<Vertex> nodesInRange = tree.getNodesInRange(v, neighborDistance);
			if (nodesInRange.isEmpty()) {
				tree.add(v);
199
			} else {
200
				// replace other vertex with any neighboring one
201
202
				Vertex original = nodesInRange.get(0);
				lr.setVertex(i, original);
203
			}
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
		}
	}

	@Override
	public void visit(PlantCover plantCover) {
		Vegetation veg = new Vegetation(VegetationType.PLANT_COVER);
		model.addVegetation(veg);
		mapPlantCover(plantCover, veg);
	}

	private void mapPlantCover(PlantCover plantCover, Vegetation veg) {
		veg.setGmlObject(plantCover);
		if (plantCover.isSetId()) {
			veg.setGmlId(new GmlId(plantCover.getId()));
		}
		mapPlantCoverGeometries(plantCover, veg);
	}

	private void mapPlantCoverGeometries(PlantCover plantCover, Vegetation veg) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		GeometryMapper.mapLod1MultiSurface(plantCover.getLod1MultiSurface(), veg, config, polygons, linkedPolygons,
				vertexMap);
		plantCover.unsetLod1MultiSurface();
		GeometryMapper.mapLod2MultiSurface(plantCover.getLod2MultiSurface(), veg, config, polygons, linkedPolygons,
				vertexMap);
		plantCover.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(plantCover.getLod3MultiSurface(), veg, config, polygons, linkedPolygons,
				vertexMap);
		plantCover.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(plantCover.getLod4MultiSurface(), veg, config, polygons, linkedPolygons,
				vertexMap);
		plantCover.unsetLod4MultiSurface();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(veg);
	}

	@Override
	public void visit(SolitaryVegetationObject solitaryVegetationObject) {
		Vegetation veg = new Vegetation(VegetationType.SOLITARY_VEGETATION_OBJECT);
		model.addVegetation(veg);
		mapSolitaryVegObject(solitaryVegetationObject, veg);
	}

	private void mapSolitaryVegObject(SolitaryVegetationObject svo, Vegetation veg) {
		veg.setGmlObject(svo);
		if (svo.isSetId()) {
			veg.setGmlId(new GmlId(svo.getId()));
		}
		mapSolitaryVegGeometries(svo, veg);
	}

	private void mapSolitaryVegGeometries(SolitaryVegetationObject svo, Vegetation veg) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		GeometryMapper.mapLod1Geometry(svo.getLod1Geometry(), veg, config, polygons, linkedPolygons, vertexMap);
		svo.unsetLod1Geometry();
		GeometryMapper.mapLod2Geometry(svo.getLod2Geometry(), veg, config, polygons, linkedPolygons, vertexMap);
		svo.unsetLod2Geometry();
		GeometryMapper.mapLod3Geometry(svo.getLod3Geometry(), veg, config, polygons, linkedPolygons, vertexMap);
		svo.unsetLod3Geometry();
		GeometryMapper.mapLod4Geometry(svo.getLod4Geometry(), veg, config, polygons, linkedPolygons, vertexMap);
		svo.unsetLod4Geometry();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(veg);
	}

	@Override
	public void visit(LandUse landUse) {
		LandObject lo = new LandObject(landUse);
		model.addLand(lo);
		mapLandUse(landUse, lo);
	}

	private void mapLandUse(LandUse landUse, LandObject lo) {
		lo.setGmlObject(landUse);
		if (landUse.isSetId()) {
			lo.setGmlId(new GmlId(landUse.getId()));
		}
		mapLandUseGeometries(landUse, lo);
	}

	private void mapLandUseGeometries(LandUse landUse, LandObject lo) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		GeometryMapper.mapLod0MultiSurface(landUse.getLod0MultiSurface(), lo, config, polygons, linkedPolygons,
				vertexMap);
		landUse.unsetLod0MultiSurface();
		GeometryMapper.mapLod1MultiSurface(landUse.getLod1MultiSurface(), lo, config, polygons, linkedPolygons,
				vertexMap);
		landUse.unsetLod1MultiSurface();
		GeometryMapper.mapLod2MultiSurface(landUse.getLod2MultiSurface(), lo, config, polygons, linkedPolygons,
				vertexMap);
		landUse.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(landUse.getLod3MultiSurface(), lo, config, polygons, linkedPolygons,
				vertexMap);
		landUse.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(landUse.getLod4MultiSurface(), lo, config, polygons, linkedPolygons,
				vertexMap);
		landUse.unsetLod4MultiSurface();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(lo);
	}

	@Override
	public void visit(Road road) {
		TransportationObject trans = new TransportationObject(TransportationType.ROAD);
		mapTransportationComplex(road, trans);
	}

	@Override
	public void visit(Railway railway) {
		TransportationObject trans = new TransportationObject(TransportationType.RAILWAY);
		mapTransportationComplex(railway, trans);
	}

	@Override
	public void visit(Square square) {
		TransportationObject trans = new TransportationObject(TransportationType.SQUARE);
		mapTransportationComplex(square, trans);
	}

	@Override
	public void visit(Track track) {
		TransportationObject trans = new TransportationObject(TransportationType.TRACK);
		mapTransportationComplex(track, trans);
	}

	@Override
	public void visit(AuxiliaryTrafficArea auxiliaryTrafficArea) {
		TransportationObject trans = new TransportationObject(TransportationType.AUXILLIARY_TRAFFIC_AREA);
		mapAuxTrafficArea(auxiliaryTrafficArea, trans);
	}

	@Override
	public void visit(TransportationComplex tc) {
		TransportationObject trans = new TransportationObject(TransportationType.TRANSPORTATION_COMPLEX);
		model.addTransportation(trans);
		mapTransportationComplex(tc, trans);

		if (tc.isSetAuxiliaryTrafficArea()) {
			for (AuxiliaryTrafficAreaProperty atap : tc.getAuxiliaryTrafficArea()) {
				if (atap.isSetAuxiliaryTrafficArea()) {
					TransportationObject subTrans = new TransportationObject(
							TransportationType.AUXILLIARY_TRAFFIC_AREA);
					trans.addChild(subTrans);
					mapAuxTrafficArea(atap.getAuxiliaryTrafficArea(), subTrans);
				}
			}
		}

		if (tc.isSetTrafficArea()) {
			for (TrafficAreaProperty tap : tc.getTrafficArea()) {
				if (tap.isSetTrafficArea()) {
					TransportationObject subTrans = new TransportationObject(TransportationType.TRAFFIC_AREA);
					trans.addChild(subTrans);
					mapTrafficArea(tap.getTrafficArea(), subTrans);
				}
			}
		}
	}

	@Override
	public void visit(TrafficArea trafficArea) {
		TransportationObject trans = new TransportationObject(TransportationType.TRAFFIC_AREA);
		model.addTransportation(trans);
		mapTrafficArea(trafficArea, trans);
	}

	private void mapTrafficArea(TrafficArea ta, TransportationObject to) {
		to.setGmlObject(ta);
		if (ta.isSetId()) {
			to.setGmlId(new GmlId(ta.getId()));
		}
		mapTrafficAreaGeometries(ta, to);
	}

	private void mapTrafficAreaGeometries(TrafficArea ta, TransportationObject to) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		GeometryMapper.mapLod2MultiSurface(ta.getLod2MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		ta.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(ta.getLod3MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		ta.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(ta.getLod4MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		ta.unsetLod4MultiSurface();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(to);
	}

	private void mapAuxTrafficArea(AuxiliaryTrafficArea ata, TransportationObject to) {
		to.setGmlObject(ata);
		if (ata.isSetId()) {
			to.setGmlId(new GmlId(ata.getId()));
		}
		mapAuxTrafficAreaGeometries(ata, to);
	}

	private void mapAuxTrafficAreaGeometries(AuxiliaryTrafficArea ata, TransportationObject to) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		GeometryMapper.mapLod2MultiSurface(ata.getLod2MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		ata.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(ata.getLod3MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		ata.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(ata.getLod4MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		ata.unsetLod4MultiSurface();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(to);
	}

	private void mapTransportationComplex(TransportationComplex tc, TransportationObject to) {
		model.addTransportation(to);
		to.setGmlObject(tc);
		if (tc.isSetId()) {
			to.setGmlId(new GmlId(tc.getId()));
		}
		mapTransportationComplexGeometries(tc, to);
	}

	private void mapTransportationComplexGeometries(TransportationComplex tc, TransportationObject to) {
		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();
		GeometryMapper.mapLod1MultiSurface(tc.getLod1MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		tc.unsetLod1MultiSurface();
		GeometryMapper.mapLod2MultiSurface(tc.getLod2MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		tc.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(tc.getLod3MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		tc.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(tc.getLod4MultiSurface(), to, config, polygons, linkedPolygons, vertexMap);
		tc.unsetLod4MultiSurface();
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(to);
	}

	@Override
	public void visit(org.citygml4j.model.citygml.building.Building building) {
		Building coBuilding = new Building();
		model.addBuilding(coBuilding);
		mapAbstractBuilding(building, coBuilding);
		if (building.isSetConsistsOfBuildingPart()) {
			for (BuildingPartProperty bpp : building.getConsistsOfBuildingPart()) {
				if (bpp.isSetBuildingPart()) {
					BuildingPart coBuildingPart = new BuildingPart(coBuilding);
					mapAbstractBuilding(bpp.getBuildingPart(), coBuildingPart);
				}
			}
		}
	}

	private void mapAbstractBuilding(org.citygml4j.model.citygml.building.AbstractBuilding ab,
			AbstractBuilding coBuilding) {
		coBuilding.setGmlObject(ab);
		if (ab.isSetId()) {
			coBuilding.setGmlId(new GmlId(ab.getId()));
		}

		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();

		mapBuildingMultiSurfaceGeometries(ab, coBuilding, polygons, linkedPolygons, vertexMap);
		mapBuildingSolidGeometries(ab, coBuilding, polygons, linkedPolygons, vertexMap);

		// handle boundary surfaces
		if (ab.isSetBoundedBySurface()) {
			for (org.citygml4j.model.citygml.building.BoundarySurfaceProperty bsp : ab.getBoundedBySurface()) {
				mapBuildingSurface(bsp, coBuilding, polygons, linkedPolygons, vertexMap);
			}
		}

		// handle outer building installations
		if (ab.isSetOuterBuildingInstallation()) {
			for (BuildingInstallationProperty bip : ab.getOuterBuildingInstallation()) {
				mapBuildingInstallation(bip, coBuilding, polygons, linkedPolygons, vertexMap);
			}
		}
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(coBuilding);
	}

	private void mapBuildingInstallation(BuildingInstallationProperty bip, AbstractBuilding coBuilding,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (!bip.isSetBuildingInstallation()) {
			return;
		}
		BuildingInstallation coBi = new BuildingInstallation();
		coBuilding.addBuildingInstallation(coBi);
		org.citygml4j.model.citygml.building.BuildingInstallation gmlBi = bip.getBuildingInstallation();
		coBi.setGmlObject(gmlBi);

		if (gmlBi.isSetLod2Geometry()) {
			GeometryProperty<? extends AbstractGeometry> abstractGeometry = gmlBi.getLod2Geometry();
			GeometryType type = extractGeometryType(abstractGeometry);
			Geometry geom = new Geometry(type, Lod.LOD2);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBuildingInstallationIntoGeometry(abstractGeometry, mapper, coBi);
			coBi.addGeometry(geom);
			gmlBi.unsetLod2Geometry();
		}
		if (gmlBi.isSetLod3Geometry()) {
			GeometryProperty<? extends AbstractGeometry> abstractGeometry = gmlBi.getLod3Geometry();
			GeometryType type = extractGeometryType(abstractGeometry);
			Geometry geom = new Geometry(type, Lod.LOD3);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBuildingInstallationIntoGeometry(abstractGeometry, mapper, coBi);
			coBi.addGeometry(geom);
			gmlBi.unsetLod3Geometry();
		}
		if (gmlBi.isSetLod4Geometry()) {
			GeometryProperty<? extends AbstractGeometry> abstractGeometry = gmlBi.getLod4Geometry();
			GeometryType type = extractGeometryType(abstractGeometry);
			Geometry geom = new Geometry(type, Lod.LOD4);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBuildingInstallationIntoGeometry(abstractGeometry, mapper, coBi);
			coBi.addGeometry(geom);
			gmlBi.unsetLod4Geometry();
		}

		// handle boundary surfaces
		if (gmlBi.isSetBoundedBySurface()) {
			for (org.citygml4j.model.citygml.building.BoundarySurfaceProperty bsp : gmlBi.getBoundedBySurface()) {
				mapBuildingInstallationSurface(bsp, coBi, polygons, linkedPolygons, vertexMap);
			}
		}
		updateEdgesAndVertices(coBi);
	}

	private GeometryType extractGeometryType(GeometryProperty<? extends AbstractGeometry> agp) {
		AbstractGeometry abstractGeometry = agp.getObject();
		if (abstractGeometry instanceof CompositeSurface) {
			return GeometryType.COMPOSITE_SURFACE;
		} else if (abstractGeometry instanceof AbstractSolid) {
			return GeometryType.SOLID;
		}
		return GeometryType.MULTI_SURFACE;
	}

	private void mapBuildingSolidGeometries(org.citygml4j.model.citygml.building.AbstractBuilding ab,
			AbstractBuilding coBuilding, Map<String, ConcretePolygon> polygons,
			List<Pair<String, Geometry>> linkedPolygons, Map<Vertex, Vertex> vertexMap) {
		GeometryMapper.mapLod1Solid(ab.getLod1Solid(), coBuilding, config, polygons, linkedPolygons, vertexMap);
		ab.unsetLod1Solid();
		GeometryMapper.mapLod2Solid(ab.getLod2Solid(), coBuilding, config, polygons, linkedPolygons, vertexMap);
		ab.unsetLod2Solid();
		GeometryMapper.mapLod3Solid(ab.getLod3Solid(), coBuilding, config, polygons, linkedPolygons, vertexMap);
		ab.unsetLod3Solid();
		GeometryMapper.mapLod4Solid(ab.getLod4Solid(), coBuilding, config, polygons, linkedPolygons, vertexMap);
		ab.unsetLod4Solid();
	}

	private void mapBuildingMultiSurfaceGeometries(org.citygml4j.model.citygml.building.AbstractBuilding ab,
			AbstractBuilding coBuilding, Map<String, ConcretePolygon> polygons,
			List<Pair<String, Geometry>> linkedPolygons, Map<Vertex, Vertex> vertexMap) {
		GeometryMapper.mapLod1MultiSurface(ab.getLod1MultiSurface(), coBuilding, config, polygons, linkedPolygons,
				vertexMap);
		ab.unsetLod1MultiSurface();
		GeometryMapper.mapLod2MultiSurface(ab.getLod2MultiSurface(), coBuilding, config, polygons, linkedPolygons,
				vertexMap);
		ab.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(ab.getLod3MultiSurface(), coBuilding, config, polygons, linkedPolygons,
				vertexMap);
		ab.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(ab.getLod4MultiSurface(), coBuilding, config, polygons, linkedPolygons,
				vertexMap);
		ab.unsetLod4MultiSurface();
	}

	private void mapBuildingSurface(org.citygml4j.model.citygml.building.BoundarySurfaceProperty bsp,
			AbstractBuilding coBuilding, Map<String, ConcretePolygon> polygons,
			List<Pair<String, Geometry>> linkedPolygons, Map<Vertex, Vertex> vertexMap) {
		if (!bsp.isSetBoundarySurface()) {
			return;
		}
		org.citygml4j.model.citygml.building.AbstractBoundarySurface abs = bsp.getBoundarySurface();
		BoundarySurfaceType surfaceType = mapSurfaceType(abs);
		BoundarySurface bs = new BoundarySurface(SurfaceFeatureType.BUILDING, surfaceType, abs);
		if (abs.isSetId()) {
			bs.setGmlId(new GmlId(abs.getId()));
		}
		coBuilding.addBoundarySurface(bs);
		createBoundarySurfaceGeometries(abs, bs, null, polygons, linkedPolygons, vertexMap);
		mapBuildingOpenings(abs.getOpening(), bs, polygons, linkedPolygons, vertexMap);
		updateEdgesAndVertices(bs);
	}

	private void mapBuildingOpenings(List<OpeningProperty> openings, BoundarySurface bs,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (openings == null || openings.isEmpty()) {
			return;
		}
		for (org.citygml4j.model.citygml.building.OpeningProperty op : openings) {
			if (!op.isSetOpening()) {
				continue;
			}
			org.citygml4j.model.citygml.building.AbstractOpening ap = op.getOpening();
			OpeningType type = mapOpeningType(ap);
			Opening opening = new Opening(type, SurfaceFeatureType.BUILDING, bs, ap);
			bs.addOpening(opening);
			createOpeningGeometries(ap, opening, polygons, linkedPolygons, vertexMap);
			updateEdgesAndVertices(opening);
		}
	}

	private void createOpeningGeometries(org.citygml4j.model.citygml.building.AbstractOpening ap, Opening opening,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (ap.isSetLod3MultiSurface()) {
			GeometryMapper.mapLod3MultiSurface(ap.getLod3MultiSurface(), opening, config, polygons, linkedPolygons,
					vertexMap);
			ap.unsetLod3MultiSurface();
		}
		if (ap.isSetLod4MultiSurface()) {
			GeometryMapper.mapLod4MultiSurface(ap.getLod3MultiSurface(), opening, config, polygons, linkedPolygons,
					vertexMap);
			ap.unsetLod4MultiSurface();
		}
	}

	private OpeningType mapOpeningType(org.citygml4j.model.citygml.building.AbstractOpening ap) {
		if (ap instanceof org.citygml4j.model.citygml.building.Door) {
			return OpeningType.DOOR;
		}
		if (ap instanceof org.citygml4j.model.citygml.building.Window) {
			return OpeningType.WINDOW;
		}
		return OpeningType.UNKNOWN;
	}

	private void mapBuildingInstallationSurface(org.citygml4j.model.citygml.building.BoundarySurfaceProperty bsp,
			BuildingInstallation coBi, Map<String, ConcretePolygon> polygons,
			List<Pair<String, Geometry>> linkedPolygons, Map<Vertex, Vertex> vertexMap) {
		if (!bsp.isSetBoundarySurface()) {
			return;
		}
		org.citygml4j.model.citygml.building.AbstractBoundarySurface abs = bsp.getBoundarySurface();
		BoundarySurfaceType surfaceType = mapSurfaceType(abs);
		BoundarySurface bs = new BoundarySurface(SurfaceFeatureType.BUILDING, surfaceType, abs);
		if (abs.isSetId()) {
			bs.setGmlId(new GmlId(abs.getId()));
		}
		coBi.addBoundarySurface(bs);
		createBoundarySurfaceGeometries(abs, bs, coBi, polygons, linkedPolygons, vertexMap);
		mapBuildingOpenings(abs.getOpening(), bs, polygons, linkedPolygons, vertexMap);
		updateEdgesAndVertices(bs);
	}

	private void createBoundarySurfaceGeometries(org.citygml4j.model.citygml.building.AbstractBoundarySurface abs,
			BoundarySurface bs, BuildingInstallation coBi, Map<String, ConcretePolygon> polygons,
			List<Pair<String, Geometry>> linkedPolygons, Map<Vertex, Vertex> vertexMap) {
		if (abs.isSetLod2MultiSurface()) {
			Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBoundarySurfaceIntoGeometry(abs.getLod2MultiSurface(), mapper, bs, coBi);
			bs.addGeometry(geom);
			abs.unsetLod2MultiSurface();
		}
		if (abs.isSetLod3MultiSurface()) {
			Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD3);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBoundarySurfaceIntoGeometry(abs.getLod3MultiSurface(), mapper, bs, coBi);
			bs.addGeometry(geom);
			abs.unsetLod3MultiSurface();
		}
		if (abs.isSetLod4MultiSurface()) {
			Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD4);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBoundarySurfaceIntoGeometry(abs.getLod4MultiSurface(), mapper, bs, coBi);
			bs.addGeometry(geom);
			abs.unsetLod4MultiSurface();
		}
	}

	private void createBoundarySurfaceGeometries(org.citygml4j.model.citygml.bridge.AbstractBoundarySurface abs,
			BoundarySurface bs, Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (abs.isSetLod2MultiSurface()) {
			Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBoundarySurfaceIntoGeometry(abs.getLod2MultiSurface(), mapper, bs, null);
			bs.addGeometry(geom);
			abs.unsetLod2MultiSurface();
		}
		if (abs.isSetLod3MultiSurface()) {
			Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD3);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBoundarySurfaceIntoGeometry(abs.getLod3MultiSurface(), mapper, bs, null);
			bs.addGeometry(geom);
			abs.unsetLod3MultiSurface();
		}
		if (abs.isSetLod4MultiSurface()) {
			Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD4);
			GeometryMapper mapper = new GeometryMapper(geom, config, polygons, linkedPolygons, vertexMap);
			GeometryMapper.mapBoundarySurfaceIntoGeometry(abs.getLod4MultiSurface(), mapper, bs, null);
			bs.addGeometry(geom);
			abs.unsetLod4MultiSurface();
		}
	}

	private BoundarySurfaceType mapSurfaceType(org.citygml4j.model.citygml.building.AbstractBoundarySurface abs) {
		switch (abs.getCityGMLClass()) {
		case BUILDING_WALL_SURFACE:
			return BoundarySurfaceType.WALL;
		case BUILDING_ROOF_SURFACE:
			return BoundarySurfaceType.ROOF;
		case BUILDING_GROUND_SURFACE:
			return BoundarySurfaceType.GROUND;
		case BUILDING_CLOSURE_SURFACE:
			return BoundarySurfaceType.CLOSURE;
		case BUILDING_FLOOR_SURFACE:
			return BoundarySurfaceType.OUTER_FLOOR;
		case OUTER_BUILDING_FLOOR_SURFACE:
			return BoundarySurfaceType.OUTER_FLOOR;
		case BUILDING_CEILING_SURFACE:
			return BoundarySurfaceType.OUTER_CEILING;
		case OUTER_BUILDING_CEILING_SURFACE:
			return BoundarySurfaceType.OUTER_CEILING;
		default:
			return BoundarySurfaceType.UNDEFINED;
		}
	}

	@Override
	public void visit(Bridge bridge) {
		BridgeObject coBridge = new BridgeObject(BridgeType.BRIDGE, bridge);
		mapBridge(bridge, coBridge);
	}

	@Override
	public void visit(BridgePart bridgePart) {
		BridgeObject coBridge = new BridgeObject(BridgeType.BRIDGE_PART, bridgePart);
		mapBridge(bridgePart, coBridge);
	}

	private void mapBridge(AbstractBridge aBridge, BridgeObject coBridge) {
		model.addBridge(coBridge);
		coBridge.setGmlObject(aBridge);
		if (aBridge.isSetId()) {
			coBridge.setGmlId(new GmlId(aBridge.getId()));
		}

		Map<String, ConcretePolygon> polygons = new HashMap<>();
		List<Pair<String, Geometry>> linkedPolygons = new ArrayList<>();
		Map<Vertex, Vertex> vertexMap = new HashMap<>();

		// map geometries
		mapBridgeMultiSurfaceGeometries(aBridge, coBridge, polygons, linkedPolygons, vertexMap);
		mapBridgeSolidGeometries(aBridge, coBridge, polygons, linkedPolygons, vertexMap);

		// handle boundary surfaces
		if (aBridge.isSetBoundedBySurface()) {
			for (org.citygml4j.model.citygml.bridge.BoundarySurfaceProperty bsp : aBridge.getBoundedBySurface()) {
				mapBridgeSurface(bsp, coBridge, polygons, linkedPolygons, vertexMap);
			}
		}
		createLinkedPolygons(polygons, linkedPolygons);
		updateEdgesAndVertices(coBridge);
	}

	private void mapBridgeMultiSurfaceGeometries(AbstractBridge aBridge, BridgeObject coBridge,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		GeometryMapper.mapLod1MultiSurface(aBridge.getLod1MultiSurface(), coBridge, config, polygons, linkedPolygons,
				vertexMap);
		aBridge.unsetLod1MultiSurface();
		GeometryMapper.mapLod2MultiSurface(aBridge.getLod2MultiSurface(), coBridge, config, polygons, linkedPolygons,
				vertexMap);
		aBridge.unsetLod2MultiSurface();
		GeometryMapper.mapLod3MultiSurface(aBridge.getLod3MultiSurface(), coBridge, config, polygons, linkedPolygons,
				vertexMap);
		aBridge.unsetLod3MultiSurface();
		GeometryMapper.mapLod4MultiSurface(aBridge.getLod4MultiSurface(), coBridge, config, polygons, linkedPolygons,
				vertexMap);
		aBridge.unsetLod4MultiSurface();
	}

	private void mapBridgeSolidGeometries(AbstractBridge aBridge, BridgeObject coBridge,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		GeometryMapper.mapLod1Solid(aBridge.getLod1Solid(), coBridge, config, polygons, linkedPolygons, vertexMap);
		aBridge.unsetLod1Solid();

		GeometryMapper.mapLod2Solid(aBridge.getLod2Solid(), coBridge, config, polygons, linkedPolygons, vertexMap);
		aBridge.unsetLod2Solid();

		GeometryMapper.mapLod3Solid(aBridge.getLod3Solid(), coBridge, config, polygons, linkedPolygons, vertexMap);
		aBridge.unsetLod3Solid();

		GeometryMapper.mapLod4Solid(aBridge.getLod4Solid(), coBridge, config, polygons, linkedPolygons, vertexMap);
		aBridge.unsetLod4Solid();
	}

	private void mapBridgeSurface(org.citygml4j.model.citygml.bridge.BoundarySurfaceProperty bsp, BridgeObject coBridge,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (!bsp.isSetBoundarySurface()) {
			return;
		}
		org.citygml4j.model.citygml.bridge.AbstractBoundarySurface abs = bsp.getBoundarySurface();
		BoundarySurfaceType surfaceType = mapSurfaceType(abs);
		BoundarySurface bs = new BoundarySurface(SurfaceFeatureType.BRIDGE, surfaceType, abs);
		bs.setGmlObject(abs);
		coBridge.addBoundarySurface(bs);
		mapBridgeOpenings(abs.getOpening(), bs, polygons, linkedPolygons, vertexMap);
		createBoundarySurfaceGeometries(abs, bs, polygons, linkedPolygons, vertexMap);
		updateEdgesAndVertices(bs);
	}

	private void mapBridgeOpenings(List<org.citygml4j.model.citygml.bridge.OpeningProperty> openings,
			BoundarySurface bs, Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (openings == null || openings.isEmpty()) {
			return;
		}
		for (org.citygml4j.model.citygml.bridge.OpeningProperty op : openings) {
			if (!op.isSetOpening()) {
				continue;
			}
			org.citygml4j.model.citygml.bridge.AbstractOpening ap = op.getOpening();
			OpeningType type = mapOpeningType(ap);
			Opening opening = new Opening(type, SurfaceFeatureType.BRIDGE, bs, ap);
			bs.addOpening(opening);
			createOpeningGeometries(ap, opening, polygons, linkedPolygons, vertexMap);
			updateEdgesAndVertices(opening);
		}
	}

	private void createOpeningGeometries(org.citygml4j.model.citygml.bridge.AbstractOpening ap, Opening opening,
			Map<String, ConcretePolygon> polygons, List<Pair<String, Geometry>> linkedPolygons,
			Map<Vertex, Vertex> vertexMap) {
		if (ap.isSetLod3MultiSurface()) {
			GeometryMapper.mapLod3MultiSurface(ap.getLod3MultiSurface(), opening, config, polygons, linkedPolygons,
					vertexMap);
			ap.unsetLod3MultiSurface();
		}
		if (ap.isSetLod4MultiSurface()) {
			GeometryMapper.mapLod4MultiSurface(ap.getLod3MultiSurface(), opening, config, polygons, linkedPolygons,
					vertexMap);
			ap.unsetLod4MultiSurface();
		}
	}

	private OpeningType mapOpeningType(org.citygml4j.model.citygml.bridge.AbstractOpening ap) {
		if (ap instanceof org.citygml4j.model.citygml.bridge.Door) {
			return OpeningType.DOOR;
		}
		if (ap instanceof org.citygml4j.model.citygml.bridge.Window) {
			return OpeningType.WINDOW;
		}
		return OpeningType.UNKNOWN;
	}

	private BoundarySurfaceType mapSurfaceType(org.citygml4j.model.citygml.bridge.AbstractBoundarySurface abs) {
		switch (abs.getCityGMLClass()) {
		case BRIDGE_CEILING_SURFACE:
			return BoundarySurfaceType.CEILING;
		case BRIDGE_CLOSURE_SURFACE:
			return BoundarySurfaceType.CLOSURE;
		case BRIDGE_FLOOR_SURFACE:
			return BoundarySurfaceType.FLOOR;
		case BRIDGE_GROUND_SURFACE:
			return BoundarySurfaceType.GROUND;
		case BRIDGE_ROOF_SURFACE:
			return BoundarySurfaceType.ROOF;
		case BRIDGE_WALL_SURFACE:
			return BoundarySurfaceType.WALL;
		case INTERIOR_BRIDGE_WALL_SURFACE:
			return BoundarySurfaceType.INTERIOR_WALL;
		case OUTER_BRIDGE_CEILING_SURFACE:
			return BoundarySurfaceType.OUTER_CEILING;
		case OUTER_BUILDING_FLOOR_SURFACE:
			return BoundarySurfaceType.OUTER_FLOOR;
		default:
			return BoundarySurfaceType.UNDEFINED;
		}
	}
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
	
	@Override
	public void visit(TINRelief relief) {
		model.addTin(mapTinRelief(relief));
	}

	private TinObject mapTinRelief(TINRelief relief) {
		TinObject tin = new TinObject(relief);
		if (relief.isSetId()) {
			tin.setGmlId(new GmlId(relief.getId()));
		}
		TinProperty tinProp = relief.getTin();
		if (tinProp == null) {
			return tin;
		}
		TriangulatedSurface triangSurface = tinProp.getObject();
		Lod lod = Lod.LOD1;
		switch (relief.getLod()) {
		case 0: 
			lod = Lod.LOD0;
			break;
		case 1: 
			break;
		case 2: 
			lod = Lod.LOD2;
			break;
		case 3: 
			lod = Lod.LOD3;
			break;
		case 4: 
			lod = Lod.LOD4;
			break;
		default:
			logger.warn("Lod for relief {} was not specified, assuming lod 1", relief.getId());
		}
		Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, lod);
		GeometryMapper.mapTriangulatedSurface(geom, triangSurface, config, new HashMap<>(), new ArrayList<>(), new HashMap<>());
		tin.addGeometry(geom);
		return tin;
	}
	
	@Override
	public void visit(ReliefFeature reliefFeature) {
		ReliefObject relief = new ReliefObject(reliefFeature);
		model.addRelief(relief);
		if (reliefFeature.isSetId()) {
			relief.setGmlId(new GmlId(reliefFeature.getId()));
		}
		List<ReliefComponentProperty> reliefprops = reliefFeature.getReliefComponent();
		for (ReliefComponentProperty prop : reliefprops) {
			AbstractReliefComponent object = prop.getObject();
			if (object == null) {
				continue;
			}
			if (object instanceof TINRelief) {
				TINRelief tinRelief = (TINRelief) object;
				TinObject tinObject = mapTinRelief(tinRelief);
				relief.getComponents().add(tinObject);
			}
		}
	}
	
950
951
952
953
954
955
956
	public CityDoctorModel getModel() {
		return model;
	}

	public void setCityModel(CityModel cModel) {
		model.setCityModel(cModel);
	}
957
	
958
}