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
a0ff9ed7
Commit
a0ff9ed7
authored
Nov 30, 2020
by
Matthias Betz
Browse files
Added check plugin system
parent
0a7d6299
Pipeline
#1380
passed with stage
in 2 minutes and 13 seconds
Changes
71
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Check.java
View file @
a0ff9ed7
...
...
@@ -18,6 +18,8 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -61,10 +63,19 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
*/
public
abstract
class
Check
{
private
CheckId
id
;
private
List
<
Class
<
Checkable
>>
applicableToClasses
=
new
ArrayList
<>(
2
)
;
public
Check
(
CheckId
id
)
{
this
.
id
=
id
;
@SuppressWarnings
(
"unchecked"
)
public
Check
()
{
Method
[]
declaredMethods
=
getClass
().
getDeclaredMethods
();
for
(
Method
m
:
declaredMethods
)
{
if
(
"check"
.
equals
(
m
.
getName
()))
{
Class
<?>[]
parameterTypes
=
m
.
getParameterTypes
();
if
(
parameterTypes
.
length
==
1
&&
Checkable
.
class
.
isAssignableFrom
(
parameterTypes
[
0
]))
{
applicableToClasses
.
add
((
Class
<
Checkable
>)
parameterTypes
[
0
]);
}
}
}
}
/**
...
...
@@ -72,7 +83,9 @@ public abstract class Check {
*
* @return a list of classes which the check applies to
*/
public
abstract
List
<
Class
<?
extends
Checkable
>>
getApplicableToClasses
();
public
List
<
Class
<
Checkable
>>
getApplicableToClasses
()
{
return
applicableToClasses
;
}
/**
* A list of dependencies which the check depends on. Each of those dependencies
...
...
@@ -90,9 +103,7 @@ public abstract class Check {
*
* @return the check id.
*/
public
CheckId
getCheckId
()
{
return
id
;
}
public
abstract
CheckId
getCheckId
();
/**
* Getter for the check type.
...
...
@@ -123,10 +134,10 @@ public abstract class Check {
boolean
hasError
=
c
.
containsError
(
dependencyCheck
);
if
(
hasError
)
{
// check whether a result was already inserted
if
(!
c
.
hasDependencyNotMetError
(
id
))
{
if
(!
c
.
hasDependencyNotMetError
(
getCheckId
()
))
{
// insert dependency error
CheckError
err
=
new
DependenciesNotMetError
(
dependencyCheck
);
CheckResult
cr
=
new
CheckResult
(
this
.
id
,
ResultStatus
.
DEPENDENCIES_NOT_MET
,
err
);
CheckResult
cr
=
new
CheckResult
(
getCheckId
()
,
ResultStatus
.
DEPENDENCIES_NOT_MET
,
err
);
c
.
addCheckResult
(
cr
);
}
return
false
;
...
...
@@ -306,7 +317,7 @@ public abstract class Check {
@Override
public
String
toString
()
{
return
"Check [id="
+
id
+
"]"
;
return
"Check [id="
+
getCheckId
()
+
"]"
;
}
/**
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/CheckError.java
View file @
a0ff9ed7
...
...
@@ -19,7 +19,6 @@
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serializable
;
import
java.util.Objects
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
...
...
@@ -32,56 +31,29 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
* @author Matthias Betz
*
*/
public
abstract
class
CheckError
implem
en
t
s
Serializable
{
public
interface
CheckError
ext
en
d
s
Serializable
{
private
static
final
long
serialVersionUID
=
-
4428235366383090704L
;
private
ErrorType
type
;
private
ErrorId
id
;
private
GmlElement
feature
;
/**
* Necessary information for every error type needs to be provided in this
* constructor.
*
* @param id the error id (not null)
* @param type the error type (not null)
* @param feature element in which the error occurred
*/
public
CheckError
(
ErrorId
id
,
ErrorType
type
,
GmlElement
feature
)
{
Objects
.
requireNonNull
(
id
,
"id may not be null"
);
Objects
.
requireNonNull
(
type
,
"type may not be null"
);
this
.
type
=
type
;
this
.
id
=
id
;
this
.
feature
=
feature
;
}
/**
* Getter for the error type
*
* @return the error type
*/
public
ErrorType
getType
()
{
return
type
;
}
public
ErrorType
getType
();
/**
* Getter for the error id
*
* @return the error id
*/
public
ErrorId
getErrorId
()
{
return
id
;
}
public
ErrorId
getErrorId
();
/**
* The gml feature in which the error occured
*
* @return the gml feature
*/
public
GmlElement
getFeature
()
{
return
feature
;
}
public
GmlElement
getFeature
();
/**
* A general visitor will have a look at this error. Visitor pattern.
...
...
@@ -89,7 +61,7 @@ public abstract class CheckError implements Serializable {
* @param errorVisitor the visitor, call {@link ErrorVisitor#visit(CheckError)})
* on this.
*/
public
abstract
void
accept
(
ErrorVisitor
errorVisitor
);
public
void
accept
(
ErrorVisitor
errorVisitor
);
/**
* Visitor pattern for the healing methods. Call
...
...
@@ -100,7 +72,7 @@ public abstract class CheckError implements Serializable {
* @param l a modification listener when a healing method changes something
* @return true if the healing method changed something in the model
*/
public
abstract
boolean
accept
(
HealingMethod
method
,
ModificationListener
l
);
public
boolean
accept
(
HealingMethod
method
,
ModificationListener
l
);
/**
* This method functions as interface to various reporting places. The
...
...
@@ -109,6 +81,6 @@ public abstract class CheckError implements Serializable {
*
* @param report
*/
public
abstract
void
report
(
ErrorReport
report
);
public
void
report
(
ErrorReport
report
);
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/CheckId.java
View file @
a0ff9ed7
...
...
@@ -9,7 +9,7 @@
* (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
* 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.
*
...
...
@@ -18,57 +18,81 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.util.Collections
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.io.Serializable
;
public
enum
CheckId
{
public
class
CheckId
implements
Serializable
{
C_GE_R_TOO_FEW_POINTS
(
"C_GE_R_TOO_FEW_POINTS"
),
C_GE_R_NOT_CLOSED
(
"C_GE_R_NOT_CLOSED"
),
C_GE_S_MULTIPLE_CONNECTED_COMPONENTS
(
"C_GE_S_MULTIPLE_CONNECTED_COMPONENTS"
),
C_GE_R_DUPLICATE_POINT
(
"C_GE_R_DUPLICATE_POINT"
),
C_GE_R_SELF_INTERSECTION
(
"C_GE_R_SELF_INTERSECTION"
),
C_GE_P_INTERIOR_DISCONNECTED
(
"C_GE_P_INTERIOR_DISCONNECTED"
),
C_GE_P_INTERSECTING_RINGS
(
"C_GE_P_INTERSECTING_RINGS"
),
C_GE_P_NON_PLANAR
(
"C_GE_P_NON_PLANAR"
),
C_GE_S_TOO_FEW_POLYGONS
(
"C_GE_S_TOO_FEW_POLYGONS"
),
NULL_AREA
(
"C_GE_R_NULL_AREA"
),
C_GE_S_NOT_CLOSED
(
"C_GE_S_NOT_CLOSED"
),
C_GE_S_NON_MANIFOLD_EDGE
(
"C_GE_S_NON_MANIFOLD_EDGE"
),
C_GE_S_POLYGON_WRONG_ORIENTATION
(
"C_GE_S_POLYGON_WRONG_ORIENTATION"
),
C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION
(
"C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION"
),
C_GE_S_NON_MANIFOLD_VERTEX
(
"C_GE_S_NON_MANIFOLD_VERTEX"
),
C_GE_S_SELF_INTERSECTION
(
"C_GE_S_SELF_INTERSECTION"
),
C_GE_P_HOLE_OUTSIDE
(
"C_GE_P_HOLE_OUTSIDE"
),
C_GE_P_ORIENTATION_RINGS_SAME
(
"C_GE_P_ORIENTATION_RINGS_SAME"
),
C_GE_P_INNER_RINGS_NESTED
(
"C_GE_P_INNER_RINGS_NESTED"
),
IS_CEILING
(
"IS_CEILING"
),
C_SEM_F_MISSING_ID
(
"C_SEM_F_MISSING_ID"
),
C_SEM_BS_NOT_CEILING
(
"C_SEM_BS_NOT_CEILING"
),
C_SEM_BS_NOT_FLOOR
(
"C_SEM_BS_NOT_FLOOR"
),
C_SEM_BS_NOT_GROUND
(
"C_SEM_BS_NOT_GROUND"
),
C_SEM_BS_GROUND_NOT_FRAGMENTED
(
"C_SEM_BS_GROUND_NOT_FRAGMENTED"
),
C_SEM_BS_IS_WALL
(
"C_SEM_BS_IS_WALL"
),
C_SEM_SCHEMATRON
(
"C_SEM_SCHEMATRON"
),
C_SEM_BS_ROOF_NOT_FRAGMENTED
(
"C_SEM_BS_ROOF_NOT_FRAGMENTED"
);
private
static
final
long
serialVersionUID
=
-
6267337828874296004L
;
public
static
final
CheckId
C_GE_R_TOO_FEW_POINTS
=
new
CheckId
(
"C_GE_R_TOO_FEW_POINTS"
);
public
static
final
CheckId
C_GE_R_NOT_CLOSED
=
new
CheckId
(
"C_GE_R_NOT_CLOSED"
);
public
static
final
CheckId
C_GE_S_MULTIPLE_CONNECTED_COMPONENTS
=
new
CheckId
(
"C_GE_S_MULTIPLE_CONNECTED_COMPONENTS"
);
public
static
final
CheckId
C_GE_R_DUPLICATE_POINT
=
new
CheckId
(
"C_GE_R_DUPLICATE_POINT"
);
public
static
final
CheckId
C_GE_R_SELF_INTERSECTION
=
new
CheckId
(
"C_GE_R_SELF_INTERSECTION"
);
public
static
final
CheckId
C_GE_P_INTERIOR_DISCONNECTED
=
new
CheckId
(
"C_GE_P_INTERIOR_DISCONNECTED"
);
public
static
final
CheckId
C_GE_P_INTERSECTING_RINGS
=
new
CheckId
(
"C_GE_P_INTERSECTING_RINGS"
);
public
static
final
CheckId
C_GE_P_NON_PLANAR
=
new
CheckId
(
"C_GE_P_NON_PLANAR"
);
public
static
final
CheckId
C_GE_S_TOO_FEW_POLYGONS
=
new
CheckId
(
"C_GE_S_TOO_FEW_POLYGONS"
);
public
static
final
CheckId
C_GE_R_NULL_AREA
=
new
CheckId
(
"C_GE_R_NULL_AREA"
);
public
static
final
CheckId
C_GE_S_NON_MANIFOLD_EDGE
=
new
CheckId
(
"C_GE_S_NON_MANIFOLD_EDGE"
);
public
static
final
CheckId
C_GE_S_POLYGON_WRONG_ORIENTATION
=
new
CheckId
(
"C_GE_S_POLYGON_WRONG_ORIENTATION"
);
public
static
final
CheckId
C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION
=
new
CheckId
(
"C_GE_S_ALL_POLYGONS_WRONG_ORIENTATION"
);
public
static
final
CheckId
C_GE_S_NON_MANIFOLD_VERTEX
=
new
CheckId
(
"C_GE_S_NON_MANIFOLD_VERTEX"
);
public
static
final
CheckId
C_GE_S_SELF_INTERSECTION
=
new
CheckId
(
"C_GE_S_SELF_INTERSECTION"
);
public
static
final
CheckId
C_GE_P_HOLE_OUTSIDE
=
new
CheckId
(
"C_GE_P_HOLE_OUTSIDE"
);
public
static
final
CheckId
IS_CEILING
=
new
CheckId
(
"IS_CEILING"
);
public
static
final
CheckId
C_GE_P_INNER_RINGS_NESTED
=
new
CheckId
(
"C_GE_P_INNER_RINGS_NESTED"
);
public
static
final
CheckId
C_SEM_BS_NOT_CEILING
=
new
CheckId
(
"C_SEM_BS_NOT_CEILING"
);
public
static
final
CheckId
C_SEM_BS_NOT_FLOOR
=
new
CheckId
(
"C_SEM_BS_NOT_FLOOR"
);
public
static
final
CheckId
C_SEM_BS_NOT_GROUND
=
new
CheckId
(
"C_SEM_BS_NOT_GROUND"
);
public
static
final
CheckId
C_SEM_F_MISSING_ID
=
new
CheckId
(
"C_SEM_F_MISSING_ID"
);
public
static
final
CheckId
C_SEM_BS_GROUND_NOT_FRAGMENTED
=
new
CheckId
(
"C_SEM_BS_GROUND_NOT_FRAGMENTED"
);
public
static
final
CheckId
C_SEM_BS_IS_WALL
=
new
CheckId
(
"C_SEM_BS_IS_WALL"
);
public
static
final
CheckId
C_SEM_SCHEMATRON
=
new
CheckId
(
"C_SEM_SCHEMATRON"
);
public
static
final
CheckId
C_SEM_BS_ROOF_NOT_FRAGMENTED
=
new
CheckId
(
"C_SEM_BS_ROOF_NOT_FRAGMENTED"
);
public
static
final
CheckId
C_GE_S_NOT_CLOSED
=
new
CheckId
(
"C_GE_S_NOT_CLOSED"
);
public
static
final
CheckId
C_GE_P_ORIENTATION_RINGS_SAME
=
new
CheckId
(
"C_GE_P_ORIENTATION_RINGS_SAME"
);
private
String
name
;
private
static
final
Map
<
String
,
CheckId
>
ENUM_MAP
;
static
{
Map
<
String
,
CheckId
>
map
=
new
TreeMap
<>();
for
(
CheckId
instance
:
CheckId
.
values
())
{
map
.
put
(
instance
.
toString
().
toUpperCase
(),
instance
);
}
ENUM_MAP
=
Collections
.
unmodifiableMap
(
map
);
public
CheckId
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
name
==
null
)
?
0
:
name
.
hashCode
());
return
result
;
}
private
String
id
;
private
CheckId
(
String
id
)
{
this
.
id
=
id
;
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
CheckId
other
=
(
CheckId
)
obj
;
if
(
name
==
null
)
{
if
(
other
.
name
!=
null
)
return
false
;
}
else
if
(!
name
.
equals
(
other
.
name
))
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
id
;
return
name
;
}
/**
* Converts a String to a check id if possible.
*
* @param checkName the string representation of a check
* @return the check id or null if not found.
*/
public
static
CheckId
getIdForName
(
String
checkName
)
{
return
ENUM_MAP
.
get
(
checkName
.
toUpperCase
());
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java
View file @
a0ff9ed7
...
...
@@ -19,7 +19,7 @@
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serializable
;
import
java.util.
Enum
Map
;
import
java.util.
Hash
Map
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -40,7 +40,7 @@ public abstract class Checkable implements Serializable {
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Checkable
.
class
);
private
Enum
Map
<
CheckId
,
CheckResult
>
checkResults
=
new
Enum
Map
<>(
CheckId
.
class
);
private
Map
<
CheckId
,
CheckResult
>
checkResults
=
new
Hash
Map
<>();
private
boolean
isValidated
=
false
;
protected
void
setValidated
(
boolean
validated
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/ErrorId.java
View file @
a0ff9ed7
...
...
@@ -18,6 +18,8 @@
*/
package
de.hft.stuttgart.citydoctor2.check
;
import
java.io.Serializable
;
/**
* The error ids of all checks and their respective name, which is used in
* reports and GUI
...
...
@@ -25,30 +27,75 @@ package de.hft.stuttgart.citydoctor2.check;
* @author Matthias Betz
*
*/
public
enum
ErrorId
{
DEPENDENCIES_NOT_MET
(
"Dependencies_not_met"
),
UNKNOWN_ERROR
(
"Unknown_error"
),
GE_R_NOT_CLOSED
(
"GE_R_NOT_CLOSED"
),
GE_S_MULTIPLE_CONNECTED_COMPONENTS
(
"GE_S_MULTIPLE_CONNECTED_COMPONENTS"
),
GE_R_CONSECUTIVE_POINTS_SAME
(
"GE_R_CONSECUTIVE_POINTS_SAME"
),
GE_R_SELF_INTERSECTION
(
"GE_R_SELF_INTERSECTION"
),
GE_S_POLYGON_WRONG_ORIENTATION
(
"GE_S_POLYGON_WRONG_ORIENTATION"
),
GE_S_ALL_POLYGONS_WRONG_ORIENTATION
(
"GE_S_ALL_POLYGONS_WRONG_ORIENTATION"
),
GE_P_HOLE_OUTSIDE
(
"GE_P_HOLE_OUTSIDE"
),
GE_P_INTERIOR_DISCONNECTED
(
"GE_P_INTERIOR_DISCONNECTED"
),
GE_S_NON_MANIFOLD_VERTEX
(
"GE_S_NON_MANIFOLD_VERTEX"
),
GE_P_INNER_RINGS_NESTED
(
"GE_P_INNER_RINGS_NESTED"
),
GE_R_NULL_AREA
(
"GE_R_NULL_AREA"
),
GE_R_TOO_FEW_POINTS
(
"GE_R_TOO_FEW_POINTS"
),
GE_S_NON_MANIFOLD_EDGE
(
"GE_S_NON_MANIFOLD_EDGE"
),
GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION
(
"GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION"
),
GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE
(
"GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE"
),
GE_P_ORIENTATION_RINGS_SAME
(
"GE_P_ORIENTATION_RINGS_SAME"
),
GE_P_INTERSECTING_RINGS
(
"GE_P_INTERSECTION_RINGS"
),
GE_S_NOT_CLOSED
(
"GE_S_NOT_CLOSED"
),
GE_S_SELF_INTERSECTION
(
"GE_S_SELF_INTERSECTION"
),
GE_S_TOO_FEW_POLYGONS
(
"GE_S_TOO_FEW_POLYGONS"
),
SEM_F_MISSING_ID
(
"SEM_F_MISSING_GML_ID"
),
SEM_BS_NOT_CEILING
(
"SEM_BS_NOT_CEILING"
),
SEM_BS_NOT_WALL
(
"SEM_BS_NOT_WALL"
),
SEM_BS_NOT_FLOOR
(
"SEM_BS_NOT_FLOOR"
),
SEM_BS_NOT_GROUND
(
"SEM_BS_NOT_GROUND"
),
SEM_SCHEMATRON_ERROR
(
"SEM_SCHEMATRON_ERROR"
),
SEM_BS_UNFRAGMENTED
(
"SEM_BS_UNFRAGMENTED"
),
GE_P_TINY_EDGE
(
"GE_P_TINY_EDGE"
);
public
class
ErrorId
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2598466667746276560L
;
public
static
final
ErrorId
DEPENDENCIES_NOT_MET
=
new
ErrorId
(
"Dependencies_not_met"
);
public
static
final
ErrorId
UNKNOWN_ERROR
=
new
ErrorId
(
"Unknown_error"
);
public
static
final
ErrorId
GE_R_NOT_CLOSED
=
new
ErrorId
(
"GE_R_NOT_CLOSED"
);
public
static
final
ErrorId
GE_S_MULTIPLE_CONNECTED_COMPONENTS
=
new
ErrorId
(
"GE_S_MULTIPLE_CONNECTED_COMPONENTS"
);
public
static
final
ErrorId
GE_R_CONSECUTIVE_POINTS_SAME
=
new
ErrorId
(
"GE_R_CONSECUTIVE_POINTS_SAME"
);
public
static
final
ErrorId
GE_R_SELF_INTERSECTION
=
new
ErrorId
(
"GE_R_SELF_INTERSECTION"
);
public
static
final
ErrorId
GE_S_POLYGON_WRONG_ORIENTATION
=
new
ErrorId
(
"GE_S_POLYGON_WRONG_ORIENTATION"
);
public
static
final
ErrorId
GE_S_ALL_POLYGONS_WRONG_ORIENTATION
=
new
ErrorId
(
"GE_S_ALL_POLYGONS_WRONG_ORIENTATION"
);
public
static
final
ErrorId
GE_P_HOLE_OUTSIDE
=
new
ErrorId
(
"GE_P_HOLE_OUTSIDE"
);
public
static
final
ErrorId
GE_P_INTERIOR_DISCONNECTED
=
new
ErrorId
(
"GE_P_INTERIOR_DISCONNECTED"
);
public
static
final
ErrorId
GE_S_NON_MANIFOLD_VERTEX
=
new
ErrorId
(
"GE_S_NON_MANIFOLD_VERTEX"
);
public
static
final
ErrorId
GE_P_INNER_RINGS_NESTED
=
new
ErrorId
(
"GE_P_INNER_RINGS_NESTED"
);
public
static
final
ErrorId
GE_R_NULL_AREA
=
new
ErrorId
(
"GE_R_NULL_AREA"
);
public
static
final
ErrorId
GE_R_TOO_FEW_POINTS
=
new
ErrorId
(
"GE_R_TOO_FEW_POINTS"
);
public
static
final
ErrorId
GE_S_NON_MANIFOLD_EDGE
=
new
ErrorId
(
"GE_S_NON_MANIFOLD_EDGE"
);
public
static
final
ErrorId
GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION
=
new
ErrorId
(
"GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION"
);
public
static
final
ErrorId
GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE
=
new
ErrorId
(
"GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE"
);
public
static
final
ErrorId
GE_P_INTERSECTING_RINGS
=
new
ErrorId
(
"GE_P_INTERSECTING_RINGS"
);
public
static
final
ErrorId
GE_S_SELF_INTERSECTION
=
new
ErrorId
(
"GE_S_SELF_INTERSECTION"
);
public
static
final
ErrorId
GE_P_ORIENTATION_RINGS_SAME
=
new
ErrorId
(
"GE_P_ORIENTATION_RINGS_SAME"
);
public
static
final
ErrorId
GE_S_NOT_CLOSED
=
new
ErrorId
(
"GE_S_NOT_CLOSED"
);
public
static
final
ErrorId
GE_S_TOO_FEW_POLYGONS
=
new
ErrorId
(
"GE_S_TOO_FEW_POLYGONS"
);
public
static
final
ErrorId
SEM_F_MISSING_ID
=
new
ErrorId
(
"SEM_F_MISSING_ID"
);
public
static
final
ErrorId
SEM_BS_NOT_CEILING
=
new
ErrorId
(
"SEM_BS_NOT_CEILING"
);
public
static
final
ErrorId
SEM_BS_NOT_WALL
=
new
ErrorId
(
"SEM_BS_NOT_WALL"
);
public
static
final
ErrorId
SEM_BS_NOT_FLOOR
=
new
ErrorId
(
"SEM_BS_NOT_FLOOR"
);
public
static
final
ErrorId
SEM_BS_NOT_GROUND
=
new
ErrorId
(
"SEM_BS_NOT_GROUND"
);
public
static
final
ErrorId
SEM_SCHEMATRON_ERROR
=
new
ErrorId
(
"SEM_SCHEMATRON_ERROR"
);
public
static
final
ErrorId
SEM_BS_UNFRAGMENTED
=
new
ErrorId
(
"SEM_BS_UNFRAGMENTED"
);
public
static
final
ErrorId
GE_P_TINY_EDGE
=
new
ErrorId
(
"GE_P_TINY_EDGE"
);
private
String
name
;
p
rivate
ErrorId
(
String
name
)
{
p
ublic
ErrorId
(
String
name
)
{
this
.
name
=
name
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
name
==
null
)
?
0
:
name
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
ErrorId
other
=
(
ErrorId
)
obj
;
if
(
name
==
null
)
{
if
(
other
.
name
!=
null
)
return
false
;
}
else
if
(!
name
.
equals
(
other
.
name
))
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
name
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/AllPolygonsWrongOrientationError.java
View file @
a0ff9ed7
...
...
@@ -26,6 +26,7 @@ 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.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.GmlElement
;
/**
* Error when all polygons are oriented wrong.
...
...
@@ -33,14 +34,13 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
* @author Matthias Betz
*
*/
public
class
AllPolygonsWrongOrientationError
ext
en
d
s
CheckError
{
public
class
AllPolygonsWrongOrientationError
implem
en
t
s
CheckError
{
private
static
final
long
serialVersionUID
=
2263993313732858840L
;
private
Geometry
geom
;
public
AllPolygonsWrongOrientationError
(
Geometry
geom
)
{
super
(
ErrorId
.
GE_S_ALL_POLYGONS_WRONG_ORIENTATION
,
ErrorType
.
ERROR
,
geom
);
this
.
geom
=
geom
;
}
...
...
@@ -68,4 +68,19 @@ public class AllPolygonsWrongOrientationError extends CheckError {
report
.
add
(
geom
);
}
@Override
public
ErrorType
getType
()
{
return
ErrorType
.
ERROR
;
}
@Override
public
ErrorId
getErrorId
()
{
return
ErrorId
.
GE_S_ALL_POLYGONS_WRONG_ORIENTATION
;
}
@Override
public
GmlElement
getFeature
()
{
return
getGeometry
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/ConsecutivePointSameError.java
View file @
a0ff9ed7
...
...
@@ -25,6 +25,7 @@ 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.GmlElement
;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
...
...
@@ -35,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
* @author Matthias Betz
*
*/
public
class
ConsecutivePointSameError
ext
en
d
s
CheckError
{
public
class
ConsecutivePointSameError
implem
en
t
s
CheckError
{
private
static
final
long
serialVersionUID
=
-
6355935751554777494L
;
...
...
@@ -44,7 +45,6 @@ public class ConsecutivePointSameError extends CheckError {
private
Vertex
p2
;
public
ConsecutivePointSameError
(
LinearRing
lr
,
Vertex
p1
,
Vertex
p2
)
{
super
(
ErrorId
.
GE_R_CONSECUTIVE_POINTS_SAME
,
ErrorType
.
ERROR
,
lr
);
this
.
lr
=
lr
;
this
.
p1
=
p1
;
this
.
p2
=
p2
;
...
...
@@ -83,4 +83,19 @@ public class ConsecutivePointSameError extends CheckError {
report
.
add
(
"duplicate point 1"
,
p1
);
report
.
add
(
"duplicate point 2"
,
p2
);
}
@Override
public
ErrorType
getType
()
{
return
ErrorType
.
ERROR
;
}
@Override
public
ErrorId
getErrorId
()
{
return
ErrorId
.
GE_R_CONSECUTIVE_POINTS_SAME
;
}
@Override
public
GmlElement
getFeature
()
{
return
getRing
();
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/DependenciesNotMetError.java
View file @
a0ff9ed7
...
...
@@ -26,6 +26,7 @@ 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.GmlElement
;
/**
* When a check checks if it can be executed but one or more dependency has
...
...
@@ -36,14 +37,13 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
* @author Matthias Betz
*
*/
public
class
DependenciesNotMetError
ext
en
d
s
CheckError
{
public
class
DependenciesNotMetError
implem
en
t
s
CheckError
{
private
static
final
long
serialVersionUID
=
-
851655185949574160L
;
private
CheckId
dependency
;
public
DependenciesNotMetError
(
CheckId
dependency
)
{
super
(
ErrorId
.
DEPENDENCIES_NOT_MET
,
ErrorType
.
ERROR
,
null
);
this
.
dependency
=
dependency
;
}
...
...
@@ -70,4 +70,19 @@ public class DependenciesNotMetError extends CheckError {
public
void
report
(
ErrorReport
report
)
{
report
.
add
(
"dependency"
,
dependency
.
toString
());
}
@Override
public
ErrorType
getType
()
{
return
ErrorType
.
ERROR
;
}
@Override
public
ErrorId
getErrorId
()
{
return
ErrorId
.
DEPENDENCIES_NOT_MET
;
}
@Override
public
GmlElement
getFeature
()
{
return
null
;
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/error/MultipleConnectedComponentsError.java
View file @
a0ff9ed7