drawing polygon bug fixed

parent a7871b06
...@@ -26,33 +26,33 @@ var makeRequest = function (value) { ...@@ -26,33 +26,33 @@ var makeRequest = function (value) {
dataType : 'json', dataType : 'json',
success : function(data) { success : function(data) {
polygonList = data.polygonList; polygonList = data.polygonList;
while (pol_element.firstChild) { while (pol_element.firstChild) {
pol_element.removeChild(pol_element.firstChild); pol_element.removeChild(pol_element.firstChild);
} }
if (polygonList.length <= 0) { if (polygonList.length <= 0) {
var temp = document.querySelector('#city_list_template'); var temp = document.querySelector('#city_list_template');
// filling template // filling template
temp.content.querySelector('li').id = ''; temp.content.querySelector('li').id = '';
temp.content.querySelectorAll('span')[0].textContent = 'No cities matched your search. Try again.'; temp.content.querySelectorAll('span')[0].textContent = 'No cities matched your search. Try again.';
temp.content.querySelectorAll('span')[1].textContent = ''; temp.content.querySelectorAll('span')[1].textContent = '';
temp.content.querySelectorAll('div')[3].textContent = ''; temp.content.querySelectorAll('div')[3].textContent = '';
var clone = document.importNode(temp.content, true); var clone = document.importNode(temp.content, true);
document.querySelector('#polygon-list').appendChild(clone); document.querySelector('#polygon-list').appendChild(clone);
} else { } else {
data.polygonList.forEach(function (polygon) { data.polygonList.forEach(function (polygon) {
var temp = document.querySelector('#city_list_template'); var temp = document.querySelector('#city_list_template');
// filling template // filling template
temp.content.querySelector('li').id = polygon.id; temp.content.querySelector('li').id = polygon.id;
temp.content.querySelectorAll('span')[0].textContent = polygon.city + ", " + polygon.state; temp.content.querySelectorAll('span')[0].textContent = polygon.city + ", " + polygon.state;
temp.content.querySelectorAll('span')[1].textContent = polygon.description; temp.content.querySelectorAll('span')[1].textContent = polygon.description;
temp.content.querySelectorAll('div')[3].textContent = "Fuente: " + polygon.source; temp.content.querySelectorAll('div')[3].textContent = "Fuente: " + polygon.source;
var clone = document.importNode(temp.content, true); var clone = document.importNode(temp.content, true);
document.querySelector('#polygon-list').appendChild(clone); document.querySelector('#polygon-list').appendChild(clone);
}); });
...@@ -84,16 +84,16 @@ function drawPolygon(element) { ...@@ -84,16 +84,16 @@ function drawPolygon(element) {
osmap.removePolygon(); osmap.removePolygon();
// draw wkt polygon // draw wkt polygon
// osmap.addWKTPolygon(polygon.wkt_polygon); osmap.addWKTPolygon(polygon.wkt_polygon);
// format coords to draw // format coords to draw
var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates); // var coords = osmap.formatCoords(polygon.geojson.geometry.coordinates);
// get the biggest area // get the biggest area
var biggest = osmap.getBiggestPolygon(coords); // var biggest = osmap.getBiggestPolygon(coords);
// draw coordsR // draw coordsR
osmap.addPolygon(biggest); // osmap.addPolygon(biggest);
} }
}) })
} }
...@@ -162,7 +162,7 @@ function drawApiResponse(element) { ...@@ -162,7 +162,7 @@ function drawApiResponse(element) {
function createProductContainer() { function createProductContainer() {
var temp_1 = document.querySelector('#product_cart_1'); var temp_1 = document.querySelector('#product_cart_1');
// filling template // filling template
temp_1.content.querySelector('span').textContent = "Product"; temp_1.content.querySelector('span').textContent = "Product";
...@@ -178,7 +178,7 @@ $('#ajax-input').focus(function () { ...@@ -178,7 +178,7 @@ $('#ajax-input').focus(function () {
$('#option-list').show(); $('#option-list').show();
OPT_LIST_IS_HIDDEN = false; OPT_LIST_IS_HIDDEN = false;
} }
}).blur(function () { }).blur(function (event) {
INPUT_ON_FOCUS = false; INPUT_ON_FOCUS = false;
if (!OPT_LIST_IS_HIDDEN && $(this).val() && $(event.target).closest('#option-list').length) { if (!OPT_LIST_IS_HIDDEN && $(this).val() && $(event.target).closest('#option-list').length) {
$('#option-list').hide(); $('#option-list').hide();
...@@ -243,13 +243,13 @@ $(document).ready(function () { ...@@ -243,13 +243,13 @@ $(document).ready(function () {
typingTimer = setTimeout(makeRequest.bind(null, value), typingInterval); typingTimer = setTimeout(makeRequest.bind(null, value), typingInterval);
} else { } else {
$('#option-list').hide(); $('#option-list').hide();
while (pol_element.firstChild) { while (pol_element.firstChild) {
pol_element.removeChild(pol_element.firstChild); pol_element.removeChild(pol_element.firstChild);
} }
OPT_LIST_IS_HIDDEN = true; OPT_LIST_IS_HIDDEN = true;
return return
} }
}); });
...@@ -304,7 +304,7 @@ $(document).ready(function () { ...@@ -304,7 +304,7 @@ $(document).ready(function () {
temp.content.querySelectorAll('span')[1].textContent = data.product.identifier; temp.content.querySelectorAll('span')[1].textContent = data.product.identifier;
temp.content.querySelectorAll('span')[2].textContent = data.product.size; temp.content.querySelectorAll('span')[2].textContent = data.product.size;
temp.content.querySelectorAll('span')[3].textContent = data.product.instrumentname; temp.content.querySelectorAll('span')[3].textContent = data.product.instrumentname;
var clone = document.importNode(temp.content, true); var clone = document.importNode(temp.content, true);
document.querySelector('#product-list-globe').appendChild(clone); document.querySelector('#product-list-globe').appendChild(clone);
} }
...@@ -397,7 +397,7 @@ $(document).ready(function () { ...@@ -397,7 +397,7 @@ $(document).ready(function () {
productsToObtain = []; productsToObtain = [];
data.product_list.forEach(function (product) { data.product_list.forEach(function (product) {
var temp_2 = document.querySelector('#product_cart_2'); var temp_2 = document.querySelector('#product_cart_2');
// filling template // filling template
temp_2.content.querySelector('li').id = product.uuid; temp_2.content.querySelector('li').id = product.uuid;
temp_2.content.querySelector('h4').id = product.uuid + "-h4"; temp_2.content.querySelector('h4').id = product.uuid + "-h4";
...@@ -424,7 +424,7 @@ $(document).ready(function () { ...@@ -424,7 +424,7 @@ $(document).ready(function () {
} }
}); });
// purchasing products in cart // purchasing products in cart
$('#purchased-product-form').submit(function (event) { $('#purchased-product-form').submit(function (event) {
event.preventDefault(); event.preventDefault();
......
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