Commit 34963593 authored by Matija Obreza's avatar Matija Obreza

Cleanup

- Fixed bugged JS formatted code
- Updated deprecated ObjectMapper#put call
parent 0f1257e2
...@@ -108,7 +108,7 @@ public class MappingServiceImpl implements MappingService { ...@@ -108,7 +108,7 @@ public class MappingServiceImpl implements MappingService {
final ObjectNode geoJson = mapper.createObjectNode(); final ObjectNode geoJson = mapper.createObjectNode();
geoJson.put("type", "FeatureCollection"); geoJson.put("type", "FeatureCollection");
final ArrayNode featuresArray = geoJson.arrayNode(); final ArrayNode featuresArray = geoJson.arrayNode();
geoJson.put("features", featuresArray); geoJson.set("features", featuresArray);
filterService.listGeo(filters, limit, new RowCallbackHandler() { filterService.listGeo(filters, limit, new RowCallbackHandler() {
@Override @Override
...@@ -119,16 +119,16 @@ public class MappingServiceImpl implements MappingService { ...@@ -119,16 +119,16 @@ public class MappingServiceImpl implements MappingService {
feature.put("id", rs.getLong("id")); feature.put("id", rs.getLong("id"));
ObjectNode geometry; ObjectNode geometry;
feature.put("geometry", geometry = feature.objectNode()); feature.set("geometry", geometry = feature.objectNode());
geometry.put("type", "Point"); geometry.put("type", "Point");
ArrayNode coordArray; ArrayNode coordArray;
geometry.put("coordinates", coordArray = geometry.arrayNode()); geometry.set("coordinates", coordArray = geometry.arrayNode());
coordArray.add(rs.getDouble("longitude")); coordArray.add(rs.getDouble("longitude"));
coordArray.add(rs.getDouble("latitude")); coordArray.add(rs.getDouble("latitude"));
ObjectNode properties; ObjectNode properties;
feature.put("properties", properties = feature.objectNode()); feature.set("properties", properties = feature.objectNode());
properties.put("acceNumb", rs.getString("acceNumb")); properties.put("acceNumb", rs.getString("acceNumb"));
properties.put("instCode", rs.getString("instCode")); properties.put("instCode", rs.getString("instCode"));
properties.put("datum", rs.getString("datum")); properties.put("datum", rs.getString("datum"));
......
...@@ -1076,30 +1076,22 @@ ...@@ -1076,30 +1076,22 @@
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
var map = L.map('map', {scrollWheelZoom: false}).setView([ var map = L.map('map', {scrollWheelZoom: false}).setView([
$ { ${accessionGeo.latitude}, ${accessionGeo.longitude}
accessionGeo.latitude
},
$ {accessionGeo.longitude}
], 4); ], 4);
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', { L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
attribution: "Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ", attribution: "Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ",
maxZoom: 16 maxZoom: 16
}).addTo(map); }).addTo(map);
var marker = L.marker([ var marker = L.marker([
$ { ${accessionGeo.latitude}, ${accessionGeo.longitude}
accessionGeo.latitude
},
$ {accessionGeo.longitude}
]).addTo(map); ]).addTo(map);
}); });
</script> </script>
</c:if> </c:if>
<c:if test="${worldclimJson ne null}"> <c:if test="${worldclimJson ne null}">
<script type="text/javascript"> <script type="text/javascript">
var monthNames = $ { var monthNames = ${jspHelper.toJson(jspHelper.monthShortNames(pageContext.response.locale))};
jspHelper.toJson(jspHelper.monthShortNames(pageContext.response.locale)) var worldclim = ${jspHelper.toJson(worldclimJson)};
};
var worldclim = $ {jspHelper.toJson(worldclimJson)};
function arrayToData(array) { function arrayToData(array) {
var ret = []; var ret = [];
for (var i = 0; i < 12; i++) { for (var i = 0; i < 12; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment