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
f8ac427e
Commit
f8ac427e
authored
Nov 16, 2020
by
Matthias Betz
Browse files
validation changes to support healing streaming
parent
c1c27a52
Pipeline
#1288
failed with stage
in 1 minute and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/CityGmlParser.java
View file @
f8ac427e
...
@@ -220,7 +220,9 @@ public class CityGmlParser {
...
@@ -220,7 +220,9 @@ public class CityGmlParser {
CityGMLBuilder
builder
=
context
.
createCityGMLBuilder
(
CityGmlParser
.
class
.
getClassLoader
());
CityGMLBuilder
builder
=
context
.
createCityGMLBuilder
(
CityGmlParser
.
class
.
getClassLoader
());
CityGMLInputFactory
inputFactory
=
builder
.
createCityGMLInputFactory
();
CityGMLInputFactory
inputFactory
=
builder
.
createCityGMLInputFactory
();
inputFactory
.
setProperty
(
CityGMLInputFactory
.
FEATURE_READ_MODE
,
FeatureReadMode
.
SPLIT_PER_FEATURE
);
inputFactory
.
setProperty
(
CityGMLInputFactory
.
FEATURE_READ_MODE
,
FeatureReadMode
.
SPLIT_PER_FEATURE
);
inputFactory
.
setProperty
(
CityGMLInputFactory
.
USE_VALIDATION
,
config
.
getValidate
());
if
(
config
!=
null
)
{
inputFactory
.
setProperty
(
CityGMLInputFactory
.
USE_VALIDATION
,
config
.
getValidate
());
}
inputFactory
.
setProperty
(
CityGMLInputFactory
.
FAIL_ON_MISSING_ADE_SCHEMA
,
false
);
inputFactory
.
setProperty
(
CityGMLInputFactory
.
FAIL_ON_MISSING_ADE_SCHEMA
,
false
);
inputFactory
.
setProperty
(
CityGMLInputFactory
.
EXCLUDE_FROM_SPLITTING
,
inputFactory
.
setProperty
(
CityGMLInputFactory
.
EXCLUDE_FROM_SPLITTING
,
new
QName
[]
{
new
QName
(
"WallSurface"
),
new
QName
(
"RoofSurface"
),
new
QName
(
"GroundSurface"
),
new
QName
[]
{
new
QName
(
"WallSurface"
),
new
QName
(
"RoofSurface"
),
new
QName
(
"GroundSurface"
),
...
@@ -359,6 +361,25 @@ public class CityGmlParser {
...
@@ -359,6 +361,25 @@ public class CityGmlParser {
}
}
return
null
;
return
null
;
}
}
public
static
CityModel
parseOnlyCityModel
(
File
inputFile
)
throws
CityGmlParseException
{
try
{
CityGMLInputFactory
inputFactory
=
setupGmlReader
(
null
);
try
(
CityGMLReader
reader
=
inputFactory
.
createCityGMLReader
(
inputFile
))
{
while
(
reader
.
hasNext
())
{
CityGML
chunk
=
reader
.
nextFeature
();
if
(
chunk
instanceof
CityModel
)
{
CityModel
cModel
=
(
CityModel
)
chunk
;
cModel
.
unsetCityObjectMember
();
return
cModel
;
}
}
}
}
catch
(
CityGMLBuilderException
|
CityGMLReadException
|
ADEException
e
)
{
throw
new
CityGmlParseException
(
e
);
}
throw
new
CityGmlParseException
(
"Did not find any CityModel in CityGML file"
);
}
private
static
void
readFeatures
(
File
file
,
ParserConfiguration
config
,
CityGMLInputFactory
inputFactory
,
private
static
void
readFeatures
(
File
file
,
ParserConfiguration
config
,
CityGMLInputFactory
inputFactory
,
ArrayBlockingQueue
<
CityObject
>
queue
,
ObservedInputStream
ois
,
FeatureStream
stream
)
{
ArrayBlockingQueue
<
CityObject
>
queue
,
ObservedInputStream
ois
,
FeatureStream
stream
)
{
...
...
CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java
View file @
f8ac427e
...
@@ -210,8 +210,12 @@ public class Checker {
...
@@ -210,8 +210,12 @@ public class Checker {
}
}
isValidated
=
true
;
isValidated
=
true
;
}
}
public
ValidationConfiguration
getConfig
()
{
return
config
;
}
p
rivate
static
SvrlContentHandler
executeSchematronValidationIfAvailable
(
ValidationConfiguration
config
,
p
ublic
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
())
{
...
@@ -493,11 +497,11 @@ public class Checker {
...
@@ -493,11 +497,11 @@ public class Checker {
try
(
BufferedOutputStream
xmlBos
=
getXmlOutputMaybe
(
xmlOutput
);
try
(
BufferedOutputStream
xmlBos
=
getXmlOutputMaybe
(
xmlOutput
);
BufferedOutputStream
pdfBos
=
getPdfOutputMaybe
(
pdfOutput
))
{
BufferedOutputStream
pdfBos
=
getPdfOutputMaybe
(
pdfOutput
))
{
XmlStreamReporter
xmlReporter
=
null
;
XmlStreamReporter
xmlReporter
=
null
;
if
(
xml
Output
!=
null
)
{
if
(
xml
Bos
!=
null
)
{
xmlReporter
=
new
XmlStreamReporter
(
xmlBos
,
stream
.
getFileName
(),
config
);
xmlReporter
=
new
XmlStreamReporter
(
xmlBos
,
stream
.
getFileName
(),
config
);
}
}
PdfStreamReporter
pdfReporter
=
null
;
PdfStreamReporter
pdfReporter
=
null
;
if
(
pdf
Output
!=
null
)
{
if
(
pdf
Bos
!=
null
)
{
pdfReporter
=
new
PdfStreamReporter
(
pdfBos
,
stream
.
getFileName
(),
config
,
logoLocation
);
pdfReporter
=
new
PdfStreamReporter
(
pdfBos
,
stream
.
getFileName
(),
config
,
logoLocation
);
}
}
CityObject
co
=
null
;
CityObject
co
=
null
;
...
@@ -515,7 +519,7 @@ public class Checker {
...
@@ -515,7 +519,7 @@ public class Checker {
}
}
}
}
p
rivate
static
void
writeReport
(
StreamReporter
reporter
,
SvrlContentHandler
handler
)
p
ublic
static
void
writeReport
(
StreamReporter
reporter
,
SvrlContentHandler
handler
)
throws
CheckReportWriteException
{
throws
CheckReportWriteException
{
if
(
reporter
!=
null
)
{
if
(
reporter
!=
null
)
{
if
(
handler
!=
null
)
{
if
(
handler
!=
null
)
{
...
@@ -530,15 +534,15 @@ public class Checker {
...
@@ -530,15 +534,15 @@ public class Checker {
}
}
}
}
p
rivate
static
BufferedOutputStream
getPdfOutputMaybe
(
String
pdfOutput
)
throws
FileNotFoundException
{
p
ublic
static
BufferedOutputStream
getPdfOutputMaybe
(
String
pdfOutput
)
throws
FileNotFoundException
{
return
pdfOutput
!=
null
?
new
BufferedOutputStream
(
new
FileOutputStream
(
pdfOutput
))
:
null
;
return
pdfOutput
!=
null
?
new
BufferedOutputStream
(
new
FileOutputStream
(
pdfOutput
))
:
null
;
}
}
p
rivate
static
BufferedOutputStream
getXmlOutputMaybe
(
String
xmlOutput
)
throws
FileNotFoundException
{
p
ublic
static
BufferedOutputStream
getXmlOutputMaybe
(
String
xmlOutput
)
throws
FileNotFoundException
{
return
xmlOutput
!=
null
?
new
BufferedOutputStream
(
new
FileOutputStream
(
xmlOutput
))
:
null
;
return
xmlOutput
!=
null
?
new
BufferedOutputStream
(
new
FileOutputStream
(
xmlOutput
))
:
null
;
}
}
p
rivate
void
checkFeature
(
XmlStreamReporter
xmlReporter
,
PdfStreamReporter
pdfReporter
,
CityObject
co
)
{
p
ublic
void
checkFeature
(
XmlStreamReporter
xmlReporter
,
PdfStreamReporter
pdfReporter
,
CityObject
co
)
{
if
(
logger
.
isDebugEnabled
())
{
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
Localization
.
getText
(
"Checker.checkFeature"
),
co
);
logger
.
debug
(
Localization
.
getText
(
"Checker.checkFeature"
),
co
);
}
}
...
...
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