Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
6fce842e
Commit
6fce842e
authored
Nov 07, 2025
by
Luna Riegel
Browse files
Refactor: Remove obsolete code
parent
d4d32018
Changes
2
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java
View file @
6fce842e
...
...
@@ -487,23 +487,6 @@ public class CityGmlParser {
}
}
}
// cgmlModel = mapper.getModel().getCityModel();
//
// // remove those that should have been parsed
// if (logger.isInfoEnabled() && verbose){
// logger.info("Resolving HRefs");
// }
//// List<AbstractCityObject> parsedCityObjects = mapper.getModel().createFeatureStream().filter(Objects::nonNull)
//// .map(CityObject::getGmlObject).toList();
//// mapper.getModel().createFeatureStream().filter(Objects::nonNull)
//// .map(CityObject::getGmlObject).forEach(acos::remove);
// mapper.getModel().getFeatureIds().forEach(id -> {acos.removeIf(aco -> aco.getId().equals(id.getGmlString()));});
//// acos.removeAll(parsedCityObjects);
// // re-add all not parsed objects
// for (AbstractCityObject aco : acos) {
// cgmlModel.getCityObjectMembers().add(new AbstractCityObjectProperty(aco));
// }
// After parsing is complete, try to resolve deferred RelativeGeometries
ImplicitGeometryHolder
.
resolveDeferredObjects
(
mapper
.
getModel
().
getCache
());
if
(
logger
.
isInfoEnabled
()
&&
verbose
)
{
...
...
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/zip/ZipTest.java
deleted
100644 → 0
View file @
d4d32018
package
de.hft.stuttgart.citydoctor2.zip
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.parser.ParserConfiguration
;
import
org.apache.commons.io.FileUtils
;
import
org.junit.Test
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
class
ZipTest
{
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
@Test
public
void
testUnzipping
()
throws
MalformedZipFileException
{
CityGmlZipArchive
cgmlArch
=
CityGmlZipArchive
.
register
(
"src/test/resources/zip/mock_archive.zip"
);
assertNotNull
(
cgmlArch
);
cgmlArch
.
mountArchive
(
config
);
checkMockArchive
(
cgmlArch
);
}
private
void
checkMockArchive
(
CityGmlZipArchive
cgmlArch
)
{
assertEquals
(
5
,
cgmlArch
.
getEntries
().
size
());
for
(
CityGmlZipEntry
entry
:
cgmlArch
.
getEntries
())
{
assertNotNull
(
entry
);
assertTrue
(
entry
.
getEntrySubPath
().
matches
(
"^mock[1-5].gml$"
));
assertNull
(
entry
.
getErrorType
());
assertNotNull
(
entry
.
getModel
());
assertEquals
(
1
,
entry
.
getModel
().
getNumberOfFeatures
());
}
}
@Test
public
void
testZipping
()
throws
IOException
{
CityGmlZipArchive
cgmlArch
=
CityGmlZipArchive
.
register
(
"src/test/resources/zip/mock_archive.zip"
);
assertNotNull
(
cgmlArch
);
cgmlArch
.
mountArchive
(
config
);
Path
tmpDir
=
null
;
try
{
tmpDir
=
Files
.
createTempDirectory
(
"testTmp"
);
tmpDir
.
toFile
().
deleteOnExit
();
String
expPath
=
tmpDir
+
"/export.zip"
;
cgmlArch
.
exportToZipFile
(
expPath
);
CityGmlZipArchive
cgmlExport
=
CityGmlZipArchive
.
register
(
expPath
);
assertNotNull
(
cgmlExport
);
cgmlExport
.
mountArchive
(
config
);
checkMockArchive
(
cgmlExport
);
}
finally
{
if
(
tmpDir
!=
null
)
{
FileUtils
.
deleteDirectory
(
tmpDir
.
toFile
());
}
}
}
@Test
public
void
testEpsgParsing
()
throws
MalformedZipFileException
{
CityGmlZipArchive
cgmlArch
=
CityGmlZipArchive
.
register
(
"src/test/resources/zip/epsg.zip"
);
assertNotNull
(
cgmlArch
);
cgmlArch
.
mountArchive
(
config
);
CityGmlZipEntry
entry
=
cgmlArch
.
getEntry
(
"epsg1.gml"
);
assertNotNull
(
entry
);
String
srsName
=
entry
.
getModel
().
getCityModel
().
getBoundedBy
().
getEnvelope
().
getSrsName
().
split
(
":"
)[
6
];
assertEquals
(
"25832"
,
srsName
);
entry
=
cgmlArch
.
getEntry
(
"epsg2.gml"
);
assertNotNull
(
entry
);
srsName
=
entry
.
getModel
().
getCityModel
().
getBoundedBy
().
getEnvelope
().
getSrsName
().
split
(
":"
)[
6
];
assertEquals
(
"7415"
,
srsName
);
}
@Test
public
void
testXMLValidation
()
throws
MalformedZipFileException
{
ParserConfiguration
valConfig
=
new
ParserConfiguration
(
8
,
true
);
CityGmlZipArchive
cgmlArch
=
CityGmlZipArchive
.
register
(
"src/test/resources/zip/validate.zip"
);
assertNotNull
(
cgmlArch
);
cgmlArch
.
mountArchive
(
valConfig
);
assertNull
(
cgmlArch
.
getEntry
(
"valCorrect.gml"
).
getErrorType
());
assertEquals
(
ZipEntryErrorType
.
INVALID_CITY_GML_FILE
,
cgmlArch
.
getEntry
(
"valFaulty.gml"
).
getErrorType
());
}
@Test
public
void
testImplicitParsing
()
throws
MalformedZipFileException
{
CityGmlZipArchive
cgmlArch
=
CityGmlZipArchive
.
register
(
"src/test/resources/zip/implicit.zip"
);
assertNotNull
(
cgmlArch
);
cgmlArch
.
mountArchive
(
config
);
CityDoctorModel
mainModel
=
cgmlArch
.
getEntry
(
"Main_model.gml"
).
getModel
();
assertEquals
(
18
,
mainModel
.
getGenericCityObjects
().
toList
().
size
());
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment