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
526c3971
Commit
526c3971
authored
May 29, 2015
by
duminil
Browse files
Fixing errors found by jshint
parent
2ffc83c1
Changes
1
Show whitespace changes
Inline
Side-by-side
website/script/simstadt_openlayers.js
View file @
526c3971
//TODO: Add zoom to extent as control
//TODO: Try to leave everything in 4326
//TODO: Add some tiles for offline mode
var
reset_btn
=
$
(
'
#reset
'
)[
0
];
var
dataPanel
=
$
(
'
#dataPanel
'
);
var
br
=
document
.
createElement
(
'
br
'
);
proj4
.
defs
(
"
EPSG:31467
"
,
"
+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0
"
+
"
+ellps=bessel +datum=potsdam +units=m +no_defs
"
);
// http://spatialreference.org/ref/epsg/31467/proj4js/
...
...
@@ -19,7 +19,7 @@ var kml_source = new ol.source.KML({
url
:
'
data/citygml_hulls.kml
'
,
extractAttributes
:
false
,
extractStyles
:
false
})
})
;
function
polygon_style
(
color
,
alpha
)
{
return
new
ol
.
style
.
Style
({
...
...
@@ -31,7 +31,7 @@ function polygon_style(color, alpha) {
width
:
2
,
lineDash
:
[
5
,
10
]
}),
})
})
;
}
var
kml_layer
=
new
ol
.
layer
.
Vector
({
...
...
@@ -68,7 +68,7 @@ novafactory_vectors.addNovaFactoryProduct = function(xmin, ymin, xmax, ymax, nam
feature
[
"
available
"
]
=
true
;
feature
[
"
source
"
]
=
"
NovaFACTORY
"
;
this
.
addFeature
(
feature
);
}
}
;
var
novafactory_layer
=
new
ol
.
layer
.
Vector
({
source
:
novafactory_vectors
,
...
...
@@ -85,7 +85,7 @@ var map = new ol.Map({
var
geoJSONformat
=
new
ol
.
format
.
GeoJSON
();
kml_layer
.
addEventListener
(
"
change
"
,
function
(
event
)
{
kml_layer
.
addEventListener
(
"
change
"
,
function
()
{
map
.
getView
().
fitExtent
(
kml_source
.
getExtent
(),
(
map
.
getSize
()));
});
...
...
@@ -131,7 +131,7 @@ featureOverlay.setMap(map);
var
selected_features
=
featureOverlay
.
getFeatures
();
selected_features
.
on
(
'
add
'
,
function
(
event
)
{
var
feature
=
event
.
element
;
feature
.
on
(
"
change
"
,
function
(
event
)
{
feature
.
on
(
"
change
"
,
function
()
{
displayInfo
();
});
});
...
...
@@ -147,7 +147,7 @@ var modify = new ol.interaction.Modify({
});
map
.
addInteraction
(
modify
);
draw
=
new
ol
.
interaction
.
Draw
({
var
draw
=
new
ol
.
interaction
.
Draw
({
features
:
featureOverlay
.
getFeatures
(),
type
:
'
Polygon
'
});
...
...
@@ -172,7 +172,7 @@ function findIntersections() {
function
findIntersection
(
feature
)
{
try
{
var
jsonIntersection
=
turf
.
intersect
(
poly1
,
feature
[
"
geoJSON
"
]);
if
(
undefined
!=
jsonIntersection
)
{
if
(
undefined
!=
=
jsonIntersection
)
{
if
(
!
intersection_found
)
{
dataPanel
.
append
(
"
Intersection found with :<br/>
\n
"
);
intersection_found
=
true
;
...
...
@@ -187,7 +187,7 @@ function findIntersections() {
if
(
feature
[
"
available
"
])
{
description
=
"
<a href=
\"
#
\"
onclick=
\"
downloadRegionFrom
"
+
feature
[
"
source
"
]
+
"
(
"
+
i
+
"
);return false;
\"
>
"
+
feature
[
"
description
"
]
+
"
</a>
"
;
console
.
log
(
description
);
//
console.log(description);
}
else
{
description
=
feature
[
'
description
'
];
}
...
...
@@ -205,9 +205,9 @@ function findIntersections() {
i
++
;
}
var
i
=
0
;
novafactory_vectors
.
forEachFeature
(
findIntersection
)
var
i
=
0
;
kml_source
.
forEachFeature
(
findIntersection
)
novafactory_vectors
.
forEachFeature
(
findIntersection
)
;
i
=
0
;
kml_source
.
forEachFeature
(
findIntersection
)
;
if
(
!
intersection_found
)
{
dataPanel
.
append
(
"
No intersection found with any CityGML or NovaFactory product<br/>
\n
"
);
}
...
...
@@ -250,7 +250,7 @@ function displayInfo() {
// "," + wgs84_coord[0] + "));<br/>";
wgs84_coords
+=
"
(
"
+
wgs84_coord
[
1
]
+
"
,
"
+
wgs84_coord
[
0
]
+
"
)<br/>
"
;
var
gsk3_coord
=
ol
.
proj
.
transform
(
coords
[
i
],
ol
.
proj
.
get
(
'
EPSG:4326
'
),
ol
.
proj
.
get
(
'
EPSG:31467
'
))
var
gsk3_coord
=
ol
.
proj
.
transform
(
coords
[
i
],
ol
.
proj
.
get
(
'
EPSG:4326
'
),
ol
.
proj
.
get
(
'
EPSG:31467
'
))
;
gsk3_coords
+=
"
(
"
+
gsk3_coord
[
0
]
+
"
,
"
+
gsk3_coord
[
1
]
+
"
)<br/>
"
;
}
dataPanel
.
append
(
"
WGS84 Coordinates<br/>
"
);
...
...
@@ -266,7 +266,7 @@ function displayInfo() {
// console.log('Execution time: ' + time);
}
draw
.
on
(
'
drawend
'
,
function
(
e
)
{
draw
.
on
(
'
drawend
'
,
function
()
{
displayInfo
();
draw
.
setActive
(
false
);
});
...
...
@@ -291,15 +291,15 @@ novafactory_layer.downloadFinished = function() {
this
.
disabled
=
false
;
// FIXME: Doesn't stop waiting cursor
$
(
"
html
"
).
removeClass
(
"
wait
"
);
}
}
;
novafactory_layer
.
updateStatus
=
function
(
status
)
{
dataPanel
.
append
(
"
NovaFactory :
"
+
status
+
"
<br/>
\n
"
);
}
}
;
novafactory_layer
.
selectSaveFile
=
function
(
zipFilename
)
{
fxapp
.
doSomethingWithThisZIP
(
zipFilename
);
}
}
;
function
downloadRegionFromNovaFACTORY
(
i
)
{
$
(
"
html
"
).
addClass
(
"
wait
"
);
...
...
@@ -315,12 +315,12 @@ function downloadRegionFromNovaFACTORY(i) {
}
function
sketchAsWKT
(
epsgId
)
{
var
epsgId
=
(
typeof
epsgId
===
'
undefined
'
)
?
'
31467
'
:
epsgId
;
epsgId
=
(
typeof
epsgId
===
'
undefined
'
)
?
'
31467
'
:
epsgId
;
var
wktFormat
=
new
ol
.
format
.
WKT
();
return
wktFormat
.
writeFeature
(
sketch
,
{
dataProjection
:
ol
.
proj
.
get
(
'
EPSG:
'
+
epsgId
),
featureProjection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
)
})
})
;
}
function
focusOnMap
()
{
...
...
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