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
01673d2c
Commit
01673d2c
authored
Nov 08, 2024
by
Riegel
Browse files
Fix checks and methods being applied to transformed geom
parent
3f908256
Changes
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ImplicitGeometryHolder.java
View file @
01673d2c
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
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
de.hft.stuttgart.citydoctor2.math.TransformationMatrix
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.core.model.core.ImplicitGeometry
;
import
org.citygml4j.core.model.core.ImplicitGeometry
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.util.List
;
/**
/**
* Datastructure for representation and resolving of implicit geometries
* Datastructure for representation and resolving of implicit geometries
...
@@ -20,59 +23,80 @@ public class ImplicitGeometryHolder extends Geometry {
...
@@ -20,59 +23,80 @@ public class ImplicitGeometryHolder extends Geometry {
private
static
final
long
serialVersionUID
=
-
8938931081577196349L
;
private
static
final
long
serialVersionUID
=
-
8938931081577196349L
;
private
ImplicitGeometry
cgmlImplicitGeometry
=
null
;
private
ImplicitGeometry
cgmlImplicitGeometry
=
null
;
/*
LibraryObject and RelativeGeometry are mutually exclusive
private
final
PrototypeGeometryType
type
;
*/
private
final
Geometry
prototypeGeometry
;
private
final
LibraryObject
libObject
;
private
final
RelativeGeometry
relativeGeom
;
public
ImplicitGeometryHolder
(
ImplicitGeometry
cgmlImplicitGeometry
,
LibraryObject
libObject
)
{
public
ImplicitGeometryHolder
(
ImplicitGeometry
cgmlImplicitGeometry
,
LibraryObject
libObject
)
{
super
(
libObject
.
getType
(),
libObject
.
getLod
());
super
(
libObject
.
getType
(),
libObject
.
getLod
());
this
.
libObject
=
libObject
;
prototypeGeometry
=
libObject
;
t
his
.
relativeGeom
=
null
;
t
ype
=
PrototypeGeometryType
.
LIBRARY_OBJECT
;
this
.
cgmlImplicitGeometry
=
cgmlImplicitGeometry
;
this
.
cgmlImplicitGeometry
=
cgmlImplicitGeometry
;
applyTransformation
();
applyTransformation
();
}
}
public
ImplicitGeometryHolder
(
ImplicitGeometry
cgmlImplicitGeometry
,
RelativeGeometry
relativeGeometry
)
{
public
ImplicitGeometryHolder
(
ImplicitGeometry
cgmlImplicitGeometry
,
RelativeGeometry
relativeGeometry
)
{
super
(
relativeGeometry
.
getType
(),
relativeGeometry
.
getLod
());
super
(
relativeGeometry
.
getType
(),
relativeGeometry
.
getLod
());
this
.
libObject
=
null
;
prototypeGeometry
=
relativeGeometry
;
t
his
.
relativeGeom
=
relativeGeometry
;
t
ype
=
PrototypeGeometryType
.
RELATIVE_GEOMETRY
;
this
.
cgmlImplicitGeometry
=
cgmlImplicitGeometry
;
this
.
cgmlImplicitGeometry
=
cgmlImplicitGeometry
;
applyTransformation
();
applyTransformation
();
}
}
@Override
public
void
accept
(
Check
c
)
{
/**
* Checks are only run on the referenced prototypical geometry.
*/
if
(
relativeGeom
!=
null
)
{
relativeGeom
.
accept
(
c
);
}
if
(
libObject
!=
null
)
{
libObject
.
accept
(
c
);
}
}
/**
/**
* Applies the transformation matrix of the implicit geometry to a copy of the reference geometry and copies the resulting
* Applies the transformation matrix of the implicit geometry to a copy of the reference geometry and copies the resulting
* transformed geometry into this object.
* transformed geometry into this object.
*/
*/
private
void
applyTransformation
()
{
private
void
applyTransformation
()
{
TransformationMatrix
transformMatrix
=
new
TransformationMatrix
(
cgmlImplicitGeometry
);
TransformationMatrix
transformMatrix
=
new
TransformationMatrix
(
cgmlImplicitGeometry
);
Geometry
refGeo
=
null
;
Geometry
transformedGeom
=
transformMatrix
.
transformGeometry
(
prototypeGeometry
);
if
(
libObject
==
null
)
{
transformedGeom
.
getPolygons
().
forEach
(
this
::
addPolygon
);
refGeo
=
relativeGeom
;
this
.
updateEdgesAndVertices
();
}
else
if
(
relativeGeom
==
null
)
{
refGeo
=
libObject
;
}
}
if
(
refGeo
==
null
)
{
throw
new
NullPointerException
(
"Geometry reference object of ImplicitGeometryHolder is null!"
);
public
PrototypeGeometryType
getPrototypeGeometryType
()
{
return
type
;
}
}
Geometry
transformedGeom
=
transformMatrix
.
transformGeometry
(
refGeo
);
transformedGeom
.
getPolygons
().
forEach
(
this
::
addPolygon
);
@Override
public
void
accept
(
Check
c
)
{
prototypeGeometry
.
accept
(
c
);
}
@Override
public
boolean
containsError
(
CheckId
checkIdentifier
)
{
return
prototypeGeometry
.
containsError
(
checkIdentifier
);
}
@Override
public
void
clearAllContainedCheckResults
()
{
prototypeGeometry
.
clearAllContainedCheckResults
();
}
@Override
public
void
collectContainedErrors
(
List
<
CheckError
>
errors
)
{
prototypeGeometry
.
clearAllContainedCheckResults
();
}
@Override
public
boolean
containsAnyError
()
{
return
prototypeGeometry
.
containsAnyError
();
}
@Override
public
void
prepareForChecking
()
{
this
.
updateEdgesAndVertices
();
this
.
updateEdgesAndVertices
();
prototypeGeometry
.
prepareForChecking
();
}
}
@Override
public
boolean
isValidated
()
{
return
prototypeGeometry
.
isValidated
();
}
public
enum
PrototypeGeometryType
{
LIBRARY_OBJECT
,
RELATIVE_GEOMETRY
}
}
}
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