Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
1bc2d658
Commit
1bc2d658
authored
4 years ago
by
Matthias Betz
Browse files
Options
Download
Email Patches
Plain Diff
implement schematron with different error types
parent
b0f6085c
Pipeline
#1604
failed with stage
in 1 minute and 31 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java
+6
-1
...in/java/de/hft/stuttgart/citydoctor2/check/Checkable.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/ErrorId.java
+4
-0
...main/java/de/hft/stuttgart/citydoctor2/check/ErrorId.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/ErrorVisitor.java
+6
-0
...java/de/hft/stuttgart/citydoctor2/check/ErrorVisitor.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/AttributeMissingError.java
+93
-0
...ttgart/citydoctor2/check/error/AttributeMissingError.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/AttributeValueWrongError.java
+93
-0
...art/citydoctor2/check/error/AttributeValueWrongError.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/SchematronError.java
+34
-9
...ft/stuttgart/citydoctor2/check/error/SchematronError.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java
+5
-3
.../de/hft/stuttgart/citydoctor2/datastructure/Geometry.java
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/GmlElement.java
+0
-9
...e/hft/stuttgart/citydoctor2/datastructure/GmlElement.java
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
+36
-22
...main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/SvrlContentHandler.java
+17
-7
.../hft/stuttgart/citydoctor2/checks/SvrlContentHandler.java
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java
+2
-5
...tuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java
with
296 additions
and
56 deletions
+296
-56
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java
+
6
-
1
View file @
1bc2d658
...
@@ -65,7 +65,12 @@ public abstract class Checkable implements Serializable {
...
@@ -65,7 +65,12 @@ public abstract class Checkable implements Serializable {
* @param c the check from which the check method is called with the Checkable
* @param c the check from which the check method is called with the Checkable
* instance as parameter.
* instance as parameter.
*/
*/
public
abstract
void
accept
(
Check
c
);
public
void
accept
(
Check
c
)
{
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
}
setValidated
(
true
);
}
/**
/**
* The GML-ID of the checkable. This is necessary so specific features can be
* The GML-ID of the checkable. This is necessary so specific features can be
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/ErrorId.java
+
4
-
0
View file @
1bc2d658
...
@@ -101,4 +101,8 @@ public class ErrorId implements Serializable {
...
@@ -101,4 +101,8 @@ public class ErrorId implements Serializable {
return
name
;
return
name
;
}
}
public
String
getIdString
()
{
return
name
;
}
}
}
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/ErrorVisitor.java
+
6
-
0
View file @
1bc2d658
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
de.hft.stuttgart.citydoctor2.check
;
package
de.hft.stuttgart.citydoctor2.check
;
import
de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError
;
import
de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError
;
import
de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError
;
import
de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError
;
import
de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError
;
import
de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError
;
import
de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError
;
import
de.hft.stuttgart.citydoctor2.check.error.DependenciesNotMetError
;
import
de.hft.stuttgart.citydoctor2.check.error.MultipleConnectedComponentsError
;
import
de.hft.stuttgart.citydoctor2.check.error.MultipleConnectedComponentsError
;
...
@@ -122,5 +124,9 @@ public interface ErrorVisitor {
...
@@ -122,5 +124,9 @@ public interface ErrorVisitor {
public
void
visit
(
SurfaceUnfragmentedError
err
);
public
void
visit
(
SurfaceUnfragmentedError
err
);
public
void
visit
(
TinyEdgeError
err
);
public
void
visit
(
TinyEdgeError
err
);
public
void
visit
(
AttributeMissingError
err
);
public
void
visit
(
AttributeValueWrongError
err
);
}
}
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/AttributeMissingError.java
0 → 100644
+
93
-
0
View file @
1bc2d658
/*-
* 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.check.error
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
import
de.hft.stuttgart.citydoctor2.check.ErrorType
;
import
de.hft.stuttgart.citydoctor2.check.ErrorVisitor
;
import
de.hft.stuttgart.citydoctor2.check.HealingMethod
;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
public
class
AttributeMissingError
implements
CheckError
{
private
static
final
long
serialVersionUID
=
185026674309965067L
;
public
static
final
ErrorId
ID
=
new
ErrorId
(
"SEM_ATTRIBUTE_MISSING"
);
private
CityObject
co
;
private
boolean
generic
;
private
String
childId
;
private
String
nameOfAttribute
;
public
AttributeMissingError
(
CityObject
co
,
String
childId
,
String
nameOfAttribute
,
boolean
generic
)
{
this
.
co
=
co
;
this
.
childId
=
childId
;
this
.
nameOfAttribute
=
nameOfAttribute
;
this
.
generic
=
generic
;
}
@Override
public
ErrorType
getType
()
{
return
ErrorType
.
ERROR
;
}
@Override
public
ErrorId
getErrorId
()
{
return
ID
;
}
public
String
getChildId
()
{
return
childId
;
}
public
boolean
isGeneric
()
{
return
generic
;
}
public
String
getNameOfAttribute
()
{
return
nameOfAttribute
;
}
@Override
public
GmlElement
getFeature
()
{
return
co
;
}
@Override
public
void
accept
(
ErrorVisitor
errorVisitor
)
{
errorVisitor
.
visit
(
this
);
}
@Override
public
boolean
accept
(
HealingMethod
method
,
ModificationListener
l
)
{
return
method
.
visit
(
this
,
l
);
}
@Override
public
void
report
(
ErrorReport
report
)
{
report
.
add
(
"childId"
,
childId
);
report
.
add
(
"name"
,
nameOfAttribute
);
report
.
add
(
"generic"
,
""
+
generic
);
}
}
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/AttributeValueWrongError.java
0 → 100644
+
93
-
0
View file @
1bc2d658
/*-
* 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.check.error
;
import
de.hft.stuttgart.citydoctor2.check.CheckError
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorReport
;
import
de.hft.stuttgart.citydoctor2.check.ErrorType
;
import
de.hft.stuttgart.citydoctor2.check.ErrorVisitor
;
import
de.hft.stuttgart.citydoctor2.check.HealingMethod
;
import
de.hft.stuttgart.citydoctor2.check.ModificationListener
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
public
class
AttributeValueWrongError
implements
CheckError
{
private
static
final
long
serialVersionUID
=
6106964709204961560L
;
public
static
final
ErrorId
ID
=
new
ErrorId
(
"SEM_ATTRIBUTE_WRONG_VALUE"
);
private
CityObject
co
;
private
boolean
generic
;
private
String
childId
;
private
String
nameOfAttribute
;
public
AttributeValueWrongError
(
CityObject
co
,
String
childId
,
String
nameOfAttribute
,
boolean
generic
)
{
this
.
co
=
co
;
this
.
childId
=
childId
;
this
.
nameOfAttribute
=
nameOfAttribute
;
this
.
generic
=
generic
;
}
@Override
public
ErrorType
getType
()
{
return
ErrorType
.
ERROR
;
}
@Override
public
ErrorId
getErrorId
()
{
return
ID
;
}
@Override
public
GmlElement
getFeature
()
{
return
co
;
}
public
String
getChildId
()
{
return
childId
;
}
public
boolean
isGeneric
()
{
return
generic
;
}
public
String
getNameOfAttribute
()
{
return
nameOfAttribute
;
}
@Override
public
void
accept
(
ErrorVisitor
errorVisitor
)
{
errorVisitor
.
visit
(
this
);
}
@Override
public
boolean
accept
(
HealingMethod
method
,
ModificationListener
l
)
{
return
method
.
visit
(
this
,
l
);
}
@Override
public
void
report
(
ErrorReport
report
)
{
report
.
add
(
"childId"
,
childId
);
report
.
add
(
"name"
,
nameOfAttribute
);
report
.
add
(
"generic"
,
""
+
generic
);
}
}
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/SchematronError.java
+
34
-
9
View file @
1bc2d658
...
@@ -31,10 +31,19 @@ public class SchematronError implements CheckError {
...
@@ -31,10 +31,19 @@ public class SchematronError implements CheckError {
private
static
final
long
serialVersionUID
=
-
2964084500589868928L
;
private
static
final
long
serialVersionUID
=
-
2964084500589868928L
;
private
String
text
;
private
String
errorId
;
private
String
gmlId
;
private
String
childId
;
private
String
nameOfAttribute
;
private
boolean
generic
;
public
SchematronError
(
String
text
)
{
this
.
text
=
text
;
public
SchematronError
(
String
errorId
,
String
gmlId
,
String
childId
,
String
nameOfAttribute
,
boolean
generic
)
{
this
.
errorId
=
errorId
;
this
.
gmlId
=
gmlId
;
this
.
childId
=
childId
;
this
.
nameOfAttribute
=
nameOfAttribute
;
this
.
generic
=
generic
;
}
}
@Override
@Override
...
@@ -49,18 +58,34 @@ public class SchematronError implements CheckError {
...
@@ -49,18 +58,34 @@ public class SchematronError implements CheckError {
@Override
@Override
public
void
report
(
ErrorReport
report
)
{
public
void
report
(
ErrorReport
report
)
{
report
.
add
(
"
Description"
,
text
);
report
.
add
(
"
errorId"
,
errorId
);
}
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"SchematronError [text="
+
text
+
"]"
;
return
"SchematronError [text="
+
errorId
+
"]"
;
}
}
public
String
get
Text
()
{
public
String
get
ChildId
()
{
return
text
;
return
childId
;
}
}
public
String
getGmlId
()
{
return
gmlId
;
}
public
String
getNameOfAttribute
()
{
return
nameOfAttribute
;
}
public
String
getErrorIdString
()
{
return
errorId
;
}
public
boolean
isGeneric
()
{
return
generic
;
}
@Override
@Override
public
ErrorType
getType
()
{
public
ErrorType
getType
()
{
return
ErrorType
.
ERROR
;
return
ErrorType
.
ERROR
;
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java
+
5
-
3
View file @
1bc2d658
...
@@ -413,11 +413,13 @@ public class Geometry extends GmlElement {
...
@@ -413,11 +413,13 @@ public class Geometry extends GmlElement {
@Override
@Override
public
void
clearMetaInformation
()
{
public
void
clearMetaInformation
()
{
for
(
Vertex
v
:
vertices
)
{
if
(
vertices
!=
null
)
{
v
.
clearAdjacentRings
();
for
(
Vertex
v
:
vertices
)
{
v
.
clearAdjacentRings
();
}
vertices
=
null
;
}
}
edges
=
null
;
edges
=
null
;
vertices
=
null
;
edgeMap
=
null
;
edgeMap
=
null
;
}
}
}
}
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/GmlElement.java
+
0
-
9
View file @
1bc2d658
...
@@ -25,7 +25,6 @@ import java.io.ObjectInputStream;
...
@@ -25,7 +25,6 @@ import java.io.ObjectInputStream;
import
java.io.ObjectOutputStream
;
import
java.io.ObjectOutputStream
;
import
java.io.UncheckedIOException
;
import
java.io.UncheckedIOException
;
import
de.hft.stuttgart.citydoctor2.check.Check
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
import
de.hft.stuttgart.citydoctor2.check.Checkable
;
/**
/**
...
@@ -54,14 +53,6 @@ public abstract class GmlElement extends Checkable {
...
@@ -54,14 +53,6 @@ public abstract class GmlElement extends Checkable {
}
}
}
}
@Override
public
void
accept
(
Check
c
)
{
if
(
c
.
canExecute
(
this
))
{
c
.
check
(
this
);
}
setValidated
(
true
);
}
public
void
setGmlId
(
GmlId
id
)
{
public
void
setGmlId
(
GmlId
id
)
{
gmlId
=
id
;
gmlId
=
id
;
}
}
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
+
36
-
22
View file @
1bc2d658
...
@@ -47,13 +47,13 @@ import org.apache.logging.log4j.LogManager;
...
@@ -47,13 +47,13 @@ import org.apache.logging.log4j.LogManager;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Document
;
import
de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError
;
import
de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError
;
import
de.hft.stuttgart.citydoctor2.check.error.SchematronError
;
import
de.hft.stuttgart.citydoctor2.check.error.SchematronError
;
import
de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException
;
import
de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.checks.SvrlContentHandler
;
import
de.hft.stuttgart.citydoctor2.checks.SvrlContentHandler
;
import
de.hft.stuttgart.citydoctor2.checks.util.FeatureCheckedListener
;
import
de.hft.stuttgart.citydoctor2.checks.util.FeatureCheckedListener
;
import
de.hft.stuttgart.citydoctor2.datastructure.Building
;
import
de.hft.stuttgart.citydoctor2.datastructure.BuildingPart
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.CityObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.FeatureType
;
import
de.hft.stuttgart.citydoctor2.datastructure.FeatureType
;
...
@@ -111,7 +111,7 @@ public class Checker {
...
@@ -111,7 +111,7 @@ public class Checker {
public
Checks
getChecks
()
{
public
Checks
getChecks
()
{
return
checkConfig
;
return
checkConfig
;
}
}
public
CityDoctorModel
getModel
()
{
public
CityDoctorModel
getModel
()
{
return
model
;
return
model
;
}
}
...
@@ -187,36 +187,47 @@ public class Checker {
...
@@ -187,36 +187,47 @@ public class Checker {
SvrlContentHandler
handler
=
executeSchematronValidationIfAvailable
(
config
,
model
.
getFile
());
SvrlContentHandler
handler
=
executeSchematronValidationIfAvailable
(
config
,
model
.
getFile
());
if
(
handler
!=
null
)
{
if
(
handler
!=
null
)
{
model
.
addGlobalErrors
(
handler
.
getGeneralErrors
());
model
.
addGlobalErrors
(
handler
.
getGeneralErrors
());
Map
<
String
,
C
heckable
>
featureMap
=
new
HashMap
<>();
Map
<
String
,
C
ityObject
>
featureMap
=
new
HashMap
<>();
model
.
createFeatureStream
().
forEach
(
f
->
featureMap
.
put
(
f
.
getGmlId
().
getGmlString
(),
f
));
model
.
createFeatureStream
().
forEach
(
f
->
featureMap
.
put
(
f
.
getGmlId
().
getGmlString
(),
f
));
for
(
Building
b
:
model
.
getBuildings
())
{
for
(
BuildingPart
bp
:
b
.
getBuildingParts
())
{
featureMap
.
put
(
bp
.
getGmlId
().
getGmlString
(),
bp
);
}
}
handler
.
getFeatureErrors
().
forEach
((
k
,
v
)
->
{
handler
.
getFeatureErrors
().
forEach
((
k
,
v
)
->
{
if
(
k
.
trim
().
isEmpty
())
{
if
(
k
.
trim
().
isEmpty
())
{
// missing gml id, ignore?
// missing gml id, ignore?
return
;
return
;
}
}
C
heckable
checkable
=
featureMap
.
get
(
k
);
C
ityObject
co
=
featureMap
.
get
(
k
);
if
(
c
heckable
==
null
)
{
if
(
c
o
==
null
)
{
// gml id reported by schematron was not found, add to general errors
// gml id reported by schematron was not found, add to general errors
model
.
addGlobalError
(
v
);
for
(
SchematronError
se
:
v
)
{
model
.
addGlobalError
(
se
);
}
}
else
{
}
else
{
checkable
.
addCheckResult
(
new
CheckResult
(
CheckId
.
C_SEM_SCHEMATRON
,
ResultStatus
.
ERROR
,
v
));
int
count
=
0
;
for
(
SchematronError
se
:
v
)
{
CheckError
err
;
if
(
AttributeMissingError
.
ID
.
getIdString
().
equals
(
se
.
getErrorIdString
()))
{
err
=
new
AttributeMissingError
(
co
,
se
.
getChildId
(),
se
.
getNameOfAttribute
(),
se
.
isGeneric
());
}
else
if
(
AttributeValueWrongError
.
ID
.
getIdString
().
equals
(
se
.
getErrorIdString
()))
{
err
=
new
AttributeValueWrongError
(
co
,
se
.
getChildId
(),
se
.
getNameOfAttribute
(),
se
.
isGeneric
());
}
else
{
throw
new
IllegalStateException
(
"Unknown error ID was given in schematron file: "
+
se
.
getErrorIdString
());
}
co
.
addCheckResult
(
new
CheckResult
(
new
CheckId
(
""
+
count
),
ResultStatus
.
ERROR
,
err
));
count
++;
}
}
}
});
});
}
}
isValidated
=
true
;
isValidated
=
true
;
}
}
public
ValidationConfiguration
getConfig
()
{
public
ValidationConfiguration
getConfig
()
{
return
config
;
return
config
;
}
}
public
static
SvrlContentHandler
executeSchematronValidationIfAvailable
(
ValidationConfiguration
config
,
public
static
SvrlContentHandler
executeSchematronValidationIfAvailable
(
ValidationConfiguration
config
,
File
file
)
{
File
file
)
{
if
(
config
.
getSchematronFilePath
()
!=
null
&&
!
config
.
getSchematronFilePath
().
isEmpty
())
{
if
(
config
.
getSchematronFilePath
()
!=
null
&&
!
config
.
getSchematronFilePath
().
isEmpty
())
{
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
Localization
.
getText
(
"Checker.schematronValidation"
));
logger
.
info
(
Localization
.
getText
(
"Checker.schematronValidation"
));
...
@@ -372,7 +383,7 @@ public class Checker {
...
@@ -372,7 +383,7 @@ public class Checker {
}
}
// check every feature
// check every feature
executeChecksForCityObject
(
co
);
executeChecksForCityObject
(
co
);
if
(
config
.
getParserConfiguration
().
useLowMemoryConsumption
())
{
if
(
config
.
getParserConfiguration
().
useLowMemoryConsumption
())
{
// low memory consumption, remove edges again
// low memory consumption, remove edges again
co
.
clearMetaInformation
();
co
.
clearMetaInformation
();
...
@@ -448,10 +459,10 @@ public class Checker {
...
@@ -448,10 +459,10 @@ public class Checker {
public
static
List
<
List
<
Check
>>
buildExecutionLayers
(
List
<
Check
>
checks
)
{
public
static
List
<
List
<
Check
>>
buildExecutionLayers
(
List
<
Check
>
checks
)
{
List
<
List
<
Check
>>
result
=
new
ArrayList
<>();
List
<
List
<
Check
>>
result
=
new
ArrayList
<>();
Set
<
Check
>
availableChecks
=
new
HashSet
<>(
checks
);
Set
<
Check
>
availableChecks
=
new
HashSet
<>(
checks
);
Set
<
CheckId
>
usedChecks
=
new
HashSet
<>();
Set
<
CheckId
>
usedChecks
=
new
HashSet
<>();
while
(!
availableChecks
.
isEmpty
())
{
while
(!
availableChecks
.
isEmpty
())
{
List
<
Check
>
layer
=
new
ArrayList
<>();
List
<
Check
>
layer
=
new
ArrayList
<>();
Iterator
<
Check
>
iterator
=
availableChecks
.
iterator
();
Iterator
<
Check
>
iterator
=
availableChecks
.
iterator
();
...
@@ -464,7 +475,8 @@ public class Checker {
...
@@ -464,7 +475,8 @@ public class Checker {
}
}
}
}
if
(
layer
.
isEmpty
())
{
if
(
layer
.
isEmpty
())
{
throw
new
IllegalStateException
(
"There are checks that have dependencies that are not executed or are unknown"
);
throw
new
IllegalStateException
(
"There are checks that have dependencies that are not executed or are unknown"
);
}
}
result
.
add
(
layer
);
result
.
add
(
layer
);
for
(
Check
c
:
layer
)
{
for
(
Check
c
:
layer
)
{
...
@@ -526,8 +538,10 @@ public class Checker {
...
@@ -526,8 +538,10 @@ public class Checker {
for
(
SchematronError
err
:
handler
.
getGeneralErrors
())
{
for
(
SchematronError
err
:
handler
.
getGeneralErrors
())
{
reporter
.
reportGlobalError
(
err
);
reporter
.
reportGlobalError
(
err
);
}
}
for
(
Entry
<
String
,
SchematronError
>
e
:
handler
.
getFeatureErrors
().
entrySet
())
{
for
(
Entry
<
String
,
List
<
SchematronError
>>
e
:
handler
.
getFeatureErrors
().
entrySet
())
{
reporter
.
addError
(
e
.
getKey
(),
e
.
getValue
());
for
(
SchematronError
se
:
e
.
getValue
())
{
reporter
.
addError
(
e
.
getKey
(),
se
);
}
}
}
}
}
reporter
.
finishReport
();
reporter
.
finishReport
();
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/checks/SvrlContentHandler.java
+
17
-
7
View file @
1bc2d658
...
@@ -45,7 +45,7 @@ public class SvrlContentHandler implements ContentHandler {
...
@@ -45,7 +45,7 @@ public class SvrlContentHandler implements ContentHandler {
private
StringBuilder
buffer
;
private
StringBuilder
buffer
;
private
Map
<
String
,
SchematronError
>
featureErrors
;
private
Map
<
String
,
List
<
SchematronError
>
>
featureErrors
;
private
List
<
SchematronError
>
generalErrors
;
private
List
<
SchematronError
>
generalErrors
;
public
SvrlContentHandler
()
{
public
SvrlContentHandler
()
{
...
@@ -53,7 +53,7 @@ public class SvrlContentHandler implements ContentHandler {
...
@@ -53,7 +53,7 @@ public class SvrlContentHandler implements ContentHandler {
generalErrors
=
new
ArrayList
<>();
generalErrors
=
new
ArrayList
<>();
}
}
public
Map
<
String
,
SchematronError
>
getFeatureErrors
()
{
public
Map
<
String
,
List
<
SchematronError
>
>
getFeatureErrors
()
{
return
featureErrors
;
return
featureErrors
;
}
}
...
@@ -104,13 +104,23 @@ public class SvrlContentHandler implements ContentHandler {
...
@@ -104,13 +104,23 @@ public class SvrlContentHandler implements ContentHandler {
// not needed
// not needed
if
(
nextIsTextContent
&&
"text"
.
equals
(
localName
))
{
if
(
nextIsTextContent
&&
"text"
.
equals
(
localName
))
{
String
text
=
buffer
.
toString
();
String
text
=
buffer
.
toString
();
int
index
=
text
.
indexOf
(
": "
);
String
[]
split
=
text
.
split
(
"\\|\\|"
);
if
(
index
==
-
1
)
{
if
(
split
.
length
!=
5
)
{
throw
new
IllegalStateException
(
"Schematron File is not formed according to specification for CityDoctor."
);
}
String
gmlId
=
split
[
0
];
String
childId
=
split
[
1
];
String
errorId
=
split
[
2
];
String
nameOfAttribute
=
split
[
3
];
boolean
generic
=
Boolean
.
parseBoolean
(
split
[
4
]);
SchematronError
err
=
new
SchematronError
(
errorId
,
gmlId
,
childId
,
nameOfAttribute
,
generic
);
if
(
gmlId
==
null
||
gmlId
.
isEmpty
())
{
// general error
// general error
generalErrors
.
add
(
new
SchematronError
(
text
)
);
generalErrors
.
add
(
err
);
}
else
{
}
else
{
String
gmlId
=
text
.
substring
(
0
,
index
);
List
<
SchematronError
>
errors
=
featureErrors
.
computeIfAbsent
(
gmlId
,
k
->
new
ArrayList
<>()
);
featureErrors
.
put
(
gmlId
,
new
SchematronError
(
text
)
);
errors
.
add
(
err
);
}
}
buffer
=
null
;
buffer
=
null
;
nextIsTextContent
=
false
;
nextIsTextContent
=
false
;
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java
+
2
-
5
View file @
1bc2d658
...
@@ -39,7 +39,6 @@ import de.hft.stuttgart.citydoctor2.check.CheckResult;
...
@@ -39,7 +39,6 @@ import de.hft.stuttgart.citydoctor2.check.CheckResult;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ErrorId
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.ResultStatus
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.check.error.SchematronError
;
import
de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException
;
import
de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeObject
;
import
de.hft.stuttgart.citydoctor2.datastructure.BridgeObject
;
...
@@ -445,10 +444,8 @@ public class PdfStreamReporter implements StreamReporter {
...
@@ -445,10 +444,8 @@ public class PdfStreamReporter implements StreamReporter {
String
text
=
"Global error "
+
err
.
getErrorId
();
String
text
=
"Global error "
+
err
.
getErrorId
();
globalErrors
.
add10PtTextElement
(
text
,
10
);
globalErrors
.
add10PtTextElement
(
text
,
10
);
if
(
err
instanceof
SchematronError
)
{
PdfErrorHandler
handler
=
new
PdfErrorHandler
(
globalErrors
,
config
.
getParserConfiguration
());
text
=
((
SchematronError
)
err
).
getText
();
err
.
report
(
handler
);
globalErrors
.
add10PtTextElement
(
text
,
20
);
}
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets