Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
e218f4b4
Commit
e218f4b4
authored
May 18, 2015
by
duminil
Browse files
Import SimStadtModel from RegionChooser.
parent
bd4ca534
Changes
4
Show whitespace changes
Inline
Side-by-side
.classpath
View file @
e218f4b4
...
@@ -11,5 +11,6 @@
...
@@ -11,5 +11,6 @@
</attributes>
</attributes>
</classpathentry>
</classpathentry>
<classpathentry
kind=
"lib"
path=
"lib/Proj4J.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/Proj4J.jar"
/>
<classpathentry
combineaccessrules=
"false"
kind=
"src"
path=
"/SimStadtRepository"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
</classpath>
src/eu/simstadt/regionchooser/RegionChooserFX.java
View file @
e218f4b4
...
@@ -14,7 +14,11 @@
...
@@ -14,7 +14,11 @@
import
javafx.scene.web.WebEngine
;
import
javafx.scene.web.WebEngine
;
import
javafx.scene.web.WebView
;
import
javafx.scene.web.WebView
;
import
javafx.stage.Stage
;
import
javafx.stage.Stage
;
import
javax.xml.stream.XMLStreamException
;
import
netscape.javascript.JSObject
;
import
netscape.javascript.JSObject
;
import
org.xml.sax.SAXParseException
;
import
eu.simstadt.admin.SimStadtModel
;
import
eu.simstadt.admin.SimStadtProject
;
public
class
RegionChooserFX
extends
Application
public
class
RegionChooserFX
extends
Application
...
@@ -50,12 +54,25 @@ public void downloadRegion(String wktPolygon) {
...
@@ -50,12 +54,25 @@ public void downloadRegion(String wktPolygon) {
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
);
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
);
}
}
public
void
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
)
{
public
int
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
)
throws
SAXParseException
,
XMLStreamException
{
//Browser.this.getScene().getRoot().setCursor(Cursor.WAIT);
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
+
" from \n"
+
project
+
">"
+
citygml
);
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
+
" from \n"
+
project
+
">"
+
citygml
);
SimStadtModel
model
=
SimStadtProject
.
loadModelWithoutSchemaValidation
(
citygmlPath
(
project
,
citygml
).
toFile
());
return
model
.
getCityDoctorBuildings
().
size
();
}
}
public
boolean
checkIfCityGMLSAreAvailable
(
String
project
,
String
citygml
)
{
public
boolean
checkIfCityGMLSAreAvailable
(
String
project
,
String
citygml
)
{
return
Files
.
isReadable
(
repo
.
resolve
(
project
+
".simstadt"
).
resolve
(
citygml
));
return
Files
.
isReadable
(
citygmlPath
(
project
,
citygml
));
}
public
void
log
(
String
text
)
{
System
.
out
.
println
(
text
);
}
private
Path
citygmlPath
(
String
project
,
String
citygml
)
{
return
repo
.
resolve
(
project
+
".simstadt"
).
resolve
(
citygml
);
}
}
}
}
...
@@ -74,6 +91,10 @@ public Browser() {
...
@@ -74,6 +91,10 @@ public Browser() {
if
(
newState
==
State
.
SUCCEEDED
)
{
if
(
newState
==
State
.
SUCCEEDED
)
{
JSObject
win
=
(
JSObject
)
webEngine
.
executeScript
(
"window"
);
JSObject
win
=
(
JSObject
)
webEngine
.
executeScript
(
"window"
);
win
.
setMember
(
"fxapp"
,
new
JavaScriptFXBridge
());
win
.
setMember
(
"fxapp"
,
new
JavaScriptFXBridge
());
webEngine
.
executeScript
(
"console.log = function(message)\n"
+
"{\n"
+
" fxapp.log(message);\n"
+
"};"
);
}
}
});
});
//add the web view to the scene
//add the web view to the scene
...
...
website/script/simstadt_openlayers.js
View file @
e218f4b4
...
@@ -67,7 +67,7 @@ kml_layer.addEventListener("change", function(event) {
...
@@ -67,7 +67,7 @@ kml_layer.addEventListener("change", function(event) {
feature
[
"
description
"
]
=
project
+
"
>
"
+
name
;
feature
[
"
description
"
]
=
project
+
"
>
"
+
name
;
var
citygmlHere
;
var
citygmlHere
;
if
(
fromJavaFX
)
{
if
(
fromJavaFX
)
{
citygmlHere
=
fxapp
.
checkIfCityGMLSAreAvailable
(
project
,
name
);
citygmlHere
=
fxapp
.
checkIfCityGMLSAreAvailable
(
project
,
name
);
}
}
feature
[
"
available
"
]
=
citygmlHere
;
feature
[
"
available
"
]
=
citygmlHere
;
});
});
...
@@ -174,8 +174,19 @@ function findIntersections() {
...
@@ -174,8 +174,19 @@ function findIntersections() {
}
}
function
downloadRegionFromCityGML
(
i
)
{
function
downloadRegionFromCityGML
(
i
)
{
$
(
"
html
"
).
addClass
(
"
wait
"
);
var
feature
=
kml_source
.
getFeatures
()[
i
];
var
feature
=
kml_source
.
getFeatures
()[
i
];
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
));
// Waiting 100ms in order to let the cursor change
setTimeout
(
function
()
{
var
start
=
new
Date
().
getTime
();
var
buildings_count
=
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
));
var
end
=
new
Date
().
getTime
();
var
time
=
end
-
start
;
console
.
log
(
'
DL Execution time:
'
+
time
);
$
(
'
#dataPanel
'
).
append
(
"
Imported buildings :
"
+
buildings_count
);
$
(
"
html
"
).
removeClass
(
"
wait
"
);
},
100
);
}
}
function
displayInfo
()
{
function
displayInfo
()
{
...
...
website/style/style.css
View file @
e218f4b4
html
.wait
,
html
.wait
*
{
cursor
:
wait
!important
;
}
html
,
body
{
html
,
body
{
margin
:
0
;
margin
:
0
;
padding
:
0
;
padding
:
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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