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
a66db57b
Commit
a66db57b
authored
Feb 10, 2021
by
Matthias Betz
Browse files
renamed tiny edge error to degenerated edge error
parent
2f04eb81
Pipeline
#1972
failed with stage
in 40 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/ErrorVisitor.java
View file @
a66db57b
...
...
@@ -48,7 +48,7 @@ import de.hft.stuttgart.citydoctor2.check.error.SchematronError;
import
de.hft.stuttgart.citydoctor2.check.error.SolidNotClosedError
;
import
de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError
;
import
de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError
;
import
de.hft.stuttgart.citydoctor2.check.error.
TinyEdge
Error
;
import
de.hft.stuttgart.citydoctor2.check.error.
DegeneratedPolygon
Error
;
import
de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError
;
import
de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError
;
...
...
@@ -123,7 +123,7 @@ public interface ErrorVisitor {
public
void
visit
(
SurfaceUnfragmentedError
err
);
public
void
visit
(
TinyEdge
Error
err
);
public
void
visit
(
DegeneratedPolygon
Error
err
);
public
void
visit
(
AttributeMissingError
err
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/HealingMethod.java
View file @
a66db57b
...
...
@@ -46,7 +46,7 @@ import de.hft.stuttgart.citydoctor2.check.error.SchematronError;
import
de.hft.stuttgart.citydoctor2.check.error.SolidNotClosedError
;
import
de.hft.stuttgart.citydoctor2.check.error.SolidSelfIntError
;
import
de.hft.stuttgart.citydoctor2.check.error.SurfaceUnfragmentedError
;
import
de.hft.stuttgart.citydoctor2.check.error.
TinyEdge
Error
;
import
de.hft.stuttgart.citydoctor2.check.error.
DegeneratedPolygon
Error
;
import
de.hft.stuttgart.citydoctor2.check.error.TooFewPolygonsError
;
import
de.hft.stuttgart.citydoctor2.check.error.UnknownCheckError
;
...
...
@@ -64,7 +64,7 @@ public interface HealingMethod {
return
false
;
}
default
boolean
visit
(
TinyEdge
Error
e
,
ModificationListener
l
)
{
default
boolean
visit
(
DegeneratedPolygon
Error
e
,
ModificationListener
l
)
{
return
false
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/
TinyEdge
Error.java
→
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/
DegeneratedPolygon
Error.java
View file @
a66db57b
...
...
@@ -28,13 +28,13 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
public
class
TinyEdge
Error
implements
CheckError
{
public
class
DegeneratedPolygon
Error
implements
CheckError
{
private
static
final
long
serialVersionUID
=
865493182529055651L
;
private
Polygon
p
;
public
TinyEdge
Error
(
Polygon
p
)
{
public
DegeneratedPolygon
Error
(
Polygon
p
)
{
this
.
p
=
p
;
}
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModel.java
View file @
a66db57b
...
...
@@ -25,6 +25,7 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.ServiceLoader
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
...
@@ -34,6 +35,8 @@ import org.citygml4j.CityGMLContext;
import
org.citygml4j.builder.jaxb.CityGMLBuilder
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.factory.GMLGeometryFactory
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.model.citygml.ade.binding.ADEContext
;
import
org.citygml4j.model.citygml.core.CityModel
;
import
org.citygml4j.model.citygml.core.CityObjectMember
;
import
org.citygml4j.model.module.citygml.CityGMLVersion
;
...
...
@@ -123,8 +126,14 @@ public class CityDoctorModel {
water
.
stream
()).
flatMap
(
co
->
co
);
}
public
void
saveAs
(
String
file
)
throws
CityGMLBuilderException
,
CityGMLWriteException
{
public
void
saveAs
(
String
file
)
throws
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
CityGMLContext
gmlContext
=
CityGMLContext
.
getInstance
();
// setup energy ade stuff, so the parser doesn't crash on encountering this
if
(!
gmlContext
.
hasADEContexts
())
{
for
(
ADEContext
adeContext
:
ServiceLoader
.
load
(
ADEContext
.
class
))
{
gmlContext
.
registerADEContext
(
adeContext
);
}
}
CityGMLBuilder
builder
=
gmlContext
.
createCityGMLBuilder
();
CityGMLOutputFactory
factory
=
builder
.
createCityGMLOutputFactory
();
try
(
CityGMLWriter
writer
=
factory
.
createCityGMLWriter
(
new
File
(
file
)))
{
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/CityDoctorValidation.java
View file @
a66db57b
...
...
@@ -26,6 +26,7 @@ import java.util.List;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.xml.io.writer.CityGMLWriteException
;
import
de.hft.stuttgart.citydoctor2.check.Checker
;
...
...
@@ -64,8 +65,9 @@ public class CityDoctorValidation {
* the cityGML schema.
* @throws CityGMLWriteException
* @throws CityGMLBuilderException
* @throws ADEException
*/
public
static
void
main
(
String
[]
args
)
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
{
public
static
void
main
(
String
[]
args
)
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
ArgumentParser
argParser
=
new
ArgumentParser
(
args
);
String
inputFile
=
getInputFile
(
argParser
);
String
xmlOutput
=
getXmlOutput
(
argParser
);
...
...
@@ -107,9 +109,10 @@ public class CityDoctorValidation {
* happens.
* @throws InvalidGmlFileException If the cityGML file is not valid according to
* the cityGML schema.
* @throws ADEException
*/
public
static
void
validate
(
File
inputFile
,
File
xmlOutput
,
File
pdfOutput
)
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
ADEException
{
validate
(
inputFile
,
xmlOutput
,
pdfOutput
,
null
);
}
...
...
@@ -126,9 +129,10 @@ public class CityDoctorValidation {
* happens.
* @throws InvalidGmlFileException If the cityGML file is not valid according to
* the cityGML schema.
* @throws ADEException
*/
public
static
void
validate
(
File
inputFile
,
File
xmlOutput
,
File
pdfOutput
,
File
validationConfigFile
)
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
{
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
ADEException
{
ValidationConfiguration
config
;
if
(
validationConfigFile
==
null
)
{
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
...
...
@@ -166,10 +170,11 @@ public class CityDoctorValidation {
* @throws CityGMLWriteException if something goes wrong while writing the gml
* file
* @throws CityGMLBuilderException
* @throws ADEException
*/
public
static
void
startValidationProcess
(
File
inputFile
,
String
xmlOutput
,
String
pdfOutput
,
ValidationConfiguration
config
,
String
outputFile
)
throws
IOException
,
CityGmlParseException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
{
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
if
(
config
.
isUseStreaming
())
{
Checker
.
streamCheck
(
inputFile
,
xmlOutput
,
pdfOutput
,
config
,
outputFile
);
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/geometry/PlanarCheck.java
View file @
a66db57b
...
...
@@ -34,7 +34,7 @@ import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import
de.hft.stuttgart.citydoctor2.check.Unit
;
import
de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonDistancePlaneError
;
import
de.hft.stuttgart.citydoctor2.check.error.NonPlanarPolygonNormalsDeviation
;
import
de.hft.stuttgart.citydoctor2.check.error.
TinyEdge
Error
;
import
de.hft.stuttgart.citydoctor2.check.error.
DegeneratedPolygon
Error
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
...
...
@@ -59,7 +59,7 @@ public class PlanarCheck extends Check {
private
static
final
String
DISTANCE_TOLERANCE
=
"distanceTolerance"
;
private
static
final
String
ANGLE_TOLERANCE
=
"angleTolerance"
;
private
static
final
String
TYPE
=
"type"
;
private
static
final
String
TINY_EDGE_TOLERANCE
=
"tinyEdge
Tolerance"
;
private
static
final
String
DEGENERATED_POLYGON_TOLERANCE
=
"degeneratedPolygon
Tolerance"
;
private
static
final
List
<
CheckId
>
dependencies
;
private
static
final
List
<
DefaultParameter
>
defaultParameters
;
...
...
@@ -76,7 +76,7 @@ public class PlanarCheck extends Check {
defParameters
.
add
(
new
DefaultParameter
(
TYPE
,
DISTANCE
,
Unit
.
NONE
));
defParameters
.
add
(
new
DefaultParameter
(
DISTANCE_TOLERANCE
,
"0.01"
,
Unit
.
METER
));
defParameters
.
add
(
new
DefaultParameter
(
ANGLE_TOLERANCE
,
"1"
,
Unit
.
DEGREE
));
defParameters
.
add
(
new
DefaultParameter
(
TINY_EDGE
_TOLERANCE
,
"0.00000"
,
Unit
.
METER
));
defParameters
.
add
(
new
DefaultParameter
(
DEGENERATED_POLYGON
_TOLERANCE
,
"0.00000"
,
Unit
.
METER
));
defaultParameters
=
Collections
.
unmodifiableList
(
defParameters
);
}
...
...
@@ -85,29 +85,21 @@ public class PlanarCheck extends Check {
private
double
rad
=
Math
.
toRadians
(
1
);
private
double
delta
=
0.01
;
private
double
tinyEdge
Tolerance
=
0.00000
;
private
double
degeneratedPolygon
Tolerance
=
0.00000
;
@Override
public
void
init
(
Map
<
String
,
String
>
parameters
,
ParserConfiguration
config
)
{
if
(
parameters
.
containsKey
(
TYPE
))
{
planarCheckType
=
parameters
.
get
(
TYPE
).
toLowerCase
();
}
else
{
planarCheckType
=
DISTANCE
;
}
if
(
parameters
.
containsKey
(
ANGLE_TOLERANCE
))
{
rad
=
Math
.
toRadians
(
Double
.
parseDouble
(
parameters
.
get
(
ANGLE_TOLERANCE
)));
}
else
{
rad
=
Math
.
toRadians
(
1
);
}
if
(
parameters
.
containsKey
(
DISTANCE_TOLERANCE
))
{
delta
=
Double
.
parseDouble
(
parameters
.
get
(
DISTANCE_TOLERANCE
));
}
else
{
delta
=
0.01
;
}
if
(
parameters
.
containsKey
(
TINY_EDGE_TOLERANCE
))
{
tinyEdgeTolerance
=
Double
.
parseDouble
(
parameters
.
get
(
TINY_EDGE_TOLERANCE
));
}
else
{
tinyEdgeTolerance
=
0.00002
;
if
(
parameters
.
containsKey
(
DEGENERATED_POLYGON_TOLERANCE
))
{
degeneratedPolygonTolerance
=
Double
.
parseDouble
(
parameters
.
get
(
DEGENERATED_POLYGON_TOLERANCE
));
}
}
...
...
@@ -231,12 +223,12 @@ public class PlanarCheck extends Check {
private
boolean
checkEigenvalues
(
Polygon
p
,
Vector3d
eigenvalues
)
{
int
nrOfEigenvaluesBelowTolerance
=
0
;
for
(
double
d
:
eigenvalues
.
getCoordinates
())
{
if
(
d
<=
tinyEdge
Tolerance
)
{
if
(
d
<=
degeneratedPolygon
Tolerance
)
{
nrOfEigenvaluesBelowTolerance
++;
}
}
if
(
nrOfEigenvaluesBelowTolerance
>=
2
)
{
CheckError
err
=
new
TinyEdge
Error
(
p
);
CheckError
err
=
new
DegeneratedPolygon
Error
(
p
);
p
.
addCheckResult
(
new
CheckResult
(
this
,
ResultStatus
.
ERROR
,
err
));
return
true
;
}
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/check/CheckerTest.java
View file @
a66db57b
...
...
@@ -25,6 +25,7 @@ import java.io.File;
import
java.io.IOException
;
import
org.citygml4j.builder.jaxb.CityGMLBuilderException
;
import
org.citygml4j.model.citygml.ade.ADEException
;
import
org.citygml4j.xml.io.writer.CityGMLWriteException
;
import
org.junit.Rule
;
import
org.junit.Test
;
...
...
@@ -70,7 +71,7 @@ public class CheckerTest {
@Test
public
void
testChecker
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
{
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
File
f
=
folder
.
newFile
();
File
f2
=
folder
.
newFile
();
...
...
@@ -93,7 +94,7 @@ public class CheckerTest {
@Test
public
void
testStreaming
()
throws
CityGmlParseException
,
IOException
,
InvalidGmlFileException
,
CityGMLBuilderException
,
CityGMLWriteException
{
CityGMLBuilderException
,
CityGMLWriteException
,
ADEException
{
File
f
=
folder
.
newFile
();
File
f2
=
folder
.
newFile
();
File
f3
=
folder
.
newFile
();
...
...
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