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
71e88cba
Commit
71e88cba
authored
May 28, 2015
by
duminil
Browse files
RegionChooser : Display NovaFactory bounding boxes.
parent
cbacf844
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/eu/simstadt/regionchooser/RegionChooserFX.java
View file @
71e88cba
package
eu.simstadt.regionchooser
;
package
eu.simstadt.regionchooser
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -7,6 +8,7 @@
...
@@ -7,6 +8,7 @@
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.util.logging.Logger
;
import
java.util.prefs.Preferences
;
import
java.util.prefs.Preferences
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -37,6 +39,7 @@
...
@@ -37,6 +39,7 @@
public
class
RegionChooserFX
extends
Application
public
class
RegionChooserFX
extends
Application
{
{
private
Scene
scene
;
private
Scene
scene
;
protected
final
static
Logger
LOGGER
=
Logger
.
getLogger
(
RegionChooserFX
.
class
.
getName
());
@Override
@Override
public
void
start
(
Stage
stage
)
{
public
void
start
(
Stage
stage
)
{
...
@@ -169,6 +172,26 @@ public void log(String text)
...
@@ -169,6 +172,26 @@ public void log(String text)
private
Path
citygmlPath
(
String
project
,
String
citygml
)
{
private
Path
citygmlPath
(
String
project
,
String
citygml
)
{
return
repo
.
resolve
(
project
+
".simstadt"
).
resolve
(
citygml
);
return
repo
.
resolve
(
project
+
".simstadt"
).
resolve
(
citygml
);
}
}
public
void
importNovaFactoryBoundingBoxes
()
throws
IOException
{
JSObject
novafactoryVectors
=
(
JSObject
)
webEngine
.
executeScript
(
"novafactory_vectors"
);
BufferedReader
nf_csv
=
Files
.
newBufferedReader
(
Paths
.
get
(
"../RegionChooser/website/data/novafactory_products.csv"
));
nf_csv
.
readLine
();
String
sCurrentLine
;
while
((
sCurrentLine
=
nf_csv
.
readLine
())
!=
null
)
{
String
[]
values
=
sCurrentLine
.
trim
().
split
(
","
);
String
product
=
values
[
1
];
// String description = values[2];
String
[]
srs
=
values
[
3
].
split
(
" "
);
String
epsgId
=
srs
[
srs
.
length
-
1
];
System
.
out
.
println
(
product
);
novafactoryVectors
.
call
(
"addNovaFactoryProduct"
,
values
[
8
],
values
[
9
],
values
[
10
],
values
[
11
],
product
,
epsgId
);
}
nf_csv
.
close
();
}
}
}
final
WebView
browser
=
new
WebView
();
final
WebView
browser
=
new
WebView
();
...
@@ -191,6 +214,12 @@ public Browser() {
...
@@ -191,6 +214,12 @@ public Browser() {
"{\n"
+
"{\n"
+
" fxapp.log(message);\n"
+
" fxapp.log(message);\n"
+
"};"
);
"};"
);
try
{
fxapp
.
importNovaFactoryBoundingBoxes
();
}
catch
(
Exception
ex
)
{
RegionChooserFX
.
LOGGER
.
warning
(
"NovaFactory CSV not found or corrupt"
);
ex
.
printStackTrace
();
}
// try {
// try {
// fxapp.selectRegionDirectlyFromCityGML(
// fxapp.selectRegionDirectlyFromCityGML(
// Paths.get("../TestRepository").resolve("Gruenbuehl.simstadt")
// Paths.get("../TestRepository").resolve("Gruenbuehl.simstadt")
...
...
website/script/simstadt_openlayers.js
View file @
71e88cba
...
@@ -22,20 +22,23 @@ var kml_source = new ol.source.KML({
...
@@ -22,20 +22,23 @@ var kml_source = new ol.source.KML({
extractStyles
:
false
extractStyles
:
false
})
})
var
polygon_style
=
new
ol
.
style
.
Style
({
function
polygon_style
(
color
,
alpha
){
return
new
ol
.
style
.
Style
({
fill
:
new
ol
.
style
.
Fill
({
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(255, 255, 255,
0.2
)
'
color
:
'
rgba(255, 255, 255,
'
+
alpha
+
'
)
'
}),
}),
stroke
:
new
ol
.
style
.
Stroke
({
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'
#777777
'
,
// color : '#777777',
color
:
color
,
width
:
2
,
width
:
2
,
lineDash
:
[
5
,
10
]
lineDash
:
[
5
,
10
]
}),
}),
})
})
}
var
kml_layer
=
new
ol
.
layer
.
Vector
({
var
kml_layer
=
new
ol
.
layer
.
Vector
({
source
:
kml_source
,
source
:
kml_source
,
style
:
polygon_style
style
:
polygon_style
(
'
#777777
'
,
0.2
)
});
});
var
intersections
=
new
ol
.
source
.
Vector
();
var
intersections
=
new
ol
.
source
.
Vector
();
...
@@ -53,22 +56,21 @@ var novafactory_vectors = new ol.source.Vector({
...
@@ -53,22 +56,21 @@ var novafactory_vectors = new ol.source.Vector({
features
:
[]
features
:
[]
});
});
novafactory_vectors
.
addMarker
=
function
(
xmin
,
ymin
,
xmax
,
ymax
,
name
)
{
novafactory_vectors
.
addNovaFactoryProduct
=
function
(
xmin
,
ymin
,
xmax
,
ymax
,
name
,
epsgId
)
{
var
p1
=
new
ol
.
geom
.
Point
(
ol
.
proj
.
transform
([
xmin
,
ymin
],
'
EPSG:31467
'
,
'
EPSG:3857
'
))
var
box
=
new
ol
.
geom
.
Polygon
([[[
xmin
,
ymin
],[
xmin
,
ymax
],[
xmax
,
ymax
],[
xmax
,
ymin
],[
xmin
,
ymin
]]]);
var
p2
=
new
ol
.
geom
.
Point
(
ol
.
proj
.
transform
([
xmin
,
ymax
],
'
EPSG:31467
'
,
'
EPSG:3857
'
))
box
.
transform
(
'
EPSG:
'
+
epsgId
,
'
EPSG:3857
'
);
var
p3
=
new
ol
.
geom
.
Point
(
ol
.
proj
.
transform
([
xmax
,
ymax
],
'
EPSG:31467
'
,
'
EPSG:3857
'
))
var
p4
=
new
ol
.
geom
.
Point
(
ol
.
proj
.
transform
([
xmax
,
ymin
],
'
EPSG:31467
'
,
'
EPSG:3857
'
))
this
.
addFeature
(
new
ol
.
Feature
({
this
.
addFeature
(
new
ol
.
Feature
({
geometry
:
new
ol
.
geom
.
Polygon
([[
p1
,
p2
,
p3
,
p4
,
p1
]])
,
geometry
:
box
,
name
:
name
,
name
:
name
,
}));
}));
}
}
novafactory_vectors
.
addMarker
(
3530000
,
5434300
,
3538800
,
5445010
,
"
WU
"
);
//novafactory_vectors.addNovaFactoryProduct(3530000,5434300,3538800,5445010,"WU");
//novafactory_vectors.addNovaFactoryProduct(3510000,5415000,3523100,5422000,"LB");
var
novafactory_layer
=
new
ol
.
layer
.
Vector
({
var
novafactory_layer
=
new
ol
.
layer
.
Vector
({
source
:
novafactory_vectors
,
source
:
novafactory_vectors
,
//
style: polygon_style
style
:
polygon_style
(
'
#ff7700
'
,
0.1
)
});
});
var
map
=
new
ol
.
Map
({
var
map
=
new
ol
.
Map
({
...
...
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