Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
89cc09dc
Commit
89cc09dc
authored
May 27, 2015
by
duminil
Browse files
Structure to extract zip file to citygml.
parent
4527f190
Changes
4
Show whitespace changes
Inline
Side-by-side
src/eu/simstadt/nf4j/ExportJobFromJavaFXRegionChooser.java
View file @
89cc09dc
...
...
@@ -31,14 +31,15 @@ public class ExportJobFromJavaFXRegionChooser implements JobStatusListener
public
void
processJob
(
Geometry
poly
,
JSObject
nfButton
)
throws
InterruptedException
{
this
.
nfButton
=
nfButton
;
String
productName
=
"WU3"
;
//NOTE: Others are LB,LBTEST, WU3
ExportJobDescription
description
=
ExportJobDescription
.
getDefaultDescriptor
();
description
.
setInitiator
(
"2758"
);
description
.
setAccount
(
"Bruse"
);
description
.
setProduct
(
"WU3"
);
// description.setProduct("WU3");
description
.
setProduct
(
productName
);
description
.
setJobnumber
(
"Bruse_0815"
);
//FIXME: Zipped GMLs coming from nF don't have any defined srsName
//FIXME: Save files somewhere else
ArrayList
<
Coord
>
regionPolygon
=
new
ArrayList
<>();
...
...
@@ -49,7 +50,7 @@ public void processJob(Geometry poly, JSObject nfButton) throws InterruptedExcep
description
.
setRegionPolygon
(
regionPolygon
);
Layer
layer
=
Layer
.
getDefaultLayer
();
layer
.
setProduct
(
"WU3"
);
layer
.
setProduct
(
productName
);
layer
.
setName
(
"GML"
);
description
.
addLayer
(
layer
);
...
...
@@ -63,15 +64,6 @@ public void processJob(Geometry poly, JSObject nfButton) throws InterruptedExcep
}
catch
(
InvalidJobDescriptorException
ex
)
{
ex
.
printStackTrace
();
}
// // Wait for timeout, failure or that all tests pass
// long timeout = 1000 * 60 * 3l; // 3 minutes maximum
// long interval = 10000l;
// while (!job.hasFinished() && !job.hasFailed() && timeout > 0) {
// Thread.sleep(interval);
// timeout -= interval;
// System.out.println("+");
// }
}
@Override
...
...
@@ -79,16 +71,16 @@ public void jobStatusChanged(JobStatusEvent event) {
JobStatus
status
=
(
JobStatus
)
event
.
getSource
();
System
.
out
.
println
(
status
);
if
(
status
==
JobStatus
.
LOCAL
)
{
nfButton
.
call
(
"updateStatus"
,
"
Local
"
);
nfButton
.
call
(
"updateStatus"
,
"
REQUEST HAS BEEN PREPARED
"
);
}
else
if
(
status
==
JobStatus
.
SENT
)
{
nfButton
.
call
(
"updateStatus"
,
"SENT"
);
nfButton
.
call
(
"updateStatus"
,
"
REQUEST HAS BEEN
SENT"
);
}
else
if
(
status
==
JobStatus
.
PENDING
)
{
nfButton
.
call
(
"updateStatus"
,
"PENDING"
);
}
else
if
(
status
==
JobStatus
.
RUNNING
)
{
nfButton
.
call
(
"updateStatus"
,
"
RUNNING
"
);
nfButton
.
call
(
"updateStatus"
,
"
SERVER IS BUSY
"
);
}
else
if
(
status
==
JobStatus
.
FINISHED
)
{
try
{
nfButton
.
call
(
"updateStatus"
,
"
FINISHED
"
);
nfButton
.
call
(
"updateStatus"
,
"
SERVER IS DONE
"
);
job
.
downloadResult
();
}
catch
(
FailedTransmissionException
ex
)
{
ex
.
printStackTrace
();
...
...
@@ -96,8 +88,12 @@ public void jobStatusChanged(JobStatusEvent event) {
}
else
if
(
status
==
JobStatus
.
DOWNLOAD
)
{
try
{
File
file
=
job
.
getResult
();
nfButton
.
call
(
"updateStatus"
,
"DOWNLOAD"
);
System
.
out
.
println
(
"CityGML at "
+
file
.
getAbsolutePath
());
nfButton
.
call
(
"updateStatus"
,
"DOWNLOADED AS ZIP"
);
nfButton
.
call
(
"selectSaveFile"
,
file
.
toString
());
// System.out.println("CityGML at " + file.getAbsolutePath());
System
.
out
.
println
(
"STILL HERE"
);
//TODO: Call downloadFinished if FAILED
nfButton
.
call
(
"downloadFinished"
);
}
catch
(
FailedTransmissionException
ex
)
{
ex
.
printStackTrace
();
}
...
...
src/eu/simstadt/regionchooser/RegionChooserFX.java
View file @
89cc09dc
...
...
@@ -79,13 +79,17 @@ protected Integer call() throws Exception {
ExportJobFromJavaFXRegionChooser
nfJob
=
new
ExportJobFromJavaFXRegionChooser
();
Geometry
poly
=
wktReader
.
read
(
wktPolygon
);
nfJob
.
processJob
(
poly
,
nfButton
);
nfButton
.
call
(
"downloadFinished"
);
return
0
;
}
};
new
Thread
(
task
).
start
();
}
public
void
doSomethingWithThisZIP
(
String
zipFilename
)
{
System
.
out
.
println
(
"Extract zipFile "
+
zipFilename
+
" to "
+
"unkownlocation"
);
}
public
void
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
,
JSObject
featureOverlay
)
throws
IOException
,
ParseException
{
...
...
test/eu/simstadt/nf4j/async/test/SuccessfulExportJob.java
View file @
89cc09dc
...
...
@@ -140,7 +140,7 @@ public void jobStatusChanged(JobStatusEvent event) {
try
{
File
file
=
job
.
getResult
();
assertTrue
(
file
.
canRead
());
System
.
out
.
println
(
"CityGML at "
+
file
.
getAbsolutePath
());
//
System.out.println("CityGML at " + file.getAbsolutePath());
}
catch
(
FailedTransmissionException
ex
)
{
ex
.
printStackTrace
();
}
...
...
website/script/simstadt_openlayers.js
View file @
89cc09dc
...
...
@@ -244,15 +244,16 @@ function findIntersections() {
function
downloadRegionFromCityGML
(
i
)
{
// TODO: Disable all links
// TODO: DRY
$
(
"
html
"
).
addClass
(
"
wait
"
);
var
feature
=
kml_source
.
getFeatures
()[
i
];
// Waiting 100ms in order to let the cursor change
setTimeout
(
function
()
{
//
var start = new Date().getTime();
//
var start = new Date().getTime();
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
),
vectorSource
);
//
var end = new Date().getTime();
//
var time = end - start;
//
console.log('DL Execution time: ' + time);
//
var end = new Date().getTime();
//
var time = end - start;
//
console.log('DL Execution time: ' + time);
setTimeout
(
function
()
{
$
(
"
html
"
).
removeClass
(
"
wait
"
);
dataPanel
.
append
(
"
Done<br/>
\n
"
);
...
...
@@ -261,7 +262,7 @@ function downloadRegionFromCityGML(i) {
}
function
displayInfo
()
{
//
var start = new Date().getTime();
//
var start = new Date().getTime();
dataPanel
.
empty
();
var
geom
=
/** @type {ol.geom.Polygon} */
(
sketch
.
getGeometry
().
clone
().
transform
(
sourceProj
,
'
EPSG:4326
'
));
...
...
@@ -289,9 +290,9 @@ function displayInfo() {
dataPanel
.
append
(
"
Area
"
+
"
<br/>
\n
"
);
dataPanel
.
append
((
Math
.
round
(
area
/
1000
)
/
10
).
toString
()
+
"
ha<br/><br/>
\n
"
);
findIntersections
();
//
var end = new Date().getTime();
//
var time = end - start;
//
console.log('Execution time: ' + time);
//
var end = new Date().getTime();
//
var time = end - start;
//
console.log('Execution time: ' + time);
}
draw
.
on
(
'
drawend
'
,
function
(
e
)
{
...
...
@@ -318,26 +319,35 @@ $('#reset').click(function() {
});
novafactory_btn
.
downloadFinished
=
function
()
{
//FIXME: Weird <br>s are inserted between lines
//
FIXME: Weird <br>s are inserted between lines
dataPanel
.
append
(
"
NovaFactory : DONE <br/>
\n
"
);
this
.
disabled
=
false
;
// FIXME: Doesn't stop waiting cursor
$
(
"
html
"
).
removeClass
(
"
wait
"
);
}
novafactory_btn
.
updateStatus
=
function
(
status
)
{
dataPanel
.
append
(
"
NovaFactory :
"
+
status
+
"
<br/>
\n
"
);
dataPanel
.
append
(
"
NovaFactory :
"
+
status
+
"
<br/>
\n
"
);
}
novafactory_btn
.
selectSaveFile
=
function
(
zipFilename
)
{
fxapp
.
doSomethingWithThisZIP
(
zipFilename
);
}
$
(
'
#nfDownload
'
).
click
(
function
()
{
$
(
"
html
"
).
addClass
(
"
wait
"
);
novafactory_btn
.
disabled
=
true
;
dataPanel
.
append
(
"
NovaFactory BEGIN <br/>
\n
"
);
// dataPanel.append("NovaFactory BEGIN <br/>\n");
setTimeout
(
function
()
{
fxapp
.
downloadRegion
(
sketchAsWKT
(
'
4326
'
),
novafactory_btn
);
},
100
);
});
function
sketchAsWKT
(
epsgId
)
{
var
epsgId
=
(
typeof
epsgId
===
'
undefined
'
)
?
'
31467
'
:
epsgId
;
var
wktFormat
=
new
ol
.
format
.
WKT
();
return
wktFormat
.
writeFeature
(
sketch
,
{
dataProjection
:
ol
.
proj
.
get
(
'
EPSG:
'
+
epsgId
),
dataProjection
:
ol
.
proj
.
get
(
'
EPSG:
'
+
epsgId
),
featureProjection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
)
})
}
...
...
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