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
a1602768
Commit
a1602768
authored
Jan 24, 2025
by
Matthias Betz
Browse files
general cleanup of code
parent
8afe47c2
Pipeline
#10955
passed with stage
in 1 minute and 9 seconds
Changes
16
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractFurniture.java
View file @
a1602768
...
...
@@ -124,7 +124,10 @@ public abstract class AbstractFurniture extends CityObject {
public
void
setParent
(
CityObject
co
)
{
parent
=
co
;
}
public
CityObject
getParent
()
{
return
parent
;
}
@Override
public
void
unsetGmlGeometries
()
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ImplicitGeometryHolder.java
View file @
a1602768
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.List
;
import
org.citygml4j.core.model.core.ImplicitGeometry
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.math.TransformationMatrix
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.core.ImplicitGeometry
;
import
java.io.Serial
;
import
java.util.List
;
/**
* Datastructure for representation and resolving of implicit geometries
...
...
@@ -18,7 +17,6 @@ import java.util.List;
*/
public
class
ImplicitGeometryHolder
extends
Geometry
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
ImplicitGeometryHolder
.
class
);
@Serial
private
static
final
long
serialVersionUID
=
-
8938931081577196349L
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java
View file @
a1602768
...
...
@@ -14,68 +14,66 @@ import java.util.Map;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Reference object for handling of implicit geometries with a library object contained in an external file
* Reference object for handling of implicit geometries with a library object
* contained in an external file
*
* @author Riegel
*/
public
class
LibraryObject
extends
Geometry
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
LibraryObject
.
class
);
@Serial
private
static
final
long
serialVersionUID
=
-
50293435187454911L
;
private
final
String
filepath
;
private
final
ParserConfiguration
config
;
private
static
Map
<
String
,
LibraryObject
>
libraryObjects
=
new
ConcurrentHashMap
<>();
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
LibraryObject
.
class
);
@Serial
private
static
final
long
serialVersionUID
=
-
50293435187454911L
;
public
static
LibraryObject
of
(
Path
path
,
ParserConfiguration
config
)
{
if
(
libraryObjects
.
containsKey
(
path
.
toString
()))
{
return
libraryObjects
.
get
(
path
.
toString
());
}
Geometry
protoGeom
=
parseFile
(
path
,
config
);
if
(
protoGeom
==
null
)
{
return
null
;
}
LibraryObject
libOb
=
new
LibraryObject
(
protoGeom
.
getType
(),
protoGeom
.
getLod
(),
path
,
config
);
protoGeom
.
getPolygons
().
forEach
(
libOb:
:
addPolygon
);
libOb
.
updateEdgesAndVertices
();
libraryObjects
.
put
(
path
.
toString
(),
libOb
);
return
libOb
;
}
private
static
Map
<
String
,
LibraryObject
>
libraryObjects
=
new
ConcurrentHashMap
<>();
private
LibraryObject
(
GeometryType
type
,
Lod
lod
,
Path
path
,
ParserConfiguration
config
)
{
super
(
type
,
lod
);
this
.
filepath
=
path
.
toString
();
this
.
config
=
config
;
}
public
static
LibraryObject
of
(
Path
path
,
ParserConfiguration
config
)
{
if
(
libraryObjects
.
containsKey
(
path
.
toString
()))
{
return
libraryObjects
.
get
(
path
.
toString
());
}
Geometry
protoGeom
=
parseFile
(
path
,
config
);
if
(
protoGeom
==
null
)
{
return
null
;
}
LibraryObject
libOb
=
new
LibraryObject
(
protoGeom
.
getType
(),
protoGeom
.
getLod
());
protoGeom
.
getPolygons
().
forEach
(
libOb:
:
addPolygon
);
libOb
.
updateEdgesAndVertices
();
libraryObjects
.
put
(
path
.
toString
(),
libOb
);
return
libOb
;
}
private
LibraryObject
(
GeometryType
type
,
Lod
lod
)
{
super
(
type
,
lod
);
}
private
static
Geometry
parseFile
(
Path
path
,
ParserConfiguration
config
)
{
Geometry
geo
=
null
;
if
(
path
.
toFile
().
exists
())
{
try
{
CityGmlParser
.
gagLogger
(
true
);
CityDoctorModel
model
=
CityGmlParser
.
parseCityGmlFile
(
path
.
toString
(),
config
);
List
<
CityObject
>
objects
=
model
.
createFeatureStream
().
toList
();
if
(
objects
.
isEmpty
())
{
throw
new
InvalidGmlFileException
(
"Referenced library-object's gml file does not contain a CityGML object!"
);
}
else
if
(
objects
.
size
()
>
1
)
{
throw
new
InvalidGmlFileException
(
"Referenced library-object's gml file contains more than one CityGML object!"
);
}
geo
=
objects
.
get
(
0
).
getHighestLodGeometry
();
}
catch
(
CityGmlParseException
e
)
{
logger
.
error
(
String
.
format
(
"Encountered an error while parsing library object %s"
,
path
));
logger
.
error
(
e
.
getStackTrace
());
}
catch
(
InvalidGmlFileException
e
)
{
logger
.
error
(
e
.
getStackTrace
());
}
finally
{
// Failsafe to remove gag should parsing fail
CityGmlParser
.
gagLogger
(
false
);
}
}
else
{
logger
.
error
(
String
.
format
(
"Implicit geometry references non-existing library object file %s."
,
path
));
}
return
geo
;
}
private
static
Geometry
parseFile
(
Path
path
,
ParserConfiguration
config
)
{
Geometry
geo
=
null
;
if
(
path
.
toFile
().
exists
())
{
try
{
CityGmlParser
.
gagLogger
(
true
);
CityDoctorModel
model
=
CityGmlParser
.
parseCityGmlFile
(
path
.
toString
(),
config
);
List
<
CityObject
>
objects
=
model
.
createFeatureStream
().
toList
();
if
(
objects
.
isEmpty
())
{
throw
new
InvalidGmlFileException
(
"Referenced library-object's gml file does not contain a CityGML object!"
);
}
else
if
(
objects
.
size
()
>
1
)
{
throw
new
InvalidGmlFileException
(
"Referenced library-object's gml file contains more than one CityGML object!"
);
}
geo
=
objects
.
get
(
0
).
getHighestLodGeometry
();
}
catch
(
CityGmlParseException
e
)
{
logger
.
error
(
"Encountered an error while parsing library object {}"
,
path
);
logger
.
error
(
e
.
getStackTrace
());
}
catch
(
InvalidGmlFileException
e
)
{
logger
.
error
(
e
.
getStackTrace
());
}
finally
{
// Failsafe to remove gag should parsing fail
CityGmlParser
.
gagLogger
(
false
);
}
}
else
{
logger
.
error
(
"Implicit geometry references non-existing library object file {}."
,
path
);
}
return
geo
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/RelativeGeometry.java
View file @
a1602768
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.io.Serial
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -15,27 +11,23 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public
class
RelativeGeometry
extends
Geometry
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
RelativeGeometry
.
class
);
@Serial
private
static
final
long
serialVersionUID
=
-
686112245455298977L
;
private
static
Map
<
Geometry
,
RelativeGeometry
>
relativeGeometries
=
new
ConcurrentHashMap
<>();
public
static
RelativeGeometry
of
(
Geometry
geom
)
{
if
(
relativeGeometries
.
containsKey
(
geom
))
{
return
relativeGeometries
.
get
(
geom
);
}
RelativeGeometry
relGeo
=
new
RelativeGeometry
(
geom
.
getType
(),
geom
.
getLod
());
geom
.
getPolygons
().
forEach
(
relGeo:
:
addPolygon
);
relGeo
.
updateEdgesAndVertices
();
relativeGeometries
.
put
(
geom
,
relGeo
);
return
relGeo
;
}
private
RelativeGeometry
(
GeometryType
type
,
Lod
lod
)
{
super
(
type
,
lod
);
}
@Serial
private
static
final
long
serialVersionUID
=
-
686112245455298977L
;
private
static
Map
<
Geometry
,
RelativeGeometry
>
relativeGeometries
=
new
ConcurrentHashMap
<>();
public
static
RelativeGeometry
of
(
Geometry
geom
)
{
if
(
relativeGeometries
.
containsKey
(
geom
))
{
return
relativeGeometries
.
get
(
geom
);
}
RelativeGeometry
relGeo
=
new
RelativeGeometry
(
geom
.
getType
(),
geom
.
getLod
());
geom
.
getPolygons
().
forEach
(
relGeo:
:
addPolygon
);
relGeo
.
updateEdgesAndVertices
();
relativeGeometries
.
put
(
geom
,
relGeo
);
return
relGeo
;
}
private
RelativeGeometry
(
GeometryType
type
,
Lod
lod
)
{
super
(
type
,
lod
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TunnelConstructiveElement.java
View file @
a1602768
...
...
@@ -60,6 +60,8 @@ public class TunnelConstructiveElement extends CityObject {
MultiSurface
ms
=
CityGmlUtils
.
createMultiSurface
(
geom
,
factory
,
config
);
setMultiSurfaceAccordingToLod
(
geom
,
ms
);
break
;
case
COMPOSITE_SURFACE:
throw
new
IllegalStateException
(
"Tunnel constructive element cannot have a composite surface geometry"
);
}
}
for
(
BoundarySurface
bs
:
boundarySurfaceList
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
a1602768
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/writer/CityGMLWriterUtils.java
View file @
a1602768
...
...
@@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.CityGMLVersion
;
import
org.citygml4j.core.model.core.AbstractCityObjectProperty
;
import
org.citygml4j.core.model.core.AbstractFeatureProperty
;
import
org.citygml4j.core.model.core.CityModel
;
...
...
CityDoctorParent/CityDoctorValidation/pom.xml
View file @
a1602768
<?xml version="1.0" encoding="utf-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
>
<project
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
de.hft.stuttgart
</groupId>
...
...
@@ -65,11 +65,11 @@
<groupId>
net.sf.saxon
</groupId>
<artifactId>
Saxon-HE
</artifactId>
</dependency>
<dependency>
<groupId>
org.yaml
</groupId>
<artifactId>
snakeyaml
</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>
org.yaml
</groupId>
<artifactId>
snakeyaml
</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/SvrlContentHandler.java
View file @
a1602768
...
...
@@ -65,23 +65,19 @@ public class SvrlContentHandler implements ContentHandler {
public
void
setDocumentLocator
(
Locator
locator
)
{
// not needed
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
startDocument
()
throws
SAXException
{
// not needed
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
endDocument
()
throws
SAXException
{
// not needed
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
startPrefixMapping
(
String
prefix
,
String
uri
)
throws
SAXException
{
// not needed
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
endPrefixMapping
(
String
prefix
)
throws
SAXException
{
// not needed
...
...
@@ -133,17 +129,14 @@ public class SvrlContentHandler implements ContentHandler {
buffer
.
append
(
ch
,
start
,
length
);
}
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
ignorableWhitespace
(
char
[]
ch
,
int
start
,
int
length
)
throws
SAXException
{
// not needed
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
processingInstruction
(
String
target
,
String
data
)
throws
SAXException
{
// not needed
}
@SuppressWarnings
(
"RedundantThrows"
)
@Override
public
void
skippedEntity
(
String
name
)
throws
SAXException
{
// not needed
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/SolidSelfIntCheck.java
View file @
a1602768
...
...
@@ -27,19 +27,16 @@ import de.hft.stuttgart.citydoctor2.check.Check;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.CheckId
;
import
de.hft.stuttgart.citydoctor2.check.CheckResult
;
import
de.hft.stuttgart.citydoctor2.check.RequirementType
;
import
de.hft.stuttgart.citydoctor2.check.GeometrySelfIntersection
;
import
de.hft.stuttgart.citydoctor2.check.Requirement
;
import
de.hft.stuttgart.citydoctor2.check.RequirementType
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError
;
import
de.hft.stuttgart.citydoctor2.checks.util.CollectionUtils
;
import
de.hft.stuttgart.citydoctor2.checks.util.SelfIntersectionUtil
;
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.math.Segment3d
;
import
de.hft.stuttgart.citydoctor2.utils.PolygonIntersection
;
import
de.hft.stuttgart.citydoctor2.utils.PolygonIntersection.IntersectionType
;
/**
* Check for self intersecting solids
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
View file @
a1602768
...
...
@@ -160,6 +160,7 @@ public class CityDoctorController {
buildLand
(
model
);
buildCityFurniture
(
model
);
buildOtherCityObjects
(
model
);
buildTunnel
(
model
.
getTunnels
());
}
private
void
resetFeatureChunks
()
{
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/CityFurnitureNode.java
View file @
a1602768
package
de.hft.stuttgart.citydoctor2.gui.tree
;
import
de.hft.stuttgart.citydoctor2.datastructure.AbstractRoom
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityFurniture
;
import
de.hft.stuttgart.citydoctor2.gui.CheckStatus
;
import
de.hft.stuttgart.citydoctor2.gui.Renderer
;
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/MainToolBar.fxml
View file @
a1602768
...
...
@@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<HBox
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
spacing=
"5.0"
xmlns=
"http://javafx.com/javafx/
22
"
xmlns:fx=
"http://javafx.com/fxml/1"
>
<HBox
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
spacing=
"5.0"
xmlns=
"http://javafx.com/javafx/
17
"
xmlns:fx=
"http://javafx.com/fxml/1"
>
<children>
<HBox
spacing=
"5.0"
HBox.hgrow=
"NEVER"
>
<children>
...
...
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/MainWindow.fxml
View file @
a1602768
...
...
@@ -3,7 +3,7 @@
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane
fx:id=
"mainPane"
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
minHeight=
"400.0"
minWidth=
"400.0"
xmlns=
"http://javafx.com/javafx/
22
"
xmlns:fx=
"http://javafx.com/fxml/1"
>
<BorderPane
fx:id=
"mainPane"
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
minHeight=
"400.0"
minWidth=
"400.0"
xmlns=
"http://javafx.com/javafx/
17
"
xmlns:fx=
"http://javafx.com/fxml/1"
>
<center>
<SplitPane
fx:id=
"mainContainer"
dividerPositions=
"0.47069431920649235"
maxHeight=
"1.7976931348623157E308"
maxWidth=
"1.7976931348623157E308"
minWidth=
"300.0"
prefHeight=
"600.0"
prefWidth=
"1100.0"
>
<items>
...
...
CityDoctorParent/Extensions/CityDoctorHealerGUI/pom.xml
View file @
a1602768
<?xml version="1.0" encoding="utf-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
>
<project
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
de.hft.stuttgart
</groupId>
...
...
CityDoctorParent/pom.xml
View file @
a1602768
<?xml version="1.0" encoding="utf-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
>
<project
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorParent
</artifactId>
...
...
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