HTML element :\n*\n*/\nfunction unfillSelectInput(select_node) {\n select_node.innerHTML = ''; // eslint-disable-line no-param-reassign\n // for (let i = select_node.childElementCount - 1; i > -1; i--) {\n // select_node.removeChild(select_node.children[i]);\n // }\n}\n\n/** Function trying to avoid layer name collision by adding a suffix\n* to the layer name if already exists and incrementing it if necessary\n* (MyLayer -> MyLayer_1 -> MyLayer_2 etc.)\n*\n* @param {string} name - The original wanted name of the layer to add\n* @return {string} new_name - An available name to safely add the layer\n* (the input name if possible or a slightly modified\n* one to avoid collision or unwanted characters)\n*/\nfunction check_layer_name(name) {\n var clean_name = name.replace(/[^a-zA-Z0-9_-]/g, '_');\n if (clean_name.match(/^\\d+/)) {\n clean_name = '_' + clean_name;\n }\n if (!data_manager.current_layers.hasOwnProperty(clean_name) && ['Graticule', 'World'].indexOf(clean_name) < 0) {\n return clean_name;\n }\n // else {\n var i = 1;\n var match = clean_name.match(/_\\d+$/);\n if (!match) {\n return check_layer_name([clean_name, i].join('_'));\n }\n i = match[0];\n clean_name = clean_name.substring(clean_name, clean_name.indexOf(i));\n return check_layer_name([clean_name, parseInt(i.slice(1, i.length), 10) + 1].join('_'));\n}\n\n/**\n* Display a message when switching between functionnalities if the layer to render\n* doesn't have any interesting field to use.\n*/\nfunction display_error_num_field() {\n // Actually we are not diplaying an error message anymore but closing\n // closing the openend menu if their is no intersting field to be used for this\n // kind of representation. TODO : Reflect that in function names etc.\n clean_menu_function();\n // swal({\n // title: '',\n // text: _tr('app_page.common.error_type_fields'),\n // type: 'error',\n // });\n}\n\n/**\n* Display a warning message if the target layer contains\n* one or more empty feature(s).\n*\n* @param {Array} features - the empty features\n*\n* @return void\n*/\nfunction display_warning_empty_geom(features) {\n swal({\n title: '',\n text: _tr('app_page.common.warning_empty_geom', { count: features.length }),\n type: 'warning',\n showCancelButton: false,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.valid') + '!'\n });\n}\n\n/**\n* Return an approximate value (based on the bbox of the targeted layer)\n* to fill the \"span\" field in stewart functionnality\n* as well as the \"resolution\" field in grid functionnality.\n*\n* @param {String} func_name - the name of the representation for which this function\n* is called (between 'grid' and 'stewart').\n* @return Number - A first guess for the span value (with no decimal if possible)\n*/\nvar get_first_guess_span = function get_first_guess_span(func_name) {\n var bbox = _target_layer_file.bbox,\n\n // layer_name = Object.getOwnPropertyNames(_target_layer_file.objects),\n const_mult = func_name === 'grid' ? 0.09 : 0.05;\n var width_km = (0, _helpers_calc.haversine_dist)([bbox[0], (0, _helpers_math.Mabs)(bbox[3]) - (0, _helpers_math.Mabs)(bbox[1])], [bbox[2], (0, _helpers_math.Mabs)(bbox[3]) - (0, _helpers_math.Mabs)(bbox[1])]);\n var height_km = (0, _helpers_calc.haversine_dist)([(0, _helpers_math.Mabs)(bbox[2]) - (0, _helpers_math.Mabs)(bbox[0]), bbox[1]], [(0, _helpers_math.Mabs)(bbox[2]) - (0, _helpers_math.Mabs)(bbox[0]), bbox[3]]);\n var val = (0, _helpers_math.Mmax)(width_km, height_km) * const_mult;\n return val > 10 ? (0, _helpers_math.Mround)(val / 10) * 10 : (0, _helpers_math.Mround)(val);\n};\n\n/**\n* Check if the wanted resolution isn't too big before sending the request\n* to the server.\n*\n* @param {Number} cell_value - The cell value to test\n* @return\n*/\nfunction test_maxmin_resolution(cell_value) {\n var bbox = _target_layer_file.bbox;\n var width_km = (0, _helpers_calc.haversine_dist)([bbox[0], (0, _helpers_math.Mabs)(bbox[3]) - (0, _helpers_math.Mabs)(bbox[1])], [bbox[2], (0, _helpers_math.Mabs)(bbox[3]) - (0, _helpers_math.Mabs)(bbox[1])]);\n var height_km = (0, _helpers_calc.haversine_dist)([(0, _helpers_math.Mabs)(bbox[2]) - (0, _helpers_math.Mabs)(bbox[0]), bbox[1]], [(0, _helpers_math.Mabs)(bbox[2]) - (0, _helpers_math.Mabs)(bbox[0]), bbox[3]]);\n // const area = width_km * height_km;\n var bigger_side = (0, _helpers_math.Mmax)(height_km, width_km);\n if (width_km * height_km / (cell_value * cell_value) > 15000) {\n return 'higher';\n } else if (cell_value > bigger_side / 1.66) {\n return 'lower';\n }\n // return;\n}\n\n/*\n* Set the appropriate discretisation icon as selected\n*\n*/\nvar color_disc_icons = function () {\n var types = new Set(['q6', 'equal_interval', 'jenks', 'quantiles']);\n return function (type_disc) {\n if (!type_disc) return;\n var t_disc = type_disc.toLowerCase();\n if (types.has(t_disc)) {\n document.getElementById('ico_' + t_disc).style.border = 'solid 1px green';\n }\n };\n}();\n\nfunction make_template_functionnality(parent_node) {\n return parent_node.append('div').attr('class', 'func-options');\n}\n\n/**\n* Make the input element allowing to choose the resulting layer name\n* (used for each representation type)\n* @param {Object} parent - The parent of the element to be created.\n* @param {String} id - the id of the element to be created.\n* @param {String} margin_top - The margin on the top of the input element (in px).\n* @return {void}\n*/\nfunction make_layer_name_input(parent, id) {\n var a = parent.append('p').style('clear', 'both');\n a.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.output' }).html(_tr('app_page.func_options.common.output'));\n a.insert('input').attrs({ class: 'params', id: id }).styles({\n width: '240px',\n float: 'right',\n 'font-size': '11.5px',\n 'margin-bottom': '20px',\n 'margin-right': '20px',\n 'margin-top': '8px'\n });\n}\n\nfunction make_discretization_icons(discr_section) {\n var subsection1 = discr_section.append('div');\n subsection1.insert('span').attrs({ 'data-i18n': '[html]app_page.func_options.common.discretization_choice', class: 'i18n' }).html(_tr('app_page.func_options.common.discretization_choice'));\n\n var subsection2 = discr_section.append('p').style('margin', '10px 0 0');\n subsection2.append('img').styles({ margin: '0 7.5px', cursor: 'pointer' }).attrs({\n title: _tr('app_page.common.Q6'),\n src: 'static/img/discr_icons/q6.png',\n id: 'ico_q6',\n class: 'i18n',\n 'data-i18n': '[title]app_page.common.Q6'\n });\n subsection2.append('img').styles({ margin: '0 7.5px', cursor: 'pointer' }).attrs({\n title: _tr('app_page.common.jenks'),\n src: 'static/img/discr_icons/jenks.png',\n id: 'ico_jenks',\n class: 'i18n',\n 'data-i18n': '[title]app_page.common.jenks'\n });\n subsection2.append('img').styles({ margin: '0 7.5px', cursor: 'pointer' }).attrs({\n title: _tr('app_page.common.equal_interval'),\n src: 'static/img/discr_icons/equal_intervals.png',\n id: 'ico_equal_interval',\n class: 'i18n',\n 'data-i18n': '[title]app_page.common.equal_interval'\n });\n subsection2.append('img').styles({ margin: '0 7.5px', cursor: 'pointer' }).attrs({\n title: _tr('app_page.common.quantiles'),\n src: 'static/img/discr_icons/quantiles.png',\n id: 'ico_quantiles',\n class: 'i18n',\n 'data-i18n': '[title]app_page.common.quantiles'\n });\n subsection2.append('img').styles({ margin: '0 7.5px', cursor: 'pointer', width: '20px' }).attrs({\n title: _tr('app_page.common.user_defined'),\n src: 'static/img/High-contrast-system-run24.png',\n id: 'ico_others',\n class: 'i18n',\n 'data-i18n': '[title]app_page.common.user_defined'\n });\n subsection2.append('span').attrs({ id: 'choro_mini_choice_disc' }).styles({ float: 'right', 'margin-top': '5px', 'margin-left': '15px' });\n subsection2.append('img').styles({ width: '15px', position: 'absolute', right: '25px' }).attrs({ id: 'img_choice_disc', src: 'static/img/Red_x.png' });\n}\n\nfunction make_ok_button(parent, id) {\n var disabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var a = parent.append('p').styles({ clear: 'both', 'text-align': 'center', margin: 'auto' });\n a.append('button').attrs({\n id: id,\n class: 'params button_st3 i18n',\n 'data-i18n': '[html]app_page.func_options.common.render',\n disabled: disabled ? true : null\n }).html(_tr('app_page.func_options.common.render'));\n}\n\nfunction make_min_max_tableau(values, nb_class, discontinuity_type, min_size, max_size, id_parent, breaks, callback) {\n var parent_nd = document.getElementById(id_parent);\n parent_nd.innerHTML = '';\n\n if (values && breaks === undefined) {\n var disc_result = (0, _common.discretize_to_size)(values, discontinuity_type, nb_class, min_size, max_size);\n breaks = disc_result[2]; // eslint-disable-line no-param-reassign\n if (!breaks) return false;\n }\n\n parent_nd.style.marginTop = '3px';\n parent_nd.style.marginBottom = '3px';\n\n var title = document.createElement('p');\n // title.style = \"margin: 1px; word-spacing: 1.8em;\";\n title.style.margin = '1px';\n title.style.wordSpacing = '1.8em';\n title.style.paddingLeft = '22px';\n title.innerHTML = 'Min - Max - Size';\n parent_nd.appendChild(title);\n\n var div_table = document.createElement('div');\n parent_nd.appendChild(div_table);\n for (var i = 0; i < breaks.length; i++) {\n var inner_line = document.createElement('p');\n inner_line.setAttribute('class', 'breaks_vals');\n inner_line.id = ['line', i].join('_');\n inner_line.style.margin = '0px';\n\n var input1 = document.createElement('input');\n input1.setAttribute('type', 'number');\n input1.setAttribute('class', 'min_class');\n input1.setAttribute('step', 'any');\n input1.value = (+breaks[i][0][0]).toFixed(2);\n input1.style.position = 'unset';\n inner_line.appendChild(input1);\n\n var input2 = document.createElement('input');\n input2.setAttribute('type', 'number');\n input2.setAttribute('class', 'max_class');\n input2.setAttribute('step', 'any');\n input2.value = (+breaks[i][0][1]).toFixed(2);\n input2.style.position = 'unset';\n inner_line.appendChild(input2);\n\n var input3 = document.createElement('input');\n input3.setAttribute('type', 'number');\n input3.setAttribute('class', 'size_class');\n input3.setAttribute('step', 'any');\n input3.value = (+breaks[i][1]).toFixed(2);\n input3.style.marginLeft = '20px';\n input3.style.position = 'unset';\n inner_line.appendChild(input3);\n\n var px = document.createElement('span');\n px.innerHTML = ' px';\n inner_line.appendChild(px);\n div_table.appendChild(inner_line);\n }\n\n var mins = document.getElementById(id_parent).querySelectorAll('.min_class'),\n maxs = document.getElementById(id_parent).querySelectorAll('.max_class');\n\n for (var _i = 0; _i < mins.length; _i++) {\n if (_i > 0) {\n (function () {\n var prev_ix = _i - 1;\n mins[_i].onchange = function () {\n maxs[prev_ix].value = this.value;\n if (callback) callback();\n };\n })();\n }\n if (_i < mins.length - 1) {\n (function () {\n var next_ix = _i + 1;\n maxs[_i].onchange = function () {\n mins[next_ix].value = this.value;\n if (callback) callback();\n };\n })();\n }\n }\n if (callback) {\n var sizes = document.getElementById(id_parent).querySelectorAll('.size_class');\n for (var _i2 = 0; _i2 < sizes.length; _i2++) {\n sizes[_i2].onchange = callback;\n }\n }\n}\n\nfunction fetch_min_max_table_value(parent_id) {\n var parent_node = void 0;\n if (parent_id) {\n parent_node = document.getElementById(parent_id);\n } else if (_app.current_functionnality.name === 'flow') {\n parent_node = document.getElementById('FlowMap_discTable');\n } else if (_app.current_functionnality.name === 'discont') {\n parent_node = document.getElementById('Discont_discTable');\n } else {\n return;\n }\n var mins = Array.prototype.map.call(parent_node.querySelectorAll('.min_class'), function (el) {\n return +el.value;\n }),\n maxs = Array.prototype.map.call(parent_node.querySelectorAll('.max_class'), function (el) {\n return +el.value;\n }),\n sizes = Array.prototype.map.call(parent_node.querySelectorAll('.size_class'), function (el) {\n return +el.value;\n }),\n\n // nb_class = mins.length,\n comp_fun = function comp_fun(a, b) {\n return a - b;\n };\n\n var r_mins = [].concat(mins);\n var r_maxs = [].concat(maxs);\n var r_sizes = [].concat(sizes);\n var sorted_min = mins.sort(comp_fun);\n var sorted_max = maxs.sort(comp_fun);\n var sorted_sizes = sizes.sort(comp_fun);\n // Some verification regarding the input values provided by the user :\n // - Values are ordered :\n if (!(r_mins.every(function (d, i) {\n return sorted_min[i] === d;\n }) && r_maxs.every(function (d, i) {\n return sorted_max[i] === d;\n }) && r_sizes.every(function (d, i) {\n return sorted_sizes[i] === d;\n }))) {\n swal('', _tr('app_page.common.error_values_order'), 'error');\n }\n\n return { mins: sorted_min, maxs: sorted_max, sizes: sorted_sizes };\n}\n\nfunction fillMenu_TwoStocks() {\n var dv2 = make_template_functionnality(section2);\n\n var f1 = dv2.append('p').attr('class', 'params_section2');\n f1.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.fields' }).html(_tr('app_page.func_options.twostocks.fields'));\n f1.insert('select').attrs({\n class: 'params',\n id: 'TwoStocks_fields',\n multiple: 'multiple',\n size: 2\n });\n\n // const f2 = dv2.append('p').attr('class', 'params_section2');\n // f2.append('span')\n // .attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.field2' })\n // .html(_tr('app_page.func_options.twostocks.field2'));\n // f2.insert('select')\n // .attrs({ class: 'params', id: 'TwoStocks_field2' });\n\n // const a = dv2.append('p').attr('class', 'params_section2');\n // a.append('span')\n // .attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.type' })\n // .html(_tr('app_page.func_options.twostocks.type'));\n // const type_select = a.insert('select')\n // .attrs({ class: 'params', id: 'TwoStocks_type' });\n\n\n // Options for waffles :\n var b = dv2.append('p').attr('class', 'params_section2');\n b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.symbol_choice' }).html(_tr('app_page.func_options.twostocks.symbol_choice'));\n b.insert('select').attrs({ class: 'params', id: 'TwoStocks_waffle_symbol' });\n\n var c = dv2.append('p').attr('class', 'params_section2');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.waffle_size_circle', id: 'TwoStocks_waffle_size_txt' }).html(_tr('app_page.func_options.twostocks.waffle_size_circle'));\n c.insert('input').attrs({\n id: 'TwoStocks_waffle_size',\n type: 'number',\n class: 'params',\n min: 1,\n max: 20,\n step: 1\n }).style('width', '50px').property('value', 3);\n c.append('span').html(' (px)');\n\n var d = dv2.append('p').attr('class', 'params_section2');\n d.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.waffle_width_rows' }).html(_tr('app_page.func_options.twostocks.waffle_width_rows'));\n d.insert('input').attrs({\n id: 'TwoStocks_waffle_WidthRow',\n class: 'params',\n type: 'number',\n min: 2,\n max: 8,\n step: 1\n }).style('width', '50px').property('value', 2);\n\n var e = dv2.append('p').attr('class', 'params_section2');\n e.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.waffle_ratio' }).html(_tr('app_page.func_options.twostocks.waffle_ratio'));\n e.insert('input').attrs({\n id: 'TwoStocks_waffle_ratio',\n class: 'params',\n type: 'number',\n min: 1,\n max: 1000000,\n step: 1\n }).style('width', '50px').property('value', 100);\n e.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.twostocks.waffle_ratio_units' }).html(_tr('app_page.func_options.twostocks.waffle_ratio_units'));\n\n make_layer_name_input(dv2, 'TwoStocks_output_name');\n make_ok_button(dv2, 'twoStocks_yes');\n dv2.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_TwoStocks = {\n fill: function fill(layer) {\n if (!layer) return;\n section2.selectAll('.params').attr('disabled', null);\n var fields_stock = (0, _helpers.getFieldsType)('stock', layer);\n var symbol_choice = section2.select('#TwoStocks_waffle_symbol');\n var fields_list = section2.select('#TwoStocks_fields');\n var ok_button = section2.select('#twoStocks_yes');\n // const ratio_select = section2.select('#TwoStocks_waffle_ratio');\n var input_name = section2.select('#TwoStocks_output_name');\n [['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symbol_choice.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n var nb_display_fields = fields_stock.length <= 4 ? fields_stock.length : 4;\n fields_stock.forEach(function (f) {\n fields_list.append('option').text(f).attr('value', f);\n });\n fields_list.node().parentElement.style.marginBottom = nb_display_fields * 16 + 'px';\n fields_list.attr('size', nb_display_fields);\n symbol_choice.on('change', function () {\n if (this.value === 'circle') {\n section2.select('#TwoStocks_waffle_size_txt').attr('data-i18n', '[html]app_page.func_options.twostocks.waffle_size_circle').text(_tr('app_page.func_options.twostocks.waffle_size_circle'));\n } else {\n section2.select('#TwoStocks_waffle_size_txt').attr('data-i18n', '[html]app_page.func_options.twostocks.waffle_size_square').text(_tr('app_page.func_options.twostocks.waffle_size_square'));\n }\n });\n input_name.node().value = layer + '_Waffle';\n ok_button.on('click', function () {\n var rendering_params = {};\n var new_layer_name = document.getElementById('TwoStocks_output_name').value;\n new_layer_name = check_layer_name(new_layer_name.length > 0 ? new_layer_name : layer + '_Waffle');\n rendering_params.ratio = +document.getElementById('TwoStocks_waffle_ratio').value;\n rendering_params.fields = Array.prototype.slice.call(fields_list.node().selectedOptions).map(function (elem) {\n return elem.value;\n });\n\n // Verify that there is 2 or more fields selected :\n if (rendering_params.fields.length < 2) {\n swal({\n title: _tr('app_page.common.error') + '!',\n text: '' + _tr('app_page.common.error_multiple_fields'),\n customClass: 'swal2_custom',\n type: 'error',\n allowOutsideClick: false\n });\n return;\n }\n\n // Verify that there isn't too many symbols to draw:\n var t_max = 0;\n\n var _loop = function _loop(i) {\n var field = rendering_params.fields[i];\n t_max += (0, _helpers_calc.max_fast)(data_manager.user_data[layer].map(function (obj) {\n return +obj[field];\n })) / rendering_params.ratio;\n };\n\n for (var i = 0; i < rendering_params.fields.length; i++) {\n _loop(i);\n }\n\n if (t_max > 900) {\n swal({\n title: _tr('app_page.common.error') + '!',\n text: '' + _tr('app_page.common.error_waffle_too_many'),\n customClass: 'swal2_custom',\n type: 'error',\n allowOutsideClick: false\n });\n return;\n }\n\n // Fetch the necessary settings for rendering the waffle map:\n rendering_params.new_name = new_layer_name;\n rendering_params.symbol_type = symbol_choice.node().value;\n rendering_params.size = +document.getElementById('TwoStocks_waffle_size').value;\n rendering_params.nCol = +document.getElementById('TwoStocks_waffle_WidthRow').value;\n\n render_twostocks_waffle(layer, rendering_params);\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n });\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('TwoStocks_waffle_symbol'));\n unfillSelectInput(document.getElementById('TwoStocks_fields'));\n unfillSelectInput(document.getElementById('TwoStocks_waffle_ratio'));\n document.getElementById('TwoStocks_fields').size = 2;\n document.getElementById('TwoStocks_fields').parentElement.style.marginBottom = '25px';\n section2.selectAll('.params').attr('disabled', true);\n }\n};\n\nfunction render_twostocks_waffle(layer, rendering_params) {\n var get_colors = function get_colors(nb) {\n var res = [];\n for (var i = 0; i < nb; i++) {\n res.push((0, _colors_helpers.randomColor)());\n }\n return res;\n };\n var ratio = rendering_params.ratio,\n symbol_type = rendering_params.symbol_type,\n nCol = rendering_params.nCol,\n fields = rendering_params.fields,\n layer_to_add = rendering_params.new_name;\n var floor = Math.floor,\n round = Math.round;\n\n var nbVar = fields.length;\n var colors = [];\n var sums = [];\n var ref_colors = void 0;\n\n var layer_id = encodeId(layer_to_add);\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n\n if (!rendering_params.result_data) {\n ref_colors = get_colors(nbVar);\n data_manager.result_data[layer_to_add] = [];\n var ref_layer_selection = map.select('#' + _app.layer_to_id.get(layer)).selectAll('path');\n var centroids = getCentroids(ref_layer_selection._groups[0]);\n var empty_geoms = [];\n\n ref_layer_selection.each(function (d, i) {\n if (!centroids[i]) {\n empty_geoms.push(d);\n } else {\n var r = { id: d.id, centroid: centroids[i] };\n for (var j = 0; j < nbVar; j++) {\n var _field = fields[j];\n r[_field] = +data_manager.user_data[layer][i][_field];\n }\n data_manager.result_data[layer_to_add].push(r);\n }\n });\n if (empty_geoms.length > 0) {\n display_warning_empty_geom(empty_geoms);\n }\n } else {\n ref_colors = rendering_params.ref_colors;\n data_manager.result_data[layer_to_add] = JSON.parse(rendering_params.result_data);\n }\n\n for (var i = 0, _length = data_manager.result_data[layer_to_add].length; i < _length; i++) {\n var c = [];\n var sum = 0;\n var color = void 0;\n for (var j = 0; j < nbVar; j++) {\n var val = data_manager.result_data[layer_to_add][i][fields[j]] / ratio;\n sum += val;\n color = ref_colors[j];\n for (var ix = 0; ix < val; ix++) {\n c.push(color);\n }\n }\n colors.push(c);\n sums.push(sum);\n }\n\n var nb_features = data_manager.result_data[layer_to_add].length;\n var new_layer = map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer no_clip' });\n\n if (symbol_type === 'circle') {\n var r = rendering_params.size;\n for (var _j = 0; _j < data_manager.result_data[layer_to_add].length; _j++) {\n var centroid = path.centroid({\n type: 'Point',\n coordinates: data_manager.result_data[layer_to_add][_j].centroid\n });\n var group = new_layer.append('g');\n var _sum = sums[_j];\n var _colors = colors[_j];\n for (var _i3 = 0; _i3 < _sum; _i3++) {\n var t_x = round(_i3 % nCol * 2 * r);\n var t_y = floor(floor(_i3 / nCol) * 2 * r);\n group.append('circle').attrs({\n transform: 'translate(-' + t_x + ', -' + t_y + ')',\n cx: centroid[0],\n cy: centroid[1],\n r: r,\n id: ['waffle_', _i3, ' feature_', data_manager.result_data[layer_to_add][_j].id].join(''),\n fill: _colors[_i3]\n });\n }\n group.node().__data__ = {\n type: 'Feature',\n properties: data_manager.result_data[layer_to_add][_j],\n geometry: {\n type: 'Point',\n coordinates: data_manager.result_data[layer_to_add][_j].centroid\n }\n };\n group.call(_helpers.drag_waffle);\n }\n } else if (symbol_type === 'rect') {\n var width = rendering_params.size;\n var offset = width / 5;\n for (var _j2 = 0; _j2 < data_manager.result_data[layer_to_add].length; _j2++) {\n var _centroid = path.centroid({\n type: 'Point',\n coordinates: data_manager.result_data[layer_to_add][_j2].centroid\n });\n var _group = new_layer.append('g');\n var _sum2 = sums[_j2];\n var _colors2 = colors[_j2];\n for (var _i4 = 0; _i4 < _sum2; _i4++) {\n var _t_x = round(_i4 % nCol * width) + offset * round(_i4 % nCol);\n var _t_y = floor(floor(_i4 / nCol) * width) + offset * floor(_i4 / nCol);\n _group.append('rect').attrs({\n transform: 'translate(-' + _t_x + ', -' + _t_y + ')',\n x: _centroid[0],\n y: _centroid[1],\n width: width,\n height: width,\n id: ['waffle_', _i4, ' feature_', data_manager.result_data[layer_to_add][_j2].id].join(''),\n fill: _colors2[_i4]\n });\n }\n _group.node().__data__ = {\n type: 'Feature',\n properties: data_manager.result_data[layer_to_add][_j2],\n geometry: {\n type: 'Point',\n coordinates: data_manager.result_data[layer_to_add][_j2].centroid\n }\n };\n _group.call(_helpers.drag_waffle);\n }\n }\n\n data_manager.current_layers[layer_to_add] = {\n fill_color: ref_colors,\n n_features: nb_features,\n renderer: 'TwoStocksWaffle',\n symbol: symbol_type,\n rendered_field: fields,\n size: rendering_params.size,\n ratio: ratio,\n nCol: nCol,\n 'stroke-width-const': 0,\n is_result: true,\n ref_layer_name: layer,\n draggable: false\n };\n (0, _helpers.create_li_layer_elem)(layer_to_add, nb_features, ['Point', 'waffle'], 'result');\n}\n\nfunction fillMenu_PropSymbolChoro() {\n var dv2 = make_template_functionnality(section2);\n\n var a = dv2.append('p').attr('class', 'params_section2');\n a.append('p').style('margin', 'auto').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.field1' }).html(_tr('app_page.func_options.choroprop.field1'));\n a.insert('select').attrs({ class: 'params', id: 'PropSymbolChoro_field_1' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var b = dv2.append('p').attr('class', 'params_section2').styles({ margin: 'auto' });\n b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.fixed_size' }).html(_tr('app_page.func_options.choroprop.fixed_size'));\n b.insert('input').attrs({\n id: 'PropSymbolChoro_ref_size',\n type: 'number',\n class: 'params',\n min: 0.1,\n max: 100.0,\n step: 'any'\n }).style('width', '50px').property('value', 60);\n b.append('span').html(' (px)');\n\n var c = dv2.append('p').attr('class', 'params_section2');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.on_value' }).html(_tr('app_page.func_options.choroprop.on_value'));\n c.insert('input').styles({ width: '100px', 'margin-left': '10px' }).attrs({ type: 'number', class: 'params', id: 'PropSymbolChoro_ref_value' }).attrs({ min: 0.1, step: 0.1 });\n\n // Other symbols could probably easily be proposed :\n var d = dv2.append('p').attr('class', 'params_section2');\n d.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.symbol_type' }).html(_tr('app_page.func_options.choroprop.symbol_type'));\n d.insert('select').attrs({ class: 'params i18n', id: 'PropSymbolChoro_symbol_type' });\n\n var e = dv2.append('p').attr('class', 'params_section2');\n e.append('p').style('margin', 'auto').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.field2' }).html(_tr('app_page.func_options.choroprop.field2'));\n\n e.insert('select').attrs({ class: 'params', id: 'PropSymbolChoro_field_2' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var discr_section = dv2.insert('p').styles({ clear: 'both', margin: 'auto' });\n discr_section.insert('span').attr('id', 'container_sparkline_propsymbolchoro').styles({ margin: '16px 50px 0px 4px', float: 'right' });\n make_discretization_icons(discr_section);\n // let f = dv2.insert('p').attr('class', 'params_section2');\n // f.append(\"button\")\n // .attrs({id: 'PropSymbolChoro_btn_disc', class: 'params button_disc i18n',\n // 'data-i18n': '[html]app_page.func_options.common.discretization_choice'})\n // .styles({\"font-size\": \"0.8em\", \"text-align\": \"center\"})\n // .html(_tr(\"app_page.func_options.common.discretization_choice\"));\n\n make_layer_name_input(dv2, 'PropSymbolChoro_output_name');\n make_ok_button(dv2, 'propChoro_yes');\n dv2.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_PropSymbolChoro = {\n fill: function fill(layer) {\n if (!layer) return;\n section2.selectAll('.params').attr('disabled', null);\n var self = this,\n fields_stock = (0, _helpers.getFieldsType)('stock', layer),\n fields_ratio = (0, _helpers.getFieldsType)('ratio', layer),\n nb_features = data_manager.user_data[layer].length,\n field_size = section2.select('#PropSymbolChoro_field_1'),\n field_color = section2.select('#PropSymbolChoro_field_2'),\n ico_disc = section2.select('#ico_others'),\n ico_jenks = section2.select('#ico_jenks'),\n ico_quantiles = section2.select('#ico_quantiles'),\n ico_equal_interval = section2.select('#ico_equal_interval'),\n ico_q6 = section2.select('#ico_q6'),\n uo_layer_name = section2.select('#PropSymbolChoro_output_name'),\n ref_value_field = section2.select('#PropSymbolChoro_ref_value'),\n symb_selec = section2.select('#PropSymbolChoro_symbol_type'),\n ref_size = section2.select('#PropSymbolChoro_ref_size'),\n choro_mini_choice_disc = section2.select('#choro_mini_choice_disc'),\n img_valid_disc = section2.select('#img_choice_disc'),\n ok_button = section2.select('#propChoro_yes');\n\n var uncolor_icons = function uncolor_icons() {\n ico_jenks.style('border', null);\n ico_q6.style('border', null);\n ico_quantiles.style('border', null);\n ico_equal_interval.style('border', null);\n };\n\n if (data_manager.current_layers[layer].type === 'Line') {\n ref_size.attr('value', 10.0);\n [['app_page.func_options.common.symbol_line', 'line'], ['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symb_selec.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n } else {\n ref_size.attr('value', 60.0);\n [['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symb_selec.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n }\n\n var prepare_disc_quantiles = function prepare_disc_quantiles(field) {\n var _values = data_manager.user_data[layer].map(function (v) {\n return v[field];\n });\n var n_class = (0, _common.getOptNbClass)(_values.length);\n render_mini_chart_serie(_values.map(function (v) {\n return +v;\n }), document.getElementById('container_sparkline_propsymbolchoro'));\n\n var _discretize_to_colors = (0, _common.discretize_to_colors)(_values, 'quantiles', n_class),\n _discretize_to_colors2 = _slicedToArray(_discretize_to_colors, 6),\n nb_class = _discretize_to_colors2[0],\n type = _discretize_to_colors2[1],\n breaks = _discretize_to_colors2[2],\n color_array = _discretize_to_colors2[3],\n colors_map = _discretize_to_colors2[4],\n no_data_color = _discretize_to_colors2[5];\n\n self.rendering_params[field] = {\n nb_class: nb_class,\n type: 'quantiles',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'Choropleth',\n rendered_field: field,\n schema: ['Reds']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.quantiles') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n uncolor_icons();\n ico_quantiles.style('border', 'solid 1px green');\n if (_values.length > 7500) {\n ico_jenks.style('display', 'none');\n } else {\n ico_jenks.style('display', null);\n }\n };\n\n if (fields_stock.length === 0 || fields_ratio.length === 0) {\n display_error_num_field();\n return;\n }\n\n // Set some default colors in order to not force to open the box for selecting them :\n {\n var first_field = fields_ratio[0];\n prepare_disc_quantiles(first_field);\n ok_button.attr('disabled', self.rendering_params[first_field] ? null : true);\n }\n\n fields_stock.forEach(function (field) {\n field_size.append('option').text(field).attr('value', field);\n });\n fields_ratio.forEach(function (field) {\n field_color.append('option').text(field).attr('value', field);\n });\n field_size.on('change', function () {\n var field_name = this.value,\n max_val_field = (0, _helpers_calc.max_fast)(data_manager.user_data[layer].map(function (obj) {\n return +obj[field_name];\n }));\n\n ref_value_field.attrs({ max: max_val_field, value: max_val_field });\n uo_layer_name.attr('value', ['PropSymbols', field_name, field_color.node().value, layer].join('_'));\n });\n\n field_color.on('change', function () {\n var field_name = this.value;\n var vals = data_manager.user_data[layer].map(function (a) {\n return +a[field_name];\n });\n render_mini_chart_serie(vals, document.getElementById('container_sparkline_propsymbolchoro'));\n uo_layer_name.attr('value', ['PropSymbols', field_size.node().value, field_name, layer].join('_'));\n if (self.rendering_params[field_name] !== undefined) {\n // ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n choro_mini_choice_disc.html([_tr('app_page.common.' + self.rendering_params[field_name].type), ', ', _tr('app_page.common.class', { count: self.rendering_params[field_name].nb_class })].join(''));\n uncolor_icons();\n color_disc_icons(self.rendering_params[field_name].type);\n // console.log(section2); console.log(self.rendering_params[field_name].type);\n } else {\n prepare_disc_quantiles(field_name);\n // ok_button.attr('disabled', true);\n // img_valid_disc.attr('src', 'static/img/Red_x.png');\n // choro_mini_choice_disc.html('');\n }\n });\n\n ico_jenks.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_color.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n\n var _discretize_to_colors3 = (0, _common.discretize_to_colors)(_values, 'jenks', n_class, 'BuGn'),\n _discretize_to_colors4 = _slicedToArray(_discretize_to_colors3, 6),\n nb_class = _discretize_to_colors4[0],\n type = _discretize_to_colors4[1],\n breaks = _discretize_to_colors4[2],\n color_array = _discretize_to_colors4[3],\n colors_map = _discretize_to_colors4[4],\n no_data_color = _discretize_to_colors4[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'jenks',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'PropSymbolsChoro',\n rendered_field: selected_field,\n schema: ['BuGn']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.jenks') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_quantiles.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_color.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n\n var _discretize_to_colors5 = (0, _common.discretize_to_colors)(_values, 'quantiles', n_class, 'BuGn'),\n _discretize_to_colors6 = _slicedToArray(_discretize_to_colors5, 6),\n nb_class = _discretize_to_colors6[0],\n type = _discretize_to_colors6[1],\n breaks = _discretize_to_colors6[2],\n color_array = _discretize_to_colors6[3],\n colors_map = _discretize_to_colors6[4],\n no_data_color = _discretize_to_colors6[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'quantiles',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'PropSymbolsChoro',\n rendered_field: selected_field,\n schema: ['BuGn']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.quantiles') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_equal_interval.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_color.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n\n var _discretize_to_colors7 = (0, _common.discretize_to_colors)(_values, 'equal_interval', n_class, 'BuGn'),\n _discretize_to_colors8 = _slicedToArray(_discretize_to_colors7, 6),\n nb_class = _discretize_to_colors8[0],\n type = _discretize_to_colors8[1],\n breaks = _discretize_to_colors8[2],\n color_array = _discretize_to_colors8[3],\n colors_map = _discretize_to_colors8[4],\n no_data_color = _discretize_to_colors8[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'equal_interval',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'PropSymbolsChoro',\n rendered_field: selected_field,\n schema: ['BuGn']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.equal_interval') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_q6.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_color.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n });\n\n var _discretize_to_colors9 = (0, _common.discretize_to_colors)(_values, 'Q6', 6, 'BuGn'),\n _discretize_to_colors10 = _slicedToArray(_discretize_to_colors9, 6),\n nb_class = _discretize_to_colors10[0],\n type = _discretize_to_colors10[1],\n breaks = _discretize_to_colors10[2],\n color_array = _discretize_to_colors10[3],\n colors_map = _discretize_to_colors10[4],\n no_data_color = _discretize_to_colors10[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'Q6',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'PropSymbolsChoro',\n rendered_field: selected_field,\n schema: ['BuGn']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.Q6') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_disc.on('click', function () {\n var selected_field = field_color.node().value;\n var opt_nb_class = (0, _common.getOptNbClass)(data_manager.user_data[layer].length);\n var conf_disc_box = void 0;\n\n if (self.rendering_params[selected_field]) {\n conf_disc_box = (0, _discretization_panel.display_discretization)(layer, selected_field, self.rendering_params[selected_field].nb_class, {\n schema: self.rendering_params[selected_field].schema,\n colors: self.rendering_params[selected_field].colors,\n no_data: self.rendering_params[selected_field].no_data,\n type: self.rendering_params[selected_field].type,\n breaks: self.rendering_params[selected_field].breaks,\n extra_options: self.rendering_params[selected_field].extra_options\n });\n } else {\n conf_disc_box = (0, _discretization_panel.display_discretization)(layer, selected_field, opt_nb_class, { type: 'quantiles' });\n }\n\n conf_disc_box.then(function (confirmed) {\n if (confirmed) {\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n choro_mini_choice_disc.html([_tr('app_page.common.' + confirmed[1]), ', ', _tr('app_page.common.class', { count: confirmed[0] })].join(''));\n uncolor_icons();\n color_disc_icons(confirmed[1]);\n self.rendering_params[selected_field] = {\n nb_class: confirmed[0],\n type: confirmed[1],\n schema: confirmed[5],\n no_data: confirmed[6],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n renderer: 'PropSymbolsChoro',\n extra_options: confirmed[7]\n };\n }\n });\n });\n ok_button.on('click', function () {\n if (!ref_value_field.node().value) return;\n var rendering_params = self.rendering_params;\n if (rendering_params[field_color.node().value]) {\n // const layer = Object.getOwnPropertyNames(data_manager.user_data)[0];\n var symbol_to_use = symb_selec.node().value,\n\n // nb_features = data_manager.user_data[layer].length,\n rd_params = {},\n color_field = field_color.node().value;\n var new_layer_name = uo_layer_name.node().value;\n\n new_layer_name = check_layer_name(new_layer_name.length > 0 ? new_layer_name : layer + '_PropSymbolsChoro');\n\n rd_params.field = field_size.node().value;\n rd_params.new_name = new_layer_name;\n rd_params.nb_features = nb_features;\n rd_params.ref_layer_name = layer;\n rd_params.symbol = symbol_to_use;\n rd_params.ref_value = +ref_value_field.node().value;\n rd_params.ref_size = +ref_size.node().value;\n rd_params.fill_color = rendering_params[color_field].colorsByFeature;\n rd_params.color_field = color_field;\n\n if (symbol_to_use === 'line') {\n make_prop_line(rd_params);\n } else {\n make_prop_symbols(rd_params);\n }\n var colors_breaks = [];\n for (var i = rendering_params[color_field].breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params[color_field].breaks[i - 1], ' - ', rendering_params[color_field].breaks[i]].join(''), rendering_params[color_field].colors[i - 1]]);\n }\n\n var options_disc = {\n schema: rendering_params[color_field].schema,\n colors: rendering_params[color_field].colors,\n no_data: rendering_params[color_field].no_data,\n type: rendering_params[color_field].type,\n breaks: rendering_params[color_field].breaks,\n extra_options: rendering_params[color_field].extra_options\n };\n\n Object.assign(data_manager.current_layers[new_layer_name], {\n renderer: 'PropSymbolsChoro',\n options_disc: options_disc,\n rendered_field: field_size.node().value,\n rendered_field2: field_color.node().value,\n colors_breaks: colors_breaks\n });\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n }\n });\n (0, _helpers.setSelected)(field_size.node(), fields_stock[0]);\n (0, _helpers.setSelected)(field_color.node(), fields_ratio[0]);\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('PropSymbolChoro_field_1'));\n unfillSelectInput(document.getElementById('PropSymbolChoro_field_2'));\n unfillSelectInput(document.getElementById('PropSymbolChoro_symbol_type'));\n section2.selectAll('.params').attr('disabled', true);\n },\n\n\n rendering_params: {}\n};\n\nvar fillMenu_Typo = function fillMenu_Typo() {\n var dv2 = make_template_functionnality(section2);\n\n var a = dv2.append('p').attr('class', 'params_section2');\n a.append('p').style('margin', 'auto').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.typo.field' }).html(_tr('app_page.func_options.typo.field'));\n a.insert('select').attrs({ id: 'Typo_field_1', class: 'params' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var b = dv2.insert('p').attr('class', 'params_section2').styles({ margin: 'auto', 'text-align': 'center', clear: 'both' });\n b.append('button').attrs({\n id: 'Typo_class',\n class: 'button_disc params i18n',\n 'data-i18n': '[html]app_page.func_options.typo.color_choice'\n }).styles({ 'font-size': '0.8em', 'text-align': 'center' }).html(_tr('app_page.func_options.typo.color_choice'));\n\n make_layer_name_input(dv2, 'Typo_output_name');\n make_ok_button(dv2, 'Typo_yes');\n dv2.selectAll('.params').attr('disabled', true);\n};\n\nvar fields_Typo = {\n fill: function fill(layer) {\n if (!layer) return;\n var self = this,\n\n // g_lyr_name = `#${layer}`,\n fields_name = (0, _helpers.getFieldsType)('category', layer),\n field_selec = section2.select('#Typo_field_1'),\n ok_button = section2.select('#Typo_yes'),\n btn_typo_class = section2.select('#Typo_class'),\n uo_layer_name = section2.select('#Typo_output_name');\n\n var prepare_colors = function prepare_colors(field) {\n var _prepare_categories_a = prepare_categories_array(layer, field, null),\n _prepare_categories_a2 = _slicedToArray(_prepare_categories_a, 2),\n col_map = _prepare_categories_a2[1];\n\n var nb_class = col_map.size;\n var colorByFeature = data_manager.user_data[layer].map(function (ft) {\n return col_map.get(ft[field])[0];\n });\n self.rendering_params[field] = {\n nb_class: nb_class,\n color_map: col_map,\n colorByFeature: colorByFeature,\n renderer: 'Categorical',\n rendered_field: field,\n skip_alert: false\n };\n };\n\n fields_name.forEach(function (f_name) {\n field_selec.append('option').text(f_name).attr('value', f_name);\n });\n\n field_selec.on('change', function () {\n var selected_field = this.value;\n uo_layer_name.attr('value', ['Typo', selected_field, layer].join('_'));\n prepare_colors(selected_field);\n });\n\n // Set some default colors in order to not force to open the box for selecting them :\n {\n var first_field = fields_name[0];\n prepare_colors(first_field);\n ok_button.attr('disabled', self.rendering_params[first_field] ? null : true);\n }\n\n btn_typo_class.on('click', function () {\n var selected_field = field_selec.node().value;\n var col_map = self.rendering_params[selected_field] ? self.rendering_params[selected_field].color_map : undefined;\n\n var _prepare_categories_a3 = prepare_categories_array(layer, selected_field, col_map),\n _prepare_categories_a4 = _slicedToArray(_prepare_categories_a3, 1),\n cats = _prepare_categories_a4[0];\n\n if (cats.length > 15) {\n swal({\n title: '',\n text: _tr('app_page.common.error_too_many_features_color'),\n type: 'warning',\n showCancelButton: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.valid') + '!',\n cancelButtonText: _tr('app_page.common.cancel')\n }).then(function () {\n (0, _categorical_panel.display_categorical_box)(data_manager.user_data[layer], layer, selected_field, cats).then(function (confirmed) {\n if (confirmed) {\n self.rendering_params[selected_field] = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: selected_field,\n skip_alert: true\n };\n }\n });\n }, function () {\n return null;\n });\n } else {\n (0, _categorical_panel.display_categorical_box)(data_manager.user_data[layer], layer, selected_field, cats).then(function (confirmed) {\n if (confirmed) {\n self.rendering_params[selected_field] = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: selected_field,\n skip_alert: true\n };\n }\n });\n }\n });\n\n ok_button.on('click', function () {\n var selected_field = field_selec.node().value;\n var params = self.rendering_params[selected_field];\n var render = function render() {\n if (params) {\n var _layer = Object.getOwnPropertyNames(data_manager.user_data)[0];\n var output_name = uo_layer_name.node().value;\n params.new_name = check_layer_name(output_name.length > 0 ? output_name : ['Typo', selected_field, _layer].join('_'));\n render_categorical(_layer, params);\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(params.new_name);\n }\n };\n if (params.color_map.size > 15 && !params.skip_alert) {\n swal({\n title: '',\n text: _tr('app_page.common.error_too_many_features_color'),\n type: 'warning',\n showCancelButton: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.valid') + '!',\n cancelButtonText: _tr('app_page.common.cancel')\n }).then(function () {\n render();\n }, function () {\n return null;\n });\n } else {\n render();\n }\n });\n uo_layer_name.attr('value', 'Typo_' + layer);\n section2.selectAll('.params').attr('disabled', null);\n (0, _helpers.setSelected)(field_selec.node(), fields_name[0]);\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('Typo_field_1'));\n section2.selectAll('.params').attr('disabled', true);\n },\n\n rendering_params: {}\n};\n\nfunction fillMenu_Choropleth() {\n var dv2 = make_template_functionnality(section2);\n\n var field_selec_section = dv2.append('p').attr('class', 'params_section2');\n field_selec_section.insert('p').style('margin', 'auto').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.field' }).html(_tr('app_page.func_options.common.field'));\n\n field_selec_section.insert('select').attrs({ id: 'choro_field1', class: 'params' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var discr_section = dv2.insert('p').attr('class', 'params_section2').styles({ margin: 'auto' });\n discr_section.insert('span').attr('id', 'container_sparkline_choro').styles({ margin: '16px 50px 0px 4px', float: 'right' });\n make_discretization_icons(discr_section);\n\n make_layer_name_input(dv2, 'Choro_output_name');\n make_ok_button(dv2, 'choro_yes');\n dv2.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_Choropleth = {\n fill: function fill(layer) {\n if (!layer) return;\n var self = this,\n\n // g_lyr_name = `#${layer}`,\n fields = (0, _helpers.getFieldsType)('ratio', layer),\n\n // fields = type_col(layer, \"number\"),\n field_selec = section2.select('#choro_field1'),\n uo_layer_name = section2.select('#Choro_output_name'),\n ok_button = section2.select('#choro_yes'),\n img_valid_disc = section2.select('#img_choice_disc'),\n ico_jenks = section2.select('#ico_jenks'),\n ico_quantiles = section2.select('#ico_quantiles'),\n ico_q6 = section2.select('#ico_q6'),\n ico_equal_interval = section2.select('#ico_equal_interval'),\n btn_class = section2.select('#ico_others'),\n choro_mini_choice_disc = section2.select('#choro_mini_choice_disc');\n\n var uncolor_icons = function uncolor_icons() {\n ico_jenks.style('border', null);\n ico_q6.style('border', null);\n ico_quantiles.style('border', null);\n ico_equal_interval.style('border', null);\n };\n\n var prepare_disc_quantiles = function prepare_disc_quantiles(field) {\n var _values = data_manager.user_data[layer].map(function (v) {\n return v[field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n render_mini_chart_serie(_values.map(function (v) {\n return +v;\n }), document.getElementById('container_sparkline_choro'));\n\n var _discretize_to_colors11 = (0, _common.discretize_to_colors)(_values, 'quantiles', n_class),\n _discretize_to_colors12 = _slicedToArray(_discretize_to_colors11, 6),\n nb_class = _discretize_to_colors12[0],\n type = _discretize_to_colors12[1],\n breaks = _discretize_to_colors12[2],\n color_array = _discretize_to_colors12[3],\n colors_map = _discretize_to_colors12[4],\n no_data_color = _discretize_to_colors12[5];\n\n self.rendering_params[field] = {\n nb_class: nb_class,\n type: 'quantiles',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'Choropleth',\n rendered_field: field,\n schema: ['Reds']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.quantiles') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n uncolor_icons();\n ico_quantiles.style('border', 'solid 1px green');\n if (_values.length > 7500) {\n ico_jenks.style('display', 'none');\n } else {\n ico_jenks.style('display', null);\n }\n };\n\n if (fields.length === 0) {\n display_error_num_field();\n return;\n }\n section2.selectAll('.params').attr('disabled', null);\n fields.forEach(function (field) {\n field_selec.append('option').text(field).attr('value', field);\n });\n\n // Set some default colors in order to not force to open the box for selecting them :\n {\n var first_field = fields[0];\n prepare_disc_quantiles(first_field);\n ok_button.attr('disabled', self.rendering_params[first_field] ? null : true);\n }\n\n field_selec.on('change', function () {\n var field_name = this.value,\n vals = data_manager.user_data[layer].map(function (a) {\n return +a[field_name];\n });\n render_mini_chart_serie(vals, document.getElementById('container_sparkline_choro'));\n uo_layer_name.attr('value', ['Choro', field_name, layer].join('_'));\n if (self.rendering_params[field_name] !== undefined) {\n // ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n var keyi18n = 'app_page.common.' + self.rendering_params[field_name].type;\n choro_mini_choice_disc.html(_tr(keyi18n) + ', ' + _tr('app_page.common.class', { count: self.rendering_params[field_name].nb_class }));\n uncolor_icons();\n color_disc_icons(self.rendering_params[field_name].type);\n } else {\n prepare_disc_quantiles(field_name);\n }\n });\n\n ico_jenks.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_selec.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n\n var _discretize_to_colors13 = (0, _common.discretize_to_colors)(_values, 'jenks', n_class),\n _discretize_to_colors14 = _slicedToArray(_discretize_to_colors13, 6),\n nb_class = _discretize_to_colors14[0],\n type = _discretize_to_colors14[1],\n breaks = _discretize_to_colors14[2],\n color_array = _discretize_to_colors14[3],\n colors_map = _discretize_to_colors14[4],\n no_data_color = _discretize_to_colors14[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'jenks',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'Choropleth',\n rendered_field: selected_field,\n schema: ['Reds']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.jenks') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n // ok_button.attr('disabled', null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_quantiles.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_selec.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n\n var _discretize_to_colors15 = (0, _common.discretize_to_colors)(_values, 'quantiles', n_class),\n _discretize_to_colors16 = _slicedToArray(_discretize_to_colors15, 6),\n nb_class = _discretize_to_colors16[0],\n type = _discretize_to_colors16[1],\n breaks = _discretize_to_colors16[2],\n color_array = _discretize_to_colors16[3],\n colors_map = _discretize_to_colors16[4],\n no_data_color = _discretize_to_colors16[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'quantiles',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'Choropleth',\n rendered_field: selected_field,\n schema: ['Reds']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.quantiles') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n // ok_button.attr(\"disabled\", null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_equal_interval.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_selec.node().value,\n _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n }),\n n_class = (0, _common.getOptNbClass)(_values.length);\n\n var _discretize_to_colors17 = (0, _common.discretize_to_colors)(_values, 'equal_interval', n_class),\n _discretize_to_colors18 = _slicedToArray(_discretize_to_colors17, 6),\n nb_class = _discretize_to_colors18[0],\n type = _discretize_to_colors18[1],\n breaks = _discretize_to_colors18[2],\n color_array = _discretize_to_colors18[3],\n colors_map = _discretize_to_colors18[4],\n no_data_color = _discretize_to_colors18[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'equal_interval',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'Choropleth',\n rendered_field: selected_field,\n schema: ['Reds']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.equal_interval') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n // ok_button.attr(\"disabled\", null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n ico_q6.on('click', function () {\n uncolor_icons();\n this.style.border = 'solid 1px green';\n var selected_field = field_selec.node().value;\n var _values = data_manager.user_data[layer].map(function (v) {\n return v[selected_field];\n });\n\n var _discretize_to_colors19 = (0, _common.discretize_to_colors)(_values, 'Q6', 6),\n _discretize_to_colors20 = _slicedToArray(_discretize_to_colors19, 6),\n nb_class = _discretize_to_colors20[0],\n type = _discretize_to_colors20[1],\n breaks = _discretize_to_colors20[2],\n color_array = _discretize_to_colors20[3],\n colors_map = _discretize_to_colors20[4],\n no_data_color = _discretize_to_colors20[5];\n\n self.rendering_params[selected_field] = {\n nb_class: nb_class,\n type: 'Q6',\n colors: color_array,\n breaks: breaks,\n no_data: no_data_color,\n colorsByFeature: colors_map,\n renderer: 'Choropleth',\n rendered_field: selected_field,\n schema: ['Reds']\n };\n choro_mini_choice_disc.html(_tr('app_page.common.Q6') + ', ' + _tr('app_page.common.class', { count: nb_class }));\n // ok_button.attr(\"disabled\", null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n });\n\n btn_class.on('click', function () {\n var selected_field = field_selec.node().value,\n opt_nb_class = (0, _common.getOptNbClass)(data_manager.user_data[layer].length);\n var conf_disc_box = void 0;\n\n if (self.rendering_params[selected_field]) {\n conf_disc_box = (0, _discretization_panel.display_discretization)(layer, selected_field, self.rendering_params[selected_field].nb_class, { schema: self.rendering_params[selected_field].schema,\n colors: self.rendering_params[selected_field].colors,\n type: self.rendering_params[selected_field].type,\n no_data: self.rendering_params[selected_field].no_data,\n breaks: self.rendering_params[selected_field].breaks,\n extra_options: self.rendering_params[selected_field].extra_options });\n } else {\n conf_disc_box = (0, _discretization_panel.display_discretization)(layer, selected_field, opt_nb_class, { type: 'quantiles' });\n }\n conf_disc_box.then(function (confirmed) {\n if (confirmed) {\n // ok_button.attr(\"disabled\", null);\n img_valid_disc.attr('src', 'static/img/Light_green_check.png');\n var keyi18n = 'app_page.common.' + confirmed[1];\n choro_mini_choice_disc.html(_tr(keyi18n) + ', ' + _tr('app_page.common.class', { count: confirmed[0] }));\n uncolor_icons();\n color_disc_icons(confirmed[1]);\n self.rendering_params[selected_field] = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n schema: confirmed[5],\n no_data: confirmed[6],\n colorsByFeature: confirmed[4],\n renderer: 'Choropleth',\n rendered_field: selected_field,\n new_name: '',\n extra_options: confirmed[7]\n };\n }\n });\n });\n\n ok_button.on('click', function () {\n var field_to_render = field_selec.node().value;\n if (self.rendering_params[field_to_render]) {\n var user_new_layer_name = uo_layer_name.node().value;\n self.rendering_params[field_to_render].new_name = check_layer_name(user_new_layer_name.length > 0 ? user_new_layer_name : ['Choro', field_to_render, layer].join('_'));\n render_choro(layer, self.rendering_params[field_to_render]);\n (0, _legend.handle_legend)(self.rendering_params[field_to_render].new_name);\n (0, _interface.switch_accordion_section)();\n }\n });\n (0, _helpers.setSelected)(field_selec.node(), fields[0]);\n },\n unfill: function unfill() {\n // const field_selec = document.getElementById('choro_field1'),\n // nb_fields = field_selec.childElementCount;\n //\n // for (let i = nb_fields - 1; i > -1; --i) {\n // // delete this.rendering_params[field_selec.children[i]];\n // field_selec.removeChild(field_selec.children[i]);\n // }\n unfillSelectInput(document.getElementById('choro_field1'));\n d3.selectAll('.params').attr('disabled', true);\n },\n\n rendering_params: {}\n};\n\nvar fields_Stewart = {\n fill: function fill(layer) {\n var other_layers = (0, _helpers.get_other_layer_names)(),\n mask_selec = d3.select('#stewart_mask');\n var default_selected_mask = void 0;\n\n unfillSelectInput(mask_selec.node());\n mask_selec.append('option').text('None').attr('value', 'None');\n for (var i = 0, n_layer = other_layers.length, lyr_name; i < n_layer; i++) {\n lyr_name = other_layers[i];\n if (data_manager.current_layers[lyr_name].type === 'Polygon') {\n mask_selec.append('option').text(lyr_name).attr('value', lyr_name);\n if (data_manager.current_layers[lyr_name].targeted) {\n default_selected_mask = lyr_name;\n }\n }\n }\n if (default_selected_mask) {\n (0, _helpers.setSelected)(mask_selec.node(), default_selected_mask);\n }\n if (layer) {\n var fields = (0, _helpers.getFieldsType)('stock', layer),\n field_selec = section2.select('#stewart_field'),\n field_selec2 = section2.select('#stewart_field2');\n\n if (fields.length === 0) {\n display_error_num_field();\n return;\n }\n\n field_selec2.append('option').text(' ').attr('value', 'None');\n fields.forEach(function (field) {\n field_selec.append('option').text(field).attr('value', field);\n field_selec2.append('option').text(field).attr('value', field);\n });\n document.getElementById('stewart_span').value = get_first_guess_span('stewart');\n\n field_selec.on('change', function () {\n document.getElementById('stewart_output_name').value = ['Smoothed', this.value, layer].join('_');\n });\n document.getElementById('stewart_output_name').value = ['Smoothed', fields[0], layer].join('_');\n section2.select('#stewart_yes').on('click', render_stewart);\n }\n section2.selectAll('.params').attr('disabled', null);\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('stewart_field'));\n unfillSelectInput(document.getElementById('stewart_field2'));\n unfillSelectInput(document.getElementById('stewart_mask'));\n d3.selectAll('.params').attr('disabled', true);\n }\n};\n\nfunction render_stewart() {\n var formToSend = new FormData(),\n doc = document,\n field1_n = doc.getElementById('stewart_field').value,\n field2_n = doc.getElementById('stewart_field2').value,\n var1_to_send = {},\n var2_to_send = {},\n layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n span = +doc.getElementById('stewart_span').value,\n beta = +doc.getElementById('stewart_beta').value,\n func_selec = doc.getElementById('stewart_func').value,\n mask_name = doc.getElementById('stewart_mask').value,\n new_user_layer_name = document.getElementById('stewart_output_name').value;\n\n var nb_class = doc.getElementById('stewart_nb_class').value,\n bval = doc.getElementById('stewart_breaks').value.trim(),\n reso = +doc.getElementById('stewart_resolution').value;\n\n if (nb_class !== (nb_class | 0)) {\n // eslint-disable-line\n nb_class = nb_class | 0; // eslint-disable-line\n doc.getElementById('stewart_nb_class').value = nb_class;\n }\n\n if (reso && reso > 0) {\n var res_test = test_maxmin_resolution(reso);\n if (res_test) {\n var message = res_test === 'low' ? _tr('app_page.common.error_too_low_resolution') : _tr('app_page.common.error_too_high_resolution');\n (0, _helpers.display_error_during_computation)(message);\n return;\n }\n reso *= 1000;\n } else {\n reso = null;\n }\n bval = bval.length > 0 ? bval.split('-').map(function (val) {\n return +val.trim();\n }) : null;\n\n var1_to_send[field1_n] = data_manager.current_layers[layer].original_fields.has(field1_n) ? [] : data_manager.user_data[layer].map(function (i) {\n return +i[field1_n];\n });\n if (field2_n !== 'None') {\n var2_to_send[field2_n] = data_manager.current_layers[layer].original_fields.has(field2_n) ? [] : data_manager.user_data[layer].map(function (i) {\n return +i[field2_n];\n });\n }\n\n formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[layer].key_name,\n variable1: var1_to_send,\n variable2: var2_to_send,\n span: span * 1000,\n beta: beta,\n typefct: func_selec,\n resolution: reso,\n nb_class: nb_class,\n user_breaks: bval,\n mask_layer: mask_name !== 'None' ? data_manager.current_layers[mask_name].key_name : ''\n }));\n\n (0, _helpers.xhrequest)('POST', 'compute/stewart', formToSend, true).then(function (res) {\n var data_split = res.split('|||'),\n raw_topojson = data_split[0],\n options = { result_layer_on_add: true, func_name: 'smooth' };\n if (new_user_layer_name.length > 0) {\n options.choosed_name = new_user_layer_name;\n }\n var n_layer_name = (0, _layers.add_layer_topojson)(raw_topojson, options);\n if (!n_layer_name) return;\n var class_lim = JSON.parse(data_split[1]),\n col_pal = (0, _colors_helpers.getColorBrewerArray)(class_lim.min.length, 'Oranges'),\n n_class = class_lim.min.length,\n colors_breaks = [];\n for (var i = 0; i < n_class; i++) {\n colors_breaks.push([class_lim.min[i] + ' - ' + class_lim.max[i], col_pal[n_class - 1 - i]]);\n }\n\n data_manager.current_layers[n_layer_name].fill_color = { class: [] };\n data_manager.current_layers[n_layer_name].renderer = 'Stewart';\n data_manager.current_layers[n_layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[n_layer_name].rendered_field = field1_n;\n data_manager.current_layers[n_layer_name].color_palette = { name: 'Oranges', reversed: false };\n data_manager.current_layers[n_layer_name].options_disc = {\n breaks: [].concat(class_lim.max[0], class_lim.min).reverse()\n };\n map.select('#' + _app.layer_to_id.get(n_layer_name)).selectAll('path').styles(function (d, i) {\n return { fill: col_pal[n_class - 1 - i], 'fill-opacity': 1, 'stroke-opacity': 0 };\n });\n (0, _legend.handle_legend)(n_layer_name);\n (0, _interface.switch_accordion_section)();\n // Todo : use the function render_choro to render the result from stewart too\n }, function (error) {\n (0, _helpers.display_error_during_computation)();\n console.log(error);\n }).catch(function (err) {\n (0, _helpers.display_error_during_computation)();\n console.log(err);\n });\n}\n\nfunction fillMenu_Stewart() {\n var dialog_content = make_template_functionnality(section2);\n\n var a = dialog_content.append('p').attr('class', 'params_section2');\n a.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.field' }).html(_tr('app_page.func_options.smooth.field'));\n a.append('select').attrs({ class: 'params marg_auto', id: 'stewart_field' });\n\n var b = dialog_content.append('p').attr('class', 'params_section2');\n b.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.divide_field' }).html(_tr('app_page.func_options.smooth.divide_field'));\n b.insert('select').attrs({ class: 'params marg_auto', id: 'stewart_field2' });\n\n var p_span = dialog_content.append('p').attr('class', 'params_section2');\n p_span.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.span' }).text(_tr('app_page.func_options.smooth.span'));\n p_span.append('input').style('width', '60px').attrs({ type: 'number', class: 'params', id: 'stewart_span', value: 5, min: 0, max: 100000, step: 'any' });\n p_span.append('span').html(' (km)');\n\n var d = dialog_content.append('p').attr('class', 'params_section2');\n d.append('span').styles({ 'margin-right': '35px' }).attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.beta' }).html(_tr('app_page.func_options.smooth.beta'));\n d.insert('input').style('width', '60px').attrs({ type: 'number', class: 'params', id: 'stewart_beta', value: 2, min: 0, max: 11, step: 'any' });\n\n var p_reso = dialog_content.append('p').attr('class', 'params_section2');\n p_reso.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.resolution' }).text(_tr('app_page.func_options.smooth.resolution'));\n p_reso.insert('input').style('width', '60px').attrs({ type: 'number', class: 'params', id: 'stewart_resolution', min: 1, max: 1000000, step: 'any' });\n p_reso.insert('label').html(' (km)');\n\n var f = dialog_content.append('p').attr('class', 'params_section2');\n f.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.func_options' }).html(_tr('app_page.func_options.smooth.function'));\n var func_selec = f.insert('select').attrs({ class: 'params i18n', id: 'stewart_func' });\n\n var g = dialog_content.append('p').attr('class', 'params_section2');\n g.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.nb_class' }).html(_tr('app_page.func_options.smooth.nb_class'));\n g.insert('input').style('width', '50px').attrs({ type: 'number', class: 'params', id: 'stewart_nb_class', value: 8, min: 1, max: 22, step: 1 });\n\n var bvs = dialog_content.append('p').attr('class', 'params_section2');\n bvs.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.smooth.break_values' }).html(_tr('app_page.func_options.smooth.break_values'));\n bvs.insert('textarea').styles({ width: '100%', height: '2.2em', 'font-size': '0.9em' }).attrs({\n class: 'params i18n',\n id: 'stewart_breaks',\n 'data-i18n': '[placeholder]app_page.common.expected_class',\n placeholder: _tr('app_page.common.expected_class')\n });\n var m = dialog_content.append('p').attr('class', 'params_section2');\n m.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.mask' }).html(_tr('app_page.func_options.common.mask'));\n\n m.insert('select').attrs({ class: 'params mask_field', id: 'stewart_mask' });\n\n [['exponential', 'app_page.func_options.smooth.func_exponential'], ['pareto', 'app_page.func_options.smooth.func_pareto']].forEach(function (fun_name) {\n func_selec.append('option').text(_tr(fun_name[1])).attrs({ value: fun_name[0], 'data-i18n': '[text]' + fun_name[1] });\n });\n\n make_layer_name_input(dialog_content, 'stewart_output_name');\n make_ok_button(dialog_content, 'stewart_yes', false);\n dialog_content.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_Anamorphose = {\n fill: function fill(layer) {\n if (!layer) return;\n var fields = (0, _helpers.getFieldsType)('stock', layer),\n field_selec = section2.select('#Anamorph_field'),\n algo_selec = section2.select('#Anamorph_algo'),\n ok_button = section2.select('#Anamorph_yes');\n\n if (fields.length === 0) {\n display_error_num_field();\n return;\n }\n algo_selec.on('change', function () {\n if (this.value === 'olson') {\n section2.selectAll('.opt_dougenik').style('display', 'none');\n section2.selectAll('.opt_olson').style('display', undefined);\n } else if (this.value === 'dougenik') {\n section2.selectAll('.opt_olson').style('display', 'none');\n section2.selectAll('.opt_dougenik').style('display', undefined);\n }\n });\n section2.selectAll('.params').attr('disabled', null);\n fields.forEach(function (field) {\n field_selec.append('option').text(field).attr('value', field);\n });\n\n field_selec.on('change', function () {\n var field_name = this.value,\n ref_value_field = document.getElementById('Anamorph_opt3');\n\n document.getElementById('Anamorph_output_name').value = ['Cartogram', this.value, layer].join('_');\n\n if (ref_value_field) {\n var max_val_field = (0, _helpers_calc.max_fast)(data_manager.user_data[layer].map(function (obj) {\n return +obj[field_name];\n }));\n ref_value_field.setAttribute('max', max_val_field);\n ref_value_field.value = max_val_field;\n }\n });\n\n ok_button.on('click', function () {\n var algo = algo_selec.node().value,\n\n // nb_features = data_manager.user_data[layer].length,\n field_name = field_selec.node().value,\n new_user_layer_name = document.getElementById('Anamorph_output_name').value;\n\n if (algo === 'olson') {\n var nb_ft = data_manager.current_layers[layer].n_features;\n var dataset = data_manager.user_data[layer];\n\n // if (contains_empty_val(dataset.map(a => a[field_name]))) {\n // discard_rendering_empty_val();\n // return;\n // }\n\n var layer_select = document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName('path'),\n d_val = [],\n transform = [];\n\n for (var i = 0; i < nb_ft; ++i) {\n var val = +dataset[i][field_name];\n // We deliberatly use 0 if this is a missing value :\n if (isNaN(val) || !isFinite(val)) val = 0;\n d_val.push([i, val, +path.area(layer_select[i].__data__.geometry)]);\n }\n d_val.sort(function (a, b) {\n return b[1] - a[1];\n });\n var ref = d_val[0][1] / d_val[0][2];\n d_val[0].push(1);\n\n for (var _i5 = 0; _i5 < nb_ft; ++_i5) {\n var _val = d_val[_i5][1] / d_val[_i5][2];\n var scale = (0, _helpers_math.Msqrt)(_val / ref);\n d_val[_i5].push(scale);\n }\n d_val.sort(function (a, b) {\n return a[0] - b[0];\n });\n var formToSend = new FormData();\n formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[layer].key_name,\n scale_values: d_val.map(function (ft) {\n return ft[3];\n }),\n field_name: field_name\n }));\n (0, _helpers.xhrequest)('POST', 'compute/olson', formToSend, true).then(function (result) {\n var options = {\n choosed_name: check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['OlsonCartogram', field_name, layer].join('_')),\n func_name: 'cartogram',\n result_layer_on_add: true\n };\n var n_layer_name = (0, _layers.add_layer_topojson)(result, options);\n data_manager.current_layers[n_layer_name].renderer = 'OlsonCarto';\n data_manager.current_layers[n_layer_name].rendered_field = field_name;\n data_manager.current_layers[n_layer_name].scale_max = 1;\n data_manager.current_layers[n_layer_name].ref_layer_name = layer;\n data_manager.current_layers[n_layer_name].scale_byFeature = transform;\n map.select('#' + _app.layer_to_id.get(n_layer_name)).selectAll('path').styles({\n stroke: 'black',\n 'stroke-opacity': 0.8,\n 'fill-opacity': 0.8\n });\n (0, _interface.switch_accordion_section)();\n }, function (err) {\n (0, _helpers.display_error_during_computation)();\n console.log(err);\n });\n } else if (algo === 'dougenik') {\n var _formToSend = new FormData(),\n var_to_send = {},\n nb_iter = document.getElementById('Anamorph_dougenik_iterations').value;\n\n var_to_send[field_name] = [];\n if (!data_manager.current_layers[layer].original_fields.has(field_name)) {\n var table = data_manager.user_data[layer],\n to_send = var_to_send[field_name];\n for (var _i6 = 0, i_len = table.length; _i6 < i_len; ++_i6) {\n to_send.push(+table[_i6][field_name]);\n }\n }\n _formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[layer].key_name,\n var_name: var_to_send,\n iterations: nb_iter\n }));\n\n (0, _helpers.xhrequest)('POST', 'compute/carto_doug', _formToSend, true).then(function (data) {\n var options = {\n choosed_name: check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['Cartogram', field_name, layer].join('_')),\n func_name: 'cartogram',\n result_layer_on_add: true\n };\n var n_layer_name = (0, _layers.add_layer_topojson)(data, options);\n data_manager.current_layers[n_layer_name].fill_color = { random: true };\n data_manager.current_layers[n_layer_name].is_result = true;\n data_manager.current_layers[n_layer_name]['stroke-width-const'] = 0.8;\n data_manager.current_layers[n_layer_name].renderer = 'Carto_doug';\n data_manager.current_layers[n_layer_name].rendered_field = field_name;\n map.select('#' + _app.layer_to_id.get(n_layer_name)).selectAll('path').style('fill', function () {\n return (0, _colors_helpers.randomColor)();\n }).style('fill-opacity', 0.8).style('stroke', 'black').style('stroke-opacity', 0.8);\n (0, _interface.switch_accordion_section)();\n }, function (error) {\n (0, _helpers.display_error_during_computation)();\n console.log(error);\n });\n }\n });\n (0, _helpers.setSelected)(field_selec.node(), field_selec.node().options[0].value);\n },\n unfill: function unfill() {\n var field_selec = document.getElementById('Anamorph_field');\n section2.selectAll('.params').attr('disabled', true);\n unfillSelectInput(field_selec);\n }\n};\n\nfunction fillMenu_Anamorphose() {\n var dialog_content = make_template_functionnality(section2);\n\n var algo_choice = dialog_content.append('p').attr('class', 'params_section2');\n algo_choice.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.cartogram.algo' }).html(_tr('app_page.func_options.cartogram.algo'));\n var algo_selec = algo_choice.insert('select').attrs({ id: 'Anamorph_algo', class: 'params i18n' });\n\n var field_choice = dialog_content.append('p').attr('class', 'params_section2');\n field_choice.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.cartogram.field' }).html(_tr('app_page.func_options.cartogram.field'));\n field_choice.insert('select').attrs({ class: 'params', id: 'Anamorph_field' });\n\n // Options for Dougenik mode :\n var doug1 = dialog_content.append('p').attr('class', 'params_section2 opt_dougenik');\n doug1.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.cartogram.dougenik_iterations' }).html(_tr('app_page.func_options.cartogram.dougenik_iterations'));\n doug1.insert('input').attrs({ type: 'number', class: 'params', value: 5, min: 1, max: 12, step: 1, id: 'Anamorph_dougenik_iterations' });\n\n [['Dougenik & al. (1985)', 'dougenik'], ['Olson (2005)', 'olson']].forEach(function (fun_name) {\n algo_selec.append('option').text(fun_name[0]).attr('value', fun_name[1]);\n });\n\n make_layer_name_input(dialog_content, 'Anamorph_output_name');\n make_ok_button(dialog_content, 'Anamorph_yes', false);\n\n dialog_content.selectAll('.params').attr('disabled', true);\n dialog_content.selectAll('.opt_olson').style('display', 'none');\n}\n\nfunction getCentroids(ref_layer_selection) {\n var centroids = [];\n for (var i = 0, nb_features = ref_layer_selection.length; i < nb_features; ++i) {\n var geom = ref_layer_selection[i].__data__.geometry;\n if (!geom) {\n centroids.push(null);\n } else if (geom.type.indexOf('Multi') < 0) {\n centroids.push(d3.geoCentroid(geom));\n } else {\n var areas = [];\n for (var j = 0; j < geom.coordinates.length; j++) {\n areas.push(path.area({\n type: geom.type,\n coordinates: [geom.coordinates[j]]\n }));\n }\n // const ix_max = areas.indexOf(max_fast(areas));\n centroids.push(d3.geoCentroid({\n type: geom.type,\n coordinates: [geom.coordinates[areas.indexOf((0, _helpers_calc.max_fast)(areas))]]\n }));\n }\n }\n return centroids;\n}\n\nfunction make_prop_line(rendering_params, geojson_line_layer) {\n var layer = rendering_params.ref_layer_name,\n field = rendering_params.field,\n color_field = rendering_params.color_field,\n t_field_name = 'prop_value',\n nb_features = rendering_params.nb_features,\n abs = Math.abs,\n ref_size = rendering_params.ref_size,\n ref_value = rendering_params.ref_value,\n symbol_type = rendering_params.symbol,\n layer_to_add = rendering_params.new_name,\n propSize = new _helpers_calc.PropSizer(ref_value, ref_size, symbol_type);\n\n if (!geojson_line_layer) {\n var make_geojson_line_layer = function make_geojson_line_layer() {\n var ref_layer_selection = document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName('path');\n var result = [];\n\n for (var i = 0, n_features = ref_layer_selection.length; i < n_features; ++i) {\n var ft = ref_layer_selection[i].__data__,\n value = +ft.properties[field];\n var new_obj = {\n id: i,\n type: 'Feature',\n properties: {},\n geometry: (0, _helpers.cloneObj)(ft.geometry)\n };\n if (f_ix_len) {\n for (var f_ix = 0; f_ix < f_ix_len; f_ix++) {\n new_obj.properties[fields_id[f_ix]] = ft.properties[fields_id[f_ix]];\n }\n }\n new_obj.properties[field] = value;\n new_obj.properties[t_field_name] = propSize.scale(value);\n new_obj.properties.color = get_color(value, i);\n if (color_field) new_obj.properties[color_field] = ft.properties[color_field];\n result.push([value, new_obj]);\n }\n result.sort(function (a, b) {\n return abs(b[0]) - abs(a[0]);\n });\n return {\n type: 'FeatureCollection',\n features: result.map(function (d) {\n return d[1];\n })\n };\n };\n\n var fields_id = (0, _helpers.getFieldsType)('id', layer).concat((0, _helpers.getFieldsType)('category', layer));\n var f_ix_len = fields_id ? fields_id.length : 0;\n var get_color = void 0,\n col1 = void 0,\n col2 = void 0;\n if (rendering_params.break_val !== undefined && rendering_params.fill_color.two) {\n col1 = rendering_params.fill_color.two[0];\n col2 = rendering_params.fill_color.two[1];\n get_color = function get_color(val) {\n return val > rendering_params.break_val ? col2 : col1;\n };\n } else if (rendering_params.fill_color instanceof Array && rendering_params.fill_color.length === nb_features) {\n get_color = function get_color(_, ix) {\n return rendering_params.fill_color[ix];\n };\n } else {\n get_color = function get_color() {\n return rendering_params.fill_color;\n };\n }\n\n geojson_line_layer = make_geojson_line_layer();\n }\n var require_clip_path = (0, _projections.isInterrupted)(_app.current_proj_name.toLowerCase()) || _app.current_proj_name.toLowerCase().indexOf('conicconformal') > -1 ? 'url(#clip)' : null;\n var layer_id = encodeId(layer_to_add);\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n data_manager.result_data[layer_to_add] = [];\n map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer', 'clip-path': require_clip_path }).styles({ 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }).selectAll('path').data(geojson_line_layer.features).enter().append('path').attr('d', path).styles(function (d) {\n data_manager.result_data[layer_to_add].push(d.properties);\n return {\n fill: 'transparent', stroke: d.properties.color, 'stroke-width': d.properties[t_field_name] };\n });\n\n data_manager.current_layers[layer_to_add] = {\n n_features: nb_features,\n renderer: rendering_params.renderer || 'PropSymbols',\n // symbol: symbol_type,\n symbol: 'path',\n rendered_field: field,\n size: [ref_value, ref_size],\n // \"stroke-width-const\": 1,\n is_result: true,\n ref_layer_name: layer,\n type: 'Line'\n };\n\n if (rendering_params.fill_color.two !== undefined) {\n data_manager.current_layers[layer_to_add].fill_color = (0, _helpers.cloneObj)(rendering_params.fill_color);\n } else if (rendering_params.fill_color instanceof Array) {\n data_manager.current_layers[layer_to_add].fill_color = {\n class: geojson_line_layer.features.map(function (v) {\n return v.properties.color;\n })\n };\n } else {\n data_manager.current_layers[layer_to_add].fill_color = { single: rendering_params.fill_color };\n }\n if (rendering_params.break_val !== undefined) {\n data_manager.current_layers[layer_to_add].break_val = rendering_params.break_val;\n }\n (0, _helpers.create_li_layer_elem)(layer_to_add, nb_features, ['Line', 'prop'], 'result');\n}\n\nfunction make_prop_symbols(rendering_params, _pt_layer) {\n var layer = rendering_params.ref_layer_name,\n field = rendering_params.field,\n color_field = rendering_params.color_field,\n t_field_name = 'prop_value',\n nb_features = rendering_params.nb_features,\n abs = Math.abs,\n ref_size = rendering_params.ref_size,\n ref_value = rendering_params.ref_value,\n symbol_type = rendering_params.symbol,\n layer_to_add = rendering_params.new_name,\n zs = d3.zoomTransform(svg_map).k,\n propSize = new _helpers_calc.PropSizer(ref_value, ref_size, symbol_type),\n warn_empty_features = [];\n var geojson_pt_layer = void 0;\n\n if (!_pt_layer) {\n var make_geojson_pt_layer = function make_geojson_pt_layer() {\n var ref_layer_selection = document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName('path');\n var result = [];\n for (var i = 0, n_features = ref_layer_selection.length; i < n_features; ++i) {\n var ft = ref_layer_selection[i].__data__;\n var value = +ft.properties[field];\n var new_obj = {\n id: i,\n type: 'Feature',\n properties: {},\n geometry: { type: 'Point' }\n };\n if (!ft.geometry) {\n warn_empty_features.push([i, ft]);\n } else if (ft.geometry.type.indexOf('Multi') < 0) {\n if (f_ix_len) {\n for (var f_ix = 0; f_ix < f_ix_len; f_ix++) {\n new_obj.properties[fields_id[f_ix]] = ft.properties[fields_id[f_ix]];\n }\n }\n new_obj.properties[field] = value;\n new_obj.properties[t_field_name] = propSize.scale(value);\n new_obj.geometry.coordinates = d3.geoCentroid(ft.geometry);\n new_obj.properties.color = get_color(value, i);\n if (color_field) new_obj.properties[color_field] = ft.properties[color_field];\n result.push([value, new_obj]);\n } else {\n var areas = [];\n for (var j = 0; j < ft.geometry.coordinates.length; j++) {\n areas.push(path.area({\n type: ft.geometry.type,\n coordinates: [ft.geometry.coordinates[j]]\n }));\n }\n var ix_max = areas.indexOf((0, _helpers_calc.max_fast)(areas));\n if (f_ix_len) {\n for (var _f_ix = 0; _f_ix < f_ix_len; _f_ix++) {\n new_obj.properties[fields_id[_f_ix]] = ft.properties[fields_id[_f_ix]];\n }\n }\n new_obj.properties[field] = value;\n new_obj.properties[t_field_name] = propSize.scale(value);\n new_obj.geometry.coordinates = d3.geoCentroid({\n type: ft.geometry.type, coordinates: [ft.geometry.coordinates[ix_max]] });\n new_obj.properties.color = get_color(value, i);\n if (color_field) new_obj.properties[color_field] = ft.properties[color_field];\n result.push([value, new_obj]);\n }\n }\n result.sort(function (a, b) {\n return abs(b[0]) - abs(a[0]);\n });\n return {\n type: 'FeatureCollection',\n features: result.map(function (d) {\n return d[1];\n })\n };\n };\n\n var fields_id = (0, _helpers.getFieldsType)('id', layer).concat((0, _helpers.getFieldsType)('category', layer));\n var f_ix_len = fields_id ? fields_id.length : 0;\n var get_color = void 0,\n col1 = void 0,\n col2 = void 0;\n\n if (rendering_params.break_val !== undefined && rendering_params.fill_color.two) {\n col1 = rendering_params.fill_color.two[0];\n col2 = rendering_params.fill_color.two[1];\n get_color = function get_color(val) {\n return val > rendering_params.break_val ? col2 : col1;\n };\n } else if (rendering_params.fill_color instanceof Array && rendering_params.fill_color.length === nb_features) {\n get_color = function get_color(_, ix) {\n return rendering_params.fill_color[ix];\n };\n } else {\n get_color = function get_color() {\n return rendering_params.fill_color;\n };\n }\n geojson_pt_layer = make_geojson_pt_layer();\n } else {\n geojson_pt_layer = _pt_layer;\n }\n\n var layer_id = encodeId(layer_to_add);\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n data_manager.result_data[layer_to_add] = [];\n if (symbol_type === 'circle') {\n map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer no_clip' }).selectAll('circle').data(geojson_pt_layer.features).enter().append('circle').attrs(function (d, i) {\n data_manager.result_data[layer_to_add].push(d.properties);\n return {\n id: ['PropSymbol_', i, ' feature_', d.id].join(''),\n r: d.properties[t_field_name],\n cx: path.centroid(d)[0],\n cy: path.centroid(d)[1]\n };\n }).styles(function (d) {\n return {\n fill: d.properties.color,\n stroke: 'black',\n 'stroke-width': 1 / zs\n };\n }).call(_helpers.drag_elem_geo2);\n } else if (symbol_type === 'rect') {\n map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer no_clip' }).selectAll('circle').data(geojson_pt_layer.features).enter().append('rect').attrs(function (d, i) {\n var size = d.properties[t_field_name];\n data_manager.result_data[layer_to_add].push(d.properties);\n return {\n id: ['PropSymbol_', i, ' feature_', d.id].join(''),\n height: size,\n width: size,\n x: path.centroid(d)[0] - size / 2,\n y: path.centroid(d)[1] - size / 2\n };\n }).styles(function (d) {\n return {\n fill: d.properties.color,\n stroke: 'black',\n 'stroke-width': 1 / zs\n };\n }).call(_helpers.drag_elem_geo2);\n }\n\n data_manager.current_layers[layer_to_add] = {\n n_features: nb_features,\n renderer: rendering_params.renderer || 'PropSymbols',\n symbol: symbol_type,\n rendered_field: field,\n size: [ref_value, ref_size],\n 'stroke-width-const': 1,\n is_result: true,\n ref_layer_name: layer,\n draggable: false\n };\n\n if (rendering_params.fill_color.two !== undefined) {\n data_manager.current_layers[layer_to_add].fill_color = (0, _helpers.cloneObj)(rendering_params.fill_color);\n } else if (rendering_params.fill_color instanceof Array) {\n data_manager.current_layers[layer_to_add].fill_color = {\n class: geojson_pt_layer.features.map(function (v) {\n return v.properties.color;\n })\n };\n } else {\n data_manager.current_layers[layer_to_add].fill_color = { single: rendering_params.fill_color };\n }\n if (rendering_params.break_val !== undefined) {\n data_manager.current_layers[layer_to_add].break_val = rendering_params.break_val;\n }\n (0, _helpers.create_li_layer_elem)(layer_to_add, nb_features, ['Point', 'prop'], 'result');\n\n if (warn_empty_features.length > 0) {\n display_warning_empty_geom(warn_empty_features);\n }\n}\n\nfunction render_categorical(layer, rendering_params) {\n var layer_name = void 0;\n if (rendering_params.new_name) {\n var fields = [].concat((0, _helpers.getFieldsType)('id', layer), rendering_params.rendered_field);\n (0, _helpers.copy_layer)(layer, rendering_params.new_name, 'typo', fields);\n data_manager.current_layers[rendering_params.new_name].key_name = data_manager.current_layers[layer].key_name;\n data_manager.current_layers[rendering_params.new_name].type = data_manager.current_layers[layer].type;\n layer_name = rendering_params.new_name;\n } else {\n layer_name = layer;\n }\n\n var colorsByFeature = rendering_params.colorByFeature,\n color_map = rendering_params.color_map,\n field = rendering_params.rendered_field;\n var layer_to_render = map.select('#' + _app.layer_to_id.get(layer_name));\n layer_to_render.style('opacity', 1).style('stroke-width', 0.75 / d3.zoomTransform(svg_map).k + 'px');\n if (data_manager.current_layers[layer_name].type === 'Line') {\n layer_to_render.selectAll('path').styles(function (_, i) {\n return {\n fill: 'transparent',\n stroke: colorsByFeature[i],\n 'stroke-opacity': 1\n };\n });\n } else {\n layer_to_render.selectAll('path').styles(function (_, i) {\n return {\n fill: colorsByFeature[i],\n 'fill-opacity': 0.9,\n stroke: '#000',\n 'stroke-opacity': 0.9\n };\n });\n }\n data_manager.current_layers[layer_name].renderer = rendering_params.renderer;\n data_manager.current_layers[layer_name].rendered_field = field;\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorByFeature };\n data_manager.current_layers[layer_name]['stroke-width-const'] = 0.75;\n data_manager.current_layers[layer_name].is_result = true;\n data_manager.current_layers[layer_name].color_map = color_map;\n (0, _map_ctrl.zoom_without_redraw)();\n}\n\n// Function to render the `layer` according to the `rendering_params`\n// (layer should be the name of group of path, ie. not a PropSymbol layer)\n// Currently used fo \"choropleth\", \"MTA - relative deviations\", \"gridded map\" functionnality\nfunction render_choro(layer, rendering_params) {\n var layer_name = void 0;\n if (rendering_params.new_name) {\n var fields = [].concat((0, _helpers.getFieldsType)('id', layer), rendering_params.rendered_field);\n (0, _helpers.copy_layer)(layer, rendering_params.new_name, 'choro', fields);\n // Assign the same key to the cloned layer so it could be used transparently on server side\n // after deletion of the reference layer if needed :\n data_manager.current_layers[rendering_params.new_name].key_name = data_manager.current_layers[layer].key_name;\n data_manager.current_layers[rendering_params.new_name].type = data_manager.current_layers[layer].type;\n layer_name = rendering_params.new_name;\n } else {\n layer_name = layer;\n }\n var breaks = rendering_params.breaks;\n var options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: breaks,\n extra_options: rendering_params.extra_options\n };\n var layer_to_render = map.select('#' + _app.layer_to_id.get(layer_name));\n layer_to_render.style('opacity', 1).style('stroke-width', 0.75 / d3.zoomTransform(svg_map).k + 'px');\n if (data_manager.current_layers[layer_name].type === 'Line') {\n layer_to_render.selectAll('path').styles({ fill: 'transparent', 'stroke-opacity': 1 }).style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n } else {\n layer_to_render.selectAll('path').styles({ 'fill-opacity': 1, 'stroke-opacity': 1, stroke: '#000' }).style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n data_manager.current_layers[layer_name].renderer = rendering_params.renderer;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.rendered_field;\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n data_manager.current_layers[layer_name]['stroke-width-const'] = 0.75;\n data_manager.current_layers[layer_name].is_result = true;\n data_manager.current_layers[layer_name].options_disc = options_disc;\n var colors_breaks = [];\n for (var i = breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[breaks[i - 1], ' - ', breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n (0, _map_ctrl.zoom_without_redraw)();\n}\n\nfunction render_mini_chart_serie(values, parent, max_h, nb_bins) {\n var bins = nb_bins || (values.length > 20 ? 16 : undefined) || (values.length > 15 ? 10 : 5);\n var class_count = (0, _helpers_calc.getBinsCount)(values, bins),\n background = '#f1f1f1',\n color = '#6633ff',\n width = 3 * bins - 3,\n height = 25,\n canvas = document.createElement('canvas');\n var cap = max_h || (0, _helpers_calc.max_fast)(class_count.counts);\n canvas.width = width;\n canvas.height = height;\n\n var old = parent.querySelector('canvas');\n if (old) old.remove();\n parent.appendChild(canvas);\n\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = background;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n var barwidth = 2;\n var barspace = 1;\n var x = 0;\n\n ctx.fillStyle = color;\n for (var i = 0; i < bins; i++) {\n var barheight = Math.floor((0, _helpers_math.Mmin)(class_count.counts[i] / cap, 1) * (height - 1));\n x += barspace;\n ctx.fillRect(x, height, barwidth, -barheight);\n x += barwidth;\n }\n canvas.setAttribute('tooltip-info', make_mini_summary(class_count));\n new Tooltip(canvas, {\n dataAttr: 'tooltip-info',\n animation: 'slideNfade',\n duration: 50,\n delay: 100,\n container: document.getElementById('twbs'),\n placement: 'top'\n });\n}\n\nfunction make_mini_summary(summary) {\n var p = (0, _helpers_math.Mmax)((0, _helpers_calc.get_nb_decimals)(summary.min), (0, _helpers_calc.get_nb_decimals)(summary.max));\n var props = {\n min: summary.min,\n max: summary.max,\n mean: summary.mean.toFixed(p),\n median: summary.median.toFixed(p),\n stddev: summary.stddev.toFixed(p)\n };\n return _tr('app_page.stat_summary.mini_summary', props);\n}\n\nfunction fillMenu_PropSymbolTypo() {\n var dv2 = make_template_functionnality(section2);\n\n var a = dv2.append('p').attr('class', 'params_section2');\n a.append('p').style('margin', 'auto').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.proptypo.field1' }).html(_tr('app_page.func_options.proptypo.field1'));\n a.insert('select').attrs({ class: 'params', id: 'PropSymbolTypo_field_1' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var b = dv2.append('p').attr('class', 'params_section2');\n b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.proptypo.fixed_size' }).html(_tr('app_page.func_options.proptypo.fixed_size'));\n b.insert('input').attrs({\n type: 'number',\n class: 'params',\n id: 'PropSymbolTypo_ref_size',\n min: 0.1,\n max: 100.0,\n step: 'any'\n }).style('width', '50px').property('value', 60.0);\n b.append('span').html(' (px)');\n\n var c = dv2.append('p').attr('class', 'params_section2');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.proptypo.on_value' }).html(_tr('app_page.func_options.proptypo.on_value'));\n c.insert('input').styles({ width: '100px', 'margin-left': '10px' }).attrs({\n type: 'number', class: 'params', id: 'PropSymbolTypo_ref_value', min: 0.1, step: 0.1\n });\n\n // Other symbols could probably easily be proposed :\n var d = dv2.append('p').attr('class', 'params_section2');\n d.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.proptypo.symbol_type' }).html(_tr('app_page.func_options.proptypo.symbol_type'));\n d.insert('select').attrs({ class: 'params', id: 'PropSymbolTypo_symbol_type' });\n\n var e = dv2.append('p').attr('class', 'params_section2');\n e.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.proptypo.field2' }).html(_tr('app_page.func_options.proptypo.field2'));\n e.insert('select').attrs({ class: 'params', id: 'PropSymbolTypo_field_2' });\n\n var f = dv2.insert('p').attr('class', 'params_section2').styles({ margin: 'auto', 'text-align': 'center' });\n f.append('button').attrs({\n id: 'Typo_class',\n class: 'button_disc params i18n',\n 'data-i18n': '[html]app_page.func_options.typo.color_choice'\n }).styles({ 'font-size': '0.8em', 'text-align': 'center' }).html(_tr('app_page.func_options.typo.color_choice'));\n\n make_layer_name_input(dv2, 'PropSymbolTypo_output_name');\n make_ok_button(dv2, 'propTypo_yes');\n section2.selectAll('.params').attr('disabled', true);\n}\n\nfunction prepare_categories_array(layer_name, selected_field, col_map) {\n var cats = [];\n if (!col_map) {\n var _col_map = new Map();\n for (var i = 0, data_layer = data_manager.user_data[layer_name]; i < data_layer.length; ++i) {\n var value = data_layer[i][selected_field],\n ret_val = _col_map.get(value);\n _col_map.set(value, ret_val ? [ret_val[0] + 1, [i].concat(ret_val[1])] : [1, [i]]);\n }\n _col_map.forEach(function (v, k) {\n cats.push({ name: k, display_name: k, nb_elem: v[0], color: (0, _colors_helpers.randomColor)() });\n });\n _col_map = new Map();\n for (var _i7 = 0; _i7 < cats.length; _i7++) {\n _col_map.set(cats[_i7].name, [cats[_i7].color, cats[_i7].name, cats[_i7].nb_elem]);\n }\n return [cats, _col_map];\n }\n col_map.forEach(function (v, k) {\n cats.push({ name: k, display_name: v[1], nb_elem: v[2], color: v[0] });\n });\n return [cats, col_map];\n}\n\nvar askManyFeaturesCategorical = function askManyFeaturesCategorical() {\n return swal({\n title: '',\n text: _tr('app_page.common.error_too_many_features_color'),\n type: 'warning',\n showCancelButton: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.valid') + '!',\n cancelButtonText: _tr('app_page.common.cancel')\n });\n};\n\nvar fields_PropSymbolTypo = {\n fill: function fill(layer) {\n if (!layer) return;\n section2.selectAll('.params').attr('disabled', null);\n var self = this,\n fields_num = (0, _helpers.getFieldsType)('stock', layer),\n fields_categ = (0, _helpers.getFieldsType)('category', layer),\n\n // nb_features = data_manager.user_data[layer].length,\n field1_selec = section2.select('#PropSymbolTypo_field_1'),\n field2_selec = section2.select('#PropSymbolTypo_field_2'),\n ref_value_field = section2.select('#PropSymbolTypo_ref_value'),\n ref_size = section2.select('#PropSymbolTypo_ref_size'),\n symb_selec = section2.select('#PropSymbolTypo_symbol_type'),\n uo_layer_name = section2.select('#PropSymbolTypo_output_name'),\n btn_typo_class = section2.select('#Typo_class'),\n ok_button = section2.select('#propTypo_yes');\n\n var prepare_colors = function prepare_colors(field) {\n var _prepare_categories_a5 = prepare_categories_array(layer, field, null),\n _prepare_categories_a6 = _slicedToArray(_prepare_categories_a5, 2),\n _ = _prepare_categories_a6[0],\n col_map = _prepare_categories_a6[1];\n\n var nb_class = col_map.size;\n var colorByFeature = data_manager.user_data[layer].map(function (ft) {\n return col_map.get(ft[field])[0];\n });\n self.rendering_params[field] = {\n nb_class: nb_class,\n color_map: col_map,\n colorByFeature: colorByFeature,\n renderer: 'Categorical',\n rendered_field: field,\n skip_alert: false\n };\n };\n\n if (fields_categ.length === 0 || fields_num.length === 0) {\n display_error_num_field();\n return;\n }\n\n if (data_manager.current_layers[layer].type === 'Line') {\n ref_size.attr('value', 10.0);\n [['app_page.func_options.common.symbol_line', 'line'], ['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symb_selec.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n } else {\n ref_size.attr('value', 60.0);\n [['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symb_selec.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n }\n\n fields_num.forEach(function (field) {\n field1_selec.append('option').text(field).attr('value', field);\n });\n\n fields_categ.forEach(function (field) {\n field2_selec.append('option').text(field).attr('value', field);\n });\n\n // Set some default colors in order to not force to open the box for selecting them :\n {\n var first_field = fields_categ[0];\n prepare_colors(first_field);\n ok_button.attr('disabled', self.rendering_params[first_field] ? null : true);\n }\n\n field1_selec.on('change', function () {\n var field_name = this.value,\n max_val_field = (0, _helpers_calc.max_fast)(data_manager.user_data[layer].map(function (obj) {\n return +obj[field_name];\n }));\n ref_value_field.attrs({ max: max_val_field, value: max_val_field });\n uo_layer_name.attr('value', ['Typo', field_name, field2_selec.node().value, layer].join('_'));\n });\n\n field2_selec.on('change', function () {\n var field_name = this.value;\n prepare_colors(field_name);\n // ok_button.attr(\"disabled\", self.rendering_params[field_name] ? null : true);\n uo_layer_name.attr('value', ['Typo', field1_selec.node().value, field_name, layer].join('_'));\n });\n\n btn_typo_class.on('click', function () {\n var selected_field = field2_selec.node().value,\n new_layer_name = check_layer_name(['Typo', field1_selec.node().value, selected_field, layer].join('_'));\n var col_map = self.rendering_params[selected_field] ? self.rendering_params[selected_field].color_map : undefined;\n\n var _prepare_categories_a7 = prepare_categories_array(layer, selected_field, col_map),\n _prepare_categories_a8 = _slicedToArray(_prepare_categories_a7, 1),\n cats = _prepare_categories_a8[0];\n\n var fun = function fun() {\n (0, _categorical_panel.display_categorical_box)(data_manager.user_data[layer], layer, selected_field, cats).then(function (confirmed) {\n if (confirmed) {\n // ok_button.attr(\"disabled\", null);\n self.rendering_params[selected_field] = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: selected_field,\n new_name: new_layer_name,\n skip_alert: true\n };\n }\n });\n };\n if (cats.length > 15) {\n askManyFeaturesCategorical().then(fun, function () {\n return null;\n });\n } else {\n fun();\n }\n });\n\n ok_button.on('click', function () {\n var render = function render() {\n render_PropSymbolTypo(field1_selec.node().value, field2_selec.node().value, uo_layer_name.node().value, ref_value_field.node().value, section2.select('#PropSymbolTypo_ref_size').node().value, section2.select('#PropSymbolTypo_symbol_type').node().value);\n };\n var field_color = field2_selec.node().value;\n if (self.rendering_params[field_color].color_map.size > 15 && !self.rendering_params[field_color].skip_alert) {\n askManyFeaturesCategorical().then(render, function () {\n return null;\n });\n } else {\n render();\n }\n });\n (0, _helpers.setSelected)(field1_selec.node(), fields_num[0]);\n (0, _helpers.setSelected)(field2_selec.node(), fields_categ[0]);\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('PropSymbolTypo_field_1'));\n unfillSelectInput(document.getElementById('PropSymbolTypo_field_2'));\n unfillSelectInput(document.getElementById('PropSymbolTypo_symbol_type'));\n section2.selectAll('.params').attr('disabled', true);\n },\n\n rendering_params: {}\n};\n\nfunction render_PropSymbolTypo(field1, color_field, n_layer_name, ref_value, ref_size, symb_selec) {\n if (!ref_value || !color_field || !fields_PropSymbolTypo.rendering_params[color_field]) {\n return;\n }\n var layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n nb_features = data_manager.user_data[layer].length,\n rendering_params = fields_PropSymbolTypo.rendering_params[color_field],\n rd_params = {};\n\n var new_layer_name = check_layer_name(n_layer_name.length > 0 ? n_layer_name : ['PropSymbolsTypo', field1, color_field, layer].join('_'));\n\n rd_params.field = field1;\n rd_params.new_name = new_layer_name;\n rd_params.nb_features = nb_features;\n rd_params.ref_layer_name = layer;\n rd_params.symbol = symb_selec;\n rd_params.ref_value = +ref_value;\n rd_params.color_field = color_field;\n rd_params.ref_size = +ref_size;\n rd_params.fill_color = rendering_params.colorByFeature;\n\n if (symb_selec === 'line') {\n make_prop_line(rd_params);\n } else {\n make_prop_symbols(rd_params);\n }\n\n Object.assign(data_manager.current_layers[new_layer_name], {\n renderer: 'PropSymbolsTypo',\n rendered_field: field1,\n rendered_field2: color_field,\n color_map: rendering_params.color_map\n });\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n}\n\nfunction fillMenu_Discont() {\n var dv2 = make_template_functionnality(section2);\n\n var a = dv2.append('p').attr('class', 'params_section2');\n a.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.discont.field' }).html(_tr('app_page.func_options.discont.field'));\n a.insert('select').attrs({ class: 'params', id: 'field_Discont' });\n\n // let b = dv2.append('p').attr('class', 'params_section2');\n // b.append('span')\n // .attrs({class: 'i18n', 'data-i18n': '[html]app_page.func_options.discont.id_field'})\n // .html(_tr('app_page.func_options.discont.id_field'));\n // b.insert('select')\n // .attrs({class: 'params', id: 'field_id_Discont'});\n\n var c = dv2.append('p').attr('class', 'params_section2');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.discont.type_discontinuity' }).html(_tr('app_page.func_options.discont.type_discontinuity'));\n var discontinuity_type = c.insert('select').attrs({ class: 'params i18n', id: 'kind_Discont' });\n\n [['app_page.func_options.discont.type_relative', 'rel'], ['app_page.func_options.discont.type_absolute', 'abs']].forEach(function (k) {\n discontinuity_type.append('option').text(_tr(k[0])).attrs({ value: k[1], 'data-i18n': '[text]' + k[0] });\n });\n\n // let d = dv2.append('p').attr('class', 'params_section2');\n // d.append('span')\n // .attrs({class: 'i18n', 'data-i18n': '[html]app_page.func_options.discont.nb_class'})\n // .html(_tr('app_page.func_options.discont.nb_class'));\n // d.insert('input')\n // .attrs({type: 'number', class: 'params', id: 'Discont_nbClass', min: 1, max: 33, value: 4})\n // .style('width', '50px');\n\n var e = dv2.append('p').attr('class', 'params_section2');\n e.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.discont.discretization' }).html(_tr('app_page.func_options.discont.discretization'));\n var disc_type = e.insert('select').attrs({ class: 'params i18n', id: 'Discont_discKind' });\n\n [['app_page.common.equal_interval', 'equal_interval'], ['app_page.common.quantiles', 'quantiles'], ['app_page.common.Q6', 'Q6'], ['app_page.common.jenks', 'jenks']].forEach(function (field) {\n disc_type.append('option').text(_tr(field[0])).attrs({ value: field[1], 'data-i18n': '[text]' + field[0] });\n });\n\n var f = dv2.append('p').attr('class', 'params_section2');\n f.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.discont.color' }).html(_tr('app_page.func_options.discont.color'));\n f.insert('input').attrs({ class: 'params', id: 'color_Discont', type: 'color', value: _colors_helpers.ColorsSelected.random() });\n\n make_layer_name_input(dv2, 'Discont_output_name');\n make_ok_button(dv2, 'yes_Discont', false);\n\n dv2.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_Discont = {\n fill: function fill(layer) {\n if (!layer) return;\n var fields_num = (0, _helpers.getFieldsType)('stock', layer).concat((0, _helpers.getFieldsType)('ratio', layer)),\n\n // fields_id = getFieldsType('id', layer),\n select_type_discont = section2.select('#kind_Discont'),\n field_discont = section2.select('#field_Discont'),\n\n // field_id = section2.select(\"#field_id_Discont\"),\n ok_button = section2.select('#yes_Discont');\n\n if (fields_num.length === 0) {\n display_error_num_field();\n return;\n }\n\n select_type_discont.on('change', function () {\n var field_name = field_discont.node().value;\n document.getElementById('Discont_output_name').value = ['Disc', field_name, this.value, layer].join('_');\n });\n\n fields_num.forEach(function (field) {\n field_discont.append('option').text(field).attr('value', field);\n });\n // if (fields_id.length == 0) {\n // field_id.append(\"option\")\n // .text(_tr(\"app_page.common.default\"))\n // .attrs({\"value\": \"__default__\", \"class\": \"i18n\",\n // \"data-i18n\": \"[text]app_page.common.default\"});\n // } else {\n // fields_id.forEach(function(field) {\n // field_id.append(\"option\").text(field).attr(\"value\", field);\n // });\n // }\n field_discont.on('change', function () {\n var discontinuity_type = document.getElementById('kind_Discont').value;\n document.getElementById('Discont_output_name').value = ['Disc', this.value, discontinuity_type, layer].join('_');\n });\n ok_button.on('click', render_discont);\n section2.selectAll('.params').attr('disabled', null);\n document.getElementById('Discont_output_name').value = ['Disc', field_discont.node().value, select_type_discont.node().value, layer].join('_');\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('field_Discont'));\n // unfillSelectInput(document.getElementById(\"field_id_Discont\"));\n section2.selectAll('.params').attr('disabled', true);\n }\n};\n\nvar render_discont = function render_discont() {\n var layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n field = document.getElementById('field_Discont').value,\n\n // field_id = document.getElementById(\"field_id_Discont\").value,\n min_size = 1,\n max_size = 10,\n discontinuity_type = document.getElementById('kind_Discont').value,\n discretization_type = document.getElementById('Discont_discKind').value,\n nb_class = 4,\n user_color = document.getElementById('color_Discont').value;\n var new_layer_name = document.getElementById('Discont_output_name').value;\n\n new_layer_name = check_layer_name(new_layer_name.length > 0 ? new_layer_name : ['Disc', field, discontinuity_type, layer].join('_'));\n\n var id_layer = encodeId(new_layer_name);\n _app.layer_to_id.set(new_layer_name, id_layer);\n _app.id_to_layer.set(id_layer, new_layer_name);\n\n // This is the \"id\" field used to make a new id for the discontinuity line\n // created in this function (by taking the id of the two nearby feature).\n // We don't let the user choose it anymore but we might change that\n // it just stay as 'undefined' for now:\n var field_id = undefined;\n // field_id = field_id == \"__default__\" ? undefined : field_id;\n\n var topo_to_use = _target_layer_file;\n\n _app.waitingOverlay.display();\n\n // Discontinuity are computed in another thread to avoid blocking the ui\n // (a waiting message is displayed during this time to avoid action from the user)\n var discont_worker = new Worker('static/dist/webworker_discont.js');\n _app.webworker_to_cancel = discont_worker;\n discont_worker.postMessage([topo_to_use, layer, field, discontinuity_type, discretization_type, field_id]);\n discont_worker.onmessage = function (e) {\n var _e$data = _slicedToArray(e.data, 2),\n arr_tmp = _e$data[0],\n d_res = _e$data[1];\n\n _app.webworker_to_cancel = undefined;\n var nb_ft = arr_tmp.length,\n step = (max_size - min_size) / (nb_class - 1),\n class_size = Array(nb_class).fill(0).map(function (d, i) {\n return min_size + i * step;\n });\n\n var _discretize_to_size = (0, _common.discretize_to_size)(arr_tmp, discretization_type, nb_class, min_size, max_size),\n _discretize_to_size2 = _slicedToArray(_discretize_to_size, 4),\n breaks = _discretize_to_size2[2],\n serie = _discretize_to_size2[3];\n\n if (!serie || !breaks) {\n var opt_nb_class = Math.floor(1 + 3.3 * Math.log10(nb_ft));\n var w = nb_class > opt_nb_class ? _tr('app_page.common.smaller') : _tr('app_page.common.larger');\n swal('', _tr('app_page.common.error_discretization', { arg: w }), 'error');\n return;\n }\n var require_clip_path = (0, _projections.isInterrupted)(_app.current_proj_name.toLowerCase()) || _app.current_proj_name.toLowerCase().indexOf('conicconformal') > -1 ? 'url(#clip)' : null;\n breaks = breaks.map(function (ft) {\n return [ft[0], ft[1]];\n }).filter(function (d) {\n return d[1] !== undefined;\n });\n\n data_manager.result_data[new_layer_name] = [];\n\n var result_layer = map.insert('g', '.legend').attrs({\n id: id_layer,\n class: 'layer',\n 'clip-path': require_clip_path\n }).styles({\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round'\n });\n\n var data_result = data_manager.result_data[new_layer_name];\n\n for (var i = 0; i < nb_ft; i++) {\n var val = d_res[i][0];\n var p_size = class_size[serie.getClass(val)];\n var elem = result_layer.append('path').datum(d_res[i][2]).attrs({ d: path, id: ['feature', i].join('_') }).styles({ stroke: user_color, 'stroke-width': p_size, fill: 'transparent', 'stroke-opacity': 1 });\n var elem_data = elem.node().__data__;\n data_result.push(d_res[i][1]);\n elem_data.geometry = d_res[i][2];\n elem_data.properties = data_result[i];\n elem_data.properties.prop_val = p_size;\n }\n\n data_manager.current_layers[new_layer_name] = {\n renderer: 'DiscLayer',\n breaks: breaks,\n min_display: 0, // FIXME\n type: 'Line',\n rendered_field: field,\n size: [0.5, 10],\n is_result: true,\n fixed_stroke: true,\n ref_layer_name: layer,\n fill_color: { single: user_color },\n n_features: nb_ft\n };\n (0, _helpers.create_li_layer_elem)(new_layer_name, nb_ft, ['Line', 'discont'], 'result');\n\n _app.waitingOverlay.hide();\n\n {\n // Only display the 50% most important values :\n // TODO : reintegrate this upstream in the layer creation :\n var lim = 0.5 * data_manager.current_layers[new_layer_name].n_features;\n result_layer.selectAll('path').style('display', function (_, i) {\n return i <= lim ? null : 'none';\n });\n data_manager.current_layers[new_layer_name].min_display = 0.5;\n }\n\n d3.select('#layer_to_export').append('option').attr('value', new_layer_name).text(new_layer_name);\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n (0, _helpers.send_layer_server)(new_layer_name, '/layers/add');\n discont_worker.terminate();\n };\n};\n\nfunction fillMenu_PropSymbol() {\n var dialog_content = make_template_functionnality(section2),\n max_allowed_size = (0, _helpers_math.Mround)(h / 2 - h / 10);\n\n var a = dialog_content.append('p').attr('class', 'params_section2');\n a.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.field' }).html(_tr('app_page.func_options.common.field'));\n a.insert('select').attrs({ class: 'params', id: 'PropSymbol_field_1' });\n\n var b = dialog_content.append('p').attr('class', 'params_section2');\n b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.prop.fixed_size' }).html(_tr('app_page.func_options.prop.fixed_size'));\n b.insert('input').attrs({\n id: 'PropSymbol_ref_size',\n type: 'number',\n class: 'params',\n min: 0.2,\n max: max_allowed_size,\n step: 0.1\n }).style('width', '50px').property('value', 60.0);\n b.append('span').html(' px');\n\n var c = dialog_content.append('p').attr('class', 'params_section2');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.prop.on_value' }).html(_tr('app_page.func_options.prop.on_value'));\n c.insert('input').styles({ width: '100px', 'margin-left': '10px' }).attrs({ id: 'PropSymbol_ref_value', type: 'number', class: 'params', min: 0.1, step: 0.1 });\n\n var d = dialog_content.append('p').attr('class', 'params_section2');\n d.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.prop.symbol_type' }).html(_tr('app_page.func_options.prop.symbol_type'));\n d.insert('select').attrs({ class: 'params i18n', id: 'PropSymbol_symbol' });\n\n // [['app_page.func_options.common.symbol_circle', 'circle'],\n // ['app_page.func_options.common.symbol_square', 'rect']\n // ].forEach(function(symb) {\n // symb_selec.append(\"option\")\n // .text(_tr(symb[0])).attrs({\"value\": symb[1], 'data-i18n': `[text]${symb[0]}`});});\n\n var color_section = dialog_content.append('p').attr('class', 'params_section2');\n color_section.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.prop.symbol_color' }).html(_tr('app_page.func_options.prop.symbol_color'));\n var color_par = color_section.append('select').attrs({ id: 'PropSymbol_nb_colors', class: 'params' });\n color_par.append('option').attrs({ value: 1, class: 'i18n', 'data-i18n': '[text]app_page.func_options.prop.options_one_color' }).text(_tr('app_page.func_options.prop.options_one_color'));\n color_par.append('option').attrs({ value: 2, class: 'i18n', 'data-i18n': '[text]app_page.func_options.prop.options_two_colors' }).text(_tr('app_page.func_options.prop.options_two_colors'));\n\n var col_p = dialog_content.append('p').attr('class', 'params_section2').styles({ 'padding-top': '5px', 'margin-bottom': '-5px', 'text-align': 'center' });\n col_p.insert('input').styles({ position: 'unset' }).attrs({ type: 'color', class: 'params', id: 'PropSymbol_color1' }).property('value', _colors_helpers.ColorsSelected.random());\n col_p.insert('input').styles({ display: 'none', position: 'unset' }).attrs({ type: 'color', class: 'params', id: 'PropSymbol_color2' }).property('value', _colors_helpers.ColorsSelected.random());\n\n var col_b = dialog_content.insert('p').attr('class', 'params_section2');\n col_b.insert('span').style('display', 'none').attrs({ id: 'PropSymbol_color_txt', class: 'i18n', 'data-i18n': '[html]app_page.func_options.prop.options_break_two_colors' }).html(_tr('app_page.func_options.prop.options_break_two_colors'));\n col_b.insert('input').attrs({ id: 'PropSymbol_break_val', type: 'number', class: 'params' }).styles({ display: 'none', width: '75px' });\n\n make_layer_name_input(dialog_content, 'PropSymbol_output_name');\n make_ok_button(dialog_content, 'PropSymbol_yes', false);\n dialog_content.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_PropSymbol = {\n fill: function fill(layer) {\n if (!layer) return;\n section2.selectAll('.params').attr('disabled', null);\n var fields = (0, _helpers.getFieldsType)('stock', layer),\n nb_features = data_manager.user_data[layer].length,\n field_selec = section2.select('#PropSymbol_field_1'),\n nb_color = section2.select('#PropSymbol_nb_colors'),\n ok_button = section2.select('#PropSymbol_yes'),\n ref_value_field = section2.select('#PropSymbol_ref_value'),\n ref_size = section2.select('#PropSymbol_ref_size'),\n symb_selec = section2.select('#PropSymbol_symbol'),\n uo_layer_name = section2.select('#PropSymbol_output_name'),\n fill_color = section2.select('#PropSymbol_color1'),\n fill_color2 = section2.select('#PropSymbol_color2'),\n fill_color_opt = section2.select('#PropSymbol_break_val'),\n fill_color_text = section2.select('#PropSymbol_color_txt');\n\n if (data_manager.current_layers[layer].type === 'Line') {\n ref_size.attr('value', 10.0);\n [['app_page.func_options.common.symbol_line', 'line'], ['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symb_selec.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n } else {\n ref_size.attr('value', 60.0);\n [['app_page.func_options.common.symbol_circle', 'circle'], ['app_page.func_options.common.symbol_square', 'rect']].forEach(function (symb) {\n symb_selec.append('option').text(_tr(symb[0])).attrs({ value: symb[1], 'data-i18n': '[text]' + symb[0] });\n });\n }\n\n fields.forEach(function (field) {\n field_selec.append('option').text(field).attr('value', field);\n });\n\n field_selec.on('change', function () {\n var field_name = this.value,\n field_values = data_manager.user_data[layer].map(function (obj) {\n return +obj[field_name];\n }),\n max_val_field = (0, _helpers_calc.max_fast)(field_values);\n uo_layer_name.attr('value', ['PropSymbol', this.value, layer].join('_'));\n ref_value_field.attrs({ max: max_val_field, value: max_val_field });\n if ((0, _helpers_calc.has_negative)(field_values)) {\n (0, _helpers.setSelected)(nb_color.node(), 2);\n fill_color_opt.attr('value', 0);\n } else {\n (0, _helpers.setSelected)(nb_color.node(), 1);\n }\n });\n\n nb_color.on('change', function () {\n if (+this.value === 1) {\n fill_color2.style('display', 'none');\n fill_color_opt.style('display', 'none');\n fill_color_text.style('display', 'none');\n } else {\n fill_color2.style('display', null);\n fill_color_opt.style('display', null);\n fill_color_text.style('display', 'inline');\n }\n });\n\n ok_button.on('click', function () {\n var field_to_render = field_selec.node().value,\n symbol_to_use = symb_selec.node().value,\n user_new_layer_name = uo_layer_name.node().value,\n new_layer_name = check_layer_name(user_new_layer_name.length > 0 ? user_new_layer_name : ['PropSymbols', field_to_render, layer].join('_'));\n var rendering_params = {\n field: field_to_render,\n nb_features: nb_features,\n new_name: new_layer_name,\n ref_layer_name: layer,\n symbol: symbol_to_use,\n ref_size: +ref_size.node().value,\n ref_value: +ref_value_field.node().value,\n fill_color: fill_color.node().value\n };\n\n if (+nb_color.node().value === 2) {\n rendering_params.break_val = +fill_color_opt.node().value;\n rendering_params.fill_color = { two: [fill_color.node().value, fill_color2.node().value] };\n }\n if (symbol_to_use === 'line') {\n make_prop_line(rendering_params);\n } else {\n make_prop_symbols(rendering_params);\n }\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n });\n uo_layer_name.attr('value', ['PropSymbols', layer].join('_'));\n (0, _helpers.setSelected)(field_selec.node(), fields[0]);\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('PropSymbol_field_1'));\n unfillSelectInput(document.getElementById('PropSymbol_symbol'));\n section2.selectAll('.params').attr('disabled', true);\n }\n};\n\nfunction fillMenu_TypoSymbol() {\n var dv2 = make_template_functionnality(section2);\n var a = dv2.append('p').attr('class', 'params_section2');\n a.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.typosymbol.field' }).html(_tr('app_page.func_options.typosymbol.field'));\n a.insert('select').attrs({ class: 'params', id: 'field_Symbol' });\n\n var b = dv2.insert('p').attr('class', 'params_section2').styles({ 'text-align': 'center', margin: 'auto' });\n b.append('button').attrs({\n id: 'selec_Symbol',\n class: 'button_disc params i18n',\n 'data-i18n': '[html]app_page.func_options.typosymbol.symbols_choice'\n }).styles({ 'font-size': '0.8em', 'text-align': 'center' }).html(_tr('app_page.func_options.typosymbol.symbols_choice'));\n\n make_layer_name_input(dv2, 'TypoSymbols_output_name');\n make_ok_button(dv2, 'yesTypoSymbols');\n dv2.selectAll('.params').attr('disabled', true);\n if (!_app.default_symbols || _app.default_symbols.length === 0) {\n _app.default_symbols = [];\n (0, _interface.prepare_available_symbols)();\n }\n}\n\nfunction discard_rendering_empty_val() {\n swal({\n title: '',\n type: 'error',\n text: _tr('app_page.common.error_empty_vals')\n });\n}\n\nvar fields_TypoSymbol = {\n fill: function fill(layer) {\n if (!layer) return;\n var fields_all = Object.getOwnPropertyNames(data_manager.user_data[layer][0]),\n field_to_use = section2.select('#field_Symbol'),\n selec_symbol = section2.select('#selec_Symbol'),\n uo_layer_name = section2.select('#TypoSymbols_output_name'),\n ok_button = section2.select('#yesTypoSymbols'),\n self = this;\n\n section2.selectAll('.params').attr('disabled', null);\n fields_all.forEach(function (field) {\n field_to_use.append('option').text(field).attr('value', field);\n });\n field_to_use.on('change', function () {\n var field = this.value;\n ok_button.attr('disabled', self.rendering_params[field] ? null : true);\n });\n selec_symbol.on('click', function () {\n swal({\n title: '',\n text: _tr('app_page.common.error_too_many_features'),\n type: 'warning',\n showCancelButton: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.valid') + '!',\n cancelButtonText: _tr('app_page.common.cancel')\n }).then(function () {\n var field = document.getElementById('field_Symbol').value;\n var symbol_map = self.rendering_params[field] ? self.rendering_params[field].symbols_map : undefined;\n (0, _symbols_picto.display_box_symbol_typo)(layer, field, symbol_map).then(function (confirmed) {\n if (confirmed) {\n document.getElementById('yesTypoSymbols').disabled = null;\n self.rendering_params[field] = {\n nb_cat: confirmed[0],\n symbols_map: confirmed[1],\n field: field\n };\n }\n });\n }, function () {\n return null;\n });\n });\n ok_button.on('click', function () {\n var field = field_to_use.node().value;\n render_TypoSymbols(self.rendering_params[field], uo_layer_name.node().value);\n });\n (0, _helpers.setSelected)(field_to_use.node(), fields_all[0]);\n uo_layer_name.attr('value', ['Symbols', layer].join('_'));\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('field_Symbol'));\n section2.selectAll('.params').attr('disabled', true);\n },\n\n rendering_params: {}\n};\n\nfunction render_TypoSymbols(rendering_params, new_name) {\n var layer_name = Object.getOwnPropertyNames(data_manager.user_data)[0];\n var ref_layer_id = _app.layer_to_id.get(layer_name);\n var field = rendering_params.field;\n var layer_to_add = check_layer_name(new_name.length > 0 ? new_name : ['Symbols', field, layer_name].join('_'));\n var ref_selection = document.getElementById(ref_layer_id).getElementsByTagName('path');\n var nb_ft = ref_selection.length;\n\n function make_geojson_pt_layer() {\n var result = [];\n for (var i = 0, nb_features = ref_selection.length; i < nb_features; ++i) {\n var ft = ref_selection[i].__data__;\n var value = ft.properties[field];\n var new_obj = {\n id: i,\n type: 'Feature',\n properties: {},\n geometry: { type: 'Point' }\n };\n if (ft.geometry.type.indexOf('Multi') < 0) {\n new_obj.properties.symbol_field = value;\n new_obj.properties.id_parent = ft.id;\n new_obj.geometry.coordinates = d3.geoCentroid(ft.geometry);\n result.push(new_obj);\n } else {\n var areas = [];\n for (var j = 0; j < ft.geometry.coordinates.length; j++) {\n areas.push(path.area({\n type: ft.geometry.type,\n coordinates: [ft.geometry.coordinates[j]]\n }));\n }\n var ix_max = areas.indexOf((0, _helpers_calc.max_fast)(areas));\n new_obj.properties.symbol_field = value;\n new_obj.properties.id_parent = ft.id;\n new_obj.geometry.coordinates = d3.geoCentroid({\n type: ft.geometry.type, coordinates: [ft.geometry.coordinates[ix_max]] });\n result.push(new_obj);\n }\n }\n return {\n type: 'FeatureCollection',\n features: result\n };\n }\n\n var new_layer_data = make_geojson_pt_layer();\n var layer_id = encodeId(layer_to_add);\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems(self_parent) {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n (0, _symbols_picto.make_style_box_indiv_symbol)(self_parent);\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n self_parent.style.display = 'none';\n } }];\n };\n\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n\n map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer no_clip' }).selectAll('image').data(new_layer_data.features).enter().insert('image').attrs(function (d) {\n var symb = rendering_params.symbols_map.get(d.properties.symbol_field),\n coords = path.centroid(d.geometry);\n return {\n x: coords[0] - symb[1] / 2,\n y: coords[1] - symb[1] / 2,\n width: symb[1],\n height: symb[1],\n 'xlink:href': symb[0]\n };\n }).on('mouseover', function () {\n this.style.cursor = 'pointer';\n }).on('mouseout', function () {\n this.style.cursor = 'initial';\n }).on('contextmenu dblclick', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems(this));\n }).call(_helpers.drag_elem_geo);\n\n data_manager.current_layers[layer_to_add] = {\n n_features: data_manager.current_layers[layer_name].n_features,\n renderer: 'TypoSymbols',\n symbols_map: rendering_params.symbols_map,\n rendered_field: field,\n is_result: true,\n symbol: 'image',\n ref_layer_name: layer_name\n };\n (0, _helpers.create_li_layer_elem)(layer_to_add, nb_ft, ['Point', 'symbol'], 'result');\n (0, _legend.handle_legend)(layer_to_add);\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n}\n\nfunction fillMenu_griddedMap() {\n var dialog_content = make_template_functionnality(section2);\n\n var sectiontypemap = dialog_content.append('p').attr('class', 'params_section2 opt_point').style('display', 'none');\n\n sectiontypemap.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.map_type' }).html(_tr('app_page.func_options.grid.map_type'));\n\n var map_type = sectiontypemap.insert('select').attrs({ class: 'params i18n', id: 'Gridded_map_type' });\n\n var ee = dialog_content.append('p').attr('class', 'params_section2 opt_point').style('display', 'none');\n\n ee.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.mesh_type' }).html(_tr('app_page.func_options.grid.mesh_type'));\n\n var mesh_type = ee.insert('select').attrs({ class: 'params i18n', id: 'Gridded_mesh_type' });\n\n var e = dialog_content.append('p').attr('class', 'params_section2 opt_point').style('display', 'none');\n\n e.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.func' }).html(_tr('app_page.func_options.grid.func'));\n\n var grid_func_ratio = e.insert('select').attrs({ class: 'params i18n', id: 'Gridded_func_ratio' });\n\n var grid_func_stock = e.insert('select').attrs({ class: 'params i18n', id: 'Gridded_func_stock' });\n\n var aa = dialog_content.append('p').attr('class', 'params_section2 opt_point opt_field').styles({ 'margin-top': '2px', display: 'none' });\n\n aa.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.field' }).html(_tr('app_page.func_options.common.field'));\n\n aa.insert('select').attrs({ class: 'params field_to_use', id: 'Gridded_field_pt' });\n\n var gg = dialog_content.append('p').attr('class', 'params_section2 opt_point opt_user_layer').style('display', 'none');\n\n gg.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.user_polygon_layer' }).html(_tr('app_page.func_options.grid.user_polygon_layer'));\n\n gg.insert('select').attrs({ class: 'params mask_field', id: 'Gridded_polygon_layer' });\n\n var bb = dialog_content.append('p').attr('class', 'params_section2 opt_point opt_grid').styles({ display: 'none', margin: '35px 0 0 0' });\n\n bb.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.cellsize' }).html(_tr('app_page.func_options.grid.cellsize'));\n\n bb.insert('input').style('width', '100px').attrs({\n type: 'number',\n class: 'params',\n id: 'Gridded_cellsize_pt',\n min: 1.000,\n max: 7000,\n step: 'any'\n }).property('value', 10.0);\n\n var cc = dialog_content.append('p').attr('class', 'params_section2 opt_point opt_grid').style('display', 'none');\n cc.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.shape' }).html(_tr('app_page.func_options.grid.shape'));\n\n var grid_shape_pt = cc.insert('select').attrs({ class: 'params i18n', id: 'Gridded_shape_pt' });\n\n var f = dialog_content.append('p').attr('class', 'params_section2 opt_point opt_grid').styles({\n display: 'none',\n 'padding-top': '10px'\n });\n\n f.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.mask' }).html(_tr('app_page.func_options.common.mask'));\n\n f.insert('select').attrs({ class: 'params mask_field', id: 'Gridded_mask' });\n\n [['app_page.func_options.grid.type_stock', 'stock'], ['app_page.func_options.grid.type_ratio', 'ratio']].forEach(function (_t) {\n map_type.append('option').text(_tr(_t[0])).attrs({ value: _t[1], 'data-i18n': '[text]' + _t[0] });\n });\n\n [['app_page.func_options.grid.user_polygons', 'user_polygons'], ['app_page.func_options.grid.regular_grid', 'regular_grid']].forEach(function (_f) {\n mesh_type.append('option').text(_tr(_f[0])).attrs({ value: _f[1], 'data-i18n': '[text]' + _f[0] });\n });\n\n [['app_page.func_options.grid.density_count', 'density_count'], ['app_page.func_options.grid.density_weighted', 'density_weighted'], ['app_page.func_options.grid.mean', 'mean'], ['app_page.func_options.grid.stddev', 'stddev']].forEach(function (_f) {\n grid_func_ratio.append('option').text(_tr(_f[0])).attrs({ value: _f[1], 'data-i18n': '[text]' + _f[0] }).property('disabled', _f[2]);\n });\n\n [['app_page.func_options.grid.stock_count', 'count'], ['app_page.func_options.grid.stock_weighted', 'weighted']].forEach(function (_f) {\n grid_func_stock.append('option').text(_tr(_f[0])).attrs({ value: _f[1], 'data-i18n': '[text]' + _f[0] }).property('disabled', _f[2]);\n });\n\n var a = dialog_content.append('p').attr('class', 'params_section2 opt_polygon').style('margin-top', '9px');\n\n a.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.common.field' }).html(_tr('app_page.func_options.common.field'));\n\n a.insert('select').attrs({ class: 'params field_to_use', id: 'Gridded_field' });\n\n var b = dialog_content.append('p').attr('class', 'params_section2 opt_polygon').style('margin', '35px 0 0 0');\n b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.cellsize' }).html(_tr('app_page.func_options.grid.cellsize'));\n b.insert('input').style('width', '100px').attrs({\n type: 'number',\n class: 'params',\n id: 'Gridded_cellsize',\n min: 1.000,\n max: 7000,\n step: 'any'\n }).property('value', 10.0);\n\n var c = dialog_content.append('p').attr('class', 'params_section2 opt_polygon');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.shape' }).html(_tr('app_page.func_options.grid.shape'));\n\n var grid_shape = c.insert('select').attrs({ class: 'params i18n', id: 'Gridded_shape' });\n\n var d = dialog_content.append('p').attr('class', 'params_section2 opt_polygon opt_point opt_grid').style('padding-top', '2px');\n d.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.grid.coloramp' }).html(_tr('app_page.func_options.grid.coloramp'));\n var col_pal = d.insert('select').attrs({ class: 'params', id: 'Gridded_color_pal' });\n\n ['Blues', 'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu', 'YlGn', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'].forEach(function (color) {\n col_pal.append('option').text(color).attr('value', color);\n });\n\n [['app_page.func_options.grid.square', 'Square'], ['app_page.func_options.grid.diamond', 'Diamond'], ['app_page.func_options.grid.hexagon', 'Hexagon']].forEach(function (shape) {\n grid_shape.append('option').text(_tr(shape[0])).attrs({ value: shape[1], 'data-i18n': '[text]' + shape[0] });\n grid_shape_pt.append('option').text(_tr(shape[0])).attrs({ value: shape[1], 'data-i18n': '[text]' + shape[0] });\n });\n\n make_layer_name_input(dialog_content, 'Gridded_output_name');\n make_ok_button(dialog_content, 'Gridded_yes', false);\n section2.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_griddedMap = {\n fill: function fill(layer) {\n var user_polygon_layer = d3.select('#Gridded_polygon_layer');\n var mask_selec = d3.select('#Gridded_mask');\n var other_layers = (0, _helpers.get_other_layer_names)();\n unfillSelectInput(mask_selec.node());\n unfillSelectInput(user_polygon_layer.node());\n mask_selec.append('option').text('None').attr('value', 'None');\n for (var i = 0, n_layer = other_layers.length, lyr_name; i < n_layer; i++) {\n lyr_name = other_layers[i];\n if (data_manager.current_layers[lyr_name].type === 'Polygon') {\n mask_selec.append('option').text(lyr_name).attr('value', lyr_name);\n user_polygon_layer.append('option').text(lyr_name).attr('value', lyr_name);\n }\n }\n if (!layer) return;\n var type_layer = data_manager.current_layers[layer].type;\n section2.selectAll('.opt_polygon').style('display', type_layer === 'Polygon' ? null : 'none');\n section2.selectAll('.opt_point').style('display', type_layer === 'Point' ? null : 'none');\n if (type_layer === 'Point') {\n var current_map_type = document.getElementById('Gridded_map_type').value;\n var current_mesh_type = document.getElementById('Gridded_mesh_type').value;\n var current_func_type = current_map_type === 'ratio' ? document.getElementById('Gridded_func_ratio').value : document.getElementById('Gridded_func_stock').value;\n if (current_map_type === 'stock') {\n document.getElementById('Gridded_func_stock').style.display = null;\n document.getElementById('Gridded_func_ratio').style.display = 'none';\n section2.select('option[value=\"regular_grid\"]').property('disabled', true);\n } else {\n document.getElementById('Gridded_func_stock').style.display = 'none';\n document.getElementById('Gridded_func_ratio').style.display = null;\n section2.select('option[value=\"regular_grid\"]').property('disabled', false);\n }\n section2.selectAll('.opt_point.opt_grid').style('display', current_mesh_type === 'regular_grid' ? null : 'none');\n section2.selectAll('.opt_point.opt_user_layer').style('display', current_mesh_type !== 'regular_grid' ? null : 'none');\n section2.select('.opt_point.opt_field').style('display', current_func_type !== 'density_count' && current_func_type !== 'count' ? null : 'none');\n section2.select('#Gridded_mesh_type').on('change', function () {\n if (this.value === 'regular_grid') {\n section2.selectAll('.opt_point.opt_grid').style('display', null);\n section2.selectAll('.opt_point.opt_user_layer').style('display', 'none');\n } else if (this.value === 'user_polygons') {\n section2.selectAll('.opt_point.opt_grid').style('display', 'none');\n section2.selectAll('.opt_point.opt_user_layer').style('display', null);\n }\n });\n section2.select('#Gridded_func_ratio').on('change', function () {\n section2.select('.opt_point.opt_field').style('display', this.value === 'density_count' ? 'none' : null);\n output_name_field.attr('value', ['Gridded', layer].join('_'));\n });\n section2.select('#Gridded_func_stock').on('change', function () {\n section2.select('.opt_point.opt_field').style('display', this.value === 'count' ? 'none' : null);\n output_name_field.attr('value', ['PropSymbol', layer].join('_'));\n });\n section2.select('#Gridded_map_type').on('change', function () {\n section2.select('#Gridded_mesh_type').property('value', 'user_polygons').dispatch('change');\n if (this.value === 'stock') {\n document.getElementById('Gridded_func_stock').style.display = null;\n document.getElementById('Gridded_func_ratio').style.display = 'none';\n section2.select('option[value=\"regular_grid\"]').property('disabled', true);\n } else {\n document.getElementById('Gridded_func_stock').style.display = 'none';\n document.getElementById('Gridded_func_ratio').style.display = null;\n section2.select('option[value=\"regular_grid\"]').property('disabled', false);\n }\n });\n }\n\n var fields = (0, _helpers.getFieldsType)('stock', layer),\n field_selecs = section2.selectAll('.field_to_use'),\n output_name_field = section2.select('#Gridded_output_name'),\n ok_button = section2.select('#Gridded_yes');\n\n fields.forEach(function (field) {\n field_selecs.append('option').text(field).attr('value', field);\n });\n field_selecs.on('change', function () {\n if (type_layer !== 'Point') {\n output_name_field.attr('value', ['Gridded', this.value, layer].join('_'));\n }\n });\n ok_button.on('click', function () {\n var output_name = output_name_field.node().value;\n if (type_layer === 'Point') {\n var map_type = document.getElementById('Gridded_map_type').value;\n var id_func_type = map_type === 'stock' ? 'Gridded_func_stock' : 'Gridded_func_ratio';\n var params = {\n mesh_type: document.getElementById('Gridded_mesh_type').value,\n func_type: document.getElementById(id_func_type).value,\n field: document.getElementById('Gridded_field_pt').value,\n resolution: document.getElementById('Gridded_cellsize_pt').value,\n cell_shape: document.getElementById('Gridded_shape_pt').value,\n mask_layer: document.getElementById('Gridded_mask').value,\n polygon_layer: document.getElementById('Gridded_polygon_layer').value,\n color_palette: document.getElementById('Gridded_color_pal').value\n };\n if (params.mesh_type === 'user_polygons' && !params.polygon_layer) {\n (0, _helpers.display_error_during_computation)(_tr('app_page.common.error_background_needed'));\n return;\n }\n render_GriddedFromPts(params, output_name);\n } else {\n render_Gridded(document.getElementById('Gridded_field').value, document.getElementById('Gridded_cellsize').value, document.getElementById('Gridded_shape').value, document.getElementById('Gridded_color_pal').value, output_name);\n }\n });\n output_name_field.attr('value', ['Gridded', layer].join('_'));\n document.getElementById('Gridded_cellsize').value = get_first_guess_span('grid');\n document.getElementById('Gridded_cellsize_pt').value = get_first_guess_span('grid');\n section2.selectAll('.params').attr('disabled', null);\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('Gridded_field'));\n unfillSelectInput(document.getElementById('Gridded_field_pt'));\n section2.selectAll('.params').attr('disabled', true);\n }\n};\n\nfunction render_GriddedFromPts(params, new_user_layer_name) {\n var layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n formToSend = new FormData();\n var var_to_send = null;\n\n // If the mesh to be used is a regular grid, test that the resolution is\n // not too high/too low:\n if (params.mesh_type === 'regular_grid') {\n var res_test = test_maxmin_resolution(params.resolution);\n if (res_test) {\n var message = res_test === 'low' ? _tr('app_page.common.error_too_low_resolution') : _tr('app_page.common.error_too_high_resolution');\n (0, _helpers.display_error_during_computation)(message);\n return;\n }\n } else if (!(params.polygon_layer in data_manager.current_layers)) {\n (0, _helpers.display_error_during_computation)('Unable to find the layer');\n return;\n }\n\n // If the method require a numerical field:\n if (params.func_type !== 'density_count') {\n var field_name = params.field;\n var_to_send = {};\n if (data_manager.current_layers[layer].original_fields.has(field_name)) {\n var_to_send[field_name] = [];\n } else {\n var_to_send[field_name] = data_manager.user_data[layer].map(function (i) {\n return i[field_name];\n });\n }\n }\n\n formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[layer].key_name,\n mesh_type: params.mesh_type,\n var_name: var_to_send,\n cellsize: params.resolution * 1000,\n grid_shape: params.cell_shape,\n polygon_layer: params.mesh_type !== 'regular_grid' ? data_manager.current_layers[params.polygon_layer].key_name : null,\n mask_layer: params.mask_layer !== 'None' ? data_manager.current_layers[params.mask_layer].key_name : null,\n func_type: params.func_type\n }));\n\n (0, _helpers.xhrequest)('POST', 'compute/gridded_point', formToSend, true).then(function (data) {\n if (params.func_type === 'count' || params.func_type === 'weighted') {\n data = JSON.parse(data);\n var _data = data.file.objects[Object.keys(data.file.objects)].geometries;\n var field_to_render = params.func_type;\n var nb_features = 0;\n var maxval = -Infinity;\n d3.select('#' + _app.layer_to_id.get(params.polygon_layer)).selectAll('path').each(function (d, i) {\n var v = _data[i].properties[field_to_render];\n d.properties[field_to_render] = v;\n nb_features += 1;\n if (v > maxval) {\n maxval = v;\n }\n });\n\n var symbol_to_use = 'circle',\n new_layer_name = check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['PropSymbols', field_to_render, params.polygon_layer].join('_'));\n var rendering_params = {\n field: field_to_render,\n nb_features: nb_features,\n new_name: new_layer_name,\n ref_layer_name: params.polygon_layer,\n symbol: symbol_to_use,\n ref_size: 40,\n ref_value: maxval,\n fill_color: 'pink'\n };\n make_prop_symbols(rendering_params);\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n } else {\n var rendered_field = params.func_type;\n var _options = {\n choosed_name: check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['PropSymbols', rendered_field, params.polygon_layer].join('_')),\n func_name: 'grid',\n result_layer_on_add: true\n };\n var n_layer_name = (0, _layers.add_layer_topojson)(data, _options);\n if (!n_layer_name) return;\n var res_data = data_manager.result_data[n_layer_name],\n nb_ft = res_data.length,\n d_values = [];\n var opt_nb_class = Math.floor(1 + 3.3 * Math.log10(nb_ft));\n opt_nb_class = opt_nb_class > 4 ? opt_nb_class - 1 : opt_nb_class;\n for (var i = 0; i < nb_ft; i++) {\n d_values.push(res_data[i][rendered_field]);\n }\n var disc_method = 'jenks';\n data_manager.current_layers[n_layer_name].renderer = 'Gridded';\n\n var _discretize_to_colors21 = (0, _common.discretize_to_colors)(d_values, disc_method, opt_nb_class, params.color_palette),\n _discretize_to_colors22 = _slicedToArray(_discretize_to_colors21, 6),\n nb_class = _discretize_to_colors22[0],\n type = _discretize_to_colors22[1],\n breaks = _discretize_to_colors22[2],\n color_array = _discretize_to_colors22[3],\n colors_map = _discretize_to_colors22[4],\n no_data_color = _discretize_to_colors22[5];\n\n var _rendering_params = {\n nb_class: nb_class,\n type: type,\n schema: [params.color_palette],\n breaks: breaks,\n no_data: no_data_color,\n colors: color_array,\n colorsByFeature: colors_map,\n renderer: 'Gridded',\n rendered_field: rendered_field\n };\n render_choro(n_layer_name, _rendering_params);\n (0, _legend.handle_legend)(n_layer_name);\n (0, _interface.switch_accordion_section)();\n }\n }, function (error) {\n (0, _helpers.display_error_during_computation)();\n console.log(error);\n });\n}\n\nfunction render_Gridded(field_n, resolution, cell_shape, color_palette, new_user_layer_name) {\n var layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n formToSend = new FormData(),\n var_to_send = {},\n res_test = test_maxmin_resolution(resolution);\n\n if (res_test) {\n var message = res_test === 'low' ? _tr('app_page.common.error_too_low_resolution') : _tr('app_page.common.error_too_high_resolution');\n (0, _helpers.display_error_during_computation)(message);\n return;\n }\n\n if (data_manager.current_layers[layer].original_fields.has(field_n)) {\n var_to_send[field_n] = [];\n } else {\n var_to_send[field_n] = data_manager.user_data[layer].map(function (i) {\n return i[field_n];\n });\n }\n\n formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[layer].key_name,\n var_name: var_to_send,\n cellsize: resolution * 1000,\n grid_shape: cell_shape\n }));\n\n (0, _helpers.xhrequest)('POST', 'compute/gridded', formToSend, true).then(function (data) {\n var _options = {\n choosed_name: check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['Gridded', resolution, layer].join('_')),\n func_name: 'grid',\n result_layer_on_add: true\n };\n var rendered_field = field_n + '_densitykm';\n var n_layer_name = (0, _layers.add_layer_topojson)(data, _options);\n if (!n_layer_name) return;\n var res_data = data_manager.result_data[n_layer_name],\n nb_ft = res_data.length,\n opt_nb_class = Math.floor(1 + 3.3 * Math.log10(nb_ft)),\n d_values = [];\n for (var i = 0; i < nb_ft; i++) {\n d_values.push(+res_data[i][rendered_field]);\n }\n var disc_method = 'quantiles';\n data_manager.current_layers[n_layer_name].renderer = 'Gridded';\n var disc_result = (0, _common.discretize_to_colors)(d_values, disc_method, opt_nb_class, color_palette);\n var rendering_params = {\n nb_class: opt_nb_class,\n type: disc_method,\n schema: [color_palette],\n breaks: disc_result[2],\n colors: disc_result[3],\n colorsByFeature: disc_result[4],\n renderer: 'Gridded',\n rendered_field: rendered_field\n };\n render_choro(n_layer_name, rendering_params);\n (0, _legend.handle_legend)(n_layer_name);\n (0, _interface.switch_accordion_section)();\n }, function (error) {\n (0, _helpers.display_error_during_computation)();\n console.log(error);\n });\n}\n\nfunction fillMenu_FlowMap() {\n var dv2 = make_template_functionnality(section2);\n\n var subtitle = dv2.append('p').attr('class', 'params_section2');\n subtitle.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.subtitle1' }).html(_tr('app_page.func_options.flow.subtitle1'));\n\n var origin_section = dv2.append('p').attr('class', 'params_section2');\n origin_section.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.origin_field' }).html(_tr('app_page.func_options.flow.origin_field'));\n origin_section.insert('select').attrs({ id: 'FlowMap_field_i', class: 'params' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var destination_section = dv2.append('p').attr('class', 'params_section2');\n destination_section.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.destination_field' }).html(_tr('app_page.func_options.flow.destination_field'));\n destination_section.append('select').attrs({ class: 'params', id: 'FlowMap_field_j' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var intensity_section = dv2.append('p').attr('class', 'params_section2');\n intensity_section.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.intensity_field' }).html(_tr('app_page.func_options.flow.intensity_field'));\n intensity_section.append('select').attrs({ class: 'params', id: 'FlowMap_field_fij' }).styles({ position: 'relative', float: 'right', 'margin-bottom': '7.5px' });\n\n var discretization_section = dv2.append('p').attr('class', 'params_section2');\n discretization_section.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.discretization' }).html(_tr('app_page.func_options.flow.discretization'));\n var disc_type = discretization_section.insert('select').attrs({ class: 'params i18n', id: 'FlowMap_discKind' });\n\n [['app_page.common.no_classification', 'no_classification'], ['app_page.common.equal_interval', 'equal_interval'], ['app_page.common.quantiles', 'quantiles'], ['app_page.common.Q6', 'Q6'], ['app_page.common.jenks', 'jenks']].forEach(function (field) {\n disc_type.append('option').text(_tr(field[0])).attrs({ value: field[1], 'data-i18n': '[text]' + field[0] });\n });\n\n var with_discretisation = dv2.append('div').attr('id', 'FlowMap_discSection').styles({ clear: 'both', display: 'none', 'padding-top': '2px' });\n\n var without_discretisation = dv2.append('div').attr('id', 'FlowMap_noDiscSection').styles({ clear: 'both', 'padding-top': '2px' });\n\n var b = without_discretisation.append('p').attr('class', 'params_section2');\n b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.fixed_size' }).html(_tr('app_page.func_options.choroprop.fixed_size'));\n b.insert('input').attrs({\n id: 'FlowMap_ref_size',\n type: 'number',\n class: 'params',\n min: 0.1,\n max: 100.0,\n step: 'any'\n }).style('width', '50px');\n b.append('span').html(' (px)');\n\n var c = without_discretisation.append('p').attr('class', 'params_section2');\n c.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.choroprop.on_value' }).html(_tr('app_page.func_options.choroprop.on_value'));\n c.insert('input').styles({ width: '100px', 'margin-left': '10px' }).attrs({ type: 'number', class: 'params', id: 'FlowMap_ref_value' }).attrs({ min: 0.1, step: 0.1 });\n\n var nb_class_section = with_discretisation.append('p').attr('class', 'params_section2');\n nb_class_section.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.nb_class' }).html(_tr('app_page.func_options.flow.nb_class'));\n nb_class_section.insert('input').attrs({ type: 'number', class: 'params', id: 'FlowMap_nbClass', min: 1, max: 33 }).style('width', '50px').property('value', 8);\n\n with_discretisation.append('p').attrs({ class: 'params', id: 'FlowMap_discTable' });\n with_discretisation.append('p').attr('class', 'params_section2').insert('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.ref_layer_field' }).html(_tr('app_page.func_options.flow.ref_layer_field'));\n\n var join_field_section = dv2.append('p').attr('class', 'params_section2');\n join_field_section.append('p').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.func_options.flow.join_field' }).html(_tr('app_page.func_options.flow.join_field'));\n join_field_section.insert('select').attrs({ class: 'params', id: 'FlowMap_field_join' });\n\n make_layer_name_input(dv2, 'FlowMap_output_name');\n make_ok_button(dv2, 'FlowMap_yes', false);\n\n d3.selectAll('.params').attr('disabled', true);\n}\n\nvar fields_FlowMap = {\n fill: function fill(layer) {\n var field_i = section2.select('#FlowMap_field_i'),\n field_j = section2.select('#FlowMap_field_j'),\n field_fij = section2.select('#FlowMap_field_fij'),\n join_field = section2.select('#FlowMap_field_join'),\n nb_class_input = section2.select('#FlowMap_nbClass'),\n disc_type = section2.select('#FlowMap_discKind'),\n ref_value = section2.select('#FlowMap_ref_value'),\n ref_size = section2.select('#FlowMap_ref_size').property('value', 20),\n ok_button = section2.select('#FlowMap_yes'),\n uo_layer_name = section2.select('#FlowMap_output_name');\n\n if (data_manager.joined_dataset.length > 0 && document.getElementById('FlowMap_field_i').options.length === 0) {\n var fields = Object.getOwnPropertyNames(data_manager.joined_dataset[0][0]);\n fields.forEach(function (field) {\n field_i.append('option').text(field).attr('value', field);\n field_j.append('option').text(field).attr('value', field);\n field_fij.append('option').text(field).attr('value', field);\n });\n }\n if (layer) {\n var ref_fields = Object.getOwnPropertyNames(data_manager.user_data[layer][0]);\n ref_fields.forEach(function (field) {\n join_field.append('option').text(field).attr('value', field);\n });\n uo_layer_name.attr('value', ref_fields.length >= 1 ? ['Links', ref_fields[0]].join('_') : 'LinksLayer');\n } else {\n uo_layer_name.attr('value', 'LinksLayer');\n }\n join_field.on('change', function () {\n uo_layer_name.attr('value', ['Links', this.value].join('_'));\n });\n // if (layer || data_manager.joined_dataset.length > 0) {\n // section2.selectAll('.params').attr('disabled', null);\n // uo_layer_name.attr('value', ['Links', layer].join('_'));\n // }\n var values_fij = void 0;\n\n field_fij.on('change', function () {\n var name = this.value;\n var disc = disc_type.node().value;\n values_fij = data_manager.joined_dataset[0].map(function (obj) {\n return +obj[name];\n });\n if (disc === 'no_classification') {\n ref_value.property('value', (0, _helpers_calc.max_fast)(values_fij));\n } else {\n var nclass = +nb_class_input.node().value,\n min_size = 0.5,\n max_size = 10;\n make_min_max_tableau(values_fij, nclass, disc, min_size, max_size, 'FlowMap_discTable');\n }\n });\n\n disc_type.on('change', function () {\n var disc = this.value;\n var name = field_fij.node().value;\n values_fij = data_manager.joined_dataset[0].map(function (obj) {\n return +obj[name];\n });\n if (disc === 'no_classification') {\n section2.select('#FlowMap_noDiscSection').style('display', null);\n section2.select('#FlowMap_discSection').style('display', 'none');\n ref_value.property('value', (0, _helpers_calc.max_fast)(values_fij));\n } else {\n section2.select('#FlowMap_noDiscSection').style('display', 'none');\n section2.select('#FlowMap_discSection').style('display', null);\n var min_size = 0.5,\n max_size = 10;\n var nclass = +nb_class_input.node().value;\n if (disc === 'Q6') {\n nclass = 6;\n nb_class_input.property('value', 6);\n }\n make_min_max_tableau(values_fij, nclass, disc, min_size, max_size, 'FlowMap_discTable');\n }\n });\n\n nb_class_input.on('change', function () {\n var nclass = this.value,\n disc = disc_type.node().value,\n min_size = 0.5,\n max_size = 10;\n make_min_max_tableau(values_fij, nclass, disc, min_size, max_size, 'FlowMap_discTable');\n });\n\n ok_button.on('click', function () {\n var discretisation = disc_type.node().value;\n if (discretisation === 'no_classification') {\n render_ProportionalFlowMap(field_i.node().value, field_j.node().value, field_fij.node().value, join_field.node().value, +ref_size.node().value, +ref_value.node().value, uo_layer_name.node().value);\n } else {\n render_GraduatedFlowMap(field_i.node().value, field_j.node().value, field_fij.node().value, join_field.node().value, discretisation, uo_layer_name.node().value);\n }\n });\n\n if (layer && data_manager.joined_dataset.length > 0) {\n section2.selectAll('.params').attr('disabled', null);\n var _fields = Object.getOwnPropertyNames(data_manager.joined_dataset[0][0]);\n if (_fields.length >= 3) {\n field_j.node().value = _fields[1];\n field_fij.node().value = _fields[2];\n field_j.node().dispatchEvent(new Event('change'));\n field_fij.node().dispatchEvent(new Event('change'));\n }\n }\n },\n unfill: function unfill() {\n unfillSelectInput(document.getElementById('FlowMap_field_i'));\n unfillSelectInput(document.getElementById('FlowMap_field_j'));\n unfillSelectInput(document.getElementById('FlowMap_field_fij'));\n unfillSelectInput(document.getElementById('FlowMap_field_join'));\n document.getElementById('FlowMap_discTable').innerHTML = '';\n document.getElementById('FlowMap_output_name').value = '';\n section2.selectAll('.params').attr('disabled', true);\n }\n};\n\nfunction render_ProportionalFlowMap(field_i, field_j, field_fij, name_join_field, ref_size, ref_value, new_user_layer_name) {\n var ref_layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n formToSend = new FormData(),\n join_field_to_send = {};\n\n join_field_to_send[name_join_field] = data_manager.user_data[ref_layer].map(function (obj) {\n return obj[name_join_field];\n });\n\n formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[ref_layer].key_name,\n csv_table: JSON.stringify(data_manager.joined_dataset[0]),\n field_i: field_i,\n field_j: field_j,\n field_fij: field_fij,\n join_field: join_field_to_send\n }));\n\n (0, _helpers.xhrequest)('POST', 'compute/links', formToSend, true).then(function (data) {\n var options = {\n choosed_name: check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['Links', name_join_field].join('_')),\n func_name: 'flow',\n result_layer_on_add: true\n };\n var temp = JSON.parse(data);\n temp.file.objects.LinksLayer.geometries = temp.file.objects.LinksLayer.geometries.sort(function (a, b) {\n return +b.properties[field_fij] - +a.properties[field_fij];\n });\n var new_layer_name = (0, _layers.add_layer_topojson)(JSON.stringify(temp), options);\n if (!new_layer_name) return;\n var layer_to_render = map.select('#' + _app.layer_to_id.get(new_layer_name)).selectAll('path'),\n fij_field_name = field_fij,\n fij_values = data_manager.result_data[new_layer_name].map(function (obj) {\n return +obj[fij_field_name];\n }),\n nb_ft = fij_values.length,\n t_field_name = 'prop_value';\n\n var propSize = new _helpers_calc.PropSizer(ref_value, ref_size, 'line');\n layer_to_render.each(function (d) {\n d.properties.color = '#FF0000'; // eslint-disable-line no-param-reassign\n d.properties[t_field_name] = propSize.scale(d.properties[field_fij]); // eslint-disable-line no-param-reassign\n });\n\n layer_to_render.styles(function (d) {\n return { fill: 'transparent', stroke: d.properties.color, 'stroke-width': d.properties[t_field_name] };\n });\n\n Object.assign(data_manager.current_layers[new_layer_name], {\n n_features: nb_ft,\n renderer: 'LinksProportional',\n symbol: 'path',\n rendered_field: field_fij,\n size: [ref_value, ref_size],\n 'stroke-width-const': undefined,\n is_result: true,\n ref_layer_name: ref_layer,\n fill_color: { single: '#FF0000' },\n type: 'Line'\n });\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n });\n}\n\nfunction render_GraduatedFlowMap(field_i, field_j, field_fij, name_join_field, disc_type, new_user_layer_name) {\n var ref_layer = Object.getOwnPropertyNames(data_manager.user_data)[0],\n formToSend = new FormData(),\n join_field_to_send = {};\n\n var disc_params = fetch_min_max_table_value('FlowMap_discTable'),\n mins = disc_params.mins,\n maxs = disc_params.maxs,\n sizes = disc_params.sizes,\n nb_class = mins.length,\n user_breaks = [].concat(mins, maxs[nb_class - 1]),\n min_size = (0, _helpers_calc.min_fast)(sizes),\n max_size = (0, _helpers_calc.max_fast)(sizes);\n\n join_field_to_send[name_join_field] = data_manager.user_data[ref_layer].map(function (obj) {\n return obj[name_join_field];\n });\n\n formToSend.append('json', JSON.stringify({\n topojson: data_manager.current_layers[ref_layer].key_name,\n csv_table: JSON.stringify(data_manager.joined_dataset[0]),\n field_i: field_i,\n field_j: field_j,\n field_fij: field_fij,\n join_field: join_field_to_send\n }));\n\n (0, _helpers.xhrequest)('POST', 'compute/links', formToSend, true).then(function (data) {\n var options = {\n choosed_name: check_layer_name(new_user_layer_name.length > 0 ? new_user_layer_name : ['Links', name_join_field].join('_')),\n func_name: 'flow',\n result_layer_on_add: true\n };\n var new_layer_name = (0, _layers.add_layer_topojson)(data, options);\n if (!new_layer_name) return;\n var layer_to_render = map.select('#' + _app.layer_to_id.get(new_layer_name)).selectAll('path'),\n fij_field_name = field_fij,\n fij_values = data_manager.result_data[new_layer_name].map(function (obj) {\n return +obj[fij_field_name];\n }),\n nb_ft = fij_values.length,\n serie = new geostats(fij_values); // eslint-disable-line new-cap\n\n if (user_breaks[0] < serie.min()) user_breaks[0] = serie.min();\n if (user_breaks[nb_class] > serie.max()) user_breaks[nb_class] = serie.max();\n\n serie.setClassManually(user_breaks);\n\n data_manager.current_layers[new_layer_name].fixed_stroke = true;\n data_manager.current_layers[new_layer_name].renderer = 'LinksGraduated';\n data_manager.current_layers[new_layer_name].breaks = [];\n data_manager.current_layers[new_layer_name].linksbyId = [];\n data_manager.current_layers[new_layer_name].size = [min_size, max_size];\n data_manager.current_layers[new_layer_name].rendered_field = fij_field_name;\n data_manager.current_layers[new_layer_name].ref_layer_name = ref_layer;\n data_manager.current_layers[new_layer_name].min_display = 0;\n\n var links_byId = data_manager.current_layers[new_layer_name].linksbyId;\n\n for (var i = 0; i < nb_ft; ++i) {\n var val = +fij_values[i];\n links_byId.push([i, val, sizes[serie.getClass(val)]]);\n }\n for (var _i8 = 0; _i8 < nb_class; ++_i8) {\n data_manager.current_layers[new_layer_name].breaks.push([[user_breaks[_i8], user_breaks[_i8 + 1]], sizes[_i8]]);\n }\n layer_to_render.style('fill-opacity', 0).style('stroke-opacity', 0.8).style('stroke-width', function (d, i) {\n return links_byId[i][2];\n });\n (0, _interface.switch_accordion_section)();\n (0, _legend.handle_legend)(new_layer_name);\n }, function (error) {\n (0, _helpers.display_error_during_computation)();\n console.log(error);\n });\n}\n\nvar render_label = exports.render_label = function render_label(layer, rendering_params, options) {\n var label_field = rendering_params.label_field;\n var txt_color = rendering_params.color;\n var selected_font = rendering_params.font;\n var font_size = rendering_params.ref_font_size + 'px';\n var new_layer_data = [];\n var warn_empty_features = [];\n var layer_to_add = rendering_params.uo_layer_name && rendering_params.uo_layer_name.length > 0 ? check_layer_name(rendering_params.uo_layer_name) : check_layer_name('Labels_' + layer);\n var filter_test = function filter_test() {\n return true;\n };\n if (rendering_params.filter_options !== undefined) {\n if (rendering_params.filter_options.type_filter === 'sup') {\n filter_test = function filter_test(prop) {\n return prop[rendering_params.filter_options.field] > rendering_params.filter_options.filter_value;\n };\n } else if (rendering_params.filter_options.type_filter === 'inf') {\n filter_test = function filter_test(prop) {\n return prop[rendering_params.filter_options.field] < rendering_params.filter_options.filter_value;\n };\n }\n }\n var layer_id = encodeId(layer_to_add);\n var pt_position = void 0;\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n var nb_ft = void 0;\n if (options && options.current_position) {\n pt_position = options.current_position;\n }\n if (options && options.data) {\n new_layer_data = options.data;\n nb_ft = new_layer_data.length;\n } else if (layer) {\n var type_ft_ref = data_manager.current_layers[layer].symbol || 'path';\n var ref_selection = document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName(type_ft_ref);\n var i_id = 0;\n nb_ft = ref_selection.length;\n for (var i = 0; i < nb_ft; i++) {\n var ft = ref_selection[i].__data__;\n if (!filter_test(ft.properties)) continue;\n var coords = void 0;\n if (!ft.geometry) {\n warn_empty_features.push([i, ft]);\n continue;\n } else if (ft.geometry.type.indexOf('Multi') === -1) {\n coords = d3.geoCentroid(ft.geometry);\n } else {\n var areas = [];\n for (var j = 0; j < ft.geometry.coordinates.length; j++) {\n areas.push(path.area({\n type: ft.geometry.type,\n coordinates: [ft.geometry.coordinates[j]]\n }));\n }\n var ix_max = areas.indexOf((0, _helpers_calc.max_fast)(areas));\n coords = d3.geoCentroid({\n type: ft.geometry.type, coordinates: [ft.geometry.coordinates[ix_max]] });\n }\n i_id += 1;\n new_layer_data.push({\n id: i_id,\n type: 'Feature',\n properties: { label: ft.properties[label_field], x: coords[0], y: coords[1] },\n geometry: { type: 'Point', coordinates: coords }\n });\n }\n }\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems(self_parent) {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n (0, _layers_style_popup.make_style_box_indiv_label)(self_parent);\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n self_parent.style.display = 'none';\n } }];\n };\n var selection = map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer no_clip' }).selectAll('text').data(new_layer_data).enter().insert('text');\n if (pt_position) {\n selection.attrs(function (d, i) {\n return {\n id: 'Feature_' + i,\n x: pt_position[i][0],\n y: pt_position[i][1],\n 'alignment-baseline': 'middle',\n 'text-anchor': 'middle'\n };\n }).styles(function (d, i) {\n return {\n display: pt_position[i][2],\n 'font-size': pt_position[i][3],\n 'font-family': pt_position[i][4],\n fill: pt_position[i][5]\n };\n }).text(function (_, i) {\n return pt_position[i][6];\n });\n } else {\n selection.attrs(function (d, i) {\n var pt = path.centroid(d.geometry);\n return {\n id: 'Feature_' + i,\n x: pt[0],\n y: pt[1],\n 'alignment-baseline': 'middle',\n 'text-anchor': 'middle'\n };\n }).styles({ 'font-size': font_size, 'font-family': selected_font, fill: txt_color }).text(function (d) {\n return d.properties.label;\n });\n }\n\n selection.on('mouseover', function () {\n this.style.cursor = 'pointer';\n }).on('mouseout', function () {\n this.style.cursor = 'initial';\n }).on('dblclick contextmenu', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems(this));\n }).call(_helpers.drag_elem_geo);\n\n data_manager.current_layers[layer_to_add] = {\n n_features: new_layer_data.length,\n renderer: 'Label',\n symbol: 'text',\n fill_color: txt_color,\n rendered_field: label_field,\n is_result: true,\n ref_layer_name: layer,\n default_size: font_size,\n default_font: selected_font\n };\n (0, _helpers.create_li_layer_elem)(layer_to_add, nb_ft, ['Point', 'label'], 'result');\n if (warn_empty_features.length > 0) {\n setTimeout(function () {\n display_warning_empty_geom(warn_empty_features);\n }, 50);\n }\n (0, _map_ctrl.zoom_without_redraw)();\n return layer_to_add;\n};\n\nvar render_label_graticule = exports.render_label_graticule = function render_label_graticule(layer, rendering_params, options) {\n var txt_color = rendering_params.color;\n var selected_font = rendering_params.font;\n var font_size = rendering_params.ref_font_size + 'px';\n var position_lat = rendering_params.position_lat || 'bottom';\n var position_lon = rendering_params.position_lon || 'left';\n var new_layer_data = [];\n var layer_to_add = check_layer_name('Labels_Graticule');\n var layer_id = encodeId(layer_to_add);\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n var nb_ft = void 0;\n if (options && options.data) {\n new_layer_data = options.data;\n nb_ft = new_layer_data.length;\n } else if (layer) {\n var grat = d3.geoGraticule().step([data_manager.current_layers.Graticule.step, data_manager.current_layers.Graticule.step]);\n grat = data_manager.current_layers.Graticule.extent ? grat.extent(data_manager.current_layers.Graticule.extent).lines() : grat.lines();\n nb_ft = grat.length;\n for (var i = 0; i < nb_ft; i++) {\n var line = grat[i];\n var txt = void 0;\n var geometry = void 0;\n if (line.coordinates[0][0] === line.coordinates[1][0]) {\n txt = line.coordinates[0][0];\n geometry = position_lat === 'bottom' ? { type: 'Point', coordinates: line.coordinates[0] } : { type: 'Point', coordinates: line.coordinates[line.length - 1] };\n } else if (line.coordinates[0][1] === line.coordinates[1][1]) {\n txt = line.coordinates[0][1];\n geometry = position_lon === 'left' ? { type: 'Point', coordinates: line.coordinates[0] } : { type: 'Point', coordinates: line.coordinates[line.length - 1] };\n }\n if (txt !== undefined) {\n new_layer_data.push({\n id: i,\n type: 'Feature',\n properties: { label: txt },\n geometry: geometry\n });\n }\n }\n }\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems(self_parent) {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n (0, _layers_style_popup.make_style_box_indiv_label)(self_parent);\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n self_parent.style.display = 'none';\n } }];\n };\n\n map.insert('g', '.legend').attrs({ id: layer_id, class: 'layer no_clip' }).selectAll('text').data(new_layer_data).enter().insert('text').attrs(function (d, i) {\n var pt = path.centroid(d.geometry);\n return {\n id: 'Feature_' + i,\n x: pt[0],\n y: pt[1],\n 'alignment-baseline': 'middle',\n 'text-anchor': 'middle'\n };\n }).styles({ 'font-size': font_size, 'font-family': selected_font, fill: txt_color }).text(function (d) {\n return d.properties.label;\n }).on('mouseover', function () {\n this.style.cursor = 'pointer';\n }).on('mouseout', function () {\n this.style.cursor = 'initial';\n }).on('dblclick contextmenu', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems(this));\n }).call(_helpers.drag_elem_geo);\n data_manager.current_layers[layer_to_add] = {\n n_features: new_layer_data.length,\n renderer: 'Label',\n symbol: 'text',\n fill_color: txt_color,\n is_result: true,\n ref_layer_name: layer,\n default_size: font_size,\n default_font: selected_font\n };\n (0, _helpers.create_li_layer_elem)(layer_to_add, nb_ft, ['Point', 'label'], 'result');\n (0, _map_ctrl.zoom_without_redraw)();\n return layer_to_add;\n};\n\n//# sourceURL=webpack:///./js/function.js?");
-
-/***/ }),
-
-/***/ "./js/helpers.js":
-/*!***********************!*\
- !*** ./js/helpers.js ***!
- \***********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global, Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isValidJSON = exports.cloneObj = exports.clickLinkFromDataUrl = exports.getFieldsType = exports.type_col2 = exports.type_col = exports.drag_waffle = exports.drag_elem_geo2 = exports.drag_elem_geo = exports.createWaitingOverlay = exports.isNumber = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.setSelected = setSelected;\nexports.path_to_geojson2 = path_to_geojson2;\nexports.display_error_during_computation = display_error_during_computation;\nexports.request_data = request_data;\nexports.xhrequest = xhrequest;\nexports.getImgDataUrl = getImgDataUrl;\nexports.make_content_summary = make_content_summary;\nexports.copy_layer = copy_layer;\nexports.send_layer_server = send_layer_server;\nexports.get_other_layer_names = get_other_layer_names;\nexports.get_display_name_on_layer_list = get_display_name_on_layer_list;\nexports.create_li_layer_elem = create_li_layer_elem;\nexports.make_box_type_fields = make_box_type_fields;\nexports.getAvailablesFunctionnalities = getAvailablesFunctionnalities;\nexports.prepareFileExt = prepareFileExt;\nexports.accordionize2 = accordionize2;\nexports.getTargetLayerProps = getTargetLayerProps;\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _buttons = __webpack_require__(/*! ./ui/buttons */ \"./js/ui/buttons.js\");\n\nvar isNumber = exports.isNumber = function isNumber(value) {\n return value != null && value !== '' && isFinite(value) && !Number.isNaN(+value);\n};\n\nvar createWaitingOverlay = exports.createWaitingOverlay = function createWaitingOverlay() {\n var bg = document.createElement('div');\n bg.id = 'overlay';\n bg.style.display = 'none';\n bg.innerHTML = '\\n \\n \\n... \\n\\n \\n\\n ';\n\n document.body.appendChild(bg);\n var btn = bg.querySelector('button.button_st3');\n btn.onclick = function () {\n if (global._app.xhr_to_cancel) {\n global._app.xhr_to_cancel.abort();\n global._app.xhr_to_cancel = undefined;\n }\n if (global._app.webworker_to_cancel) {\n global._app.webworker_to_cancel.onmessage = null;\n global._app.webworker_to_cancel.terminate();\n global._app.webworker_to_cancel = undefined;\n }\n bg.style.display = 'none';\n };\n return {\n display: function display() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n bg.style.display = '';\n if (opts.cancel_button && opts.cancel_button === false) {\n btn.style.display = 'none';\n }\n if (opts.zIndex) {\n bg.style.zIndex = opts.zIndex;\n }\n },\n hide: function hide() {\n bg.style.display = 'none';\n bg.style.zIndex = '';\n btn.style.display = '';\n }\n };\n};\n\nvar drag_elem_geo = exports.drag_elem_geo = d3.drag().subject(function () {\n var t = d3.select(this);\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n}).on('drag', function () {\n d3.select(this).attr('x', d3.event.x).attr('y', d3.event.y);\n});\n\nvar drag_elem_geo2 = exports.drag_elem_geo2 = d3.drag().filter(function () {\n return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable;\n}).subject(function () {\n // const layer_name = global._app.id_to_layer.get(this.parentElement.id);\n var symbol = data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].symbol;\n var t = d3.select(this);\n if (symbol === 'rect') {\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n symbol: symbol,\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n } else if (symbol === 'circle') {\n return {\n x: t.attr('cx'),\n y: t.attr('cy'),\n symbol: symbol,\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n }\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n var zoom = svg_map.__zoom;\n var centroid = path.centroid(this.__data__.geometry);\n centroid[0] = centroid[0] * zoom.k + zoom.x;\n centroid[1] = centroid[1] * zoom.k + zoom.y;\n map.append('rect').attrs({\n x: centroid[0] - 2,\n y: centroid[1] - 2,\n height: 4,\n width: 4,\n id: 'ref_symbol_location'\n }).style('fill', 'red');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n map.selectAll('#ref_symbol_location').remove();\n}).on('drag', function () {\n if (d3.event.subject.symbol === 'rect') {\n d3.select(this).attr('x', d3.event.x).attr('y', d3.event.y);\n } else if (d3.event.subject.symbol === 'circle') {\n d3.select(this).attr('cx', d3.event.x).attr('cy', d3.event.y);\n }\n});\n\nvar drag_waffle = exports.drag_waffle = d3.drag().filter(function () {\n return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable;\n}).subject(function () {\n var t = d3.select(this);\n var prev_translate = t.attr('transform');\n prev_translate = prev_translate ? prev_translate.slice(10, -1).split(/[ ,]+/).map(function (f) {\n return +f;\n }) : [0, 0];\n return {\n x: t.attr('x') + prev_translate[0],\n y: t.attr('y') + prev_translate[1],\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n}).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n}).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n d3.select(this).style('cursor', 'grab');\n}).on('drag', function () {\n d3.select(this).attr('transform', 'translate(' + [d3.event.x, d3.event.y] + ')').style('cursor', 'grabbing');\n});\n\nfunction setSelected(selectNode, value) {\n selectNode.value = value; // eslint-disable-line no-param-reassign\n selectNode.dispatchEvent(new Event('change'));\n}\n\nfunction path_to_geojson(layerName) {\n var id_layer = ['#', global._app.layer_to_id.get(layerName)].join('');\n var result_geojson = [];\n d3.select(id_layer).selectAll('path').each(function (d, i) {\n result_geojson.push({\n type: 'Feature',\n id: i,\n properties: d.properties,\n geometry: { type: d.type, coordinates: d.coordinates }\n });\n });\n return JSON.stringify({\n type: 'FeatureCollection',\n crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },\n features: result_geojson\n });\n}\n\nfunction path_to_geojson2(layerName) {\n var id_layer = ['#', global._app.layer_to_id.get(layerName)].join('');\n var result_geojson = [];\n d3.select(id_layer).selectAll('path').each(function (d, i) {\n result_geojson.push({\n type: 'Feature',\n id: i,\n properties: d.properties,\n geometry: d.geometry\n });\n });\n return JSON.stringify({\n type: 'FeatureCollection',\n crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },\n features: result_geojson\n });\n}\n\nfunction display_error_during_computation(msg) {\n // FIXME :\n var message = message ? '' + _tr('app_page.common.details') + ': ' + msg : '';\n swal({\n title: _tr('app_page.common.error') + '!',\n text: '' + _tr('app_page.common.error_message') + msg,\n customClass: 'swal2_custom',\n type: 'error',\n allowOutsideClick: false\n });\n}\n\n/**\n* Perform an asynchronous request\n*\n* @param {String} method - the method like \"GET\" or \"POST\"\n* @param {String} url - the targeted url\n* @param {FormData} data - Optionnal, the data to be send\n* @return {Promise} response\n*/\nfunction request_data(method, url, data) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(method, url, true);\n request.onload = resolve;\n request.onerror = reject;\n request.send(data);\n });\n}\n\n/**\n* Perform an asynchronous request\n*\n* @param {String} method - the method like \"GET\" or \"POST\"\n* @param {String} url - the targeted url\n* @param {FormData} data - Optionnal, the data to be send\n* @param {Boolean} waitingMessage - Optionnal, whether to display or not\n* a waiting message while the request is proceeded\n* @return {Promise} response\n*/\nfunction xhrequest(method, url, data, waitingMessage) {\n if (waitingMessage) {\n global._app.waitingOverlay.display();\n }\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n global._app.xhr_to_cancel = request;\n request.open(method, url, true);\n request.onload = function (resp) {\n resolve(resp.target.responseText);\n global._app.xhr_to_cancel = undefined;\n if (waitingMessage) {\n global._app.waitingOverlay.hide();\n }\n };\n request.onerror = function (err) {\n reject(err);\n global._app.xhr_to_cancel = undefined;\n if (waitingMessage) {\n global._app.waitingOverlay.hide();\n }\n };\n request.send(data);\n });\n}\n\nfunction getImgDataUrl(url) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.onload = function () {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(request.response);\n };\n request.onerror = function (err) {\n reject(err);\n };\n request.open('GET', url, true);\n request.responseType = 'blob';\n request.send();\n });\n}\n\nfunction make_content_summary(serie) {\n var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;\n\n return [_tr('app_page.stat_summary.population'), ' : ', (0, _helpers_calc.round_value)(serie.pop(), precision), ' ', _tr('app_page.stat_summary.min'), ' : ', (0, _helpers_calc.round_value)(serie.min(), precision), ' | ', _tr('app_page.stat_summary.max'), ' : ', (0, _helpers_calc.round_value)(serie.max(), precision), ' ', _tr('app_page.stat_summary.mean'), ' : ', (0, _helpers_calc.round_value)(serie.mean(), precision), ' ', _tr('app_page.stat_summary.median'), ' : ', (0, _helpers_calc.round_value)(serie.median(), precision), ' ', _tr('app_page.stat_summary.variance'), ' : ', (0, _helpers_calc.round_value)(serie.variance(), precision), ' ', _tr('app_page.stat_summary.stddev'), ' : ', (0, _helpers_calc.round_value)(serie.stddev(), precision), ' ', _tr('app_page.stat_summary.cov'), ' : ', (0, _helpers_calc.round_value)(serie.cov(), precision)].join('');\n}\n\nfunction copy_layer(ref_layer, new_name, type_result, fields_to_copy) {\n var id_new_layer = encodeId(new_name);\n var id_ref_layer = global._app.layer_to_id.get(ref_layer);\n var node_ref_layer = svg_map.querySelector('#' + id_ref_layer);\n var current_layers = global.data_manager.current_layers;\n\n global._app.layer_to_id.set(new_name, id_new_layer);\n global._app.id_to_layer.set(id_new_layer, new_name);\n svg_map.appendChild(node_ref_layer.cloneNode(true));\n svg_map.lastChild.setAttribute('id', id_new_layer);\n var node_new_layer = document.getElementById(id_new_layer);\n svg_map.insertBefore(node_new_layer, svg_map.querySelector('.legend'));\n data_manager.result_data[new_name] = [];\n current_layers[new_name] = {\n n_features: current_layers[ref_layer].n_features,\n type: current_layers[ref_layer].type,\n ref_layer_name: ref_layer\n };\n if (current_layers[ref_layer].pointRadius) {\n current_layers[new_name].pointRadius = current_layers[ref_layer].pointRadius;\n }\n var selec_src = node_ref_layer.getElementsByTagName('path'),\n selec_dest = node_new_layer.getElementsByTagName('path');\n if (!fields_to_copy) {\n for (var i = 0; i < selec_src.length; i++) {\n selec_dest[i].__data__ = selec_src[i].__data__;\n data_manager.result_data[new_name].push(selec_dest[i].__data__.properties);\n }\n } else {\n for (var _i = 0; _i < selec_src.length; _i++) {\n selec_dest[_i].__data__ = {\n type: 'Feature',\n properties: {},\n geometry: cloneObj(selec_src[_i].__data__.geometry)\n };\n var nb_field_to_copy = fields_to_copy.length;\n for (var j = 0; j < nb_field_to_copy; j++) {\n var f = fields_to_copy[j];\n selec_dest[_i].__data__.properties[f] = selec_src[_i].__data__.properties[f];\n }\n data_manager.result_data[new_name].push(selec_dest[_i].__data__.properties);\n }\n }\n // Set the desired class name :\n node_new_layer.className.baseVal = 'layer';\n // Reset visibility and filter attributes to default values:\n node_new_layer.style.visibility = '';\n node_new_layer.removeAttribute('filter');\n // Create an entry in the layer manager:\n create_li_layer_elem(new_name, current_layers[new_name].n_features, [current_layers[new_name].type, type_result], 'result');\n}\n\n/**\n* Send a geo result layer computed client-side (currently only discontinuities)\n* to the server in order to use it as other result layers computed server side\n* @param {string} layerName - The name of the layer to send\n* @param {string} url - The url to use\n* @return {undefined}\n*/\nfunction send_layer_server(layerName, url) {\n var JSON_layer = path_to_geojson(layerName);\n var formToSend = new FormData();\n formToSend.append('geojson', JSON_layer);\n formToSend.append('layer_name', layerName);\n xhrequest('POST', url, formToSend, false).then(function (e) {\n data_manager.current_layers[layerName].key_name = JSON.parse(e).key;\n }).catch(function (err) {\n display_error_during_computation();\n console.log(err);\n });\n}\n\n/**\n* Function returning the name of all current layers (excepted the sample layers used as layout)\n*\n* @return {Array} - The name of the other layers in an Array\n*/\nfunction get_other_layer_names() {\n var otherLayers = Object.getOwnPropertyNames(data_manager.current_layers);\n var tmpIdx = null;\n\n tmpIdx = otherLayers.indexOf('Graticule');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n tmpIdx = otherLayers.indexOf('World');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n tmpIdx = otherLayers.indexOf('Sphere');\n if (tmpIdx > -1) otherLayers.splice(tmpIdx, 1);\n\n return otherLayers;\n}\n\nfunction get_display_name_on_layer_list(layer_name_to_add) {\n return +layer_name_to_add.length > 40 ? [layer_name_to_add.substring(0, 37), '(...)'].join('') : layer_name_to_add;\n}\n\n/**\n* Function triggered in order to add a new layer\n* in the \"layer manager\" (with appropriates icons regarding to its type, etc.)\n* @param {string} layerName - The name of the new layer\n* @param {integer} nbFt - The number of feature in this layer\n* @param {string} typeGeom - The geometry type\n* @param {string} typeLayer - Whether it is a result layer or not\n* @return {undefined}\n*/\nfunction create_li_layer_elem(layerName, nbFt, typeGeom, typeLayer) {\n var listDisplayName = get_display_name_on_layer_list(layerName);\n var layerId = encodeId(layerName);\n var layersListed = document.querySelector('#sortable.layer_list');\n var li = document.createElement('li');\n li.setAttribute('layer_name', layerName);\n if (typeLayer === 'result') {\n li.setAttribute('class', ['sortable_result ', layerId].join(''));\n var promotable = ['flow', 'grid', 'discont', 'cartogram', 'smooth'];\n var legend_but = typeGeom[1] !== 'cartogram' ? _buttons.button_legend : undefined;\n var replace_but = promotable.indexOf(typeGeom[1]) > -1 ? _buttons.button_replace : undefined;\n li.innerHTML = [listDisplayName, '', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, legend_but, _buttons.button_result_type.get(typeGeom[1]), replace_but, '
'].join('');\n } else if (typeLayer === 'target') {\n li.setAttribute('class', ['sortable_target ', layerId].join(''));\n li.innerHTML = [listDisplayName, '', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_type.get(typeGeom), _buttons.button_replace, '
'].join('');\n } else {\n var _replace_but = !data_manager.current_layers[layerName].graticule && !data_manager.current_layers[layerName].sphere ? _buttons.button_replace : undefined;\n li.setAttribute('class', ['sortable ', layerId].join(''));\n li.innerHTML = [listDisplayName, '', _buttons.button_trash, _buttons.sys_run_button_t2, _buttons.button_zoom_fit, _buttons.button_table, _buttons.eye_open0, _buttons.button_type.get(typeGeom), _replace_but, '
'].join('');\n }\n layersListed.insertBefore(li, layersListed.childNodes[0]);\n (0, _interface.binds_layers_buttons)(layerName);\n}\n\n/**\n* Function returning an object describing the type of field\n* @param {string} layerName - The name of the new layer\n* @param {string} target - The geometry type\n* @return {object|array} - An object containing the type of each field if\n* target was nos specified, otherwise an array of field name corresponding\n* to the type defined in 'target'.\n*/\nvar type_col = exports.type_col = function type_col(layerName, target) {\n // Function returning an object like {\"field1\": \"field_type\", \"field2\": \"field_type\"},\n // for the fields of the selected layer.\n // If target is set to \"number\" it should return an array containing only the name of the numerical fields\n // ------------------- \"string\" ---------------------------------------------------------non-numerial ----\n var table = data_manager.user_data.hasOwnProperty(layerName) ? data_manager.user_data[layerName] : data_manager.result_data.hasOwnProperty(layerName) ? data_manager.result_data[layerName] : data_manager.joined_dataset[0];\n var fields = Object.getOwnPropertyNames(table[0]);\n var nbFeatures = table.length;\n var deepthTest = nbFeatures > 100 ? 100 : nbFeatures - 1;\n var result = {};\n var field = void 0;\n var tmpType = void 0;\n\n for (var j = 0, len = fields.length; j < len; ++j) {\n field = fields[j];\n result[field] = [];\n for (var i = 0; i < deepthTest; ++i) {\n tmpType = _typeof(table[i][field]);\n if (tmpType === 'string' && table[i][field].length === 0) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && !isNaN(Number(table[i][field])) || tmpType === 'number') {\n tmpType = 'number';\n } else if (tmpType === 'object' && isFinite(table[i][field])) {\n tmpType = 'empty';\n }\n result[fields[j]].push(tmpType);\n }\n }\n\n for (var _j = 0, _len = fields.length; _j < _len; ++_j) {\n field = fields[_j];\n if (result[field].every(function (ft) {\n return ft === 'number' || ft === 'empty';\n }) && result[field].indexOf('number') > -1) {\n result[field] = 'number';\n } else {\n result[field] = 'string';\n }\n }\n if (target) {\n var res = [];\n Object.keys(result).forEach(function (k) {\n if (result[k] === target && k !== '_uid') {\n res.push(k);\n }\n });\n return res;\n }\n return result;\n};\n\nvar type_col2 = exports.type_col2 = function type_col2(table, _field) {\n var skip_if_empty_values = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n // Function returning an array of objects like\n // {name: \"field1\", type: \"field_type\"}, {name: \"field2\", type: \"field_type\"}, (...)]\n // for the fields of the selected layer.\n var result = [];\n var nbFeatures = table.length;\n var tmp = {};\n var dups = {};\n var field = _field;\n var tmpType = void 0;\n var fields = void 0;\n\n if (!field) {\n fields = Object.getOwnPropertyNames(table[0]).filter(function (v) {\n return v !== '_uid';\n });\n field = undefined;\n } else {\n fields = [field];\n field = undefined;\n }\n\n for (var j = 0, len = fields.length; j < len; ++j) {\n field = fields[j];\n tmp[field] = [];\n dups[field] = false;\n var h = {};\n for (var i = 0; i < nbFeatures; ++i) {\n var val = table[i][field];\n if (h[val]) dups[field] = true;else h[val] = true;\n tmpType = typeof val === 'undefined' ? 'undefined' : _typeof(val);\n if (tmpType === 'object' && isFinite(val)) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && val.length === 0) {\n tmpType = 'empty';\n } else if (tmpType === 'string' && !isNaN(Number(val)) || tmpType === 'number') {\n var _val = Number(val);\n tmpType = (_val | 0) === val ? 'stock' : (_val | 0) === +val ? 'stock' : 'ratio';\n }\n tmp[fields[j]].push(tmpType);\n }\n }\n var nb_id_field = 0;\n for (var _j2 = 0, _len2 = fields.length; _j2 < _len2; ++_j2) {\n field = fields[_j2];\n var hasDup = dups[field];\n if ((field.toLowerCase() === 'id' || field.toLowerCase().indexOf('name') > -1 || field.toLowerCase().indexOf('nom') > -1) && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (field.toLowerCase().indexOf('id') > -1 && nb_id_field < 1 && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (!hasDup && nb_id_field < 1 && tmp[field].every(function (ft) {\n return ft === 'string' || ft === 'stock';\n })) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (tmp[field].every(function (ft) {\n return ft === 'string';\n }) && !hasDup) {\n result.push({ name: field, type: 'id', has_duplicate: hasDup });\n nb_id_field += 1;\n } else if (tmp[field].every(function (ft) {\n return ft === 'stock' || ft === 'empty';\n }) && tmp[field].indexOf('stock') > -1) {\n result.push({ name: field, type: 'stock', has_duplicate: hasDup });\n } else if (tmp[field].every(function (ft) {\n return ft === 'string' || ft === 'empty';\n }) && tmp[field].indexOf('string') > -1) {\n result.push({ name: field, type: 'category', has_duplicate: hasDup });\n } else if (tmp[field].every(function (ft) {\n return ft === 'ratio' || ft === 'stock' || ft === 'empty';\n }) && tmp[field].indexOf('ratio') > -1) {\n result.push({ name: field, type: 'ratio' });\n } else {\n result.push({ name: field, type: 'unknown', has_duplicate: hasDup });\n }\n }\n return result;\n};\n\nvar getFieldsType = exports.getFieldsType = function getFieldsType(type, layerName, ref) {\n if (!layerName && !ref) return null;\n var refField = ref || data_manager.current_layers[layerName].fields_type;\n if (!refField) return [];\n return refField.filter(function (d) {\n return d.type === type;\n }).map(function (d) {\n return d.name;\n });\n};\n\nfunction make_box_type_fields(layerName) {\n (0, _dialogs.make_dialog_container)('box_type_fields', _tr('app_page.box_type_fields.title'), 'dialog');\n d3.select('#box_type_fields').select('.modal-dialog').style('width', '500px');\n var newbox = d3.select('#box_type_fields').select('.modal-body');\n var tmp = type_col2(data_manager.user_data[layerName]);\n var fields_type = data_manager.current_layers[layerName].fields_type;\n var f = fields_type.map(function (v) {\n return v.name;\n });\n var refType = ['id', 'stock', 'ratio', 'category', 'unknown'];\n\n // const deferred = Promise.pending();\n var container = document.getElementById('box_type_fields');\n return new Promise(function (resolve, reject) {\n var clean_up_box = function clean_up_box() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', helper_esc_key_twbs);\n if (window.fields_handler) {\n fields_handler.unfill();\n fields_handler.fill(layerName);\n }\n };\n\n if (f.length === 0) {\n // If the user dont have already selected the type :\n fields_type = tmp.slice();\n container.querySelector('.btn_cancel').remove(); // Disabled cancel button to force the user to choose\n var _onclose = function _onclose() {\n // Or use the default values if he use the X close button\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n };\n container.querySelector('#xclose').onclick = _onclose;\n } else if (tmp.length > fields_type.length) {\n // There is already types selected but new fields where added\n tmp.forEach(function (d) {\n if (f.indexOf(d.name) === -1) {\n fields_type.push(d);\n }\n });\n container.querySelector('.btn_cancel').remove(); // Disabled cancel button to force the user to choose\n var _onclose2 = function _onclose2() {\n // Or use the default values if he use the X close button\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n };\n container.querySelector('#xclose').onclick = _onclose2;\n } else {\n // There is already types selected and no new fields (so this is a modification) :\n // Use the previous values if the user close\n // the window without confirmation (cancel or X button)\n var _onclose3 = function _onclose3() {\n data_manager.current_layers[layerName].fields_type = fields_type;\n resolve(false);\n clean_up_box();\n };\n container.querySelector('.btn_cancel').onclick = _onclose3;\n container.querySelector('#xclose').onclick = _onclose3;\n }\n\n // Fetch and store the selected values when 'Ok' button is clicked :\n container.querySelector('.btn_ok').onclick = function () {\n var r = [];\n Array.prototype.forEach.call(document.querySelectorAll('#fields_select > li'), function (elem) {\n r.push({ name: elem.childNodes[0].innerHTML.trim(), type: elem.childNodes[1].value });\n });\n resolve(true);\n data_manager.current_layers[layerName].fields_type = r.slice();\n getAvailablesFunctionnalities(layerName);\n clean_up_box();\n };\n function helper_esc_key_twbs(_evt) {\n var evt = _evt || window.event;\n var isEscape = 'key' in evt ? evt.key === 'Escape' || evt.key === 'Esc' : evt.keyCode === 27;\n if (isEscape) {\n evt.stopPropagation();\n data_manager.current_layers[layerName].fields_type = tmp.slice();\n getAvailablesFunctionnalities(layerName);\n resolve(false);\n clean_up_box();\n }\n }\n document.addEventListener('keydown', helper_esc_key_twbs);\n document.getElementById('btn_type_fields').removeAttribute('disabled');\n\n newbox.append('h3').html(_tr('app_page.box_type_fields.message_invite'));\n\n var box_select = newbox.append('ul').attr('id', 'fields_select').styles({\n padding: '0',\n 'list-style': 'none'\n });\n\n box_select.selectAll('li').data(fields_type).enter().append('li');\n\n box_select.selectAll('li').insert('span').html(function (d) {\n return d.name;\n });\n\n box_select.selectAll('li').insert('select').style('float', 'right').selectAll('option').data(refType).enter().insert('option').attr('value', function (d) {\n return d;\n }).text(function (d) {\n return _tr('app_page.box_type_fields.' + d);\n }).exit();\n\n box_select.selectAll('select').each(function (d) {\n this.value = d.type;\n });\n\n for (var i = 0; i < fields_type.length; i++) {\n if (fields_type[i].type === 'category' || fields_type[i].not_number) {\n box_select.node().childNodes[i].childNodes[1].options.remove(2);\n box_select.node().childNodes[i].childNodes[1].options.remove(1);\n }\n if (fields_type[i].has_duplicate) {\n box_select.node().childNodes[i].childNodes[1].options.remove(0);\n }\n }\n _dialogs.overlay_under_modal.display();\n setTimeout(function () {\n container.querySelector('button.btn_ok').focus();\n }, 400);\n });\n}\n\nfunction getAvailablesFunctionnalities(layerName) {\n var section = document.getElementById('section2_pre');\n if (!layerName) {\n var elems = section.querySelectorAll('#button_grid, #button_discont, #button_smooth, #button_cartogram, #button_typosymbol, #button_flow, #button_prop, #button_choro, #button_choroprop, #button_typo, #button_proptypo, #button_two_stocks');\n for (var i = 0, len_i = elems.length; i < len_i; i++) {\n elems[i].style.filter = 'grayscale(100%)';\n }\n return;\n }\n\n var fields_stock = getFieldsType('stock', layerName),\n fields_ratio = getFieldsType('ratio', layerName),\n fields_categ = getFieldsType('category', layerName),\n fields_id = getFieldsType('id', layerName);\n var func_stock = void 0,\n func_ratio = void 0,\n func_categ = void 0,\n func_id = void 0;\n if (data_manager.current_layers[layerName].type === 'Line') {\n // Layer type is Line\n var _elems = section.querySelectorAll('#button_grid, #button_discont, #button_smooth, #button_cartogram, #button_typosymbol, #button_flow');\n for (var _i2 = 0, _len_i = _elems.length; _i2 < _len_i; _i2++) {\n _elems[_i2].style.filter = 'grayscale(100%)';\n }\n func_id = [];\n func_stock = section.querySelectorAll('#button_prop');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo');\n } else if (data_manager.current_layers[layerName].type === 'Point') {\n // layer type is Point\n var _elems2 = section.querySelectorAll('#button_discont, #button_cartogram');\n for (var _i3 = 0, _len_i2 = _elems2.length; _i3 < _len_i2; _i3++) {\n _elems2[_i3].style.filter = 'grayscale(100%)';\n }\n func_id = section.querySelectorAll('#button_flow');\n func_stock = section.querySelectorAll('#button_smooth, #button_prop, #button_grid');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo, #button_typosymbol');\n } else {\n // Layer type is Polygon\n func_id = section.querySelectorAll('#button_flow');\n func_stock = section.querySelectorAll('#button_smooth, #button_prop, #button_grid, #button_cartogram, #button_discont');\n func_ratio = section.querySelectorAll('#button_choro, #button_choroprop, #button_discont');\n func_categ = section.querySelectorAll('#button_typo, #button_proptypo, #button_typosymbol');\n }\n /* eslint-disable no-param-reassign */\n var to_unactive = function to_unactive(d) {\n d.style.filter = 'grayscale(100%)';\n };\n var to_active = function to_active(d) {\n d.style.filter = 'invert(0%) saturate(100%)';\n };\n /* eslint-enable no-param-reassign */\n if (fields_stock.length === 0) {\n Array.prototype.forEach.call(func_stock, to_unactive);\n } else {\n Array.prototype.forEach.call(func_stock, to_active);\n }\n if (fields_ratio.length === 0) {\n Array.prototype.forEach.call(func_ratio, to_unactive);\n } else {\n Array.prototype.forEach.call(func_ratio, to_active);\n }\n if (fields_categ.length === 0) {\n Array.prototype.forEach.call(func_categ, to_unactive);\n } else {\n Array.prototype.forEach.call(func_categ, to_active);\n }\n if (fields_id.length === 0) {\n Array.prototype.forEach.call(func_id, to_unactive);\n } else {\n Array.prototype.forEach.call(func_id, to_active);\n }\n\n // That representation needs both Stock and Ratio variables:\n if (fields_stock.length === 0 || fields_ratio.length === 0) {\n document.getElementById('button_choroprop').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_choroprop').style.filter = 'invert(0%) saturate(100%)';\n }\n // That representation needs both Stock and Categorical variables:\n if (fields_stock.length === 0 || fields_categ.length === 0) {\n document.getElementById('button_proptypo').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_proptypo').style.filter = 'invert(0%) saturate(100%)';\n }\n // That representation needs either a Stock or a Ratio variable:\n if (data_manager.current_layers[layerName].type === 'Polygon' && (fields_stock.length > 0 || fields_ratio.length > 0)) {\n document.getElementById('button_discont').style.filter = 'invert(0%) saturate(100%)';\n } else {\n document.getElementById('button_discont').style.filter = 'grayscale(100%)';\n }\n // Special case for the \"waffle\" kind of map as it needs 2 or more stock variables:\n if (fields_stock.length < 2) {\n document.getElementById('button_two_stocks').style.filter = 'grayscale(100%)';\n } else {\n document.getElementById('button_two_stocks').style.filter = 'invert(0%) saturate(100%)';\n }\n}\n\nvar clickLinkFromDataUrl = exports.clickLinkFromDataUrl = function clickLinkFromDataUrl(url, filename) {\n return fetch(url).then(function (res) {\n return res.blob();\n }).then(function (blob) {\n var blobUrl = URL.createObjectURL(blob);\n var dlAnchorElem = document.createElement('a');\n dlAnchorElem.setAttribute('href', blobUrl);\n dlAnchorElem.setAttribute('download', filename);\n // if (window.isIE || window.isOldMS_Firefox) {\n if (window.isIE) {\n swal({\n title: '',\n html: '' + _tr('app_page.common.download_link') + '
',\n showCancelButton: true,\n showConfirmButton: false,\n allowEscapeKey: false,\n allowOutsideClick: false,\n cancelButtonText: _tr('app_page.common.close'),\n animation: 'slide-from-top',\n onOpen: function onOpen() {\n dlAnchorElem.innerHTML = filename;\n var content = document.getElementsByClassName('link_download')[0];\n content.appendChild(dlAnchorElem);\n },\n onClose: function onClose() {\n URL.revokeObjectURL(blobUrl);\n }\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n } else {\n dlAnchorElem.style.display = 'none';\n document.body.appendChild(dlAnchorElem);\n dlAnchorElem.click();\n dlAnchorElem.remove();\n URL.revokeObjectURL(blobUrl);\n }\n });\n};\n\n/**\n* Clone a JS Object, taking care of also copying JS Map objects.\n*\n* @param {Array} obj - The object to be cloned.\n* @return {Array} The resulting Object (or Map).\n*/\nvar cloneObj = exports.cloneObj = function cloneObj(obj) {\n if (obj === null || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') return obj;else if (obj.toString() === '[object Map]') return new Map(obj.entries());\n return Object.assign({}, obj);\n};\n\nfunction prepareFileExt(files_to_send) {\n /* eslint-disable no-param-reassign */\n Array.prototype.forEach.call(files_to_send, function (f) {\n f._ext = '';\n if (f.name.indexOf('.') > -1) {\n var name = f.name.substring(0, f.name.lastIndexOf('.'));\n var ext = f.name.substring(f.name.lastIndexOf('.') + 1, f.name.length);\n f._name = [name, ext.toLowerCase()].join('.');\n f._ext = ext.toLowerCase();\n }\n });\n /* eslint-enable no-param-reassign */\n return files_to_send;\n}\n\n// /**\n// * Take an array to reverse it (acting on a copy of the input).\n// *\n// * @param {Array} arr - The array to be copied and reversed.\n// * @return {Array} The resulting Array, letting the input Array untouched.\n// */\n// function getCopyReversed(arr) {\n// return arr.slice().reverse();\n// }\n\n/**\n* Try to parse a JSON string into. Returns an Array of two elements :\n* like [true, data] if parsing suceeded or like [false, error] if it failed.\n*\n* @param {String} txt - The JSON string to be parsed.\n* @return {Array} An Array of two element, this first one is a Boolean (wheter\n* parsing the string sucedded or not) and the second is the resulting object or\n* the error thrown.\n*/\nvar isValidJSON = exports.isValidJSON = function isValidJSON(txt) {\n try {\n var a = JSON.parse(txt);\n return [true, a];\n } catch (e) {\n return [false, e];\n }\n};\n\nfunction accordionize2() {\n var css_selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.accordion';\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;\n\n var acc = parent.querySelectorAll(css_selector);\n for (var i = 0; i < acc.length; i++) {\n acc[i].onclick = function () {\n this.classList.toggle('active');\n this.nextElementSibling.classList.toggle('show');\n };\n }\n}\n\nfunction getTargetLayerProps() {\n var names = Object.keys(data_manager.current_layers);\n for (var i = 0, n_layer = names.length; i < n_layer; i++) {\n if (data_manager.current_layers[names[i]].targeted) {\n return data_manager.current_layers[names[i]];\n }\n }\n return null;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/helpers.js?");
-
-/***/ }),
-
-/***/ "./js/helpers_calc.js":
-/*!****************************!*\
- !*** ./js/helpers_calc.js ***!
- \****************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.PropSizer = exports.get_precision_axis = exports.round_value = exports.contains_empty_val = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.min_fast = min_fast;\nexports.max_fast = max_fast;\nexports.has_negative = has_negative;\nexports.has_duplicate = has_duplicate;\nexports.get_nb_decimals = get_nb_decimals;\nexports.get_nb_left_separator = get_nb_left_separator;\nexports.getDecimalSeparator = getDecimalSeparator;\nexports.prop_sizer3_e = prop_sizer3_e;\nexports.getBinsCount = getBinsCount;\nexports.haversine_dist = haversine_dist;\nexports.coslaw_dist = coslaw_dist;\nexports.getTranslateNewLegend = getTranslateNewLegend;\nexports.scale_to_bbox = scale_to_bbox;\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar sin = Math.sin;\nvar cos = Math.cos;\nvar atan2 = Math.atan2;\n\n/**\n* Function computing the min of an array of values (tking care of empty/null/undefined slot)\n* - no fancy functionnalities here (it doesn't add anything comparing to Math.min.apply()\n* or d3.min() except a little speed-up)\n*\n* @param {Array} arr - The serie of values.\n* @return {Number} - The minimum value.\n*/\nfunction min_fast(arr) {\n var min = arr[0];\n for (var i = 1, len_i = arr.length; i < len_i; ++i) {\n var val = +arr[i];\n if (val && val < min) min = val;\n }\n return min;\n}\n\n/**\n* Return the maximum value of an array of numbers\n*\n* @param {Array} arr - the array of numbers\n* @return {Number} max\n*/\nfunction max_fast(arr) {\n var max = arr[0];\n for (var i = 1, len_i = arr.length; i < len_i; ++i) {\n var val = +arr[i];\n if (val > max) max = val;\n }\n return max;\n}\n\n/**\n* Test an array of numbers for negative values\n*\n* @param {Array} arr - the array of numbers\n* @return {Bool} result - True or False, whether it contains negatives values or not\n*/\nfunction has_negative(arr) {\n for (var i = 0; i < arr.length; ++i) {\n if (+arr[i] < 0) return true;\n }\n return false;\n}\n\n/**\n* @param {Array} arr - The array to test\n* @return {Boolean} result - True or False, according to whether it contains empty values or not\n*/\nvar contains_empty_val = exports.contains_empty_val = function contains_empty_val(arr) {\n for (var i = arr.length - 1; i > -1; --i) {\n if (arr[i] == null) return true;else if (isNaN(+arr[i])) return true;\n }\n return false;\n};\n\n/**\n* @param {Array} arr - The array to test\n* @return {Boolean} result - True or False, according to whether it contains duplicate or not\n*/\nfunction has_duplicate(arr) {\n var _h = {},\n len_arr = arr.length;\n for (var i = 0; i < len_arr; i++) {\n if (_h[arr[i]]) return true;\n _h[arr[i]] = true;\n }\n return false;\n}\n\n/**\n* Round a given value with the given precision\n*\n* @param {Number} val - The value to be rounded.\n* @param {Number} precision - The wanted precision.\n* @return {Number} value - The rounded value.\n*/\nvar round_value = exports.round_value = function round_value(val, nb) {\n if (nb === undefined) {\n return val;\n }\n var dec_mult = +['1', Array((0, _helpers_math.Mabs)(nb)).fill('0').join('')].join('');\n return nb >= 0 ? (0, _helpers_math.Mround)(+val * dec_mult) / dec_mult : (0, _helpers_math.Mround)(+val / dec_mult) * dec_mult;\n};\n\nfunction get_nb_decimals(nb) {\n var tmp = nb.toString().split('.');\n return tmp.length < 2 ? 0 : tmp[1].length;\n}\n\nfunction get_nb_left_separator(nb) {\n var tmp = nb.toString().split('.');\n return tmp[0].length;\n}\n\n/**\n* Get the decimal separator in user's locale.\n* and compute the number of item in each bin.\n*\n* @return {String} separator - The decimal separator (dot or comma)\n*/\nfunction getDecimalSeparator() {\n return 1.1.toLocaleString().substr(1, 1);\n}\n\nvar get_precision_axis = exports.get_precision_axis = function get_precision_axis(serie_min, serie_max, precision) {\n var range_serie = serie_max - serie_min;\n if (serie_max > 1 && range_serie > 100) {\n return '.0f';\n } else if (range_serie > 10) {\n if (precision === 0) {\n return '.0f';\n }\n return '.1f';\n } else if (range_serie > 1) {\n if (precision < 2) {\n return '.1f';\n }\n return '.2f';\n } else if (range_serie > 0.1) {\n return '.3f';\n } else if (range_serie > 0.01) {\n return '.4f';\n } else if (range_serie > 0.001) {\n return '.5f';\n } else if (range_serie > 0.0001) {\n return '.6f';\n } else if (range_serie > 0.00001) {\n return '.7f';\n }\n return '.8f';\n};\n\nvar PropSizer = exports.PropSizer = function PropSizer(fixed_value, fixed_size, type_symbol) {\n var _this = this;\n\n this.fixed_value = fixed_value;\n var sqrt = Math.sqrt,\n abs = Math.abs,\n pi = Math.PI;\n if (type_symbol === 'circle') {\n this.smax = fixed_size * fixed_size * pi;\n this.scale = function (val) {\n return sqrt(abs(val) * _this.smax / _this.fixed_value) / pi;\n };\n this.get_value = function (size) {\n return Math.pow(size * pi, 2) / _this.smax * _this.fixed_value;\n };\n } else if (type_symbol === 'line') {\n this.smax = fixed_size;\n this.scale = function (val) {\n return abs(val) * _this.smax / _this.fixed_value;\n };\n this.get_value = function (size) {\n return size / _this.smax * _this.fixed_value;\n };\n } else {\n this.smax = fixed_size * fixed_size;\n this.scale = function (val) {\n return sqrt(abs(val) * _this.smax / _this.fixed_value);\n };\n this.get_value = function (size) {\n return Math.pow(size, 2) / _this.smax * _this.fixed_value;\n };\n }\n};\n\nfunction prop_sizer3_e(arr, fixed_value, fixed_size, type_symbol) {\n var pi = Math.PI,\n abs = Math.abs,\n sqrt = Math.sqrt,\n arr_len = arr.length,\n res = [];\n\n if (!fixed_value || fixed_value === 0) {\n fixed_value = max_fast(arr);\n }\n\n if (type_symbol === 'circle') {\n var smax = fixed_size * fixed_size * pi;\n var _t = smax / fixed_value;\n for (var i = 0; i < arr_len; ++i) {\n res.push(sqrt(abs(arr[i]) * _t) / pi);\n }\n } else if (type_symbol === 'line') {\n var _t2 = fixed_size / fixed_value;\n for (var _i = 0; _i < arr_len; ++_i) {\n res.push(abs(arr[_i]) * _t2);\n }\n } else {\n var _smax = fixed_size * fixed_size;\n var _t3 = _smax / fixed_value;\n for (var _i2 = 0; _i2 < arr_len; ++_i2) {\n res.push(sqrt(abs(arr[_i2]) * _t3));\n }\n }\n return res;\n}\n\n/**\n* Compute a summary about the given serie of values.\n*\n* @param {Array} _values - The serie of values.\n* @param {Integer} bins - The number of bins to be used to compute the stock by class.\n* @return {Object} - A summary containing the break values (according to the number\n* of bins), the min value, the max value, the mean value, the median value,\n* the standard deviation and the stock by class.\n*\n*/\nfunction getBinsCount(_values) {\n var bins = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;\n\n var values = _values.filter(function (a) {\n return a;\n }).sort(function (a, b) {\n return a - b;\n });\n var nb_ft = values.length;\n var min = values[0],\n max = values[nb_ft - 1],\n extend = max - min,\n bin_size = extend / bins,\n counts = new Array(bins),\n break_values = [min],\n ix_med = (nb_ft + 1) / 2;\n var sum = 0;\n\n for (var i = 0; i < bins; i++) {\n break_values.push(break_values[i] + bin_size);\n }\n for (var _i3 = 1, j = 0; _i3 < nb_ft; _i3++) {\n var class_max = break_values[_i3 - 1];\n counts[_i3 - 1] = 0;\n while (values[j] <= class_max) {\n sum += values[j];\n counts[_i3 - 1] += 1;\n j += 1;\n }\n }\n var mean = sum / nb_ft;\n var stddev = getStdDev(values, mean);\n\n return {\n breaks: break_values,\n counts: counts,\n min: min,\n max: max,\n mean: mean,\n median: (ix_med | 0) === ix_med ? values[ix_med] : (values[Math.floor(ix_med)] + values[Math.ceil(ix_med)]) / 2,\n stddev: stddev\n };\n}\n\n/**\n* Return the haversine distance in kilometers between two points (lat/long coordinates)\n*\n* @param {Array} A - Coordinates of the 1st point as [latitude, longitude]\n* @param {Array} B - Coordinates of the 2nd point as [latitude, longitude]\n* @return {Number} distance - The distance in km between A and B\n*/\nfunction haversine_dist(A, B) {\n var pi_dr = Math.PI / 180;\n\n var lat1 = +A[0],\n lon1 = +A[1],\n lat2 = +B[0],\n lon2 = +B[1];\n\n var x1 = lat2 - lat1,\n dLat = x1 * pi_dr,\n x2 = lon2 - lon1,\n dLon = x2 * pi_dr;\n\n var a = sin(dLat / 2) * sin(dLat / 2) + cos(lat1 * pi_dr) * cos(lat2 * pi_dr) * sin(dLon / 2) * sin(dLon / 2);\n return 6371 * 2 * atan2((0, _helpers_math.Msqrt)(a), (0, _helpers_math.Msqrt)(1 - a));\n}\n\n/**\n* Return the distance in kilometers between two points (lat/long coordinates)\n* according to the spherical law of cosines\n*\n* @param {Array} A - Coordinates of the 1st point as [latitude, longitude]\n* @param {Array} B - Coordinates of the 2nd point as [latitude, longitude]\n* @return {Number} distance - The distance in km between A and B\n*/\nfunction coslaw_dist(A, B) {\n var pi_dr = Math.PI / 180;\n\n var lat1 = +A[0],\n lon1 = +A[1],\n lat2 = +B[0],\n lon2 = +B[1];\n var phi1 = lat1 * pi_dr,\n phi2 = lat2 * pi_dr,\n d_lambda = (lon2 - lon1) * pi_dr;\n return Math.acos(Math.sin(phi1) * Math.sin(phi2) + Math.cos(phi1) * Math.cos(phi2) * Math.cos(d_lambda)) * 6371;\n}\n\n// /**\n// * Compute the euclidian distance between pt1 and pt2, in the unit provided.\n// *\n// * @param {Array} pt1 - Coordinates of the 1st point as [x, y].\n// * @param {Array} pt2 - Coordinates of the 2nd point as [x, y].\n// * @return {Number} - The euclidian distance between pt1 and pt2.\n// */\n// export function get_distance(pt1, pt2) {\n// const xs = pt2[0] - pt1[1];\n// const ys = pt2[1] - pt1[1];\n// return Msqrt((xs * xs) + (ys * ys));\n// }\n\n/**\n* Compute the standard deviation of a serie of values.\n*\n* @param {Array} values - The serie of values.\n* @param {Number} mean_val - The mean of the serie (computed upstream).\n* @return {Number} - The standard deviation.\n*/\nfunction getStdDev(values, mean_val) {\n var nb_val = values.length;\n // const pow = Math.pow;\n var s = 0;\n for (var i = 0; i < nb_val; i++) {\n // s += pow(values[i] - mean_val, 2);\n s += Math.pow(values[i] - mean_val, 2);\n }\n return (0, _helpers_math.Msqrt)(1 / nb_val * s);\n}\n\n/**\n* Return the maximal available rectangle in the map\n* in order to locate a new legend without covering existing ones.\n*\n* Implementation taken from http://www.codinghands.co.uk/blog/2013/02/javascript-implementation-omn-maximal-rectangle-algorithm/\n*\n* @param {NodeList} legend_nodes - All the existing `Node`s corresponding\n to the main (ie. larger) element of a legend on the map.\n* @return {Object} - A summary about the larger available rectangle found.\n*\n*/\nfunction getMaximalAvailableRectangle(legend_nodes) {\n function getMaxRect() {\n var cache = new Array(rows + 1);\n var stack = [];\n var bestUpperLeft = { x: -1, y: -1 };\n var bestLowerRight = { x: -1, y: -1 };\n\n for (var i = 0; i < cache.length; i++) {\n cache[i] = 0;\n }\n\n for (var x = cols - 1; x >= 0; x--) {\n updateCache(x, cache);\n var width = 0;\n for (var y = 0; y < rows + 1; y++) {\n if (cache[y] > width) {\n stack.push({ y: y, width: width });\n width = cache[y];\n }\n if (cache[y] < width) {\n var _y = void 0;\n var w0 = void 0;\n while (true) {\n var pop = stack.pop();\n _y = pop.y;\n w0 = pop.width;\n if (width * (y - _y) > area(bestUpperLeft, bestLowerRight) && y - _y >= minQuadY && width >= minQuadX) {\n bestUpperLeft = { x: x, y: _y };\n bestLowerRight = { x: x + width - 1, y: y - 1 };\n }\n width = w0;\n if (cache[y] >= width) break;\n }\n width = cache[y];\n if (width !== 0) stack.push({ y: _y, width: w0 });\n }\n }\n }\n return {\n x: bestUpperLeft.x,\n y: bestUpperLeft.y,\n lenX: bestLowerRight.x - bestUpperLeft.x + 1,\n lenY: bestLowerRight.y - bestUpperLeft.y + 1,\n area: area(bestUpperLeft, bestLowerRight)\n };\n }\n\n function area(upperLeft, lowerRight) {\n if (upperLeft.x > lowerRight.x || upperLeft.y > lowerRight.y) return 0;\n return (lowerRight.x + 1 - upperLeft.x) * (lowerRight.y + 1 - upperLeft.y);\n }\n\n function updateCache(x, cache) {\n for (var y = 0; y < rows; y++) {\n if (mat[x][y] === 1) cache[y]++;else cache[y] = 0;\n }\n }\n\n function fillMat(xs, ys) {\n for (var x = xs[0]; x < xs[1]; x++) {\n for (var y = ys[0]; y < ys[1]; y++) {\n mat[x][y] = 0;\n }\n }\n }\n\n var _get_map_xy = get_map_xy0(),\n x0 = _get_map_xy.x,\n y0 = _get_map_xy.y;\n\n var minQuadY = 100;\n var minQuadX = 40;\n // x0 = Math.abs(x0);\n // y0 = Math.abs(y0);\n // let cols = Math.abs(w);\n // let rows = Math.abs(h);\n // let mat = new Array(cols);\n // for (let i = 0; i < cols; i++) {\n // mat[i] = new Array(rows);\n // for (let j = 0; j < rows; j++) {\n // mat[i][j] = 1;\n // }\n // }\n x0 = Math.floor(x0);\n y0 = Math.floor(y0);\n var cols = Math.floor(w);\n var rows = Math.floor(h);\n var mat = [];\n for (var i = 0; i < cols; i++) {\n mat.push([]);\n for (var j = 0; j < rows; j++) {\n mat[i].push(1);\n }\n }\n for (var _i4 = 0; _i4 < legend_nodes.length; _i4++) {\n var bbox = legend_nodes[_i4].getBoundingClientRect();\n var bx = Math.floor(bbox.left - x0);\n var by = Math.floor(bbox.top - y0);\n if (bx < 0) bx = 0;\n if (by < 0) by = 0;\n var bx2 = bx + Math.floor(bbox.width) >= cols ? cols - 1 : bx + Math.floor(bbox.width);\n var by2 = by + Math.floor(bbox.height) >= rows ? rows - 1 : by + Math.floor(bbox.height);\n fillMat([bx, bx2], [by, by2]);\n }\n return getMaxRect(mat);\n}\n\n/**\n* Get the x and y parameters to be used to translate a newly created legend\n* in order it doesn't overlay existing legends.\n*\n* @return {Array} - The x and y values to be used to translate the new legend.\n*\n*/\nfunction getTranslateNewLegend() {\n var legends = svg_map.querySelectorAll('.legend_feature');\n if (legends.length === 0) {\n return { x: 0, y: 0 };\n }\n try {\n return getMaximalAvailableRectangle(legends);\n } catch (e) {\n console.log(e);\n return { x: 0, y: 0 };\n }\n}\n\n/**\n* Scale the map to the given rectangular bouding box (in geographic coordinates / WGS84),\n* redraw the path of all the layer and also reproject the layers containing ponctual\n* features (such as symbol layer, labels, etc.)\n*\n* @param {Array} bbox - The bounding box (as [xmin, ymin, xmax, ymax]) to scale on.\n* @return {void}\n*\n*/\nfunction scale_to_bbox(bbox) {\n var _bbox = _slicedToArray(bbox, 4),\n xmin = _bbox[0],\n ymin = _bbox[1],\n xmax = _bbox[2],\n ymax = _bbox[3];\n\n var feature = {\n type: 'Feature',\n properties: {},\n id: 0,\n geometry: {\n type: 'LineString',\n coordinates: [[xmin, ymin], [xmax, ymin], [xmax, ymax], [xmin, ymax], [xmin, ymin]]\n }\n };\n var bboxPath = path.bounds(feature);\n s = 0.95 / (0, _helpers_math.Mmax)((bboxPath[1][0] - bboxPath[0][0]) / w, (bboxPath[1][1] - bboxPath[0][1]) / h) * proj.scale();\n t = [0, 0];\n proj.scale(s).translate(t);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n var zoom_scale = 1;\n var zoom_translate = [(w - zoom_scale * (bboxPath[1][0] + bboxPath[0][0])) / 2, (h - zoom_scale * (bboxPath[1][1] + bboxPath[0][1])) / 2];\n var zoom = svg_map.__zoom;\n zoom.k = zoom_scale;\n zoom.x = zoom_translate[0];\n zoom.y = zoom_translate[1];\n (0, _map_ctrl.zoom_without_redraw)();\n}\n\n//# sourceURL=webpack:///./js/helpers_calc.js?");
-
-/***/ }),
-
-/***/ "./js/helpers_math.js":
-/*!****************************!*\
- !*** ./js/helpers_math.js ***!
- \****************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar Mmax = exports.Mmax = Math.max;\nvar Mmin = exports.Mmin = Math.min;\nvar Mabs = exports.Mabs = Math.abs;\nvar Mpow = exports.Mpow = Math.pow; // eslint-disable-line no-restricted-properties\nvar Msqrt = exports.Msqrt = Math.sqrt;\nvar Mround = exports.Mround = Math.round;\nvar Mceil = exports.Mceil = Math.ceil;\n\n//# sourceURL=webpack:///./js/helpers_math.js?");
-
-/***/ }),
-
-/***/ "./js/interface.js":
-/*!*************************!*\
- !*** ./js/interface.js ***!
- \*************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global, Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.setUpInterface = setUpInterface;\nexports.askTypeLayer = askTypeLayer;\nexports.handle_upload_files = handle_upload_files;\nexports.prepare_drop_section = prepare_drop_section;\nexports.handle_reload_TopoJSON = handle_reload_TopoJSON;\nexports.update_menu_dataset = update_menu_dataset;\nexports.update_section1_layout = update_section1_layout;\nexports.update_section1 = update_section1;\nexports.ask_join_now = ask_join_now;\nexports.updateLayer = updateLayer;\nexports.handle_click_hand = handle_click_hand;\nexports.scale_to_lyr = scale_to_lyr;\nexports.center_map = center_map;\nexports.fitLayer = fitLayer;\nexports.setSphereBottom = setSphereBottom;\nexports.add_simplified_land_layer = add_simplified_land_layer;\nexports.prepare_available_symbols = prepare_available_symbols;\nexports.accordionize = accordionize;\nexports.switch_accordion_section = switch_accordion_section;\nexports.handle_title = handle_title;\nexports.handle_title_properties = handle_title_properties;\nexports.displayInfoOnMove = displayInfoOnMove;\nexports.handle_active_layer = handle_active_layer;\nexports.remove_layer_cleanup = remove_layer_cleanup;\nexports.binds_layers_buttons = binds_layers_buttons;\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _jschardet = __webpack_require__(/*! jschardet */ \"./node_modules/jschardet/src/init.js\");\n\nvar _jschardet2 = _interopRequireDefault(_jschardet);\n\nvar _proj = __webpack_require__(/*! proj4 */ \"./node_modules/proj4/lib/index.js\");\n\nvar _proj2 = _interopRequireDefault(_proj);\n\nvar _topojson = __webpack_require__(/*! topojson */ \"./node_modules/topojson/index.js\");\n\nvar topojson = _interopRequireWildcard(_topojson);\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _fonts = __webpack_require__(/*! ./fonts */ \"./js/fonts.js\");\n\nvar _function = __webpack_require__(/*! ./function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _join_popup = __webpack_require__(/*! ./join_popup */ \"./js/join_popup.js\");\n\nvar _layers_style_popup = __webpack_require__(/*! ./layers_style_popup */ \"./js/layers_style_popup.js\");\n\nvar _layers = __webpack_require__(/*! ./layers */ \"./js/layers.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _map_project = __webpack_require__(/*! ./map_project */ \"./js/map_project.js\");\n\nvar _projections = __webpack_require__(/*! ./projections */ \"./js/projections.js\");\n\nvar _sample_topo = __webpack_require__(/*! ./sample_topo */ \"./js/sample_topo.js\");\n\nvar _tables = __webpack_require__(/*! ./tables */ \"./js/tables.js\");\n\nvar _zoom_rect = __webpack_require__(/*! ./zoom_rect */ \"./js/zoom_rect.js\");\n\nvar _zoom_rect2 = _interopRequireDefault(_zoom_rect);\n\nvar _buttons = __webpack_require__(/*! ./ui/buttons */ \"./js/ui/buttons.js\");\n\nvar _header = __webpack_require__(/*! ./ui/header */ \"./js/ui/header.js\");\n\nvar _header2 = _interopRequireDefault(_header);\n\nvar _section = __webpack_require__(/*! ./ui/section1 */ \"./js/ui/section1.js\");\n\nvar _section2 = _interopRequireDefault(_section);\n\nvar _section3 = __webpack_require__(/*! ./ui/section2 */ \"./js/ui/section2.js\");\n\nvar _section4 = _interopRequireDefault(_section3);\n\nvar _section5 = __webpack_require__(/*! ./ui/section3 */ \"./js/ui/section3.js\");\n\nvar _section6 = _interopRequireDefault(_section5);\n\nvar _section7 = __webpack_require__(/*! ./ui/section4 */ \"./js/ui/section4.js\");\n\nvar _section8 = _interopRequireDefault(_section7);\n\nvar _section9 = __webpack_require__(/*! ./ui/section5 */ \"./js/ui/section5.js\");\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n* Maxium allowed input size in bytes. If the input file is larger than\n* this size, the user will receive an alert.\n* In the case of sending multiple files unziped, this limit corresponds\n* to the sum of the size of each file.\n*/\nvar MAX_INPUT_SIZE = 27300000;\n\n/**\n* Function setting-up main elements of the interface\n*\n* Some of the variables created here are put in global/window scope\n* as they are gonna be frequently used\n*\n*/\nfunction setUpInterface(reload_project) {\n // Create the waiting overlay to be ready to be displayed when needed:\n global._app.waitingOverlay = (0, _helpers.createWaitingOverlay)();\n // Only ask for confirmation before leaving page if things have been done\n // (layer added, etc..)\n window.addEventListener('beforeunload', _map_project.beforeUnloadWindow);\n\n // Remove some layers from the server when user leave the page\n // (ie. result layers are removed but targeted layer and layout layers stay\n // in cache as they have more chance to be added again)\n window.addEventListener('unload', function () {\n var layer_names = Object.getOwnPropertyNames(data_manager.current_layers).filter(function (name) {\n if (!data_manager.current_layers[name].hasOwnProperty('key_name')) {\n return 0;\n } else if (data_manager.current_layers[name].targeted) {\n return 0;\n } else if (data_manager.current_layers[name].renderer && (data_manager.current_layers[name].renderer.indexOf('PropSymbols') > -1 || data_manager.current_layers[name].renderer.indexOf('Dorling') > -1 || data_manager.current_layers[name].renderer.indexOf('Choropleth') > -1 || data_manager.current_layers[name].renderer.indexOf('Categorical') > -1)) {\n return 0;\n }\n return 1;\n });\n if (layer_names.length) {\n var formToSend = new FormData();\n layer_names.forEach(function (name) {\n formToSend.append('layer_name', data_manager.current_layers[name].key_name);\n });\n navigator.sendBeacon('/layers/delete', formToSend);\n }\n }, false);\n\n global.overlay_drop = document.querySelector('#overlay_drop');\n document.getElementById('menu').style.display = null;\n (0, _header2.default)();\n (0, _section2.default)();\n (0, _section4.default)();\n (0, _section6.default)();\n (0, _section8.default)();\n add_simplified_land_layer();\n (0, _section9.makeSection5)();\n\n // Zoom-in, Zoom-out, Info, Hand-Move and RectZoom buttons (on the top of the map) :\n var lm = map_div.append('div').attr('class', 'light-menu');\n\n var lm_buttons = [{ id: 'zoom_out', i18n: '[data-ot]app_page.lm_buttons.zoom-', class: 'zoom_button i18n tt', html: '-' }, { id: 'zoom_in', i18n: '[data-ot]app_page.lm_buttons.zoom+', class: 'zoom_button i18n tt', html: '+' }, { id: 'info_button', i18n: '[data-ot]app_page.lm_buttons.i', class: 'info_button i18n tt', html: 'i' }, { id: 'brush_zoom_button', i18n: '[data-ot]app_page.lm_buttons.zoom_rect', class: 'brush_zoom_button i18n tt', html: ' ' }, { id: 'hand_button', i18n: '[data-ot]app_page.lm_buttons.hand_button', class: 'hand_button i18n tt', html: ' ' }];\n\n lm.selectAll('input').data(lm_buttons).enter().append('p').attr('class', 'cont_map_btn').insert('button').attrs(function (elem) {\n return {\n class: elem.class,\n 'data-i18n': elem.i18n,\n 'data-ot-delay': 0,\n 'data-ot-fixed': true,\n 'data-ot-target': true,\n id: elem.id\n };\n }).html(function (elem) {\n return elem.html;\n });\n\n // Trigger actions when buttons are clicked and set-up the initial view :\n d3.selectAll('.zoom_button').on('click', _map_ctrl.zoomClick);\n document.getElementById('info_button').onclick = displayInfoOnMove;\n document.getElementById('hand_button').onclick = handle_click_hand;\n document.getElementById('brush_zoom_button').onclick = _zoom_rect2.default;\n\n // Already append the div for displaying information on features,\n // setting it currently unactive until it will be requested :\n d3.select('body').append('div').attr('id', 'info_features').classed('active', false).style('display', 'none').html('');\n\n accordionize('.accordion');\n document.getElementById('btn_s1').dispatchEvent(new MouseEvent('click'));\n prepare_drop_section();\n\n if (reload_project) {\n var url = void 0;\n if (reload_project.startsWith('http')) {\n url = reload_project;\n } else {\n url = 'https://gist.githubusercontent.com/' + reload_project + '/raw/';\n }\n (0, _helpers.xhrequest)('GET', url, undefined, true).then(function (data) {\n (0, _map_project.apply_user_preferences)(data);\n });\n } else {\n // Check if there is a project to reload in the localStorage :\n var last_project = window.localStorage.getItem('magrit_project');\n if (last_project && last_project.length && last_project.length > 0) {\n swal({\n title: '',\n // text: _tr('app_page.common.resume_last_project'),\n allowOutsideClick: false,\n allowEscapeKey: false,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.new_project'),\n cancelButtonText: _tr('app_page.common.resume_last')\n }).then(function () {\n // If we don't want to resume from the last project, we can\n // remove it :\n window.localStorage.removeItem('magrit_project');\n }, function () {\n (0, _map_project.apply_user_preferences)(last_project);\n });\n }\n }\n // Set the properties for the notification zone :\n _alertifyjs2.default.set('notifier', 'position', 'bottom-left');\n}\n\n/**\n*\n* @param\n*\n*\n*/\nfunction askTypeLayer() {\n var opts = { target: _tr('app_page.common.target_l'), layout: _tr('app_page.common.layout_l') };\n var target_layer_added = Object.keys(data_manager.user_data).length > 0;\n var first_reject = false;\n return swal({\n title: '',\n text: _tr('app_page.common.layer_type_selection'),\n type: 'info',\n showCancelButton: true,\n showCloseButton: false,\n allowEscapeKey: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.confirm'),\n input: 'select',\n inputValue: target_layer_added ? 'layout' : 'target',\n inputPlaceholder: _tr('app_page.common.layer_type_selection'),\n inputOptions: opts,\n inputValidator: function inputValidator(value) {\n return new Promise(function (resolve, reject) {\n if (value.indexOf('target') < 0 && value.indexOf('layout') < 0) {\n reject(_tr('app_page.common.no_value'));\n } else if (value.indexOf('target') > -1 && _app.targeted_layer_added && !first_reject) {\n first_reject = true;\n reject(_tr('app_page.common.ask_replace_target_layer'));\n } else {\n if (value.indexOf('target') > -1 && first_reject) {\n downgradeTargetLayer();\n }\n resolve(value);\n }\n });\n }\n });\n}\n\n/**\n* @param {FileList} files - The files(s) to be handled for this layer\n*\n* @return undefined\n*/\nfunction handle_upload_files(files) {\n var tot_size = Array.prototype.map.call(files, function (f) {\n return f.size;\n }).reduce(function (a, b) {\n return a + b;\n }, 0);\n if (files[0] && !files[0]._ext) {\n files = (0, _helpers.prepareFileExt)(files);\n }\n if (tot_size > MAX_INPUT_SIZE) {\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.too_large_input'),\n type: 'error',\n customClass: 'swal2_custom',\n allowEscapeKey: false,\n allowOutsideClick: false\n });\n }\n if (!(files.length === 1)) {\n var files_to_send = [];\n Array.prototype.forEach.call(files, function (f) {\n return f._ext === 'shp' || f._ext === 'dbf' || f._ext === 'shx' || f._ext === 'prj' || f._ext === 'cpg' ? files_to_send.push(f) : null;\n });\n if (files_to_send.length >= 4 && files_to_send.length <= 6) {\n handle_shapefile(files_to_send);\n } else {\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.alert_upload1'),\n customClass: 'swal2_custom',\n type: 'error',\n allowEscapeKey: false,\n allowOutsideClick: false\n });\n }\n } else if (files[0]._ext.indexOf('json') > -1 || files[0]._ext === 'zip' || files[0]._ext === 'gml' || files[0]._ext === 'kml') {\n if (files[0]._ext.indexOf('json') < 0) {\n handle_single_file(files[0]);\n } else {\n var rd = new FileReader();\n rd.onloadend = function () {\n var _isValidJSON = (0, _helpers.isValidJSON)(rd.result),\n _isValidJSON2 = _slicedToArray(_isValidJSON, 2),\n valid = _isValidJSON2[0],\n tmp = _isValidJSON2[1];\n\n if (!valid) {\n console.log(tmp);\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.alert_upload_invalid'),\n type: 'error',\n customClass: 'swal2_custom',\n allowOutsideClick: false,\n allowEscapeKey: false\n });\n }\n if (tmp.type && tmp.type === 'FeatureCollection') {\n handle_single_file(files[0]);\n } else if (tmp.type && tmp.type === 'Topology') {\n handle_TopoJSON_files(files);\n } else if (tmp.map_config && tmp.layers) {\n (0, _map_project.apply_user_preferences)(rd.result);\n } else {\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.alert_upload_invalid'),\n type: 'error',\n customClass: 'swal2_custom',\n allowOutsideClick: false,\n allowEscapeKey: false\n });\n }\n };\n rd.readAsText(files[0]);\n }\n } else if (files[0]._ext === 'csv' || files[0]._ext === 'tsv') {\n handle_dataset(files[0]);\n } else if (files[0]._ext.indexOf('xls') > -1 || files[0]._ext.indexOf('ods') > -1) {\n convert_dataset(files[0]);\n } else {\n var shp_part = void 0;\n Array.prototype.forEach.call(files, function (f) {\n f._ext === 'shp' || f._ext === 'dbf' || f._ext === 'shx' || f._ext === 'prj' || f._ext === 'cpg' ? shp_part = true : null;\n });\n if (shp_part) {\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.alert_upload_shp'),\n type: 'error',\n customClass: 'swal2_custom',\n allowOutsideClick: false,\n allowEscapeKey: false\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n } else {\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.alert_upload_invalid'),\n type: 'error',\n customClass: 'swal2_custom',\n allowOutsideClick: false,\n allowEscapeKey: false\n });\n }\n }\n}\n\nfunction handleOneByOneShp(files) {\n function populate_shp_slot(slots, file) {\n if (file.name.toLowerCase().indexOf('.shp') > -1) {\n slots.set('.shp', file);\n document.getElementById('f_shp').className = 'mini_button_ok';\n } else if (file.name.toLowerCase().indexOf('.shx') > -1) {\n slots.set('.shx', file);\n document.getElementById('f_shx').className = 'mini_button_ok';\n } else if (file.name.toLowerCase().indexOf('.prj') > -1) {\n slots.set('.prj', file);\n document.getElementById('f_prj').className = 'mini_button_ok';\n } else if (file.name.toLowerCase().indexOf('.dbf') > -1) {\n slots.set('.dbf', file);\n document.getElementById('f_dbf').className = 'mini_button_ok';\n } else if (file.name.toLowerCase().indexOf('.cpg') > -1) {\n slots.set('.cpg', file);\n document.getElementById('f_cpg').className = 'mini_button_ok';\n } else {\n return false;\n }\n }\n var name = files[0].name.substring(0, files[0].name.lastIndexOf('.'));\n var shp_slots = new Map();\n\n swal({\n title: '',\n html: '' + ('
' + _tr('app_page.common.shp_one_by_one_msg1') + ' ') + ('
' + _tr('app_page.common.shp_one_by_one_msg2', { name: name }) + '
') + ('
' + _tr('app_page.common.shp_one_by_one_msg3') + '
') + '
' + '.shp
.shx
' + '.dbf
.prj
' + '.cpg
',\n type: 'info',\n showCancelButton: true,\n showCloseButton: false,\n allowEscapeKey: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.confirm'),\n preConfirm: function preConfirm() {\n return new Promise(function (resolve, reject) {\n setTimeout(function () {\n if (!(shp_slots.size === 4 && !shp_slots.has('.cpg') || shp_slots.size === 5)) {\n reject(_tr('app_page.common.shp_one_by_one_missing_files'));\n } else {\n resolve();\n }\n }, 50);\n });\n }\n }).then(function () {\n var file_list = [shp_slots.get('.shp'), shp_slots.get('.shx'), shp_slots.get('.dbf'), shp_slots.get('.prj')];\n if (shp_slots.has('.cpg')) {\n file_list.push(shp_slots.get('.cpg'));\n }\n for (var i = 0; i < file_list.length; i++) {\n if (file_list[i].size > MAX_INPUT_SIZE) {\n overlay_drop.style.display = 'none';\n return swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.too_large_input'),\n type: 'error',\n allowEscapeKey: false,\n allowOutsideClick: false\n });\n }\n }\n handle_shapefile(file_list);\n }, function (dismiss) {\n overlay_drop.style.display = 'none';\n console.log(dismiss);\n });\n\n populate_shp_slot(shp_slots, files[0]);\n document.getElementById('dv_drop_shp').addEventListener('drop', function (event) {\n event.preventDefault();\n event.stopPropagation();\n var next_files = (0, _helpers.prepareFileExt)(event.dataTransfer.files);\n for (var f_ix = 0; f_ix < next_files.length; f_ix++) {\n // let file = next_files[f_ix];\n populate_shp_slot(shp_slots, next_files[f_ix]);\n }\n if (shp_slots.size === 4 && !shp_slots.has('.cpg') || shp_slots.size === 5) {\n // const elem = document.getElementById('dv_drop_shp');\n // elem.innerHTML = elem.innerHTML.replace('Ic_file_download_48px.svg', 'Ic_check_36px.svg');\n this.innerHTML = this.innerHTML.replace('Ic_file_download_48px.svg', 'Ic_check_36px.svg');\n }\n });\n document.getElementById('dv_drop_shp').addEventListener('dragover', function (event) {\n this.style.border = 'dashed 2.5px green';\n event.preventDefault();event.stopPropagation();\n });\n document.getElementById('dv_drop_shp').addEventListener('dragleave', function (event) {\n this.style.border = 'dashed 1px green';\n event.preventDefault();event.stopPropagation();\n });\n}\n\n/**\n* Function called to bind the \"drop zone\" on the 2 desired menu elements\n*\n*/\nfunction prepare_drop_section() {\n var timeout = void 0;\n Array.prototype.forEach.call(document.querySelectorAll('body, .overlay_drop'), function (elem) {\n elem.addEventListener('dragenter', function (e) {\n e.preventDefault();e.stopPropagation();\n if (document.body.classList.contains('no-drop')) return;\n document.getElementById('overlay_drop').style.display = '';\n });\n\n elem.addEventListener('dragover', function (e) {\n e.preventDefault();e.stopPropagation();\n if (document.body.classList.contains('no-drop')) return;\n if (timeout) {\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n // e.preventDefault(); e.stopPropagation();\n document.getElementById('overlay_drop').style.display = 'none';\n timeout = null;\n }, 2500);\n }\n });\n\n elem.addEventListener('dragleave', function (e) {\n e.preventDefault();e.stopPropagation();\n if (document.body.classList.contains('no-drop')) {\n document.body.classList.remove('no-drop');\n return;\n }\n timeout = setTimeout(function () {\n document.getElementById('overlay_drop').style.display = 'none';\n timeout = null;\n }, 2500);\n });\n\n elem.addEventListener('drop', function _drop_func(e) {\n e.preventDefault();e.stopPropagation();\n if (timeout) {\n clearTimeout(timeout);\n }\n if (document.body.classList.contains('no-drop') || !e.dataTransfer.files.length) {\n document.getElementById('overlay_drop').style.display = 'none';\n return;\n }\n timeout = setTimeout(function () {\n document.getElementById('overlay_drop').style.display = 'none';\n timeout = null;\n }, 750);\n\n var files = (0, _helpers.prepareFileExt)(e.dataTransfer.files);\n if (files.length === 1 && (files[0]._ext === 'shp' || files[0]._ext === 'dbf' || files[0]._ext === 'shx' || files[0]._ext === 'prj' || files[0]._ext === 'cpg')) {\n Array.prototype.slice.call(document.querySelectorAll('body, .overlay_drop')).forEach(function (_elem) {\n _elem.removeEventListener('drop', _drop_func);\n });\n handleOneByOneShp(files);\n } else {\n handle_upload_files(files, null);\n }\n });\n });\n}\n\nfunction ask_replace_dataset() {\n return swal({\n title: '',\n text: _tr('app_page.common.ask_replace_dataset'),\n type: 'warning',\n showCancelButton: true,\n allowOutsideClick: false,\n allowEscapeKey: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.confirm')\n });\n}\n\nfunction convert_dataset(file) {\n var do_convert = function do_convert() {\n var ajaxData = new FormData();\n ajaxData.append('action', 'submit_form');\n ajaxData.append('file[]', file);\n (0, _helpers.xhrequest)('POST', 'convert_tabular', ajaxData, true).then(function (raw_data) {\n var data = JSON.parse(raw_data);\n swal({\n title: '',\n text: _tr('app_page.common.warn_xls_sheet') + (data.message ? '\\n' + _tr(data.message[0], { sheet_name: data.message[1][0] }) : ''),\n type: 'info',\n allowOutsideClick: false,\n allowEscapeKey: false\n }).then(function () {\n var tmp_dataset = d3.csvParse(data.file);\n var field_names = Object.getOwnPropertyNames(tmp_dataset[0]).map(function (el) {\n return el.toLowerCase ? el.toLowerCase() : el;\n });\n if (!_app.targeted_layer_added && (field_names.indexOf('x') > -1 || field_names.indexOf('lat') > -1 || field_names.indexOf('latitude') > -1)) {\n if (field_names.indexOf('y') > -1 || field_names.indexOf('lon') > -1 || field_names.indexOf('longitude') > -1 || field_names.indexOf('long') > -1 || field_names.indexOf('lng') > -1) {\n add_csv_geom(data.file, data.name);\n return;\n }\n }\n data_manager.dataset_name = data.name;\n add_dataset(tmp_dataset);\n }, function () {\n return null;\n });\n }, function () {\n (0, _helpers.display_error_during_computation)();\n });\n };\n\n if (data_manager.joined_dataset.length !== 0) {\n ask_replace_dataset().then(function () {\n remove_ext_dataset_cleanup();\n do_convert();\n }, function () {\n return null;\n });\n } else {\n do_convert();\n }\n}\n\n/**\n* Handle shapefile opened/dropped on the window by the user.\n*\n* @param {Array} files - An array of files, containing the mandatory files\n* for correctly reading shapefiles\n* (.shp, .shx, .dbf, .prj and optionnaly .cpg).\n* @return {void}\n*/\nfunction handle_shapefile(files) {\n askTypeLayer().then(function (val) {\n overlay_drop.style.display = 'none';\n var target_layer_on_add = void 0;\n if (val.indexOf('target') > -1) {\n target_layer_on_add = true;\n } else {\n target_layer_on_add = false;\n }\n var ajaxData = new FormData();\n ajaxData.append('type', 'multiple');\n for (var j = 0; j < files.length; j++) {\n ajaxData.append('file[' + j + ']', files[j]);\n }\n (0, _helpers.xhrequest)('POST', 'convert_to_topojson', ajaxData, true).then(function (data) {\n (0, _layers.add_layer_topojson)(data, { target_layer_on_add: target_layer_on_add });\n }, function () {\n (0, _helpers.display_error_during_computation)();\n });\n }, function () {\n overlay_drop.style.display = 'none';\n });\n}\n\nfunction handle_TopoJSON_files(files) {\n askTypeLayer().then(function (val) {\n overlay_drop.style.display = 'none';\n var target_layer_on_add = void 0;\n if (val.indexOf('target') > -1) {\n target_layer_on_add = true;\n } else {\n target_layer_on_add = false;\n }\n var f = files[0],\n\n // name = files[0].name,\n reader = new FileReader(),\n ajaxData = new FormData();\n ajaxData.append('file[]', f);\n (0, _helpers.xhrequest)('POST', 'convert_topojson', ajaxData, true).then(function (res) {\n var key = JSON.parse(res).key;\n reader.onloadend = function () {\n var text = reader.result;\n var topoObjText = ['{\"key\": ', key, ',\"file\":', text, '}'].join('');\n (0, _layers.add_layer_topojson)(topoObjText, { target_layer_on_add: target_layer_on_add });\n };\n reader.readAsText(f);\n }, function () {\n (0, _helpers.display_error_during_computation)();\n });\n }, function () {\n overlay_drop.style.display = 'none';\n });\n}\n\n/**\n* Function used to reload a TopoJSON layer from a project file.\n* The layer is send to the server (for eventual later usage) but\n* we are not waiting for its response to actually add the layer to the map.\n*\n* @param {String} text - The TopoJSON layer stringified in JSON.\n* @param {Object} param_add_func - The options Object to be passed to the\n* 'add_layer_topojson' function.\n* @return {String} - The actual name of the layer, once added to the map.\n*\n*/\nfunction handle_reload_TopoJSON(text, param_add_func) {\n var ajaxData = new FormData();\n var f = new Blob([text], { type: 'application/json' });\n ajaxData.append('file[]', f);\n\n // let topoObjText = ['{\"key\":null,\"file\":', text, '}'].join('');\n var layer_name = (0, _layers.add_layer_topojson)(['{\"key\":null,\"file\":', text, '}'].join(''), param_add_func);\n (0, _helpers.xhrequest)('POST', 'convert_topojson', ajaxData, false).then(function (response) {\n var key = JSON.parse(response).key;\n data_manager.current_layers[layer_name].key_name = key;\n });\n return layer_name;\n}\n\n/**\n* Handle a csv dataset by parsing it as an array of Object (ie features) or by\n* converting it to topojson if it contains valid x/y/lat/lon/etc. columns and\n* adding it to the map\n* @param {File} f - The input csv file\n*/\nfunction handle_dataset(f, target_layer_on_add) {\n var check_dataset = function check_dataset() {\n var reader = new FileReader(),\n name = f.name;\n\n reader.onload = function (e) {\n var data = e.target.result;\n var encoding = _jschardet2.default.detect(data).encoding;\n var new_reader = new FileReader();\n new_reader.onload = function (ev) {\n data = ev.target.result;\n var sep = data.split('\\n')[0];\n if (sep.indexOf('\\t') > -1) {\n sep = '\\t';\n } else if (sep.indexOf(';') > -1) {\n sep = ';';\n } else {\n sep = ',';\n }\n\n var tmp_dataset = d3.dsvFormat(sep).parse(data);\n var field_names = Object.getOwnPropertyNames(tmp_dataset[0]).map(function (el) {\n return el.toLowerCase ? el.toLowerCase() : el;\n });\n if (field_names.indexOf('x') > -1 || field_names.indexOf('lat') > -1 || field_names.indexOf('latitude') > -1) {\n if (field_names.indexOf('y') > -1 || field_names.indexOf('lon') > -1 || field_names.indexOf('longitude') > -1 || field_names.indexOf('long') > -1 || field_names.indexOf('lng') > -1) {\n if (target_layer_on_add && _app.targeted_layer_added) {\n swal({\n title: _tr('app_page.common.error') + '!',\n text: _tr('app_page.common.error_only_one'),\n customClass: 'swal2_custom',\n type: 'error',\n allowEscapeKey: false,\n allowOutsideClick: false });\n } else {\n add_csv_geom(data, name.substring(0, name.indexOf('.csv')));\n }\n return;\n }\n }\n data_manager.dataset_name = name.substring(0, name.indexOf('.csv'));\n add_dataset(tmp_dataset);\n };\n new_reader.readAsText(f, encoding);\n };\n reader.readAsBinaryString(f);\n };\n\n if (data_manager.joined_dataset.length !== 0) {\n ask_replace_dataset().then(function () {\n remove_ext_dataset_cleanup();\n check_dataset();\n }, function () {\n return null;\n });\n } else {\n check_dataset();\n }\n}\n\n// function handle_dataset(f, target_layer_on_add){\n// function box_dataset(){\n// createBoxTextImportWizard(f).then(confirm => {\n// if(confirm){\n// let [tmp_dataset, valid] = confirm;\n// console.log(tmp_dataset, valid);\n// let field_name = Object.getOwnPropertyNames(tmp_dataset[0]);\n// if(field_name.indexOf(\"x\") > -1 || field_name.indexOf(\"X\") > -1 || field_name.indexOf(\"lat\") > -1 || field_name.indexOf(\"latitude\") > -1){\n// if(field_name.indexOf(\"y\") > -1 || field_name.indexOf(\"Y\") > -1 || field_name.indexOf(\"lon\") > -1 || field_name.indexOf(\"longitude\") > -1 || field_name.indexOf(\"long\") > -1){\n// if(target_layer_on_add && _app.targeted_layer_added){\n// swal({title: _tr(\"app_page.common.error\") + \"!\",\n// text: _tr('app_page.common.error_only_one'),\n// customClass: 'swal2_custom',\n// type: \"error\",\n// allowEscapeKey: false,\n// allowOutsideClick: false});\n//\n// } else {\n// let reader = new FileReader(),\n// name = f.name;\n//\n// reader.onload = function(e) {\n// add_csv_geom(e.target.result, f.name.substring(0, name.indexOf('.csv')));\n// }\n// reader.readAsText();\n// }\n// return;\n// }\n// }\n// data_manager.dataset_name = f.name.substring(0, f.name.indexOf('.csv'));\n// add_dataset(tmp_dataset);\n// }\n// });\n// }\n//\n// if(data_manager.joined_dataset.length !== 0){\n// ask_replace_dataset().then(() => {\n// remove_ext_dataset_cleanup();\n// box_dataset();\n// }, () => { null; });\n// } else {\n// box_dataset();\n// }\n// }\n\nfunction update_menu_dataset() {\n var d_name = data_manager.dataset_name.length > 20 ? [data_manager.dataset_name.substring(0, 17), '(...)'].join('') : data_manager.dataset_name,\n nb_features = data_manager.joined_dataset[0].length,\n field_names = Object.getOwnPropertyNames(data_manager.joined_dataset[0][0]);\n\n d3.select('#ext_dataset_zone').attr('data-i18n', null).styles({\n border: null,\n color: 'black',\n 'margin-bottom': '3px',\n padding: null,\n 'text-align': 'initial'\n }).html('\\n\\n ' + d_name + ' \\n' + nb_features + ' ' + _tr('app_page.common.feature', { count: +nb_features }) + ' - ' + field_names.length + ' ' + _tr('app_page.common.field', { count: +field_names.length }) + ' \\n
\\n\\n
\\n
\\n
');\n\n document.getElementById('remove_dataset').onclick = function () {\n remove_ext_dataset();\n };\n if (_app.targeted_layer_added) {\n (0, _join_popup.valid_join_check_display)(false);\n }\n document.getElementById('table_dataset_s1').onclick = function () {\n _tables.boxExplore2.create(data_manager.dataset_name);\n };\n}\n\n/**\n*\n*\n*/\nfunction add_dataset(readed_dataset) {\n // Check if their is an empty name in the columns name (typically the first one) and replace it by UID:\n if (readed_dataset[0].hasOwnProperty('')) {\n var new_col_name = !readed_dataset[0].hasOwnProperty('UID') ? 'UID' : 'Undefined_Name';\n for (var i = 0; i < readed_dataset.length; ++i) {\n readed_dataset[i][new_col_name] = readed_dataset[i][''];\n delete readed_dataset[i][''];\n }\n }\n\n var cols = Object.getOwnPropertyNames(readed_dataset[0]);\n\n // Test if there is an empty last line and remove it if its the case :\n if (cols.map(function (f) {\n return readed_dataset[readed_dataset.length - 1][f];\n }).every(function (f) {\n return f === '' || f === undefined;\n })) {\n readed_dataset = readed_dataset.slice(0, readed_dataset.length - 1);\n }\n\n // Suboptimal way to convert an eventual comma decimal separator to a point decimal separator :\n for (var _i = 0; _i < cols.length; _i++) {\n var tmp = [];\n // Check that all values of this field can be coerced to Number :\n for (var j = 0; j < readed_dataset.length; j++) {\n if (readed_dataset[j][cols[_i]].replace && (!isNaN(+readed_dataset[j][cols[_i]].replace(',', '.')) || !isNaN(+readed_dataset[j][cols[_i]].split(' ').join(''))) || !isNaN(+readed_dataset[j][cols[_i]])) {\n // Add the converted value to temporary field if its ok ...\n var t_val = readed_dataset[j][cols[_i]].replace(',', '.').split(' ').join('');\n tmp.push(isFinite(t_val) && t_val !== '' && t_val != null ? +t_val : t_val);\n } else {\n // Or break early if a value can't be coerced :\n break; // So no value of this field will be converted\n }\n }\n // If the whole field has been converted successfully, apply the modification :\n if (tmp.length === readed_dataset.length) {\n for (var _j = 0; _j < readed_dataset.length; _j++) {\n readed_dataset[_j][cols[_i]] = tmp[_j];\n }\n }\n }\n data_manager.joined_dataset.push(readed_dataset);\n\n update_menu_dataset();\n\n if (_app.current_functionnality && _app.current_functionnality.name === 'flow') {\n fields_handler.fill();\n }\n\n if (_app.targeted_layer_added) {\n var layer_name = Object.getOwnPropertyNames(data_manager.user_data)[0];\n ask_join_now(layer_name, 'dataset');\n }\n}\n\n/**\n* Send a csv file containing x/x columns to the server to convert it\n* to a TopoJSON layer.\n*\n*\n* @param {String} file - The csv file to be converted.\n* @param {String} name - The original name of the csv file.\n* @return {void}\n*/\nfunction add_csv_geom(file, name) {\n var ajaxData = new FormData();\n ajaxData.append('filename', name);\n ajaxData.append('csv_file', file);\n (0, _helpers.xhrequest)('POST', 'convert_csv_geo', ajaxData, true).then(function (data) {\n data_manager.dataset_name = undefined;\n (0, _layers.add_layer_topojson)(data, { target_layer_on_add: true });\n }, function () {\n (0, _helpers.display_error_during_computation)();\n });\n}\n\n/**\n* Send a single file (.zip / .kml / .gml / .geojson) to the server in order to get\n* the converted layer added to the map\n* @param {File} file\n*/\nfunction handle_single_file(file) {\n askTypeLayer().then(function (val) {\n overlay_drop.style.display = 'none';\n var target_layer_on_add = void 0;\n if (val.indexOf('target') > -1) {\n target_layer_on_add = true;\n } else {\n target_layer_on_add = false;\n }\n var ajaxData = new FormData();\n ajaxData.append('type', 'single');\n ajaxData.append('file[]', file);\n (0, _helpers.xhrequest)('POST', '/convert_to_topojson', ajaxData, true).then(function (data) {\n (0, _layers.add_layer_topojson)(data, { target_layer_on_add: target_layer_on_add });\n }, function () {\n (0, _helpers.display_error_during_computation)();\n });\n }, function () {\n overlay_drop.style.display = 'none';\n });\n}\n\nfunction update_section1_layout() {\n var nb_layout_layer = 0;\n Object.keys(data_manager.current_layers).forEach(function (k) {\n if (!data_manager.current_layers[k].is_result && !data_manager.current_layers[k].targeted) {\n nb_layout_layer += 1;\n }\n });\n if (nb_layout_layer > 0) {\n d3.select('#layout_layers_section').style('display', 'inline-flex').html('\\n
\\n\\n' + _tr('app_page.section1.plus_layout_layers', { count: nb_layout_layer }) + '
');\n } else {\n d3.select('#layout_layers_section').style('display', 'none').html('');\n }\n}\n\nfunction update_section1(type, nb_fields, nb_ft, lyr_name_to_add) {\n var nb_char_display = lyr_name_to_add.length;\n var _lyr_name_display = +nb_char_display > 35 ? [lyr_name_to_add.substring(0, 30), '(...)'].join('') : lyr_name_to_add;\n\n // Prepare an icon according to the type of geometry:\n var _button = _buttons.button_type.get(type);\n _button = _button.substring(10, _button.indexOf('class') - 2);\n\n // Upate the zone allowed for displaying info on the target layer:\n d3.select('#target_layer_zone').attr('data-i18n', null).styles({\n border: null,\n color: 'black',\n padding: null,\n 'text-align': 'left'\n }).html('\\n
\\n
\\n\\n' + _lyr_name_display + ' \\n \\n' + nb_ft + ' ' + _tr('app_page.common.feature', { count: +nb_ft }) + ' - ' + nb_fields + ' ' + _tr('app_page.common.field', { count: +nb_fields }) + ' \\n
\\n');\n\n // const remove_target = document.getElementById('remove_target');\n document.getElementById('remove_target').onclick = function () {\n remove_layer(Object.getOwnPropertyNames(data_manager.user_data)[0]);\n };\n // const table_target = document.getElementById('table_layer_s1');\n document.getElementById('table_layer_s1').onclick = display_table_target_layer;\n // const downgrade_target = document.getElementById('downgrade_target');\n document.getElementById('downgrade_target').onclick = function () {\n ask_downgrade_target_layer(Object.keys(data_manager.user_data)[0]).then(function () {\n downgradeTargetLayer();\n }, function () {\n return null;\n });\n };\n}\n\nfunction ask_downgrade_target_layer(name_layer) {\n return swal({\n title: '',\n text: _tr('app_page.common.replace_target_downgrade', { name_layer: name_layer }),\n allowOutsideClick: false,\n allowEscapeKey: true,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.yes'),\n cancelButtonText: _tr('app_page.common.no')\n });\n}\n\nfunction ask_replace_target_layer(name_layer) {\n return swal({\n title: '',\n text: _tr('app_page.common.replace_target_promote', { name_layer: name_layer }),\n allowOutsideClick: false,\n allowEscapeKey: true,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.yes'),\n cancelButtonText: _tr('app_page.common.no')\n });\n}\n\nfunction ask_join_now(layer_name) {\n var on_add = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'layer';\n\n swal({\n title: '',\n text: _tr('app_page.join_box.before_join_ask'),\n allowOutsideClick: false,\n allowEscapeKey: true,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.yes'),\n cancelButtonText: _tr('app_page.common.no')\n }).then(function () {\n (0, _join_popup.createJoinBox)(layer_name);\n }, function () {\n if (on_add === 'layer') (0, _helpers.make_box_type_fields)(layer_name);\n });\n}\n\nvar display_table_target_layer = function display_table_target_layer() {\n var layer_name = Object.keys(data_manager.user_data)[0];\n _tables.boxExplore2.create(layer_name);\n};\n\nfunction updateLayer(layer_name) {\n var fields = Object.keys(data_manager.user_data[layer_name][0]);\n data_manager.current_layers[layer_name].n_features = data_manager.user_data[layer_name].length;\n data_manager.current_layers[layer_name].original_fields = new Set(fields);\n var lyr_id = _app.layer_to_id.get(layer_name);\n var k = Object.keys(_target_layer_file.objects)[0];\n var selection = map.select('#' + lyr_id).selectAll('path').data(topojson.feature(_target_layer_file, _target_layer_file.objects[k]).features, function (d) {\n return d.id;\n });\n selection.exit().remove();\n scale_to_lyr(layer_name);\n center_map(layer_name);\n (0, _map_ctrl.zoom_without_redraw)();\n update_section1(data_manager.current_layers[layer_name].type, fields.length, data_manager.current_layers[layer_name].n_features, layer_name);\n}\n\nfunction handle_click_hand(behavior) {\n var hb = d3.select('#hand_button');\n // eslint-disable-next-line no-param-reassign\n var b = (typeof behavior === 'undefined' ? 'undefined' : _typeof(behavior)) === 'object' ? !hb.classed('locked') ? 'lock' : 'unlock' : behavior && typeof behavior === 'string' ? behavior : false;\n if (b === 'lock') {\n hb.classed('locked', true);\n hb.html(' ');\n map.select('.brush').remove();\n document.getElementById('zoom_in').parentElement.style.display = 'none';\n document.getElementById('zoom_out').parentElement.style.display = 'none';\n document.getElementById('brush_zoom_button').parentElement.style.display = 'none';\n _map_ctrl.zoom.on('zoom', function () {\n var blocked = svg_map.__zoom;return function () {\n this.__zoom = blocked;\n };\n }());\n } else {\n hb.classed('locked', false);\n hb.html(' ');\n _map_ctrl.zoom.on('zoom', _map_ctrl.zoom_without_redraw);\n document.getElementById('zoom_in').parentElement.style.display = '';\n document.getElementById('zoom_out').parentElement.style.display = '';\n document.getElementById('brush_zoom_button').parentElement.style.display = '';\n map.select('.brush').remove();\n }\n}\n\n/**\n* Get the bounding box (in map/svg coordinates) of a layer using path.bounds()\n*\n* @param {string} name - The name of layer\n* @return {Array} The bbox [[xmin, ymin], [xmax, ymax]] of the layer.\n*/\nfunction get_bbox_layer_path(name) {\n var selec = svg_map.querySelector('#' + _app.layer_to_id.get(name)).childNodes;\n var bbox_layer_path = [[Infinity, Infinity], [-Infinity, -Infinity]];\n for (var i = 0, len_i = selec.length; i < len_i; i++) {\n var bbox_path = path.bounds(selec[i].__data__);\n bbox_layer_path[0][0] = bbox_path[0][0] < bbox_layer_path[0][0] ? bbox_path[0][0] : bbox_layer_path[0][0];\n bbox_layer_path[0][1] = bbox_path[0][1] < bbox_layer_path[0][1] ? bbox_path[0][1] : bbox_layer_path[0][1];\n bbox_layer_path[1][0] = bbox_path[1][0] > bbox_layer_path[1][0] ? bbox_path[1][0] : bbox_layer_path[1][0];\n bbox_layer_path[1][1] = bbox_path[1][1] > bbox_layer_path[1][1] ? bbox_path[1][1] : bbox_layer_path[1][1];\n }\n if (_app.current_proj_name === 'ConicConformal') {\n var s1 = (0, _helpers_math.Mmax)((bbox_layer_path[1][0] - bbox_layer_path[0][0]) / w, (bbox_layer_path[1][1] - bbox_layer_path[0][1]) / h);\n var bbox_layer_path2 = path.bounds({ type: 'MultiPoint', coordinates: [[-69.3, -55.1], [20.9, -36.7], [147.2, -42.2], [162.1, 67.0], [-160.2, 65.7]] });\n var s2 = (0, _helpers_math.Mmax)((bbox_layer_path2[1][0] - bbox_layer_path2[0][0]) / w, (bbox_layer_path2[1][1] - bbox_layer_path2[0][1]) / h);\n if (s2 < s1) bbox_layer_path = bbox_layer_path2;\n } else if (_app.current_proj_name === 'Armadillo') {\n var _s = (0, _helpers_math.Mmax)((bbox_layer_path[1][0] - bbox_layer_path[0][0]) / w, (bbox_layer_path[1][1] - bbox_layer_path[0][1]) / h);\n var _bbox_layer_path = path.bounds({ type: 'MultiPoint', coordinates: [[-69.3, -35.0], [-170, 10], [-170, 85], [0, -70], [20.9, -35.0], [147.2, -35.0], [170, 85], [170, 10]] });\n var _s2 = (0, _helpers_math.Mmax)((_bbox_layer_path[1][0] - _bbox_layer_path[0][0]) / w, (_bbox_layer_path[1][1] - _bbox_layer_path[0][1]) / h);\n if (_s2 < _s) bbox_layer_path = _bbox_layer_path;\n }\n return bbox_layer_path;\n}\n\n/**\n* Change the projection scale and translate properties in order to fit the layer.\n* Redraw the path from all the current layers to reflect the change.\n*\n* @param {string} name - The name of layer to scale on\n* @return {void}\n*/\nfunction scale_to_lyr(name) {\n var bbox_layer_path = get_bbox_layer_path(name);\n if (!bbox_layer_path) return;\n s = 0.95 / (0, _helpers_math.Mmax)((bbox_layer_path[1][0] - bbox_layer_path[0][0]) / w, (bbox_layer_path[1][1] - bbox_layer_path[0][1]) / h) * proj.scale();\n t = [0, 0];\n proj.scale(s).translate(t);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n}\n\n/**\n* Center and zoom to a layer (using zoom scale and translate properties).\n* Projection properties stay unchanged.\n*\n* @param {string} name - The name of layer to zoom on\n* @return {void}\n*/\nfunction center_map(name) {\n var bbox_layer_path = get_bbox_layer_path(name);\n var zoom_scale = 0.95 / (0, _helpers_math.Mmax)((bbox_layer_path[1][0] - bbox_layer_path[0][0]) / w, (bbox_layer_path[1][1] - bbox_layer_path[0][1]) / h);\n var zoom_translate = [(w - zoom_scale * (bbox_layer_path[1][0] + bbox_layer_path[0][0])) / 2, (h - zoom_scale * (bbox_layer_path[1][1] + bbox_layer_path[0][1])) / 2];\n var _zoom = svg_map.__zoom;\n _zoom.k = zoom_scale;\n _zoom.x = zoom_translate[0];\n _zoom.y = zoom_translate[1];\n}\n\nfunction fitLayer(layer_name) {\n proj.scale(1).translate([0, 0]);\n var b = get_bbox_layer_path(layer_name);\n var s = 0.95 / (0, _helpers_math.Mmax)((b[1][0] - b[0][0]) / w, (b[1][1] - b[0][1]) / h);\n var t = [(w - s * (b[1][0] + b[0][0])) / 2, (h - s * (b[1][1] + b[0][1])) / 2];\n proj.scale(s).translate(t);\n return [s, t];\n}\n\n/**\n* Helper function called when a new 'Sphere' layer is added, in order to put it\n* on the bottom of the other layer on the map.\n*\n* @param {string} sphere_id - The DOM id of the sphere.\n* @return {void}\n*/\nfunction setSphereBottom(sphere_id) {\n var layers_list = document.querySelector('.layer_list');\n layers_list.appendChild(layers_list.childNodes[0]);\n svg_map.insertBefore(svg_map.querySelector('#' + sphere_id + '.layer'), svg_map.childNodes[0]);\n svg_map.insertBefore(defs.node(), svg_map.childNodes[0]);\n}\n\n/**\n* Helper function to add the 'world' layer (notably added) when the application\n* is started.\n*\n* @return {void}\n*/\nfunction add_simplified_land_layer() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var skip_rescale = options.skip_rescale || false;\n var stroke = options.stroke || 'rgb(0,0,0)';\n var fill = options.fill || '#d3d3d3';\n var stroke_opacity = options.stroke_opacity || 0.0;\n var fill_opacity = options.fill_opacity || 0.75;\n var stroke_width = options.stroke_width || '0.3px';\n var visible = !(options.visible === false);\n var drop_shadow = options.drop_shadow || false;\n\n var world_id = encodeId('World');\n _app.layer_to_id.set('World', world_id);\n _app.id_to_layer.set(world_id, 'World');\n data_manager.current_layers.World = {\n type: 'Polygon',\n n_features: 125,\n 'stroke-width-const': +stroke_width.slice(0, -2),\n fill_color: { single: fill },\n default_layer: true\n };\n map.insert('g', '.legend').attrs({ id: world_id, class: 'layer', 'clip-path': 'url(#clip)' }).style('stroke-width', stroke_width).selectAll('.subunit').data(topojson.feature(_sample_topo.world_topology, _sample_topo.world_topology.objects.World).features).enter().append('path').attr('d', path).styles({\n stroke: stroke,\n fill: fill,\n 'stroke-opacity': stroke_opacity,\n 'fill-opacity': fill_opacity\n });\n (0, _helpers.create_li_layer_elem)('World', null, 'Polygon', 'sample');\n if (drop_shadow) {\n (0, _layers_style_popup.createDropShadow)('World');\n }\n if (!skip_rescale) {\n scale_to_lyr('World');\n center_map('World');\n }\n if (!visible) {\n handle_active_layer('World');\n }\n (0, _map_ctrl.zoom_without_redraw)();\n}\n\nfunction send_remove_server(layer_name) {\n var formToSend = new FormData();\n formToSend.append('layer_name', data_manager.current_layers[layer_name].key_name);\n (0, _helpers.xhrequest)('POST', 'layers/delete', formToSend, true).then(function (data) {\n var parsed = JSON.parse(data);\n if (!parsed.code || parsed.code !== 'Ok') console.log(data);\n }).catch(function (err) {\n console.log(err);\n });\n}\n\nfunction prepare_available_symbols() {\n return (0, _helpers.xhrequest)('GET', 'static/json/list_symbols.json', null).then(function (result) {\n var list_res = JSON.parse(result);\n return Promise.all(list_res.map(function (name) {\n return (0, _helpers.getImgDataUrl)('static/img/svg_symbols/' + name);\n })).then(function (symbols) {\n for (var i = 0; i < list_res.length; i++) {\n _app.default_symbols.push([list_res[i], symbols[i]]);\n }\n });\n });\n}\n\nfunction accordionize() {\n var css_selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.accordion';\n var parent = arguments[1];\n\n var _parent = parent && (typeof parent === 'undefined' ? 'undefined' : _typeof(parent)) === 'object' ? parent : parent && typeof parent === 'string' ? document.querySelector(parent) : document;\n var acc = _parent.querySelectorAll(css_selector);\n for (var i = 0; i < acc.length; i++) {\n acc[i].onclick = function () {\n var opened = _parent.querySelector(css_selector + '.active');\n if (opened) {\n opened.classList.toggle('active');\n opened.nextElementSibling.classList.toggle('show');\n }\n if (!opened || opened.id !== this.id) {\n this.classList.toggle('active');\n this.nextElementSibling.classList.toggle('show');\n }\n };\n }\n}\n\nfunction downgradeTargetLayer() {\n var old_target = Object.keys(data_manager.user_data)[0];\n if (!old_target) return;\n delete data_manager.current_layers[old_target].targeted;\n data_manager.field_join_map = [];\n data_manager.user_data = {};\n _app.targeted_layer_added = false;\n _target_layer_file = null;\n resetSection1();\n (0, _helpers.getAvailablesFunctionnalities)();\n var id_lyr = _app.layer_to_id.get(old_target);\n document.querySelector('.' + id_lyr + '.sortable_target').classList.remove('sortable_target');\n return old_target;\n}\n\nfunction changeTargetLayer(new_target) {\n function _reproj(d_proj) {\n if (d_proj[0] === 'proj4') {\n var proj_str = d_proj[1];\n var custom_name = void 0;\n if (proj_str.startsWith('EPSG:')) {\n var code = +proj_str.split('EPSG:')[1];\n var rv = _app.epsg_projections[code];\n proj_str = rv.proj4;\n custom_name = rv.name;\n }\n _app.current_proj_name = 'def_proj4';\n _app.last_projection = proj_str;\n (0, _projections.change_projection_4)((0, _proj2.default)(proj_str));\n (0, _projections.addLastProjectionSelect)('def_proj4', _app.last_projection, custom_name);\n } else if (d_proj[0] === 'd3') {\n _app.current_proj_name = d_proj[1];\n (0, _projections.change_projection)(d_proj[1]);\n (0, _projections.addLastProjectionSelect)(_app.current_proj_name);\n }\n }\n downgradeTargetLayer();\n // const old_target = downgradeTargetLayer();\n data_manager.current_layers[new_target].targeted = true;\n _app.targeted_layer_added = true;\n data_manager.user_data[new_target] = Array.from(document.querySelector('#' + _app.layer_to_id.get(new_target)).querySelectorAll('path')).map(function (d) {\n return d.__data__.properties;\n });\n var fields = Object.keys(data_manager.user_data[new_target][0]);\n update_section1(data_manager.current_layers[new_target].type, fields.length, data_manager.current_layers[new_target].n_features, new_target);\n if (!data_manager.current_layers[new_target].fields_type) {\n data_manager.current_layers[new_target].original_fields = new Set(fields);\n }\n if (!data_manager.current_layers[new_target].fields_type) {\n data_manager.current_layers[new_target].fields_type = (0, _helpers.type_col2)(data_manager.user_data[new_target]);\n }\n document.getElementById('btn_type_fields').removeAttribute('disabled');\n (0, _helpers.getAvailablesFunctionnalities)(new_target);\n scale_to_lyr(new_target);\n center_map(new_target);\n (0, _map_ctrl.zoom_without_redraw)();\n\n // Reproject the map to the default projection if any:\n if (data_manager.current_layers[new_target].default_projection) {\n var d_proj = data_manager.current_layers[new_target].default_projection;\n _reproj(d_proj);\n } else if (data_manager.current_layers[new_target].last_projection) {\n var _d_proj = data_manager.current_layers[new_target].last_projection;\n _reproj(_d_proj);\n }\n\n var id_new_target_lyr = _app.layer_to_id.get(new_target);\n document.querySelector('#sortable > .' + id_new_target_lyr).classList.add('sortable_target');\n\n var d = {};\n d[new_target] = {\n type: 'FeatureCollection',\n features: Array.prototype.slice.call(document.querySelectorAll('#' + id_new_target_lyr + ' > path')).map(function (d) {\n return d.__data__;\n })\n };\n window._target_layer_file = topojson.topology(d);\n\n if (!data_manager.current_layers[new_target].key_name) {\n (0, _helpers.send_layer_server)(new_target, '/layers/add');\n }\n\n // Replace the proposed variables in the options of the current representation\n // if any:\n if (_app.current_functionnality !== undefined) {\n fields_handler.unfill();\n fields_handler.fill(new_target);\n }\n}\n\nfunction resetSection1() {\n // Remove infos and buttons about the target layer:\n d3.select('#target_layer_zone').attrs({\n class: 'i18n',\n 'data-i18n': '[html]app_page.section1.no_target'\n }).styles({\n border: '3px dashed #ccc',\n color: '#ccc',\n 'margin-bottom': '3px',\n padding: '3px',\n 'text-align': 'center'\n }).html(_tr('app_page.section1.no_target'));\n\n // Restore the state of the bottom of the section 1 :\n document.getElementById('join_section').innerHTML = '';\n\n // Disabled the button allowing the user to choose type for its layer :\n document.getElementById('btn_type_fields').setAttribute('disabled', 'true');\n\n // Set all the representation modes to \"unavailable\":\n (0, _helpers.getAvailablesFunctionnalities)();\n\n // Reset some values stored in the functionnality panel:\n (0, _function.reset_user_values)();\n}\n\n// Function to be called after clicking on \"render\" in order to close the section 2\n// and to have the section 3 opened\nfunction switch_accordion_section(id_elem) {\n document.getElementById(id_elem || 'btn_s3').dispatchEvent(new MouseEvent('click'));\n}\n\n// Function to handle the title add and changes\nfunction handle_title(txt) {\n var title = d3.select('#map_title').select('text');\n if (title.node()) {\n title.text(txt);\n } else {\n map.append('g').attrs({ class: 'legend title', id: 'map_title' }).style('cursor', 'pointer').insert('text').attrs({ x: w / 2, y: h / 12, 'alignment-baseline': 'middle', 'text-anchor': 'middle' }).styles({ 'font-family': 'verdana', 'font-size': '20px', position: 'absolute', color: 'black' }).text(txt).on('contextmenu dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n handle_title_properties();\n }).call(_helpers.drag_elem_geo);\n }\n}\n\nfunction handle_title_properties() {\n var title = d3.select('#map_title').select('text');\n if (!title.node() || title.text() === '') {\n swal({\n title: '',\n text: _tr('app_page.common.error_no_title'),\n type: 'error',\n allowOutsideClick: true,\n allowEscapeKey: true\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n return;\n }\n var title_props = {\n size: title.style('font-size'),\n font_weight: title.style('font-weight'),\n font_style: title.style('font-style'),\n text_decoration: title.style('text-decoration'),\n color: title.style('fill'),\n position_x: title.attr('x'),\n position_x_pct: (0, _helpers_calc.round_value)(+title.attr('x') / w * 100, 1),\n position_y: title.attr('y'),\n position_y_pct: (0, _helpers_calc.round_value)(+title.attr('y') / h * 100, 1),\n font_family: title.style('font-family'),\n stroke: title.style('stroke'),\n stroke_width: title.style('stroke-width')\n };\n title_props.font_weight = title_props.font_weight === '400' || title_props.font_weight === '' ? '' : 'bold';\n // Font name don't seems to be formatted in the same way on Firefox and Chrome\n // (a space is inserted after the comma in Chrome so we are removing it)\n title_props.font_family = title_props.font_family ? title_props.font_family.replace(', ', ',') : title_props.font_family;\n\n // Properties on the title are changed in real-time by the user\n // then it will be rollbacked to original properties if Cancel is clicked\n (0, _dialogs.make_confirm_dialog2)('mapTitleitleDialogBox', _tr('app_page.title_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (!confirmed) {\n title.attrs({ x: title_props.position_x, y: title_props.position_y }).styles({\n fill: title_props.color,\n stroke: title_props.stroke,\n 'stroke-width': title_props.stroke_width,\n 'font-family': title_props.font_family,\n 'font-size': title_props.size,\n 'font-style': title_props.font_style,\n 'font-weight': title_props.font_weight,\n 'text-decoration': title_props.text_decoration\n });\n }\n });\n var box_content = d3.select('.mapTitleitleDialogBox').select('.modal-body').append('div').style('margin', '15x');\n box_content.append('p').html(_tr('app_page.title_box.font_size')).insert('input').attrs({ type: 'number', min: 2, max: 40, step: 1 }).property('value', +title_props.size.split('px')[0]).style('width', '65px').on('change', function () {\n title.style('font-size', this.value + 'px');\n });\n box_content.append('p').html(_tr('app_page.title_box.xpos')).insert('input').attrs({ type: 'number', min: 0, max: 100, step: 1 }).property('value', title_props.position_x_pct).style('width', '65px').on('change', function () {\n title.attr('x', w * +this.value / 100);\n });\n box_content.append('p').html(_tr('app_page.title_box.ypos')).insert('input').attrs({ type: 'number', min: 0, max: 100, step: 1 }).property('value', title_props.position_y_pct).style('width', '65px').on('change', function () {\n title.attr('y', h * +this.value / 100);\n });\n box_content.append('p').html(_tr('app_page.title_box.font_color')).insert('input').attr('type', 'color').property('value', (0, _colors_helpers.rgb2hex)(title_props.color)).on('change', function () {\n title.style('fill', this.value);\n });\n\n var font_select = box_content.append('p').html(_tr('app_page.title_box.font_family')).insert('select').attr('class', 'params').on('change', function () {\n title.style('font-family', this.value);\n });\n _fonts.available_fonts.forEach(function (font) {\n font_select.append('option').text(font[0]).attr('value', font[1]);\n });\n font_select.node().selectedIndex = _fonts.available_fonts.map(function (d) {\n return d[1] === title_props.font_family ? '1' : '0';\n }).indexOf('1');\n\n var options_format = box_content.append('p'),\n btn_bold = options_format.insert('span').attr('class', title_props.font_weight === 'bold' ? 'active button_disc' : 'button_disc').html(' '),\n btn_italic = options_format.insert('span').attr('class', title_props.font_style === 'italic' ? 'active button_disc' : 'button_disc').html(' '),\n btn_underline = options_format.insert('span').attr('class', title_props.text_decoration === 'underline' ? 'active button_disc' : 'button_disc').html(' ');\n\n btn_bold.on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n title.style('font-weight', '');\n } else {\n this.classList.add('active');\n title.style('font-weight', 'bold');\n }\n });\n btn_italic.on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n title.style('font-style', '');\n } else {\n this.classList.add('active');\n title.style('font-style', 'italic');\n }\n });\n btn_underline.on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n title.style('text-decoration', '');\n } else {\n this.classList.add('active');\n title.style('text-decoration', 'underline');\n }\n });\n\n var hasBuffer = title_props.stroke !== 'none';\n var buffer_section1 = box_content.append('p');\n var buffer_section2 = box_content.append('p').style('display', hasBuffer ? '' : 'none');\n box_content.append('p').style('clear', 'both');\n\n buffer_section1.append('input').attrs({ type: 'checkbox', id: 'title_buffer_chkbox', checked: hasBuffer ? true : null }).on('change', function () {\n if (this.checked) {\n buffer_section2.style('display', '');\n title.style('stroke', buffer_color.node().value).style('stroke-width', buffer_width.node().value + 'px');\n } else {\n buffer_section2.style('display', 'none');\n title.style('stroke', 'none').style('stroke-width', '1px');\n }\n });\n\n buffer_section1.append('label').attrs({ for: 'title_buffer_chkbox' }).text(_tr('app_page.title_box.buffer'));\n\n var buffer_color = buffer_section2.insert('input').style('float', 'left').attrs({ type: 'color' }).property('value', hasBuffer ? (0, _colors_helpers.rgb2hex)(title_props.stroke) : '#ffffff').on('change', function () {\n title.style('stroke', this.value);\n });\n\n buffer_section2.insert('span').style('float', 'right').html(' px');\n\n var buffer_width = buffer_section2.insert('input').styles({ float: 'right', width: '60px' }).attrs({ type: 'number', step: '0.1' }).property('value', hasBuffer ? +title_props.stroke_width.replace('px', '') : 1).on('change', function () {\n title.style('stroke-width', this.value + 'px');\n });\n}\n\n// Function to display information on the top layer (in the layer manager)\nfunction displayInfoOnMove() {\n var info_features = d3.select('#info_features');\n if (info_features.classed('active')) {\n map.selectAll('.layer').selectAll('path').on('mouseover', null);\n map.selectAll('.layer').selectAll('circle').on('mouseover', null);\n map.selectAll('.layer').selectAll('rect').on('mouseover', null);\n info_features.classed('active', false);\n info_features.style('display', 'none').html('');\n d3.select('#info_button').classed('active', false);\n svg_map.style.cursor = '';\n } else {\n map.select('.brush').remove();\n d3.select('#brush_zoom_button').classed('active', false);\n var layers = svg_map.querySelectorAll('.layer'),\n nb_layer = layers.length;\n var top_visible_layer = null;\n\n for (var i = nb_layer - 1; i > -1; i--) {\n if (layers[i].style.visibility !== 'hidden') {\n top_visible_layer = global._app.id_to_layer.get(layers[i].id);\n break;\n }\n }\n\n if (!top_visible_layer) {\n swal('', _tr('app_page.common.error_no_visible'), 'error');\n return;\n }\n\n var id_top_layer = '#' + global._app.layer_to_id.get(top_visible_layer);\n var symbol = data_manager.current_layers[top_visible_layer].symbol || 'path';\n\n map.select(id_top_layer).selectAll(symbol).on('mouseover', function (d, i) {\n var txt_info = ['', top_visible_layer, ' Feature ', i + 1, '/', data_manager.current_layers[top_visible_layer].n_features, ' '];\n var properties = data_manager.result_data[top_visible_layer] ? data_manager.result_data[top_visible_layer][i] : d.properties;\n Object.getOwnPropertyNames(properties).forEach(function (el) {\n txt_info.push('' + el + ' : ' + properties[el]);\n });\n txt_info.push('
');\n info_features.style('display', null).html(txt_info.join(''));\n });\n\n map.select(id_top_layer).selectAll(symbol).on('mouseout', function () {\n info_features.style('display', 'none').html('');\n });\n\n info_features.classed('active', true);\n svg_map.style.cursor = 'help';\n d3.select('#info_button').classed('active', true);\n }\n}\n\n// Function to switch the visibility of a layer the open/closed eye button\nfunction handle_active_layer(name) {\n var fill_value = void 0,\n parent_div = void 0,\n selec = void 0,\n at_end = void 0;\n\n if (document.getElementById('info_features').className === 'active') {\n displayInfoOnMove();\n at_end = true;\n }\n if (!name) {\n selec = this;\n parent_div = selec.parentElement;\n name = parent_div.parentElement.getAttribute('layer_name'); // eslint-disable-line no-param-reassign\n } else {\n selec = document.querySelector('#sortable .' + global._app.layer_to_id.get(name) + ' .active_button');\n parent_div = selec.parentElement;\n }\n var func = function func() {\n handle_active_layer(name);\n };\n if (selec.id === 'eye_closed') {\n fill_value = 1;\n var eye_open = make_eye_button('open');\n eye_open.onclick = func;\n parent_div.replaceChild(eye_open, selec);\n } else {\n fill_value = 0;\n var eye_closed = make_eye_button('closed');\n eye_closed.onclick = func;\n parent_div.replaceChild(eye_closed, selec);\n }\n map.select('#' + global._app.layer_to_id.get(name)).style('visibility', fill_value === 0 ? 'hidden' : 'initial');\n map.selectAll('.lgdf_' + global._app.layer_to_id.get(name)).style('visibility', fill_value === 0 ? 'hidden' : 'initial');\n\n if (at_end) {\n displayInfoOnMove();\n }\n}\n\nfunction make_eye_button(state) {\n if (state === 'open') {\n var eye_open = document.createElement('img');\n eye_open.setAttribute('src', 'static/img/b/eye_open.png');\n eye_open.setAttribute('class', 'active_button i18n');\n eye_open.setAttribute('id', 'eye_open');\n eye_open.setAttribute('width', 17);\n eye_open.setAttribute('height', 17);\n eye_open.setAttribute('alt', 'Visible');\n return eye_open;\n } else if (state === 'closed') {\n var eye_closed = document.createElement('img');\n eye_closed.setAttribute('src', 'static/img/b/eye_closed.png');\n eye_closed.setAttribute('class', 'active_button i18n');\n eye_closed.setAttribute('id', 'eye_closed');\n eye_closed.setAttribute('width', 17);\n eye_closed.setAttribute('height', 17);\n eye_closed.setAttribute('alt', 'Not visible');\n return eye_closed;\n }\n}\n\n// Wrapper to obtain confirmation before actually removing a layer :\nfunction remove_layer(name) {\n // eslint-disable-next-line no-param-reassign\n name = name || this.parentElement.parentElement.getAttribute('layer_name');\n swal({\n title: '',\n text: _tr('app_page.common.remove_layer', { layer: name }),\n type: 'warning',\n customClass: 'swal2_custom',\n showCancelButton: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.delete') + '!',\n cancelButtonText: _tr('app_page.common.cancel')\n }).then(function () {\n remove_layer_cleanup(name);\n }, function () {\n return null;\n });\n // ^^^^^^^^^^^^ Do nothing on cancel, but this avoid having an \"uncaught exeption (cancel)\" comming in the console if nothing is set here\n // ^^^^^^^^^^^^^^^^^^^^^^^ Not sure anymore :/\n}\n\nfunction remove_ext_dataset() {\n swal({\n title: '',\n text: _tr('app_page.common.remove_tabular'),\n type: 'warning',\n showCancelButton: true,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.delete') + '!',\n cancelButtonText: _tr('app_page.common.cancel')\n }).then(function () {\n remove_ext_dataset_cleanup();\n }, function () {\n return null;\n });\n}\n\nfunction remove_ext_dataset_cleanup() {\n data_manager.field_join_map = [];\n data_manager.joined_dataset = [];\n data_manager.dataset_name = undefined;\n d3.select('#ext_dataset_zone').attr('data-i18n', '[html]app_page.section1.no_ext_dataset').styles({\n border: '3px dashed #ccc',\n color: 'rgb(204, 204, 204)',\n padding: '3px',\n 'text-align': 'center'\n }).html(_tr('app_page.section1.no_ext_dataset'));\n document.getElementById('join_section').innerHTML = '';\n}\n\n// Do some clean-up when a layer is removed\n// Most of the job is to do when it's the targeted layer which is removed in\n// order to restore functionnalities to their initial states\nfunction remove_layer_cleanup(name) {\n if (!data_manager.current_layers[name]) return;\n var layer_id = global._app.layer_to_id.get(name);\n // Making some clean-up regarding the result layer :\n if (data_manager.current_layers[name].is_result || data_manager.current_layers[name].layout_legend_displayed) {\n map.selectAll(['.lgdf_', layer_id].join('')).remove();\n }\n // Making some clean-up regarding the result layer :\n if (data_manager.result_data.hasOwnProperty(name)) {\n delete data_manager.result_data[name];\n }\n if (data_manager.current_layers[name].hasOwnProperty('key_name') && data_manager.current_layers[name].renderer && data_manager.current_layers[name].renderer.indexOf('Choropleth') < 0 && data_manager.current_layers[name].renderer.indexOf('Categorical') < 0) {\n send_remove_server(name);\n }\n // Is the layer using a filter ? If yes, remove it:\n var filter_id = map.select('#' + layer_id).attr('filter');\n if (filter_id) {\n svg_map.querySelector(filter_id.substr(4).replace(')', '')).remove();\n }\n\n // Remove the layer from the map and from the layer manager :\n map.select('#' + layer_id).remove();\n document.querySelector('#sortable .' + layer_id).remove();\n\n // Remove the layer from the \"geo export\" menu :\n var a = document.getElementById('layer_to_export').querySelector('option[value=\"' + name + '\"]');\n if (a) a.remove();\n\n // Remove the layer from the \"mask\" section if the \"smoothed map\" menu is open :\n if (global._app.current_functionnality && (global._app.current_functionnality.name === 'smooth' || global._app.current_functionnality.name === 'grid')) {\n Array.prototype.slice.call(document.querySelectorAll('.mask_field')).forEach(function (elem) {\n var aa = elem.querySelector('option[value=\"' + name + '\"]');\n if (aa) aa.remove();\n });\n }\n\n // Reset the panel displaying info on the targeted layer if she\"s the one to be removed :\n if (data_manager.current_layers[name].targeted) {\n // Unfiling the fields related to the targeted functionnality:\n if (global._app.current_functionnality) {\n (0, _function.clean_menu_function)();\n }\n\n // Update some global variables :\n data_manager.field_join_map = [];\n data_manager.user_data = {};\n global._app.targeted_layer_added = false;\n\n // Updating the top of the menu (section 1) :\n resetSection1();\n\n // Reset the projection (if the projection was defined via proj4):\n if (_app.current_proj_name === 'def_proj4') {\n _app.current_proj_name = 'NaturalEarth2';\n (0, _projections.change_projection)(_app.current_proj_name);\n (0, _projections.addLastProjectionSelect)(_app.current_proj_name);\n }\n }\n\n // There is probably better ways in JS to delete the object,\n // but in order to make it explicit that we are removing it :\n delete data_manager.current_layers[name];\n\n // Lastly remove it from the mapping 'layer name' <-> DOM id :\n if (name !== 'Graticule') {\n global._app.layer_to_id.delete(name);\n global._app.id_to_layer.delete(layer_id);\n }\n}\n\n// To bind the set of small buttons\n// (trash icon, paint icon, active/deactive visibility, info tooltip, etc..)\n// which are on each feature representing a layer in the layer manager\n// (the function is called each time that a new feature is put in this layer manager)\nfunction binds_layers_buttons(layer_name) {\n var layer_id = global._app.layer_to_id.get(layer_name);\n var sortable_elem = d3.select('#sortable').select('.' + layer_id);\n sortable_elem.on('dblclick', function () {\n (0, _layers_style_popup.handle_click_layer)(layer_name);\n });\n sortable_elem.on('contextmenu', function () {\n d3.event.preventDefault();\n });\n sortable_elem.select('#trash_button').on('click', function () {\n remove_layer(layer_name);\n });\n sortable_elem.select('.active_button').on('click', function () {\n handle_active_layer(layer_name);\n });\n sortable_elem.select('.style_button').on('click', function () {\n (0, _layers_style_popup.handle_click_layer)(layer_name);\n });\n sortable_elem.select('.style_target_layer').on('click', function () {\n (0, _layers_style_popup.handle_click_layer)(layer_name);\n });\n sortable_elem.select('#legend_button').on('click', function () {\n (0, _legend.handle_legend)(layer_name);\n });\n sortable_elem.select('#browse_data_button').on('click', function () {\n _tables.boxExplore2.create(layer_name);\n });\n sortable_elem.select('#replace_button').on('click', function () {\n ask_replace_target_layer(layer_name).then(function () {\n changeTargetLayer(layer_name);\n }, function () {\n return null;\n });\n });\n sortable_elem.select('#zoom_fit_button').on('click', function () {\n center_map(layer_name);\n (0, _map_ctrl.zoom_without_redraw)();\n });\n // TODO : re-add a tooltip when the mouse is over that sortable element ?\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/interface.js?");
-
-/***/ }),
-
-/***/ "./js/join_popup.js":
-/*!**************************!*\
- !*** ./js/join_popup.js ***!
- \**************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global, Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createJoinBox = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.valid_join_check_display = valid_join_check_display;\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction handleJoin() {\n var layer_name = Object.getOwnPropertyNames(global.data_manager.user_data);\n\n if (!(layer_name.length === 1 && global.data_manager.joined_dataset.length === 1)) {\n swal('', _tr('app_page.join_box.unable_join'), 'error');\n } else if (data_manager.field_join_map.length !== 0) {\n (0, _dialogs.make_confirm_dialog2)('dialogBox', undefined, { html_content: _tr('app_page.join_box.ask_forget_join') }).then(function (confirmed) {\n if (confirmed) {\n valid_join_check_display();\n data_manager.field_join_map = [];\n removeExistingJointure(layer_name);\n createJoinBox(layer_name[0]);\n }\n });\n } else if (global.data_manager.user_data[layer_name].length !== global.data_manager.joined_dataset[0].length) {\n (0, _dialogs.make_confirm_dialog2)('dialogBox', undefined, { html_content: _tr('app_page.join_box.ask_diff_nb_features') }).then(function (confirmed) {\n if (confirmed) {\n createJoinBox(layer_name[0]);\n }\n });\n } else {\n createJoinBox(layer_name[0]);\n }\n}\n\n/**\n* Function called to update the menu according to user operation\n* (triggered when layers/dataset are added and after a join operation)\n* @param {bool} val - ...\n* @param {Array} prop - The proportion of joined features\n* @return {void}\n*/\nfunction valid_join_check_display(val, prop) {\n if (!val) {\n var extDatasetImg = document.getElementById('img_data_ext');\n extDatasetImg.setAttribute('src', 'static/img/b/joinfalse.png');\n extDatasetImg.setAttribute('alt', 'Non-validated join');\n extDatasetImg.style.width = '28px';\n extDatasetImg.style.height = '28px';\n extDatasetImg.onclick = handleJoin;\n\n var joinSec = document.getElementById('join_section');\n joinSec.innerHTML = [prop, _tr('app_page.join_box.state_not_joined')].join('');\n\n var button = document.createElement('button');\n button.setAttribute('id', 'join_button');\n button.style.display = 'inline';\n button.innerHTML = '' + _tr('app_page.join_box.button_join') + ' ';\n button.onclick = handleJoin;\n joinSec.appendChild(button);\n } else {\n var _extDatasetImg = document.getElementById('img_data_ext');\n _extDatasetImg.setAttribute('src', 'static/img/b/jointrue.png');\n _extDatasetImg.setAttribute('alt', 'Validated join');\n _extDatasetImg.style.width = '28px';\n _extDatasetImg.style.height = '28px';\n _extDatasetImg.onclick = null;\n\n var _prop$split$map = prop.split('/').map(function (d) {\n return +d;\n }),\n _prop$split$map2 = _slicedToArray(_prop$split$map, 1),\n v1 = _prop$split$map2[0];\n\n var _joinSec = document.getElementById('join_section');\n _joinSec.innerHTML = [' ', prop, _tr('app_page.join_box.match', { count: v1 }), ' '].join(' ');\n\n var _button = document.createElement('button');\n _button.setAttribute('id', 'join_button');\n _button.style.display = 'inline';\n _button.innerHTML = [' - ', _tr('app_page.join_box.change_field'), ' '].join('');\n _button.onclick = handleJoin;\n _joinSec.appendChild(_button);\n }\n}\n\nfunction valid_join_on(layer_name, join_values1, join_values2, field1, field2, hits) {\n var ext_dataset = global.data_manager.joined_dataset[0];\n var layer_dataset = global.data_manager.user_data[layer_name];\n var prop = [hits, '/', join_values1.length].join('');\n var f_name = '';\n var val = void 0;\n\n if (hits >= join_values1.length) {\n swal({\n title: '',\n text: _tr('app_page.common.success'),\n type: 'success',\n allowOutsideClick: true\n });\n var fields_name_to_add = Object.getOwnPropertyNames(ext_dataset[0]);\n for (var i = 0, len = join_values1.length; i < len; i++) {\n val = data_manager.field_join_map[i];\n for (var j = 0, leng = fields_name_to_add.length; j < leng; j++) {\n f_name = fields_name_to_add[j];\n if (f_name.length > 0) {\n layer_dataset[i][f_name] = ext_dataset[val][f_name];\n }\n }\n }\n valid_join_check_display(true, prop);\n return Promise.resolve(true);\n } else if (hits > 0) {\n return swal({\n title: _tr('app_page.common.confirm') + '!',\n text: _tr('app_page.join_box.partial_join', { ratio: prop }),\n allowOutsideClick: false,\n allowEscapeKey: true,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.yes'),\n cancelButtonText: _tr('app_page.common.no')\n }).then(function () {\n var fields_name_to_add = Object.getOwnPropertyNames(ext_dataset[0]);\n for (var _i = 0, _len = data_manager.field_join_map.length; _i < _len; _i++) {\n val = data_manager.field_join_map[_i];\n for (var _j = 0, _leng = fields_name_to_add.length; _j < _leng; _j++) {\n f_name = fields_name_to_add[_j];\n if (f_name.length > 0) {\n // let t_val;\n // if (val == undefined) t_val = null; // eslint-disable-line\n // else if (ext_dataset[val][f_name] === '') t_val = null;\n // else t_val = ext_dataset[val][f_name];\n layer_dataset[_i][f_name] = val != undefined ? ext_dataset[val][f_name] : null; // eslint-disable-line\n }\n }\n }\n return swal({\n title: _tr('app_page.common.confirm') + '!',\n text: _tr('app_page.join_box.delete_not_join'),\n allowOutsideClick: false,\n allowEscapeKey: true,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.yes'),\n cancelButtonText: _tr('app_page.common.no')\n }).then(function () {\n var k = Object.keys(_target_layer_file.objects);\n var geoms = _target_layer_file.objects[k[0]].geometries;\n var temp1 = [];\n var temp2 = [];\n for (var _i2 = 0; _i2 < layer_dataset.length; _i2++) {\n if (data_manager.field_join_map[_i2] !== undefined) {\n temp1.push(layer_dataset[_i2]);\n temp2.push(geoms[_i2]);\n }\n }\n global.data_manager.user_data[layer_name] = temp1;\n _target_layer_file.objects[k[0]].geometries = temp2;\n (0, _interface.updateLayer)(layer_name);\n valid_join_check_display(true, [global.data_manager.user_data[layer_name].length, global.data_manager.user_data[layer_name].length].join('/'));\n var formToSend = new FormData();\n var json_layer = (0, _helpers.path_to_geojson2)(layer_name);\n formToSend.append('geojson', json_layer);\n formToSend.append('layer_name', layer_name);\n (0, _helpers.xhrequest)('POST', '/layers/add', formToSend, false).then(function (e) {\n data_manager.current_layers[layer_name].key_name = JSON.parse(e).key;\n }).catch(function (err) {\n (0, _helpers.display_error_during_computation)();\n console.log(err);\n });\n return Promise.resolve(true);\n }, function () {\n valid_join_check_display(true, prop);\n return Promise.resolve(true);\n });\n }, function () {\n data_manager.field_join_map = [];\n return Promise.resolve(false);\n });\n }\n swal('', _tr('app_page.join_box.no_match', { field1: field1, field2: field2 }), 'error');\n data_manager.field_join_map = [];\n return Promise.resolve(false);\n}\n\n// Where the real join is done\n// Its two main results are:\n// -the update of the global \"data_manager.field_join_map\" array\n// (storing the relation between index of the geometry\n// layer and index of the external dataset)\n// -the update of the global \"data_manager.user_data\" object, adding actualy the value\n// to each object representing each feature of the layer\nfunction prepare_join_on(layer_name, field1, field2) {\n var join_values1 = [],\n join_values2 = [];\n var layer_dataset = global.data_manager.user_data[layer_name];\n var ext_dataset = global.data_manager.joined_dataset[0];\n var nb_features = layer_dataset.length;\n var hits = 0;\n var val = void 0;\n\n data_manager.field_join_map = [];\n\n for (var i = 0, len = ext_dataset.length; i < len; i++) {\n join_values2.push(ext_dataset[i][field2]);\n }\n for (var _i3 = 0, _len2 = layer_dataset.length; _i3 < _len2; _i3++) {\n join_values1.push(layer_dataset[_i3][field1]);\n }\n if ((0, _helpers_calc.has_duplicate)(join_values1) || (0, _helpers_calc.has_duplicate)(join_values2)) {\n return swal('', _tr('app_page.join_box.error_not_uniques'), 'warning');\n }\n if (nb_features > 5000) {\n _app.waitingOverlay.display();\n var jointure_worker = new Worker('static/dist/webworker_jointure.js');\n _app.webworker_to_cancel = jointure_worker;\n jointure_worker.postMessage([join_values1, join_values2]);\n jointure_worker.onmessage = function jointure_worker_onmessage(e) {\n var _e$data = _slicedToArray(e.data, 2),\n join_map = _e$data[0],\n _hits = _e$data[1];\n\n _app.webworker_to_cancel = undefined;\n hits = _hits;\n data_manager.field_join_map = join_map;\n _app.waitingOverlay.hide();\n valid_join_on(layer_name, join_values1, join_values2, field1, field2, hits).then(function (valid) {\n jointure_worker.terminate();\n if (valid) (0, _helpers.make_box_type_fields)(layer_name);\n });\n };\n } else {\n if (typeof join_values1[0] === 'number' && typeof join_values2[0] === 'string') {\n for (var _i4 = 0; _i4 < nb_features; _i4++) {\n val = join_values2.indexOf(String(join_values1[_i4]));\n if (val !== -1) {\n data_manager.field_join_map.push(val);\n hits += 1;\n } else {\n data_manager.field_join_map.push(undefined);\n }\n }\n } else if (typeof join_values2[0] === 'number' && typeof join_values1[0] === 'string') {\n for (var _i5 = 0; _i5 < nb_features; _i5++) {\n val = join_values2.indexOf(Number(join_values1[_i5]));\n if (val !== -1) {\n data_manager.field_join_map.push(val);\n hits += 1;\n } else {\n data_manager.field_join_map.push(undefined);\n }\n }\n } else if (typeof join_values2[0] === 'number' && typeof join_values1[0] === 'number') {\n for (var _i6 = 0; _i6 < nb_features; _i6++) {\n val = join_values2.indexOf(join_values1[_i6]);\n if (val !== -1) {\n data_manager.field_join_map.push(val);\n hits += 1;\n } else {\n data_manager.field_join_map.push(undefined);\n }\n }\n } else {\n for (var _i7 = 0; _i7 < nb_features; _i7++) {\n val = join_values2.indexOf(String(join_values1[_i7]));\n if (val !== -1) {\n data_manager.field_join_map.push(val);\n hits += 1;\n } else {\n data_manager.field_join_map.push(undefined);\n }\n }\n }\n valid_join_on(layer_name, join_values1, join_values2, field1, field2, hits).then(function (valid) {\n if (valid) (0, _helpers.make_box_type_fields)(layer_name);\n });\n }\n}\n// Function creating the join box, filled by two \"select\" input, one containing\n// the field names of the geometry layer, the other one containing those from\n// the external dataset, in order to let the user choose the common field to do\n// the join.\nvar createJoinBox = exports.createJoinBox = function createJoinBox(layer) {\n var geom_layer_fields = [].concat(_toConsumableArray(data_manager.current_layers[layer].original_fields.keys()));\n var ext_dataset_fields = Object.getOwnPropertyNames(global.data_manager.joined_dataset[0][0]);\n var options_fields_layer = [];\n var options_fields_ext_dataset = [];\n var lastChoice = { field1: geom_layer_fields[0], field2: ext_dataset_fields[0] };\n\n for (var i = 0, len = geom_layer_fields.length; i < len; i++) {\n options_fields_layer.push('' + geom_layer_fields[i] + ' ');\n }\n\n for (var _i8 = 0, _len3 = ext_dataset_fields.length; _i8 < _len3; _i8++) {\n if (ext_dataset_fields[_i8].length > 0) {\n options_fields_ext_dataset.push('' + ext_dataset_fields[_i8] + ' ');\n }\n }\n\n var inner_box = '' + _tr('app_page.join_box.select_fields') + '
\\n\\n
' + _tr('app_page.join_box.geom_layer_field') + '
\\n
(' + layer + ')
\\n
' + options_fields_layer.join('') + ' \\n
\\n\\n
' + _tr('app_page.join_box.ext_dataset_field') + '
\\n
(' + data_manager.dataset_name + '.csv)
\\n
' + options_fields_ext_dataset.join('') + ' \\n
\\n\\n ' + _tr('app_page.join_box.ask_join') + ' \\n
';\n\n (0, _dialogs.make_confirm_dialog2)('joinBox', _tr('app_page.join_box.title'), { html_content: inner_box, widthFitContent: true }).then(function (confirmed) {\n if (confirmed) {\n prepare_join_on(layer, lastChoice.field1, lastChoice.field2);\n }\n });\n\n d3.select('.joinBox').styles({ 'text-align': 'center', 'line-height': '0.9em' });\n\n d3.select('#button_field1').on('change', function () {\n lastChoice.field1 = this.value;\n });\n\n d3.select('#button_field2').on('change', function () {\n lastChoice.field2 = this.value;\n });\n};\n\nvar removeExistingJointure = function removeExistingJointure(layer_name) {\n var user_data = global.data_manager.user_data;\n\n if (!user_data[layer_name] || user_data[layer_name].length < 1) return;\n var dataLayer = user_data[layer_name];\n var original_fields = global.data_manager.current_layers[layer_name];\n var fieldDifference = Object.getOwnPropertyNames(dataLayer[0]).filter(function (f) {\n return !original_fields.has(f);\n });\n var nbFields = fieldDifference.length;\n for (var i = 0, nbFt = dataLayer.length; i < nbFt; i++) {\n for (var j = 0; j < nbFields; j++) {\n delete dataLayer[i][fieldDifference[j]];\n }\n }\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\"), __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/join_popup.js?");
-
-/***/ }),
-
-/***/ "./js/layers.js":
-/*!**********************!*\
- !*** ./js/layers.js ***!
- \**********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.add_sample_layer = add_sample_layer;\nexports.add_layer_topojson = add_layer_topojson;\n\nvar _proj2 = __webpack_require__(/*! proj4 */ \"./node_modules/proj4/lib/index.js\");\n\nvar _proj3 = _interopRequireDefault(_proj2);\n\nvar _topojson = __webpack_require__(/*! topojson */ \"./node_modules/topojson/index.js\");\n\nvar topojson = _interopRequireWildcard(_topojson);\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _function = __webpack_require__(/*! ./function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _join_popup = __webpack_require__(/*! ./join_popup */ \"./js/join_popup.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _projections = __webpack_require__(/*! ./projections */ \"./js/projections.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n* Function to display the dialog allowing the choose and add a sample target layer.\n*\n* @return {void}\n*/\nfunction add_sample_layer() {\n var prepare_extra_dataset_availables = function prepare_extra_dataset_availables() {\n (0, _helpers.request_data)('GET', 'extrabasemaps').then(function (result) {\n _app.list_extrabasemaps = JSON.parse(result.target.responseText).filter(function (elem) {\n return elem[0] !== 'Tunisia';\n });\n });\n };\n (0, _dialogs.check_remove_existing_box)('.sampleDialogBox');\n if (!_app.list_extrabasemaps) {\n prepare_extra_dataset_availables();\n }\n\n var selec = void 0;\n var selec_url = void 0;\n var content = void 0;\n\n (0, _dialogs.make_confirm_dialog2)('sampleDialogBox', _tr('app_page.sample_layer_box.title')).then(function (confirmed) {\n if (confirmed) {\n (0, _interface.askTypeLayer)().then(function (_type_layer) {\n var target_layer = _type_layer.indexOf('target') > -1;\n if (content.attr('id') === 'panel1') {\n if (selec) {\n var layer_info = _app.sample_layers.find(function (_o) {\n return _o.name === selec;\n });\n add_sample_geojson(selec, {\n target_layer_on_add: target_layer,\n fields_type: layer_info['fields_type'], // Can be undefined\n default_projection: layer_info['suggested_projection'] // Can be undefined\n });\n }\n } else if (content.attr('id') === 'panel2') {\n var formToSend = new FormData();\n formToSend.append('url', selec_url[1]);\n formToSend.append('layer_name', selec_url[0]);\n (0, _helpers.xhrequest)('POST', '/convert_extrabasemap', formToSend, true).then(function (data) {\n add_layer_topojson(data, { target_layer_on_add: target_layer });\n }, function () {\n (0, _helpers.display_error_during_computation)();\n });\n }\n }, function (dismiss) {\n console.log(dismiss);\n });\n }\n });\n\n function make_panel2() {\n box_body.selectAll('div').remove();\n content = box_body.append('div').attr('id', 'panel2');\n content.append('h3').html(_tr('app_page.sample_layer_box.subtitle1'));\n content.append('p').append('span').html(_tr('app_page.sample_layer_box.extra_basemaps_info'));\n var select_extrabasemap = content.append('p').insert('select').on('change', function () {\n var id_elem = this.value;\n selec_url = [_app.list_extrabasemaps[id_elem][0], _app.list_extrabasemaps[id_elem][1], id_elem];\n });\n for (var i = 0, len_i = _app.list_extrabasemaps.length; i < len_i; i++) {\n select_extrabasemap.append('option').attr('value', i).html(_app.list_extrabasemaps[i][0]);\n }\n content.append('p').styles({ margin: 'auto', 'text-align': 'right', cursor: 'pointer' }).append('span').html(_tr('app_page.sample_layer_box.back_sample')).on('click', function () {\n make_panel1();\n });\n if (selec_url) {\n (0, _helpers.setSelected)(select_extrabasemap.node(), selec_url[2]);\n } else {\n selec_url = [_app.list_extrabasemaps[0][0], _app.list_extrabasemaps[0][1], 0];\n }\n content.select('#link1').on('click', function () {\n window.open('http://www.naturalearthdata.com', 'Natural Earth', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n });\n content.select('#link2').on('click', function () {\n window.open('https://github.com/riatelab/basemaps/tree/master/Countries', 'riatelab/basemaps', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n });\n }\n\n function make_panel1() {\n box_body.selectAll('div').remove();\n content = box_body.append('div').attr('id', 'panel1');\n content.append('h3').html(_tr('app_page.sample_layer_box.subtitle1'));\n\n var t_layer_selec = content.append('p').html('').insert('select').attr('class', 'sample_target').on('change', function () {\n selec = this.value;\n });\n\n t_layer_selec.append('option').attr('value', '').html(_tr('app_page.sample_layer_box.layer'));\n\n _app.sample_layers.forEach(function (layer_info) {\n var n = layer_info['name'];\n t_layer_selec.append('option').attr('value', n).html(_tr('app_page.sample_layer_box.' + n));\n });\n\n content.append('p').styles({ margin: 'auto', 'text-align': 'right', cursor: 'pointer' }).append('span').html(_tr('app_page.sample_layer_box.more_basemaps')).on('click', function () {\n make_panel2();\n });\n\n if (selec) {\n (0, _helpers.setSelected)(t_layer_selec.node(), selec);\n }\n }\n\n var container = d3.select('.sampleDialogBox').styles({ width: '625px', display: 'flex' });\n container.select('.modal-content').style('width', '625px');\n var box_body = container.select('.modal-body');\n setTimeout(function () {\n document.querySelector('select.sample_target').focus();\n }, 500);\n make_panel1();\n}\n\nfunction add_sample_geojson(name, options) {\n var formToSend = new FormData();\n formToSend.append('layer_name', name);\n (0, _helpers.xhrequest)('POST', 'sample', formToSend, true).then(function (data) {\n add_layer_topojson(data, options);\n }).catch(function (err) {\n (0, _helpers.display_error_during_computation)();\n console.log(err);\n });\n}\n\n/**\n* Add a TopoJSON layer to the 'svg' element.\n*\n* @param {String} text - the text content to be parsed as a JS object.\n* @param {Object} url - options regarding the layer to be added (such as wether\n* skipping the 'success' alert or not, which name to use for the layer, etc.).\n* @return {String} The actual name of the layer once added, or `undefined` if\n* something went wrong.\n*/\nfunction add_layer_topojson(text) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var _isValidJSON = (0, _helpers.isValidJSON)(text),\n _isValidJSON2 = _slicedToArray(_isValidJSON, 2),\n valid = _isValidJSON2[0],\n parsedJSON = _isValidJSON2[1];\n // If JSON.parse failed:\n\n\n if (!valid) {\n (0, _helpers.display_error_during_computation)('Unable to load the layer');\n return;\n }\n // Server returns a JSON reponse like {\"Error\":\"The error\"}\n // if something went bad during the conversion:\n if (parsedJSON.Error) {\n (0, _helpers.display_error_during_computation)(parsedJSON.Error);\n return;\n }\n\n var result_layer_on_add = options.result_layer_on_add ? true : false,\n target_layer_on_add = options.target_layer_on_add ? true : false,\n skip_alert = options.skip_alert ? true : false,\n skip_rescale = options.skip_rescale === true ? true : false,\n fields_type = options.fields_type ? options.fields_type : undefined;\n var topoObj = parsedJSON.file.transform ? parsedJSON.file : topojson.quantize(parsedJSON.file, 1e5);\n var layers_names = Object.getOwnPropertyNames(topoObj.objects);\n var random_color1 = _colors_helpers.ColorsSelected.random();\n var lyr_name = layers_names[0];\n var lyr_name_to_add = (0, _function.check_layer_name)(options.choosed_name ? options.choosed_name : lyr_name);\n var lyr_id = encodeId(lyr_name_to_add);\n var nb_ft = topoObj.objects[lyr_name].geometries.length;\n var topoObj_objects = topoObj.objects[lyr_name];\n var data_to_load = false;\n var type = void 0,\n _proj = void 0;\n\n // We don't allow multiple layer to be added at the same time, so the TopoJSON\n // file we are handling is supposed to only contains one layer. If it's not\n // the case, a warning is displayed and only the first layer is added to the svg.\n if (layers_names.length > 1) {\n swal('', _tr('app_page.common.warning_multiple_layers'), 'warning');\n }\n\n // Abort if the layer is empty (doesn't contains any feature)\n if (!topoObj_objects.geometries || topoObj_objects.geometries.length === 0) {\n (0, _helpers.display_error_during_computation)(_tr('app_page.common.error_invalid_empty'));\n return;\n }\n\n // \"Register\" the layer name in the UI and it's corresponding id on the DOM :\n _app.layer_to_id.set(lyr_name_to_add, lyr_id);\n _app.id_to_layer.set(lyr_id, lyr_name_to_add);\n\n for (var _t_ix = 0; _t_ix < nb_ft; _t_ix++) {\n if (topoObj_objects.geometries[_t_ix] && topoObj_objects.geometries[_t_ix].type) {\n if (topoObj_objects.geometries[_t_ix].type.indexOf('Point') > -1) type = 'Point';else if (topoObj_objects.geometries[_t_ix].type.indexOf('LineString') > -1) type = 'Line';else if (topoObj_objects.geometries[_t_ix].type.indexOf('Polygon') > -1) type = 'Polygon';\n break;\n }\n }\n\n // Abort if the layer doesn't contains any feature with a geometry type within\n // \"Point\", \"MultiPoint\", \"LineString\", \"MultiLineString\", \"Polygon\", \"MultiPolygon\"\n if (!type) {\n (0, _helpers.display_error_during_computation)(_tr('app_page.common.error_invalid_empty'));\n return;\n }\n\n // Some special operations if this is the first layer to be added:\n if (data_manager.current_layers.World && data_manager.current_layers.World.default_layer) {\n // Remove the 'world' layout layer displayed when the application starts:\n (0, _interface.remove_layer_cleanup)('World');\n }\n\n // Read the projection information provided with the layer, if any:\n if (parsedJSON.proj) {\n try {\n _proj = (0, _proj3.default)(parsedJSON.proj);\n } catch (e) {\n _proj = undefined;\n console.log(e);\n }\n }\n\n data_manager.current_layers[lyr_name_to_add] = {\n type: type,\n n_features: nb_ft,\n 'stroke-width-const': type === 'Line' ? 1.5 : 0.4,\n fill_color: { single: random_color1 },\n key_name: parsedJSON.key\n };\n\n if (target_layer_on_add) {\n data_manager.current_layers[lyr_name_to_add].targeted = true;\n data_manager.user_data[lyr_name_to_add] = [];\n data_to_load = true;\n data_manager.current_layers[lyr_name_to_add].fields_type = [];\n } else if (result_layer_on_add) {\n data_manager.result_data[lyr_name_to_add] = [];\n data_manager.current_layers[lyr_name_to_add].is_result = true;\n }\n\n var field_names = topoObj_objects.geometries[0].properties ? Object.getOwnPropertyNames(topoObj_objects.geometries[0].properties) : [];\n var path_to_use = options.pointRadius ? path.pointRadius(options.pointRadius) : path;\n var nb_fields = field_names.length;\n topoObj_objects.geometries.forEach(function (d, ix) {\n if (data_to_load && nb_fields > 0) {\n if (d.id !== undefined && d.id !== ix) {\n d.properties._uid = d.id; // eslint-disable-line no-param-reassign\n d.id = +ix; // eslint-disable-line no-param-reassign\n } else if (!d.id) {\n d.id = +ix; // eslint-disable-line no-param-reassign\n }\n data_manager.user_data[lyr_name_to_add].push(d.properties);\n } else if (data_to_load) {\n d.properties.id = d.id = ix; // eslint-disable-line no-param-reassign, no-multi-assign\n data_manager.user_data[lyr_name_to_add].push({ id: d.properties.id });\n } else if (result_layer_on_add) {\n data_manager.result_data[lyr_name_to_add].push(d.properties);\n }\n });\n\n var func_data_idx = function func_data_idx(_, ix) {\n return 'feature_' + ix;\n };\n\n map.insert('g', '.legend').attrs({ id: lyr_id, class: data_to_load ? 'targeted_layer layer' : 'layer' }).styles({ 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }).selectAll('.subunit').data(topojson.feature(topoObj, topoObj_objects).features, function (d) {\n return d.id;\n }).enter().append('path').attrs({ d: path_to_use, id: func_data_idx }).styles({\n stroke: type !== 'Line' ? 'rgb(0, 0, 0)' : random_color1,\n 'stroke-opacity': 1,\n fill: type !== 'Line' ? random_color1 : null,\n 'fill-opacity': type !== 'Line' ? 0.90 : 0\n });\n d3.select('#layer_to_export').append('option').attr('value', lyr_name_to_add).text(lyr_name_to_add);\n (0, _interface.update_section1_layout)();\n if (target_layer_on_add) {\n data_manager.current_layers[lyr_name_to_add].original_fields = new Set(Object.getOwnPropertyNames(data_manager.user_data[lyr_name_to_add][0]));\n if (data_manager.joined_dataset.length !== 0) {\n (0, _join_popup.valid_join_check_display)(false);\n }\n (0, _interface.update_section1)(type, nb_fields, nb_ft, lyr_name_to_add);\n (0, _helpers.create_li_layer_elem)(lyr_name_to_add, nb_ft, type, 'target');\n _app.targeted_layer_added = true;\n window._target_layer_file = topoObj;\n if (!skip_rescale) {\n (0, _interface.scale_to_lyr)(lyr_name_to_add);\n (0, _interface.center_map)(lyr_name_to_add);\n }\n if (_app.current_functionnality !== undefined) {\n fields_handler.fill(lyr_name_to_add);\n }\n (0, _interface.handle_click_hand)('lock');\n\n // If the target layer is a point layer, slightly change the tooltip for the \"grid\"\n // functionnality:\n document.getElementById('button_grid').setAttribute('data-i18n', type === 'Point' ? '[title]app_page.func_description.grid_point' : '[title]app_page.func_description.grid');\n localize('#button_grid');\n } else if (result_layer_on_add) {\n (0, _helpers.create_li_layer_elem)(lyr_name_to_add, nb_ft, [type, options.func_name], 'result');\n } else {\n (0, _helpers.create_li_layer_elem)(lyr_name_to_add, nb_ft, type, '');\n }\n\n if (!target_layer_on_add && _app.current_functionnality !== undefined && (_app.current_functionnality.name === 'smooth' || _app.current_functionnality.name === 'grid')) {\n fields_handler.fill();\n }\n\n if (type === 'Point') {\n data_manager.current_layers[lyr_name_to_add].pointRadius = options.pointRadius || path.pointRadius();\n }\n\n // layers_listed.insertBefore(li, layers_listed.childNodes[0]);\n (0, _projections.handleClipPath)(_app.current_proj_name);\n (0, _interface.binds_layers_buttons)(lyr_name_to_add);\n if (!skip_rescale) {\n (0, _map_ctrl.zoom_without_redraw)();\n }\n\n // An alert is triggered when the layer is successfully added, except if\n // 'skip_alert' is false.\n // That \"success\" alert guide the user through other message; one for typing it's\n // data fields, on other (optionnal) for making the jointure between it's layer\n // and it's tabular dataset and another one (optional too)\n // to allow him to use the projection originally provided with the layer.\n if (!skip_alert) {\n if (fields_type) {\n data_manager.current_layers[lyr_name_to_add].fields_type = fields_type;\n }\n\n // No projection was provided with the layer\n if (_proj === undefined) {\n // if (_proj === undefined || !target_layer_on_add) {\n swal({\n title: '',\n text: _tr('app_page.common.layer_success'),\n allowOutsideClick: true,\n allowEscapeKey: true,\n type: 'success'\n }).then(function () {\n if (target_layer_on_add && data_manager.joined_dataset.length > 0) {\n (0, _interface.ask_join_now)(lyr_name_to_add);\n } else if (target_layer_on_add) {\n (0, _helpers.make_box_type_fields)(lyr_name_to_add);\n }\n }, function () {\n if (target_layer_on_add && data_manager.joined_dataset.length > 0) {\n (0, _interface.ask_join_now)(lyr_name_to_add);\n } else if (target_layer_on_add) {\n (0, _helpers.make_box_type_fields)(lyr_name_to_add);\n }\n });\n } else {\n // A projection was provided with the layer:\n swal({\n title: '',\n text: _tr('app_page.common.layer_success_and_proj'),\n showCancelButton: true,\n showCloseButton: false,\n allowEscapeKey: true,\n allowOutsideClick: true,\n type: 'success'\n }).then(function () {\n _app.last_projection = parsedJSON.proj;\n _app.current_proj_name = 'def_proj4';\n (0, _projections.change_projection_4)(_proj);\n var custom_name = (0, _projections.tryFindNameProj)(_app.last_projection);\n (0, _projections.addLastProjectionSelect)('def_proj4', _app.last_projection, custom_name);\n if (target_layer_on_add && data_manager.joined_dataset.length > 0) {\n (0, _interface.ask_join_now)(lyr_name_to_add);\n } else if (target_layer_on_add) {\n (0, _helpers.make_box_type_fields)(lyr_name_to_add);\n }\n }, function () {\n if (target_layer_on_add && data_manager.joined_dataset.length > 0) {\n (0, _interface.ask_join_now)(lyr_name_to_add);\n } else if (target_layer_on_add) {\n (0, _helpers.make_box_type_fields)(lyr_name_to_add);\n }\n });\n }\n }\n\n if (options.default_projection) {\n // We are also storing this information for later use if the user promotes/downgrade\n // some lmayers:\n data_manager.current_layers[lyr_name_to_add].default_projection = options.default_projection;\n if (options.target_layer_on_add) {\n // The 'default_projection' property is used for providing a custom projection\n // with our sample layer (it use a separate path compared to the previous\n // block of code, in order to not let the choice to the user)\n if (options.default_projection[0] === 'proj4') {\n var proj_str = options.default_projection[1];\n var custom_name = void 0;\n if (proj_str.startsWith('EPSG:')) {\n var code = +proj_str.split('EPSG:')[1];\n var rv = _app.epsg_projections[code];\n proj_str = rv.proj4;\n custom_name = rv.name;\n }\n _app.current_proj_name = 'def_proj4';\n _app.last_projection = proj_str;\n (0, _projections.change_projection_4)((0, _proj3.default)(proj_str));\n (0, _projections.addLastProjectionSelect)('def_proj4', _app.last_projection, custom_name);\n } else if (options.default_projection[0] === 'd3') {\n _app.current_proj_name = options.default_projection[1];\n (0, _projections.change_projection)(options.default_projection[1]);\n (0, _projections.addLastProjectionSelect)(_app.current_proj_name);\n }\n }\n } else if (parsedJSON.proj) {\n // We are also storing informations about the projection read from the .proj file\n // if any:\n data_manager.current_layers[lyr_name_to_add].default_projection = ['proj4', parsedJSON.proj];\n }\n return lyr_name_to_add;\n}\n\n//# sourceURL=webpack:///./js/layers.js?");
-
-/***/ }),
-
-/***/ "./js/layers_style_popup.js":
-/*!**********************************!*\
- !*** ./js/layers_style_popup.js ***!
- \**********************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createDropShadow = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.handle_click_layer = handle_click_layer;\nexports.make_style_box_indiv_label = make_style_box_indiv_label;\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _discretization_panel = __webpack_require__(/*! ./classification/discretization_panel */ \"./js/classification/discretization_panel.js\");\n\nvar _categorical_panel = __webpack_require__(/*! ./classification/categorical_panel */ \"./js/classification/categorical_panel.js\");\n\nvar _discrtiz_links_discont = __webpack_require__(/*! ./classification/discrtiz_links_discont */ \"./js/classification/discrtiz_links_discont.js\");\n\nvar _fonts = __webpack_require__(/*! ./fonts */ \"./js/fonts.js\");\n\nvar _function = __webpack_require__(/*! ./function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _tables = __webpack_require__(/*! ./tables */ \"./js/tables.js\");\n\n/**\n* Function to dispatch the click on the \"open style box\" icon\n* to the actual appropriate function according to the type of the layer.\n*\n* @param {String} layer_name - The name of the layer.\n* @return {void} - Nothing is returned but the \"style box\" should open.\n*\n*/\nfunction handle_click_layer(layer_name) {\n if (data_manager.current_layers[layer_name].graticule) {\n createStyleBoxGraticule();\n } else if (data_manager.current_layers[layer_name].type === 'Line') {\n createStyleBox_Line(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer.indexOf('PropSymbol') > -1) {\n createStyleBox_ProbSymbol(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'Label') {\n createStyleBoxLabel(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'TypoSymbols') {\n createStyleBoxTypoSymbols(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer && data_manager.current_layers[layer_name].renderer === 'TwoStocksWaffle') {\n createStyleBoxWaffle(layer_name);\n } else if (data_manager.current_layers[layer_name].renderer === 'Stewart') {\n createStyleBoxStewart(layer_name);\n } else {\n createStyleBox(layer_name);\n }\n}\n\nfunction make_single_color_menu(layer, fill_prev) {\n var symbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'path';\n\n var fill_color_section = d3.select('#fill_color_section'),\n g_lyr_name = '#' + _app.layer_to_id.get(layer),\n last_color = fill_prev && fill_prev.single ? fill_prev.single : '#FFF';\n var block = fill_color_section.insert('p');\n block.insert('span').html(_tr('app_page.layer_style_popup.fill_color'));\n block.insert('input').attr('type', 'color').style('float', 'right').property('value', last_color).on('change', function () {\n map.select(g_lyr_name).selectAll(symbol).transition().style('fill', this.value);\n data_manager.current_layers[layer].fill_color = { single: this.value };\n });\n map.select(g_lyr_name).selectAll(symbol).transition().style('fill', last_color);\n data_manager.current_layers[layer].fill_color = { single: last_color };\n}\n\nfunction make_random_color(layer) {\n var symbol = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'path';\n\n var block = d3.select('#fill_color_section');\n block.insert('p').styles({ cursor: 'pointer', 'text-align': 'center', margin: 'auto !important' }).insert('span').attr('id', 'random_color_btn').html(_tr('app_page.layer_style_popup.toggle_colors')).on('click', function () {\n map.select('#' + _app.layer_to_id.get(layer)).selectAll(symbol).transition().style('fill', function () {\n return (0, _colors_helpers.randomColor)();\n }); // Colors.names[Colors.random()]);\n data_manager.current_layers[layer].fill_color = { random: true };\n });\n}\n\nfunction fill_categorical(layer, field_name, symbol, color_cat_map) {\n map.select('#' + _app.layer_to_id.get(layer)).selectAll(symbol).transition().style('fill', function (d) {\n return color_cat_map.get(d.properties[field_name]);\n });\n}\n\nfunction make_categorical_color_menu(fields, layer, fill_prev) {\n var symbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'path';\n\n var fill_color_section = d3.select('#fill_color_section').append('p');\n fill_color_section.insert('span').html(_tr('app_page.layer_style_popup.categorical_field'));\n var field_selec = fill_color_section.insert('select').styles({ display: 'inline', float: 'right' });\n fields.forEach(function (field) {\n if (field !== 'id') field_selec.append('option').text(field).attr('value', field);\n });\n if (fill_prev.categorical && fill_prev.categorical instanceof Array) {\n (0, _helpers.setSelected)(field_selec.node(), fill_prev.categorical[0]);\n }\n field_selec.on('change', function () {\n var field_name = this.value,\n data_layer = data_manager.current_layers[layer].is_result ? data_manager.result_data[layer] : data_manager.user_data[layer],\n values = data_layer.map(function (i) {\n return i[field_name];\n }),\n cats = new Set(values),\n txt = [cats.size, ' cat.'].join('');\n d3.select('#nb_cat_txt').html(txt);\n var color_cat_map = new Map();\n Array.from(cats.keys()).forEach(function (val) {\n color_cat_map.set(val, _colors_helpers.Colors.names[_colors_helpers.Colors.random()]);\n });\n data_manager.current_layers[layer].fill_color = { categorical: [field_name, color_cat_map] };\n fill_categorical(layer, field_name, symbol, color_cat_map);\n });\n\n if ((!fill_prev || !fill_prev.categorical) && field_selec.node().options.length > 0) {\n (0, _helpers.setSelected)(field_selec.node(), field_selec.node().options[0].value);\n }\n fill_color_section.append('span').attr('id', 'nb_cat_txt').html('');\n}\n\n/**\n* Function to create the input section allowing to change the name of a layer.\n* (Used by all the createStyleBox_xxx functions)\n*\n* @param {Object} parent - A d3 selection corresponding to the parent box.\n* @param {String} layer_name - The current name of layer edited in the style box.\n* @return {Object} - The d3 selection corresponding to the input element created.\n*/\nfunction make_change_layer_name_section(parent, layer_name) {\n var section = parent.insert('p').attr('class', 'inp_bottom');\n section.append('span').html(_tr('app_page.layer_style_popup.layer_name'));\n var inpt = section.append('input').attrs({ id: 'lyr_change_name', type: 'text' }).styles({ width: '200px', float: 'left' });\n inpt.node().value = layer_name;\n return inpt;\n}\n\nfunction createStyleBoxTypoSymbols(layer_name) {\n function get_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n prev_settings.push({\n display: features[i].style.display ? features[i].style.display : null,\n size: features[i].getAttribute('width'),\n position: [features[i].getAttribute('x'), features[i].getAttribute('y')]\n });\n }\n prev_settings_defaults.size = data_manager.current_layers[layer_name].default_size;\n }\n\n var restore_prev_settings = function restore_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n features[i].setAttribute('width', prev_settings[i].size);\n features[i].setAttribute('height', prev_settings[i].size);\n features[i].setAttribute('x', prev_settings[i].position[0]);\n features[i].setAttribute('y', prev_settings[i].position[1]);\n features[i].style.display = prev_settings[i].display;\n }\n data_manager.current_layers[layer_name].default_size = prev_settings_defaults.size;\n };\n\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n\n var selection = map.select('#' + _app.layer_to_id.get(layer_name)).selectAll('image'),\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n symbols_map = data_manager.current_layers[layer_name].symbols_map,\n rendered_field = data_manager.current_layers[layer_name].rendered_field;\n\n var prev_settings = [],\n prev_settings_defaults = {};\n // const zs = d3.zoomTransform(svg_map).k;\n\n get_prev_settings();\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n restore_prev_settings();\n } else if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_symbols_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var centroid = path.centroid(d.geometry),\n size_symbol = symbols_map.get(d.properties.symbol_field)[1] / 2;\n return { x: centroid[0] - size_symbol, y: centroid[1] - size_symbol };\n });\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_display', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.redraw_symbols')).on('click', function () {\n selection.style('display', undefined);\n });\n\n var size_section = popup.append('p');\n size_section.append('span').html(_tr('app_page.layer_style_popup.symbols_size'));\n size_section.append('input').attrs({ min: 0, max: 200, step: 'any', type: 'number' }).styles({ width: '60px', margin: 'auto' }).property('value', 32).on('change', function () {\n var value = this.value;\n selection.transition().attrs(function () {\n var current_size = this.height.baseVal.value;\n return {\n width: value + 'px',\n height: value + 'px',\n x: this.x.baseVal.value + current_size / 2 - value / 2,\n y: this.y.baseVal.value + current_size / 2 - value / 2\n };\n });\n });\n}\n// popup.append(\"p\").style(\"text-align\", \"center\")\n// .insert(\"button\")\n// .attr(\"id\",\"modif_symb\")\n// .attr(\"class\", \"button_st4\")\n// .text(_tr(\"app_page.layer_style_popup.modify_symbols\"))\n// .on(\"click\", function(){\n// display_box_symbol_typo(ref_layer_name, rendered_field)().then(function(confirmed){\n// if(confirmed){\n// rendering_params = {\n// nb_cat: confirmed[0],\n// symbols_map: confirmed[1],\n// field: rendered_field\n// };\n// map.select(\"#\" + layer_name)\n// .selectAll(\"image\")\n// .attr(\"x\",\n// d => d.coords[0] - rendering_params.symbols_map.get(d.Symbol_field)[1] / 2)\n// .attr(\"y\",\n// d => d.coords[1] - rendering_params.symbols_map.get(d.Symbol_field)[1] / 2)\n// .attr(\"width\",\n// d => rendering_params.symbols_map.get(d.Symbol_field)[1] + \"px\")\n// .attr(\"height\",\n// d => rendering_params.symbols_map.get(d.Symbol_field)[1] + \"px\")\n// .attr(\"xlink:href\",\n// (d, i) => rendering_params.symbols_map.get(d.Symbol_field)[0]);\n// }\n// });\n// });\n\nfunction createStyleBoxLabel(layer_name) {\n function get_prev_settings() {\n var features = selection._groups[0];\n prev_settings = [];\n for (var i = 0; i < features.length; i++) {\n prev_settings.push({\n color: features[i].style.fill,\n size: features[i].style.fontSize,\n display: features[i].style.display ? features[i].style.display : null,\n position: [features[i].getAttribute('x'), features[i].getAttribute('y')],\n font: features[i].style.fontFamily\n });\n }\n prev_settings_defaults = {\n color: data_manager.current_layers[layer_name].fill_color,\n size: data_manager.current_layers[layer_name].default_size,\n font: data_manager.current_layers[layer_name].default_font\n };\n }\n\n function restore_prev_settings() {\n var features = selection._groups[0];\n for (var i = 0; i < features.length; i++) {\n features[i].style.fill = prev_settings[i].color;\n features[i].style.fontSize = prev_settings[i].size;\n features[i].style.display = prev_settings[i].display;\n features[i].setAttribute('x', prev_settings[i].position[0]);\n features[i].setAttribute('y', prev_settings[i].position[1]);\n features[i].style.fontFamily = prev_settings[i].font;\n }\n\n data_manager.current_layers[layer_name].fill_color = prev_settings_defaults.color;\n data_manager.current_layers[layer_name].default_size = prev_settings_defaults.size;\n data_manager.current_layers[layer_name].default_font = prev_settings_defaults.font;\n }\n\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n\n var selection = map.select('#' + _app.layer_to_id.get(layer_name)).selectAll('text'),\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name;\n // const rendering_params = {};\n var prev_settings_defaults = {};\n var prev_settings = [];\n\n get_prev_settings();\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n restore_prev_settings();\n } else {\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: data_manager.current_layers[layer_name].rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_labels_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_labels_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var coords = path.centroid(d.geometry);\n return { x: coords[0], y: coords[1] };\n });\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_labels_display', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.redraw_labels')).on('click', function () {\n selection.style('display', undefined);\n });\n\n popup.insert('p').styles({ 'text-align': 'center', 'font-size': '9px' }).html(_tr('app_page.layer_style_popup.overrride_warning'));\n var label_sizes = popup.append('p').attr('class', 'line_elem');\n label_sizes.append('span').html(_tr('app_page.layer_style_popup.labels_default_size'));\n label_sizes.insert('span').style('float', 'right').html(' px');\n label_sizes.insert('input').attr('type', 'number').styles({ float: 'right', width: '70px' }).property('value', +data_manager.current_layers[layer_name].default_size.replace('px', '')).on('change', function () {\n var size = this.value + 'px';\n data_manager.current_layers[layer_name].default_size = size;\n selection.style('font-size', size);\n });\n\n var default_color = popup.insert('p').attr('class', 'line_elem');\n default_color.append('span').html(_tr('app_page.layer_style_popup.labels_default_color'));\n default_color.insert('input').attr('type', 'color').style('float', 'right').property('value', data_manager.current_layers[layer_name].fill_color).on('change', function () {\n data_manager.current_layers[layer_name].fill_color = this.value;\n selection.transition().style('fill', this.value);\n });\n\n var font_section = popup.insert('p').attr('class', 'line_elem');\n font_section.append('span').html(_tr('app_page.layer_style_popup.labels_default_font'));\n var choice_font = font_section.insert('select').style('float', 'right').on('change', function () {\n data_manager.current_layers[layer_name].default_font = this.value;\n selection.transition().style('font-family', this.value);\n });\n\n _fonts.available_fonts.forEach(function (name) {\n choice_font.append('option').attr('value', name[1]).text(name[0]);\n });\n choice_font.node().value = data_manager.current_layers[layer_name].default_font;\n}\n\nfunction createStyleBoxGraticule(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var current_params = (0, _helpers.cloneObj)(data_manager.current_layers.Graticule);\n var selection = map.select('#L_Graticule > path');\n var selection_strokeW = map.select('#L_Graticule');\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n return null;\n } else {\n return null;\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n // let new_layer_name = layer_name;\n // const new_name_section = make_change_layer_name_section(popup, layer_name);\n // new_name_section.on('change', function() {\n // new_layer_name = this.value;\n // });\n\n var color_choice = popup.append('p').attr('class', 'line_elem');\n color_choice.append('span').html(_tr('app_page.layer_style_popup.color'));\n color_choice.append('input').attr('type', 'color').style('float', 'right').property('value', current_params.fill_color.single).on('change', function () {\n selection.style('stroke', this.value);\n data_manager.current_layers.Graticule.fill_color.single = this.value;\n });\n\n var opacity_choice = popup.append('p').attr('class', 'line_elem');\n opacity_choice.append('span').html(_tr('app_page.layer_style_popup.opacity'));\n opacity_choice.append('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', current_params.opacity).on('change', function () {\n selection.style('stroke-opacity', this.value);\n data_manager.current_layers.Graticule.opacity = +this.value;\n popup.select('#graticule_opacity_txt').html(+this.value * 100 + '%');\n });\n opacity_choice.append('span').attr('id', 'graticule_opacity_txt').style('float', 'right').html(current_params.opacity * 100 + '%');\n\n var stroke_width_choice = popup.append('p').attr('class', 'line_elem');\n stroke_width_choice.append('span').html(_tr('app_page.layer_style_popup.width'));\n stroke_width_choice.append('input').attr('type', 'number').styles({ width: '60px', float: 'right' }).property('value', current_params['stroke-width-const']).on('change', function () {\n selection_strokeW.style('stroke-width', this.value);\n data_manager.current_layers.Graticule['stroke-width-const'] = +this.value;\n });\n\n var steps_choice = popup.append('p').attr('class', 'line_elem');\n steps_choice.append('span').html(_tr('app_page.layer_style_popup.graticule_steps'));\n steps_choice.append('input').attrs({ id: 'graticule_range_steps', type: 'range', min: 0, max: 100, step: 1 }).styles({ 'vertical-align': 'middle', width: '58px', display: 'inline', float: 'right' }).property('value', current_params.step).on('change', function () {\n var next_layer = selection_strokeW.node().nextSibling;\n var step_val = +this.value;\n var dasharray_val = +document.getElementById('graticule_dasharray_txt').value;\n data_manager.current_layers.Graticule.step = step_val;\n var graticule = d3.geoGraticule().step([step_val, step_val]);\n if (data_manager.current_layers.Graticule.extent) {\n graticule = graticule.extent(data_manager.current_layers.Graticule.extent);\n }\n map.select('#L_Graticule').remove();\n map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: data_manager.current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });\n (0, _map_ctrl.zoom_without_redraw)();\n selection = map.select('#L_Graticule').selectAll('path');\n selection_strokeW = map.select('#L_Graticule');\n svg_map.insertBefore(selection_strokeW.node(), next_layer);\n popup.select('#graticule_step_txt').property('value', step_val);\n });\n steps_choice.append('input').attrs({ type: 'number', min: 0, max: 100, step: 'any', class: 'without_spinner', id: 'graticule_step_txt' }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', current_params.step).on('change', function () {\n var grat_range = document.getElementById('graticule_range_steps');\n grat_range.value = +this.value;\n grat_range.dispatchEvent(new MouseEvent('change'));\n });\n\n var dasharray_choice = popup.append('p').attr('class', 'line_elem');\n dasharray_choice.append('span').html(_tr('app_page.layer_style_popup.graticule_dasharray'));\n dasharray_choice.append('input').attrs({ type: 'range', min: 0, max: 50, step: 0.1, id: 'graticule_range_dasharray' }).styles({ 'vertical-align': 'middle', width: '58px', display: 'inline', float: 'right' }).property('value', current_params.dasharray).on('change', function () {\n selection.style('stroke-dasharray', this.value);\n data_manager.current_layers.Graticule.dasharray = +this.value;\n popup.select('#graticule_dasharray_txt').property('value', this.value);\n });\n dasharray_choice.append('input').attrs({ type: 'number', min: 0, max: 100, step: 'any', class: 'without_spinner', id: 'graticule_dasharray_txt' }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', current_params.dasharray).on('change', function () {\n var grat_range = document.getElementById('graticule_range_dasharray');\n grat_range.value = +this.value;\n grat_range.dispatchEvent(new MouseEvent('change'));\n });\n\n // Only append this section if there is currently a target layer :\n if (Object.keys(data_manager.user_data).length) {\n var clip_extent_section = popup.append('p').attr('class', 'line_elem');\n clip_extent_section.append('input').attrs({ type: 'checkbox', id: 'clip_graticule' }).property('checked', current_params.extent ? true : null).on('change', function () {\n var next_layer = selection_strokeW.node().nextSibling,\n step_val = +document.getElementById('graticule_step_txt').value,\n dasharray_val = +document.getElementById('graticule_dasharray_txt').value;\n var graticule = d3.geoGraticule().step([step_val, step_val]);\n map.select('#L_Graticule').remove();\n if (this.checked) {\n var bbox_layer = _target_layer_file.bbox;\n var extent_grat = [[Math.round((bbox_layer[0] - 12) / 10) * 10, Math.round((bbox_layer[1] - 12) / 10) * 10], [Math.round((bbox_layer[2] + 12) / 10) * 10, Math.round((bbox_layer[3] + 12) / 10) * 10]];\n\n if (extent_grat[0] < -180) extent_grat[0] = -180;\n if (extent_grat[1] < -90) extent_grat[1] = -90;\n if (extent_grat[2] > 180) extent_grat[2] = 180;\n if (extent_grat[3] > 90) extent_grat[3] = 90;\n graticule = graticule.extent(extent_grat);\n data_manager.current_layers.Graticule.extent = extent_grat;\n } else {\n data_manager.current_layers.Graticule.extent = undefined;\n }\n map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: data_manager.current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });\n (0, _map_ctrl.zoom_without_redraw)();\n selection = map.select('#L_Graticule').selectAll('path');\n selection_strokeW = map.select('#L_Graticule');\n svg_map.insertBefore(selection_strokeW.node(), next_layer);\n });\n clip_extent_section.append('label').attrs({ for: 'clip_graticule' }).html(_tr('app_page.layer_style_popup.graticule_clip'));\n }\n\n // Allow to create label for each line of the graticule\n make_generate_labels_graticule_section(popup);\n}\n\n/**\n* Function triggered to redraw the legend after changing some properties on a layer.\n*\n* @param {String} type_legend - The type of the legend to redraw.\n* @param {String} layer_name - The name of the layer concerned.\n* @param {String} field - The name of the rendered field.\n* @return {void}\n*\n*/\nfunction redraw_legend(type_legend, layer_name, field) {\n var _ref = type_legend === 'choro' ? [['#legend_root.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_choro] : type_legend === 'choro_horiz' ? [['#legend_root_horiz.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_choro_horizontal] : type_legend === 'line_class' ? [['#legend_root_lines_class.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_discont_links] : type_legend === 'line_symbol' ? [['#legend_root_lines_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_line_symbol] : type_legend === 'waffle' ? [['#legend_root_waffle.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_waffle] : type_legend === 'layout' ? [['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join(''), _legend.createLegend_layout] : undefined,\n _ref2 = _slicedToArray(_ref, 2),\n selector = _ref2[0],\n legend_func = _ref2[1];\n\n var lgd = document.querySelector(selector);\n if (lgd) {\n var transform_param = lgd.getAttribute('transform'),\n lgd_title = lgd.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = lgd.querySelector('#legendsubtitle').innerHTML,\n rounding_precision = lgd.getAttribute('rounding_precision'),\n note = lgd.querySelector('#legend_bottom_note').innerHTML,\n boxgap = lgd.getAttribute('boxgap');\n var rect_fill_value = lgd.getAttribute('visible_rect') === 'true' ? {\n color: lgd.querySelector('#under_rect').style.fill,\n opacity: lgd.querySelector('#under_rect').style.fillOpacity\n } : undefined;\n if (type_legend.indexOf('choro') > -1) {\n var no_data_txt = lgd.querySelector('#no_data_txt');\n no_data_txt = no_data_txt != null ? no_data_txt.textContent : null;\n\n lgd.remove();\n legend_func(layer_name, field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, no_data_txt, note);\n } else if (type_legend === 'waffle') {\n lgd.remove();\n legend_func(layer_name, field, lgd_title, lgd_subtitle, rect_fill_value, note);\n } else if (type_legend === 'layout') {\n lgd.remove();\n var text_value = lgd.querySelector('g.lg.legend_0 > text').innerHTML;\n legend_func(layer_name, data_manager.current_layers[layer_name].type, lgd_title, lgd_subtitle, rect_fill_value, text_value, note);\n } else {\n lgd.remove();\n legend_func(layer_name, data_manager.current_layers[layer_name].rendered_field, lgd_title, lgd_subtitle, rect_fill_value, rounding_precision, note);\n }\n lgd = document.querySelector(selector);\n if (transform_param) {\n lgd.setAttribute('transform', transform_param);\n }\n }\n}\n\nfunction createStyleBox_Line(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var renderer = data_manager.current_layers[layer_name].renderer,\n g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var prev_random_colors = void 0;\n var prev_col_breaks = void 0;\n var rendering_params = void 0;\n\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.stroke);\n });\n }\n\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var stroke_prev = selection.style('stroke');\n var prev_min_display = void 0,\n prev_size = void 0,\n prev_breaks = void 0;\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n var table = [];\n Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll('path'), function (d) {\n table.push(d.__data__.properties);\n });\n\n var redraw_prop_val = function redraw_prop_val(prop_values) {\n var selec = selection._groups[0];\n for (var i = 0, len = prop_values.length; i < len; i++) {\n selec[i].style.strokeWidth = prop_values[i];\n }\n };\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n if (renderer !== undefined && rendering_params !== undefined && renderer !== 'Categorical' && renderer !== 'PropSymbolsTypo' && renderer !== 'LinksProportional') {\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n var colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.breaks[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.field;\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, rendering_params.field);\n } else {\n redraw_legend('choro_horiz', layer_name, rendering_params.field);\n }\n } else if ((renderer === 'Categorical' || renderer === 'PropSymbolsTypo') && rendering_params !== undefined) {\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n redraw_legend('choro', layer_name, rendering_params.field);\n } else if (renderer === 'DiscLayer') {\n selection.each(function (d) {\n d.properties.prop_val = this.style.strokeWidth; // eslint-disable-line no-param-reassign\n });\n // Also change the legend if there is one displayed :\n redraw_legend('line_class', layer_name);\n } else if (renderer === 'LinksGraduated') {\n selection.each(function (d, i) {\n data_manager.current_layers[layer_name].linksbyId[i][2] = this.style.strokeWidth;\n });\n // Also change the legend if there is one displayed :\n redraw_legend('line_class', layer_name);\n } else if (data_manager.current_layers[layer_name].layout_legend_displayed) {\n redraw_legend('layout', layer_name);\n }\n\n if (renderer && (renderer.startsWith('PropSymbols') || renderer === 'LinksProportional')) {\n selection.each(function (d) {\n d.properties.color = this.style.stroke; // eslint-disable-line no-param-reassign\n });\n redraw_legend('line_symbol', layer_name);\n }\n\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n\n if (data_manager.current_layers[layer_name].renderer === 'LinksGraduated' && prev_min_display !== undefined) {\n data_manager.current_layers[layer_name].min_display = prev_min_display;\n data_manager.current_layers[layer_name].breaks = prev_breaks;\n selection.style('fill-opacity', 0).style('stroke', fill_prev.single).style('display', function (d) {\n return +d.properties[data_manager.current_layers[layer_name].rendered_field] > prev_min_display ? null : 'none';\n }).style('stroke-opacity', border_opacity).style('stroke-width', function (d, i) {\n return data_manager.current_layers[layer_name].linksbyId[i][2];\n });\n } else if (data_manager.current_layers[layer_name].renderer === 'DiscLayer' && prev_min_display !== undefined) {\n data_manager.current_layers[layer_name].min_display = prev_min_display;\n data_manager.current_layers[layer_name].size = prev_size;\n data_manager.current_layers[layer_name].breaks = prev_breaks;\n var lim = prev_min_display !== 0 ? prev_min_display * data_manager.current_layers[layer_name].n_features : -1;\n selection.style('fill-opacity', 0).style('stroke', fill_prev.single).style('stroke-opacity', border_opacity).style('display', function (d, i) {\n return +i <= lim ? null : 'none';\n }).style('stroke-width', function (d) {\n return d.properties.prop_val;\n });\n } else {\n if (fill_meth === 'single') {\n selection.style('stroke', fill_prev.single).style('stroke-opacity', border_opacity);\n } else if (fill_meth === 'random') {\n selection.style('stroke-opacity', border_opacity).style('stroke', function (d, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n });\n } else if (fill_meth === 'class' && renderer === 'LinksGraduated') {\n selection.style('stroke-opacity', function (d, i) {\n return data_manager.current_layers[layer_name].linksbyId[i][0];\n }).style('stroke', stroke_prev);\n }\n }\n if (data_manager.current_layers[layer_name].colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n if (renderer === 'Categorical' || renderer === 'PropSymbolsTypo') {\n var color_field = renderer === 'Categorical' ? data_manager.current_layers[layer_name].rendered_field : data_manager.current_layers[layer_name].rendered_field2;\n\n popup.insert('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').styles({ 'font-size': '0.8em', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n var _prepare_categories_a = (0, _function.prepare_categories_array)(layer_name, color_field, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a2 = _slicedToArray(_prepare_categories_a, 2),\n cats = _prepare_categories_a2[0],\n _ = _prepare_categories_a2[1];\n\n container.modal.hide();\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, color_field, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: color_field,\n field: color_field\n };\n selection.transition().style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Choropleth' || renderer === 'PropSymbolsChoro') {\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, data_manager.current_layers[layer_name].rendered_field, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n // renderer:\"Choropleth\",\n field: data_manager.current_layers[layer_name].rendered_field,\n extra_options: confirmed[7]\n };\n selection.transition().style('stroke', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else {\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n data_manager.current_layers[layer_name].fill_color = { single: this.value };\n // data_manager.current_layers[layer_name].fill_color.single = this.value;\n });\n }\n\n if (renderer === 'LinksGraduated') {\n prev_min_display = data_manager.current_layers[layer_name].min_display || 0;\n prev_breaks = data_manager.current_layers[layer_name].breaks.slice();\n var fij_field = data_manager.current_layers[layer_name].rendered_field;\n var max_val = 0;\n selection.each(function (d) {\n if (+d.properties[fij_field] > max_val) max_val = +d.properties[fij_field];\n });\n var threshold_section = popup.append('p').attr('class', 'line_elem');\n threshold_section.append('span').html(_tr('app_page.layer_style_popup.display_flow_larger'));\n // The legend will be updated in order to start on the minimum value displayed instead of\n // using the minimum value of the serie (skipping unused class if necessary)\n threshold_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: max_val,\n step: 0.5\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', prev_min_display).on('change', function () {\n var val = +this.value;\n popup.select('#larger_than').html([' ', val, ' '].join(''));\n selection.style('display', function (d) {\n return +d.properties[fij_field] > val ? null : 'none';\n });\n data_manager.current_layers[layer_name].min_display = val;\n });\n threshold_section.insert('label').attr('id', 'larger_than').style('float', 'right').html(' ' + prev_min_display + ' ');\n popup.append('p').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.modify_size_class')).on('click', function () {\n container.modal.hide();\n (0, _discrtiz_links_discont.display_discretization_links_discont)(layer_name, data_manager.current_layers[layer_name].rendered_field, data_manager.current_layers[layer_name].breaks.length, 'user_defined').then(function (result) {\n container.modal.show();\n if (result) {\n var serie = result[0],\n sizes = result[1].map(function (ft) {\n return ft[1];\n }),\n links_byId = data_manager.current_layers[layer_name].linksbyId;\n serie.setClassManually(result[2]);\n data_manager.current_layers[layer_name].breaks = result[1];\n selection.style('fill-opacity', 0).style('stroke-width', function (d, i) {\n return sizes[serie.getClass(+links_byId[i][1])];\n });\n }\n });\n });\n } else if (renderer === 'DiscLayer') {\n prev_min_display = +data_manager.current_layers[layer_name].min_display || 0;\n prev_size = data_manager.current_layers[layer_name].size.slice();\n prev_breaks = data_manager.current_layers[layer_name].breaks.slice();\n // const max_val = Math.max.apply(null, data_manager.result_data[layer_name].map(i => i.disc_value));\n var disc_part = popup.append('p').attr('class', 'line_elem');\n disc_part.append('span').html(_tr('app_page.layer_style_popup.discont_threshold'));\n disc_part.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right', 'margin-right': '0px' }).property('value', prev_min_display).on('change', function () {\n var val = +this.value;\n var lim = val !== 0 ? val * data_manager.current_layers[layer_name].n_features : -1;\n popup.select('#larger_than').html([' ', val * 100, ' % '].join(''));\n selection.style('display', function (d, i) {\n return i <= lim ? null : 'none';\n });\n data_manager.current_layers[layer_name].min_display = val;\n });\n disc_part.insert('label').attr('id', 'larger_than').style('float', 'right').html([' ', prev_min_display * 100, ' % '].join(''));\n popup.append('p').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n (0, _discrtiz_links_discont.display_discretization_links_discont)(layer_name, 'disc_value', data_manager.current_layers[layer_name].breaks.length, 'user_defined').then(function (result) {\n container.modal.show();\n if (result) {\n var serie = result[0],\n sizes = result[1].map(function (ft) {\n return ft[1];\n });\n\n serie.setClassManually(result[2]);\n data_manager.current_layers[layer_name].breaks = result[1];\n data_manager.current_layers[layer_name].size = [sizes[0], sizes[sizes.length - 1]];\n selection.style('fill-opacity', 0).style('stroke-width', function (d) {\n return sizes[serie.getClass(+d.properties.disc_value)];\n });\n }\n });\n });\n }\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n if (!renderer || !renderer.startsWith('PropSymbols') && !renderer.startsWith('Links') && renderer !== 'DiscLayer') {\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n } else if (renderer.startsWith('PropSymbols') || renderer === 'LinksProportional') {\n var field_used = data_manager.current_layers[layer_name].rendered_field;\n var d_values = data_manager.result_data[layer_name].map(function (f) {\n return +f[field_used];\n });\n var prop_val_content = popup.append('p');\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.field_symbol_size', { field: data_manager.current_layers[layer_name].rendered_field }));\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.symbol_fixed_size'));\n prop_val_content.insert('input').styles({ width: '60px', float: 'right' }).attrs({\n type: 'number',\n id: 'max_size_range',\n min: 0.1,\n step: 'any'\n }).property('value', data_manager.current_layers[layer_name].size[1]).on('change', function () {\n var f_size = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, data_manager.current_layers[layer_name].size[0], f_size, 'line');\n data_manager.current_layers[layer_name].size[1] = f_size;\n redraw_prop_val(prop_values);\n });\n prop_val_content.append('span').style('float', 'right').html('(px)');\n\n var prop_val_content2 = popup.append('p').attr('class', 'line_elem');\n prop_val_content2.append('span').html(_tr('app_page.layer_style_popup.on_value'));\n prop_val_content2.insert('input').styles({ width: '100px', float: 'right' }).attrs({ type: 'number', min: 0.1, step: 0.1 }).property('value', +data_manager.current_layers[layer_name].size[0]).on('change', function () {\n var f_val = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, f_val, data_manager.current_layers[layer_name].size[1], 'line');\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size[0] = f_val;\n });\n }\n\n if (data_manager.current_layers[layer_name].renderer === undefined) {\n var generate_legend_section = popup.append('p');\n var generate_lgd_chkbox = generate_legend_section.insert('input').style('margin', 0).property('checked', data_manager.current_layers[layer_name].layout_legend_displayed === true).attrs({\n type: 'checkbox',\n id: 'checkbox_layout_legend'\n });\n generate_legend_section.insert('label').attr('for', 'checkbox_layout_legend').html(_tr('app_page.layer_style_popup.layout_legend'));\n generate_lgd_chkbox.on('change', function () {\n if (this.checked) {\n (0, _legend.createLegend_layout)(layer_name, data_manager.current_layers[layer_name].type, layer_name, '', undefined, layer_name);\n data_manager.current_layers[layer_name].layout_legend_displayed = true;\n } else {\n document.querySelector(['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join('')).remove();\n data_manager.current_layers[layer_name].layout_legend_displayed = false;\n }\n });\n }\n\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction createStyleBox(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var type = data_manager.current_layers[layer_name].type,\n isSphere = data_manager.current_layers[layer_name].sphere === true,\n renderer = data_manager.current_layers[layer_name].renderer,\n g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var prev_col_breaks = void 0;\n var rendering_params = void 0;\n var prev_random_colors = void 0;\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.fill);\n });\n }\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var table = [];\n var stroke_prev = selection.style('stroke');\n var previous_point_radius = data_manager.current_layers[layer_name].pointRadius;\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll('path'), function (d) {\n table.push(d.__data__.properties);\n });\n var fields_layer = !isSphere ? data_manager.current_layers[layer_name].fields_type || (0, _helpers.type_col2)(table) : [];\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n // Update the object holding the properties of the layer if Yes is clicked\n if (renderer !== undefined && rendering_params !== undefined && renderer !== 'Categorical') {\n data_manager.current_layers[layer_name].fill_color = { class: rendering_params.colorsByFeature };\n var colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].colors_breaks = colors_breaks;\n data_manager.current_layers[layer_name].rendered_field = rendering_params.field;\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n } else if (renderer === 'Categorical' && rendering_params !== undefined) {\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n }\n\n if (rendering_params !== undefined && rendering_params.field !== undefined) {\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n } else if (data_manager.current_layers[layer_name].layout_legend_displayed) {\n redraw_legend('layout', layer_name);\n }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n if (type === 'Point' && data_manager.current_layers[layer_name].pointRadius) {\n data_manager.current_layers[layer_name].pointRadius = previous_point_radius;\n selection.attr('d', path.pointRadius(+data_manager.current_layers[layer_name].pointRadius));\n } else {\n if (fill_meth === 'single') {\n selection.style('fill', fill_prev.single).style('stroke', stroke_prev);\n } else if (fill_meth === 'class') {\n selection.style('fill-opacity', opacity).style('fill', function (d, i) {\n return fill_prev.class[i];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'random') {\n selection.style('fill', function (d, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n }).style('stroke', stroke_prev);\n } else if (fill_meth === 'categorical') {\n fill_categorical(layer_name, fill_prev.categorical[0], 'path', fill_prev.categorical[1]);\n }\n }\n if (data_manager.current_layers[layer_name].colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n if (layer_name !== 'World') {\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n }\n\n if (type === 'Point') {\n var pt_size = popup.append('p').attr('class', 'line_elem');\n pt_size.append('span').html(_tr('app_page.layer_style_popup.point_radius'));\n pt_size.append('input').attrs({\n type: 'range',\n min: 0,\n max: 80,\n id: 'point_radius_size'\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', previous_point_radius).on('change', function () {\n var current_pt_size = +this.value;\n data_manager.current_layers[layer_name].pointRadius = current_pt_size;\n document.getElementById('point_radius_size_txt').value = current_pt_size;\n selection.attr('d', path.pointRadius(current_pt_size));\n });\n pt_size.append('input').attrs({\n type: 'number',\n min: 0,\n max: 80,\n step: 'any',\n class: 'without_spinner',\n id: 'point_radius_size_txt'\n }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', +previous_point_radius).on('change', function () {\n var pt_size_range = document.getElementById('point_radius_size');\n var old_value = pt_size_range.value;\n if (this.value === '' || isNaN(+this.value)) {\n this.value = old_value;\n } else {\n this.value = (0, _helpers_calc.round_value)(+this.value, 2);\n var current_pt_size = this.value;\n pt_size_range.value = current_pt_size;\n data_manager.current_layers[layer_name].pointRadius = current_pt_size;\n selection.attr('d', path.pointRadius(current_pt_size));\n }\n });\n }\n\n if (data_manager.current_layers[layer_name].colors_breaks === undefined && renderer !== 'Categorical') {\n if (data_manager.current_layers[layer_name].targeted || data_manager.current_layers[layer_name].is_result) {\n var fields = (0, _helpers.getFieldsType)('category', null, fields_layer);\n var fill_method_section = popup.append('p');\n fill_method_section.append('span').html(_tr('app_page.layer_style_popup.fill_color'));\n var fill_method = fill_method_section.insert('select').styles({ display: 'inline', float: 'right', width: '100%' });\n [[_tr('app_page.layer_style_popup.single_color'), 'single'], [_tr('app_page.layer_style_popup.categorical_color'), 'categorical'], [_tr('app_page.layer_style_popup.random_color'), 'random']].forEach(function (d) {\n fill_method.append('option').text(d[0]).attr('value', d[1]);\n });\n popup.append('p').attrs({ id: 'fill_color_section' }).styles({ clear: 'both', 'padding-top': '10px' });\n fill_method.on('change', function () {\n d3.select('#fill_color_section').html('').on('click', null);\n if (this.value === 'single') {\n make_single_color_menu(layer_name, fill_prev);\n } else if (this.value === 'categorical') {\n make_categorical_color_menu(fields, layer_name, fill_prev);\n } else if (this.value === 'random') {\n make_random_color(layer_name);\n document.getElementById('random_color_btn').click();\n }\n });\n (0, _helpers.setSelected)(fill_method.node(), Object.getOwnPropertyNames(fill_prev)[0]);\n } else {\n popup.append('div').attrs({ id: 'fill_color_section' });\n make_single_color_menu(layer_name, fill_prev);\n }\n } else if (renderer === 'Categorical') {\n var rendered_field = data_manager.current_layers[layer_name].rendered_field;\n\n popup.insert('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n container.modal.hide();\n\n var _prepare_categories_a3 = (0, _function.prepare_categories_array)(layer_name, rendered_field, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a4 = _slicedToArray(_prepare_categories_a3, 1),\n cats = _prepare_categories_a4[0];\n\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, rendered_field, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: rendered_field,\n field: rendered_field\n };\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Choropleth') {\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, data_manager.current_layers[layer_name].rendered_field, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n // renderer:\"Choropleth\",\n field: data_manager.current_layers[layer_name].rendered_field,\n extra_options: confirmed[7]\n };\n // let opacity_val = fill_opacity_section ? +fill_opacity_section.node().value : 0.9\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (renderer === 'Gridded') {\n var field_to_discretize = data_manager.current_layers[layer_name].rendered_field;\n popup.append('p').style('margin', 'auto').style('text-align', 'center').append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, field_to_discretize, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n renderer: 'Choropleth',\n field: field_to_discretize,\n extra_options: confirmed[7]\n };\n // let opacity_val = fill_opacity_section ? +fill_opacity_section.node().value : 0.9\n selection.transition().style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n }\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem');\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: 1,\n step: 0.1\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(this.value * 100 + '%');\n });\n fill_opacity_section.append('span').style('float', 'right').attr('id', 'fill_opacity_txt').html(+opacity * 100 + '%');\n\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.border_color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n });\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n opacity_section.insert('input').attrs({ type: 'range', min: 0, max: 1, step: 0.1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n\n var shadow_section = popup.append('p');\n var chkbx = shadow_section.insert('input').style('margin', '0').property('checked', map.select(g_lyr_name).attr('filter') ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_shadow_layer'\n });\n shadow_section.insert('label').attr('for', 'checkbox_shadow_layer').html(_tr('app_page.layer_style_popup.layer_shadow'));\n chkbx.on('change', function () {\n if (this.checked) {\n createDropShadow(_app.layer_to_id.get(layer_name));\n } else {\n var filter_id = map.select(g_lyr_name).attr('filter');\n svg_map.querySelector(filter_id.substring(4).replace(')', '')).remove();\n map.select(g_lyr_name).attr('filter', null);\n }\n });\n\n if (data_manager.current_layers[layer_name].renderer === undefined || data_manager.current_layers[layer_name].renderer === 'Carto_doug' || data_manager.current_layers[layer_name].renderer === 'OlsonCarto') {\n var generate_legend_section = popup.append('p');\n var generate_lgd_chkbox = generate_legend_section.insert('input').style('margin', 0).property('checked', data_manager.current_layers[layer_name].layout_legend_displayed === true).attrs({\n type: 'checkbox',\n id: 'checkbox_layout_legend'\n });\n generate_legend_section.insert('label').attr('for', 'checkbox_layout_legend').html(_tr('app_page.layer_style_popup.layout_legend'));\n generate_lgd_chkbox.on('change', function () {\n if (this.checked) {\n (0, _legend.createLegend_layout)(layer_name, data_manager.current_layers[layer_name].type, layer_name, '', undefined, layer_name);\n data_manager.current_layers[layer_name].layout_legend_displayed = true;\n } else {\n document.querySelector(['#legend_root_layout.lgdf_', _app.layer_to_id.get(layer_name)].join('')).remove();\n data_manager.current_layers[layer_name].layout_legend_displayed = false;\n }\n });\n }\n\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction createStyleBoxStewart(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var g_lyr_name = '#' + _app.layer_to_id.get(layer_name),\n selection = map.select(g_lyr_name).selectAll('path'),\n opacity = selection.style('fill-opacity');\n\n var nb_ft = data_manager.current_layers[layer_name].n_features;\n var prev_palette = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].color_palette);\n\n var recolor_stewart = function recolor_stewart(coloramp_name, reversed) {\n var new_coloramp = (0, _colors_helpers.getColorBrewerArray)(nb_ft, coloramp_name).slice();\n if (reversed === false) {\n new_coloramp.reverse();\n }\n for (var i = 0; i < nb_ft; ++i) {\n rendering_params.breaks[i][1] = new_coloramp[i];\n }\n selection.transition().style('fill', function (d, i) {\n return new_coloramp[i];\n });\n data_manager.current_layers[layer_name].color_palette = {\n name: coloramp_name,\n reversed: reversed\n };\n };\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var rendering_params = {\n breaks: [].concat(data_manager.current_layers[layer_name].colors_breaks)\n };\n var prev_col_breaks = void 0;\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = data_manager.current_layers[layer_name].colors_breaks.concat([]);\n }\n var border_opacity = selection.style('stroke-opacity'),\n stroke_width = +data_manager.current_layers[layer_name]['stroke-width-const'];\n var stroke_prev = selection.style('stroke');\n\n if (stroke_prev.startsWith('rgb')) {\n stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n }\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n data_manager.current_layers[layer_name].colors_breaks = rendering_params.breaks;\n data_manager.current_layers[layer_name].fill_color.class = rendering_params.breaks.map(function (obj) {\n return obj[1];\n });\n // Redraw the legend if necessary:\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n // Reset to original values the rendering parameters if \"no\" is clicked\n selection.style('fill-opacity', opacity).style('stroke-opacity', border_opacity);\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', stroke_width / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n // const fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n recolor_stewart(prev_palette.name, prev_palette.reversed);\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n var color_palette_section = popup.insert('p').attr('class', 'line_elem');\n color_palette_section.append('span').html(_tr('app_page.layer_style_popup.color_palette'));\n var seq_color_select = color_palette_section.insert('select').attr('id', 'coloramp_params').style('float', 'right').on('change', function () {\n recolor_stewart(this.value, document.getElementById('chckbox_reverse_palette').checked);\n });\n\n ['Blues', 'BuGn', 'BuPu', 'GnBu', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'RdPu', 'YlGn', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'].forEach(function (name) {\n seq_color_select.append('option').text(name).attr('value', name);\n });\n seq_color_select.node().value = prev_palette.name;\n var reversed_section = popup.append('div').style('margin-bottom', '10px');\n reversed_section.append('input').property('checked', prev_palette.reversed ? true : false).attrs({ id: 'chckbox_reverse_palette', type: 'checkbox' }).style('margin', 'auto').on('change', function onchangerevpal() {\n var pal_name = document.getElementById('coloramp_params').value;\n recolor_stewart(pal_name, this.checked);\n });\n reversed_section.append('label').attr('for', 'chckbox_reverse_palette').html(_tr('app_page.layer_style_popup.reverse_palette'));\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem');\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: 1,\n step: 0.1\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right',\n 'margin-right': '0px'\n }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(this.value * 100 + '%');\n });\n fill_opacity_section.append('span').style('float', 'right').attr('id', 'fill_opacity_txt').html(+opacity * 100 + '%');\n\n var c_section = popup.append('p').attr('class', 'line_elem');\n c_section.insert('span').html(_tr('app_page.layer_style_popup.border_color'));\n c_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.style('stroke', this.value);\n });\n\n var opacity_section = popup.append('p').attr('class', 'line_elem');\n opacity_section.insert('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n opacity_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: 1,\n step: 0.1\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right'\n }).property('value', border_opacity).on('change', function () {\n opacity_section.select('#opacity_val_txt').html(' ' + this.value);\n selection.style('stroke-opacity', this.value);\n });\n\n opacity_section.append('span').attr('id', 'opacity_val_txt').styles({ display: 'inline', float: 'right' }).html(' ' + border_opacity);\n\n var width_section = popup.append('p').attr('class', 'line_elem');\n width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n var val = +this.value;\n var zoom_scale = +d3.zoomTransform(map.node()).k;\n map.select(g_lyr_name).style('stroke-width', val / zoom_scale + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = val;\n });\n\n var shadow_section = popup.append('p');\n var chkbx = shadow_section.insert('input').style('margin', '0').property('checked', map.select(g_lyr_name).attr('filter') ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_shadow_layer'\n });\n shadow_section.insert('label').attr('for', 'checkbox_shadow_layer').html(_tr('app_page.layer_style_popup.layer_shadow'));\n chkbx.on('change', function () {\n if (this.checked) {\n createDropShadow(_app.layer_to_id.get(layer_name));\n } else {\n var filter_id = map.select(g_lyr_name).attr('filter');\n svg_map.querySelector(filter_id.substring(4).replace(')', '')).remove();\n map.select(g_lyr_name).attr('filter', null);\n }\n });\n make_generate_labels_section(popup, layer_name);\n}\n\nfunction make_generate_labels_graticule_section(parent_node) {\n var labels_section = parent_node.append('p');\n labels_section.append('span').attr('id', 'generate_labels').styles({ cursor: 'pointer', 'margin-top': '15px' }).html(_tr('app_page.layer_style_popup.generate_labels')).on('mouseover', function () {\n this.style.fontWeight = 'bold';\n }).on('mouseout', function () {\n this.style.fontWeight = '';\n }).on('click', function () {\n (0, _function.render_label_graticule)('Graticule', {\n color: '#000',\n font: 'verdana',\n ref_font_size: 12,\n uo_layer_name: ['Labels', 'Graticule'].join('_')\n });\n });\n}\n\n/**\n* Create the section allowing to generate labels on a parent style box.\n* (Used by all the createStyleBox_xxx functions)\n*\n* @param {Object} parent_node - The d3 selection corresponding the parent style box.\n* @param {String} layer_name - The name of the layer currently edited in the style box.\n* @return {void}\n*\n*/\nfunction make_generate_labels_section(parent_node, layer_name) {\n var _fields = get_fields_name(layer_name) || [];\n // const table = make_table(layer_name);\n var fields_num = (0, _helpers.type_col2)((0, _tables.make_table)(layer_name)).filter(function (a) {\n return a.type === 'ratio' || a.type === 'stock';\n }).map(function (a) {\n return a.name;\n });\n if (_fields && _fields.length > 0) {\n var labels_section = parent_node.append('p');\n var input_fields = {};\n for (var i = 0; i < _fields.length; i++) {\n input_fields[_fields[i]] = _fields[i];\n }\n labels_section.append('span').attr('id', 'generate_labels').styles({ cursor: 'pointer', 'margin-top': '15px' }).html(_tr('app_page.layer_style_popup.generate_labels')).on('mouseover', function () {\n this.style.fontWeight = 'bold';\n }).on('mouseout', function () {\n this.style.fontWeight = '';\n }).on('click', function () {\n swal({\n title: '',\n html: '\\n
' + _tr('app_page.layer_style_popup.field_label') + '
\\n
\\n' + _tr('app_page.common.field') + ' \\n \\n
\\n
',\n type: 'question',\n customClass: 'swal2_custom',\n showCancelButton: true,\n showCloseButton: false,\n allowEscapeKey: false,\n allowOutsideClick: false,\n confirmButtonColor: '#DD6B55',\n confirmButtonText: _tr('app_page.common.confirm'),\n inputOptions: input_fields,\n onOpen: function onOpen() {\n var sel = d3.select('#label_box_field');\n _fields.forEach(function (f_name) {\n sel.append('option').property('value', f_name).text(f_name);\n });\n if (fields_num.length > 0) {\n var section_filter = d3.select('#label_box_filter_section');\n section_filter.append('input').attrs({ type: 'checkbox', id: 'label_box_filter_chk' }).on('change', function () {\n if (this.checked) {\n subsection_filter_label.style('display', null);\n } else {\n subsection_filter_label.style('display', 'none');\n }\n });\n section_filter.append('label').attr('for', 'label_box_filter_chk').html(_tr('app_page.layer_style_popup.filter_label'));\n var subsection_filter_label = section_filter.append('div').style('display', 'none');\n var sel2 = subsection_filter_label.append('select').attr('id', 'label_box_filter_field');\n fields_num.forEach(function (f_name) {\n sel2.append('option').property('value', f_name).text(f_name);\n });\n var sel3 = subsection_filter_label.append('select').attr('id', 'label_box_filter_type');\n sel3.append('option').property('value', 'sup').text('>');\n sel3.append('option').property('value', 'inf').text('<');\n subsection_filter_label.append('input').attrs({ type: 'number', id: 'label_box_filter_value' });\n }\n },\n preConfirm: function preConfirm() {\n return new Promise(function (resolve, reject) {\n setTimeout(function () {\n var selected_field = document.getElementById('label_box_field').value;\n var filter_options = undefined;\n if (fields_num.length > 0) {\n var to_filter = document.getElementById('label_box_filter_chk').checked;\n if (to_filter) {\n var filter_value = document.getElementById('label_box_filter_value').value;\n if (!filter_value || isNaN(filter_value)) {\n reject(_tr('app_page.common.incorrect_value'));\n return;\n }\n filter_options = {\n field: document.getElementById('label_box_filter_field').value,\n type_filter: document.getElementById('label_box_filter_type').value,\n filter_value: filter_value\n };\n }\n }\n if (_fields.indexOf(selected_field) < 0) {\n reject(_tr('app_page.common.no_value'));\n } else {\n resolve();\n (0, _function.render_label)(layer_name, {\n label_field: selected_field,\n filter_options: filter_options,\n color: '#000',\n font: 'verdana',\n ref_font_size: 12,\n uo_layer_name: ['Labels', selected_field, layer_name].join('_')\n });\n }\n }, 50);\n });\n }\n }).then(function () {\n //console.log(value);\n }, function () {\n //console.log(dismiss);\n });\n });\n }\n}\n\n/**\n* Return the name of the fields/columns\n* (ie. the members of the `properties` Object for each feature on a layer)\n*\n* @param {String} layer_name - The name of the layer.\n* @return {Array} - An array of Strings, one for each field name.\n*\n*/\nfunction get_fields_name(layer_name) {\n var elem = document.getElementById(_app.layer_to_id.get(layer_name)).childNodes[0];\n if (!elem.__data__ || !elem.__data__.properties) {\n return null;\n }\n return Object.getOwnPropertyNames(elem.__data__.properties);\n}\n\nfunction createStyleBoxWaffle(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var round = Math.round;\n var floor = Math.floor;\n var layer_id = _app.layer_to_id.get(layer_name),\n g_lyr_name = '#' + layer_id,\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n symbol = data_manager.current_layers[layer_name].symbol,\n fields = data_manager.current_layers[layer_name].rendered_field,\n selection = map.select(g_lyr_name);\n\n var previous_params = {\n fill_opacity: selection.selectAll(symbol).style('fill-opacity'),\n ref_colors: [].concat(data_manager.current_layers[layer_name].fill_color),\n size: data_manager.current_layers[layer_name].size,\n nCol: data_manager.current_layers[layer_name].nCol\n };\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n redraw_legend('waffle', layer_name, fields);\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n } else {\n data_manager.current_layers[layer_name].fill_color = previous_params.ref_colors;\n data_manager.current_layers[layer_name].size = previous_params.size;\n selection.selectAll(symbol).style('fill-opacity', previous_params.fill_opacity);\n }\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: fields.join(' ,') }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var fill_opacity_section = popup.append('p').attr('class', 'line_elem').attr('id', 'fill_color_section');\n\n fill_opacity_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n fill_opacity_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: 1,\n step: 0.1\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right'\n }).property('value', previous_params.fill_opacity).on('change', function () {\n selection.selectAll(symbol).style('fill-opacity', +this.value);\n fill_opacity_section.select('#fill_opacity_txt').html(+this.value * 100 + '%');\n });\n\n fill_opacity_section.append('span').attr('id', 'fill_opacity_txt').style('float', 'right').html(+previous_params.fill_opacity * 100 + '%');\n\n var ref_colors_section = popup.append('div').attr('id', 'ref_colors_section').style('clear', 'both');\n ref_colors_section.append('p').html(_tr('app_page.layer_style_popup.ref_colors'));\n\n var _loop = function _loop(i) {\n var p = ref_colors_section.append('p').style('margin', '15px 5px');\n p.append('span').html(data_manager.current_layers[layer_name].rendered_field[i]);\n p.insert('input').attrs({ id: i, type: 'color' }).style('float', 'right').property('value', data_manager.current_layers[layer_name].fill_color[i]).on('change', function () {\n // eslint-disable-line no-loop-func\n var col = (0, _colors_helpers.rgb2hex)(this.value);\n var to_replace = data_manager.current_layers[layer_name].fill_color[i];\n data_manager.current_layers[layer_name].fill_color[i] = col;\n selection.selectAll(symbol).each(function () {\n if ((0, _colors_helpers.rgb2hex)(this.getAttribute('fill')) === to_replace) {\n this.setAttribute('fill', col);\n }\n });\n });\n };\n\n for (var i = 0; i < data_manager.current_layers[layer_name].fill_color.length; i++) {\n _loop(i);\n }\n\n var size_section = popup.append('p').attr('class', 'line_elem').attr('id', 'size_section').style('clear', 'both');\n\n size_section.append('span').html(_tr('app_page.layer_style_popup.ref_size'));\n size_section.insert('input').attrs({ type: 'range', min: 1, max: 40, step: 1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.size).on('change', function () {\n var val = +this.value;\n var nCol = data_manager.current_layers[layer_name].nCol;\n data_manager.current_layers[layer_name].size = val;\n selection.selectAll('g').selectAll(symbol).each(function (_, i) {\n if (symbol === 'circle') {\n var t_x = round(i % nCol * 2 * val);\n var t_y = floor(floor(i / nCol) * 2 * val);\n this.setAttribute('r', val);\n this.setAttribute('transform', 'translate(-' + t_x + ', -' + t_y + ')');\n } else {\n var offset = val / 5;\n var _t_x = round(i % nCol * val) + offset * round(i % nCol);\n var _t_y = floor(floor(i / nCol) * val) + offset * floor(i / nCol);\n this.setAttribute('width', val);\n this.setAttribute('height', val);\n this.setAttribute('transform', 'translate(-' + _t_x + ', -' + _t_y + ')');\n }\n });\n size_section.select('#size_section_txt').html(this.value + ' px');\n });\n size_section.append('span').attr('id', 'size_section_txt').style('float', 'right').html(previous_params.size + ' px');\n\n var width_row_section = popup.append('p').attr('class', 'line_elem').attr('id', 'width_row_section');\n\n width_row_section.append('span').html(_tr('app_page.func_options.twostocks.waffle_width_rows'));\n width_row_section.insert('input').attrs({ type: 'range', min: 1, max: 10, step: 1 }).styles({ width: '58px', 'vertical-align': 'middle', display: 'inline', float: 'right' }).property('value', previous_params.nCol).on('change', function () {\n var val = +this.value;\n var size = data_manager.current_layers[layer_name].size;\n data_manager.current_layers[layer_name].nCol = val;\n selection.selectAll('g').selectAll(symbol).each(function (d, i) {\n if (symbol === 'circle') {\n var t_x = round(i % val * 2 * size);\n var t_y = floor(floor(i / val) * 2 * size);\n this.setAttribute('transform', 'translate(-' + t_x + ', -' + t_y + ')');\n } else {\n var offset = size / 5;\n var _t_x2 = round(i % val * size) + offset * round(i % val);\n var _t_y2 = floor(floor(i / val) * size) + offset * floor(i / val);\n this.setAttribute('transform', 'translate(-' + _t_x2 + ', -' + _t_y2 + ')');\n }\n });\n width_row_section.select('#width_row_text').html(this.value);\n });\n width_row_section.append('span').attr('id', 'width_row_text').style('float', 'right').html(previous_params.nCol);\n\n var allow_move_section = popup.append('p');\n var chkbx = allow_move_section.insert('input').style('margin', '0').property('checked', data_manager.current_layers[layer_name].draggable ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_move_symbol'\n });\n allow_move_section.insert('label').attr('for', 'checkbox_move_symbol').html(_tr('app_page.layer_style_popup.let_draggable'));\n chkbx.on('change', function () {\n if (this.checked) {\n data_manager.current_layers[layer_name].draggable = true;\n } else {\n data_manager.current_layers[layer_name].draggable = false;\n }\n });\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n}\n\nfunction createStyleBox_ProbSymbol(layer_name) {\n (0, _dialogs.check_remove_existing_box)('.styleBox');\n var layer_id = _app.layer_to_id.get(layer_name),\n g_lyr_name = '#' + layer_id,\n ref_layer_name = data_manager.current_layers[layer_name].ref_layer_name,\n type_method = data_manager.current_layers[layer_name].renderer,\n type_symbol = data_manager.current_layers[layer_name].symbol,\n field_used = data_manager.current_layers[layer_name].rendered_field,\n selection = map.select(g_lyr_name).selectAll(type_symbol),\n old_size = [data_manager.current_layers[layer_name].size[0], data_manager.current_layers[layer_name].size[1]];\n var rendering_params = void 0;\n var stroke_prev = selection.style('stroke');\n var stroke_width = selection.style('stroke-width');\n var prev_random_colors = void 0;\n\n var opacity = selection.style('fill-opacity'),\n border_opacity = selection.style('stroke-opacity');\n\n var fill_prev = (0, _helpers.cloneObj)(data_manager.current_layers[layer_name].fill_color);\n var d_values = data_manager.result_data[layer_name].map(function (v) {\n return +v[field_used];\n });\n var prev_col_breaks = void 0;\n var redraw_prop_val = function redraw_prop_val(prop_values) {\n var selec = selection._groups[0];\n\n if (type_symbol === 'circle') {\n for (var i = 0, len = prop_values.length; i < len; i++) {\n selec[i].setAttribute('r', prop_values[i]);\n }\n } else if (type_symbol === 'rect') {\n for (var _i = 0, _len = prop_values.length; _i < _len; _i++) {\n var old_rect_size = +selec[_i].getAttribute('height');\n var centr = [+selec[_i].getAttribute('x') + old_rect_size / 2 - prop_values[_i] / 2, +selec[_i].getAttribute('y') + old_rect_size / 2 - prop_values[_i] / 2];\n selec[_i].setAttribute('x', centr[0]);\n selec[_i].setAttribute('y', centr[1]);\n selec[_i].setAttribute('height', prop_values[_i]);\n selec[_i].setAttribute('width', prop_values[_i]);\n }\n }\n };\n\n if (data_manager.current_layers[layer_name].colors_breaks && data_manager.current_layers[layer_name].colors_breaks instanceof Array) {\n prev_col_breaks = [].concat(data_manager.current_layers[layer_name].colors_breaks);\n } else if (data_manager.current_layers[layer_name].break_val !== undefined) {\n prev_col_breaks = data_manager.current_layers[layer_name].break_val;\n } else if (fill_prev.random) {\n prev_random_colors = [];\n selection.each(function () {\n prev_random_colors.push(this.style.fill);\n });\n }\n if (stroke_prev.startsWith('rgb')) stroke_prev = (0, _colors_helpers.rgb2hex)(stroke_prev);\n if (stroke_width.endsWith('px')) stroke_width = stroke_width.substring(0, stroke_width.length - 2);\n\n (0, _dialogs.make_confirm_dialog2)('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (confirmed) {\n // if(data_manager.current_layers[layer_name].size != old_size){\n var lgd_prop_symb = document.querySelector(['#legend_root_symbol.lgdf_', layer_id].join(''));\n if (lgd_prop_symb) {\n (0, _map_ctrl.redraw_legends_symbols)(lgd_prop_symb);\n }\n if (type_symbol === 'circle') {\n selection.each(function (d) {\n d.properties.prop_value = this.getAttribute('r'); // eslint-disable-line no-param-reassign\n d.properties.color = (0, _colors_helpers.rgb2hex)(this.style.fill); // eslint-disable-line no-param-reassign\n });\n } else {\n selection.each(function (d) {\n d.properties.prop_value = this.getAttribute('height'); // eslint-disable-line no-param-reassign\n d.properties.color = (0, _colors_helpers.rgb2hex)(this.style.fill); // eslint-disable-line no-param-reassign\n });\n }\n\n if ((type_method === 'PropSymbolsChoro' || type_method === 'PropSymbolsTypo') && rendering_params !== undefined) {\n if (type_method === 'PropSymbolsChoro') {\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n data_manager.current_layers[layer_name].colors_breaks = [];\n for (var i = rendering_params.breaks.length - 1; i > 0; --i) {\n data_manager.current_layers[layer_name].colors_breaks.push([[rendering_params.breaks[i - 1], ' - ', rendering_params.breaks[i]].join(''), rendering_params.colors[i - 1]]);\n }\n data_manager.current_layers[layer_name].options_disc = {\n schema: rendering_params.schema,\n colors: rendering_params.colors,\n no_data: rendering_params.no_data,\n type: rendering_params.type,\n breaks: rendering_params.breaks,\n extra_options: rendering_params.extra_options\n };\n } else if (type_method === 'PropSymbolsTypo') {\n data_manager.current_layers[layer_name].fill_color = {\n class: [].concat(rendering_params.colorsByFeature)\n };\n data_manager.current_layers[layer_name].color_map = rendering_params.color_map;\n }\n data_manager.current_layers[layer_name].rendered_field2 = rendering_params.field;\n // Also change the legend if there is one displayed :\n if (document.querySelector('.legend.legend_feature.lgdf_' + _app.layer_to_id.get(layer_name)).id === 'legend_root') {\n redraw_legend('choro', layer_name, data_manager.current_layers[layer_name].rendered_field);\n } else {\n redraw_legend('choro_horiz', layer_name, data_manager.current_layers[layer_name].rendered_field);\n }\n }\n // if(selection._groups[0][0].__data__.properties.color && rendering_params !== undefined){\n // selection.each((d,i) => {\n // d.properties.color = rendering_params.colorsByFeature[i];\n // });\n // }\n // Change the layer name if requested :\n if (new_layer_name !== layer_name) {\n change_layer_name(layer_name, (0, _function.check_layer_name)(new_layer_name.trim()));\n }\n } else {\n selection.style('fill-opacity', opacity);\n map.select(g_lyr_name).style('stroke-width', stroke_width);\n data_manager.current_layers[layer_name]['stroke-width-const'] = stroke_width;\n var fill_meth = Object.getOwnPropertyNames(fill_prev)[0];\n if (fill_meth === 'single') {\n selection.style('fill', fill_prev.single).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'two') {\n data_manager.current_layers[layer_name].break_val = prev_col_breaks;\n data_manager.current_layers[layer_name].fill_color = { two: [fill_prev.two[0], fill_prev.two[1]] };\n selection.style('fill', function (d, i) {\n return d_values[i] > prev_col_breaks ? fill_prev.two[1] : fill_prev.two[0];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'class') {\n selection.style('fill-opacity', opacity).style('fill', function (d, i) {\n return data_manager.current_layers[layer_name].fill_color.class[i];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n data_manager.current_layers[layer_name].colors_breaks = prev_col_breaks;\n } else if (fill_meth === 'random') {\n selection.style('fill', function (_, i) {\n return prev_random_colors[i] || _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n }).style('stroke-opacity', border_opacity).style('stroke', stroke_prev);\n } else if (fill_meth === 'categorical') {\n fill_categorical(layer_name, fill_prev.categorical[0], type_symbol, fill_prev.categorical[1]);\n }\n data_manager.current_layers[layer_name].fill_color = fill_prev;\n if (data_manager.current_layers[layer_name].size[1] !== old_size[1]) {\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, old_size[0], old_size[1], type_symbol);\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size = [old_size[0], old_size[1]];\n }\n }\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var container = document.querySelector('.twbs > .styleBox');\n var popup = d3.select(container).select('.modal-content').style('width', '300px').select('.modal-body');\n\n popup.append('p').styles({ 'text-align': 'center', color: 'grey' }).html([_tr('app_page.layer_style_popup.rendered_field', { field: data_manager.current_layers[layer_name].rendered_field }), _tr('app_page.layer_style_popup.reference_layer', { layer: ref_layer_name })].join(''));\n\n var new_layer_name = layer_name;\n var new_name_section = make_change_layer_name_section(popup, layer_name);\n new_name_section.on('change', function () {\n new_layer_name = this.value;\n });\n\n if (type_method === 'PropSymbolsChoro') {\n var field_color = data_manager.current_layers[layer_name].rendered_field2;\n popup.append('p').styles({ margin: 'auto', 'text-align': 'center' }).html(_tr('app_page.layer_style_popup.field_symbol_color', { field: field_color })).append('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_discretization')).on('click', function () {\n container.modal.hide();\n var _opts = rendering_params ? { schema: rendering_params.schema, colors: rendering_params.colors, no_data: rendering_params.no_data, type: rendering_params.type, breaks: rendering_params.breaks, extra_options: rendering_params.extra_options } : data_manager.current_layers[layer_name].options_disc;\n (0, _discretization_panel.display_discretization)(layer_name, field_color, _opts.breaks.length - 1, _opts).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n type: confirmed[1],\n breaks: confirmed[2],\n colors: confirmed[3],\n colorsByFeature: confirmed[4],\n schema: confirmed[5],\n no_data: confirmed[6],\n renderer: 'PropSymbolsChoro',\n field: field_color,\n extra_options: confirmed[7]\n };\n selection.style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else if (data_manager.current_layers[layer_name].break_val !== undefined) {\n var fill_color_section = popup.append('div').attr('id', 'fill_color_section');\n fill_color_section.append('p').style('text-align', 'center').html(_tr('app_page.layer_style_popup.color_break'));\n var p2 = fill_color_section.append('p').style('display', 'inline');\n var col1 = p2.insert('input').attrs({ id: 'col1', type: 'color' }).property('value', data_manager.current_layers[layer_name].fill_color.two[0]).on('change', function () {\n var _this = this;\n\n var new_break_val = +b_val.node().value;\n data_manager.current_layers[layer_name].fill_color.two[0] = this.value;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? col2.node().value : _this.value;\n });\n });\n var col2 = p2.insert('input').attrs({ id: 'col2', type: 'color' }).property('value', data_manager.current_layers[layer_name].fill_color.two[1]).on('change', function () {\n var _this2 = this;\n\n var new_break_val = +b_val.node().value;\n data_manager.current_layers[layer_name].fill_color.two[1] = this.value;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? _this2.value : col1.node().value;\n });\n });\n fill_color_section.insert('span').html(_tr('app_page.layer_style_popup.break_value'));\n var b_val = fill_color_section.insert('input').attr('type', 'number').style('width', '75px').property('value', data_manager.current_layers[layer_name].break_val).on('change', function () {\n var new_break_val = +this.value;\n data_manager.current_layers[layer_name].break_val = new_break_val;\n selection.transition().style('fill', function (d, i) {\n return d_values[i] > new_break_val ? col2.node().value : col1.node().value;\n });\n });\n } else if (type_method === 'PropSymbolsTypo') {\n var _field_color = data_manager.current_layers[layer_name].rendered_field2;\n popup.append('p').style('margin', 'auto').html(_tr('app_page.layer_style_popup.field_symbol_color', { field: _field_color }));\n popup.append('p').style('text-align', 'center').insert('button').attr('class', 'button_disc').html(_tr('app_page.layer_style_popup.choose_colors')).on('click', function () {\n var _prepare_categories_a5 = (0, _function.prepare_categories_array)(layer_name, _field_color, data_manager.current_layers[layer_name].color_map),\n _prepare_categories_a6 = _slicedToArray(_prepare_categories_a5, 1),\n cats = _prepare_categories_a6[0];\n\n container.modal.hide();\n (0, _categorical_panel.display_categorical_box)(data_manager.result_data[layer_name], layer_name, _field_color, cats).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n rendering_params = {\n nb_class: confirmed[0],\n color_map: confirmed[1],\n colorsByFeature: confirmed[2],\n renderer: 'Categorical',\n rendered_field: _field_color,\n field: _field_color\n };\n selection.style('fill', function (d, i) {\n return rendering_params.colorsByFeature[i];\n });\n }\n });\n });\n } else {\n // const fields_all = type_col2(data_manager.result_data[layer_name]),\n // fields = getFieldsType('category', null, fields_all);\n var fill_method = popup.append('p').html(_tr('app_page.layer_style_popup.fill_color')).insert('select');\n\n [[_tr('app_page.layer_style_popup.single_color'), 'single'], [_tr('app_page.layer_style_popup.random_color'), 'random']].forEach(function (d) {\n fill_method.append('option').text(d[0]).attr('value', d[1]);\n });\n popup.append('div').attr('id', 'fill_color_section');\n fill_method.on('change', function () {\n popup.select('#fill_color_section').html('').on('click', null);\n if (this.value === 'single') {\n make_single_color_menu(layer_name, fill_prev, type_symbol);\n map.select(g_lyr_name).selectAll(type_symbol).transition().style('fill', fill_prev.single);\n data_manager.current_layers[layer_name].fill_color = (0, _helpers.cloneObj)(fill_prev);\n } else if (this.value === 'random') {\n make_random_color(layer_name, type_symbol);\n document.getElementById('random_color_btn').click();\n }\n });\n (0, _helpers.setSelected)(fill_method.node(), Object.getOwnPropertyNames(fill_prev)[0]);\n }\n\n var fill_opct_section = popup.append('p').attr('class', 'line_elem');\n fill_opct_section.append('span').html(_tr('app_page.layer_style_popup.fill_opacity'));\n\n fill_opct_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: 1,\n step: 0.1\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right'\n }).property('value', opacity).on('change', function () {\n selection.style('fill-opacity', this.value);\n fill_opct_section.select('#fill_opacity_txt').html(+this.value * 100 + '%');\n });\n\n fill_opct_section.append('span').attr('id', 'fill_opacity_txt').style('float', 'right').html(+opacity * 100 + '%');\n\n var border_color_section = popup.append('p').attr('class', 'line_elem');\n border_color_section.append('span').html(_tr('app_page.layer_style_popup.border_color'));\n border_color_section.insert('input').attr('type', 'color').style('float', 'right').property('value', stroke_prev).on('change', function () {\n selection.transition().style('stroke', this.value);\n });\n\n var border_opacity_section = popup.append('p');\n border_opacity_section.append('span').html(_tr('app_page.layer_style_popup.border_opacity'));\n\n border_opacity_section.insert('input').attrs({\n type: 'range',\n min: 0,\n max: 1,\n step: 0.1\n }).styles({\n width: '58px',\n 'vertical-align': 'middle',\n display: 'inline',\n float: 'right'\n }).property('value', border_opacity).on('change', function () {\n selection.style('stroke-opacity', this.value);\n border_opacity_section.select('#border_opacity_txt').html('' + this.value);\n });\n\n border_opacity_section.append('span').attr('id', 'border_opacity_txt').style('float', 'right').html(' ' + border_opacity);\n\n var border_width_section = popup.append('p').attr('class', 'line_elem');\n border_width_section.append('span').html(_tr('app_page.layer_style_popup.border_width'));\n border_width_section.insert('input').attrs({ type: 'number', min: 0, step: 0.1 }).styles({ width: '60px', float: 'right' }).property('value', stroke_width).on('change', function () {\n selection.style('stroke-width', this.value + 'px');\n data_manager.current_layers[layer_name]['stroke-width-const'] = +this.value;\n });\n\n var prop_val_content = popup.append('p');\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.field_symbol_size', { field: field_used }));\n prop_val_content.append('span').html(_tr('app_page.layer_style_popup.symbol_fixed_size'));\n prop_val_content.insert('input').styles({ width: '60px', float: 'right' }).attrs({\n type: 'number',\n id: 'max_size_range',\n min: 0.1,\n step: 'any'\n }).property('value', data_manager.current_layers[layer_name].size[1]).on('change', function () {\n var f_size = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, data_manager.current_layers[layer_name].size[0], f_size, type_symbol);\n data_manager.current_layers[layer_name].size[1] = f_size;\n redraw_prop_val(prop_values);\n });\n prop_val_content.append('span').style('float', 'right').html('(px)');\n\n var prop_val_content2 = popup.append('p').attr('class', 'line_elem');\n prop_val_content2.append('span').html(_tr('app_page.layer_style_popup.on_value'));\n prop_val_content2.insert('input').styles({ width: '100px', float: 'right' }).attrs({ type: 'number', min: 0.1, step: 0.1 }).property('value', +data_manager.current_layers[layer_name].size[0]).on('change', function () {\n var f_val = +this.value;\n var prop_values = (0, _helpers_calc.prop_sizer3_e)(d_values, f_val, data_manager.current_layers[layer_name].size[1], type_symbol);\n redraw_prop_val(prop_values);\n data_manager.current_layers[layer_name].size[0] = f_val;\n });\n\n var allow_move_section = popup.append('p');\n var chkbx = allow_move_section.insert('input').style('margin', '0').property('checked', data_manager.current_layers[layer_name].draggable ? true : null).attrs({\n type: 'checkbox',\n id: 'checkbox_move_symbol'\n });\n allow_move_section.insert('label').attr('for', 'checkbox_move_symbol').html(_tr('app_page.layer_style_popup.let_draggable'));\n chkbx.on('change', function () {\n if (this.checked) {\n data_manager.current_layers[layer_name].draggable = true;\n } else {\n data_manager.current_layers[layer_name].draggable = false;\n }\n });\n\n popup.append('p').style('text-align', 'center').insert('button').attrs({ id: 'reset_symb_loc', class: 'button_st4' }).text(_tr('app_page.layer_style_popup.reset_symbols_location')).on('click', function () {\n selection.transition().attrs(function (d) {\n var centroid = path.centroid(d.geometry);\n if (type_symbol === 'circle') {\n return {\n cx: centroid[0],\n cy: centroid[1]\n };\n } else {\n return {\n x: centroid[0] - +d.properties.prop_value / 2,\n y: centroid[1] - +d.properties.prop_value / 2\n };\n }\n });\n });\n make_generate_labels_section(popup, layer_name);\n}\n\n/**\n* Function triggered when the user want to edit a single label.\n*\n* @param {Node} label_node - The HTMLElement corresponding to this label.\n* @return {void}\n*\n*/\nfunction make_style_box_indiv_label(label_node) {\n var current_options = {\n size: label_node.style.fontSize,\n content: label_node.textContent,\n font: label_node.style.fontFamily,\n color: label_node.style.fill\n };\n // const new_params = {};\n if (current_options.color.startsWith('rgb')) {\n current_options.color = (0, _colors_helpers.rgb2hex)(current_options.color);\n }\n (0, _dialogs.check_remove_existing_box)('.styleTextAnnotation');\n (0, _dialogs.make_confirm_dialog2)('styleTextAnnotation', _tr('app_page.func_options.label.title_box_indiv'), { widthFitContent: true, draggable: true }).then(function (confirmed) {\n if (!confirmed) {\n label_node.style.fontsize = current_options.size; // eslint-disable-line no-param-reassign\n label_node.textContent = current_options.content; // eslint-disable-line no-param-reassign\n label_node.style.fill = current_options.color; // eslint-disable-line no-param-reassign\n label_node.style.fontFamily = current_options.font; // eslint-disable-line no-param-reassign\n }\n });\n var box_content = d3.select('.styleTextAnnotation').select('.modal-content').style('width', '300px').select('.modal-body').insert('div');\n var a = box_content.append('p').attr('class', 'line_elem');\n a.insert('span').html(_tr('app_page.func_options.label.font_size'));\n a.append('input').attrs({\n type: 'number',\n id: 'font_size',\n min: 0,\n max: 34,\n step: 'any'\n }).styles({ width: '70px', float: 'right' }).property('value', +label_node.style.fontSize.slice(0, -2)).on('change', function () {\n label_node.style.fontSize = this.value + 'px'; // eslint-disable-line no-param-reassign\n });\n var b = box_content.append('p').attr('class', 'line_elem');\n b.insert('span').html(_tr('app_page.func_options.label.content'));\n b.append('input').attr('id', 'label_content').styles({ width: '70px', float: 'right' }).property('value', label_node.textContent).on('keyup', function () {\n label_node.textContent = this.value; // eslint-disable-line no-param-reassign\n });\n var c = box_content.append('p').attr('class', 'line_elem');\n c.insert('span').html(_tr('app_page.func_options.common.color'));\n c.append('input').attrs({ type: 'color', id: 'label_color' }).styles({ width: '70px', float: 'right' }).property('value', (0, _colors_helpers.rgb2hex)(label_node.style.fill)).on('change', function () {\n label_node.style.fill = this.value; // eslint-disable-line no-param-reassign\n });\n var d = box_content.append('p').attr('class', 'line_elem');\n d.insert('span').html(_tr('app_page.func_options.label.font_type'));\n var selec_fonts = d.append('select').style('float', 'right').on('change', function () {\n label_node.style.fontFamily = this.value; // eslint-disable-line no-param-reassign\n });\n\n _fonts.available_fonts.forEach(function (name) {\n selec_fonts.append('option').attr('value', name[1]).text(name[0]);\n });\n selec_fonts.node().value = label_node.style.fontFamily;\n}\n\n/**\n* Function creating a drop shadow on a layer.\n* Currently the properties (offset, gaussianBlur) of this shadow are hard-coded.\n*\n* @param {String} layerId - The id of the layer (ie. the \"id\" attribute, not the layer name)\n* @return {void}\n*\n*/\nvar createDropShadow = exports.createDropShadow = function createDropShadow(layerId) {\n var filt_to_use = document.createElementNS('http://www.w3.org/2000/svg', 'filter');\n filt_to_use.setAttribute('id', 'filt_' + layerId);\n // filt_to_use.setAttribute(\"x\", 0);\n // filt_to_use.setAttribute(\"y\", 0);\n filt_to_use.setAttribute('width', '200%');\n filt_to_use.setAttribute('height', '200%');\n var offset = document.createElementNS('http://www.w3.org/2000/svg', 'feOffset');\n offset.setAttributeNS(null, 'result', 'offOut');\n offset.setAttributeNS(null, 'in', 'SourceAlpha');\n offset.setAttributeNS(null, 'dx', '5');\n offset.setAttributeNS(null, 'dy', '5');\n var gaussian_blur = document.createElementNS('http://www.w3.org/2000/svg', 'feGaussianBlur');\n gaussian_blur.setAttributeNS(null, 'result', 'blurOut');\n gaussian_blur.setAttributeNS(null, 'in', 'offOut');\n gaussian_blur.setAttributeNS(null, 'stdDeviation', 10);\n var blend = document.createElementNS('http://www.w3.org/2000/svg', 'feBlend');\n blend.setAttributeNS(null, 'in', 'SourceGraphic');\n blend.setAttributeNS(null, 'in2', 'blurOut');\n blend.setAttributeNS(null, 'mode', 'normal');\n filt_to_use.appendChild(offset);\n filt_to_use.appendChild(gaussian_blur);\n filt_to_use.appendChild(blend);\n defs.node().appendChild(filt_to_use);\n svg_map.querySelector('#' + layerId).setAttribute('filter', 'url(#filt_' + layerId + ')');\n};\n\n/**\n* Return the id of a gaussian blur filter with the desired size (stdDeviation attribute)\n* if one with the same param already exists, its id is returned,\n* otherwise a new one is created, and its id is returned\n*/\n// var getBlurFilter = (function(size){\n// var count = 0;\n// return function(size) {\n// let blur_filts = defs.node().getElementsByClassName(\"blur\");\n// let blur_filt_to_use;\n// for(let i=0; i < blur_filts.length; i++){\n// if(blur_filts[i].querySelector(\"feGaussianBlur\")\n// .getAttributeNS(null, \"stdDeviation\") === size){\n// blur_filt_to_use = blur_filts[i];\n// }\n// }\n// if(!blur_filt_to_use){\n// count = count + 1;\n// blur_filt_to_use = document.createElementNS(\n// \"http://www.w3.org/2000/svg\", \"filter\");\n// blur_filt_to_use.setAttribute(\"id\",\"blurfilt\" + count);\n// blur_filt_to_use.setAttribute(\"class\", \"blur\");\n// var gaussianFilter = document.createElementNS(\n// \"http://www.w3.org/2000/svg\", \"feGaussianBlur\");\n// gaussianFilter.setAttributeNS(null, \"in\", \"SourceGraphic\");\n// gaussianFilter.setAttributeNS(null, \"stdDeviation\", size);\n// blur_filt_to_use.appendChild(gaussianFilter);\n// defs.node().appendChild(blur_filt_to_use);\n// }\n// return blur_filt_to_use.id;\n// };\n// })();\n\nfunction change_layer_name(old_name, new_name) {\n // Temporarily deactivate the tooltip displaying information under the cursor:\n var restart_info = false;\n if (document.getElementById('info_features').className === 'active') {\n (0, _interface.displayInfoOnMove)();\n restart_info = true;\n }\n var old_id = global._app.layer_to_id.get(old_name);\n var new_id = encodeId(new_name);\n data_manager.current_layers[new_name] = (0, _helpers.cloneObj)(data_manager.current_layers[old_name]);\n delete data_manager.current_layers[old_name];\n var list_elem = document.querySelector('li.' + old_id);\n list_elem.classList.remove(old_id);\n list_elem.classList.add(new_id);\n list_elem.setAttribute('layer_name', new_name);\n list_elem.innerHTML = list_elem.innerHTML.replace((0, _helpers.get_display_name_on_layer_list)(old_name), (0, _helpers.get_display_name_on_layer_list)(new_name));\n var b = svg_map.querySelector('#' + old_id);\n b.id = new_id;\n var lgd_elems = document.querySelectorAll('g[layer_name=\"' + old_name + '\"]');\n lgd_elems.forEach(function (lgd_elem) {\n lgd_elem.setAttribute('layer_name', new_name);\n lgd_elem.classList.remove('lgdf_' + old_id);\n lgd_elem.classList.add('lgdf_' + new_id);\n });\n if (Object.getOwnPropertyNames(data_manager.result_data).indexOf(old_name) > -1) {\n data_manager.result_data[new_name] = [].concat(data_manager.result_data[old_name]);\n delete data_manager.result_data[old_name];\n }\n if (Object.getOwnPropertyNames(data_manager.user_data).indexOf(old_name) > -1) {\n data_manager.user_data[new_name] = [].concat(data_manager.user_data[old_name]);\n delete data_manager.user_data[old_name];\n }\n if (data_manager.current_layers[new_name].targeted) {\n var name_section1 = document.getElementById('section1').querySelector('#input_geom');\n name_section1.innerHTML = name_section1.innerHTML.replace(old_name, new_name);\n if (window.fields_handler) {\n window.fields_handler.unfill();\n window.fields_handler.fill(new_name);\n }\n }\n if (_app.current_functionnality && _app.current_functionnality.name === 'smooth') {\n var mask_layers = document.querySelectorAll('select#stewart_mask > option');\n for (var i = 0; i < mask_layers.length; i++) {\n if (mask_layers[i].value === old_name) {\n mask_layers[i].value = new_name;\n mask_layers[i].innerHTML = new_name;\n }\n }\n }\n var other_layers = Object.getOwnPropertyNames(data_manager.current_layers);\n for (var _i2 = 0; _i2 < other_layers.length; _i2++) {\n if (data_manager.current_layers[other_layers[_i2]].ref_layer_name === old_name) {\n data_manager.current_layers[other_layers[_i2]].ref_layer_name = new_name;\n }\n }\n var select_export_lyr = document.getElementById('section5').querySelectorAll('#layer_to_export > option');\n for (var _i3 = 0; _i3 < select_export_lyr.length; _i3++) {\n if (select_export_lyr[_i3].value === old_name) {\n select_export_lyr[_i3].value = new_name;\n select_export_lyr[_i3].innerHTML = new_name;\n }\n }\n _app.layer_to_id.set(new_name, new_id);\n _app.id_to_layer.set(new_id, new_name);\n _app.layer_to_id.delete(old_name);\n _app.id_to_layer.delete(old_id);\n (0, _interface.binds_layers_buttons)(new_name);\n\n if (restart_info) {\n (0, _interface.displayInfoOnMove)();\n }\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/layers_style_popup.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/arrow.js":
-/*!*************************************!*\
- !*** ./js/layout_features/arrow.js ***!
- \*************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar atan2 = Math.atan2;\nvar sin = Math.sin;\nvar cos = Math.cos;\nvar PI = Math.PI;\n\nvar UserArrow = function () {\n function UserArrow(id, origin_pt, destination_pt) {\n var parent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;\n var untransformed = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n _classCallCheck(this, UserArrow);\n\n this.parent = parent || svg_map;\n this.svg_elem = d3.select(this.parent);\n this.id = id;\n this.stroke_width = 4;\n this.color = 'rgb(0, 0, 0)';\n this.hide_head = undefined;\n if (!untransformed) {\n var zoom_param = svg_map.__zoom;\n this.pt1 = [(origin_pt[0] - zoom_param.x) / zoom_param.k, (origin_pt[1] - zoom_param.y) / zoom_param.k];\n this.pt2 = [(destination_pt[0] - zoom_param.x) / zoom_param.k, (destination_pt[1] - zoom_param.y) / zoom_param.k];\n } else {\n this.pt1 = origin_pt;\n this.pt2 = destination_pt;\n }\n var self = this;\n this.drag_behavior = d3.drag().subject(function () {\n // let snap_lines = get_coords_snap_lines(this.id + this.className);\n var t = d3.select(this.querySelector('line'));\n return {\n x: +t.attr('x2') - +t.attr('x1'),\n y: +t.attr('y2') - +t.attr('y1'),\n x1: t.attr('x1'),\n x2: t.attr('x2'),\n y1: t.attr('y1'),\n y2: t.attr('y2'),\n map_locked: !!map_div.select('#hand_button').classed('locked') // , snap_lines: snap_lines\n };\n }).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n (0, _interface.handle_click_hand)('lock');\n }).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n }).on('drag', function () {\n d3.event.sourceEvent.preventDefault();\n var _t = this.querySelector('line'),\n\n // arrow_head_size = +_t.style.strokeWidth.replace('px', ''),\n subject = d3.event.subject,\n tx = (+d3.event.x - +subject.x) / svg_map.__zoom.k,\n ty = (+d3.event.y - +subject.y) / svg_map.__zoom.k;\n self.pt1 = [+subject.x1 + tx, +subject.y1 + ty];\n self.pt2 = [+subject.x2 + tx, +subject.y2 + ty];\n // if(_app.autoalign_features){\n // let snap_lines_x = subject.snap_lines.x,\n // snap_lines_y = subject.snap_lines.y;\n // for(let i = 0; i < subject.snap_lines.x.length; i++){\n // if(Math.abs(snap_lines_x[i] - (self.pt1[0] + svg_map.__zoom.x / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: snap_lines_x[i], x2: snap_lines_x[i], y1: 0, y2: h}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // self.pt1[0] = snap_lines_x[i] - svg_map.__zoom.x / svg_map.__zoom.k;\n // }\n // if(Math.abs(snap_lines_x[i] - (self.pt2[0] + svg_map.__zoom.x / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: snap_lines_x[i], x2: snap_lines_x[i], y1: 0, y2: h}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // if(self.pt2[0] < self.pt1[0])\n // arrow_head_size = -arrow_head_size;\n // self.pt2[0] = snap_lines_x[i] - svg_map.__zoom.x / svg_map.__zoom.k + arrow_head_size;\n // }\n // if(Math.abs(snap_lines_y[i] - (self.pt1[1] + svg_map.__zoom.y / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: 0, x2: w, y1: snap_lines_y[i], y2: snap_lines_y[i]}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // self.pt1[1] = snap_lines_y[i] - svg_map.__zoom.y / svg_map.__zoom.k;\n // }\n // if(Math.abs(snap_lines_y[i] - (self.pt2[1] + svg_map.__zoom.y / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: 0, x2: w, y1: snap_lines_y[i], y2: snap_lines_y[i]}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // if(self.pt2[1] < self.pt1[1])\n // arrow_head_size = -arrow_head_size;\n // self.pt2[1] = snap_lines_y[i] - svg_map.__zoom.y / svg_map.__zoom.k + arrow_head_size;\n // }\n // }\n // }\n _t.x1.baseVal.value = self.pt1[0];\n _t.x2.baseVal.value = self.pt2[0];\n _t.y1.baseVal.value = self.pt1[1];\n _t.y2.baseVal.value = self.pt2[1];\n });\n\n var markers_exists = defs ? defs.node().querySelector('marker') : null;\n\n if (!markers_exists) {\n this.add_defs_marker();\n }\n this.draw();\n }\n\n _createClass(UserArrow, [{\n key: 'add_defs_marker',\n value: function add_defs_marker() {\n defs.append('marker').attrs({\n id: 'arrow_head',\n viewBox: '0 -5 10 10',\n refX: 5,\n refY: 0,\n orient: 'auto',\n markerWidth: 4,\n markerHeight: 4\n }).style('stroke-width', 1).append('path').attrs({ d: 'M0,-5L10,0L0,5', class: 'arrowHead' });\n if (this.parent.childNodes[0].tagName !== 'defs') {\n this.parent.insertBefore(defs.node(), this.parent.childNodes[0]);\n }\n }\n }, {\n key: 'draw',\n value: function draw() {\n var _this = this;\n\n var context_menu = new _contextMenu2.default(),\n getItems = function getItems() {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n _this.editStyle();\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n _this.up_element();\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n _this.down_element();\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n _this.remove();\n } }];\n };\n\n this.arrow = this.svg_elem.append('g').style('cursor', 'all-scroll').attrs({ class: 'arrow legend scalable-legend', id: this.id, transform: svg_map.__zoom.toString() });\n\n this.arrow.insert('line').attrs({\n 'marker-end': this.hide_head ? null : 'url(#arrow_head)',\n x1: this.pt1[0],\n y1: this.pt1[1],\n x2: this.pt2[0],\n y2: this.pt2[1] }).styles({ 'stroke-width': this.stroke_width, stroke: 'rgb(0, 0, 0)' });\n\n this.arrow.call(this.drag_behavior);\n\n this.arrow.on('contextmenu', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems());\n });\n this.arrow.on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n _this.handle_ctrl_pt();\n });\n }\n }, {\n key: 'remove',\n value: function remove() {\n // pos_lgds_elem.delete(this.arrow.attr('id'));\n this.arrow.remove();\n }\n }, {\n key: 'up_element',\n value: function up_element() {\n (0, _legend.up_legend)(this.arrow.node());\n }\n }, {\n key: 'down_element',\n value: function down_element() {\n (0, _legend.down_legend)(this.arrow.node());\n }\n }, {\n key: 'handle_ctrl_pt',\n value: function handle_ctrl_pt() {\n var self = this,\n line = self.arrow.node().querySelector('line'),\n zoom_params = svg_map.__zoom,\n map_locked = !!map_div.select('#hand_button').classed('locked'),\n msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_modify_feature'), 'warning', 0);\n\n // New behavior if the user click on the lock to move on the map :\n var cleanup_edit_state = function cleanup_edit_state() {\n edit_layer.remove();\n msg.dismiss();\n self.pt1 = [line.x1.baseVal.value, line.y1.baseVal.value];\n self.pt2 = [line.x2.baseVal.value, line.y2.baseVal.value];\n\n // Reactive the ability to move the arrow :\n self.arrow.call(self.drag_behavior);\n // Restore the ability to edit the control points on dblclick on the arrow :\n self.arrow.on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n self.handle_ctrl_pt();\n });\n if (!map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n // Restore the previous behiavor for the 'lock' button :\n document.getElementById('hand_button').onclick = _interface.handle_click_hand;\n };\n\n // Change the behavior of the 'lock' button :\n document.getElementById('hand_button').onclick = function () {\n cleanup_edit_state();\n (0, _interface.handle_click_hand)();\n };\n // Desactive the ability to drag the arrow :\n self.arrow.on('.drag', null);\n // Desactive the ability to zoom/move on the map ;\n (0, _interface.handle_click_hand)('lock');\n\n // Add a layer to intercept click on the map :\n var edit_layer = map.insert('g');\n edit_layer.append('rect').attrs({ x: 0, y: 0, width: w, height: h, class: 'edit_rect' }).style('fill', 'transparent').on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n cleanup_edit_state();\n });\n\n // Append two red squares for the start point and the end point of the arrow :\n edit_layer.append('rect').attrs({ x: self.pt1[0] * zoom_params.k + zoom_params.x - 3, y: self.pt1[1] * zoom_params.k + zoom_params.y - 3, height: 6, width: 6, id: 'arrow_start_pt' }).styles({ fill: 'red', cursor: 'grab' }).call(d3.drag().on('drag', function () {\n var t = d3.select(this),\n nx = d3.event.x,\n ny = d3.event.y;\n t.attrs({ x: nx - 3, y: ny - 3 });\n line.x1.baseVal.value = (nx - zoom_params.x) / zoom_params.k;\n line.y1.baseVal.value = (ny - zoom_params.y) / zoom_params.k;\n }));\n edit_layer.append('rect').attrs({ x: self.pt2[0] * zoom_params.k + zoom_params.x - 3, y: self.pt2[1] * zoom_params.k + zoom_params.y - 3, height: 6, width: 6, id: 'arrow_end_pt' }).styles({ fill: 'red', cursor: 'grab' }).call(d3.drag().on('drag', function () {\n var t = d3.select(this),\n nx = d3.event.x,\n ny = d3.event.y;\n t.attrs({ x: nx - 3, y: ny - 3 });\n line.x2.baseVal.value = (nx - zoom_params.x) / zoom_params.k;\n line.y2.baseVal.value = (ny - zoom_params.y) / zoom_params.k;\n }));\n\n // Exit the \"edit\" state by double clicking again on the arrow :\n self.arrow.on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n cleanup_edit_state();\n });\n }\n }, {\n key: 'calcAngle',\n value: function calcAngle() {\n var dx = this.pt2[0] - this.pt1[0],\n dy = this.pt2[1] - this.pt1[1];\n return atan2(dy, dx) * (180 / PI);\n }\n }, {\n key: 'calcDestFromOAD',\n value: function calcDestFromOAD(origin, angle, distance) {\n var theta = angle / (180 / PI),\n dx = distance * cos(theta),\n dy = distance * sin(theta);\n return [origin[0] + dx, origin[1] + dy];\n }\n }, {\n key: 'editStyle',\n value: function editStyle() {\n var current_options = { pt1: this.pt1.slice(),\n pt2: this.pt2.slice() };\n var self = this,\n line = self.arrow.node().querySelector('line'),\n angle = (-this.calcAngle()).toFixed(0),\n map_locked = !!map_div.select('#hand_button').classed('locked');\n\n if (!map_locked) (0, _interface.handle_click_hand)('lock');\n\n (0, _dialogs.check_remove_existing_box)('.styleBoxArrow');\n\n (0, _dialogs.make_confirm_dialog2)('styleBoxArrow', _tr('app_page.arrow_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (confirmed) {\n // Store shorcut of useful values :\n self.stroke_width = line.style.strokeWidth;\n self.color = line.style.stroke;\n self.pt1 = [line.x1.baseVal.value, line.y1.baseVal.value];\n self.pt2 = [line.x2.baseVal.value, line.y2.baseVal.value];\n } else {\n // Rollback on initials parameters :\n line.x1.baseVal.value = current_options.pt1[0];\n line.y1.baseVal.value = current_options.pt1[1];\n line.x2.baseVal.value = current_options.pt2[0];\n line.y2.baseVal.value = current_options.pt2[1];\n self.pt1 = current_options.pt1.slice();\n self.pt2 = current_options.pt2.slice();\n line.style.strokeWidth = self.stroke_width;\n line.style.stroke = self.color;\n }\n map.select('#arrow_start_pt').remove();\n map.select('#arrow_end_pt').remove();\n if (!map_locked) (0, _interface.handle_click_hand)('unlock');\n });\n\n var box_content = d3.select('.styleBoxArrow').select('.modal-body').style('width', '295px').insert('div').attr('id', 'styleBoxArrow');\n\n var s1 = box_content.append('p').attr('class', 'line_elem2');\n s1.append('span').html(_tr('app_page.arrow_edit_box.arrowWeight'));\n s1.insert('span').styles({ float: 'right', width: '13px' }).html(' px');\n s1.insert('input').attrs({ id: 'arrow_weight_text', class: 'without_spinner', min: 0, max: 34, step: 0.1 }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', self.stroke_width).on('input', function () {\n var elem = document.getElementById('arrow_stroke_width');\n elem.value = this.value;\n elem.dispatchEvent(new Event('change'));\n });\n\n s1.append('input').attrs({\n id: 'arrow_stroke_width',\n min: 0,\n max: 34,\n step: 0.1,\n type: 'range'\n }).styles({\n float: 'right',\n 'vertical-align': 'middle',\n width: '80px'\n }).property('value', self.stroke_width).on('change', function () {\n line.style.strokeWidth = this.value;\n document.getElementById('arrow_weight_text').value = +this.value;\n });\n\n var s2 = box_content.append('p').attr('class', 'line_elem2');\n s2.append('span').html(_tr('app_page.arrow_edit_box.arrowAngle'));\n s2.insert('span').styles({ float: 'right', width: '13px' }).html(' °');\n s2.insert('input').attrs({ id: 'arrow_angle_text', class: 'without_spinner', min: 0, max: 1, step: 1 }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', angle).on('input', function () {\n var elem = document.getElementById('arrow_angle');\n elem.value = this.value;\n elem.dispatchEvent(new Event('change'));\n });\n s2.insert('input').attrs({ id: 'arrow_angle', type: 'range', min: 0, max: 360, step: 1 }).styles({ width: '80px', 'vertical-align': 'middle', float: 'right' }).property('value', angle).on('change', function () {\n var distance = (0, _helpers_math.Msqrt)((self.pt1[0] - self.pt2[0]) * (self.pt1[0] - self.pt2[0]) + (self.pt1[1] - self.pt2[1]) * (self.pt1[1] - self.pt2[1]));\n var _angle = -+this.value;\n\n var _self$calcDestFromOAD = self.calcDestFromOAD(self.pt1, _angle, distance),\n _self$calcDestFromOAD2 = _slicedToArray(_self$calcDestFromOAD, 2),\n nx = _self$calcDestFromOAD2[0],\n ny = _self$calcDestFromOAD2[1];\n\n line.x2.baseVal.value = nx;\n line.y2.baseVal.value = ny;\n document.getElementById('arrow_angle_text').value = +this.value;\n });\n var s3 = box_content.append('p').attr('class', 'line_elem2');\n s3.append('label').attrs({ for: 'checkbox_head_arrow' }).html(_tr('app_page.arrow_edit_box.arrowHead'));\n s3.append('input').attrs({ type: 'checkbox', id: 'checkbox_head_arrow' }).styles({ 'margin-left': '45px', 'vertical-align': 'middle' }).property('checked', self.hide_head === true).on('change', function () {\n if (this.checked) {\n self.hide_head = true;\n self.arrow.select('line').attr('marker-end', null);\n } else {\n self.hide_head = false;\n self.arrow.select('line').attr('marker-end', 'url(#arrow_head)');\n }\n });\n }\n }]);\n\n return UserArrow;\n}();\n\nexports.default = UserArrow;\n\n//# sourceURL=webpack:///./js/layout_features/arrow.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/ellipse.js":
-/*!***************************************!*\
- !*** ./js/layout_features/ellipse.js ***!
- \***************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar atan2 = Math.atan2;\nvar sin = Math.sin;\nvar cos = Math.cos;\nvar PI = Math.PI;\n\nvar UserEllipse = function () {\n function UserEllipse(id, origin_pt) {\n var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n var untransformed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n _classCallCheck(this, UserEllipse);\n\n this.parent = parent || svg_map;\n this.svg_elem = d3.select(this.parent);\n this.id = id;\n this.stroke_width = 4;\n this.stroke_color = 'rgb(0, 0, 0)';\n\n if (!untransformed) {\n var zoom_param = svg_map.__zoom;\n this.pt1 = [(+origin_pt[0] - zoom_param.x) / zoom_param.k, (+origin_pt[1] - zoom_param.y) / zoom_param.k];\n } else {\n this.pt1 = [+origin_pt[0], +origin_pt[1]];\n }\n var self = this;\n this.drag_behavior = d3.drag().subject(function () {\n var t = d3.select(this.querySelector('ellipse'));\n return {\n x: +t.attr('cx'),\n y: +t.attr('cy'),\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n }).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n (0, _interface.handle_click_hand)('lock');\n }).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n }).on('drag', function () {\n d3.event.sourceEvent.preventDefault();\n var _t = this.querySelector('ellipse'),\n subject = d3.event.subject,\n tx = (+d3.event.x - +subject.x) / svg_map.__zoom.k,\n ty = (+d3.event.y - +subject.y) / svg_map.__zoom.k;\n self.pt1 = [+subject.x + tx, +subject.y + ty];\n _t.cx.baseVal.value = self.pt1[0];\n _t.cy.baseVal.value = self.pt1[1];\n });\n\n this.draw();\n return this;\n }\n\n _createClass(UserEllipse, [{\n key: 'draw',\n value: function draw() {\n var _this = this;\n\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems() {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n _this.editStyle();\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n _this.up_element();\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n _this.down_element();\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n _this.remove();\n } }];\n };\n\n this.ellipse = this.svg_elem.append('g').attrs({ class: 'user_ellipse legend scalable-legend', id: this.id, transform: svg_map.__zoom.toString() });\n\n this.ellipse.insert('ellipse').attrs({\n rx: 30,\n ry: 40,\n cx: this.pt1[0],\n cy: this.pt1[1]\n }).styles({\n fill: 'rgb(255, 255, 255)',\n 'fill-opacity': 0,\n stroke: this.stroke_color,\n 'stroke-width': this.stroke_width\n });\n\n this.ellipse.on('contextmenu', function () {\n context_menu.showMenu(d3.event, document.body, getItems());\n }).on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n _this.handle_ctrl_pt();\n }).call(this.drag_behavior);\n }\n }, {\n key: 'remove',\n value: function remove() {\n this.ellipse.remove();\n }\n }, {\n key: 'up_element',\n value: function up_element() {\n (0, _legend.up_legend)(this.ellipse.node());\n }\n }, {\n key: 'down_element',\n value: function down_element() {\n (0, _legend.down_legend)(this.ellipse.node());\n }\n }, {\n key: 'calcAngle',\n value: function calcAngle() {\n var ellipse_elem = this.ellipse.node().querySelector('ellipse'),\n dx = ellipse_elem.rx.baseVal.value - this.pt1[0],\n dy = ellipse_elem.ry.baseVal.value - this.pt1[1];\n return atan2(dy, dx) * (180 / PI);\n }\n }, {\n key: 'editStyle',\n value: function editStyle() {\n var self = this,\n ellipse_elem = self.ellipse.node().querySelector('ellipse'),\n\n // zoom_param = svg_map.__zoom,\n map_locked = !!map_div.select('#hand_button').classed('locked'),\n current_options = {\n pt1: this.pt1.slice(),\n rx: ellipse_elem.rx.baseVal.value,\n ry: ellipse_elem.ry.baseVal.value\n };\n // const angle = (-this.calcAngle()).toFixed(0);\n\n if (!map_locked) (0, _interface.handle_click_hand)('lock');\n (0, _dialogs.make_confirm_dialog2)('styleBoxEllipse', _tr('app_page.ellipse_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n map.selectAll('.ctrl_pt').remove();\n if (confirmed) {\n // Store shorcut of useful values :\n self.stroke_width = ellipse_elem.style.strokeWidth;\n self.stroke_color = ellipse_elem.style.stroke;\n } else {\n // Rollback on initials parameters :\n self.pt1 = current_options.pt1.slice();\n ellipse_elem.style.strokeWidth = self.stroke_width;\n ellipse_elem.style.stroke = self.stroke_color;\n }\n if (!map_locked) (0, _interface.handle_click_hand)('unlock');\n });\n var box_content = d3.select('.styleBoxEllipse').select('.modal-body').style('width', '295px').insert('div').attr('id', 'styleBoxEllipse');\n\n var s1 = box_content.append('p').attr('class', 'line_elem2');\n s1.append('span').style('margin', 'auto').html(_tr('app_page.ellipse_edit_box.stroke_width'));\n s1.append('input').attrs({\n min: 0,\n max: 34,\n step: 0.1,\n type: 'range'\n }).styles({ width: '80px', float: 'right' }).property('value', self.stroke_width).on('change', function () {\n ellipse_elem.style.strokeWidth = this.value;\n txt_line_weight.html(this.value + 'px');\n });\n var txt_line_weight = s1.append('span').styles({ float: 'right', margin: '0 5px 0 5px' }).html(self.stroke_width + ' px');\n\n var s2 = box_content.append('p').attr('class', 'line_elem2');\n\n s2.append('span').style('margin', 'auto').html(_tr('app_page.ellipse_edit_box.stroke_color'));\n\n s2.append('input').style('float', 'right').attr('type', 'color').property('value', self.stroke_color).on('change', function () {\n ellipse_elem.style.stroke = this.value;\n });\n // let s2b = box_content.append(\"p\").attr('class', 'line_elem2')\n // s2b.append(\"span\").html(_tr(\"app_page.ellipse_edit_box.ellispeAngle\"))\n // s2b.insert(\"span\").styles({float: 'right', 'width': '12px'}).html(\" °\");\n // s2b.insert(\"input\")\n // .attrs({id: \"ellipse_angle_text\", class: \"without_spinner\", value: angle, min: 0, max: 1, step: 1})\n // .styles({width: \"30px\", \"margin-left\": \"10px\", 'float': 'right'})\n // .on(\"input\", function(){\n // let elem = document.getElementById(\"ellipse_angle\");\n // elem.value = this.value;\n // elem.dispatchEvent(new Event('change'));\n // });\n // s2b.insert(\"input\")\n // .attrs({id: \"ellipse_angle\", type: \"range\", value: Math.abs(angle), min: 0, max: 360, step: 1})\n // .styles({width: \"80px\", \"vertical-align\": \"middle\", 'float': 'right'})\n // .on(\"change\", function(){\n // let pt2 = [self.pt1[0] - ellipse_elem.rx.baseVal.value, self.pt1[1]],\n // distance = Math.sqrt((self.pt1[0] - pt2[0]) * (self.pt1[0] - pt2[0]) + (self.pt1[1] - pt2[1]) * (self.pt1[1] - pt2[1])),\n // angle = Math.abs(+this.value);\n // let [nx, ny] = self.calcDestFromOAD(self.pt1, angle, distance);\n // console.log(\"angle :\", angle); console.log(\"pt2 :\", pt2); console.log(\"distance :\", distance);\n // console.log(ellipse_elem.rx.baseVal.value, self.pt1[0], nx);\n // console.log(ellipse_elem.ry.baseVal.value, self.pt1[1], ny);\n // ellipse_elem.rx.baseVal.value = nx;\n // ellipse_elem.ry.baseVal.value = ny;\n // document.getElementById(\"ellipse_angle_text\").value = +this.value;\n // });\n }\n }, {\n key: 'handle_ctrl_pt',\n value: function handle_ctrl_pt() {\n var self = this,\n ellipse_elem = self.ellipse.node().querySelector('ellipse'),\n zoom_param = svg_map.__zoom,\n map_locked = !!map_div.select('#hand_button').classed('locked'),\n msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_modify_feature'), 'warning', 0);\n\n var cleanup_edit_state = function cleanup_edit_state() {\n edit_layer.remove();\n msg.dismiss();\n self.ellipse.call(self.drag_behavior);\n self.ellipse.on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n self.handle_ctrl_pt();\n });\n if (!map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n document.getElementById('hand_button').onclick = _interface.handle_click_hand;\n };\n\n // Change the behavior of the 'lock' button :\n document.getElementById('hand_button').onclick = function () {\n cleanup_edit_state();\n (0, _interface.handle_click_hand)();\n };\n // Desactive the ability to drag the ellipse :\n self.ellipse.on('.drag', null);\n // Desactive the ability to zoom/move on the map ;\n (0, _interface.handle_click_hand)('lock');\n // Add a layer to intercept click on the map :\n var edit_layer = map.insert('g');\n edit_layer.append('rect').attrs({ x: 0, y: 0, width: w, height: h, class: 'edit_rect' }).style('fill', 'transparent').on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n cleanup_edit_state();\n });\n\n // Temporary start point:\n edit_layer.append('rect').attrs({\n id: 'pt1',\n class: 'ctrl_pt',\n height: 8,\n width: 8,\n x: (self.pt1[0] - ellipse_elem.rx.baseVal.value) * zoom_param.k + zoom_param.x - 4,\n y: self.pt1[1] * zoom_param.k + zoom_param.y - 4\n }).call(d3.drag().on('drag', function () {\n var t = d3.select(this);\n t.attr('x', d3.event.x - 4);\n var dist = self.pt1[0] - (d3.event.x - zoom_param.x) / zoom_param.k;\n ellipse_elem.rx.baseVal.value = dist;\n }));\n\n // Temporary end point:\n edit_layer.append('rect').attrs({ class: 'ctrl_pt',\n height: 8,\n width: 8,\n id: 'pt2',\n x: self.pt1[0] * zoom_param.k + zoom_param.x - 4,\n y: (self.pt1[1] - ellipse_elem.ry.baseVal.value) * zoom_param.k + zoom_param.y - 4 }).call(d3.drag().on('drag', function () {\n var t = d3.select(this);\n t.attr('y', d3.event.y - 4);\n var dist = self.pt1[1] - (d3.event.y - zoom_param.y) / zoom_param.k;\n ellipse_elem.ry.baseVal.value = dist;\n }));\n\n self.ellipse.on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n cleanup_edit_state();\n });\n }\n }], [{\n key: 'calcDestFromOAD',\n value: function calcDestFromOAD(origin, angle, distance) {\n var theta = angle / (180 / PI),\n dx = distance * cos(theta),\n dy = distance * sin(theta);\n return [origin[0] + dx, origin[1] + dy];\n }\n }]);\n\n return UserEllipse;\n}();\n\nexports.default = UserEllipse;\n\n//# sourceURL=webpack:///./js/layout_features/ellipse.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/helpers.js":
-/*!***************************************!*\
- !*** ./js/layout_features/helpers.js ***!
- \***************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add_layout_feature = add_layout_feature;\nexports.add_single_symbol = add_single_symbol;\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _arrow = __webpack_require__(/*! ./arrow */ \"./js/layout_features/arrow.js\");\n\nvar _arrow2 = _interopRequireDefault(_arrow);\n\nvar _ellipse = __webpack_require__(/*! ./ellipse */ \"./js/layout_features/ellipse.js\");\n\nvar _ellipse2 = _interopRequireDefault(_ellipse);\n\nvar _north_arrow = __webpack_require__(/*! ./north_arrow */ \"./js/layout_features/north_arrow.js\");\n\nvar _rectangle = __webpack_require__(/*! ./rectangle */ \"./js/layout_features/rectangle.js\");\n\nvar _rectangle2 = _interopRequireDefault(_rectangle);\n\nvar _scalebar = __webpack_require__(/*! ./scalebar */ \"./js/layout_features/scalebar.js\");\n\nvar _text_annotation = __webpack_require__(/*! ./text_annotation */ \"./js/layout_features/text_annotation.js\");\n\nvar _text_annotation2 = _interopRequireDefault(_text_annotation);\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _function = __webpack_require__(/*! ./../function */ \"./js/function.js\");\n\nvar _helpers = __webpack_require__(/*! ./../helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./../helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./../map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _projections = __webpack_require__(/*! ./../projections */ \"./js/projections.js\");\n\nvar _symbols_picto = __webpack_require__(/*! ./../symbols_picto */ \"./js/symbols_picto.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction ask_existing_feature(feature_name) {\n return swal({\n title: '',\n text: _tr('app_page.common.error_existing_' + feature_name),\n allowOutsideClick: false,\n allowEscapeKey: false,\n type: 'question',\n showConfirmButton: true,\n showCancelButton: true,\n confirmButtonText: _tr('app_page.common.yes'),\n cancelButtonText: _tr('app_page.common.no')\n });\n}\n\nvar getIdLayoutFeature = function getIdLayoutFeature(type) {\n var class_name = void 0,\n id_prefix = void 0,\n error_name = void 0;\n if (type === 'ellipse') {\n class_name = 'user_ellipse';\n id_prefix = 'user_ellipse_';\n error_name = 'error_max_ellipses';\n } else if (type === 'rectangle') {\n class_name = 'user_rectangle';\n id_prefix = 'user_rectangle_';\n error_name = 'error_max_rectangles';\n } else if (type === 'arrow') {\n class_name = 'arrow';\n id_prefix = 'arrow_';\n error_name = 'error_max_arrows';\n } else if (type === 'single_symbol') {\n class_name = 'single_symbol';\n id_prefix = 'single_symbol_';\n error_name = 'error_max_symbols';\n }\n var features = document.getElementsByClassName(class_name);\n if (!features) {\n return 0;\n } else if (features.length > 30) {\n swal(_tr('app_page.common.error'), _tr('app_page.common.' + error_name), 'error').catch(swal.noop);\n return null;\n }\n var ids = [];\n for (var i = 0; i < features.length; i++) {\n ids.push(+features[i].id.split(id_prefix)[1]);\n }\n if (ids.indexOf(features.length) === -1) {\n return features.length;\n }\n for (var _i = 0; _i < features.length; _i++) {\n if (ids.indexOf(_i) === -1) {\n return _i;\n }\n }\n return null;\n};\n\nfunction handleClickAddRectangle() {\n var esc_cancel = function esc_cancel(evt) {\n evt = evt || window.event;\n if ('key' in evt && evt.key !== 'Escape' && evt.key !== 'Esc' || evt.keyCode !== 27) {\n return;\n }\n msg.dismiss();\n map.select('.brush_rect_draw').remove();\n document.body.style.cursor = '';\n document.removeEventListener('keydown', esc_cancel);\n };\n function rectbrushended() {\n if (!d3.event.selection) {\n map.select('.brush_rect_draw').remove();\n document.body.style.cursor = '';\n msg.dismiss();\n document.removeEventListener('keydown', esc_cancel);\n _alertifyjs2.default.notify(_tr('app_page.notification.brush_map_cancelled'), 'warning', 5);\n return;\n }\n msg.dismiss();\n var k = svg_map.__zoom.k;\n var wi = (d3.event.selection[1][0] - d3.event.selection[0][0]) / k;\n var he = (d3.event.selection[1][1] - d3.event.selection[0][1]) / k;\n new _rectangle2.default('user_rectangle_' + rectangle_id, d3.event.selection[0], svg_map, false, wi, he);\n map.select('.brush_rect_draw').remove();\n document.removeEventListener('keydown', esc_cancel);\n document.body.style.cursor = '';\n }\n var rectangle_id = getIdLayoutFeature('rectangle');\n if (rectangle_id === null) {\n return;\n }\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_brush_map'), 'warning', 0);\n document.addEventListener('keydown', esc_cancel);\n document.body.style.cursor = 'not-allowed';\n var _brush = d3.brush().on('end', rectbrushended);\n map.append('g').attr('class', 'brush_rect_draw').call(_brush);\n}\n\nfunction handleClickAddOther(type) {\n var esc_cancel = function esc_cancel(evt) {\n evt = evt || window.event;\n if ('key' in evt && evt.key !== 'Escape' && evt.key !== 'Esc' || evt.keyCode !== 27) {\n return;\n }\n msg.dismiss();\n document.body.style.cursor = '';\n map.style('cursor', '').on('click', null);\n document.removeEventListener('keydown', esc_cancel);\n };\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_click_map'), 'warning', 0);\n document.addEventListener('keydown', esc_cancel);\n document.body.style.cursor = 'not-allowed';\n map.style('cursor', 'crosshair').on('click', function () {\n msg.dismiss();\n document.removeEventListener('keydown', esc_cancel);\n map.style('cursor', '').on('click', null);\n document.body.style.cursor = '';\n if (type === 'north_arrow') {\n _north_arrow.northArrow.display(d3.event.layerX, d3.event.layerY);\n } else if (type === 'scalebar') {\n _scalebar.scaleBar.create(d3.event.layerX, d3.event.layerY);\n }\n });\n}\n\nfunction handleClickAddEllipse() {\n var esc_cancel = function esc_cancel(evt) {\n evt = evt || window.event;\n if ('key' in evt && evt.key !== 'Escape' && evt.key !== 'Esc' || evt.keyCode !== 27) {\n return;\n }\n msg.dismiss();\n document.body.style.cursor = '';\n map.style('cursor', '').on('click', null);\n document.removeEventListener('keydown', esc_cancel);\n };\n var ellipse_id = getIdLayoutFeature('ellipse');\n if (ellipse_id === null) {\n return;\n }\n document.body.style.cursor = 'not-allowed';\n var start_point = void 0,\n tmp_start_point = void 0;\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_click_map'), 'warning', 0);\n document.addEventListener('keydown', esc_cancel);\n map.style('cursor', 'crosshair').on('click', function () {\n msg.dismiss();\n document.removeEventListener('keydown', esc_cancel);\n start_point = [d3.event.layerX, d3.event.layerY];\n tmp_start_point = map.append('rect').attrs({ x: start_point[0] - 2, y: start_point[1] - 2, height: 4, width: 4 }).style('fill', 'red');\n setTimeout(function () {\n tmp_start_point.remove();\n }, 1000);\n map.style('cursor', '').on('click', null);\n document.body.style.cursor = '';\n new _ellipse2.default('user_ellipse_' + ellipse_id, start_point, svg_map);\n });\n}\n\nfunction handleClickTextBox(text_box_id) {\n var esc_cancel = function esc_cancel(evt) {\n evt = evt || window.event;\n if ('key' in evt && evt.key !== 'Escape' && evt.key !== 'Esc' || evt.keyCode !== 27) {\n return;\n }\n msg.dismiss();\n document.body.style.cursor = '';\n map.style('cursor', '').on('click', null);\n document.removeEventListener('keydown', esc_cancel);\n };\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_click_map'), 'warning', 0);\n document.body.style.cursor = 'not-allowed';\n map.style('cursor', 'crosshair').on('click', function () {\n msg.dismiss();\n document.removeEventListener('keydown', esc_cancel);\n map.style('cursor', '').on('click', null);\n document.body.style.cursor = '';\n var text_box = new _text_annotation2.default(svg_map, text_box_id, [d3.event.layerX, d3.event.layerY]);\n setTimeout(function () {\n text_box.editStyle();\n }, 350);\n });\n document.addEventListener('keydown', esc_cancel);\n}\n\nfunction handleClickAddPicto() {\n var esc_cancel = function esc_cancel(evt) {\n evt = evt || window.event;\n if ('key' in evt && evt.key !== 'Escape' && evt.key !== 'Esc' || evt.keyCode !== 27) {\n return;\n }\n msg.dismiss();\n document.body.style.cursor = '';\n map.style('cursor', '').on('click', null);\n document.removeEventListener('keydown', esc_cancel);\n };\n\n var on_result = function on_result(result) {\n if (result) {\n add_single_symbol(result.split('url(')[1].substring(1).slice(0, -2), click_pt[0], click_pt[1], 45, 45, 'single_symbol_' + symbol_id);\n }\n };\n\n var display_box_symbol = function display_box_symbol() {\n (0, _symbols_picto.box_choice_symbol)(_app.default_symbols).then(on_result);\n };\n\n var symbol_id = getIdLayoutFeature('single_symbol');\n if (symbol_id === null) {\n return;\n }\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_click_map'), 'warning', 0);\n document.addEventListener('keydown', esc_cancel);\n var map_point = void 0,\n click_pt = void 0,\n prep_symbols = void 0,\n available_symbols = false;\n\n if (!_app.default_symbols || _app.default_symbols.length === 0) {\n _app.default_symbols = [];\n prep_symbols = (0, _interface.prepare_available_symbols)();\n } else {\n available_symbols = true;\n }\n\n document.body.style.cursor = 'not-allowed';\n map.style('cursor', 'crosshair').on('click', function () {\n msg.dismiss();\n document.removeEventListener('keydown', esc_cancel);\n click_pt = [d3.event.layerX, d3.event.layerY];\n map_point = map.append('rect').attrs({ x: click_pt[0] - 2, y: click_pt[1] - 2, height: 4, width: 4 }).style('fill', 'red');\n setTimeout(function () {\n map_point.remove();\n }, 500);\n map.style('cursor', '').on('click', null);\n document.body.style.cursor = '';\n if (!available_symbols) {\n prep_symbols.then(display_box_symbol);\n } else {\n display_box_symbol();\n }\n });\n}\n\n// function handleFreeDraw(){\n// var line_gen = d3.line(d3.curveBasis);\n// var draw_layer = map.select('#_m_free_draw_layer');\n// if(!draw_layer.node()){\n// draw_layer = map.append('g').attrs({id: \"_m_free_draw_layer\"});\n// } else {\n// // up the draw_layer ?\n// }\n// var draw_rect = draw_layer.append('rect')\n// .attrs({fill: 'transparent', height: h, width: w, x: 0, y:0});\n// draw_layer.call(d3.drag()\n// .container(function(){ return this; })\n// .subject(_ => [[d3.event.x, d3.event.y], [d3.event.x, d3.event.y]])\n// .on('start', _ => {\n// handle_click_hand('lock');\n// let d = d3.event.subject,\n// active_line = draw_layer.append('path').datum(d),\n// x0 = d3.event.x,\n// y0 = d3.event.y;\n// d3.event.on('drag', function(){\n// var x1 = d3.event.x,\n// y1 = d3.event.y,\n// dx = x1 - x0,\n// dy = y1 - y0;\n// if(dx * dx + dy * dy > 100) d.push([x0 = x1, y0 = y1]);\n// else d[d.length -1] = [x1, y1];\n// active_line.attr('d', line_gen)\n// });\n// }));\n// }\n\nfunction handleClickAddArrow() {\n var esc_cancel = function esc_cancel(evt) {\n evt = evt || window.event;\n if ('key' in evt && evt.key !== 'Escape' && evt.key !== 'Esc' || evt.keyCode !== 27) {\n return;\n }\n msg.dismiss();\n document.body.style.cursor = '';\n map.style('cursor', '').on('click', null);\n if (tmp_start_point && tmp_start_point.remove) {\n tmp_start_point.remove();\n }\n document.removeEventListener('keydown', esc_cancel);\n };\n var arrow_id = getIdLayoutFeature('arrow');\n if (arrow_id === null) {\n return;\n }\n var start_point = void 0,\n tmp_start_point = void 0,\n end_point = void 0,\n tmp_end_point = void 0;\n document.body.style.cursor = 'not-allowed';\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_click_map_arrow1'), 'warning', 0);\n document.addEventListener('keydown', esc_cancel);\n map.style('cursor', 'crosshair').on('click', function () {\n if (!start_point) {\n start_point = [d3.event.layerX, d3.event.layerY];\n tmp_start_point = map.append('rect').attrs({ x: start_point[0] - 2, y: start_point[1] - 2, height: 4, width: 4 }).style('fill', 'red');\n msg.dismiss();\n msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_click_map_arrow2'), 'warning', 0);\n } else {\n end_point = [d3.event.layerX, d3.event.layerY];\n tmp_end_point = map.append('rect').attrs({ x: end_point[0] - 2, y: end_point[1] - 2, height: 4, width: 4 }).style('fill', 'red');\n }\n if (start_point && end_point) {\n msg.dismiss();\n document.removeEventListener('keydown', esc_cancel);\n setTimeout(function () {\n tmp_start_point.remove();\n tmp_end_point.remove();\n }, 1000);\n map.style('cursor', '').on('click', null);\n document.body.style.cursor = '';\n new _arrow2.default('arrow_' + arrow_id, start_point, end_point, svg_map);\n }\n });\n}\n\nfunction add_layout_feature(selected_feature) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (document.body.style.cursor === 'not-allowed') {\n return;\n }\n if (selected_feature === 'text_annot') {\n var existing_annotation = document.getElementsByClassName('txt_annot');\n var existing_id = [];\n var new_id = void 0;\n if (existing_annotation) {\n existing_id = Array.prototype.map.call(existing_annotation, function (elem) {\n return +elem.id.split('text_annotation_')[1];\n });\n }\n for (var i = 0; i < 50; i++) {\n if (existing_id.indexOf(i) === -1) {\n existing_id.push(i);\n new_id = ['text_annotation_', i].join('');\n break;\n }\n }\n if (!new_id) {\n swal(_tr('app_page.common.error') + '!', _tr('app_page.common.error_max_text_annot'), 'error');\n return;\n }\n handleClickTextBox(new_id);\n } else if (selected_feature === 'sphere') {\n // if(data_manager.current_layers.Sphere) return;\n var layer_to_add = (0, _function.check_layer_name)(options.layer_name || 'Sphere');\n var layer_id = encodeId(layer_to_add);\n var fill = options.fill || '#add8e6';\n var fill_opacity = options.fill_opacity || 0.2;\n var stroke_width = options.stroke_width || '0.5px';\n var stroke_opacity = options.stroke_opacity || 1;\n var stroke = options.stroke || '#ffffff';\n _app.layer_to_id.set(layer_to_add, layer_id);\n _app.id_to_layer.set(layer_id, layer_to_add);\n data_manager.current_layers[layer_to_add] = {\n sphere: true,\n type: 'Polygon',\n n_features: 1,\n 'stroke-width-const': +stroke_width.slice(0, -2),\n fill_color: { single: fill }\n };\n map.append('g').attrs({ id: layer_id, class: 'layer' }).styles({ 'stroke-width': stroke_width }).append('path').datum({ type: 'Sphere' }).styles({ fill: fill, 'fill-opacity': fill_opacity, 'stroke-opacity': stroke_opacity, stroke: stroke }).attrs({ d: path });\n if ((0, _projections.isInterrupted)(_app.current_proj_name.toLowerCase())) {\n map.select('g#' + layer_id).attr('clip-path', 'url(#clip)');\n }\n (0, _helpers.create_li_layer_elem)(layer_to_add, null, 'Polygon', 'sample');\n _alertifyjs2.default.notify(_tr('app_page.notification.success_sphere_added'), 'success', 5);\n (0, _map_ctrl.zoom_without_redraw)();\n (0, _interface.setSphereBottom)(layer_id);\n } else if (selected_feature === 'graticule') {\n if (data_manager.current_layers.Graticule !== undefined) return;\n var _stroke = options.stroke || '#808080';\n var _stroke_width = options.stroke_width || '1px';\n var _stroke_opacity = options.stroke_opacity || 1;\n var stroke_dasharray = options.stroke_dasharray || 5;\n var step = options.step || 10;\n var graticule = d3.geoGraticule().step([step, step]);\n var extent = void 0;\n if (options.extent) {\n if (options.extent instanceof Array) {\n extent = options.extent;\n } else {\n var bbox_layer = _target_layer_file.bbox;\n extent = [[(0, _helpers_calc.Mround)((bbox_layer[0] - 10) / 10) * 10, (0, _helpers_calc.Mround)((bbox_layer[1] - 10) / 10) * 10], [(0, _helpers_calc.Mround)((bbox_layer[2] + 10) / 10) * 10, (0, _helpers_calc.Mround)((bbox_layer[3] + 10) / 10) * 10]];\n }\n graticule = graticule.extent(extent);\n }\n var _layer_to_add = 'Graticule';\n var _layer_id = encodeId(_layer_to_add);\n _app.layer_to_id.set(_layer_to_add, _layer_id);\n _app.id_to_layer.set(_layer_id, _layer_to_add);\n map.insert('g', '.legend').attrs({ id: _layer_id, class: 'layer' }).styles({ 'stroke-width': _stroke_width }).append('path').datum(graticule).attrs({ d: path, class: 'graticule' }).styles({ 'stroke-dasharray': stroke_dasharray, fill: 'none', stroke: _stroke });\n data_manager.current_layers.Graticule = {\n dasharray: stroke_dasharray,\n extent: extent,\n fill_color: { single: _stroke },\n graticule: true,\n n_features: 1,\n opacity: _stroke_opacity,\n step: step,\n 'stroke-width-const': +_stroke_width.slice(0, -2),\n type: 'Line'\n };\n if ((0, _projections.isInterrupted)(_app.current_proj_name.toLowerCase())) {\n map.select('g#' + _layer_id).attr('clip-path', 'url(#clip)');\n }\n (0, _helpers.create_li_layer_elem)('Graticule', null, 'Line', 'sample');\n _alertifyjs2.default.notify(_tr('app_page.notification.success_graticule_added'), 'success', 5);\n (0, _legend.up_legends)();\n (0, _map_ctrl.zoom_without_redraw)();\n } else if (selected_feature === 'scale') {\n if (!_scalebar.scaleBar.displayed) {\n handleClickAddOther('scalebar');\n } else {\n ask_existing_feature('scalebar').then(function () {\n _scalebar.scaleBar.remove();\n handleClickAddOther('scalebar');\n }, function () {\n return null;\n });\n }\n } else if (selected_feature === 'north_arrow') {\n if (!_north_arrow.northArrow.displayed) {\n handleClickAddOther('north_arrow');\n } else {\n ask_existing_feature('north_arrow').then(function () {\n _north_arrow.northArrow.remove();\n handleClickAddOther('north_arrow');\n }, function () {\n return null;\n });\n }\n } else if (selected_feature === 'arrow') {\n handleClickAddArrow();\n } else if (selected_feature === 'ellipse') {\n handleClickAddEllipse();\n } else if (selected_feature === 'rectangle') {\n handleClickAddRectangle();\n } else if (selected_feature === 'symbol') {\n handleClickAddPicto();\n } else {\n swal(_tr('app_page.common.error') + '!', _tr('app_page.common.error'), 'error');\n }\n}\n\n// function handleCreateFreeDraw(){\n// let start_point,\n// tmp_start_point,\n// active_line,\n// drawing_data = { \"lines\": [] };\n//\n// let render_line = d3.line().x(d => d[0]).y(d => d[1]);\n// let draw_calc = map.append(\"g\")\n// .append(\"rect\")\n// .attrs({class: \"draw_calc\", x: 0, y: 0, width: w, height: h})\n// .style(\"opacity\", 0.1).style(\"fill\", \"grey\");\n//\n// function redraw() {\n// var lines;\n// lines = draw_calc.selectAll('.line').data(drawing_data.lines);\n// lines.enter().append('path').attrs({\n// \"class\": 'line',\n// stroke: function(d) {\n// return d.color;\n// }\n// });\n// lines.attr(\"d\", function(d) { return render_line(d.points);});\n// return lines.exit();\n// };\n//\n// let drag = d3.drag()\n// .on('start', function() {\n// active_line = {\n// points: [],\n// color: \"black\"\n// };\n// drawing_data.lines.push(active_line);\n// return redraw();\n// })\n// .on('drag', function() {\n// active_line.points.push([d3.event.x, d3.event.y]);\n// console.log(drawing_data);\n// return redraw();\n// })\n// .on('end', function() {\n// if (active_line.points.length === 0) {\n// drawing_data.lines.pop();\n// }\n// active_line = null;\n// console.log(drawing_data);\n// return;\n// });\n// zoom.on(\"zoom\", null);\n// draw_calc.call(drag);\n// }\n\nfunction add_single_symbol(symbol_dataurl, x, y) {\n var width = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '30';\n var height = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '30';\n var symbol_id = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;\n\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems(self_parent) {\n return [{ name: _tr('app_page.common.options'), action: function action() {\n (0, _symbols_picto.make_style_box_indiv_symbol)(self_parent);\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n (0, _legend.up_legend)(self_parent.parentElement);\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n (0, _legend.down_legend)(self_parent.parentElement);\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n self_parent.parentElement.remove();\n } }];\n };\n\n return map.append('g').attrs({ class: 'legend single_symbol', id: symbol_id }).insert('image').attrs({\n x: x || w / 2,\n y: y || h / 2,\n width: width,\n height: height,\n 'xlink:href': symbol_dataurl\n }).on('mouseover', function () {\n this.style.cursor = 'pointer';\n }).on('mouseout', function () {\n this.style.cursor = 'initial';\n }).on('dblclick contextmenu', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems(this));\n }).call(_helpers.drag_elem_geo);\n}\n\n//# sourceURL=webpack:///./js/layout_features/helpers.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/north_arrow.js":
-/*!*******************************************!*\
- !*** ./js/layout_features/north_arrow.js ***!
- \*******************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.northArrow = undefined;\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nvar _snap_lines = __webpack_require__(/*! ./snap_lines */ \"./js/layout_features/snap_lines.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar northArrow = exports.northArrow = {\n /* eslint-disable-line import/prefer-default-export */\n display: function display(x, y) {\n var _this = this;\n\n var x_pos = x || w - 100,\n y_pos = y || h - 100,\n self = this;\n\n var arrow_gp = map.append('g').attrs({ id: 'north_arrow', class: 'legend', scale: 1, rotate: null }).style('cursor', 'all-scroll');\n\n this.svg_node = arrow_gp;\n this.displayed = true;\n\n this.arrow_img = arrow_gp.insert('image').attrs({ x: x_pos, y: y_pos, height: '30px', width: '30px' }).attr('xlink:href', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABVCAYAAAD5cuL2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAVjwAAFY8BlpPm3wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAWvSURBVHic7ZxtiFVFGMd/e3W3dJdyFWpVSipcYiNrMYhACWspKLOICqPCKOyF7EXK0sIMytKSIoperKg2I+lDEJYIQWC1RAW1ZST2IlHZi1qxYi+7dO7twzNn773nnnPuOWfOzNxd7x/OhztnZp7//M+cmXmemXOhiSaaMICbge8C18KEZa8LKXuaAY4ATDRUbydwfCBtI3AS8GedslNCyh6eE68aFExVHILpwMMW7SWCTQEArgXOsWwzFrYFaEFehQ7LdiNhWwCAWcBaB3ZD4UIAgGXAfEe2q+BKgALwPDDJkf0qIrbwe+B3N7DGov1Q2BRgBTASSLsdg4ucJLApwA7goUDaROAFoM0ijyrYHgMeRISoxBxgpWUeo7AtwAiwBPgvkH4PcLJlLoCbWeAz4LFAWhvwMuZ8k0i4mgZXAzsDab3AbbaJuBJgGPELioH0B4ATbRJxJQDAh8DTgbTDkDHCGlwKAHAXsDuQZpWTawH+ApYCJVcEXAsA8C7wkivjjSAAwHLgJxeGG0WAIeBGF4YbRQCAt4DNto02kgAg4fS9Ng2aWnoOAOsDab+G5GtHZgIf+4ErgL5APifjgw2sBc52TcIVjkP8gY+RaPEhh1eBb5FF0CWOuVjHKYBHWYBvgFanjCzjbaThvgAl4AanjCxiHuVGVwrwGzIrWMUE2waBfmQHeAeyLzBVpbcDfwPvO+BkDQuRp70S2EZ1DygCB4GjnLEzjAISD/wZmEytAP71qCuCpnEl0kDf6YkSYITaAxJjHq1IY3dT3gSJEqCIRIjHFW5CGnd5RVqUAL4IvZY5GsMkxJn5gmrvM04AD9hql6Y53I006rxAepwA/nWWPZpmMAXZFg+b2+sJ4DEOHKX1SGPODLmXpAeUgIutMDWA6UiwY0vE/SQCeIijZH3PMA88gzTg1Ij7SXtACTk9OqYwG1nQvBKTJ6kAHhJOs+4o6eA1RIATYvKk6QElYJVBvrliDvLUnqyTL40AReAAMM0M5XyxFXFrZ9bJl7YHlIANZijnh/kI0SQnQbMIMAwcmzvrHDGAHIefWi8j2QQoAi/mzjonLEJI3pkwfxYBfBGiplZnKACDlIMdSZBVAA/ZR2woXIWQuz5FmawC+NeCnLhrww92fE262L6OAA3lKC1DSC1OWU63B5SAi/Tp66Ed+AX4nPRb7boCeEiv03KUdM8HLAe6kNNewTN/plFAfI6rLdsdRSfwB/BexvJ5vAIe0gOTzjw10OkBqxARnJ30Rvh3ISdLrGIGEux4U6OOPHqAvzAaIqOjlLUHrEG+5rw3Y/k80QIcgYxDVuAHO/o168mrB/iXNUdpszKmu321nXwFKCKf3xhFrzL0hEYdc5HGl5DV3D+qzjxE8JAPtI1hG7KF3ZWh7AzgWeRzmYPAfcg4MlOle+rSFUBnYI6FH+y4P2W5ycgAdQAh2A8cHZKvB/Hy/IboCDEvJcdEGEAWPp0J87cAlwLfK1LvIPHCeuhDltZZhfCAj8jZUbpQVX5HwvwLgE9VmZ2IEGlQUGV+oDzApRViUUqbsWQGgT3UX3LOBl5XBPYDt6LnrFS+Pml7wS5N26NYoipdGpOnE1gH/ItMkY8DR+ZhXGGaqn+EdL3hGl3DbcifmEQFO1qRbau9yuAWzB5v6UZ6WJH644NHuhBdKG5RlV0Wcq8P+FLd/wS7/wdwOvAByQbKFVmNdCB7coNU+ww9yOZHCfgR6QGuvju4AOmhUUL4jlKSMH0NVqtKzlW/wxYyzv8AgfJruI/oGWNd2kr9YMd2yiPxEOWFTJaVoGl0IA9lmFoRhoFj0lT2iCr4FNLN0yxkXGMWsInagfK5pBX4wQ6/4C7SL2QaAXORbxIrZ4WeJAU3qgL7kJD3WD/Hfz7wFdKmN+pl7kae/gbkhNd4wQRkIbcHOCMu42LiT3WMdbRT+0VaE00cyvgfEKvQLuWtHAIAAAAASUVORK5CYII=');\n\n this.drag_behavior = d3.drag().subject(function () {\n var t = d3.select(this.querySelector('image'));\n var snap_lines = (0, _snap_lines.get_coords_snap_lines)(this.id);\n return {\n x: +t.attr('x'),\n y: +t.attr('y'),\n map_locked: !!map_div.select('#hand_button').classed('locked'),\n snap_lines: snap_lines\n };\n }).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n (0, _interface.handle_click_hand)('lock');\n }).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n _snap_lines.pos_lgds_elem.set(this.id, get_bounding_rect(this));\n }).on('drag', function () {\n d3.event.sourceEvent.preventDefault();\n var t1 = this.querySelector('image'),\n t2 = this.querySelector('rect'),\n dim = t2.width.baseVal.value / 2;\n var tx = +d3.event.x,\n ty = +d3.event.y;\n if (tx < 0 - dim || tx > w + dim || ty < 0 - dim || ty > h + dim) {\n return;\n }\n t1.x.baseVal.value = tx;\n t1.y.baseVal.value = ty;\n t2.x.baseVal.value = tx - 7.5;\n t2.y.baseVal.value = ty - 7.5;\n self.x_center = tx - 7.5 + dim;\n self.y_center = ty - 7.5 + dim;\n if (_app.autoalign_features) {\n var _bbox = get_bounding_rect(t2),\n xmin = t2.x.baseVal.value,\n xmax = xmin + _bbox.width,\n ymin = t2.y.baseVal.value,\n ymax = ymin + _bbox.height,\n snap_lines_x = d3.event.subject.snap_lines.x,\n snap_lines_y = d3.event.subject.snap_lines.y;\n for (var i = 0; i < snap_lines_x.length; i++) {\n if ((0, _helpers_math.Mabs)(snap_lines_x[i][0] - xmin) < 10) {\n var _y1 = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_y[i][0], snap_lines_y[i][1]), ymin);\n var _y2 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_y[i][0], snap_lines_y[i][1]), ymax);\n (0, _snap_lines.make_red_line_snap)(snap_lines_x[i][0], snap_lines_x[i][0], _y1, _y2);\n tx = snap_lines_x[i][0] + 7.5;\n }\n if ((0, _helpers_math.Mabs)(snap_lines_x[i][0] - xmax) < 10) {\n var _y = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_y[i][0], snap_lines_y[i][1]), ymin);\n var _y3 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_y[i][0], snap_lines_y[i][1]), ymax);\n (0, _snap_lines.make_red_line_snap)(snap_lines_x[i][0], snap_lines_x[i][0], _y, _y3);\n tx = snap_lines_x[i][0] - _bbox.width + 7.5;\n }\n if ((0, _helpers_math.Mabs)(snap_lines_y[i][0] - ymin) < 10) {\n var _x1 = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_x[i][0], snap_lines_x[i][1]), xmin);\n var _x2 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_x[i][0], snap_lines_x[i][1]), xmax);\n (0, _snap_lines.make_red_line_snap)(_x1, _x2, snap_lines_y[i][0], snap_lines_y[i][0]);\n ty = snap_lines_y[i][0] + 7.5;\n }\n if ((0, _helpers_math.Mabs)(snap_lines_y[i][0] - ymax) < 10) {\n var _x = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_x[i][0], snap_lines_x[i][1]), xmin);\n var _x3 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_x[i][0], snap_lines_x[i][1]), xmax);\n (0, _snap_lines.make_red_line_snap)(_x, _x3, snap_lines_y[i][0], snap_lines_y[i][0]);\n ty = snap_lines_y[i][0] - _bbox.height + 7.5;\n }\n }\n t1.x.baseVal.value = tx;\n t1.y.baseVal.value = ty;\n t2.x.baseVal.value = tx - 7.5;\n t2.y.baseVal.value = ty - 7.5;\n self.x_center = tx - 7.5 + dim;\n self.y_center = ty - 7.5 + dim;\n }\n });\n\n var getItems = function getItems() {\n return [{ name: _tr('app_page.common.options'), action: function action() {\n _this.editStyle();\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n _this.up_element();\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n _this.down_element();\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n _this.remove();\n } }];\n };\n\n var arrow_context_menu = new _contextMenu2.default();\n\n var bbox = document.getElementById('north_arrow').getBBox();\n\n this.under_rect = arrow_gp.append('g').insert('rect').styles({ fill: 'green', 'fill-opacity': 0 }).attrs({\n x: bbox.x - 7.5,\n y: bbox.y - 7.5,\n height: bbox.height + 15,\n width: bbox.width + 15\n });\n\n this.x_center = bbox.x + bbox.width / 2;\n this.y_center = bbox.y + bbox.height / 2;\n\n arrow_gp.call(this.drag_behavior);\n\n arrow_gp.on('mouseover', function () {\n self.under_rect.style('fill-opacity', 0.1);\n }).on('mouseout', function () {\n self.under_rect.style('fill-opacity', 0);\n }).on('contextmenu dblclick', function () {\n d3.event.preventDefault();\n return arrow_context_menu.showMenu(d3.event, document.querySelector('body'), getItems());\n });\n },\n up_element: function up_element() {\n (0, _legend.up_legend)(this.svg_node.node());\n },\n down_element: function down_element() {\n (0, _legend.down_legend)(this.svg_node.node());\n },\n remove: function remove() {\n _snap_lines.pos_lgds_elem.delete(this.svg_node.attr('id'));\n this.svg_node.remove();\n this.displayed = false;\n },\n editStyle: function editStyle() {\n var self = this,\n old_dim = +self.under_rect.attr('width'),\n old_rotate = !isNaN(+self.svg_node.attr('rotate')) ? +self.svg_node.attr('rotate') : 0,\n x_pos = +self.x_center - old_dim / 2,\n y_pos = +self.y_center - old_dim / 2;\n\n (0, _dialogs.make_confirm_dialog2)('arrowEditBox', _tr('app_page.north_arrow_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (confirmed) {\n null;\n }\n });\n\n var box_body = d3.select('.arrowEditBox').select('.modal-body').style('width', '295px');\n var a = box_body.append('p').attr('class', 'line_elem2');\n a.append('span').html(_tr('app_page.north_arrow_edit_box.size'));\n a.append('span').style('float', 'right').html(' px');\n\n a.append('input').attrs({\n class: 'without_spinner',\n id: 'txt_size_n_arrow',\n min: 0,\n max: 200,\n step: 1,\n type: 'number'\n }).styles({\n float: 'right',\n width: '40px'\n }).property('value', old_dim).on('change', function () {\n var elem = document.getElementById('range_size_n_arrow');\n elem.value = +this.value;\n elem.dispatchEvent(new Event('change'));\n });\n\n a.append('input').attrs({\n type: 'range',\n min: 1,\n max: 200,\n step: 1,\n id: 'range_size_n_arrow'\n }).styles({\n 'vertical-align': 'middle',\n width: '100px',\n float: 'right'\n }).property('value', old_dim).on('change', function () {\n var new_size = +this.value;\n self.arrow_img.attrs({\n width: new_size,\n height: new_size\n });\n var bbox = self.arrow_img.node().getBBox();\n self.under_rect.attrs({\n x: bbox.x - 7.5,\n y: bbox.y - 7.5,\n height: bbox.height + 15,\n width: bbox.width + 15\n });\n self.x_center = x_pos + new_size / 2;\n self.y_center = y_pos + new_size / 2;\n document.getElementById('txt_size_n_arrow').value = new_size;\n });\n\n var b = box_body.append('p').attr('class', 'line_elem2');\n b.append('span').html(_tr('app_page.north_arrow_edit_box.rotation'));\n b.append('span').style('float', 'right').html(' °');\n\n b.append('input').attrs({\n class: 'without_spinner',\n id: 'txt_rotate_n_arrow',\n min: 0,\n max: 360,\n step: 'any',\n type: 'number'\n }).styles({\n float: 'right',\n width: '40px'\n }).property('value', old_rotate).on('change', function () {\n var rotate_value = +this.value;\n self.svg_node.attrs({\n rotate: rotate_value,\n transform: 'rotate(' + [rotate_value, self.x_center, self.y_center] + ')'\n });\n document.getElementById('range_rotate_n_arrow').value = rotate_value;\n });\n\n b.append('input').attrs({\n type: 'range',\n min: 0,\n max: 360,\n step: 0.1,\n id: 'range_rotate_n_arrow'\n }).styles({\n float: 'right',\n 'vertical-align': 'middle',\n width: '100px'\n }).property('value', old_rotate).on('change', function () {\n var rotate_value = +this.value;\n self.svg_node.attrs({\n rotate: rotate_value,\n transform: 'rotate(' + [rotate_value, self.x_center, self.y_center] + ')'\n });\n document.getElementById('txt_rotate_n_arrow').value = rotate_value;\n });\n },\n\n displayed: false\n};\n\n//# sourceURL=webpack:///./js/layout_features/north_arrow.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/rectangle.js":
-/*!*****************************************!*\
- !*** ./js/layout_features/rectangle.js ***!
- \*****************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _colors_helpers = __webpack_require__(/*! ./../colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar UserRectangle = function () {\n function UserRectangle(id, origin_pt) {\n var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;\n var untransformed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var width = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 30;\n var height = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 40;\n\n _classCallCheck(this, UserRectangle);\n\n this.parent = parent || svg_map;\n this.svg_elem = d3.select(this.parent);\n this.id = id;\n this.stroke_width = 4;\n this.stroke_color = 'rgb(0, 0, 0)';\n this.fill_color = 'rgb(255, 255, 255)';\n this.fill_opacity = 0;\n this.height = height;\n this.width = width;\n var self = this;\n if (!untransformed) {\n var zoom_param = svg_map.__zoom;\n this.pt1 = [(+origin_pt[0] - zoom_param.x) / zoom_param.k, (+origin_pt[1] - zoom_param.y) / zoom_param.k];\n } else {\n this.pt1 = [+origin_pt[0], +origin_pt[1]];\n }\n\n this.drag_behavior = d3.drag().subject(function () {\n var t = d3.select(this.querySelector('rect'));\n return {\n x: +t.attr('x'),\n y: +t.attr('y'),\n map_locked: !!map_div.select('#hand_button').classed('locked')\n };\n }).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n (0, _interface.handle_click_hand)('lock');\n }).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n }).on('drag', function () {\n d3.event.sourceEvent.preventDefault();\n var _t = this.querySelector('rect'),\n subject = d3.event.subject,\n tx = (+d3.event.x - +subject.x) / svg_map.__zoom.k,\n ty = (+d3.event.y - +subject.y) / svg_map.__zoom.k;\n self.pt1 = [+subject.x + tx, +subject.y + ty];\n // self.pt2 = [self.pt1[0] + self.width, self.pt1[1] + self.height];\n // if(_app.autoalign_features){\n // let snap_lines_x = subject.snap_lines.x,\n // snap_lines_y = subject.snap_lines.y;\n // for(let i = 0; i < subject.snap_lines.x.length; i++){\n // if(Math.abs(snap_lines_x[i] - (self.pt1[0] + svg_map.__zoom.x / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: snap_lines_x[i], x2: snap_lines_x[i], y1: 0, y2: h}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // self.pt1[0] = snap_lines_x[i] - svg_map.__zoom.x / svg_map.__zoom.k;\n // }\n // if(Math.abs(snap_lines_x[i] - (self.pt2[0] + svg_map.__zoom.x / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: snap_lines_x[i], x2: snap_lines_x[i], y1: 0, y2: h}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // self.pt1[0] = snap_lines_x[i] - svg_map.__zoom.x / svg_map.__zoom.k - self.width;\n // }\n // if(Math.abs(snap_lines_y[i] - (self.pt1[1] + svg_map.__zoom.y / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: 0, x2: w, y1: snap_lines_y[i], y2: snap_lines_y[i]}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // self.pt1[1] = snap_lines_y[i] - svg_map.__zoom.y / svg_map.__zoom.k;\n // }\n // if(Math.abs(snap_lines_y[i] - (self.pt2[1] + svg_map.__zoom.y / svg_map.__zoom.k)) < 10){\n // let l = map.append('line')\n // .attrs({x1: 0, x2: w, y1: snap_lines_y[i], y2: snap_lines_y[i]}).style('stroke', 'red');\n // setTimeout(function(){ l.remove(); }, 1000);\n // self.pt1[1] = snap_lines_y[i] - svg_map.__zoom.y / svg_map.__zoom.k - self.height;\n // }\n // }\n // }\n _t.x.baseVal.value = self.pt1[0];\n _t.y.baseVal.value = self.pt1[1];\n });\n this.draw();\n return this;\n }\n\n _createClass(UserRectangle, [{\n key: 'up_element',\n value: function up_element() {\n (0, _legend.up_legend)(this.rectangle.node());\n }\n }, {\n key: 'down_element',\n value: function down_element() {\n (0, _legend.down_legend)(this.rectangle.node());\n }\n }, {\n key: 'draw',\n value: function draw() {\n var _this = this;\n\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems() {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n _this.editStyle();\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n _this.up_element();\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n _this.down_element();\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n _this.remove();\n } }];\n };\n\n this.rectangle = this.svg_elem.append('g').attrs({ class: 'user_rectangle legend scalable-legend',\n id: this.id,\n transform: svg_map.__zoom.toString() });\n\n this.rectangle.insert('rect').attrs({\n x: this.pt1[0],\n y: this.pt1[1],\n height: this.height,\n width: this.width\n }).styles({\n fill: this.fill_color,\n 'fill-opacity': 0,\n stroke: this.stroke_color,\n 'stroke-width': this.stroke_width\n });\n\n this.rectangle.on('contextmenu', function () {\n context_menu.showMenu(d3.event, document.body, getItems());\n }).on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n _this.handle_ctrl_pt();\n }).call(this.drag_behavior);\n }\n }, {\n key: 'remove',\n value: function remove() {\n this.rectangle.remove();\n }\n }, {\n key: 'handle_ctrl_pt',\n value: function handle_ctrl_pt() {\n var self = this,\n rectangle_elem = self.rectangle.node().querySelector('rect'),\n zoom_param = svg_map.__zoom,\n map_locked = !!map_div.select('#hand_button').classed('locked');\n var center_pt = [self.pt1[0] + rectangle_elem.width.baseVal.value / 2, self.pt1[1] + rectangle_elem.height.baseVal.value / 2];\n var bottomright = [self.pt1[0] + rectangle_elem.width.baseVal.value, self.pt1[1] + rectangle_elem.height.baseVal.value];\n var msg = _alertifyjs2.default.notify(_tr('app_page.notification.instruction_modify_feature'), 'warning', 0);\n\n var topleft = self.pt1.slice();\n\n var cleanup_edit_state = function cleanup_edit_state() {\n edit_layer.remove();\n msg.dismiss();\n self.rectangle.call(self.drag_behavior);\n self.rectangle.on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n self.handle_ctrl_pt();\n });\n if (!map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n document.getElementById('hand_button').onclick = _interface.handle_click_hand;\n };\n\n // Change the behavior of the 'lock' button :\n document.getElementById('hand_button').onclick = function () {\n cleanup_edit_state();\n (0, _interface.handle_click_hand)();\n };\n\n // Desactive the ability to drag the rectangle :\n self.rectangle.on('.drag', null);\n // Desactive the ability to zoom/move on the map ;\n (0, _interface.handle_click_hand)('lock');\n\n // Add a layer to intercept click on the map :\n var edit_layer = map.insert('g');\n edit_layer.append('rect').attrs({ x: 0, y: 0, width: w, height: h, class: 'edit_rect' }).style('fill', 'transparent').on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n cleanup_edit_state();\n });\n\n // Temporary top point:\n edit_layer.append('rect').attrs({\n class: 'ctrl_pt',\n id: 'pt_top',\n height: 8,\n width: 8,\n x: center_pt[0] * zoom_param.k + zoom_param.x - 4,\n y: (center_pt[1] - rectangle_elem.height.baseVal.value / 2) * zoom_param.k + zoom_param.y - 4\n }).call(d3.drag().on('drag', function () {\n var dist = (d3.event.y - zoom_param.y) / zoom_param.k;\n if (self.height - (dist - self.pt1[1]) < 2) {\n return;\n }\n d3.select(this).attr('y', d3.event.y - 4);\n var a = self.pt1[1];\n self.pt1[1] = rectangle_elem.y.baseVal.value = dist;\n topleft = self.pt1.slice();\n rectangle_elem.height.baseVal.value = self.height = (0, _helpers_math.Mabs)(self.height - (self.pt1[1] - a));\n map.selectAll('#pt_left,#pt_right').attr('y', (topleft[1] + self.height / 2) * zoom_param.k + zoom_param.y);\n }));\n\n // Temporary left point:\n edit_layer.append('rect').attrs({\n class: 'ctrl_pt',\n height: 8,\n width: 8,\n id: 'pt_left',\n x: (center_pt[0] - rectangle_elem.width.baseVal.value / 2) * zoom_param.k + zoom_param.x - 4,\n y: center_pt[1] * zoom_param.k + zoom_param.y - 4\n }).call(d3.drag().on('drag', function () {\n var dist = /*topleft[0] -*/(d3.event.x - zoom_param.x) / zoom_param.k;\n if (self.width + (self.pt1[0] - dist) < 2) {\n return;\n }\n d3.select(this).attr('x', d3.event.x - 4);\n var a = self.pt1[0];\n self.pt1[0] = rectangle_elem.x.baseVal.value = dist; // topleft[0] - dist;\n topleft = self.pt1.slice();\n rectangle_elem.width.baseVal.value = self.width = (0, _helpers_math.Mabs)(self.width + (a - self.pt1[0]));\n map.selectAll('#pt_top,#pt_bottom').attr('x', (topleft[0] + self.width / 2) * zoom_param.k + zoom_param.x);\n }));\n\n // Temporary bottom point:\n edit_layer.append('rect').attrs({\n class: 'ctrl_pt',\n id: 'pt_bottom',\n x: center_pt[0] * zoom_param.k + zoom_param.x - 4,\n y: bottomright[1] * zoom_param.k + zoom_param.y - 4,\n height: 8,\n width: 8\n }).call(d3.drag().on('drag', function () {\n var dist = -(topleft[1] - (d3.event.y - zoom_param.y) / zoom_param.k);\n if (dist < 2) {\n return;\n }\n d3.select(this).attr('y', d3.event.y - 4);\n self.height = rectangle_elem.height.baseVal.value = dist;\n map.selectAll('#pt_left,#pt_right').attr('y', (topleft[1] + self.height / 2) * zoom_param.k + zoom_param.y);\n }));\n\n // Temporary right point:\n edit_layer.append('rect').attrs({\n class: 'ctrl_pt',\n id: 'pt_right',\n x: bottomright[0] * zoom_param.k + zoom_param.x - 4,\n y: center_pt[1] * zoom_param.k + zoom_param.y - 4,\n height: 8,\n width: 8\n }).call(d3.drag().on('drag', function () {\n var dist = -(topleft[0] - (d3.event.x - zoom_param.x) / zoom_param.k);\n if (dist < 2) {\n return;\n }\n d3.select(this).attr('x', d3.event.x - 4);\n self.width = rectangle_elem.width.baseVal.value = dist;\n map.selectAll('#pt_top,#pt_bottom').attr('x', (topleft[0] + self.width / 2) * zoom_param.k + zoom_param.x);\n }));\n\n self.rectangle.on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n cleanup_edit_state();\n });\n }\n }, {\n key: 'editStyle',\n value: function editStyle() {\n var self = this,\n rectangle_elem = self.rectangle.node().querySelector('rect'),\n\n // zoom_param = svg_map.__zoom,\n map_locked = !!map_div.select('#hand_button').classed('locked'),\n current_options = { pt1: this.pt1.slice() };\n if (!map_locked) (0, _interface.handle_click_hand)('lock');\n (0, _dialogs.make_confirm_dialog2)('styleBoxRectangle', _tr('app_page.rectangle_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (confirmed) {\n // Store shorcut of useful values :\n self.stroke_width = rectangle_elem.style.strokeWidth;\n self.stroke_color = rectangle_elem.style.stroke;\n self.fill_color = rectangle_elem.style.fill;\n self.fill_opacity = +rectangle_elem.style.fillOpacity;\n } else {\n // Rollback on initials parameters :\n self.pt1 = current_options.pt1.slice();\n rectangle_elem.style.strokeWidth = self.stroke_width;\n rectangle_elem.style.stroke = self.stroke_color;\n rectangle_elem.style.fill = self.fill_color;\n rectangle_elem.style.fillOpacity = self.fill_opacity;\n }\n if (!map_locked) (0, _interface.handle_click_hand)('unlock');\n });\n var box_content = d3.select('.styleBoxRectangle').select('.modal-body').style('width', '295px').insert('div').attr('id', 'styleBoxRectangle');\n\n var s1 = box_content.append('p').attr('class', 'line_elem2');\n\n s1.append('span').style('margin', 'auto').html(_tr('app_page.rectangle_edit_box.stroke_width'));\n\n s1.append('input').attrs({\n min: 0,\n max: 34,\n step: 0.1,\n type: 'range'\n }).styles({ width: '55px', float: 'right' }).property('value', self.stroke_width).on('change', function () {\n rectangle_elem.style.strokeWidth = this.value;\n txt_line_weight.html(this.value + 'px');\n });\n\n var txt_line_weight = s1.append('span').styles({ float: 'right', margin: '0 5px 0 5px' }).html(self.stroke_width + ' px');\n\n var s2 = box_content.append('p').attr('class', 'line_elem2');\n\n s2.append('span').style('margin', 'auto').html(_tr('app_page.rectangle_edit_box.stroke_color'));\n\n s2.append('input').style('float', 'right').attr('type', 'color').property('value', (0, _colors_helpers.rgb2hex)(self.stroke_color)).on('change', function () {\n rectangle_elem.style.stroke = this.value;\n });\n\n var s3 = box_content.append('p').attr('class', 'line_elem2');\n s3.append('span').style('margin', 'auto').html(_tr('app_page.rectangle_edit_box.fill_color'));\n s3.append('input').style('float', 'right').attr('type', 'color').property('value', (0, _colors_helpers.rgb2hex)(self.fill_color)).on('change', function () {\n rectangle_elem.style.fill = this.value;\n });\n\n var s4 = box_content.append('p').attr('class', 'line_elem2');\n s4.append('span').style('margin', 'auto').html(_tr('app_page.rectangle_edit_box.fill_opacity'));\n s4.append('input').attrs({\n min: 0,\n max: 1,\n step: 0.1,\n type: 'range'\n }).styles({ width: '55px', float: 'right' }).property('value', rectangle_elem.style.fillOpacity).on('change', function () {\n rectangle_elem.style.fillOpacity = this.value;\n txt_fillop_value.html('' + rectangle_elem.style.fillOpacity);\n });\n\n var txt_fillop_value = s4.append('span').styles({ float: 'right', margin: '0 5px 0 5px' }).html('' + rectangle_elem.style.fillOpacity);\n\n // rx : Coordonnée sur l'axe X du centre de l'ellipse pour les angles arrondis\n // ry : .................... Y\n var s5 = box_content.append('p').attr('class', 'line_elem2');\n s5.append('span').style('margin', 'auto').html(_tr('app_page.rectangle_edit_box.rounded_corner'));\n s5.append('input').attrs({\n min: 0,\n max: Math.round(self.width / 2),\n step: 1,\n type: 'range'\n }).styles({ width: '55px', float: 'right' }).property('value', rectangle_elem.rx.baseVal.value).on('change', function () {\n rectangle_elem.rx.baseVal.value = this.value;\n txt_rx_value.html('' + rectangle_elem.rx.baseVal.value);\n });\n var txt_rx_value = s5.append('span').styles({ float: 'right', margin: '0 5px 0 5px' }).html('' + rectangle_elem.rx.baseVal.value);\n\n // s5.append('input')\n // .attrs({ type: 'range', min: 0, max: Math.round(self.width / 2), step: 1 })\n // .styles({ width: '55px', float: 'right' })\n // .property('value', rectangle_elem.ry.baseVal.value)\n // .on('change', function () {\n // rectangle_elem.ry.baseVal.value = this.value;\n // });\n }\n }]);\n\n return UserRectangle;\n}();\n\nexports.default = UserRectangle;\n\n//# sourceURL=webpack:///./js/layout_features/rectangle.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/scalebar.js":
-/*!****************************************!*\
- !*** ./js/layout_features/scalebar.js ***!
- \****************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.scaleBar = undefined;\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./../helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nvar _snap_lines = __webpack_require__(/*! ./snap_lines */ \"./js/layout_features/snap_lines.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar convert_dist = function convert_dist(unit_in, unit_out, value) {\n if (unit_in === unit_out) {\n return value;\n } else if (unit_in === 'km' && unit_out === 'm') {\n return +value * 1000;\n } else if (unit_in === 'km' && unit_out === 'mi') {\n return +value * 0.621371;\n } else if (unit_in === 'm' && unit_out === 'km') {\n return +value / 1000;\n } else if (unit_in === 'm' && unit_out === 'mi') {\n return +value * 0.000621371;\n } else if (unit_in === 'mi' && unit_out === 'km') {\n return +value * 1.60934;\n } else if (unit_in === 'mi' && unit_out === 'm') {\n return +value * 1609.34;\n }\n throw 'Invalid unit';\n};\n\n/**\n* Handler for the scale bar (only designed for one scale bar)\n*\n*/\nvar scaleBar = exports.scaleBar = {\n create: function create(x, y) {\n var _this = this;\n\n // if (!proj.invert) {\n // swal({ title: '',\n // text: _tr('app_page.common.error_interrupted_projection_scalebar'),\n // type: 'error',\n // allowOutsideClick: false,\n // allowEscapeKey: false,\n // }).then(() => { null; }, () => { null; });\n // return;\n // }\n var scale_gp = map.append('g').attrs({ id: 'scale_bar', class: 'legend scale' }),\n x_pos = 40,\n y_pos = h - 100,\n bar_size = 50,\n self = this;\n\n this.x = x_pos;\n this.y = y_pos;\n this.bar_size = bar_size;\n this.unit = 'km';\n this.precision = 0;\n this.start_end_bar = false;\n this.fixed_size = false;\n var rv = this.getDist();\n if (rv) return;\n\n var getItems = function getItems() {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n _this.editStyle();\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n _this.up_element();\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n _this.down_element();\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n _this.remove();\n } }];\n };\n\n var scale_context_menu = new _contextMenu2.default();\n this.under_rect = scale_gp.insert('rect').attrs({ x: x_pos - 10, y: y_pos - 20, height: 30, width: this.bar_size + 20, id: 'under_rect' }).styles({ fill: 'green', 'fill-opacity': 0 });\n scale_gp.insert('rect').attrs({ id: 'rect_scale', x: x_pos, y: y_pos, height: 2, width: this.bar_size }).style('fill', 'black');\n scale_gp.insert('text').attrs({ id: 'text_limit_sup_scale', x: x_pos + bar_size, y: y_pos - 5 }).styles({\n 'font-family': 'verdana',\n 'font-size': '11px',\n 'text-anchor': 'middle'\n }).text(this.dist_txt + ' km');\n\n scale_gp.call((0, _legend.drag_legend_func)(scale_gp));\n scale_gp.on('mouseover', function () {\n this.style.cursor = 'pointer';\n self.under_rect.style('fill-opacity', 0.1);\n }).on('mouseout', function () {\n this.style.cursor = 'pointer';\n self.under_rect.style('fill-opacity', 0);\n }).on('contextmenu dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n return scale_context_menu.showMenu(d3.event, document.querySelector('body'), getItems());\n });\n if (x && y) {\n scale_gp.attr('transform', 'translate(' + [x - this.x, y - this.y] + ')');\n }\n this.Scale = scale_gp;\n this.displayed = true;\n if (this.dist > 100) {\n this.resize((0, _helpers_math.Mround)(this.dist / 100) * 100);\n } else if (this.dist > 10) {\n this.resize((0, _helpers_math.Mround)(this.dist / 10) * 10);\n } else if ((0, _helpers_math.Mround)(this.dist) > 1) {\n this.resize((0, _helpers_math.Mround)(this.dist));\n } else if ((0, _helpers_math.Mround)(this.dist * 10) / 10 > 0.1) {\n this.precision = 1;\n this.resize((0, _helpers_math.Mround)(this.dist * 10) / 10);\n } else {\n var t = this.dist.toString().split('.');\n this.precision = t && t.length > 1 ? t[1].length : ('' + this.dist).length;\n this.resize(this.dist);\n }\n _snap_lines.pos_lgds_elem.set(scale_gp.attr('id') + ' ' + scale_gp.attr('class'), get_bounding_rect(scale_gp.node()));\n },\n getDist: function getDist() {\n var x_pos = w / 2,\n y_pos = h / 2,\n transform = d3.zoomTransform(svg_map),\n z_trans = [transform.x, transform.y],\n z_scale = transform.k;\n\n if (isNaN(+this.bar_size)) {\n console.log('scaleBar.bar_size : NaN');\n this.bar_size = 50;\n }\n\n var pt1 = proj.invert([(x_pos - z_trans[0]) / z_scale, (y_pos - z_trans[1]) / z_scale]);\n var pt2 = proj.invert([(x_pos + this.bar_size - z_trans[0]) / z_scale, (y_pos - z_trans[1]) / z_scale]);\n if (!pt1 || !pt2) {\n this.remove();\n return true;\n }\n this.dist = (0, _helpers_calc.coslaw_dist)([pt1[1], pt1[0]], [pt2[1], pt2[0]]);\n var mult = this.unit == 'km' ? 1 : this.unit == 'm' ? 1000 : this.unit == 'mi' ? 0.621371 : 1;\n this.dist_txt = (this.dist * mult).toFixed(this.precision);\n },\n resize: function resize(desired_dist) {\n desired_dist = desired_dist || this.fixed_size;\n var ratio = +this.dist / desired_dist;\n var new_size = this.bar_size / ratio;\n\n this.Scale.select('#rect_scale').attr('width', new_size);\n this.Scale.select('#text_limit_sup_scale').attr('x', this.x + new_size / 2);\n this.bar_size = new_size;\n this.fixed_size = desired_dist;\n this.under_rect.attr('width', new_size + 20);\n var err = this.getDist();\n if (err) {\n this.remove();\n return;\n }\n this.Scale.select('#text_limit_sup_scale').text(this.dist_txt + ' ' + this.unit);\n this.handle_start_end_bar();\n },\n update: function update() {\n var err = this.getDist();\n if (err) {\n this.remove();\n return;\n }\n if (this.fixed_size) {\n this.resize();\n } else {\n this.Scale.select('#text_limit_sup_scale').text(this.dist_txt + ' ' + this.unit);\n }\n },\n up_element: function up_element() {\n (0, _legend.up_legend)(this.Scale.node());\n },\n down_element: function down_element() {\n (0, _legend.down_legend)(this.Scale.node());\n },\n remove: function remove() {\n _snap_lines.pos_lgds_elem.delete(this.Scale.attr('id') + ' ' + this.Scale.attr('class'));\n this.Scale.remove();\n this.Scale = null;\n this.displayed = false;\n },\n handle_start_end_bar: function handle_start_end_bar() {\n this.Scale.selectAll('.se_bar').remove();\n if (this.start_end_bar) {\n this.Scale.insert('rect').attrs({ class: 'start_bar se_bar', x: this.x, y: this.y - 4.5, width: '1.5px', height: '4.5px' });\n\n this.Scale.insert('rect').attrs({ class: 'end_bar se_bar', x: this.x + this.bar_size - 1.5, y: this.y - 4.5, width: '1.5px', height: '4.5px' });\n }\n },\n editStyle: function editStyle() {\n var new_val = void 0;\n var self = this;\n var initial_params = {\n bar_size: self.bar_size,\n displayed: self.displayed,\n dist: self.dist,\n dist_txt: self.dist_txt,\n fixed_size: self.fixed_size,\n precision: self.precision,\n unit: self.unit,\n x: self.x,\n y: self.y,\n transform: self.Scale._groups[0][0].getAttribute('transform') || ''\n };\n\n (0, _dialogs.make_confirm_dialog2)('scaleBarEditBox', _tr('app_page.scale_bar_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (!confirmed) {\n var _t = self.dist_txt;\n self.bar_size = initial_params.bar_size;\n self.displayed = initial_params.displayed;\n self.dist = initial_params.dist;\n self.dist_txt = initial_params.dist_txt;\n self.fixed_size = initial_params.fixed_size;\n self.precision = initial_params.precision;\n self.unit = initial_params.unit;\n self.x = initial_params.x;\n self.y = initial_params.y;\n if (_t == initial_params.dist_txt) {\n self.update();\n } else {\n self.resize(+_t);\n }\n }\n });\n var box_body = d3.select('.scaleBarEditBox').select('.modal-body').style('width', '295px');\n // box_body.node().parentElement.style.width = \"auto\";\n box_body.append('h3').html(_tr('app_page.scale_bar_edit_box.title'));\n var a = box_body.append('p').attr('class', 'line_elem2');\n a.append('span').html(_tr('app_page.scale_bar_edit_box.fixed_size'));\n\n a.append('input').style('float', 'right').attrs({\n id: 'scale_fixed_field',\n type: 'number'\n }).property('disabled', initial_params.fixed_size ? null : true).property('value', +this.dist_txt).on('change', function () {\n var v = convert_dist(self.unit, 'km', +this.value);\n self.resize(v);\n });\n\n a.append('input').style('float', 'right').attrs({ type: 'checkbox', checked: self.fixed_size ? true : null }).on('change', function () {\n if (!self.fixed_size) {\n box_body.select('#scale_fixed_field').property('disabled', false);\n var v = convert_dist(self.unit, 'km', +box_body.select('#scale_fixed_field').property('value'));\n self.fixed_size = v;\n self.resize(v);\n } else {\n box_body.select('#scale_fixed_field').property('disabled', true);\n self.fixed_size = false;\n self.update();\n }\n });\n\n var b = box_body.append('p').attr('class', 'line_elem2');\n b.insert('span').html(_tr('app_page.scale_bar_edit_box.precision'));\n b.insert('input').attrs({\n id: 'scale_precision',\n type: 'number',\n min: 0,\n max: 6,\n step: 1\n }).styles({\n float: 'right',\n width: '60px'\n }).property('value', +self.precision).on('change', function () {\n self.precision = +this.value;\n self.update();\n });\n\n var c = box_body.append('p').attr('class', 'line_elem2');\n c.insert('span').html(_tr('app_page.scale_bar_edit_box.unit'));\n var unit_select = c.insert('select').style('float', 'right').attr('id', 'scale_unit').on('change', function () {\n var old_unit = self.unit;\n var v = void 0;\n self.unit = this.value;\n if (self.fixed_size != false) {\n v = convert_dist(old_unit, self.unit, +self.fixed_size).toFixed(self.precision);\n self.fixed_size = +self.dist;\n } else {\n v = convert_dist(old_unit, self.unit, +self.dist_txt).toFixed(self.precision);\n }\n box_body.select('#scale_fixed_field').property('value', +v);\n self.update();\n });\n unit_select.append('option').text('km').attr('value', 'km');\n unit_select.append('option').text('m').attr('value', 'm');\n unit_select.append('option').text('mi').attr('value', 'mi');\n unit_select.node().value = self.unit;\n\n var e = box_body.append('p').attr('class', 'line_elem2');\n e.append('span').html(_tr('app_page.scale_bar_edit_box.start_end_bar'));\n e.append('input').style('float', 'right').attrs({ id: 'checkbox_start_end_bar', type: 'checkbox' }).on('change', function () {\n self.start_end_bar = self.start_end_bar !== true;\n self.handle_start_end_bar();\n });\n document.getElementById('checkbox_start_end_bar').checked = self.start_end_bar;\n },\n\n displayed: false\n};\n\n//# sourceURL=webpack:///./js/layout_features/scalebar.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/snap_lines.js":
-/*!******************************************!*\
- !*** ./js/layout_features/snap_lines.js ***!
- \******************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar pos_lgds_elem = exports.pos_lgds_elem = new Map();\n\nvar get_coords_snap_lines = exports.get_coords_snap_lines = function get_coords_snap_lines(uid) {\n var snap_lines = { x: [], y: [] };\n pos_lgds_elem.forEach(function (v, k) {\n if (k != uid) {\n snap_lines.y.push([v.top + v.height, v.top], [v.top, v.top + v.height]);\n snap_lines.x.push([v.left, v.left + v.width], [v.left + v.width, v.left]);\n // snap_lines.y.push([v.bottom, v.top], [v.top, v.bottom]);\n // snap_lines.x.push([v.left, v.right], [v.right, v.left]);\n }\n });\n return snap_lines;\n};\n\nvar make_red_line_snap = exports.make_red_line_snap = function make_red_line_snap(x1, x2, y1, y2) {\n var timeout = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 750;\n\n var current_timeout = void 0;\n return function () {\n if (current_timeout) {\n clearTimeout(current_timeout);\n }\n map.select('.snap_line').remove();\n var line = map.append('line').attrs({ x1: x1, x2: x2, y1: y1, y2: y2, class: 'snap_line' }).styles({ stroke: 'red', 'stroke-width': 0.7 });\n current_timeout = setTimeout(function () {\n line.remove();\n }, timeout);\n }();\n};\n\n//# sourceURL=webpack:///./js/layout_features/snap_lines.js?");
-
-/***/ }),
-
-/***/ "./js/layout_features/text_annotation.js":
-/*!***********************************************!*\
- !*** ./js/layout_features/text_annotation.js ***!
- \***********************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _contextMenu = __webpack_require__(/*! ./../context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _colors_helpers = __webpack_require__(/*! ./../colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./../dialogs */ \"./js/dialogs.js\");\n\nvar _fonts = __webpack_require__(/*! ./../fonts */ \"./js/fonts.js\");\n\nvar _helpers = __webpack_require__(/*! ./../helpers */ \"./js/helpers.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _legend = __webpack_require__(/*! ./../legend */ \"./js/legend.js\");\n\nvar _snap_lines = __webpack_require__(/*! ./snap_lines */ \"./js/layout_features/snap_lines.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar round = Math.round;\n\nvar Textbox = function () {\n function Textbox(parent, id_text_annot) {\n var _this = this;\n\n var position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [10, 30];\n\n _classCallCheck(this, Textbox);\n\n var self = this;\n this.x = position[0];\n this.y = position[1];\n this.fontSize = 14;\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems() {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n _this.editStyle();\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n _this.up_element();\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n _this.down_element();\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n _this.remove();\n } }];\n };\n var drag_txt_annot = d3.drag().subject(function () {\n var t = d3.select(this).select('text');\n var snap_lines = (0, _snap_lines.get_coords_snap_lines)(this.id);\n return {\n x: t.attr('x'),\n y: t.attr('y'),\n map_locked: !!map_div.select('#hand_button').classed('locked'),\n snap_lines: snap_lines\n };\n }).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n (0, _interface.handle_click_hand)('lock');\n }).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n _snap_lines.pos_lgds_elem.set(this.id, get_bounding_rect(this.querySelector('rect')));\n }).on('drag', function () {\n d3.event.sourceEvent.preventDefault();\n var elem = d3.select(this).select('text').attrs({ x: +d3.event.x, y: +d3.event.y });\n var transform = elem.attr('transform');\n if (transform) {\n var v = +transform.match(/[-.0-9]+/g)[0];\n elem.attr('transform', 'rotate(' + v + ', ' + (d3.event.x + self.width) + ', ' + (d3.event.y + self.height) + ')');\n }\n elem.selectAll('tspan').attr('x', +d3.event.x);\n\n if (_app.autoalign_features) {\n var bbox = get_bounding_rect(elem.node()),\n xmin = bbox.x - 10,\n xmax = xmin + bbox.width + 20,\n ymin = bbox.y - 10,\n ymax = ymin + bbox.height + 20,\n snap_lines_x = d3.event.subject.snap_lines.x,\n snap_lines_y = d3.event.subject.snap_lines.y;\n for (var i = 0; i < snap_lines_x.length; i++) {\n if ((0, _helpers_math.Mabs)(snap_lines_x[i][0] - xmin) < 10) {\n var _y1 = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_y[i][0], snap_lines_y[i][1]), ymin);\n var _y2 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_y[i][0], snap_lines_y[i][1]), ymax);\n (0, _snap_lines.make_red_line_snap)(snap_lines_x[i][0], snap_lines_x[i][0], _y1, _y2);\n elem.selectAll('tspan').attr('x', snap_lines_x[i][0] + 10);\n elem.attr('x', snap_lines_x[i][0] + 10);\n }\n if ((0, _helpers_math.Mabs)(snap_lines_x[i][0] - xmax) < 10) {\n var _y = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_y[i][0], snap_lines_y[i][1]), ymin);\n var _y3 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_y[i][0], snap_lines_y[i][1]), ymax);\n (0, _snap_lines.make_red_line_snap)(snap_lines_x[i][0], snap_lines_x[i][0], _y, _y3);\n elem.selectAll('tspan').attr('x', snap_lines_x[i][0] - bbox.width - 10);\n elem.attr('x', snap_lines_x[i][0] - bbox.width - 10);\n }\n if ((0, _helpers_math.Mabs)(snap_lines_y[i][0] - ymin) < 10) {\n var x1 = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_x[i][0], snap_lines_x[i][1]), xmin);\n var x2 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_x[i][0], snap_lines_x[i][1]), xmax);\n (0, _snap_lines.make_red_line_snap)(x1, x2, snap_lines_y[i][0], snap_lines_y[i][0]);\n elem.attr('y', snap_lines_y[i][0] + bbox.height + 7.5);\n }\n if ((0, _helpers_math.Mabs)(snap_lines_y[i][0] - ymax) < 10) {\n var _x2 = (0, _helpers_math.Mmin)((0, _helpers_math.Mmin)(snap_lines_x[i][0], snap_lines_x[i][1]), xmin);\n var _x3 = (0, _helpers_math.Mmax)((0, _helpers_math.Mmax)(snap_lines_x[i][0], snap_lines_x[i][1]), xmax);\n (0, _snap_lines.make_red_line_snap)(_x2, _x3, snap_lines_y[i][0], snap_lines_y[i][0]);\n elem.attr('y', snap_lines_y[i][0] - 17.5);\n }\n }\n }\n elem.attr('x', elem.select('tspan').attr('x'));\n self.x = elem.attr('x');\n self.y = elem.attr('y');\n if (transform) {\n var _v = +transform.match(/[-.0-9]+/g)[0];\n elem.attr('transform', 'rotate(' + _v + ', ' + self.x + ', ' + self.y + ')');\n }\n self.update_bbox();\n });\n var group_elem = map.append('g').attrs({ id: id_text_annot, class: 'legend txt_annot' }).styles({ cursor: 'pointer' }).on('mouseover', function () {\n under_rect.style('fill-opacity', 0.1);\n }).on('mouseout', function () {\n under_rect.style('fill-opacity', 0);\n });\n var under_rect = group_elem.append('rect').styles({ fill: 'green', 'fill-opacity': 0 });\n var text_elem = group_elem.append('text').attrs({ x: this.x, y: this.y, id: ['in_', id_text_annot].join('') }).styles({\n 'font-size': this.fontSize + 'px',\n 'font-family': 'verdana',\n 'text-anchor': 'start'\n });\n text_elem.append('tspan').attr('x', this.x).text(_tr('app_page.text_box_edit_box.constructor_default'));\n group_elem.call(drag_txt_annot);\n group_elem.on('dblclick', function () {\n d3.event.preventDefault();\n d3.event.stopPropagation();\n _this.editStyle();\n }).on('contextmenu', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems());\n });\n\n this.lineHeight = round(this.fontSize * 1.4);\n this.textAnnot = text_elem;\n this.group = group_elem;\n this.fontFamily = 'verdana';\n this.anchor = 'start';\n this.buffer = undefined;\n this.id = id_text_annot;\n\n this.update_bbox();\n _snap_lines.pos_lgds_elem.set(this.id, get_bounding_rect(group_elem.node()));\n }\n\n _createClass(Textbox, [{\n key: 'remove',\n value: function remove() {\n _snap_lines.pos_lgds_elem.delete(this.group.attr('id'));\n this.group.remove();\n }\n }, {\n key: 'update_text',\n value: function update_text(new_content) {\n var split = new_content.split('\\n');\n this.textAnnot.selectAll('tspan').remove();\n for (var i = 0; i < split.length; i++) {\n this.textAnnot.append('tspan').attrs({ x: this.x, dy: i === 0 ? null : this.lineHeight }).html(split[i]);\n }\n this.update_bbox();\n }\n }, {\n key: 'get_text_content',\n value: function get_text_content() {\n var content = [];\n this.textAnnot.selectAll('tspan').each(function () {\n content.push(this.innerHTML);\n });\n return content.join('\\n');\n }\n }, {\n key: 'update_bbox',\n value: function update_bbox() {\n var bbox = get_bounding_rect(this.textAnnot.node());\n this.width = bbox.width;\n this.height = bbox.height;\n this.group.select('rect').attrs({\n x: bbox.x - 10,\n y: bbox.y - 10,\n height: this.height + 20,\n width: this.width + 20\n });\n }\n }, {\n key: 'updateLineHeight',\n value: function updateLineHeight() {\n var self = this;\n self.lineHeight = round(self.fontSize * 1.33);\n self.textAnnot.selectAll('tspan').each(function (d, i) {\n if (i !== 0) {\n d3.select(this).attr('dy', self.lineHeight);\n }\n });\n }\n }, {\n key: 'editStyle',\n value: function editStyle() {\n var _this2 = this;\n\n var self = this;\n var text_elem = self.textAnnot;\n (0, _dialogs.check_remove_existing_box)('.styleTextAnnotation');\n\n var current_options = {\n size: self.fontSize,\n color: text_elem.style('fill'),\n content: unescape(this.get_text_content()),\n transform_rotate: text_elem.attr('transform'),\n x: text_elem.attr('x'),\n y: text_elem.attr('y'),\n font_weight: text_elem.style('font-weight'),\n font_style: text_elem.style('font-style'),\n text_decoration: text_elem.style('text-decoration'),\n buffer: self.buffer !== undefined ? (0, _helpers.cloneObj)(self.buffer) : undefined,\n text_shadow: text_elem.style('text-shadow'),\n font_family: self.fontFamily\n };\n current_options.font_weight = current_options.font_weight === '400' || current_options.font_weight === '' ? '' : 'bold';\n (0, _dialogs.make_confirm_dialog2)('styleTextAnnotation', _tr('app_page.text_box_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (!confirmed) {\n text_elem.styles({\n color: current_options.color,\n 'font-size': current_options.size + 'px',\n 'font-weight': current_options.font_weight,\n 'text-decoration': current_options.text_decoration,\n 'font-style': current_options.font_style,\n 'text-shadow': current_options.text_shadow,\n 'font-family': current_options.font_family\n });\n self.fontSize = current_options.size;\n self.fontFamily = current_options.font_family;\n text_elem.attr('transform', current_options.transform_rotate);\n self.buffer = current_options.buffer;\n _this2.update_text(current_options.content);\n } else if (!buffer_txt_chk.node().checked) {\n self.buffer = undefined;\n }\n });\n var box_content = d3.select('.styleTextAnnotation').select('.modal-body').style('width', '295px').insert('div').attr('id', 'styleTextAnnotation');\n\n var current_rotate = typeof current_options.transform_rotate === 'string' ? current_options.transform_rotate.match(/[-.0-9]+/g) : 0;\n if (current_rotate && current_rotate.length === 3) {\n current_rotate = +current_rotate[0];\n } else {\n current_rotate = 0;\n }\n\n var bbox = get_bounding_rect(text_elem.node()),\n nx = bbox.x,\n ny = bbox.y,\n x_center = nx + bbox.width / 2,\n y_center = ny + bbox.height / 2;\n\n var option_rotation = box_content.append('p').attr('class', 'line_elem2');\n\n option_rotation.append('span').html(_tr('app_page.text_box_edit_box.rotation'));\n\n option_rotation.append('span').style('float', 'right').html(' °');\n\n option_rotation.append('input').attrs({\n type: 'number',\n min: 0,\n max: 360,\n step: 'any',\n class: 'without_spinner',\n id: 'textbox_txt_rotate'\n }).styles({ width: '40px', float: 'right' }).property('value', current_rotate).on('change', function () {\n var rotate_value = +this.value;\n text_elem.attrs({ x: nx, y: ny, transform: 'rotate(' + [rotate_value, x_center, y_center] + ')' });\n text_elem.selectAll('tspan').attr('x', nx);\n document.getElementById('textbox_range_rotate').value = rotate_value;\n });\n\n option_rotation.append('input').attrs({ type: 'range', min: 0, max: 360, step: 0.1, id: 'textbox_range_rotate' }).styles({ 'vertical-align': 'middle', width: '100px', float: 'right', margin: 'auto 10px' }).property('value', current_rotate).on('change', function () {\n var rotate_value = +this.value;\n text_elem.attrs({ x: nx, y: ny, transform: 'rotate(' + [rotate_value, x_center, y_center] + ')' });\n text_elem.selectAll('tspan').attr('x', nx);\n document.getElementById('textbox_txt_rotate').value = rotate_value;\n });\n\n var options_font = box_content.append('p');\n var font_select = options_font.insert('select').on('change', function () {\n text_elem.style('font-family', this.value);\n self.fontFamily = this.value;\n });\n\n _fonts.available_fonts.forEach(function (font) {\n font_select.append('option').text(font[0]).attr('value', font[1]);\n });\n font_select.node().selectedIndex = _fonts.available_fonts.map(function (d) {\n return d[1] === self.fontFamily ? '1' : '0';\n }).indexOf('1');\n\n options_font.append('input').attrs({\n id: 'font_size',\n min: 0,\n max: 34,\n step: 0.1,\n type: 'number'\n }).styles({ width: '60px', margin: '0 15px' }).property('value', self.fontSize).on('change', function () {\n self.fontSize = +this.value;\n text_elem.style('font-size', self.fontSize + 'px');\n self.updateLineHeight();\n self.update_bbox();\n });\n\n options_font.append('input').attrs({\n type: 'color',\n id: 'font_color'\n }).style('width', '60px').property('value', (0, _colors_helpers.rgb2hex)(current_options.color)).on('change', function () {\n text_elem.style('fill', this.value);\n });\n\n var options_format = box_content.append('p').style('text-align', 'center');\n var btn_bold = options_format.insert('span').attr('class', current_options.font_weight === 'bold' ? 'active button_disc' : 'button_disc').html(' ');\n var btn_italic = options_format.insert('span').attr('class', current_options.font_style === 'italic' ? 'active button_disc' : 'button_disc').html(' ');\n var btn_underline = options_format.insert('span').attr('class', current_options.text_decoration === 'underline' ? 'active button_disc' : 'button_disc').html(' ');\n\n var content_modif_zone = box_content.append('p');\n content_modif_zone.append('span').html(_tr('app_page.text_box_edit_box.content'));\n var right = content_modif_zone.append('span').attr('class', 'align-option').styles({ 'font-size': '11px', 'font-weight': '', 'margin-left': '10px', float: 'right' }).html('right').on('click', function () {\n content_modif_zone.selectAll('.align-option').style('font-weight', '');\n right.style('font-weight', 'bold').style('font-size', '12px');\n text_elem.style('text-anchor', 'end');\n self.anchor = 'end';\n self.update_bbox();\n });\n var center = content_modif_zone.append('span').styles({ 'font-size': '11px', 'font-weight': '', 'margin-left': '10px', float: 'right' }).attr('class', 'align-option').html('center').on('click', function () {\n content_modif_zone.selectAll('.align-option').style('font-weight', '');\n center.style('font-weight', 'bold').style('font-size', '12px');\n text_elem.style('text-anchor', 'middle');\n self.anchor = 'middle';\n self.update_bbox();\n });\n var left = content_modif_zone.append('span').styles({ 'font-size': '11px', 'font-weight': '', 'margin-left': '10px', float: 'right' }).attr('class', 'align-option').html('left').on('click', function () {\n content_modif_zone.selectAll('.align-option').style('font-weight', '').style('font-size', '11px');\n left.style('font-weight', 'bold').style('font-size', '12px');\n text_elem.style('text-anchor', 'start');\n self.anchor = 'start';\n self.update_bbox();\n });\n var selected = self.anchor === 'start' ? left : self.anchor === 'middle' ? center : right;\n selected.style('font-weight', 'bold').style('font-size', '12px');\n\n content_modif_zone.append('span').html(' ');\n content_modif_zone.append('textarea').attr('id', 'annotation_content').styles({ margin: '5px 0px 0px', width: '100%' }).on('keyup', function () {\n self.update_text(this.value);\n });\n document.getElementById('annotation_content').value = current_options.content;\n\n var buffer_text_zone = box_content.append('p');\n var buffer_txt_chk = buffer_text_zone.append('input').attrs({ type: 'checkbox', id: 'buffer_txt_chk', checked: current_options.buffer !== undefined ? true : null }).on('change', function () {\n if (this.checked) {\n buffer_color.style('display', '');\n if (self.buffer === undefined) {\n self.buffer = { color: '#FFFFFF', size: 1 };\n }\n var color = self.buffer.color,\n size = self.buffer.size;\n text_elem.style('text-shadow', '-' + size + 'px 0px 0px ' + color + ', 0px ' + size + 'px 0px ' + color + ', ' + size + 'px 0px 0px ' + color + ', 0px -' + size + 'px 0px ' + color);\n } else {\n buffer_color.style('display', 'none');\n text_elem.style('text-shadow', 'none');\n }\n });\n\n buffer_text_zone.append('label').attrs({ for: 'buffer_txt_chk' }).text(_tr('app_page.text_box_edit_box.buffer'));\n\n var buffer_color = buffer_text_zone.append('input').styles({\n display: current_options.buffer !== undefined ? '' : 'none',\n float: 'right'\n }).attr('type', 'color').property('value', current_options.buffer && current_options.buffer.color ? current_options.buffer.color : '#FFFFFF').on('change', function () {\n self.buffer.color = this.value;\n var color = self.buffer.color,\n size = self.buffer.size;\n text_elem.style('text-shadow', '-' + size + 'px 0px 0px ' + color + ', 0px ' + size + 'px 0px ' + color + ', ' + size + 'px 0px 0px ' + color + ', 0px -' + size + 'px 0px ' + color);\n });\n\n btn_bold.on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n text_elem.style('font-weight', '');\n } else {\n this.classList.add('active');\n text_elem.style('font-weight', 'bold');\n }\n });\n\n btn_italic.on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n text_elem.style('font-style', '');\n } else {\n this.classList.add('active');\n text_elem.style('font-style', 'italic');\n }\n });\n\n btn_underline.on('click', function () {\n if (this.classList.contains('active')) {\n this.classList.remove('active');\n text_elem.style('text-decoration', '');\n } else {\n this.classList.add('active');\n text_elem.style('text-decoration', 'underline');\n }\n });\n }\n }, {\n key: 'up_element',\n value: function up_element() {\n (0, _legend.up_legend)(this.group.node());\n }\n }, {\n key: 'down_element',\n value: function down_element() {\n (0, _legend.down_legend)(this.group.node());\n }\n }]);\n\n return Textbox;\n}();\n\nexports.default = Textbox;\n\n//# sourceURL=webpack:///./js/layout_features/text_annotation.js?");
-
-/***/ }),
-
-/***/ "./js/legend.js":
-/*!**********************!*\
- !*** ./js/legend.js ***!
- \**********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.drag_legend_func = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.handle_legend = handle_legend;\nexports.up_legends = up_legends;\nexports.up_legend = up_legend;\nexports.down_legend = down_legend;\nexports.createLegend_waffle = createLegend_waffle;\nexports.createLegend_discont_links = createLegend_discont_links;\nexports.createLegend_symbol = createLegend_symbol;\nexports.createLegend_line_symbol = createLegend_line_symbol;\nexports.createLegend_layout = createLegend_layout;\nexports.createLegend_choro = createLegend_choro;\nexports.createLegend_choro_horizontal = createLegend_choro_horizontal;\nexports.move_legends = move_legends;\n\nvar _contextMenu = __webpack_require__(/*! ./context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _snap_lines = __webpack_require__(/*! ./layout_features/snap_lines */ \"./js/layout_features/snap_lines.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n* Function called on clicking on the legend button of each layer\n* - toggle the visibility of the legend (or create the legend if doesn't currently exists)\n*\n* @param {String} layer - The layer name\n* @returns {void}\n*/\nfunction handle_legend(layer) {\n var state = data_manager.current_layers[layer].renderer;\n if (state != undefined) {\n var class_name = ['.lgdf', _app.layer_to_id.get(layer)].join('_');\n var legends = svg_map.querySelectorAll(class_name);\n if (legends.length > 0) {\n if (legends[0].getAttribute('display') == null) {\n Array.prototype.forEach.call(legends, function (el) {\n return el.setAttribute('display', 'none');\n });\n } else {\n Array.prototype.forEach.call(legends, function (el) {\n return el.removeAttribute('display');\n });\n // Redisplay the legend(s) and also\n // verify if still in the visible part\n // of the map, if not, move them in:\n // .. so it's actually a feature if the legend is redrawn on its origin location\n // after being moved too close to the outer border of the map :\n var tol = 10;\n\n var _get_map_xy = get_map_xy0(),\n x0 = _get_map_xy.x,\n y0 = _get_map_xy.y;\n\n var limit_left = x0 - tol;\n var limit_right = x0 + +w + tol;\n var limit_top = y0 - tol;\n var limit_bottom = y0 + +h + tol;\n\n for (var i = 0; i < legends.length; i++) {\n var bboxLegend = legends[i].getBoundingClientRect();\n if (bboxLegend.left < limit_left || bboxLegend.left > limit_right || bboxLegend.top < limit_top || bboxLegend.top > limit_bottom) {\n legends[i].setAttribute('transform', 'translate(0, 0)');\n }\n }\n }\n } else {\n createLegend(layer, '');\n up_legends();\n }\n }\n}\n\nfunction up_legends() {\n var legend_features = svg_map.querySelectorAll('.legend');\n for (var i = 0; i < legend_features.length; i++) {\n svg_map.appendChild(legend_features[i], null);\n }\n}\n\n/**\n* Function called on the first click on the legend button of each layer\n* - delegate legend creation according to the type of function\n*\n* @param {String} layer - The layer name\n* @param {String} title - The desired title (default: empty - can be modified later)\n*\n*/\nfunction createLegend(layer, title) {\n var renderer = data_manager.current_layers[layer].renderer,\n field = data_manager.current_layers[layer].rendered_field,\n field2 = data_manager.current_layers[layer].rendered_field2,\n type_layer = data_manager.current_layers[layer].type;\n var el = void 0,\n el2 = void 0;\n\n var lgd_pos = (0, _helpers_calc.getTranslateNewLegend)();\n\n if (renderer.indexOf('Choropleth') > -1 || renderer.indexOf('Gridded') > -1 || renderer.indexOf('Stewart') > -1 || renderer.indexOf('TypoSymbols') > -1) {\n el = createLegend_choro(layer, field, title, field, 0);\n } else if (renderer.indexOf('Categorical') > -1) {\n el = createLegend_choro(layer, field, title, field, 4);\n } else if (renderer.indexOf('LinksGraduated') !== -1 || renderer.indexOf('DiscLayer') !== -1) {\n el = createLegend_discont_links(layer, field, title, field);\n } else if (renderer.indexOf('PropSymbolsChoro') !== -1) {\n el = createLegend_choro(layer, field2, title, field2, 0);\n el2 = type_layer === 'Line' ? createLegend_line_symbol(layer, field, title, field) : createLegend_symbol(layer, field, title, field);\n } else if (renderer.indexOf('PropSymbolsTypo') !== -1) {\n el = createLegend_choro(layer, field2, title, field2, 4);\n el2 = type_layer === 'Line' ? createLegend_line_symbol(layer, field, title, field) : createLegend_symbol(layer, field, title, field);\n } else if (renderer.indexOf('PropSymbols') !== -1) {\n el = type_layer === 'Line' ? createLegend_line_symbol(layer, field, title, field) : createLegend_symbol(layer, field, title, field);\n } else if (renderer.indexOf('LinksProp') !== -1) {\n el = createLegend_line_symbol(layer, field, title, field);\n } else if (renderer.indexOf('TwoStocksWaffle') !== -1) {\n el = createLegend_waffle(layer, field, title, '');\n } else if (!renderer) {\n el = createLegend_layout(layer, data_manager.current_layers[layer].type, title, '', undefined, layer);\n } else {\n swal('Oops..', _tr('No legend available for this representation') + '. ' + _tr('Want to make a suggestion ?'), 'warning');\n return;\n }\n\n if (el && lgd_pos && lgd_pos.x) {\n el.attr('transform', 'translate(' + lgd_pos.x + ',' + lgd_pos.y + ')');\n }\n _snap_lines.pos_lgds_elem.set(el.attr('id') + ' ' + el.attr('class'), get_bounding_rect(el.node()));\n if (el2) {\n var prev_bbox = get_bounding_rect(el.node()),\n dim_h = lgd_pos.y + prev_bbox.height,\n dim_w = lgd_pos.x + prev_bbox.width;\n var lgd_pos2 = (0, _helpers_calc.getTranslateNewLegend)();\n if (lgd_pos2.x !== lgd_pos.x || lgd_pos2.y !== lgd_pos.y) {\n el2.attr('transform', 'translate(' + lgd_pos2.x + ',' + lgd_pos2.y + ')');\n } else if (dim_h < h) {\n el2.attr('transform', 'translate(' + lgd_pos.x + ',' + dim_h + ')');\n } else if (dim_w < w) {\n el2.attr('transform', 'translate(' + dim_w + ',' + lgd_pos.y + ')');\n }\n _snap_lines.pos_lgds_elem.set(el2.attr('id') + ' ' + el2.attr('class'), get_bounding_rect(el2.node()));\n }\n}\n\nfunction up_legend(legend_node) {\n var lgd_features = svg_map.querySelectorAll('.legend'),\n nb_lgd_features = +lgd_features.length;\n var self_position = void 0;\n\n for (var i = 0; i < nb_lgd_features; i++) {\n if (lgd_features[i].id === legend_node.id && lgd_features[i].classList === legend_node.classList) {\n self_position = i;\n }\n }\n // if (self_position === nb_lgd_features - 1) {\n //\n // } else {\n // svg_map.insertBefore(lgd_features[self_position + 1], lgd_features[self_position]);\n // }\n if (!(self_position === nb_lgd_features - 1)) {\n svg_map.insertBefore(lgd_features[self_position + 1], lgd_features[self_position]);\n }\n}\n\nfunction down_legend(legend_node) {\n var lgd_features = svg_map.querySelectorAll('.legend'),\n nb_lgd_features = +lgd_features.length;\n var self_position = void 0;\n\n for (var i = 0; i < nb_lgd_features; i++) {\n if (lgd_features[i].id === legend_node.id && lgd_features[i].classList === legend_node.classList) {\n self_position = i;\n }\n }\n if (self_position !== 0) {\n svg_map.insertBefore(lgd_features[self_position], lgd_features[self_position - 1]);\n }\n}\n\nfunction make_legend_context_menu(legend_node) {\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems() {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n createlegendEditBox(legend_node.attr('id'), legend_node.attr('layer_name'));\n } }, { name: _tr('app_page.common.up_element'), action: function action() {\n up_legend(legend_node.node());\n } }, { name: _tr('app_page.common.down_element'), action: function action() {\n down_legend(legend_node.node());\n } }, {\n name: _tr('app_page.common.hide'),\n action: function action() {\n if (!(legend_node.attr('display') === 'none')) legend_node.attr('display', 'none');else legend_node.attr('display', null);\n }\n }];\n };\n legend_node.on('dblclick', function () {\n d3.event.stopPropagation();\n d3.event.preventDefault();\n createlegendEditBox(legend_node.attr('id'), legend_node.attr('layer_name'));\n });\n\n legend_node.on('contextmenu', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems());\n });\n}\n\nvar drag_legend_func = exports.drag_legend_func = function drag_legend_func(legend_group) {\n return d3.drag().subject(function () {\n var t = d3.select(this),\n prev_translate = t.attr('transform'),\n snap_lines = (0, _snap_lines.get_coords_snap_lines)(t.attr('id') + ' ' + t.attr('class'));\n\n prev_translate = prev_translate ? prev_translate.slice(10, -1).split(/[ ,]+/).map(function (f) {\n return +f;\n }) : [0, 0];\n if (prev_translate.length === 1) prev_translate = [prev_translate[0], 0];\n\n return {\n x: +t.attr('x') + prev_translate[0],\n y: +t.attr('y') + prev_translate[1],\n map_locked: !!map_div.select('#hand_button').classed('locked'),\n snap_lines: snap_lines,\n offset: [+legend_group.select('#under_rect').attr('x'), +legend_group.select('#under_rect').attr('y')]\n };\n }).on('start', function () {\n d3.event.sourceEvent.stopPropagation();\n d3.event.sourceEvent.preventDefault();\n (0, _interface.handle_click_hand)('lock');\n }).on('end', function () {\n if (d3.event.subject && !d3.event.subject.map_locked) {\n (0, _interface.handle_click_hand)('unlock');\n }\n legend_group.style('cursor', 'grab');\n _snap_lines.pos_lgds_elem.set(legend_group.attr('id') + ' ' + legend_group.attr('class'), get_bounding_rect(legend_group.node()));\n }).on('drag', function () {\n var Min = _helpers_math.Mmin;\n var Max = _helpers_math.Mmax;\n var new_value = [d3.event.x, d3.event.y];\n var prev_value = legend_group.attr('transform');\n prev_value = prev_value ? prev_value.slice(10, -1).split(/[ ,]+/).map(function (f) {\n return +f;\n }) : [0, 0];\n if (prev_value.length === 1) prev_value = [prev_value[0], 0];\n legend_group.attr('transform', 'translate(' + new_value + ')').style('cursor', 'grabbing');\n\n var bbox_elem = get_bounding_rect(legend_group.node());\n var val_x = d3.event.x,\n val_y = d3.event.y,\n change = void 0;\n\n if (_app.autoalign_features) {\n var xmin = bbox_elem.x,\n xmax = bbox_elem.x + bbox_elem.width,\n ymin = bbox_elem.y,\n ymax = bbox_elem.y + bbox_elem.height;\n\n var snap_lines_x = d3.event.subject.snap_lines.x,\n snap_lines_y = d3.event.subject.snap_lines.y;\n for (var i = 0; i < snap_lines_x.length; i++) {\n if ((0, _helpers_math.Mabs)(snap_lines_x[i][0] - xmin) < 10) {\n var _y1 = Min(Min(snap_lines_y[i][0], snap_lines_y[i][1]), ymin);\n var _y2 = Max(Max(snap_lines_y[i][0], snap_lines_y[i][1]), ymax);\n (0, _snap_lines.make_red_line_snap)(snap_lines_x[i][0], snap_lines_x[i][0], _y1, _y2);\n val_x = snap_lines_x[i][0] - d3.event.subject.offset[0];\n change = true;\n }\n if ((0, _helpers_math.Mabs)(snap_lines_x[i][0] - xmax) < 10) {\n var _y = Min(Min(snap_lines_y[i][0], snap_lines_y[i][1]), ymin);\n var _y3 = Max(Max(snap_lines_y[i][0], snap_lines_y[i][1]), ymax);\n (0, _snap_lines.make_red_line_snap)(snap_lines_x[i][0], snap_lines_x[i][0], _y, _y3);\n val_x = snap_lines_x[i][0] - bbox_elem.width - d3.event.subject.offset[0];\n change = true;\n }\n if ((0, _helpers_math.Mabs)(snap_lines_y[i][0] - ymin) < 10) {\n var x1 = Min(Min(snap_lines_x[i][0], snap_lines_x[i][1]), xmin);\n var x2 = Max(Max(snap_lines_x[i][0], snap_lines_x[i][1]), xmax);\n (0, _snap_lines.make_red_line_snap)(x1, x2, snap_lines_y[i][0], snap_lines_y[i][0]);\n val_y = snap_lines_y[i][0] - d3.event.subject.offset[1];\n change = true;\n }\n if ((0, _helpers_math.Mabs)(snap_lines_y[i][0] - ymax) < 10) {\n var _x = Min(Min(snap_lines_x[i][0], snap_lines_x[i][1]), xmin);\n var _x2 = Max(Max(snap_lines_x[i][0], snap_lines_x[i][1]), xmax);\n (0, _snap_lines.make_red_line_snap)(_x, _x2, snap_lines_y[i][0], snap_lines_y[i][0]);\n val_y = snap_lines_y[i][0] - bbox_elem.height - d3.event.subject.offset[1];\n change = true;\n }\n }\n }\n\n if (bbox_elem.width < w && bbox_elem.x < -10 || bbox_elem.x + bbox_elem.width > +w + 10) {\n val_x = prev_value[0];\n change = true;\n }\n if (bbox_elem.height < h && bbox_elem.y < -10 || bbox_elem.y + bbox_elem.height > +h + 10) {\n val_y = prev_value[1];\n change = true;\n }\n if (change) {\n legend_group.attr('transform', 'translate(' + [val_x, val_y] + ')');\n }\n });\n};\n\nfunction createLegend_waffle(layer, fields, title, subtitle, rect_fill_value, ratio_txt, note_bottom) {\n var space_elem = 18;\n var boxheight = 18;\n var boxwidth = 18;\n var boxgap = 12;\n var xpos = 30;\n var ypos = 30;\n var y_pos2 = ypos + space_elem;\n var tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer);\n var nbVar = fields.length;\n var ref_colors = data_manager.current_layers[layer].fill_color;\n var symbol = data_manager.current_layers[layer].symbol;\n var size_symbol = data_manager.current_layers[layer].size;\n var last_pos = void 0;\n\n var legend_root = map.insert('g').attrs({\n id: 'legend_root_waffle',\n class: tmp_class_name,\n transform: 'translate(0,0)',\n layer_name: layer\n }).styles({\n cursor: 'grab',\n 'font-size': '11px',\n 'font-family': 'verdana'\n });\n\n var rect_under_legend = legend_root.insert('rect');\n\n legend_root.insert('text').attrs(subtitle != '' ? { id: 'legendtitle', x: xpos + space_elem, y: ypos } : { id: 'legendtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).text(title || '');\n\n legend_root.insert('text').attrs({ id: 'legendsubtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).text(subtitle);\n\n var fields_colors = [];\n for (var i = 0; i < nbVar; i++) {\n fields_colors.push([fields[i], ref_colors[i]]);\n }\n\n var legend_elems = legend_root.selectAll('.legend').append('g').data(fields_colors).enter().insert('g').attr('class', function (d, i) {\n return 'lg legend_' + i;\n });\n\n legend_elems.append('rect').attrs(function (d, i) {\n last_pos = y_pos2 + i * boxgap + i * boxheight;\n return {\n x: xpos + boxwidth,\n y: last_pos,\n width: boxwidth,\n height: boxheight\n };\n }).styles(function (d) {\n return { fill: d[1], stroke: d[1] };\n });\n\n legend_elems.append('text').attr('x', xpos + boxwidth * 2 + 10).attr('y', function (d, i) {\n return y_pos2 + i * boxheight + i * boxgap + boxheight * 2 / 3;\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return d[0];\n });\n\n var legend_symbol_size = legend_root.append('g');\n if (symbol === 'rect') {\n legend_symbol_size.insert('rect').attrs({\n x: xpos + boxwidth + (boxwidth - size_symbol) / 2,\n y: last_pos + 2 * space_elem,\n width: size_symbol,\n height: size_symbol\n }).styles({ fill: 'lightgray', stroke: 'black', 'stroke-width': '0.8px' });\n legend_symbol_size.insert('text').attrs({\n x: xpos + boxwidth + space_elem + size_symbol,\n y: last_pos + 2 * space_elem + size_symbol / 2 + 4,\n id: 'ratio_txt'\n }).html(ratio_txt || ' = ' + data_manager.current_layers[layer].ratio);\n last_pos = last_pos + 3 * space_elem + size_symbol;\n } else {\n legend_symbol_size.insert('circle').attrs({\n cx: xpos + boxwidth * 1.5,\n cy: last_pos + 2 * space_elem + size_symbol,\n r: size_symbol\n }).styles({ fill: 'lightgray', stroke: 'black', 'stroke-width': '0.8px' });\n legend_symbol_size.insert('text').attrs({ x: xpos + boxwidth + space_elem + size_symbol * 2, y: last_pos + 2 * space_elem + size_symbol + 4, id: 'ratio_txt' }).html(ratio_txt || ' = ' + data_manager.current_layers[layer].ratio);\n last_pos = last_pos + 3 * space_elem + size_symbol * 2;\n }\n\n legend_root.append('g').insert('text').attrs({ id: 'legend_bottom_note', x: xpos + space_elem, y: last_pos }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).html(note_bottom != null ? note_bottom : '');\n\n legend_root.call(drag_legend_func(legend_root));\n\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\nfunction createLegend_discont_links(layer, field, title, subtitle, rect_fill_value, rounding_precision, note_bottom) {\n var space_elem = 18,\n boxgap = 12,\n xpos = 30,\n ypos = 30,\n y_pos2 = ypos + space_elem,\n tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer),\n breaks = data_manager.current_layers[layer].breaks,\n nb_class = breaks.length;\n\n if (rounding_precision === undefined) {\n var b_val = breaks.map(function (v) {\n return v[0][0];\n }).concat(breaks[nb_class - 1][0][1]);\n rounding_precision = get_lgd_display_precision(b_val);\n }\n\n var legend_root = map.insert('g').attrs({\n id: 'legend_root_lines_class',\n class: tmp_class_name,\n transform: 'translate(0,0)',\n rounding_precision: rounding_precision,\n layer_field: field,\n layer_name: layer\n }).styles({ cursor: 'grab', 'font-size': '11px', 'font-family': 'verdana' });\n\n var rect_under_legend = legend_root.insert('rect');\n\n legend_root.insert('text').attrs(subtitle != '' ? { id: 'legendtitle', x: xpos + space_elem, y: ypos } : { id: 'legendtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).text(title || '');\n\n legend_root.insert('text').attrs({ id: 'legendsubtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).text(subtitle);\n\n var ref_symbols_params = [];\n\n // Prepare symbols for the legend, taking care of not representing values\n // under the display threshold defined by the user (if any) :\n var current_min_value = +data_manager.current_layers[layer].min_display;\n if (data_manager.current_layers[layer].renderer === 'DiscLayer') {\n // Todo use the same way to store the threshold for links and disclayer\n // in order to avoid theses condition\n var values = Array.prototype.map.call(svg_map.querySelector('#' + _app.layer_to_id.get(layer)).querySelectorAll('path'), function (d) {\n return +d.__data__.properties.disc_value;\n });\n current_min_value = current_min_value !== 1 ? values[(0, _helpers_math.Mround)(current_min_value * data_manager.current_layers[layer].n_features)] : values[values.length - 1];\n }\n\n for (var ix = 0; ix < nb_class; ix++) {\n var _b_val = breaks[ix];\n if (_b_val[1] !== 0) {\n if (current_min_value >= +_b_val[0][0] && current_min_value < +_b_val[0][1]) {\n ref_symbols_params.push({ value: [current_min_value, _b_val[0][1]], size: _b_val[1] });\n } else if (current_min_value < +_b_val[0][0] && current_min_value < +_b_val[0][1]) {\n ref_symbols_params.push({ value: _b_val[0], size: _b_val[1] });\n }\n }\n }\n\n ref_symbols_params.reverse();\n\n var legend_elems = legend_root.selectAll('.legend').append('g').data(ref_symbols_params).enter().insert('g').attr('class', function (d, i) {\n return 'lg legend_' + i;\n });\n\n var max_size = data_manager.current_layers[layer].size[1],\n color = data_manager.current_layers[layer].fill_color.single,\n xrect = xpos + space_elem + max_size / 2;\n var last_size = 0,\n last_pos = y_pos2;\n\n legend_elems.append('rect').styles({\n fill: color,\n stroke: 'rgb(0, 0, 0)',\n 'fill-opacity': 1,\n 'stroke-width': 0\n }).attrs(function (d) {\n last_pos = boxgap + last_pos + last_size;\n last_size = d.size * svg_map.__zoom.k;\n return {\n x: xrect,\n y: last_pos,\n width: 45,\n height: last_size\n };\n });\n\n last_pos = y_pos2;\n last_size = 0;\n\n var x_text_pos = xpos + space_elem + max_size * 1.5 + 45;\n var tmp_pos = void 0;\n legend_elems.append('text').attrs(function (d) {\n last_pos = boxgap + last_pos + last_size;\n last_size = d.size * svg_map.__zoom.k;\n tmp_pos = last_pos - last_size / 4;\n return { x: x_text_pos, y: tmp_pos };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value[1], rounding_precision).toLocaleString();\n });\n\n legend_root.insert('text').attrs({ id: 'lgd_choro_min_val', x: x_text_pos, y: tmp_pos + boxgap }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text((0, _helpers_calc.round_value)(ref_symbols_params[ref_symbols_params.length - 1].value[0], rounding_precision).toLocaleString());\n\n legend_root.call(drag_legend_func(legend_root));\n\n legend_root.append('g').insert('text').attrs({\n id: 'legend_bottom_note',\n x: xpos + space_elem,\n y: last_pos + 2 * space_elem\n }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).text(note_bottom != null ? note_bottom : '');\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n // legend_root.select('#legendtitle').text(title || \"\");\n make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\n/**\n* Function computing the size of the rectangle to be put under the legend\n* (called on each change modifying the size of the legend box,\n* eg. longer title, switching to nested symbols, etc..)\n*\n*/\nfunction make_underlying_rect(legend_root, under_rect, fill) {\n under_rect.attrs({ width: 0, height: 0 });\n var bboxLegend = get_bounding_rect(legend_root.node());\n var translate = legend_root.attr('transform');\n\n translate = translate ? translate.split('translate(')[1].split(')')[0].split(/[ ,]+/).map(function (d) {\n return +d;\n }) : [0, 0];\n if (translate.length === 1) translate = [translate[0], 0];\n\n var x_top_left = bboxLegend.x - 12.5 - translate[0];\n var y_top_left = bboxLegend.y - 12.5 - translate[1];\n var x_top_right = bboxLegend.x + bboxLegend.width + 12.5 - translate[0];\n var y_bottom_left = bboxLegend.y + bboxLegend.height + 12.5 - translate[1];\n var rect_height = y_bottom_left - y_top_left;\n var rect_width = x_top_right - x_top_left;\n\n under_rect.attrs({\n id: 'under_rect',\n x: x_top_left,\n y: y_top_left,\n height: rect_height,\n width: rect_width\n });\n\n if (!fill || !fill.color || !fill.opacity) {\n under_rect.styles({ fill: 'green', 'fill-opacity': 0 });\n legend_root.attr('visible_rect', 'false').on('mouseover', function () {\n under_rect.style('fill-opacity', 0.1);\n }).on('mouseout', function () {\n under_rect.style('fill-opacity', 0);\n });\n } else {\n under_rect.styles({ fill: fill.color, 'fill-opacity': fill.opacity });\n legend_root.attr('visible_rect', 'true').on('mouseover', null).on('mouseout', null);\n }\n}\n\nfunction createLegend_symbol(layer, field, title, subtitle) {\n var nested = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'false';\n var join_line = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'false';\n var rect_fill_value = arguments[6];\n var rounding_precision = arguments[7];\n var note_bottom = arguments[8];\n var options = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : {};\n\n var parent = options.parent || window.map;\n var layer_prop = data_manager.current_layers[layer];\n var space_elem = 18;\n var boxgap = 4;\n var xpos = 30;\n var ypos = 30;\n var y_pos2 = ypos + space_elem * 1.5;\n var tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer);\n var symbol_type = layer_prop.symbol;\n\n var color_symb_lgd = layer_prop.renderer === 'PropSymbolsChoro' || layer_prop.renderer === 'PropSymbolsTypo' || layer_prop.fill_color.two !== undefined || layer_prop.fill_color.random !== undefined ? '#FFF' : layer_prop.fill_color.single;\n\n var stroke_color = layer_prop.renderer === 'PropSymbolsChoro' || layer_prop.renderer === 'PropSymbolsTypo' || layer_prop.fill_color.two !== undefined || layer_prop.fill_color.random !== undefined ? 'rgb(0, 0, 0)' : map.select('#' + _app.layer_to_id.get(layer)).select(symbol_type).style('stroke');\n\n var ref_symbols = document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName(symbol_type);\n var type_param = symbol_type === 'circle' ? 'r' : 'width';\n var z_scale = +d3.zoomTransform(map.node()).k;\n\n var _layer_prop$size = _slicedToArray(layer_prop.size, 2),\n ref_value = _layer_prop$size[0],\n ref_size = _layer_prop$size[1];\n\n var propSize = new _helpers_calc.PropSizer(ref_value, ref_size, symbol_type);\n\n if (!layer_prop.size_legend_symbol) {\n var non_empty = Array.prototype.filter.call(ref_symbols, function (d) {\n if (d[type_param].baseVal.value !== 0) return d[type_param].baseVal.value;\n });\n var size_max = +non_empty[0].getAttribute(type_param),\n size_min = +non_empty[non_empty.length - 1].getAttribute(type_param),\n val_max = (0, _helpers_math.Mabs)(+non_empty[0].__data__.properties[field]),\n val_min = (0, _helpers_math.Mabs)(+non_empty[non_empty.length - 1].__data__.properties[field]);\n var r = (0, _helpers_math.Mmax)((0, _helpers_calc.get_nb_decimals)(val_max), (0, _helpers_calc.get_nb_decimals)(val_min)),\n diff_size = (0, _helpers_math.Msqrt)(size_max) - (0, _helpers_math.Msqrt)(size_min),\n size_interm1 = (0, _helpers_math.Msqrt)(size_min) + diff_size / 3,\n size_interm2 = (0, _helpers_math.Mpow)(size_interm1 + diff_size / 3, 2);\n size_interm1 = (0, _helpers_math.Mpow)(size_interm1, 2);\n layer_prop.size_legend_symbol = [{ value: val_max }, { value: (0, _helpers_calc.round_value)(propSize.get_value(size_interm2), r) }, { value: (0, _helpers_calc.round_value)(propSize.get_value(size_interm1), r) }, { value: val_min }];\n if (layer_prop.size_legend_symbol[0].value - layer_prop.size_legend_symbol[1].value > 1) {\n rounding_precision = 0;\n } else {\n rounding_precision = (0, _helpers_math.Mmax)((0, _helpers_calc.get_nb_decimals)(val_max), (0, _helpers_calc.get_nb_decimals)(val_min));\n }\n }\n\n var t = layer_prop.size_legend_symbol;\n var ref_symbols_params = [{ size: propSize.scale(t[0].value) * z_scale, value: t[0].value }, { size: propSize.scale(t[1].value) * z_scale, value: t[1].value }, { size: propSize.scale(t[2].value) * z_scale, value: t[2].value }, { size: propSize.scale(t[3].value) * z_scale, value: t[3].value }];\n if (ref_symbols_params[3].value === 0) {\n ref_symbols_params.pop();\n }\n if (ref_symbols_params[2].value === 0) {\n ref_symbols_params.pop();\n }\n\n var legend_root = parent.insert('g').styles({\n cursor: 'grab',\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).attrs({\n id: 'legend_root_symbol',\n class: tmp_class_name,\n transform: 'translate(0,0)',\n layer_name: layer,\n nested: nested,\n join_line: join_line,\n rounding_precision: rounding_precision,\n layer_field: field\n });\n\n var rect_under_legend = legend_root.insert('rect');\n legend_root.insert('text').attrs(subtitle != '' ? { 'id': 'legendtitle', x: xpos + space_elem, y: ypos } : { 'id': 'legendtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).text(title);\n\n legend_root.insert('text').attrs({ id: 'legendsubtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).text(subtitle);\n\n var legend_elems = legend_root.selectAll('.legend').append('g').data(ref_symbols_params).enter().insert('g').attr('class', function (d, i) {\n return 'lg legend_' + i;\n });\n\n var max_size = ref_symbols_params[0].size * 2;\n var last_size = 0;\n\n if (symbol_type === 'rect') {\n y_pos2 -= max_size / 4;\n }\n\n var last_pos = y_pos2;\n\n if (nested === 'false') {\n if (symbol_type === 'circle') {\n legend_elems.append('circle').styles({ fill: color_symb_lgd, stroke: stroke_color, 'fill-opacity': 1 }).attrs(function (d, i) {\n last_pos = i * boxgap + d.size + last_pos + last_size;\n last_size = d.size;\n return {\n cx: xpos + space_elem + boxgap + max_size / 4,\n cy: last_pos,\n r: d.size\n };\n });\n\n last_pos = y_pos2;last_size = 0;\n legend_elems.append('text').attrs(function (d, i) {\n last_pos = i * boxgap + d.size + last_pos + last_size;\n last_size = d.size;\n return {\n x: xpos + space_elem + boxgap + max_size * 0.75 + 7,\n y: last_pos + i * 2 / 3\n };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value, rounding_precision).toLocaleString();\n });\n } else if (symbol_type === 'rect') {\n legend_elems.append('rect').styles({ fill: color_symb_lgd, stroke: stroke_color, 'fill-opacity': 1 }).attrs(function (d, i) {\n last_pos = i * boxgap + d.size / 2 + last_pos + last_size;\n last_size = d.size;\n return {\n x: xpos + space_elem + boxgap + max_size / 4 - last_size / 2,\n y: last_pos,\n width: last_size,\n height: last_size\n };\n });\n\n last_pos = y_pos2;last_size = 0;\n var x_text_pos = xpos + space_elem + boxgap + max_size / 2 + 7;\n legend_elems.append('text').attrs(function (d, i) {\n last_pos = i * boxgap + d.size / 2 + last_pos + last_size;\n last_size = d.size;\n return { x: x_text_pos, y: last_pos + d.size * 0.51 };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value, rounding_precision).toLocaleString();\n });\n }\n } else if (nested === 'true') {\n var dist_to_title = 30;\n if (symbol_type === 'circle') {\n if (join_line === 'true') {\n legend_elems.append('line').attrs(function (d) {\n return {\n x1: xpos + space_elem + boxgap + max_size / 4 - d.size,\n x2: xpos + space_elem + boxgap + max_size * 0.75 + 6.5,\n y1: ypos + dist_to_title + max_size - d.size + 0.5,\n y2: ypos + dist_to_title + max_size - d.size + 0.5,\n stroke: '#3f3f3f',\n 'stroke-width': 0.8\n };\n });\n legend_elems.append('circle').attrs(function (d) {\n return {\n cx: xpos + space_elem + boxgap + max_size / 4,\n cy: ypos + dist_to_title + max_size - d.size,\n r: d.size\n };\n }).styles({ fill: color_symb_lgd, stroke: stroke_color, 'fill-opacity': 1 });\n last_pos = y_pos2;last_size = 0;\n legend_elems.append('text').attrs(function (d) {\n return {\n x: xpos + space_elem + boxgap + max_size * 0.75 + 7,\n y: ypos + dist_to_title + 3 + max_size - d.size\n };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value, rounding_precision).toLocaleString();\n });\n } else {\n legend_elems.append('circle').attrs(function (d) {\n return {\n cx: xpos + space_elem + boxgap + max_size / 4,\n cy: ypos + dist_to_title + max_size - d.size,\n r: d.size\n };\n }).styles({ fill: color_symb_lgd, stroke: stroke_color, 'fill-opacity': 1 });\n last_pos = y_pos2;last_size = 0;\n legend_elems.append('text').attrs(function (d) {\n return {\n x: xpos + space_elem + boxgap + max_size * 0.75 + 7,\n y: ypos + dist_to_title + 1 + max_size - d.size * 2\n };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value, rounding_precision).toLocaleString();\n });\n }\n last_pos = ypos + 20 + max_size;\n } else if (symbol_type === 'rect') {\n legend_elems.append('rect').attrs(function (d) {\n return {\n x: xpos + space_elem + boxgap,\n y: ypos + dist_to_title + max_size / 2 - d.size,\n width: d.size,\n height: d.size\n };\n }).styles({ fill: color_symb_lgd, stroke: stroke_color, 'fill-opacity': 1 });\n last_pos = y_pos2;last_size = 0;\n legend_elems.append('text').attrs(function (d) {\n return {\n x: xpos + space_elem + boxgap + max_size / 2 + 7,\n y: ypos + dist_to_title + 1 + max_size / 2 - d.size\n };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value, rounding_precision).toLocaleString();\n });\n last_pos = ypos + 20 + max_size / 2;\n }\n }\n\n if (layer_prop.break_val !== undefined) {\n var bottom_colors = legend_root.append('g');\n bottom_colors.insert('text').attrs({\n id: 'col1_txt',\n x: xpos + space_elem,\n y: last_pos + 1.75 * space_elem\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).html('< ' + layer_prop.break_val.toLocaleString());\n bottom_colors.insert('rect').attrs({\n id: 'col1',\n x: xpos + space_elem,\n y: last_pos + 2 * space_elem,\n width: space_elem,\n height: space_elem\n }).style('fill', layer_prop.fill_color.two[0]);\n bottom_colors.insert('text').attrs({\n id: 'col1_txt',\n x: xpos + 3 * space_elem,\n y: last_pos + 1.75 * space_elem\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).html('> ' + layer_prop.break_val.toLocaleString());\n bottom_colors.insert('rect').attrs({\n id: 'col2',\n x: xpos + 3 * space_elem,\n y: last_pos + 2 * space_elem,\n width: space_elem,\n height: space_elem\n }).style('fill', layer_prop.fill_color.two[1]);\n last_pos += 2.5 * space_elem;\n }\n\n legend_root.append('g').insert('text').attrs({\n id: 'legend_bottom_note',\n x: xpos + space_elem,\n y: last_pos + 2 * space_elem\n }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).text(note_bottom != null ? note_bottom : '');\n\n legend_root.call(drag_legend_func(legend_root));\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n if (parent == map) make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\nfunction createLegend_line_symbol(layer, field, title, subtitle, rect_fill_value, rounding_precision, note_bottom) {\n var space_elem = 18,\n boxgap = 12,\n xpos = 30,\n ypos = 30,\n y_pos2 = ypos + space_elem,\n tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer);\n\n var ref_symbols = document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName('path');\n var type_param = 'strokeWidth';\n\n var non_empty = Array.prototype.filter.call(ref_symbols, function (d) {\n return d.style[type_param] !== '0';\n }),\n size_max = +non_empty[0].style[type_param],\n size_min = +non_empty[non_empty.length - 1].style[type_param],\n val_max = (0, _helpers_math.Mabs)(+non_empty[0].__data__.properties[field]),\n val_min = (0, _helpers_math.Mabs)(+non_empty[non_empty.length - 1].__data__.properties[field]),\n diff_size = size_max - size_min,\n diff_val = val_max - val_min,\n val_interm1 = val_min + diff_val / 3,\n val_interm2 = val_interm1 + diff_val / 3,\n size_interm1 = size_min + diff_size / 3,\n size_interm2 = size_interm1 + diff_size / 3,\n ref_symbols_params = [{ size: size_max, value: val_max }, { size: size_interm2, value: val_interm2 }, { size: size_interm1, value: val_interm1 }, { size: size_min, value: val_min }];\n\n if (rounding_precision === undefined) {\n rounding_precision = get_lgd_display_precision(ref_symbols_params.map(function (d) {\n return d.value;\n }));\n }\n\n var legend_root = map.insert('g').attrs({\n id: 'legend_root_lines_symbol',\n class: tmp_class_name,\n transform: 'translate(0,0)',\n rounding_precision: rounding_precision,\n layer_field: field,\n layer_name: layer\n }).styles({\n cursor: 'grab',\n 'font-size': '11px',\n 'font-family': 'verdana'\n });\n\n var rect_under_legend = legend_root.insert('rect');\n\n legend_root.insert('text').attrs(subtitle != '' ? { id: 'legendtitle', x: xpos + space_elem, y: ypos } : { id: 'legendtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).text(title || 'Title');\n\n legend_root.insert('text').attrs({ id: 'legendsubtitle', x: xpos + space_elem, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).text(subtitle);\n\n var legend_elems = legend_root.selectAll('.legend').append('g').data(ref_symbols_params).enter().insert('g').attr('class', function (d, i) {\n return 'lg legend_' + i;\n });\n\n var last_size = 0;\n var last_pos = y_pos2;\n var color = data_manager.current_layers[layer].fill_color.single;\n var xrect = xpos + space_elem;\n\n legend_elems.append('rect').styles({\n fill: color,\n stroke: 'rgb(0, 0, 0)',\n 'fill-opacity': 1,\n 'stroke-width': 0\n }).attrs(function (d) {\n last_pos = boxgap + last_pos + last_size;\n last_size = d.size;\n return {\n x: xrect,\n y: last_pos,\n width: 45,\n height: d.size\n };\n });\n\n last_pos = y_pos2;last_size = 0;\n var x_text_pos = xrect + 75;\n legend_elems.append('text').attrs(function (d) {\n last_pos = boxgap + last_pos + d.size;\n return { x: x_text_pos, y: last_pos + 4 - d.size / 2 };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(d.value, rounding_precision).toLocaleString();\n });\n\n legend_root.append('g').insert('text').attrs({\n id: 'legend_bottom_note',\n x: xpos + space_elem,\n y: last_pos + space_elem\n }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).text(note_bottom != null ? note_bottom : '');\n\n legend_root.call(drag_legend_func(legend_root));\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n legend_root.select('#legendtitle').text(title || '');\n make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\nvar get_lgd_display_precision = function get_lgd_display_precision(breaks) {\n // Set rounding precision to 0 if they are all integers :\n // eslint-disable-next-line no-bitwise\n if (breaks.filter(function (b) {\n return (b | 0) === b;\n }).length === breaks.length) {\n return 0;\n }\n // Compute the difference between each break to set\n // ... the rounding precision in order to differenciate each class :\n var diff = void 0;\n for (var i = 0; i < breaks.length - 1; i++) {\n var d = +breaks[i + 1] - +breaks[i];\n if (!diff) diff = d;else if (d < diff) diff = d;\n }\n if (diff > 1 || diff > 0.1) {\n return 1;\n } else if (diff > 0.01) {\n return 2;\n } else if (diff > 0.001) {\n return 3;\n } else if (diff > 0.0001) {\n return 4;\n } else if (diff > 0.00001) {\n return 5;\n } else if (diff > 0.000001) {\n return 6;\n } else if (diff > 0.0000001) {\n return 7;\n }\n return undefined;\n};\n\nfunction createLegend_layout(layer, type_geom, title, subtitle, rect_fill_value, text_value, note_bottom) {\n var space_elem = 18;\n var boxheight = 18;\n var boxwidth = 18;\n var xpos = 30;\n var ypos = 30;\n var tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer);\n var color_layer = data_manager.current_layers[layer].fill_color.single;\n var legend_root = map.insert('g').styles({ cursor: 'grab', 'font-size': '11px', 'font-family': 'verdana' }).attrs({\n id: 'legend_root_layout',\n class: tmp_class_name,\n transform: 'translate(0,0)',\n layer_name: layer\n });\n var rect_under_legend = legend_root.insert('rect');\n\n legend_root.insert('text').attrs(subtitle != '' ? { id: 'legendtitle', x: xpos + boxheight, y: ypos } : { id: 'legendtitle', x: xpos + boxheight, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).text(title || '');\n\n legend_root.insert('text').attrs({ id: 'legendsubtitle', x: xpos + boxheight, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).text(subtitle);\n\n var legend_elems = legend_root.append('g').insert('g').attr('class', 'lg legend_0');\n\n if (type_geom === 'Polygon') {\n var stroke_color = map.select('#' + _app.layer_to_id.get(layer)).select('path').style('stroke');\n var stroke_width = map.select('#' + _app.layer_to_id.get(layer)).select('path').style('stroke-width');\n legend_elems.append('rect').attrs({\n x: xpos + boxwidth,\n y: ypos + boxheight * 1.8,\n width: boxwidth,\n height: boxheight\n }).styles({\n fill: color_layer,\n stroke: stroke_color,\n 'stroke-width': stroke_width\n });\n\n legend_elems.append('text').attrs({ x: xpos + boxwidth * 2 + 10, y: ypos + boxheight * 2.6 }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(text_value);\n ypos += 30 + boxheight;\n } else if (type_geom === 'Line') {\n var _stroke_width = +data_manager.current_layers[layer]['stroke-width-const'];\n legend_elems.append('rect').styles({\n fill: color_layer,\n stroke: 'rgb(0, 0, 0)',\n 'fill-opacity': 1,\n 'stroke-width': 0\n }).attrs({\n x: xpos + boxwidth,\n y: ypos + boxheight * 1.9 + boxheight / 2 - _stroke_width / 2,\n width: boxwidth,\n height: _stroke_width\n });\n\n legend_elems.append('text').attrs({ x: xpos + boxwidth * 2 + 10, y: ypos + boxheight * 2.6 }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(text_value);\n ypos = ypos + boxheight * 1.9 + boxheight / 2 + _stroke_width / 2;\n } else if (type_geom === 'Point') {\n var radius = data_manager.current_layers[layer].pointRadius * svg_map.__zoom.k;\n var _stroke_color = map.select('#' + _app.layer_to_id.get(layer)).select('path').style('stroke');\n var _stroke_width2 = map.select('#' + _app.layer_to_id.get(layer)).style('stroke-width');\n console.log(_stroke_color, _stroke_width2);\n var dist_to_title = 30;\n legend_elems.append('circle').styles({\n fill: color_layer,\n stroke: _stroke_color,\n 'fill-opacity': 1,\n 'stroke-width': _stroke_width2\n }).attrs(function (d) {\n return {\n cx: xpos + space_elem + 4 + radius / 2,\n cy: ypos + dist_to_title + radius,\n r: radius\n };\n });\n legend_elems.append('text').attrs(function (d) {\n return {\n x: xpos + space_elem + 4 + radius * 2 * 0.75 + 7,\n y: ypos + dist_to_title + 1 + radius\n };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(text_value);\n ypos = ypos + dist_to_title + 1 + radius * 2;\n }\n\n legend_root.append('g').insert('text').attrs({ id: 'legend_bottom_note', x: xpos + boxheight, y: ypos + boxheight }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).text(note_bottom != null ? note_bottom : '');\n\n legend_root.call(drag_legend_func(legend_root));\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\nfunction createLegend_choro(layer, field, title, subtitle) {\n var box_gap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var rect_fill_value = arguments[5];\n var rounding_precision = arguments[6];\n var no_data_txt = arguments[7];\n var note_bottom = arguments[8];\n\n var layer_prop = data_manager.current_layers[layer];\n var boxheight = 18,\n boxwidth = 18,\n xpos = 30,\n ypos = 30,\n y_pos2 = ypos + boxheight * 1.8,\n tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer);\n\n var boxgap = +box_gap;\n\n var last_pos = null,\n\n // nb_class,\n data_colors_label = void 0;\n\n if (layer_prop.renderer.indexOf('Categorical') > -1 || layer_prop.renderer.indexOf('PropSymbolsTypo') > -1) {\n data_colors_label = [];\n layer_prop.color_map.forEach(function (v) {\n data_colors_label.push({ value: v[1], color: v[0] });\n });\n // nb_class = layer_prop.color_map.size;\n } else if (layer_prop.renderer.indexOf('TypoSymbols') > -1) {\n data_colors_label = [];\n layer_prop.symbols_map.forEach(function (v) {\n data_colors_label.push({ value: v[2], image: v[0] });\n });\n // nb_class = layer_prop.symbols_map.size;\n } else {\n data_colors_label = layer_prop.colors_breaks.map(function (obj) {\n return { value: obj[0], color: obj[1] };\n });\n // nb_class = layer_prop.colors_breaks.length;\n if (rounding_precision === undefined) {\n var breaks = layer_prop.options_disc.breaks;\n rounding_precision = get_lgd_display_precision(breaks);\n }\n }\n\n var legend_root = map.insert('g').styles({ cursor: 'grab', 'font-size': '11px', 'font-family': 'verdana' }).attrs({\n id: 'legend_root',\n class: tmp_class_name,\n layer_field: field,\n transform: 'translate(0,0)',\n boxgap: boxgap,\n rounding_precision: rounding_precision,\n layer_name: layer\n });\n\n var rect_under_legend = legend_root.insert('rect');\n\n legend_root.insert('text').attrs(subtitle != '' ? { id: 'legendtitle', x: xpos + boxheight, y: ypos } : { id: 'legendtitle', x: xpos + boxheight, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).text(title || '');\n\n legend_root.insert('text').attrs({ id: 'legendsubtitle', x: xpos + boxheight, y: ypos + 15 }).styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).text(subtitle);\n\n var legend_elems = legend_root.selectAll('.legend').append('g').data(data_colors_label).enter().insert('g').attr('class', function (d, i) {\n return 'lg legend_' + i;\n });\n\n if (layer_prop.renderer.indexOf('TypoSymbols') === -1) {\n legend_elems.append('rect').attrs(function (d, i) {\n last_pos = y_pos2 + i * boxgap + i * boxheight;\n return {\n x: xpos + boxwidth,\n y: last_pos,\n width: boxwidth,\n height: boxheight\n };\n }).styles(function (d) {\n return { fill: d.color, stroke: d.color };\n });\n } else {\n legend_elems.append('image').attrs(function (d, i) {\n return {\n x: xpos + boxwidth,\n y: y_pos2 + i * boxgap + i * boxheight,\n width: boxwidth,\n height: boxheight,\n 'xlink:href': d.image\n };\n });\n }\n\n if (layer_prop.renderer.indexOf('Choropleth') > -1 || layer_prop.renderer.indexOf('PropSymbolsChoro') > -1 || layer_prop.renderer.indexOf('Gridded') > -1 || layer_prop.renderer.indexOf('Stewart') > -1) {\n var tmp_pos = void 0;\n legend_elems.append('text').attrs(function (d, i) {\n tmp_pos = y_pos2 + i * boxheight + i * boxgap;\n return { x: xpos + boxwidth * 2 + 10, y: tmp_pos };\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(+d.value.split(' - ')[1], rounding_precision).toLocaleString();\n });\n\n legend_root.insert('text').attrs({\n id: 'lgd_choro_min_val',\n x: xpos + boxwidth * 2 + 10,\n y: tmp_pos + boxheight + boxgap\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function () {\n return (0, _helpers_calc.round_value)(data_colors_label[data_colors_label.length - 1].value.split(' - ')[0], rounding_precision).toLocaleString();\n });\n } else {\n legend_elems.append('text').attr('x', xpos + boxwidth * 2 + 10).attr('y', function (d, i) {\n return y_pos2 + i * boxheight + i * boxgap + boxheight * 2 / 3;\n }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(function (d) {\n return d.value;\n });\n }\n if (layer_prop.options_disc && layer_prop.options_disc.no_data) {\n var gp_no_data = legend_root.append('g');\n gp_no_data.append('rect').attrs({\n x: xpos + boxheight,\n y: last_pos + 2 * boxheight,\n width: boxwidth,\n height: boxheight\n }).styles({\n fill: layer_prop.options_disc.no_data,\n stroke: layer_prop.options_disc.no_data\n });\n\n gp_no_data.append('text').attrs({ x: xpos + boxwidth * 2 + 10, y: last_pos + 2.7 * boxheight, id: 'no_data_txt' }).styles({ 'alignment-baseline': 'middle', 'font-size': '10px' }).text(no_data_txt != null ? no_data_txt : 'No data');\n\n last_pos += 2 * boxheight;\n }\n\n legend_root.append('g').insert('text').attrs({ id: 'legend_bottom_note', x: xpos + boxheight, y: last_pos + 2 * boxheight }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n }).text(note_bottom != null ? note_bottom : '');\n legend_root.call(drag_legend_func(legend_root));\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\nfunction createLegend_choro_horizontal(layer, field, title, subtitle) {\n var box_gap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var rect_fill_value = arguments[5];\n var rounding_precision = arguments[6];\n var no_data_txt = arguments[7];\n var note_bottom = arguments[8];\n\n var layer_prop = data_manager.current_layers[layer];\n var boxheight = 16,\n boxwidth = 42,\n xpos = 30,\n ypos = 30,\n y_pos2 = ypos + boxheight * 1.8,\n tmp_class_name = 'legend legend_feature lgdf_' + _app.layer_to_id.get(layer);\n\n var boxgap = +box_gap;\n\n var data_colors_label = layer_prop.colors_breaks.map(function (obj) {\n return { value: obj[0], color: obj[1] };\n }).reverse();\n // const nb_class = data_colors_label;\n\n if (rounding_precision === undefined) {\n rounding_precision = get_lgd_display_precision(layer_prop.options_disc.breaks);\n }\n\n var legend_root = map.insert('g').styles({ cursor: 'grab', 'font-size': '11px', 'font-family': 'verdana' }).attrs({\n id: 'legend_root_horiz',\n class: tmp_class_name,\n layer_field: field,\n transform: 'translate(0,0)',\n boxgap: boxgap,\n rounding_precision: rounding_precision,\n layer_name: layer\n });\n\n var rect_under_legend = legend_root.insert('rect');\n\n var lgd_title = legend_root.insert('text').styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-weight': 'bold'\n }).attrs({\n id: 'legendtitle',\n x: xpos + boxwidth,\n y: subtitle !== '' ? ypos : ypos + 15,\n 'text-anchor': 'middle'\n });\n // .text(title || '');\n\n var lgd_subtitle = legend_root.insert('text').styles({\n 'font-size': '12px',\n 'font-family': 'verdana',\n 'font-style': 'italic'\n }).attrs({\n id: 'legendsubtitle',\n x: xpos + boxwidth,\n y: ypos + 15,\n 'text-anchor': 'middle'\n });\n // .text(subtitle);\n\n var legend_elems = legend_root.selectAll('.legend').append('g').data(data_colors_label).enter().insert('g').attr('class', function (d, i) {\n return 'lg legend_' + i;\n });\n\n legend_elems.append('rect').attr('x', function (d, i) {\n return xpos + (boxgap + boxwidth) * i;\n }).attr('y', y_pos2).attrs({ width: boxwidth, height: boxheight }).styles(function (d) {\n return { fill: d.color, stroke: d.color };\n });\n\n legend_elems.append('text').attr('x', function (d, i) {\n return xpos + (boxgap + boxwidth) * i;\n }).attr('y', y_pos2 + boxheight + 20).attr('text-anchor', 'middle').styles({ 'font-size': '10px' }).text(function (d) {\n return (0, _helpers_calc.round_value)(+d.value.split(' - ')[0], rounding_precision).toLocaleString();\n });\n\n legend_root.insert('text').attrs({\n id: 'lgd_choro_min_val',\n x: xpos + (boxgap + boxwidth) * data_colors_label.length,\n y: y_pos2 + boxheight + 20,\n 'text-anchor': 'middle'\n }).styles({ 'font-size': '10px' }).text(function () {\n return (0, _helpers_calc.round_value)(data_colors_label[data_colors_label.length - 1].value.split(' - ')[1], rounding_precision).toLocaleString();\n });\n\n if (layer_prop.options_disc && layer_prop.options_disc.no_data) {\n var gp_no_data = legend_root.append('g');\n gp_no_data.append('rect').attrs({\n x: xpos + boxwidth + (boxgap + boxwidth) * data_colors_label.length,\n y: y_pos2,\n width: boxwidth,\n height: boxheight\n }).styles({\n fill: layer_prop.options_disc.no_data,\n stroke: layer_prop.options_disc.no_data\n });\n\n gp_no_data.append('text').attrs({\n x: xpos + boxwidth / 2 + (boxgap + boxwidth) * (data_colors_label.length + 1),\n y: y_pos2 + boxheight + 20,\n id: 'no_data_txt',\n 'text-anchor': 'middle'\n }).styles({ 'font-size': '10px' }).text(no_data_txt != null ? no_data_txt : 'No data');\n }\n\n var bottom_note = legend_root.append('g').insert('text').attrs({\n id: 'legend_bottom_note',\n x: xpos + boxwidth,\n y: y_pos2 + boxheight + 40,\n 'text-anchor': 'middle'\n }).styles({\n 'font-size': '11px',\n 'font-family': 'verdana'\n });\n\n // Center the title and the subtitle:\n var bb = get_bounding_rect(legend_root.node());\n var x_middle = bb.x + bb.width / 2;\n lgd_title.attr('x', x_middle).text(title || '');\n lgd_subtitle.attr('x', x_middle).text(subtitle);\n bottom_note.attr('x', x_middle).text(note_bottom != null ? note_bottom : '');\n legend_root.call(drag_legend_func(legend_root));\n make_underlying_rect(legend_root, rect_under_legend, rect_fill_value);\n make_legend_context_menu(legend_root, layer);\n return legend_root;\n}\n\nfunction display_box_value_symbol(layer_name) {\n var symbol_type = data_manager.current_layers[layer_name].symbol,\n field = data_manager.current_layers[layer_name].rendered_field,\n ref_symbols = document.getElementById(_app.layer_to_id.get(layer_name)).getElementsByTagName(symbol_type),\n type_param = symbol_type === 'circle' ? 'r' : 'width';\n var non_empty = Array.prototype.filter.call(ref_symbols, function (d) {\n if (d[type_param].baseVal.value != 0) return d[type_param].baseVal.value;\n });\n var val_max = (0, _helpers_math.Mabs)(+non_empty[0].__data__.properties[field]);\n\n var redraw_sample_legend = function () {\n var legend_node = svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''));\n var rendered_field = data_manager.current_layers[layer_name].rendered_field;\n var nested = legend_node.getAttribute('nested');\n var join_line = legend_node.getAttribute('join_line');\n var rounding_precision = legend_node.getAttribute('rounding_precision');\n var lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n return function (values) {\n if (values) {\n data_manager.current_layers[layer_name].size_legend_symbol = values.sort(function (a, b) {\n return b.value - a.value;\n });\n val1.property('value', values[0].value);\n val2.property('value', values[1].value);\n val3.property('value', values[2].value);\n val4.property('value', values[3].value);\n }\n sample_svg.selectAll('g').remove();\n createLegend_symbol(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, {}, rounding_precision, note, { parent: sample_svg });\n sample_svg.select('g').select('#under_rect').remove();\n sample_svg.select('#legend_root_symbol').on('.drag', null);\n };\n }();\n\n var prom = (0, _dialogs.make_confirm_dialog2)('legend_symbol_values_box', layer_name + ' - ' + _tr('app_page.legend_symbol_values_box.title')).then(function (confirmed) {\n data_manager.current_layers[layer_name].size_legend_symbol = confirmed ? data_manager.current_layers[layer_name].size_legend_symbol : original_values;\n return Promise.resolve(confirmed);\n });\n\n var box_body = d3.select('.legend_symbol_values_box').select('.modal-content').style('width', '400px').select('.modal-body');\n box_body.append('p').style('text-align', 'center').insert('h3');\n // .html(_tr(\"app_page.legend_symbol_values_box.subtitle\"));\n var sample_svg = box_body.append('div').attr('id', 'sample_svg').style('float', 'left').append('svg').attrs({ width: 200, height: 300, id: 'svg_sample_legend' });\n\n var values_to_use = [].concat(data_manager.current_layers[layer_name].size_legend_symbol.map(function (f) {\n return (0, _helpers.cloneObj)(f);\n }));\n\n var _data_manager$current = _slicedToArray(data_manager.current_layers[layer_name].size, 2),\n ref_value = _data_manager$current[0],\n ref_size = _data_manager$current[1];\n\n var propSize = new _helpers_calc.PropSizer(ref_value, ref_size, symbol_type);\n var input_zone = box_body.append('div').styles({\n float: 'right',\n top: '100px',\n right: '20px',\n position: 'relative'\n });\n var a = input_zone.append('p');\n var b = input_zone.append('p');\n var c = input_zone.append('p');\n var d = input_zone.append('p');\n var original_values = [].concat(values_to_use);\n var val1 = a.insert('input').style('width', '80px').attrs({ class: 'without_spinner', type: 'number', max: val_max }).property('value', values_to_use[0].value).on('change', function () {\n var val = +this.value;\n if (isNaN(val)) return;\n values_to_use[0] = { size: propSize.scale(val), value: val };\n val2.attr('max', val);\n redraw_sample_legend(values_to_use);\n });\n var val2 = b.insert('input').style('width', '80px').attrs({ class: 'without_spinner', type: 'number', max: values_to_use[0].value, min: values_to_use[2] }).property('value', values_to_use[1].value).on('change', function () {\n var val = +this.value;\n if (isNaN(val)) return;\n values_to_use[1] = { size: propSize.scale(val), value: val };\n val1.attr('min', val);\n val3.attr('max', val);\n redraw_sample_legend(values_to_use);\n });\n var val3 = c.insert('input').style('width', '80px').attrs({ class: 'without_spinner', type: 'number', max: values_to_use[1].value, min: values_to_use[3].value }).property('value', values_to_use[2].value).on('change', function () {\n var val = +this.value;\n if (isNaN(val)) return;\n values_to_use[2] = { size: propSize.scale(val), value: val };\n val2.attr('min', val);\n val4.attr('max', val);\n redraw_sample_legend(values_to_use);\n });\n var val4 = d.insert('input').style('width', '80px').attrs({ class: 'without_spinner', type: 'number', min: 0, max: values_to_use[2].value }).property('value', values_to_use[3].value).on('change', function () {\n var val = +this.value;\n if (isNaN(val)) return;\n values_to_use[3] = { size: propSize.scale(val), value: val };\n val3.attr('min', val);\n redraw_sample_legend(values_to_use);\n });\n box_body.append('div').styles({ clear: 'both', 'text-align': 'center' }).append('p').styles({ 'text-align': 'center' }).insert('span').attrs({ class: 'button_st3' }).html(_tr('app_page.legend_symbol_values_box.reset')).on('click', function () {\n data_manager.current_layers[layer_name].size_legend_symbol = undefined;\n redraw_sample_legend(original_values);\n });\n\n redraw_sample_legend();\n return prom;\n}\n\n// function createlegendEditBox_symbol(legend_id, layer_name) {\n// function bind_selections() {\n// box_class = [layer_id, '_legend_popup'].join('');\n// legend_node = svg_map.querySelector(['#', legend_id, '.lgdf_', layer_id].join(''));\n// title_content = legend_node.querySelector('#legendtitle');\n// subtitle_content = legend_node.querySelector('#legendsubtitle');\n// note_content = legend_node.querySelector('#legend_bottom_note');\n// ratio_waffle_txt = legend_node.querySelector('#ratio_txt');\n// legend_node_d3 = d3.select(legend_node);\n// legend_boxes = legend_node_d3.selectAll(['#', legend_id, ' .lg'].join('')).select('text');\n// }\n// const layer_id = _app.layer_to_id.get(layer_name);\n// const type_symbol = data_manager.current_layers[layer_name].symbol;\n// let box_class,\n// legend_node,\n// title_content,\n// subtitle_content,\n// note_content;\n// // let source_content;\n// let legend_node_d3,\n// // legend_boxes,\n// ratio_waffle_txt,\n// rect_fill_value = {},\n// original_rect_fill_value;\n//\n// bind_selections();\n// if (document.querySelector(`.${box_class}`)) document.querySelector(`.${box_class}`).remove();\n// const original_params = {\n// title_content: title_content.textContent,\n// y_title: title_content.y.baseVal.getItem(0).value,\n// subtitle_content: subtitle_content.textContent,\n// y_subtitle: subtitle_content.y.baseVal.getItem(0).value,\n// note_content: note_content.textContent,\n// ratio_waffle_txt: ratio_waffle_txt != null ? ratio_waffle_txt.textContent : null,\n// }; // , source_content: source_content.textContent ? source_content.textContent : \"\"\n//\n// if (legend_node.getAttribute('visible_rect') === 'true') {\n// rect_fill_value = {\n// color: legend_node.querySelector('#under_rect').style.fill,\n// opacity: legend_node.querySelector('#under_rect').style.fillOpacity,\n// };\n// original_rect_fill_value = cloneObj(rect_fill_value);\n// }\n//\n// make_confirm_dialog2(box_class, layer_name)\n// .then((confirmed) => {\n// if (!confirmed) {\n// title_content.textContent = original_params.title_content;\n// title_content.y.baseVal.getItem(0).value = original_params.y_title;\n// subtitle_content.textContent = original_params.subtitle_content;\n// subtitle_content.y.baseVal.getItem(0).value = original_params.y_subtitle;\n// note_content.textContent = original_params.note_content;\n// if (ratio_waffle_txt) {\n// ratio_waffle_txt.textContent = original_params.ratio_waffle_txt;\n// }\n// rect_fill_value = original_rect_fill_value;\n// }\n// make_underlying_rect(legend_node_d3,\n// legend_node_d3.select('#under_rect'),\n// rect_fill_value);\n// bind_selections();\n// });\n// const container = document.querySelectorAll(`.${box_class}`)[0];\n// const box_body = d3.select(container)\n// .select('.modal-dialog').style('width', '375px')\n// .select('.modal-body');\n// let current_nb_dec;\n//\n// box_body.append('p').style('text-align', 'center')\n// .insert('h3')\n// .html(_tr('app_page.legend_style_box.subtitle'));\n//\n// const a = box_body.append('p');\n// a.append('span')\n// .html(_tr('app_page.legend_style_box.lgd_title'));\n//\n// a.append('input')\n// .style('float', 'right')\n// .property('value', title_content.textContent)\n// .on('keyup', function () {\n// title_content.textContent = this.value;\n// });\n//\n// const b = box_body.append('p');\n// b.insert('span')\n// .html(_tr('app_page.legend_style_box.var_name'));\n// b.insert('input')\n// .style('float', 'right')\n// .property('value', subtitle_content.textContent)\n// .on('keyup', function () {\n// const empty = subtitle_content.textContent == '';\n// // Move up the title to its original position if the subtitle isn't empty :\n// if (empty && this.value != '') {\n// title_content.y.baseVal.getItem(0).value = title_content.y.baseVal.getItem(0).value - 15;\n// }\n// // Change the displayed content :\n// subtitle_content.textContent = this.value;\n// // Move down the title (if it wasn't already moved down), if the new subtitle is empty\n// if (!empty && subtitle_content.textContent == '') {\n// title_content.y.baseVal.getItem(0).value = title_content.y.baseVal.getItem(0).value + 15;\n// }\n// });\n//\n// const c = box_body.insert('p');\n// c.insert('span')\n// .html(_tr('app_page.legend_style_box.additionnal_notes'));\n// c.insert('input')\n// .styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' })\n// .property('value', note_content.textContent)\n// .on('keyup', function () {\n// note_content.textContent = this.value;\n// });\n//\n// if (ratio_waffle_txt) {\n// const d = box_body.insert('p');\n// d.insert('span')\n// .html(_tr('app_page.legend_style_box.ratio_waffle_txt'));\n// d.insert('input')\n// .styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' })\n// .property('value', ratio_waffle_txt.textContent)\n// .on('keyup', function () {\n// ratio_waffle_txt.textContent = this.value;\n// });\n// }\n//\n// const choice_break_value_section1 = box_body.insert('p')\n// .styles({ 'text-align': 'center', 'margin-top': '25px !important' });\n// choice_break_value_section1.append('span')\n// .attr('class', 'button_disc')\n// .styles({ cursor: 'pointer' })\n// .html(_tr('app_page.legend_style_box.choice_break_symbol'))\n// .on('click', () => {\n// container.modal.hide();\n// display_box_value_symbol(layer_name).then((confirmed) => {\n// container.modal.show();\n// if (confirmed) {\n// redraw_legends_symbols(svg_map.querySelector(\n// ['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join('')));\n// }\n// });\n// });\n//\n// const current_state_nested = legend_node.getAttribute('nested') === 'true';\n// const gap_section = box_body.insert('p');\n// gap_section.append('input')\n// .style('margin-left', '0px')\n// .attrs({ id: 'style_lgd', type: 'checkbox' })\n// .property('checked', current_state_nested)\n// .on('change', function () {\n// if (this.checked) {\n// join_line_section.style('display', null);\n// } else {\n// join_line_section.style('display', 'none');\n// }\n// legend_node = svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''));\n// const rendered_field = data_manager.current_layers[layer_name].rendered_field;\n// const nested = this.checked ? 'true' : 'false';\n// const join_line = join_line_section.select('input').property('checked') ? 'true' : 'false';\n// const rounding_precision = legend_node.getAttribute('rounding_precision');\n// const transform_param = legend_node.getAttribute('transform'),\n// lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n// lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n// note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n//\n// legend_node.remove();\n// createLegend_symbol(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, note);\n// bind_selections();\n// if (transform_param) {\n// svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join('')).setAttribute('transform', transform_param);\n// }\n// });\n// gap_section.append('label')\n// .attrs({ for: 'style_lgd', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.nested_symbols' })\n// .html(_tr('app_page.legend_style_box.nested_symbols'));\n//\n// const current_state_line = legend_node.getAttribute('join_line') === 'true';\n// const join_line_section = box_body.insert('p').style('display', current_state_nested && (type_symbol === 'circle') ? null : 'none');\n// join_line_section.append('input')\n// .style('margin-left', '0px')\n// .attrs({ id: 'style_lgd_join_line', type: 'checkbox' })\n// .property('checked', current_state_line)\n// .on('change', function () {\n// legend_node = svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''));\n// const rendered_field = data_manager.current_layers[layer_name].rendered_field;\n// const nested = legend_node.getAttribute('nested') === 'true' ? 'true' : 'false';\n// const join_line = this.checked ? 'true' : 'false';\n// const rounding_precision = legend_node.getAttribute('rounding_precision');\n// const transform_param = legend_node.getAttribute('transform'),\n// lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n// lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n// note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n//\n// legend_node.remove();\n// createLegend_symbol(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, note);\n// bind_selections();\n// if (transform_param) {\n// svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join('')).setAttribute('transform', transform_param);\n// }\n// });\n// join_line_section.append('label')\n// .attrs({ for: 'style_lgd_join_line', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.join_line' })\n// .html(_tr('app_page.legend_style_box.join_line'));\n//\n//\n// const rectangle_options1 = box_body.insert('p');\n// rectangle_options1.insert('input')\n// .style('margin-left', '0px')\n// .attrs({\n// type: 'checkbox',\n// id: 'rect_lgd_checkbox',\n// })\n// .property('checked', rect_fill_value.color === undefined ? null : true)\n// .on('change', function () {\n// if (this.checked) {\n// rectangle_options2.style('display', '');\n// const r = document.getElementById('choice_color_under_rect');\n// rect_fill_value = !!r\n// ? { color: r.value, opacity: 1 }\n// : { color: '#ffffff', opacity: 1 };\n// } else {\n// rectangle_options2.style('display', 'none');\n// rect_fill_value = {};\n// }\n// make_underlying_rect(legend_node_d3,\n// legend_node_d3.select('#under_rect'),\n// rect_fill_value);\n// });\n// rectangle_options1.append('label')\n// .attrs({ for: 'rect_lgd_checkbox', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.under_rectangle' })\n// .html(_tr('app_page.legend_style_box.under_rectangle'));\n//\n// let rectangle_options2 = rectangle_options1.insert('span')\n// .styles({ float: 'right', display: rect_fill_value.color === undefined ? 'none' : '' });\n// rectangle_options2.insert('input')\n// .attrs({\n// id: 'choice_color_under_rect',\n// type: 'color',\n// })\n// .property('value', rect_fill_value.color === undefined ? '#ffffff' : rgb2hex(rect_fill_value.color))\n// .on('change', function () {\n// rect_fill_value = { color: this.value, opacity: 1 };\n// make_underlying_rect(legend_node_d3, legend_node_d3.select('#under_rect'), rect_fill_value);\n// });\n// }\n\n// function createlegendEditBox_choro(legend_id, layer_name) {\n// function bind_selections() {\n// box_class = [layer_id, '_legend_popup'].join('');\n// legend_node = svg_map.querySelector(['#', legend_id, '.lgdf_', layer_id].join(''));\n// title_content = legend_node.querySelector('#legendtitle');\n// subtitle_content = legend_node.querySelector('#legendsubtitle');\n// note_content = legend_node.querySelector('#legend_bottom_note');\n// no_data_txt = legend_node.querySelector('#no_data_txt');\n// legend_node_d3 = d3.select(legend_node);\n// legend_boxes = legend_node_d3.selectAll(['#', legend_id, ' .lg'].join('')).select('text');\n// }\n// const layer_id = _app.layer_to_id.get(layer_name);\n//\n// let box_class,\n// legend_node,\n// title_content,\n// subtitle_content,\n// note_content,\n// source_content;\n// let legend_node_d3,\n// legend_boxes,\n// no_data_txt,\n// rect_fill_value = {},\n// original_rect_fill_value;\n//\n// bind_selections();\n// if (document.querySelector(`.${box_class}`)) document.querySelector(`.${box_class}`).remove();\n// const original_params = {\n// title_content: title_content.textContent,\n// y_title: title_content.y.baseVal.getItem(0).value,\n// subtitle_content: subtitle_content.textContent,\n// y_subtitle: subtitle_content.y.baseVal.getItem(0).value,\n// note_content: note_content.textContent,\n// no_data_txt: no_data_txt != null ? no_data_txt.textContent : null,\n// boxgap: +legend_node.getAttribute('boxgap'),\n// };\n//\n// if (legend_node.getAttribute('visible_rect') === 'true') {\n// rect_fill_value = {\n// color: legend_node.querySelector('#under_rect').style.fill,\n// opacity: legend_node.querySelector('#under_rect').style.fillOpacity,\n// };\n// original_rect_fill_value = cloneObj(rect_fill_value);\n// }\n//\n// make_confirm_dialog2(box_class, layer_name)\n// .then((confirmed) => {\n// if (!confirmed) {\n// title_content.textContent = original_params.title_content;\n// title_content.y.baseVal.getItem(0).value = original_params.y_title;\n// subtitle_content.textContent = original_params.subtitle_content;\n// subtitle_content.y.baseVal.getItem(0).value = original_params.y_subtitle;\n// note_content.textContent = original_params.note_content;\n// if (no_data_txt) {\n// no_data_txt.textContent = original_params.no_data_txt;\n// }\n// rect_fill_value = original_rect_fill_value;\n// }\n// make_underlying_rect(legend_node_d3,\n// legend_node_d3.select('#under_rect'),\n// rect_fill_value);\n// bind_selections();\n// });\n// const container = document.querySelectorAll(`.${box_class}`)[0];\n// const box_body = d3.select(container)\n// .select('.modal-dialog').style('width', '375px')\n// .select('.modal-body');\n// let current_nb_dec;\n//\n// box_body.append('p').style('text-align', 'center')\n// .insert('h3')\n// .html(_tr('app_page.legend_style_box.subtitle'));\n//\n// const a = box_body.append('p');\n// a.append('span')\n// .html(_tr('app_page.legend_style_box.lgd_title'));\n//\n// a.append('input')\n// .style('float', 'right')\n// .property('value', title_content.textContent)\n// .on('keyup', function () {\n// title_content.textContent = this.value;\n// });\n//\n// const b = box_body.append('p');\n// b.insert('span')\n// .html(_tr('app_page.legend_style_box.var_name'));\n// b.insert('input')\n// .style('float', 'right')\n// .property('value', subtitle_content.textContent)\n// .on('keyup', function () {\n// const empty = subtitle_content.textContent == '';\n// // Move up the title to its original position if the subtitle isn't empty :\n// if (empty && this.value != '') {\n// title_content.y.baseVal.getItem(0).value = title_content.y.baseVal.getItem(0).value - 15;\n// }\n// // Change the displayed content :\n// subtitle_content.textContent = this.value;\n// // Move down the title (if it wasn't already moved down), if the new subtitle is empty\n// if (!empty && subtitle_content.textContent == '') {\n// title_content.y.baseVal.getItem(0).value = title_content.y.baseVal.getItem(0).value + 15;\n// }\n// });\n//\n// const c = box_body.insert('p');\n// c.insert('span')\n// .html(_tr('app_page.legend_style_box.additionnal_notes'));\n// c.insert('input')\n// .styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' })\n// .property('value', note_content.textContent)\n// .on('keyup', function () {\n// note_content.textContent = this.value;\n// });\n//\n// if (no_data_txt) {\n// const d = box_body.insert('p');\n// d.insert('span')\n// .html(_tr('app_page.legend_style_box.no_data'));\n// d.insert('input')\n// .styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' })\n// .property('value', no_data_txt.textContent)\n// .on('keyup', function () {\n// no_data_txt.textContent = this.value;\n// });\n// }\n//\n// // Float precision for label in the legend\n// // (actually it's not really the float precision but an estimation based on\n// // the string representation of only two values but it will most likely do the job in many cases)\n// let max_nb_decimals = 0;\n// let max_nb_left = 0;\n//\n// const nb_dec = [],\n// nb_left = [];\n// legend_boxes.each((d) => {\n// nb_dec.push(get_nb_decimals(d.value));\n// nb_left.push(get_nb_left_separator(d.value));\n// });\n// max_nb_decimals = max_fast(nb_dec);\n// max_nb_left = min_fast(nb_left);\n//\n// max_nb_left = max_nb_left > 2 ? max_nb_left : 2;\n// if (max_nb_decimals > 0 || max_nb_left >= 2) {\n// if (legend_node.getAttribute('rounding_precision')) {\n// current_nb_dec = legend_node.getAttribute('rounding_precision');\n// } else {\n// const nbs = [],\n// nb_dec = [];\n// legend_boxes.each(function () { nbs.push(this.textContent); });\n// for (let i = 0; i < nbs.length; i++) {\n// nb_dec.push(get_nb_decimals(nbs[i]));\n// }\n// current_nb_dec = max_fast(nb_dec);\n// }\n// if (max_nb_decimals > +current_nb_dec && max_nb_decimals > 18) { max_nb_decimals = 18; }\n// const e = box_body.append('p');\n// e.append('span')\n// .html(_tr('app_page.legend_style_box.float_rounding'));\n//\n// e.append('input')\n// .attrs({\n// id: 'precision_range',\n// type: 'range',\n// min: -(+max_nb_left),\n// max: max_nb_decimals,\n// step: 1,\n// })\n// .styles({ float: 'right', width: '90px', 'vertical-align': 'middle', 'margin-left': '10px' })\n// .property('value', current_nb_dec)\n// .on('change', function () {\n// const nb_float = +this.value;\n// d3.select('#precision_change_txt').html(nb_float);\n// legend_node.setAttribute('rounding_precision', nb_float);\n// if (legend_id === 'legend_root' || legend_id === 'legend_root_horiz') {\n// for (let i = 0; i < legend_boxes._groups[0].length; i++) {\n// const values = legend_boxes._groups[0][i].__data__.value.split(' - ');\n// legend_boxes._groups[0][i].innerHTML = round_value(+values[1], nb_float).toLocaleString();\n// }\n// const min_val = +legend_boxes._groups[0][legend_boxes._groups[0].length - 1].__data__.value.split(' - ')[0];\n// legend_node.querySelector('#lgd_choro_min_val').innerHTML = round_value(min_val, nb_float).toLocaleString();\n// } else if (legend_id === 'legend_root_symbol') {\n// for (let i = 0; i < legend_boxes._groups[0].length; i++) {\n// const value = legend_boxes._groups[0][i].__data__.value;\n// legend_boxes._groups[0][i].innerHTML = round_value(+value, nb_float).toLocaleString();\n// }\n// } else if (legend_id === 'legend_root_lines_class') {\n// for (let i = 0; i < legend_boxes._groups[0].length; i++) {\n// const value = legend_boxes._groups[0][i].__data__.value[1];\n// legend_boxes._groups[0][i].innerHTML = round_value(+value, nb_float).toLocaleString();\n// }\n// const min_val = +legend_boxes._groups[0][legend_boxes._groups[0].length - 1].__data__.value[0];\n// legend_node.querySelector('#lgd_choro_min_val').innerHTML = round_value(min_val, nb_float).toLocaleString();\n// }\n// });\n// e.append('span')\n// .style('float', 'right')\n// .attr('id', 'precision_change_txt')\n// .html(`${current_nb_dec}`);\n// }\n//\n// const current_state = +legend_node.getAttribute('boxgap') === 0;\n// const gap_section = box_body.insert('p');\n// gap_section.append('input')\n// .style('margin-left', '0px')\n// .attrs({ type: 'checkbox', id: 'style_lgd' })\n// .property('checked', current_state)\n// .on('change', () => {\n// const rendered_field = data_manager.current_layers[layer_name].rendered_field2 ? data_manager.current_layers[layer_name].rendered_field2 : data_manager.current_layers[layer_name].rendered_field;\n// legend_node = svg_map.querySelector(`#${legend_id}.lgdf_${_app.layer_to_id.get(layer_name)}`);\n// const boxgap = +legend_node.getAttribute('boxgap') == 0 ? 4 : 0;\n// const rounding_precision = legend_node.getAttribute('rounding_precision');\n// const transform_param = legend_node.getAttribute('transform'),\n// lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n// lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n// note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n// let _no_data_txt = legend_node.querySelector('#no_data_txt');\n// _no_data_txt = _no_data_txt != null ? _no_data_txt.textContent : null;\n// legend_node.remove();\n// if (legend_id === 'legend_root') {\n// createLegend_choro(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n// } else if (legend_id === 'legend_root_horiz') {\n// createLegend_choro_horizontal(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n// }\n// bind_selections();\n// if (transform_param) {\n// svg_map.querySelector(`#${legend_id}.lgdf_${_app.layer_to_id.get(layer_name)}`).setAttribute('transform', transform_param);\n// }\n// });\n// gap_section.append('label')\n// .attrs({ for: 'style_lgd', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.gap_boxes' })\n// .html(_tr('app_page.legend_style_box.gap_boxes'));\n//\n// const rectangle_options1 = box_body.insert('p');\n// rectangle_options1.insert('input')\n// .style('margin-left', '0px')\n// .attrs({\n// type: 'checkbox',\n// id: 'rect_lgd_checkbox',\n// })\n// .property('checked', rect_fill_value.color === undefined ? null : true)\n// .on('change', function () {\n// if (this.checked) {\n// rectangle_options2.style('display', '');\n// const r = document.getElementById('choice_color_under_rect');\n// rect_fill_value = r ? { color: r.value, opacity: 1 } : { color: '#ffffff', opacity: 1 };\n// } else {\n// rectangle_options2.style('display', 'none');\n// rect_fill_value = {};\n// }\n// make_underlying_rect(legend_node_d3,\n// legend_node_d3.select('#under_rect'),\n// rect_fill_value);\n// });\n// rectangle_options1.append('label')\n// .attrs({ for: 'rect_lgd_checkbox', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.under_rectangle' })\n// .html(_tr('app_page.legend_style_box.under_rectangle'));\n//\n// let rectangle_options2 = rectangle_options1.insert('span')\n// .styles({ float: 'right', display: rect_fill_value.color === undefined ? 'none' : '' });\n// rectangle_options2.insert('input')\n// .attrs({ id: 'choice_color_under_rect', type: 'color' })\n// .property('value', rect_fill_value.color === undefined ? '#ffffff' : rgb2hex(rect_fill_value.color))\n// .on('change', function () {\n// rect_fill_value = { color: this.value, opacity: 1 };\n// make_underlying_rect(legend_node_d3, legend_node_d3.select('#under_rect'), rect_fill_value);\n// });\n//\n// if (legend_id === 'legend_root_horiz' || (legend_id === 'legend_root' && data_manager.current_layers[layer_name].options_disc)) {\n// const change_legend_type = box_body.insert('p');\n// const vert_layout = change_legend_type.append('p')\n// .attr('id', 'vert_layout')\n// .attr('class', legend_id === 'legend_root' ? 'opts_lgd_layout selected' : 'opts_lgd_layout')\n// .text(_tr('app_page.legend_style_box.lgd_layout_vertical'));\n// const horiz_layout = change_legend_type.append('p')\n// .attr('id', 'horiz_layout')\n// .attr('class', legend_id !== 'legend_root' ? 'opts_lgd_layout selected' : 'opts_lgd_layout')\n// .text(_tr('app_page.legend_style_box.lgd_layout_horizontal'));\n// change_legend_type.selectAll('.opts_lgd_layout')\n// .on('click', function () {\n// if (this.classList.contains('selected')) { return; }\n// change_legend_type.selectAll('.opts_lgd_layout').attr('class', 'opts_lgd_layout');\n// this.classList.add('selected');\n// const rendered_field = data_manager.current_layers[layer_name].rendered_field2 ? data_manager.current_layers[layer_name].rendered_field2 : data_manager.current_layers[layer_name].rendered_field;\n// legend_node = svg_map.querySelector(`#${legend_id}.lgdf_${_app.layer_to_id.get(layer_name)}`);\n// const boxgap = +legend_node.getAttribute('boxgap');\n// const rounding_precision = legend_node.getAttribute('rounding_precision');\n// const transform_param = legend_node.getAttribute('transform'),\n// lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n// lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n// note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n// let _no_data_txt = legend_node.querySelector('#no_data_txt');\n// _no_data_txt = _no_data_txt != null ? _no_data_txt.textContent : null;\n// legend_node.remove();\n//\n// if (this.id === 'horiz_layout') {\n// createLegend_choro_horizontal(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n// legend_id = 'legend_root_horiz';\n// } else {\n// createLegend_choro(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n// legend_id = 'legend_root';\n// }\n// bind_selections();\n// if (transform_param) {\n// svg_map.querySelector(`#${legend_id}.lgdf_${_app.layer_to_id.get(layer_name)}`).setAttribute('transform', transform_param);\n// }\n// });\n// }\n// }\n\n// Todo : find a better organization for the options in this box\n// (+ better alignement)\nfunction createlegendEditBox(legend_id, layer_name) {\n function bind_selections() {\n box_class = [layer_id, '_legend_popup'].join('');\n legend_node = svg_map.querySelector(['#', legend_id, '.lgdf_', layer_id].join(''));\n title_content = legend_node.querySelector('#legendtitle');\n subtitle_content = legend_node.querySelector('#legendsubtitle');\n note_content = legend_node.querySelector('#legend_bottom_note');\n no_data_txt = legend_node.querySelector('#no_data_txt');\n ratio_waffle_txt = legend_node.querySelector('#ratio_txt');\n legend_node_d3 = d3.select(legend_node);\n legend_boxes = legend_node_d3.selectAll(['#', legend_id, ' .lg'].join('')).select('text');\n }\n var layer_id = _app.layer_to_id.get(layer_name);\n var box_class = void 0,\n legend_node = void 0,\n title_content = void 0,\n subtitle_content = void 0,\n note_content = void 0;\n\n var legend_node_d3 = void 0,\n legend_boxes = void 0,\n no_data_txt = void 0,\n ratio_waffle_txt = void 0,\n rect_fill_value = {},\n original_rect_fill_value = void 0;\n\n bind_selections();\n if (document.querySelector('.' + box_class)) document.querySelector('.' + box_class).remove();\n var original_params = {\n title_content: title_content.textContent,\n y_title: title_content.y.baseVal.getItem(0).value,\n subtitle_content: subtitle_content.textContent,\n y_subtitle: subtitle_content.y.baseVal.getItem(0).value,\n note_content: note_content.textContent,\n no_data_txt: no_data_txt != null ? no_data_txt.textContent : null,\n ratio_waffle_txt: ratio_waffle_txt != null ? ratio_waffle_txt.textContent : null,\n boxgap: +legend_node.getAttribute('boxgap'),\n layout_text_value: legend_id === 'legend_root_layout' ? legend_node.querySelector('.lg.legend_0 > text').innerHTML : undefined\n }; // , source_content: source_content.textContent ? source_content.textContent : \"\"\n\n if (legend_node.getAttribute('visible_rect') === 'true') {\n rect_fill_value = {\n color: legend_node.querySelector('#under_rect').style.fill,\n opacity: legend_node.querySelector('#under_rect').style.fillOpacity\n };\n original_rect_fill_value = (0, _helpers.cloneObj)(rect_fill_value);\n }\n\n (0, _dialogs.make_confirm_dialog2)(box_class, layer_name).then(function (confirmed) {\n if (!confirmed) {\n title_content.textContent = original_params.title_content;\n title_content.y.baseVal.getItem(0).value = original_params.y_title;\n subtitle_content.textContent = original_params.subtitle_content;\n subtitle_content.y.baseVal.getItem(0).value = original_params.y_subtitle;\n note_content.textContent = original_params.note_content;\n if (no_data_txt) {\n no_data_txt.textContent = original_params.no_data_txt;\n } else if (ratio_waffle_txt) {\n ratio_waffle_txt.textContent = original_params.ratio_waffle_txt;\n }\n rect_fill_value = original_rect_fill_value;\n if (original_params.layout_text_value) {\n legend_node.querySelector('.lg.legend_0 > text').innerHTML = original_params.layout_text_value;\n }\n }\n make_underlying_rect(legend_node_d3, legend_node_d3.select('#under_rect'), rect_fill_value);\n bind_selections();\n });\n var container = document.querySelectorAll('.' + box_class)[0];\n var box_body = d3.select(container).select('.modal-dialog').style('width', '375px').select('.modal-body');\n var current_nb_dec = void 0;\n\n box_body.append('p').style('text-align', 'center').insert('h3').html(_tr('app_page.legend_style_box.subtitle'));\n\n var a = box_body.append('p');\n a.append('span').html(_tr('app_page.legend_style_box.lgd_title'));\n\n a.append('input').style('float', 'right').property('value', title_content.textContent).on('keyup', function () {\n title_content.textContent = this.value;\n });\n\n var b = box_body.append('p');\n b.insert('span').html(_tr('app_page.legend_style_box.var_name'));\n b.insert('input').style('float', 'right').property('value', subtitle_content.textContent).on('keyup', function () {\n var empty = subtitle_content.textContent == '';\n // Move up the title to its original position if the subtitle isn't empty :\n if (empty && this.value != '') {\n title_content.y.baseVal.getItem(0).value = title_content.y.baseVal.getItem(0).value - 15;\n }\n // Change the displayed content :\n subtitle_content.textContent = this.value;\n // Move down the title (if it wasn't already moved down), if the new subtitle is empty\n if (!empty && subtitle_content.textContent == '') {\n title_content.y.baseVal.getItem(0).value = title_content.y.baseVal.getItem(0).value + 15;\n }\n });\n\n var c = box_body.insert('p');\n c.insert('span').html(_tr('app_page.legend_style_box.additionnal_notes'));\n c.insert('input').styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' }).property('value', note_content.textContent).on('keyup', function () {\n note_content.textContent = this.value;\n });\n\n if (no_data_txt) {\n var d = box_body.insert('p');\n d.insert('span').html(_tr('app_page.legend_style_box.no_data'));\n d.insert('input').styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' }).property('value', no_data_txt.textContent).on('keyup', function () {\n no_data_txt.textContent = this.value;\n });\n } else if (ratio_waffle_txt) {\n var _d = box_body.insert('p');\n _d.insert('span').html(_tr('app_page.legend_style_box.ratio_waffle_txt'));\n _d.insert('input').styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' }).property('value', ratio_waffle_txt.textContent).on('keyup', function () {\n ratio_waffle_txt.textContent = this.value;\n });\n }\n\n if (legend_id === 'legend_root_symbol') {\n var choice_break_value_section1 = box_body.insert('p').styles({ 'text-align': 'center', 'margin-top': '25px !important' });\n choice_break_value_section1.append('span').attr('class', 'button_disc').styles({ cursor: 'pointer' }).html(_tr('app_page.legend_style_box.choice_break_symbol')).on('click', function () {\n container.modal.hide();\n display_box_value_symbol(layer_name).then(function (confirmed) {\n container.modal.show();\n if (confirmed) {\n (0, _map_ctrl.redraw_legends_symbols)(svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join('')));\n }\n });\n });\n }\n if (data_manager.current_layers[layer_name].renderer !== 'TwoStocksWaffle' && data_manager.current_layers[layer_name].renderer !== 'Categorical' && data_manager.current_layers[layer_name].renderer !== 'TypoSymbols' && !(data_manager.current_layers[layer_name].renderer === 'PropSymbolsTypo' && legend_id.indexOf('legend_root_symbol') < 0) && !data_manager.current_layers[layer_name].layout_legend_displayed) {\n // Float precision for label in the legend\n // (actually it's not really the float precision but an estimation based on\n // the string representation of only two values but it will most likely do the job in many cases)\n var max_nb_decimals = 0;\n var max_nb_left = 0;\n if (legend_id.indexOf('legend_root_symbol') === -1) {\n //&& legend_id.indexOf('links') === -1) {\n max_nb_decimals = get_max_nb_dec(layer_name);\n max_nb_left = get_max_nb_left_sep(layer_name);\n } else {\n var nb_dec = [],\n nb_left = [];\n legend_boxes.each(function (d) {\n nb_dec.push((0, _helpers_calc.get_nb_decimals)(d.value));\n nb_left.push((0, _helpers_calc.get_nb_left_separator)(d.value));\n });\n max_nb_decimals = (0, _helpers_calc.max_fast)(nb_dec);\n max_nb_left = (0, _helpers_calc.min_fast)(nb_left);\n }\n max_nb_left = max_nb_left > 2 ? max_nb_left : 2;\n if (max_nb_decimals > 0 || max_nb_left >= 2) {\n if (legend_node.getAttribute('rounding_precision')) {\n current_nb_dec = legend_node.getAttribute('rounding_precision');\n } else {\n var nbs = [],\n _nb_dec = [];\n legend_boxes.each(function () {\n nbs.push(this.textContent);\n });\n for (var i = 0; i < nbs.length; i++) {\n _nb_dec.push((0, _helpers_calc.get_nb_decimals)(nbs[i]));\n }\n current_nb_dec = (0, _helpers_calc.max_fast)(_nb_dec);\n }\n if (max_nb_decimals > +current_nb_dec && max_nb_decimals > 18) {\n max_nb_decimals = 18;\n }\n var e = box_body.append('p');\n e.append('span').html(_tr('app_page.legend_style_box.float_rounding'));\n\n e.append('input').attrs({\n id: 'precision_range',\n type: 'range',\n min: -+max_nb_left,\n max: max_nb_decimals,\n step: 1\n }).styles({\n float: 'right',\n width: '90px',\n 'vertical-align': 'middle',\n 'margin-left': '10px'\n }).property('value', current_nb_dec).on('change', function () {\n var nb_float = +this.value;\n d3.select('#precision_change_txt').html(nb_float);\n legend_node.setAttribute('rounding_precision', nb_float);\n if (legend_id === 'legend_root') {\n for (var _i = 0; _i < legend_boxes._groups[0].length; _i++) {\n var values = legend_boxes._groups[0][_i].__data__.value.split(' - ');\n legend_boxes._groups[0][_i].innerHTML = (0, _helpers_calc.round_value)(+values[1], nb_float).toLocaleString();\n }\n var min_val = +legend_boxes._groups[0][legend_boxes._groups[0].length - 1].__data__.value.split(' - ')[0];\n legend_node.querySelector('#lgd_choro_min_val').innerHTML = (0, _helpers_calc.round_value)(min_val, nb_float).toLocaleString();\n } else if (legend_id === 'legend_root_horiz') {\n for (var _i2 = 0; _i2 < legend_boxes._groups[0].length; _i2++) {\n var _values = legend_boxes._groups[0][_i2].__data__.value.split(' - ');\n legend_boxes._groups[0][_i2].innerHTML = (0, _helpers_calc.round_value)(+_values[0], nb_float).toLocaleString();\n }\n var _min_val = +legend_boxes._groups[0][legend_boxes._groups[0].length - 1].__data__.value.split(' - ')[1];\n legend_node.querySelector('#lgd_choro_min_val').innerHTML = (0, _helpers_calc.round_value)(_min_val, nb_float).toLocaleString();\n } else if (legend_id === 'legend_root_symbol') {\n for (var _i3 = 0; _i3 < legend_boxes._groups[0].length; _i3++) {\n var value = legend_boxes._groups[0][_i3].__data__.value;\n legend_boxes._groups[0][_i3].innerHTML = (0, _helpers_calc.round_value)(+value, nb_float).toLocaleString();\n }\n } else if (legend_id === 'legend_root_lines_class') {\n for (var _i4 = 0; _i4 < legend_boxes._groups[0].length; _i4++) {\n var _value = legend_boxes._groups[0][_i4].__data__.value[1];\n legend_boxes._groups[0][_i4].innerHTML = (0, _helpers_calc.round_value)(+_value, nb_float).toLocaleString();\n }\n var _min_val2 = +legend_boxes._groups[0][legend_boxes._groups[0].length - 1].__data__.value[0];\n legend_node.querySelector('#lgd_choro_min_val').innerHTML = (0, _helpers_calc.round_value)(_min_val2, nb_float).toLocaleString();\n }\n });\n e.append('span').style('float', 'right').attr('id', 'precision_change_txt').html('' + current_nb_dec);\n }\n }\n\n if (legend_id === 'legend_root' || legend_id === 'legend_root_horiz') {\n var current_state = +legend_node.getAttribute('boxgap') === 0;\n var gap_section = box_body.insert('p');\n gap_section.append('input').style('margin-left', '0px').attrs({ type: 'checkbox', id: 'style_lgd' }).property('checked', current_state).on('change', function () {\n var rendered_field = data_manager.current_layers[layer_name].rendered_field2 ? data_manager.current_layers[layer_name].rendered_field2 : data_manager.current_layers[layer_name].rendered_field;\n legend_node = svg_map.querySelector('#' + legend_id + '.lgdf_' + _app.layer_to_id.get(layer_name));\n var boxgap = +legend_node.getAttribute('boxgap') === 0 ? 4 : 0;\n var rounding_precision = legend_node.getAttribute('rounding_precision');\n var transform_param = legend_node.getAttribute('transform'),\n lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n var _no_data_txt = legend_node.querySelector('#no_data_txt');\n _no_data_txt = _no_data_txt != null ? _no_data_txt.textContent : null;\n legend_node.remove();\n if (legend_id === 'legend_root') {\n createLegend_choro(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n } else if (legend_id === 'legend_root_horiz') {\n createLegend_choro_horizontal(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n }\n bind_selections();\n if (transform_param) {\n svg_map.querySelector('#' + legend_id + '.lgdf_' + _app.layer_to_id.get(layer_name)).setAttribute('transform', transform_param);\n }\n });\n gap_section.append('label').attrs({ for: 'style_lgd', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.gap_boxes' }).html(_tr('app_page.legend_style_box.gap_boxes'));\n // document.getElementById('style_lgd').checked = current_state;\n } else if (legend_id === 'legend_root_symbol') {\n var type_symbol = data_manager.current_layers[layer_name].symbol;\n var current_state_nested = legend_node.getAttribute('nested') === 'true';\n var _gap_section = box_body.insert('p');\n _gap_section.append('input').style('margin-left', '0px').attrs({ id: 'style_lgd', type: 'checkbox' }).property('checked', current_state_nested).on('change', function () {\n join_line_section.style('display', this.checked && type_symbol === 'circle' ? null : 'none');\n legend_node = svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''));\n var rendered_field = data_manager.current_layers[layer_name].rendered_field;\n var nested = this.checked ? 'true' : 'false';\n var join_line = join_line_section.select('input').property('checked') ? 'true' : 'false';\n var rounding_precision = legend_node.getAttribute('rounding_precision');\n var transform_param = legend_node.getAttribute('transform'),\n lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n\n legend_node.remove();\n createLegend_symbol(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, note);\n bind_selections();\n if (transform_param) {\n svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join('')).setAttribute('transform', transform_param);\n }\n });\n _gap_section.append('label').attrs({ for: 'style_lgd', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.nested_symbols' }).html(_tr('app_page.legend_style_box.nested_symbols'));\n\n var current_state_line = legend_node.getAttribute('join_line') === 'true';\n var join_line_section = box_body.insert('p').style('display', current_state_nested && type_symbol === 'circle' ? null : 'none');\n join_line_section.append('input').style('margin-left', '0px').attrs({ id: 'style_lgd_join_line', type: 'checkbox' }).property('checked', current_state_line).on('change', function () {\n legend_node = svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join(''));\n var rendered_field = data_manager.current_layers[layer_name].rendered_field;\n var nested = legend_node.getAttribute('nested') === 'true' ? 'true' : 'false';\n var join_line = this.checked ? 'true' : 'false';\n var rounding_precision = legend_node.getAttribute('rounding_precision');\n var transform_param = legend_node.getAttribute('transform'),\n lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n\n legend_node.remove();\n createLegend_symbol(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, note);\n bind_selections();\n if (transform_param) {\n svg_map.querySelector(['#legend_root_symbol.lgdf_', _app.layer_to_id.get(layer_name)].join('')).setAttribute('transform', transform_param);\n }\n });\n join_line_section.append('label').attrs({ for: 'style_lgd_join_line', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.join_line' }).html(_tr('app_page.legend_style_box.join_line'));\n } else if (legend_id === 'legend_root_layout') {\n var text_value_section = box_body.insert('p');\n text_value_section.insert('span').html(_tr('app_page.legend_style_box.layout_legend_text_value'));\n text_value_section.insert('input').styles({ float: 'right', 'font-family': '12px Gill Sans Extrabold, sans-serif' }).property('value', legend_node.querySelector('.lg.legend_0 > text').innerHTML).on('keyup', function () {\n legend_node.querySelector('.lg.legend_0 > text').innerHTML = this.value;\n });\n }\n // Todo : Reactivate this functionnality :\n // box_body.insert(\"p\").html(\"Display features count \")\n // .insert(\"input\").attr(\"type\", \"checkbox\")\n // .on(\"change\", function(){\n // alert(\"to be done!\");\n // });\n\n var rectangle_options1 = box_body.insert('p');\n rectangle_options1.insert('input').style('margin-left', '0px').property('checked', rect_fill_value.color === undefined ? null : true).attrs({ type: 'checkbox', id: 'rect_lgd_checkbox' }).on('change', function () {\n if (this.checked) {\n rectangle_options2.style('display', '');\n var r = document.getElementById('choice_color_under_rect');\n rect_fill_value = r ? { color: r.value, opacity: 1 } : { color: '#ffffff', opacity: 1 };\n } else {\n rectangle_options2.style('display', 'none');\n rect_fill_value = {};\n }\n make_underlying_rect(legend_node_d3, legend_node_d3.select('#under_rect'), rect_fill_value);\n });\n rectangle_options1.append('label').attrs({ for: 'rect_lgd_checkbox', class: 'i18n', 'data-i18n': '[html]app_page.legend_style_box.under_rectangle' }).html(_tr('app_page.legend_style_box.under_rectangle'));\n\n var rectangle_options2 = rectangle_options1.insert('span').styles({ float: 'right', display: rect_fill_value.color === undefined ? 'none' : '' });\n rectangle_options2.insert('input').attrs({ id: 'choice_color_under_rect', type: 'color' }).property('value', rect_fill_value.color === undefined ? '#ffffff' : (0, _colors_helpers.rgb2hex)(rect_fill_value.color)).on('change', function () {\n rect_fill_value = { color: this.value, opacity: 1 };\n make_underlying_rect(legend_node_d3, legend_node_d3.select('#under_rect'), rect_fill_value);\n });\n\n if (legend_id === 'legend_root_horiz' || legend_id === 'legend_root' && data_manager.current_layers[layer_name].options_disc) {\n var change_legend_type = box_body.insert('p');\n // Vertical layout option:\n change_legend_type.append('p').attr('id', 'vert_layout').attr('class', legend_id === 'legend_root' ? 'opts_lgd_layout selected' : 'opts_lgd_layout').text(_tr('app_page.legend_style_box.lgd_layout_vertical'));\n // Horizontal layout option:\n change_legend_type.append('p').attr('id', 'horiz_layout').attr('class', legend_id !== 'legend_root' ? 'opts_lgd_layout selected' : 'opts_lgd_layout').text(_tr('app_page.legend_style_box.lgd_layout_horizontal'));\n\n change_legend_type.selectAll('.opts_lgd_layout').on('click', function () {\n if (this.classList.contains('selected')) {\n return;\n }\n change_legend_type.selectAll('.opts_lgd_layout').attr('class', 'opts_lgd_layout');\n this.classList.add('selected');\n var rendered_field = data_manager.current_layers[layer_name].rendered_field2 ? data_manager.current_layers[layer_name].rendered_field2 : data_manager.current_layers[layer_name].rendered_field;\n legend_node = svg_map.querySelector('#' + legend_id + '.lgdf_' + _app.layer_to_id.get(layer_name));\n var boxgap = +legend_node.getAttribute('boxgap');\n var rounding_precision = legend_node.getAttribute('rounding_precision');\n var transform_param = legend_node.getAttribute('transform'),\n lgd_title = legend_node.querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_node.querySelector('#legendsubtitle').innerHTML,\n note = legend_node.querySelector('#legend_bottom_note').innerHTML;\n var _no_data_txt = legend_node.querySelector('#no_data_txt');\n _no_data_txt = _no_data_txt != null ? _no_data_txt.textContent : null;\n legend_node.remove();\n\n if (this.id === 'horiz_layout') {\n createLegend_choro_horizontal(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n legend_id = 'legend_root_horiz';\n } else {\n createLegend_choro(layer_name, rendered_field, lgd_title, lgd_subtitle, boxgap, rect_fill_value, rounding_precision, _no_data_txt, note);\n legend_id = 'legend_root';\n }\n bind_selections();\n if (transform_param) {\n svg_map.querySelector('#' + legend_id + '.lgdf_' + _app.layer_to_id.get(layer_name)).setAttribute('transform', transform_param);\n }\n });\n }\n}\n\nfunction move_legends() {\n var xy0_map = get_map_xy0();\n var dim_width = w + xy0_map.x;\n var dim_height = h + xy0_map.y;\n\n // Move the legends and the scalebar according to svg map resizing:\n var legends = [svg_map.querySelectorAll('.legend_feature'), svg_map.querySelectorAll('#scale_bar.legend')];\n for (var j = 0; j < 2; ++j) {\n var legends_type = legends[j];\n for (var i = 0, i_len = legends_type.length; i < i_len; ++i) {\n var legend_bbox = legends_type[i].getBoundingClientRect();\n if (legend_bbox.left + legend_bbox.width > dim_width) {\n var current_transform = legends_type[i].getAttribute('transform');\n\n var _$exec$1$split = /\\(([^\\)]+)\\)/.exec(current_transform)[1].split(/[ ,]+/),\n _$exec$1$split2 = _slicedToArray(_$exec$1$split, 2),\n val_x = _$exec$1$split2[0],\n val_y = _$exec$1$split2[1];\n\n var trans_x = legend_bbox.left + legend_bbox.width - dim_width;\n legends_type[i].setAttribute('transform', ['translate(', [+val_x - trans_x, val_y], ')'].join(''));\n }\n if (legend_bbox.top + legend_bbox.height > dim_height) {\n var _current_transform = legends_type[i].getAttribute('transform');\n\n var _$exec$1$split3 = /\\(([^\\)]+)\\)/.exec(_current_transform)[1].split(/[ ,]+/),\n _$exec$1$split4 = _slicedToArray(_$exec$1$split3, 2),\n _val_x = _$exec$1$split4[0],\n _val_y = _$exec$1$split4[1];\n\n var trans_y = legend_bbox.top + legend_bbox.height - dim_height;\n legends_type[i].setAttribute('transform', ['translate(', [_val_x, +_val_y - trans_y], ')'].join(''));\n }\n }\n }\n\n // Move the text_annotation according to svg map resizing:\n var text_annot = document.querySelectorAll('.txt_annot');\n for (var _i5 = 0, len_i = text_annot.length; _i5 < len_i; _i5++) {\n var _legend_bbox = text_annot[_i5].getBoundingClientRect();\n if (_legend_bbox.left + _legend_bbox.width > dim_width) {\n var _trans_x = _legend_bbox.left + _legend_bbox.width - dim_width;\n var annot = d3.select(text_annot[_i5]);\n var x_rect = +annot.select('rect').attr('x') - _trans_x;\n var x_txt = +annot.select('text').attr('x') - _trans_x;\n if (x_txt > 0) {\n annot.select('rect').attr('x', x_rect);\n annot.select('text').attr('x', x_txt).selectAll('tspan').attr('x', x_txt);\n }\n }\n if (_legend_bbox.top + _legend_bbox.height > dim_height) {\n var _trans_y = _legend_bbox.top + _legend_bbox.height - dim_height;\n var _annot = d3.select(text_annot[_i5]);\n var y_rect = +_annot.select('rect').attr('y') - _trans_y;\n var y_txt = +_annot.select('text').attr('y') - _trans_y;\n if (y_txt > 0) {\n _annot.select('rect').attr('y', y_rect);\n _annot.select('text').attr('y', y_txt);\n }\n }\n }\n}\n\nvar get_max_nb_dec = function get_max_nb_dec(layer_name) {\n if (!data_manager.current_layers[layer_name] || !data_manager.current_layers[layer_name].colors_breaks) {\n return undefined;\n }\n var max = 0;\n data_manager.current_layers[layer_name].colors_breaks.forEach(function (el) {\n var tmp = el[0].split(' - ');\n var p1 = tmp[0].indexOf('.');\n var p2 = tmp[1].indexOf('.');\n if (p1 > -1) {\n if (tmp[0].length - 1 - p1 > max) {\n max = tmp[0].length - 1 - tmp[0].indexOf('.');\n }\n }\n if (p2 > -1) {\n if (tmp[1].length - 1 - p2 > max) {\n max = tmp[1].length - 1 - tmp[1].indexOf('.');\n }\n }\n });\n return max;\n};\n\n// function _get_max_nb_left_sep(values) {\n// return max_fast(values.map(d => (`${d}`).split('.')[0].length));\n// }\n\nvar get_max_nb_left_sep = function get_max_nb_left_sep(layer_name) {\n if (!data_manager.current_layers[layer_name] || !data_manager.current_layers[layer_name].colors_breaks) {\n return undefined;\n }\n var nb_left = [];\n data_manager.current_layers[layer_name].colors_breaks.forEach(function (el) {\n var tmp = el[0].split(' - ');\n var p1 = tmp[0].indexOf('.');\n var p2 = tmp[1].indexOf('.');\n nb_left.push(p1);\n nb_left.push(p2);\n });\n return (0, _helpers_calc.min_fast)(nb_left);\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/legend.js?");
-
-/***/ }),
-
-/***/ "./js/main.js":
-/*!********************!*\
- !*** ./js/main.js ***!
- \********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _i18next = __webpack_require__(/*! i18next */ \"./node_modules/i18next/dist/es/index.js\");\n\nvar _i18next2 = _interopRequireDefault(_i18next);\n\nvar _i18nextXhrBackend = __webpack_require__(/*! i18next-xhr-backend */ \"./node_modules/i18next-xhr-backend/index.js\");\n\nvar _i18nextXhrBackend2 = _interopRequireDefault(_i18nextXhrBackend);\n\nvar _locI18next = __webpack_require__(/*! loc-i18next */ \"./node_modules/loc-i18next/index.js\");\n\nvar _locI18next2 = _interopRequireDefault(_locI18next);\n\n__webpack_require__(/*! ./../css/style.css */ \"./css/style.css\");\n\n__webpack_require__(/*! ./../css/discretization.css */ \"./css/discretization.css\");\n\n__webpack_require__(/*! ./../node_modules/alertifyjs/build/css/alertify.min.css */ \"./node_modules/alertifyjs/build/css/alertify.min.css\");\n\n__webpack_require__(/*! ./../node_modules/alertifyjs/build/css/themes/semantic.min.css */ \"./node_modules/alertifyjs/build/css/themes/semantic.min.css\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _tooltips = __webpack_require__(/*! ./tooltips */ \"./js/tooltips.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nPromise.config({\n warnings: true,\n longStackTraces: true\n});\n\n// /*\n// * Memoization functions (naive LRU implementation)\n// *\n// */\n// global.Function.prototype.memoized = function (max_size = 25) {\n// this._memo = this._memo || { values: new Map(), stack: [], max_size: max_size };\n// const key = JSON.stringify(Array.prototype.slice.call(arguments));\n// let cache_value = this._memo.values.get(key);\n// if (cache_value !== undefined) {\n// return JSON.parse(cache_value);\n// }\n// cache_value = this.apply(this, arguments);\n// this._memo.values.set(key, JSON.stringify(cache_value));\n// this._memo.stack.push(key);\n// if (this._memo.stack.length >= this._memo.max_size) {\n// const old_key = this._memo.stack.shift();\n// this._memo.values.delete(old_key);\n// }\n// return cache_value;\n// };\n//\n// global.Function.prototype.memoize = function () {\n// const fn = this;\n// return function () {\n// return fn.memoized.apply(fn, arguments);\n// };\n// };\nglobal.i18next = _i18next2.default;\nglobal._tr = function () {\n return _i18next2.default.t.apply(_i18next2.default, arguments);\n};\nglobal.encodeId = function (layer_name) {\n return layer_name !== '' ? 'L_' + layer_name.replace(/[^a-zA-Z0-9_-]/g, function (match) {\n return '_' + match[0].charCodeAt(0).toString(16) + '_';\n }) : 'L_';\n};\n\nglobal._app = {\n current_functionnality: undefined,\n current_proj_name: 'NaturalEarth2',\n custom_palettes: new Map(),\n default_symbols: [],\n existing_lang: ['en', 'es', 'fr'],\n layer_to_id: new Map([['World', encodeId('World')], ['Graticule', encodeId('Graticule')]]),\n legendRedrawTimeout: null,\n id_to_layer: new Map([[encodeId('World'), 'World'], [encodeId('Graticule'), 'Graticule']]),\n targeted_layer_added: false,\n to_cancel: undefined,\n version: \"0.8.11\" // eslint-disable-line no-undef\n};\n\nglobal.w = (0, _helpers_math.Mround)(window.innerWidth - 361);\nglobal.h = window.innerHeight - 55;\nglobal.proj = d3.geoNaturalEarth2().scale(1).translate([0, 0]);\nglobal.path = d3.geoPath().projection(proj).pointRadius(4);\nglobal.t = proj.translate();\nglobal.s = proj.scale();\n\n/*\nA bunch of global variable, storing oftently reused informations :\n - data_manager.user_data[layer_name] : will be an Array of Objects containing data for each features of the targeted layer\n (+ the joined features if a join is done)\n - data_manager.result_data[layer_name] : the same but for any eventual result layers (like Stewart, gridded, etc.)\n - data_manager.joined_dataset : the joined dataset (read with d3.csv then pushed in the first slot of this array)\n - data_manager.field_join_map : an array containg mapping between index of geom layer and index of ext. dataset\n - data_manager.current_layers : the main object describing **all** the layers on the map (incunding detailed (ie. by features) styling properties if needed)\n*/\nglobal.data_manager = {\n current_layers: {},\n dataset_name: null,\n joined_dataset: [],\n field_join_map: [],\n result_data: {},\n user_data: {}\n};\n\nfunction parseQuery(search) {\n var args = search.substring(1).split('&');\n var argsParsed = {};\n var arg = void 0,\n kvp = void 0,\n key = void 0,\n value = void 0;\n for (var i = 0; i < args.length; i++) {\n arg = args[i];\n if (arg.indexOf('=') === -1) {\n argsParsed[decodeURIComponent(arg).trim()] = true;\n } else {\n kvp = arg.split('=');\n key = decodeURIComponent(kvp[0]).trim();\n value = decodeURIComponent(kvp[1]).trim();\n argsParsed[key] = decodeURIComponent(kvp[1]).trim();\n }\n }\n return argsParsed;\n}\n\nfunction loadI18next(lang) {\n return new Promise(function (resolve, reject) {\n _i18next2.default.use(_i18nextXhrBackend2.default).init({\n debug: true,\n lng: lang,\n fallbackLng: _app.existing_lang[0],\n backend: {\n loadPath: 'static/locales/{{lng}}/translation.json'\n }\n }, function (err, tr) {\n if (err) reject(err);\n resolve(tr);\n });\n });\n}\n\n(function () {\n var getEpsgProjection = function getEpsgProjection() {\n return (0, _helpers.xhrequest)('GET', 'static/json/epsg.json', undefined, false);\n };\n var getSampleLayers = function getSampleLayers() {\n return (0, _helpers.xhrequest)('GET', 'static/json/sample_layers.json', undefined, false);\n };\n var params = {};\n Object.assign(global, (0, _map_ctrl.makeSvgMap)());\n\n document.querySelector('noscript').remove();\n window.isIE = function () {\n return (/MSIE/i.test(navigator.userAgent) || /Trident\\/\\d./i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)\n );\n }();\n // window.isOldMS_Firefox = (() => (/Firefox/i.test(navigator.userAgent)\n // && (/Windows NT 6.0/i.test(navigator.userAgent)\n // || /Windows NT 6.1/i.test(navigator.userAgent))) ? true : false\n // )();\n if (window.location.search) {\n var parsed_querystring = parseQuery(window.location.search);\n params.reload = parsed_querystring.reload;\n if (typeof history.replaceState !== 'undefined') {\n // replaceState should avoid creating a new entry on the history\n var obj = { Page: window.location.search, Url: window.location.pathname };\n history.replaceState(obj, obj.Page, obj.Url);\n }\n }\n var lang = docCookies.getItem('user_lang') || window.navigator.language.split('-')[0];\n lang = _app.existing_lang.indexOf(lang) > -1 ? lang : 'en';\n\n Promise.all([loadI18next(lang), getEpsgProjection(), getSampleLayers()]).then(function (results) {\n var _results = _slicedToArray(results, 3),\n tr = _results[0],\n epsg_proj = _results[1],\n sample_layers = _results[2];\n\n global.localize = _locI18next2.default.init(_i18next2.default);\n _app.epsg_projections = JSON.parse(epsg_proj);\n _app.sample_layers = JSON.parse(sample_layers);\n\n (0, _interface.setUpInterface)(params.reload);\n localize('.i18n');\n (0, _tooltips.bindTooltips)();\n }).catch(function (e) {\n swal({\n title: _tr('app_page.common.error'),\n text: _tr('app_page.common.error_loading_page'),\n type: 'error',\n customClass: 'swal2_custom',\n allowOutsideClick: false,\n allowEscapeKey: false\n });\n });\n})();\n\n/**\n* Return the x and y position where the svg element is located\n* in the browser window.\n*\n* @return {Object} - An object with x and y properties.\n*/\nglobal.get_map_xy0 = function () {\n var bbox = svg_map.getBoundingClientRect();\n return { x: bbox.left, y: bbox.top };\n};\n\nglobal.get_bounding_rect = function (elem) {\n var _get_map_xy = get_map_xy0(),\n x = _get_map_xy.x,\n y = _get_map_xy.y;\n\n var bbox = elem.getBoundingClientRect();\n var a = {\n x: bbox.left - x,\n y: bbox.top - y,\n width: bbox.width ? bbox.width : bbox.right - bbox.left,\n height: bbox.height ? bbox.height : bbox.bottom - bbox.top\n };\n a.left = a.x;\n a.top = a.y;\n return a;\n};\n\nglobal.helper_esc_key_twbs_cb = function helper_esc_key_twbs_cb(_event, callback) {\n var evt = _event || window.event;\n var isEscape = 'key' in evt ? evt.key === 'Escape' || evt.key === 'Esc' : evt.keyCode === 27;\n if (isEscape) {\n evt.stopPropagation();\n if (callback) {\n callback();\n }\n }\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/main.js?");
-
-/***/ }),
-
-/***/ "./js/map_ctrl.js":
-/*!************************!*\
- !*** ./js/map_ctrl.js ***!
- \************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.canvas_rotation_value = exports.zoom = undefined;\nexports.makeSvgMap = makeSvgMap;\nexports.zoom_without_redraw = zoom_without_redraw;\nexports.reproj_symbol_layer = reproj_symbol_layer;\nexports.rotate_global = rotate_global;\nexports.redraw_legends_symbols = redraw_legends_symbols;\nexports.zoomClick = zoomClick;\nexports.handle_bg_color = handle_bg_color;\nexports.canvas_mod_size = canvas_mod_size;\n\nvar _alertifyjs = __webpack_require__(/*! alertifyjs */ \"./node_modules/alertifyjs/build/alertify.js\");\n\nvar _alertifyjs2 = _interopRequireDefault(_alertifyjs);\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _scalebar = __webpack_require__(/*! ./layout_features/scalebar */ \"./js/layout_features/scalebar.js\");\n\nvar _north_arrow = __webpack_require__(/*! ./layout_features/north_arrow */ \"./js/layout_features/north_arrow.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar zoom = exports.zoom = d3.zoom().on('zoom', zoom_without_redraw);\nvar canvas_rotation_value = exports.canvas_rotation_value = null;\n\nfunction makeSvgMap() {\n // The div containing the svg map:\n var map_div = d3.select('#map');\n map_div.selectAll('*').remove();\n\n // The 'map':\n // (so actually the `map` variable is a reference to the d3 selection\n // of the main `svg` element on which we are drawing)\n var map = map_div.styles({ width: w + 'px', height: h + 'px' }).append('svg').attrs({ id: 'svg_map', width: w, height: h }).styles({ position: 'absolute', 'background-color': 'rgba(255, 255, 255, 0)' }).on('contextmenu', function () {\n d3.event.preventDefault();\n }).call(zoom);\n\n var svg_map = map.node();\n var defs = map.append('defs');\n return {\n map_div: map_div, map: map, svg_map: svg_map, defs: defs\n };\n}\n\nfunction zoom_without_redraw() {\n var rot_val = canvas_rotation_value || '';\n var transform = void 0;\n var t_val = void 0;\n if (!d3.event || !d3.event.transform || !d3.event.sourceEvent) {\n transform = d3.zoomTransform(svg_map);\n t_val = transform.toString() + rot_val;\n map.selectAll('.layer').transition().duration(50).style('stroke-width', function () {\n var lyr_name = global._app.id_to_layer.get(this.id);\n return data_manager.current_layers[lyr_name].fixed_stroke ? this.style.strokeWidth : data_manager.current_layers[lyr_name]['stroke-width-const'] / transform.k + 'px';\n }).attr('transform', t_val);\n map.selectAll('.scalable-legend').transition().duration(50).attr('transform', t_val);\n } else {\n t_val = d3.event.transform.toString() + rot_val;\n map.selectAll('.layer').transition().duration(50).style('stroke-width', function () {\n var lyr_name = global._app.id_to_layer.get(this.id);\n return data_manager.current_layers[lyr_name].fixed_stroke ? this.style.strokeWidth : data_manager.current_layers[lyr_name]['stroke-width-const'] / d3.event.transform.k + 'px';\n }).attr('transform', t_val);\n map.selectAll('.scalable-legend').transition().duration(50).attr('transform', t_val);\n }\n\n if (_scalebar.scaleBar.displayed) {\n _scalebar.scaleBar.update();\n }\n\n if (_app.legendRedrawTimeout) {\n clearTimeout(_app.legendRedrawTimeout);\n }\n _app.legendRedrawTimeout = setTimeout(redraw_legends_symbols, 650);\n var zoom_params = svg_map.__zoom;\n var _k = proj.scale() * zoom_params.k;\n // let zoom_k_scale = proj.scale() * zoom_params.k;\n document.getElementById('input-center-x').value = (0, _helpers_calc.round_value)(zoom_params.x, 2);\n document.getElementById('input-center-y').value = (0, _helpers_calc.round_value)(zoom_params.y, 2);\n document.getElementById('input-scale-k').value = _k > 2 || _k < -2 ? (0, _helpers_calc.round_value)(_k, 2) : (0, _helpers_calc.round_value)(_k, Math.round((0, _helpers_calc.get_nb_decimals)(_k) / 2));\n // let a = document.getElementById('form_projection'),\n // disabled_val = (zoom_k_scale > 200) && (window._target_layer_file != undefined || data_manager.result_data.length > 1)? '' : 'disabled';\n // a.querySelector('option[value=\"ConicConformalSec\"]').disabled = disabled_val;\n // a.querySelector('option[value=\"ConicConformalTangent\"]').disabled = disabled_val;\n}\n\n/**\n* Function redrawing the prop symbol / img / labels / waffles when the projection\n* changes (also taking care of redrawing point layer with appropriate 'pointRadius')\n*\n* @return {void}\n*\n*/\nfunction reproj_symbol_layer() {\n /* eslint-disable no-loop-func */\n var layers = Object.keys(data_manager.current_layers);\n var n_layers = layers.length;\n var lyr_name = void 0;\n for (var ix = 0; ix < n_layers; ix++) {\n lyr_name = layers[ix];\n if (data_manager.current_layers[lyr_name].renderer && (data_manager.current_layers[lyr_name].renderer.indexOf('PropSymbol') > -1 || data_manager.current_layers[lyr_name].renderer.indexOf('TypoSymbols') > -1 || data_manager.current_layers[lyr_name].renderer.indexOf('Label') > -1)) {\n var symbol = data_manager.current_layers[lyr_name].symbol;\n\n if (symbol === 'text') {\n // Reproject the labels :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).attrs(function (d) {\n var pt = path.centroid(d.geometry);\n return { x: pt[0], y: pt[1] };\n });\n } else if (symbol === 'image') {\n // Reproject pictograms :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).attrs(function (d) {\n var coords = path.centroid(d.geometry),\n size = +this.getAttribute('width').replace('px', '') / 2;\n return { x: coords[0] - size, y: coords[1] - size };\n });\n } else if (symbol === 'circle') {\n // Reproject Prop Symbol :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).style('display', function (d) {\n return isNaN(+path.centroid(d)[0]) ? 'none' : undefined;\n }).attrs(function (d) {\n var centroid = path.centroid(d);\n return {\n r: d.properties.prop_value,\n cx: centroid[0],\n cy: centroid[1]\n };\n });\n } else if (symbol === 'rect') {\n // Reproject Prop Symbol :\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll(symbol).style('display', function (d) {\n return isNaN(+path.centroid(d)[0]) ? 'none' : undefined;\n }).attrs(function (d) {\n var centroid = path.centroid(d),\n size = d.properties.prop_value;\n return {\n height: size,\n width: size,\n x: centroid[0] - size / 2,\n y: centroid[1] - size / 2\n };\n });\n }\n } else if (data_manager.current_layers[lyr_name].pointRadius !== undefined) {\n map.select('#' + global._app.layer_to_id.get(lyr_name)).selectAll('path').attr('d', path.pointRadius(data_manager.current_layers[lyr_name].pointRadius));\n } else if (data_manager.current_layers[lyr_name].renderer === 'TwoStocksWaffle') {\n var selection = svg_map.querySelector('#' + global._app.layer_to_id.get(lyr_name)).querySelectorAll('g');\n var nbFt = selection.length;\n if (data_manager.current_layers[lyr_name].symbol === 'circle') {\n for (var i = 0; i < nbFt; i++) {\n var centroid = path.centroid({\n type: 'Point',\n coordinates: selection[i].__data__.properties.centroid\n });\n var symbols = selection[i].querySelectorAll('circle');\n for (var j = 0, nb_symbol = symbols.length; j < nb_symbol; j++) {\n symbols[j].setAttribute('cx', centroid[0]);\n symbols[j].setAttribute('cy', centroid[1]);\n }\n }\n } else {\n for (var _i = 0; _i < nbFt; _i++) {\n var _centroid = path.centroid({\n type: 'Point',\n coordinates: selection[_i].__data__.properties.centroid\n });\n var _symbols = selection[_i].querySelectorAll('rect');\n for (var _j = 0, _nb_symbol = _symbols.length; _j < _nb_symbol; _j++) {\n _symbols[_j].setAttribute('x', _centroid[0]);\n _symbols[_j].setAttribute('y', _centroid[1]);\n }\n }\n }\n }\n }\n /* eslint-enable no-loop-func */\n}\n\nfunction rotate_global(angle) {\n exports.canvas_rotation_value = canvas_rotation_value = ['rotate(', angle, ')'].join('');\n var zoom_transform = d3.zoomTransform(svg_map);\n\n map.selectAll('g.layer').transition().duration(10).attr('transform', canvas_rotation_value + ',translate(' + [zoom_transform.x, zoom_transform.y] + '),scale(' + zoom_transform.k + ')');\n\n if (_north_arrow.northArrow.displayed) {\n var current_rotate = !isNaN(+_north_arrow.northArrow.svg_node.attr('rotate')) ? +_north_arrow.northArrow.svg_node.attr('rotate') : 0;\n _north_arrow.northArrow.svg_node.attr('transform', 'rotate(' + (+angle + current_rotate) + ',' + _north_arrow.northArrow.x_center + ', ' + _north_arrow.northArrow.y_center + ')');\n }\n zoom_without_redraw();\n}\n\nfunction redraw_legends_symbols(targeted_node) {\n var legend_nodes = targeted_node ? [targeted_node] : document.querySelectorAll('#legend_root_symbol,#legend_root_layout');\n var hide = svg_map.__zoom.k > 5 || svg_map.__zoom.k < 0.15;\n var hidden_message = false;\n\n for (var i = 0; i < legend_nodes.length; ++i) {\n var layer_id = legend_nodes[i].classList[2].split('lgdf_')[1],\n layer_name = global._app.id_to_layer.get(layer_id),\n rendered_field = data_manager.current_layers[layer_name].rendered_field;\n var transform_param = legend_nodes[i].getAttribute('transform'),\n rounding_precision = legend_nodes[i].getAttribute('rounding_precision'),\n lgd_title = legend_nodes[i].querySelector('#legendtitle').innerHTML,\n lgd_subtitle = legend_nodes[i].querySelector('#legendsubtitle').innerHTML,\n notes = legend_nodes[i].querySelector('#legend_bottom_note').innerHTML;\n\n var rect_fill_value = legend_nodes[i].getAttribute('visible_rect') === 'true' ? {\n color: legend_nodes[i].querySelector('#under_rect').style.fill,\n opacity: legend_nodes[i].querySelector('#under_rect').style.fillOpacity\n } : undefined;\n\n var display_value = legend_nodes[i].getAttribute('display'),\n visible = legend_nodes[i].style.visibility;\n var type_lgd_layout = data_manager.current_layers[layer_name].type;\n var new_lgd = void 0;\n\n if (!rendered_field && type_lgd_layout === 'Point') {\n var text_value = legend_nodes[i].querySelector('g.lg.legend_0 > text').innerHTML;\n legend_nodes[i].remove();\n (0, _legend.createLegend_layout)(layer_name, type_lgd_layout, lgd_title, lgd_subtitle, rect_fill_value, text_value, notes);\n\n new_lgd = document.querySelector(['#legend_root_layout.lgdf_', layer_id].join(''));\n } else if (rendered_field && ['Carto_doug', 'OlsonCarto'].indexOf(data_manager.current_layers[layer_name].renderer) < 0) {\n var nested = legend_nodes[i].getAttribute('nested'),\n join_line = legend_nodes[i].getAttribute('join_line');\n\n legend_nodes[i].remove();\n (0, _legend.createLegend_symbol)(layer_name, rendered_field, lgd_title, lgd_subtitle, nested, join_line, rect_fill_value, rounding_precision, notes);\n new_lgd = document.querySelector(['#legend_root_symbol.lgdf_', layer_id].join(''));\n } else {\n continue;\n }\n new_lgd.style.visibility = visible;\n if (transform_param) {\n new_lgd.setAttribute('transform', transform_param);\n }\n if (display_value) {\n new_lgd.setAttribute('display', display_value);\n } else if (hide && rendered_field) {\n new_lgd.setAttribute('display', 'none');\n hidden_message = true;\n }\n }\n if (hidden_message) {\n _alertifyjs2.default.notify(_tr('app_page.notification.warning_deactivation_prop_symbol_legend'), 'warning', 5);\n }\n\n // if (!targeted_node) {\n var legend_nodes_links_discont = document.querySelectorAll('#legend_root_lines_class');\n for (var _i2 = 0; _i2 < legend_nodes_links_discont.length; ++_i2) {\n var _layer_id = legend_nodes_links_discont[_i2].classList[2].split('lgdf_')[1],\n _layer_name = global._app.id_to_layer.get(_layer_id),\n _rendered_field = data_manager.current_layers[_layer_name].rendered_field,\n _display_value = legend_nodes_links_discont[_i2].getAttribute('display'),\n _visible = legend_nodes_links_discont[_i2].style.visibility;\n\n var _transform_param = legend_nodes_links_discont[_i2].getAttribute('transform'),\n _rounding_precision = legend_nodes_links_discont[_i2].getAttribute('rounding_precision'),\n _lgd_title = legend_nodes_links_discont[_i2].querySelector('#legendtitle').innerHTML,\n _lgd_subtitle = legend_nodes_links_discont[_i2].querySelector('#legendsubtitle').innerHTML,\n _notes = legend_nodes_links_discont[_i2].querySelector('#legend_bottom_note').innerHTML;\n\n var _rect_fill_value = legend_nodes_links_discont[_i2].getAttribute('visible_rect') === 'true' ? {\n color: legend_nodes_links_discont[_i2].querySelector('#under_rect').style.fill,\n opacity: legend_nodes_links_discont[_i2].querySelector('#under_rect').style.fillOpacity\n } : undefined;\n\n legend_nodes_links_discont[_i2].remove();\n (0, _legend.createLegend_discont_links)(_layer_name, _rendered_field, _lgd_title, _lgd_subtitle, _rect_fill_value, _rounding_precision, _notes);\n var _new_lgd = document.querySelector(['#legend_root_lines_class.lgdf_', _layer_id].join(''));\n _new_lgd.style.visibility = _visible;\n if (_transform_param) {\n _new_lgd.setAttribute('transform', _transform_param);\n }\n if (_display_value) {\n _new_lgd.setAttribute('display', _display_value);\n }\n }\n}\n\nfunction interpolateZoom(translate, scale) {\n var transform = d3.zoomTransform(svg_map);\n return d3.transition().duration(225).tween('zoom', function () {\n var iTranslate = d3.interpolate([transform.x, transform.y], translate);\n var iScale = d3.interpolate(transform.k, scale);\n return function (t_value) {\n svg_map.__zoom.k = iScale(t_value);\n var _t = iTranslate(t_value);\n svg_map.__zoom.x = _t[0];\n svg_map.__zoom.y = _t[1];\n zoom_without_redraw();\n };\n });\n}\n\nfunction zoomClick() {\n if (map_div.select('#hand_button').classed('locked')) return;\n var direction = this.id === 'zoom_in' ? 1 : -1,\n factor = 0.1,\n center = [w / 2, h / 2],\n transform = d3.zoomTransform(svg_map),\n translate = [transform.x, transform.y],\n view = { x: translate[0], y: translate[1], k: transform.k };\n var target_zoom = 1,\n translate0 = [],\n l = [];\n d3.event.preventDefault();\n target_zoom = transform.k * (1 + factor * direction);\n translate0 = [(center[0] - view.x) / view.k, (center[1] - view.y) / view.k];\n view.k = target_zoom;\n l = [translate0[0] * view.k + view.x, translate0[1] * view.k + view.y];\n view.x += center[0] - l[0];\n view.y += center[1] - l[1];\n interpolateZoom([view.x, view.y], view.k);\n}\n\n// Change color of the background\n// (ie the parent \"svg\" element on the top of which group of elements have been added)\nfunction handle_bg_color(color) {\n map.style('background-color', color);\n}\n\n/** Function triggered by the change of map/canvas size\n* @param {Array} shape - An Array of two elements : [width, height] to use;\n* generally only used once at the time so `shape` values\n* are like [null, 750] or [800, null]\n* but also works with the 2 params together like [800, 750])\n*/\nfunction canvas_mod_size(shape) {\n if (shape[0]) {\n w = +shape[0];\n map.attr('width', w).call(zoom_without_redraw);\n map_div.style('width', w + 'px');\n if (w + 360 + 33 < window.innerWidth) {\n document.querySelector('.light-menu').style.right = '-33px';\n } else {\n document.querySelector('.light-menu').style.right = '0px';\n }\n }\n if (shape[1]) {\n h = +shape[1];\n map.attr('height', h).call(zoom_without_redraw);\n map_div.style('height', h + 'px');\n }\n (0, _legend.move_legends)();\n\n // Lets update the corresponding fields in the export section :\n var ratio = void 0;\n var format = document.getElementById('select_png_format').value;\n if (format === 'web') {\n ratio = 1;\n } else if (format === 'user_defined') {\n ratio = 118.11;\n } else {\n return;\n }\n // const zoom_params = svg_map.__zoom;\n document.getElementById('export_png_width').value = (0, _helpers_math.Mround)(w * ratio * 10) / 10;\n document.getElementById('export_png_height').value = (0, _helpers_math.Mround)(h * ratio * 10) / 10;\n document.getElementById('input-width').value = w;\n document.getElementById('input-height').value = h;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/map_ctrl.js?");
-
-/***/ }),
-
-/***/ "./js/map_export.js":
-/*!**************************!*\
- !*** ./js/map_export.js ***!
- \**************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.export_compo_svg = export_compo_svg;\nexports.export_compo_png = export_compo_png;\nexports.export_layer_geo = export_layer_geo;\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _fonts = __webpack_require__(/*! ./fonts */ \"./js/fonts.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nfunction patchSvgForFonts() {\n function getListUsedFonts() {\n var elems = [svg_map.getElementsByTagName('text'), svg_map.getElementsByTagName('p')];\n var needed_definitions = [];\n elems.map(function (d) {\n return d || [];\n });\n for (var j = 0; j < 2; j++) {\n var _loop = function _loop(i) {\n var font_elem = elems[j][i].style.fontFamily;\n _fonts.custom_fonts.forEach(function (font) {\n if (font_elem.indexOf(font) > -1 && needed_definitions.indexOf(font) === -1) {\n needed_definitions.push(font);\n }\n });\n };\n\n for (var i = 0; i < elems[j].length; i++) {\n _loop(i);\n }\n }\n return needed_definitions;\n }\n\n var needed_definitions = getListUsedFonts();\n if (needed_definitions.length === 0) {\n return;\n }\n var fonts_definitions = Array.prototype.filter.call(document.styleSheets, function (i) {\n return i.href && i.href.indexOf('style-fonts.css') > -1 ? i : null;\n })[0].cssRules;\n var fonts_to_add = needed_definitions.map(function (name) {\n return String(fonts_definitions[_fonts.custom_fonts.indexOf(name)].cssText);\n });\n var style_elem = document.createElement('style');\n style_elem.innerHTML = fonts_to_add.join(' ');\n svg_map.querySelector('defs').appendChild(style_elem);\n}\n\nfunction unpatchSvgForFonts() {\n var defs_style = svg_map.querySelector('defs').querySelector('style');\n if (defs_style) defs_style.remove();\n}\n\nfunction patchSvgForInkscape() {\n svg_map.setAttribute('xmlns:inkscape', 'http://www.inkscape.org/namespaces/inkscape');\n var elems = svg_map.getElementsByTagName('g');\n for (var i = elems.length - 1; i > -1; i--) {\n if (elems[i].id === '') {\n continue;\n } else if (elems[i].classList.contains('layer')) {\n elems[i].setAttribute('inkscape:label', elems[i].id);\n } else if (elems[i].id.indexOf('legend') > -1) {\n var layer_name = elems[i].className.baseVal.split('lgdf_')[1];\n elems[i].setAttribute('inkscape:label', 'legend_' + layer_name);\n } else {\n elems[i].setAttribute('inkscape:label', elems[i].id);\n }\n elems[i].setAttribute('inkscape:groupmode', 'layer');\n }\n}\n\nfunction unpatchSvgForInkscape() {\n svg_map.removeAttribute('xmlns:inkscape');\n var elems = svg_map.getElementsByTagName('g');\n for (var i = elems.length - 1; i > -1; i--) {\n if (elems[i].id !== '') {\n elems[i].removeAttribute('inkscape:label');\n elems[i].removeAttribute('inkscape:groupmode');\n }\n }\n}\n\nfunction patchSvgForForeignObj() {\n var elems = document.getElementsByTagName('foreignObject');\n var originals = [];\n for (var i = 0; i < elems.length; i++) {\n var el = elems[i];\n originals.push([el.getAttribute('width'), el.getAttribute('height')]);\n el.setAttribute('width', '100%');\n el.setAttribute('height', '100%');\n }\n return originals;\n}\n\nfunction unpatchSvgForForeignObj(originals) {\n var elems = document.getElementsByTagName('foreignObject');\n for (var i = 0; i < originals.length; i++) {\n var el = elems[i];\n el.setAttribute('width', originals[i][0]);\n el.setAttribute('height', originals[i][1]);\n }\n}\n\nfunction patchSvgBackground() {\n d3.select(svg_map).insert('g', 'defs').attr('id', 'G_bg').insert('rect').attrs({\n id: 'background',\n width: w,\n height: h,\n x: 0,\n y: 0\n }).style('fill', document.getElementById('bg_color').value);\n}\n\nfunction unpatchSvgBackground() {\n svg_map.querySelector('#G_bg').remove();\n}\n\nfunction check_output_name(name, extension) {\n var _name = name.toLowerCase().indexOf(extension) > -1 ? name.substring(0, name.lastIndexOf('.')) : name;\n var regexpName = new RegExp(/^[().a-z0-9_-]+$/i);\n if (regexpName.test(_name) && _name.length < 250) {\n return _name + '.' + extension;\n }\n return 'export.' + extension;\n}\n\n/*\n* Straight from http://stackoverflow.com/a/26047748/5050917\n*\n*/\nfunction changeResolution(canvas, scaleFactor) {\n // Set up CSS size if it's not set up already\n if (!canvas.style.width) canvas.style.width = canvas.width + 'px'; // eslint-disable-line no-param-reassign\n if (!canvas.style.height) canvas.style.height = canvas.height + 'px'; // eslint-disable-line no-param-reassign\n\n canvas.width = (0, _helpers_math.Mceil)(canvas.width * scaleFactor); // eslint-disable-line no-param-reassign\n canvas.height = (0, _helpers_math.Mceil)(canvas.height * scaleFactor); // eslint-disable-line no-param-reassign\n var ctx = canvas.getContext('2d');\n ctx.scale(scaleFactor, scaleFactor);\n}\n\nfunction export_compo_svg(output_name, clip_to_viewport) {\n var _finally = function _finally() {\n if (clip_to_viewport) {\n proj = proj.clipExtent(null);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n }\n };\n var zoom_params = svg_map.__zoom;\n var _output_name = check_output_name(output_name, 'svg');\n patchSvgForInkscape();\n patchSvgForFonts();\n patchSvgBackground();\n if (clip_to_viewport) {\n proj = proj.clipExtent([[0 - zoom_params.x / zoom_params.k, 0 - zoom_params.y / zoom_params.k], [(w - zoom_params.x) / zoom_params.k, (h - zoom_params.y) / zoom_params.k]]);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n }\n var dimensions_foreign_obj = patchSvgForForeignObj();\n var targetSvg = document.getElementById('svg_map'),\n serializer = new XMLSerializer();\n var source = serializer.serializeToString(targetSvg);\n\n if (!source.match(/^]+xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg\"/)) {\n source = source.replace(/^]+\"http:\\/\\/www\\.w3\\.org\\/1999\\/xlink\"/)) {\n source = source.replace(/^\\r\\n', source].join('');\n\n var url = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(source);\n (0, _helpers.clickLinkFromDataUrl)(url, _output_name).then(function () {\n unpatchSvgForFonts();\n unpatchSvgForForeignObj(dimensions_foreign_obj);\n unpatchSvgForInkscape();\n unpatchSvgBackground();\n _finally();\n }).catch(function (err) {\n (0, _helpers.display_error_during_computation)();\n console.log(err);\n _finally();\n });\n}\n\n// Maybe PNGs should be rendered on server side in order to avoid limitations that\n// could be encountered in the browser (as 'out of memory' error)\nfunction export_compo_png() {\n var scalefactor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var output_name = arguments[1];\n\n global._app.waitingOverlay.display();\n var _output_name = check_output_name(output_name, 'png');\n var dimensions_foreign_obj = patchSvgForForeignObj();\n patchSvgForFonts();\n var targetCanvas = d3.select('body').append('canvas').attrs({ id: 'canvas_map_export', height: h, width: w }).node();\n var targetSVG = document.querySelector('#svg_map');\n var mime_type = 'image/png';\n var svg_xml = void 0,\n ctx = void 0,\n img = void 0;\n\n // At this point it might be better to wrap the whole function in a try catch ?\n // (as it seems it could fail on various points :\n // XMLSerializer()).serializeToString, toDataURL, changeResolution, etc.)\n try {\n svg_xml = new XMLSerializer().serializeToString(targetSVG);\n ctx = targetCanvas.getContext('2d');\n img = new Image();\n } catch (err) {\n global._app.waitingOverlay.hide();\n targetCanvas.remove();\n (0, _helpers.display_error_during_computation)(String(err));\n return;\n }\n if (scalefactor !== 1) {\n try {\n changeResolution(targetCanvas, scalefactor);\n } catch (err) {\n global._app.waitingOverlay.hide();\n targetCanvas.remove();\n (0, _helpers.display_error_during_computation)(_tr('app_page.common.error_too_high_resolution') + ' ' + String(err));\n return;\n }\n }\n var imgUrl = void 0;\n img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg_xml);\n img.onload = function () {\n ctx.drawImage(img, 0, 0);\n try {\n imgUrl = targetCanvas.toDataURL(mime_type);\n } catch (err) {\n global._app.waitingOverlay.hide();\n targetCanvas.remove();\n (0, _helpers.display_error_during_computation)(String(err));\n return;\n }\n (0, _helpers.clickLinkFromDataUrl)(imgUrl, _output_name).then(function () {\n unpatchSvgForFonts();\n unpatchSvgForForeignObj(dimensions_foreign_obj);\n global._app.waitingOverlay.hide();\n targetCanvas.remove();\n }).catch(function (err) {\n (0, _helpers.display_error_during_computation)();\n console.log(err);\n });\n };\n}\n\nfunction export_layer_geo(layer, type, projec, proj4str) {\n var formToSend = new FormData();\n formToSend.append('layer', layer);\n formToSend.append('layer_name', data_manager.current_layers[layer].key_name);\n formToSend.append('format', type);\n if (projec === 'proj4string') {\n formToSend.append('projection', JSON.stringify({ proj4string: proj4str }));\n } else {\n formToSend.append('projection', JSON.stringify({ name: projec }));\n }\n var extensions = new Map([['GeoJSON', 'geojson'], ['TopoJSON', 'topojson'], ['ESRI Shapefile', 'zip'], ['GML', 'zip'], ['KML', 'kml']]);\n\n (0, _helpers.xhrequest)('POST', 'get_layer2', formToSend, true).then(function (data) {\n if (data.indexOf('{\"Error\"') === 0 || data.length === 0) {\n var error_message = void 0;\n if (data.indexOf('{\"Error\"') < 5) {\n error_message = _tr(JSON.parse(data).Error);\n } else {\n error_message = _tr('app_page.common.error_msg');\n }\n swal({\n title: 'Oops...',\n text: error_message,\n type: 'error',\n allowOutsideClick: false,\n allowEscapeKey: false\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n return;\n }\n var ext = extensions.get(type),\n filename = [layer, ext].join('.');\n var dataStr = void 0;\n if (ext.indexOf('json') > -1) {\n dataStr = 'data:text/json;charset=utf-8,' + encodeURIComponent(data);\n } else if (ext.indexOf('kml') > -1) {\n dataStr = 'data:text/xml;charset=utf-8,' + encodeURIComponent(data);\n } else {\n dataStr = 'data:application/zip;base64,' + data;\n }\n (0, _helpers.clickLinkFromDataUrl)(dataStr, filename);\n }, function (error) {\n console.log(error);\n });\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/map_export.js?");
-
-/***/ }),
-
-/***/ "./js/map_project.js":
-/*!***************************!*\
- !*** ./js/map_project.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(Promise, global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.beforeUnloadWindow = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.get_map_project = get_map_project;\nexports.save_map_project = save_map_project;\nexports.load_map_project = load_map_project;\nexports.apply_user_preferences = apply_user_preferences;\n\nvar _proj = __webpack_require__(/*! proj4 */ \"./node_modules/proj4/lib/index.js\");\n\nvar _proj2 = _interopRequireDefault(_proj);\n\nvar _topojson = __webpack_require__(/*! topojson */ \"./node_modules/topojson/index.js\");\n\nvar topojson = _interopRequireWildcard(_topojson);\n\nvar _contextMenu = __webpack_require__(/*! ./context-menu */ \"./js/context-menu.js\");\n\nvar _contextMenu2 = _interopRequireDefault(_contextMenu);\n\nvar _colors_helpers = __webpack_require__(/*! ./colors_helpers */ \"./js/colors_helpers.js\");\n\nvar _function = __webpack_require__(/*! ./function */ \"./js/function.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _layers_style_popup = __webpack_require__(/*! ./layers_style_popup */ \"./js/layers_style_popup.js\");\n\nvar _legend = __webpack_require__(/*! ./legend */ \"./js/legend.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _projections = __webpack_require__(/*! ./projections */ \"./js/projections.js\");\n\nvar _symbols_picto = __webpack_require__(/*! ./symbols_picto */ \"./js/symbols_picto.js\");\n\nvar _arrow2 = __webpack_require__(/*! ./layout_features/arrow */ \"./js/layout_features/arrow.js\");\n\nvar _arrow3 = _interopRequireDefault(_arrow2);\n\nvar _ellipse = __webpack_require__(/*! ./layout_features/ellipse */ \"./js/layout_features/ellipse.js\");\n\nvar _ellipse2 = _interopRequireDefault(_ellipse);\n\nvar _helpers2 = __webpack_require__(/*! ./layout_features/helpers */ \"./js/layout_features/helpers.js\");\n\nvar _north_arrow = __webpack_require__(/*! ./layout_features/north_arrow */ \"./js/layout_features/north_arrow.js\");\n\nvar _rectangle = __webpack_require__(/*! ./layout_features/rectangle */ \"./js/layout_features/rectangle.js\");\n\nvar _rectangle2 = _interopRequireDefault(_rectangle);\n\nvar _scalebar = __webpack_require__(/*! ./layout_features/scalebar */ \"./js/layout_features/scalebar.js\");\n\nvar _text_annotation = __webpack_require__(/*! ./layout_features/text_annotation */ \"./js/layout_features/text_annotation.js\");\n\nvar _text_annotation2 = _interopRequireDefault(_text_annotation);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar serialize_layer_to_topojson = function serialize_layer_to_topojson(layer_name) {\n var layer = svg_map.querySelector('#' + _app.layer_to_id.get(layer_name)).querySelectorAll('path');\n var n_features = layer.length;\n var result_features = [];\n for (var i = 0; i < n_features; i++) {\n result_features.push(layer[i].__data__);\n }\n var to_convert = {};\n to_convert[layer_name] = { type: 'FeatureCollection', features: result_features };\n return Promise.resolve(JSON.stringify(topojson.topology(to_convert)));\n};\n\n/* eslint-disable no-loop-func */\nfunction get_map_project() {\n var getPropSymbolCurrentPos = function getPropSymbolCurrentPos(selection, type_symbol) {\n var result = [];\n var nbFt = selection.length;\n if (type_symbol === 'circle') {\n for (var i = 0; i < nbFt; i++) {\n result.push({\n cx: selection[i].getAttribute('cx'),\n cy: selection[i].getAttribute('cy')\n });\n }\n } else {\n for (var _i = 0; _i < nbFt; _i++) {\n result.push({\n x: selection[_i].getAttribute('x'),\n y: selection[_i].getAttribute('y')\n });\n }\n }\n return result;\n };\n var getWaffleCurrentPos = function getWaffleCurrentPos(selection) {\n var result = [];\n var nbFt = selection.length;\n for (var i = 0; i < nbFt; i++) {\n result.push(selection[i].getAttribute('transform'));\n }\n return result;\n };\n var get_legend_info = function get_legend_info(lgd_node) {\n var type_lgd = lgd_node.id;\n var rect_fill_value = lgd_node.getAttribute('visible_rect') === 'true' ? { color: lgd_node.querySelector('#under_rect').style.fill,\n opacity: lgd_node.querySelector('#under_rect').style.fillOpacity } : undefined;\n var result = {\n type: type_lgd,\n display: lgd_node.getAttribute('display'),\n transform: lgd_node.getAttribute('transform'),\n field: lgd_node.getAttribute('layer_field'),\n rounding_precision: lgd_node.getAttribute('rounding_precision'),\n rect_fill_value: rect_fill_value,\n title: lgd_node.querySelector('#legendtitle').innerHTML,\n subtitle: lgd_node.querySelector('#legendsubtitle').innerHTML,\n bottom_note: lgd_node.querySelector('#legend_bottom_note').innerHTML\n };\n if (type_lgd === 'legend_root' || type_lgd === 'legend_root_horiz') {\n result.boxgap = lgd_node.getAttribute('boxgap');\n var no_data = lgd_node.querySelector('#no_data_txt');\n if (no_data) result.no_data_txt = no_data.innerHTML;\n } else if (type_lgd === 'legend_root_symbol') {\n result.nested_symbols = lgd_node.getAttribute('nested');\n result.join_line = lgd_node.getAttribute('join_line');\n } else if (type_lgd === 'legend_root_waffle') {\n var lyr_name = lgd_node.getAttribute('layer_name');\n result.field = data_manager.current_layers[lyr_name].rendered_field;\n result.ratio_txt = lgd_node.querySelector('#ratio_txt').innerHTML;\n } else if (type_lgd === 'legend_root_layout') {\n var _lyr_name = lgd_node.getAttribute('layer_name');\n result.text_value = lgd_node.querySelector('g.legend_0 > text').innerHTML;\n result.type_geom = data_manager.current_layers[_lyr_name].type;\n }\n return result;\n };\n\n var map_config = {},\n layers_style = [],\n layers = map.selectAll('g.layer'),\n map_title = document.getElementById('map_title'),\n layout_features = document.querySelectorAll('.legend:not(.title):not(.legend_feature)'),\n zoom_transform = d3.zoomTransform(svg_map);\n\n map_config.projection = _app.current_proj_name;\n if (_app.current_proj_name === 'def_proj4') {\n map_config.custom_projection = _app.last_projection;\n }\n map_config.projection_scale = proj.scale();\n map_config.projection_translate = proj.translate();\n map_config.projection_center = proj.center();\n map_config.projection_rotation = proj.rotate !== undefined ? proj.rotate() : undefined;\n map_config.projection_parallels = proj.parallels !== undefined ? proj.parallels() : undefined;\n map_config.projection_parallel = proj.parallel !== undefined ? proj.parallel() : undefined;\n map_config.zoom_translate = [zoom_transform.x, zoom_transform.y];\n map_config.zoom_scale = zoom_transform.k;\n map_config.div_width = +w;\n map_config.div_height = +h;\n map_config.n_layers = layers._groups[0].length;\n map_config.background_color = map.style('background-color');\n map_config.canvas_rotation = typeof _map_ctrl.canvas_rotation_value === 'string' ? _map_ctrl.canvas_rotation_value.match(/\\d+/) : undefined;\n map_config.custom_palettes = Array.from(_app.custom_palettes.entries());\n\n if (map_title) {\n map_config.title = {\n content: map_title.textContent,\n x: map_title.getElementsByTagName('text')[0].getAttribute('x'),\n y: map_title.getElementsByTagName('text')[0].getAttribute('y'),\n style: map_title.getElementsByTagName('text')[0].getAttribute('style')\n };\n }\n\n // Save the provided dataset if it wasn't joined to the geo layer :\n if (data_manager.joined_dataset.length > 0 && data_manager.field_join_map.length === 0) {\n map_config.joined_dataset = data_manager.joined_dataset[0];\n map_config.dataset_name = data_manager.dataset_name;\n }\n\n map_config.global_order = Array.from(svg_map.querySelectorAll('.legend,.layer')).map(function (ft) {\n return ['#', ft.id, '.', ft.className.baseVal.split(' ').join('.')].join('');\n });\n\n map_config.layout_features = {};\n if (layout_features) {\n for (var i = 0; i < layout_features.length; i++) {\n var ft = layout_features[i];\n if (ft.id === 'scale_bar') {\n map_config.layout_features.scale_bar = {\n bar_size: _scalebar.scaleBar.bar_size,\n displayed: _scalebar.scaleBar.displayed,\n dist: _scalebar.scaleBar.dist,\n dist_txt: _scalebar.scaleBar.dist_txt,\n fixed_size: _scalebar.scaleBar.fixed_size,\n precision: _scalebar.scaleBar.precision,\n unit: _scalebar.scaleBar.unit,\n x: _scalebar.scaleBar.x,\n y: _scalebar.scaleBar.y,\n transform: _scalebar.scaleBar.Scale._groups[0][0].getAttribute('transform') || ''\n };\n } else if (ft.id === 'north_arrow') {\n var n_arr = _north_arrow.northArrow.arrow_img._groups[0][0];\n map_config.layout_features.north_arrow = {\n arrow_img: ft.getAttribute('href'),\n displayed: _north_arrow.northArrow.displayed,\n x_img: n_arr.getAttribute('x'),\n y_img: n_arr.getAttribute('y'),\n x_center: _north_arrow.northArrow.x_center,\n y_center: _north_arrow.northArrow.y_center,\n size: n_arr.getAttribute('width')\n };\n } else if (ft.classList.contains('user_ellipse')) {\n if (!map_config.layout_features.user_ellipse) map_config.layout_features.user_ellipse = [];\n var ellps = ft.childNodes[0];\n map_config.layout_features.user_ellipse.push({\n rx: ellps.getAttribute('rx'),\n ry: ellps.getAttribute('ry'),\n cx: ellps.getAttribute('cx'),\n cy: ellps.getAttribute('cy'),\n stroke: ellps.style.stroke,\n stroke_width: ellps.style.strokeWidth,\n id: ft.id\n });\n } else if (ft.classList.contains('user_rectangle')) {\n if (!map_config.layout_features.user_rectangle) {\n map_config.layout_features.user_rectangle = [];\n }\n var rect = ft.childNodes[0];\n map_config.layout_features.user_rectangle.push({\n x: rect.getAttribute('x'),\n y: rect.getAttribute('y'),\n rx: rect.getAttribute('rx'),\n ry: rect.getAttribute('ry'),\n width: rect.getAttribute('width'),\n height: rect.getAttribute('height'),\n style: rect.getAttribute('style'),\n id: ft.id\n });\n } else if (ft.classList.contains('arrow')) {\n if (!map_config.layout_features.arrow) map_config.layout_features.arrow = [];\n var line = ft.childNodes[0];\n map_config.layout_features.arrow.push({\n stroke_width: line.style.strokeWidth,\n stroke: line.style.stroke,\n pt1: [line.x1.baseVal.value, line.y1.baseVal.value],\n pt2: [line.x2.baseVal.value, line.y2.baseVal.value],\n id: ft.id,\n marker_head: line.getAttribute('marker-end')\n });\n } else if (ft.classList.contains('txt_annot')) {\n if (!map_config.layout_features.text_annot) map_config.layout_features.text_annot = [];\n var text = ft.querySelector('text');\n map_config.layout_features.text_annot.push({\n id: ft.id,\n content: Array.prototype.map.call(text.querySelectorAll('tspan'), function (el) {\n return el.innerHTML;\n }).join('\\n'),\n style: text.getAttribute('style'),\n position_x: text.getAttribute('x'),\n position_y: text.getAttribute('y'),\n transform: text.getAttribute('transform')\n });\n } else if (ft.classList.contains('single_symbol')) {\n if (!map_config.layout_features.single_symbol) {\n map_config.layout_features.single_symbol = [];\n }\n var img = ft.childNodes[0];\n map_config.layout_features.single_symbol.push({\n id: ft.id,\n x: img.getAttribute('x'),\n y: img.getAttribute('y'),\n width: img.getAttribute('width'),\n height: img.getAttribute('height'),\n href: img.getAttribute('href'),\n scalable: ft.classList.contains('scalable-legend')\n });\n }\n }\n }\n for (var _i2 = map_config.n_layers - 1; _i2 > -1; --_i2) {\n layers_style[_i2] = {};\n var layer_style_i = layers_style[_i2],\n layer_id = layers._groups[0][_i2].id,\n layer_name = _app.id_to_layer.get(layer_id),\n current_layer_prop = data_manager.current_layers[layer_name],\n layer_type = (current_layer_prop.sphere ? 'sphere' : false) || (current_layer_prop.graticule ? 'graticule' : 'layer'),\n nb_ft = current_layer_prop.n_features;\n var selection = void 0;\n\n layer_style_i.layer_name = layer_name;\n layer_style_i.layer_type = layer_type;\n layer_style_i.n_features = nb_ft;\n layer_style_i.visible = layers._groups[0][_i2].style.visibility !== 'hidden' ? '' : 'hidden';\n layer_style_i.layout_legend_displayed = current_layer_prop.layout_legend_displayed;\n\n var lgd = document.getElementsByClassName('lgdf_' + layer_id);\n if (lgd.length === 0) {\n layer_style_i.legend = undefined;\n } else if (lgd.length === 1) {\n layer_style_i.legend = [get_legend_info(lgd[0])];\n } else if (lgd.length === 2) {\n layer_style_i.legend = lgd[0].id === 'legend_root' ? [get_legend_info(lgd[0]), get_legend_info(lgd[1])] : [get_legend_info(lgd[1]), get_legend_info(lgd[0])];\n }\n\n if (map.select('#' + layer_id).attr('filter')) {\n layer_style_i.filter_shadow = true;\n }\n\n if (current_layer_prop['stroke-width-const']) {\n layer_style_i['stroke-width-const'] = current_layer_prop['stroke-width-const'];\n }\n if (current_layer_prop.pointRadius !== undefined) {\n layer_style_i.pointRadius = current_layer_prop.pointRadius;\n }\n if (current_layer_prop.fixed_stroke !== undefined) {\n layer_style_i.fixed_stroke = current_layer_prop.fixed_stroke;\n }\n if (current_layer_prop.colors_breaks) {\n layer_style_i.colors_breaks = current_layer_prop.colors_breaks;\n }\n if (current_layer_prop.options_disc !== undefined) {\n layer_style_i.options_disc = current_layer_prop.options_disc;\n }\n if (current_layer_prop.targeted) {\n selection = map.select('#' + layer_id).selectAll('path');\n layer_style_i.fill_opacity = selection.style('fill-opacity');\n layer_style_i.targeted = true;\n layer_style_i.topo_geom = true;\n // layer_style_i.topo_geom = JSON.stringify(_target_layer_file);\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.fields_type = current_layer_prop.fields_type;\n layer_style_i.stroke_color = selection.style('stroke');\n } else if (layer_type === 'sphere' || layer_type === 'graticule' || layer_name === 'World') {\n selection = map.select('#' + layer_id).selectAll('path');\n layer_style_i.fill_color = (0, _colors_helpers.rgb2hex)(selection.style('fill'));\n layer_style_i.stroke_color = (0, _colors_helpers.rgb2hex)(selection.style('stroke'));\n if (layer_type === 'graticule') {\n layer_style_i.stroke_dasharray = data_manager.current_layers.Graticule.dasharray;\n layer_style_i.step = data_manager.current_layers.Graticule.step;\n layer_style_i.extent = data_manager.current_layers.Graticule.extent;\n }\n } else if (!current_layer_prop.renderer) {\n selection = map.select('#' + layer_id).selectAll('path');\n layer_style_i.fill_opacity = selection.style('fill-opacity');\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.topo_geom = true;\n // layer_style_i.topo_geom = String(current_layer_prop.key_name);\n layer_style_i.stroke_color = selection.style('stroke');\n } else if (current_layer_prop.renderer.indexOf('PropSymbols') > -1 && current_layer_prop.type !== 'Line') {\n var type_symbol = current_layer_prop.symbol;\n selection = map.select('#' + layer_id).selectAll(type_symbol);\n var features = Array.prototype.map.call(svg_map.querySelector('#' + layer_id).getElementsByTagName(type_symbol), function (d) {\n return d.__data__;\n });\n layer_style_i.symbol = type_symbol;\n layer_style_i.size_legend_symbol = current_layer_prop.size_legend_symbol;\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n if (current_layer_prop.rendered_field2) {\n layer_style_i.rendered_field2 = current_layer_prop.rendered_field2;\n }\n layer_style_i.current_position = getPropSymbolCurrentPos(selection._groups[0], type_symbol);\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.size = current_layer_prop.size;\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.stroke_color = selection.style('stroke');\n layer_style_i.ref_layer_name = current_layer_prop.ref_layer_name;\n layer_style_i.geo_pt = {\n type: 'FeatureCollection',\n features: features\n };\n if (current_layer_prop.renderer === 'PropSymbolsTypo') {\n layer_style_i.color_map = [].concat(_toConsumableArray(current_layer_prop.color_map));\n }\n if (current_layer_prop.break_val) {\n layer_style_i.break_val = current_layer_prop.break_val;\n }\n } else if ((current_layer_prop.renderer.indexOf('PropSymbols') > -1 || current_layer_prop.renderer === 'LinksProportional') && current_layer_prop.type === 'Line') {\n var _type_symbol = current_layer_prop.symbol;\n selection = map.select('#' + layer_id).selectAll('path');\n var _features = Array.prototype.map.call(svg_map.querySelector('#' + layer_id).getElementsByTagName('path'), function (d) {\n return d.__data__;\n });\n layer_style_i.symbol = _type_symbol;\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n if (current_layer_prop.rendered_field2) {\n layer_style_i.rendered_field2 = current_layer_prop.rendered_field2;\n }\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.size = current_layer_prop.size;\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.ref_layer_name = current_layer_prop.ref_layer_name;\n layer_style_i.geo_line = {\n type: 'FeatureCollection',\n features: _features\n };\n if (current_layer_prop.renderer === 'PropSymbolsTypo') {\n layer_style_i.color_map = [].concat(_toConsumableArray(current_layer_prop.color_map));\n }\n if (current_layer_prop.break_val) {\n layer_style_i.break_val = current_layer_prop.break_val;\n }\n } else if (['Stewart', 'Gridded', 'Choropleth', 'Categorical', 'Carto_doug', 'OlsonCarto'].indexOf(current_layer_prop.renderer) > -1) {\n (function () {\n selection = map.select('#' + layer_id).selectAll('path');\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.topo_geom = true;\n // layer_style_i.topo_geom = String(current_layer_prop.key_name);\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.stroke_color = selection.style('stroke');\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n layer_style_i.ref_layer_name = current_layer_prop.ref_layer_name;\n var color_by_id = [];\n var params = current_layer_prop.type === 'Line' ? 'stroke' : 'fill';\n selection.each(function () {\n color_by_id.push((0, _colors_helpers.rgb2hex)(this.style[params]));\n });\n layer_style_i.color_by_id = color_by_id;\n if (current_layer_prop.renderer !== 'Categorical') {\n layer_style_i.options_disc = current_layer_prop.options_disc;\n } else {\n layer_style_i.color_map = [].concat(_toConsumableArray(current_layer_prop.color_map));\n }\n\n if (current_layer_prop.renderer === 'Stewart') {\n layer_style_i.color_palette = current_layer_prop.color_palette;\n } else if (current_layer_prop.renderer === 'OlsonCarto') {\n layer_style_i.scale_max = current_layer_prop.scale_max;\n layer_style_i.scale_byFeature = current_layer_prop.scale_byFeature;\n }\n })();\n } else if (current_layer_prop.renderer === 'LinksGraduated' || current_layer_prop.renderer === 'DiscLayer') {\n selection = map.select('#' + layer_id).selectAll('path');\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.topo_geom = true;\n // layer_style_i.topo_geom = String(current_layer_prop.key_name);\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n layer_style_i.ref_layer_name = current_layer_prop.ref_layer_name;\n layer_style_i.size = current_layer_prop.size;\n layer_style_i.min_display = current_layer_prop.min_display;\n layer_style_i.breaks = current_layer_prop.breaks;\n // layer_style_i.topo_geom = String(current_layer_prop.key_name);\n if (current_layer_prop.renderer === 'LinksGraduated') {\n layer_style_i.linksbyId = current_layer_prop.linksbyId.slice(0, nb_ft);\n }\n } else if (current_layer_prop.renderer === 'TypoSymbols') {\n selection = map.select('#' + layer_id).selectAll('image');\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.symbols_map = [].concat(_toConsumableArray(current_layer_prop.symbols_map));\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n layer_style_i.ref_layer_name = current_layer_prop.ref_layer_name;\n\n var state_to_save = [];\n var selec = selection._groups[0];\n for (var ix = 0; ix < selec.length; ix++) {\n var _ft = selec[ix];\n state_to_save.push({\n display: _ft.style.display,\n data: _ft.__data__,\n pos: [_ft.getAttribute('x'), _ft.getAttribute('y')],\n size: _ft.getAttribute('width')\n });\n }\n layer_style_i.current_state = state_to_save;\n } else if (current_layer_prop.renderer === 'Label') {\n selection = map.select('#' + layer_id).selectAll('text');\n var _selec = document.getElementById(layer_id).getElementsByTagName('text');\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n layer_style_i.default_font = current_layer_prop.default_font;\n layer_style_i.default_size = +current_layer_prop.default_size.slice(0, 2);\n layer_style_i.fill_color = current_layer_prop.fill_color;\n var _features2 = [];\n var current_position = [];\n for (var j = _selec.length - 1; j > -1; j--) {\n var _s = _selec[j];\n _features2.push(_s.__data__);\n current_position.push([+_s.getAttribute('x'), +_s.getAttribute('y'), _s.style.display, _s.style.fontSize, _s.style.fontFamily, _s.style.fill, _s.textContent]);\n }\n layer_style_i.data_labels = _features2;\n layer_style_i.current_position = current_position;\n } else if (current_layer_prop.renderer === 'TwoStocksWaffle') {\n var _type_symbol2 = current_layer_prop.symbol;\n selection = map.select('#' + layer_id).selectAll(_type_symbol2);\n layer_style_i.symbol = _type_symbol2;\n layer_style_i.rendered_field = current_layer_prop.rendered_field;\n layer_style_i.renderer = current_layer_prop.renderer;\n layer_style_i.size = current_layer_prop.size;\n layer_style_i.fill_color = current_layer_prop.fill_color;\n layer_style_i.ratio = current_layer_prop.ratio;\n layer_style_i.nCol = current_layer_prop.nCol;\n layer_style_i.ref_layer_name = current_layer_prop.ref_layer_name;\n layer_style_i.result_data = JSON.stringify(data_manager.result_data[layer_name]);\n layer_style_i.current_position = getWaffleCurrentPos(svg_map.querySelectorAll('#' + layer_id + ' > g'));\n } else {\n selection = map.select('#' + layer_id).selectAll('path');\n }\n layer_style_i.stroke_opacity = selection.style('stroke-opacity');\n layer_style_i.fill_opacity = selection.style('fill-opacity');\n }\n\n // return Promise.all(\n // layers_style.map(obj => (obj.topo_geom && !obj.targeted)\n // ? xhrequest(\"GET\", \"/get_layer/\" + obj.topo_geom, null, false) : null))\n return Promise.all(layers_style.map(function (obj) {\n return obj.topo_geom ? serialize_layer_to_topojson(obj.layer_name) : null;\n })).then(function (result) {\n for (var _i3 = 0; _i3 < layers_style.length; _i3++) {\n if (result[_i3]) {\n layers_style[_i3].topo_geom = result[_i3];\n }\n }\n // console.log(JSON.stringify({\"map_config\": map_config, \"layers\": layers_style}))\n return JSON.stringify({\n map_config: map_config,\n layers: layers_style,\n info: { version: _app.version }\n });\n });\n}\n\n// Function triggered when the user request a download of its map preferences\nfunction save_map_project() {\n _app.waitingOverlay.display();\n get_map_project().then(function (json_params) {\n var url = 'data:text/json;charset=utf-8,' + encodeURIComponent(json_params);\n _app.waitingOverlay.hide();\n (0, _helpers.clickLinkFromDataUrl)(url, 'magrit_project.json');\n });\n}\n\nfunction load_map_project() {\n var input_button = document.createElement('input');\n input_button.style.display = 'none';\n input_button.setAttribute('type', 'file');\n input_button.setAttribute('name', 'file');\n input_button.setAttribute('accept', '.json');\n input_button.onchange = function (event) {\n var file = event.target.files[0];\n var reader = new FileReader();\n reader.onloadend = function () {\n apply_user_preferences(reader.result);\n };\n reader.readAsText(file);\n input_button.remove();\n };\n document.body.appendChild(input_button);\n input_button.click();\n}\n\nfunction display_error_loading_project(error) {\n swal({\n title: _tr('app_page.common.error') + '!',\n text: '' + _tr('app_page.common.error_map_project') + (error || 'Unknown'),\n type: 'error',\n allowOutsideClick: false\n });\n}\n\nvar getAppVersion = function getAppVersion(info) {\n if (!info || !info.version) {\n return { app_version: undefined, p_version: undefined };\n }\n var app_version = info.version;\n var version_split = app_version.split('.');\n var p_version = {\n major: version_split[0],\n minor: version_split[1],\n patch: version_split[2]\n };\n return { app_version: app_version, p_version: p_version };\n};\n\nvar remove_all_layers = function remove_all_layers() {\n var layer_names = Object.getOwnPropertyNames(data_manager.current_layers);\n for (var i = 0, nb_layers = layer_names.length; i < nb_layers; i++) {\n (0, _interface.remove_layer_cleanup)(layer_names[i]);\n }\n // Make sure there is no layers and legend/layout features on the map :\n var _l = svg_map.childNodes;\n var _ll = _l.length;\n for (var _i4 = _ll - 1; _i4 > -1; _i4--) {\n _l[_i4].remove();\n }\n // Make sure there is no layers in the layer manager :\n _l = document.querySelector('#sortable.layer_list').childNodes;\n _ll = _l.length;\n for (var _i5 = _ll - 1; _i5 > -1; _i5--) {\n _l[_i5].remove();\n }\n // Get a new object for where we are storing the main properties :\n data_manager.current_layers = {};\n};\n\nfunction reorder_layers(desired_order) {\n var layers = svg_map.querySelectorAll('.layer'),\n parent = layers[0].parentNode,\n nb_layers = desired_order.length;\n // eslint-disable-next-line no-param-reassign\n desired_order = desired_order.map(function (el) {\n return _app.layer_to_id.get(el);\n });\n for (var i = 0; i < nb_layers; i++) {\n var _t = document.getElementById(desired_order[i]);\n if (_t) {\n parent.insertBefore(_t, parent.firstChild);\n }\n }\n svg_map.insertBefore(defs.node(), svg_map.childNodes[0]);\n}\n\nfunction reorder_elem_list_layer(desired_order) {\n var parent = document.getElementsByClassName('layer_list')[0],\n\n // layers = parent.childNodes,\n nb_layers = desired_order.length;\n for (var i = 0; i < nb_layers; i++) {\n var selec = parent.querySelector('li.' + _app.layer_to_id.get(desired_order[i]));\n if (selec) {\n parent.insertBefore(selec, parent.firstChild);\n }\n }\n}\n\nfunction reorder_layers_elem_legends(desired_order) {\n var elems = svg_map.querySelectorAll('.legend,.layer');\n var parent = elems[0].parentNode;\n var nb_elems = desired_order.length;\n for (var i = 0; i < nb_elems; i++) {\n var _t2 = svg_map.querySelector(desired_order[i]);\n if (_t2) {\n parent.appendChild(_t2);\n }\n }\n svg_map.insertBefore(defs.node(), svg_map.childNodes[0]);\n}\n\nfunction rehandle_legend(layer_name, properties) {\n for (var i = 0; i < properties.length; i++) {\n var prop = properties[i];\n if (prop.type === 'legend_root') {\n (0, _legend.createLegend_choro)(layer_name, prop.field, prop.title, prop.subtitle, prop.boxgap, prop.rect_fill_value, prop.rounding_precision, prop.no_data_txt, prop.bottom_note);\n } else if (prop.type === 'legend_root_symbol') {\n (0, _legend.createLegend_symbol)(layer_name, prop.field, prop.title, prop.subtitle, prop.nested_symbols, prop.join_line, prop.rect_fill_value, prop.rounding_precision, prop.bottom_note);\n } else if (prop.type === 'legend_root_lines_class') {\n (0, _legend.createLegend_discont_links)(layer_name, prop.field, prop.title, prop.subtitle, prop.rect_fill_value, prop.rounding_precision, prop.bottom_note);\n } else if (prop.type === 'legend_root_lines_symbol') {\n (0, _legend.createLegend_line_symbol)(layer_name, prop.field, prop.title, prop.subtitle, prop.rect_fill_value, prop.rounding_precision, prop.bottom_note);\n } else if (prop.type === 'legend_root_waffle') {\n (0, _legend.createLegend_waffle)(layer_name, prop.field, prop.title, prop.subtitle, prop.rect_fill_value, prop.ratio_txt, prop.bottom_note);\n } else if (prop.type === 'legend_root_horiz') {\n (0, _legend.createLegend_choro_horizontal)(layer_name, prop.field, prop.title, prop.subtitle, prop.boxgap, prop.rect_fill_value, prop.rounding_precision, prop.no_data_txt, prop.bottom_note);\n } else if (prop.type === 'legend_root_layout') {\n (0, _legend.createLegend_layout)(layer_name, prop.type_geom, prop.title, prop.subtitle, prop.rect_fill_value, prop.text_value, prop.bottom_note);\n }\n var lgd = svg_map.querySelector('#' + prop.type + '.lgdf_' + _app.layer_to_id.get(layer_name));\n lgd.setAttribute('transform', prop.transform);\n if (prop.display === 'none') lgd.setAttribute('display', 'none');\n }\n}\n\nfunction apply_user_preferences(json_pref) {\n // Try to read the project-file provided by the user:\n var _isValidJSON = (0, _helpers.isValidJSON)(json_pref),\n _isValidJSON2 = _slicedToArray(_isValidJSON, 2),\n valid = _isValidJSON2[0],\n preferences = _isValidJSON2[1];\n\n if (!valid) {\n display_error_loading_project(_tr('app_page.common.error_invalid_map_project') + preferences);\n return;\n }\n var map_config = preferences.map_config;\n var layers = preferences.layers;\n if (!layers || !map_config) {\n display_error_loading_project(_tr('app_page.common.error_invalid_map_project'));\n return;\n }\n\n var _getAppVersion = getAppVersion(preferences.info),\n app_version = _getAppVersion.app_version,\n p_version = _getAppVersion.p_version;\n\n // Clean the map and the menus from existing layers:\n\n\n remove_all_layers();\n\n // Display waiting overlay:\n _app.waitingOverlay.display({ cancel_button: false });\n\n // Restore the state of the page (ie. without any open functionnality):\n if (window.fields_handler) {\n (0, _function.clean_menu_function)();\n }\n\n // Clean the values remembered for the user from the previous rendering if any:\n (0, _function.reset_user_values)();\n\n var restorePreviousPos = function restorePreviousPos(layer_id, current_position, type_symbol) {\n var selection = map.select('#' + layer_id).selectAll(type_symbol);\n if (type_symbol === 'circle') {\n selection.attrs(function (d, i) {\n return {\n cx: current_position[i].cx,\n cy: current_position[i].cy\n };\n });\n } else {\n selection.attrs(function (d, i) {\n return {\n x: current_position[i].x,\n y: current_position[i].y\n };\n });\n }\n };\n var restorePreviousPosWaffle = function restorePreviousPosWaffle(layer_id, current_position /* , type_symbol */) {\n map.select('#' + layer_id).selectAll('g').attr('transform', function (d, i) {\n return current_position[i];\n });\n };\n\n var set_final_param = function set_final_param() {\n setTimeout(function () {\n var _zoom = svg_map.__zoom;\n _zoom.k = map_config.zoom_scale;\n _zoom.x = map_config.zoom_translate[0];\n _zoom.y = map_config.zoom_translate[1];\n (0, _map_ctrl.zoom_without_redraw)();\n s = map_config.projection_scale;\n t = map_config.projection_translate;\n proj.scale(s).translate(t);\n if (map_config.projection_rotation) proj = proj.rotate(map_config.projection_rotation);\n path = d3.geoPath().projection(proj).pointRadius(4);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _projections.handleClipPath)(_app.current_proj_name);\n (0, _map_ctrl.reproj_symbol_layer)();\n apply_layout_lgd_elem();\n if (!map_config.global_order) {\n // Old method to reorder layers :\n if (layers.length > 1) {\n var desired_order = layers.map(function (i) {\n return i.layer_name;\n });\n reorder_elem_list_layer(desired_order);\n desired_order.reverse();\n reorder_layers(desired_order);\n }\n } else if (p_version.minor <= 4) {\n reorder_layers_elem_legends(map_config.global_order);\n if (layers.length > 1) {\n var _desired_order = layers.map(function (i) {\n return i.layer_name;\n });\n reorder_elem_list_layer(_desired_order);\n _desired_order.reverse();\n reorder_layers(_desired_order);\n }\n // Current method to reorder layers:\n } else if (map_config.global_order && map_config.global_order.length > 1 && (p_version.minor > 4 || p_version.minor === 4 && p_version.patch > 1)) {\n var order = layers.map(function (i) {\n return i.layer_name;\n });\n reorder_elem_list_layer(order);\n reorder_layers_elem_legends(map_config.global_order);\n }\n if (map_config.canvas_rotation) {\n document.getElementById('form_rotate').value = map_config.canvas_rotation;\n document.getElementById('canvas_rotation_value_txt').value = map_config.canvas_rotation;\n (0, _map_ctrl.rotate_global)(map_config.canvas_rotation);\n }\n _app.waitingOverlay.hide();\n var targeted_layer = Object.getOwnPropertyNames(data_manager.user_data)[0];\n if (targeted_layer) (0, _helpers.getAvailablesFunctionnalities)(targeted_layer);\n for (var ii = 0; ii < at_end.length; ii++) {\n at_end[ii][0](at_end[ii][1], at_end[ii][2], at_end[ii][3]);\n }\n }, 150);\n };\n\n function apply_layout_lgd_elem() {\n if (map_config.title) {\n // Create the title object :\n (0, _interface.handle_title)(map_config.title.content);\n // Use its old properties :\n var title = document.getElementById('map_title').getElementsByTagName('text')[0];\n title.setAttribute('x', map_config.title.x);\n title.setAttribute('y', map_config.title.y);\n title.setAttribute('style', map_config.title.style);\n // Also fill the input field on the left menu :\n document.querySelector('input#title.list_elem_section4').value = map_config.title.content;\n }\n if (map_config.layout_features) {\n if (map_config.layout_features.scale_bar) {\n _scalebar.scaleBar.create();\n _scalebar.scaleBar.bar_size = map_config.layout_features.scale_bar.bar_size;\n _scalebar.scaleBar.displayed = map_config.layout_features.scale_bar.displayed;\n _scalebar.scaleBar.dist = map_config.layout_features.scale_bar.dist;\n _scalebar.scaleBar.dist_txt = map_config.layout_features.scale_bar.dist_txt;\n _scalebar.scaleBar.fixed_size = map_config.layout_features.scale_bar.fixed_size;\n _scalebar.scaleBar.precision = map_config.layout_features.scale_bar.precision;\n _scalebar.scaleBar.x = map_config.layout_features.scale_bar.x;\n _scalebar.scaleBar.y = map_config.layout_features.scale_bar.y;\n _scalebar.scaleBar.Scale._groups[0][0].setAttribute('transform', map_config.layout_features.scale_bar.transform);\n // We should be able to avoid this condition and always use the same method\n // but while waiting to test it more it may be safer to do it that way\n if (_scalebar.scaleBar.fixed_size === false) {\n _scalebar.scaleBar.update();\n } else {\n _scalebar.scaleBar.resize();\n }\n }\n if (map_config.layout_features.north_arrow) {\n _north_arrow.northArrow.display();\n _north_arrow.northArrow.arrow_img._groups[0][0].setAttribute('x', map_config.layout_features.north_arrow.x_img);\n _north_arrow.northArrow.arrow_img._groups[0][0].setAttribute('y', map_config.layout_features.north_arrow.y_img);\n _north_arrow.northArrow.arrow_img._groups[0][0].setAttribute('width', map_config.layout_features.north_arrow.size);\n _north_arrow.northArrow.arrow_img._groups[0][0].setAttribute('height', map_config.layout_features.north_arrow.size);\n _north_arrow.northArrow.under_rect._groups[0][0].setAttribute('x', map_config.layout_features.north_arrow.x_img - 7.5);\n _north_arrow.northArrow.under_rect._groups[0][0].setAttribute('y', map_config.layout_features.north_arrow.y_img - 7.5);\n _north_arrow.northArrow.x_center = map_config.layout_features.north_arrow.x_center;\n _north_arrow.northArrow.y_center = map_config.layout_features.north_arrow.y_center;\n _north_arrow.northArrow.displayed = map_config.layout_features.north_arrow.displayed;\n }\n if (map_config.layout_features.arrow) {\n for (var i = 0; i < map_config.layout_features.arrow.length; i++) {\n var ft = map_config.layout_features.arrow[i];\n var _arrow = new _arrow3.default(ft.id, ft.pt1, ft.pt2, svg_map, true);\n var _line = _arrow.arrow.select('line').node();\n _arrow.hide_head = map_config.layout_features.arrow[i].marker_head === null;\n _line.setAttribute('marker-end', map_config.layout_features.arrow[i].marker_head);\n _line.style.stroke = map_config.layout_features.arrow[i].stroke;\n _line.style.strokeWidth = map_config.layout_features.arrow[i].stroke_width;\n }\n }\n if (map_config.layout_features.user_ellipse) {\n for (var _i6 = 0; _i6 < map_config.layout_features.user_ellipse.length; _i6++) {\n var _ft2 = map_config.layout_features.user_ellipse[_i6];\n var ellps = new _ellipse2.default(_ft2.id, [_ft2.cx, _ft2.cy], svg_map, true);\n var ellps_node = ellps.ellipse.node().querySelector('ellipse');\n ellps_node.setAttribute('rx', _ft2.rx);\n ellps_node.setAttribute('ry', _ft2.ry);\n ellps_node.style.stroke = _ft2.stroke;\n ellps_node.style.strokeWidth = _ft2.stroke_width;\n }\n }\n if (map_config.layout_features.user_rectangle) {\n for (var _i7 = 0; _i7 < map_config.layout_features.user_rectangle.length; _i7++) {\n var _ft3 = map_config.layout_features.user_rectangle[_i7],\n rect = new _rectangle2.default(_ft3.id, [_ft3.x, _ft3.y], svg_map, true),\n rect_node = rect.rectangle.node().querySelector('rect');\n rect_node.setAttribute('rx', _ft3.rx);\n rect_node.setAttribute('ry', _ft3.ry);\n rect_node.setAttribute('height', _ft3.height);\n rect_node.setAttribute('width', _ft3.width);\n rect_node.setAttribute('style', _ft3.style);\n }\n }\n if (map_config.layout_features.text_annot) {\n for (var _i8 = 0; _i8 < map_config.layout_features.text_annot.length; _i8++) {\n var _ft4 = map_config.layout_features.text_annot[_i8];\n var new_txt_box = new _text_annotation2.default(svg_map, _ft4.id, [_ft4.position_x, _ft4.position_y]);\n new_txt_box.textAnnot.node().setAttribute('style', _ft4.style);\n new_txt_box.textAnnot.attrs({\n transform: _ft4.transform,\n x: _ft4.position_x,\n y: _ft4.position_y\n }).selectAll('tspan').attrs({\n x: _ft4.position_x,\n y: _ft4.position_y\n });\n new_txt_box.fontSize = +_ft4.style.split('font-size: ')[1].split('px')[0];\n new_txt_box.fontFamily = (_ft4.style.split('font-family: ')[1].split(';')[0] || '').replace(', ', ',');\n new_txt_box.updateLineHeight();\n new_txt_box.update_text(_ft4.content);\n }\n }\n if (map_config.layout_features.single_symbol) {\n for (var _i9 = 0; _i9 < map_config.layout_features.single_symbol.length; _i9++) {\n var _ft5 = map_config.layout_features.single_symbol[_i9];\n var symb = (0, _helpers2.add_single_symbol)(_ft5.href, _ft5.x, _ft5.y, _ft5.width, _ft5.height, _ft5.id);\n if (_ft5.scalable) {\n var parent_symb = symb.node().parentElement;\n parent_symb.classList.add('scalable-legend');\n parent_symb.setAttribute('transform', ['translate(', map_config.zoom_translate[0], ',', map_config.zoom_translate[1], ') scale(', map_config.zoom_scale, ',', map_config.zoom_scale, ')'].join(''));\n }\n }\n }\n }\n }\n var at_end = [];\n var done = 0;\n var func_name_corresp = new Map([['LinksGraduated', 'flow'], ['Carto_doug', 'cartogram'], ['OlsonCarto', 'cartogram'], ['Stewart', 'smooth'], ['Gridded', 'grid'], ['DiscLayer', 'discont'], ['Choropleth', 'choro'], ['Categorical', 'typo']]);\n\n // Set the dimension of the map (width and height) :\n w = +map_config.div_width;\n h = +map_config.div_height;\n (0, _map_ctrl.canvas_mod_size)([w, h]);\n document.getElementById('input-width').value = w;\n document.getElementById('input-height').value = h;\n\n // Recrate the Map for the palettes defined by the user:\n _app.custom_palettes = new Map(map_config.custom_palettes);\n\n // Set the variables/fields related to the projection\n // (names were slightly changed in a last version, thus the replacing of whitespace)\n _app.current_proj_name = map_config.projection.replace(/ /g, '');\n if (map_config.custom_projection) {\n proj = (0, _projections.getD3ProjFromProj4)((0, _proj2.default)(map_config.custom_projection));\n _app.last_projection = map_config.custom_projection;\n var custom_name = Object.keys(_app.epsg_projections).map(function (d) {\n return [d, _app.epsg_projections[d]];\n }).filter(function (ft) {\n return ft[1].proj4 === _app.last_projection;\n });\n custom_name = custom_name && custom_name.length > 0 && custom_name[0].length > 1 ? custom_name[0][1].name : undefined;\n (0, _projections.addLastProjectionSelect)(_app.current_proj_name, _app.last_projection, custom_name);\n } else {\n proj = d3[_projections.available_projections.get(_app.current_proj_name).name]();\n (0, _projections.addLastProjectionSelect)(_app.current_proj_name);\n }\n if (map_config.projection_parallels) proj = proj.parallels(map_config.projection_parallels);\n if (map_config.projection_parallel) proj = proj.parallel(map_config.projection_parallel);\n if (map_config.projection_clipAngle) proj = proj.clipAngle(map_config.projection_clipAngle);\n s = map_config.projection_scale;\n t = map_config.projection_translate;\n proj.scale(s).translate(t);\n if (map_config.projection_rotation) proj = proj.rotate(map_config.projection_rotation);\n defs = map.append('defs');\n path = d3.geoPath().projection(proj).pointRadius(4);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n\n // Set the background color of the map :\n map.style('background-color', map_config.background_color);\n document.querySelector('input#bg_color').value = (0, _colors_helpers.rgb2hex)(map_config.background_color);\n\n // Reload the external (not-joined) dataset if there is one :\n if (map_config.joined_dataset) {\n data_manager.field_join_map = [];\n data_manager.joined_dataset = [map_config.joined_dataset.slice()];\n data_manager.dataset_name = map_config.dataset_name;\n (0, _interface.update_menu_dataset)();\n }\n\n // Add each layer :\n\n var _loop = function _loop(i) {\n var _layer = layers[i];\n var layer_name = _layer.layer_name,\n layer_type = _layer.layer_type,\n layer_id = void 0;\n // symbol;\n\n // Reload the sphere differently as some (\"breaking\") changes were made\n // when updating to 0.3.3\n if (app_version === undefined || p_version.major === 0 && p_version.minor <= 3 && p_version.patch < 3) {\n if (layer_name === 'Sphere') {\n layer_type = 'sphere';\n } else if (layer_name === 'Graticule') {\n layer_type = 'graticule';\n }\n }\n var fill_opacity = _layer.fill_opacity,\n stroke_opacity = _layer.stroke_opacity;\n\n // This is a layer for which a geometries have been stocked as TopoJSON :\n if (_layer.topo_geom) {\n var tmp = {\n skip_alert: true,\n choosed_name: layer_name,\n skip_rescale: true\n };\n if (_layer.targeted) {\n tmp.target_layer_on_add = true;\n } else if (_layer.renderer) {\n tmp.func_name = func_name_corresp.get(_layer.renderer);\n tmp.result_layer_on_add = true;\n }\n if (_layer.pointRadius !== undefined) {\n tmp.pointRadius = _layer.pointRadius;\n }\n // handle_reload_TopoJSON(_layer.topo_geom, tmp).then(function(n_layer_name){\n layer_name = (0, _interface.handle_reload_TopoJSON)(_layer.topo_geom, tmp);\n var current_layer_prop = data_manager.current_layers[layer_name];\n if (_layer.renderer) {\n current_layer_prop.renderer = _layer.renderer;\n }\n if (_layer.targeted && _layer.fields_type) {\n current_layer_prop.fields_type = _layer.fields_type;\n document.getElementById('btn_type_fields').removeAttribute('disabled');\n }\n layer_id = _app.layer_to_id.get(layer_name);\n var layer_selec = map.select('#' + layer_id);\n\n current_layer_prop.rendered_field = _layer.rendered_field;\n if (_layer.layout_legend_displayed) current_layer_prop.layout_legend_displayed = _layer.layout_legend_displayed;\n if (_layer.ref_layer_name) current_layer_prop.ref_layer_name = _layer.ref_layer_name;\n if (_layer.size) current_layer_prop.size = _layer.size;\n if (_layer.colors_breaks) current_layer_prop.colors_breaks = _layer.colors_breaks;\n if (_layer.options_disc) current_layer_prop.options_disc = _layer.options_disc;\n if (_layer.fill_color) current_layer_prop.fill_color = _layer.fill_color;\n if (_layer.color_palette) current_layer_prop.color_palette = _layer.color_palette;\n if (_layer.renderer) {\n if (['Choropleth', 'Stewart', 'Gridded'].indexOf(_layer.renderer) > -1) {\n layer_selec.selectAll('path').style(current_layer_prop.type === 'Line' ? 'stroke' : 'fill', function (d, j) {\n return _layer.color_by_id[j];\n });\n } else if (_layer.renderer === 'LinksGraduated') {\n current_layer_prop.linksbyId = _layer.linksbyId;\n current_layer_prop.min_display = _layer.min_display;\n current_layer_prop.breaks = _layer.breaks;\n layer_selec.selectAll('path').styles(function (d, j) {\n return {\n display: +d.properties.fij > _layer.min_display ? null : 'none',\n stroke: _layer.fill_color.single,\n 'stroke-width': current_layer_prop.linksbyId[j][2]\n };\n });\n } else if (_layer.renderer === 'DiscLayer') {\n current_layer_prop.min_display = _layer.min_display || 0;\n current_layer_prop.breaks = _layer.breaks;\n var lim = current_layer_prop.min_display !== 0 ? current_layer_prop.min_display * data_manager.current_layers[layer_name].n_features : -1;\n layer_selec.selectAll('path').styles(function (d, j) {\n return {\n fill: 'none',\n stroke: _layer.fill_color.single,\n display: j <= lim ? null : 'none',\n 'stroke-width': d.properties.prop_val\n };\n });\n } else if (_layer.renderer.startsWith('Categorical')) {\n (0, _function.render_categorical)(layer_name, {\n colorByFeature: _layer.color_by_id,\n color_map: new Map(_layer.color_map),\n rendered_field: _layer.rendered_field,\n renderer: 'Categorical'\n });\n }\n }\n if (_layer.stroke_color) {\n layer_selec.selectAll('path').style('stroke', _layer.stroke_color);\n }\n if (_layer['stroke-width-const']) {\n current_layer_prop['stroke-width-const'] = _layer['stroke-width-const'];\n layer_selec.style('stroke-width', _layer['stroke-width-const']);\n }\n if (_layer.fixed_stroke) {\n current_layer_prop.fixed_stroke = _layer.fixed_stroke;\n }\n if (_layer.legend) {\n rehandle_legend(layer_name, _layer.legend);\n }\n if (_layer.fill_color && _layer.fill_color.single && _layer.renderer !== 'DiscLayer') {\n layer_selec.selectAll('path').style(current_layer_prop.type !== 'Line' ? 'fill' : 'stroke', _layer.fill_color.single);\n } else if (_layer.fill_color && _layer.fill_color.random) {\n layer_selec.selectAll('path').style(current_layer_prop.type !== 'Line' ? 'fill' : 'stroke', function () {\n return _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n });\n }\n\n layer_selec.selectAll('path').styles({ 'fill-opacity': fill_opacity, 'stroke-opacity': stroke_opacity });\n if (_layer.visible === 'hidden') {\n (0, _interface.handle_active_layer)(layer_name);\n }\n if (_layer.filter_shadow) {\n (0, _layers_style_popup.createDropShadow)(layer_id);\n }\n done += 1;\n if (done === map_config.n_layers) set_final_param();\n // });\n } else if (layer_name === 'World') {\n (0, _interface.add_simplified_land_layer)({\n skip_rescale: true,\n fill: _layer.fill_color,\n stroke: _layer.stroke_color,\n fill_opacity: fill_opacity,\n stroke_opacity: stroke_opacity,\n stroke_width: _layer['stroke-width-const'] + 'px',\n visible: _layer.visible !== 'hidden',\n drop_shadow: _layer.filter_shadow\n });\n done += 1;\n if (done === map_config.n_layers) set_final_param();\n // ... or this is a layer provided by the application :\n } else {\n if (layer_type === 'sphere' || layer_type === 'graticule') {\n var options = {\n layer_name: layer_name,\n stroke: _layer.stroke_color,\n fill_opacity: fill_opacity,\n stroke_opacity: stroke_opacity,\n stroke_width: _layer['stroke-width-const'] + 'px'\n };\n if (layer_type === 'graticule') {\n options.fill = 'none';\n options.stroke_dasharray = _layer.stroke_dasharray;\n options.step = _layer.step;\n options.extent = _layer.extent;\n } else {\n options.fill = _layer.fill_color;\n }\n (0, _helpers2.add_layout_feature)(layer_type, options);\n layer_id = _app.layer_to_id.get(layer_name);\n // ... or this is a layer of proportionnals symbols :\n } else if (_layer.renderer && (_layer.renderer.startsWith('PropSymbol') || _layer.renderer === 'LinksProportional')) {\n var geojson_layer = _layer.geo_line || _layer.geo_pt;\n var _s2 = _layer.symbol === 'path' ? 'line' : _layer.symbol;\n var rendering_params = {\n new_name: layer_name,\n field: _layer.rendered_field,\n ref_value: _layer.size[0],\n ref_size: _layer.size[1],\n symbol: _s2,\n nb_features: geojson_layer.features.length,\n ref_layer_name: _layer.ref_layer_name,\n renderer: _layer.renderer\n };\n if (_layer.renderer === 'PropSymbolsChoro' || _layer.renderer === 'PropSymbolsTypo') {\n rendering_params.fill_color = _layer.fill_color.class;\n } else if (_layer.fill_color.random) {\n rendering_params.fill_color = '#fff';\n } else if (_layer.fill_color.single !== undefined) {\n rendering_params.fill_color = _layer.fill_color.single;\n } else if (_layer.fill_color.two) {\n rendering_params.fill_color = _layer.fill_color;\n rendering_params.break_val = _layer.break_val;\n }\n\n if (_layer.symbol === 'line' || _layer.symbol === 'path') {\n (0, _function.make_prop_line)(rendering_params, geojson_layer);\n } else {\n (0, _function.make_prop_symbols)(rendering_params, geojson_layer);\n if (_layer.stroke_color) {\n map.select('#' + _app.layer_to_id.get(layer_name)).selectAll(_layer.symbol).style('stroke', _layer.stroke_color);\n }\n }\n if (_layer.renderer === 'PropSymbolsTypo') {\n data_manager.current_layers[layer_name].color_map = new Map(_layer.color_map);\n }\n if (_layer.options_disc) {\n data_manager.current_layers[layer_name].options_disc = _layer.options_disc;\n }\n if (_layer.rendered_field2) {\n data_manager.current_layers[layer_name].rendered_field2 = _layer.rendered_field2;\n }\n if (_layer.colors_breaks) {\n data_manager.current_layers[layer_name].colors_breaks = _layer.colors_breaks;\n }\n if (_layer.size_legend_symbol) {\n data_manager.current_layers[layer_name].size_legend_symbol = _layer.size_legend_symbol;\n }\n if (_layer.legend) {\n rehandle_legend(layer_name, _layer.legend);\n }\n data_manager.current_layers[layer_name]['stroke-width-const'] = _layer['stroke-width-const'];\n layer_id = _app.layer_to_id.get(layer_name);\n var _layer_selec = map.select('#' + layer_id).selectAll(_layer.symbol);\n _layer_selec.styles({\n 'stroke-width': _layer['stroke-width-const'] + 'px',\n 'fill-opacity': fill_opacity,\n 'stroke-opacity': stroke_opacity\n });\n if (_layer.fill_color.random) {\n _layer_selec.style('fill', function () {\n return _colors_helpers.Colors.names[_colors_helpers.Colors.random()];\n });\n }\n if (_layer.current_position) {\n at_end.push([restorePreviousPos, layer_id, _layer.current_position, _layer.symbol]);\n }\n // ... or this is a layer of labels :\n } else if (_layer.renderer && _layer.renderer.startsWith('Label')) {\n var _rendering_params = {\n uo_layer_name: layer_name,\n label_field: _layer.rendered_field,\n color: _layer.fill_color,\n ref_font_size: _layer.default_size,\n font: _layer.default_font\n };\n // TODO : apply the same thing as with PropSymbol\n // for setting label at their original positions :\n (0, _function.render_label)(null, _rendering_params, {\n data: _layer.data_labels,\n current_position: _layer.current_position\n });\n layer_id = _app.layer_to_id.get(layer_name);\n } else if (_layer.renderer && _layer.renderer === 'TwoStocksWaffle') {\n (0, _function.render_twostocks_waffle)(undefined, {\n nCol: _layer.nCol,\n ratio: _layer.ratio,\n symbol_type: _layer.symbol,\n new_name: layer_name,\n size: _layer.size,\n ref_colors: _layer.fill_color,\n fields: _layer.rendered_field,\n result_data: _layer.result_data\n });\n layer_id = _app.layer_to_id.get(layer_name);\n map.select('#' + layer_id).selectAll(_layer.symbol).style('fill-opacity', _layer.fill_opacity);\n if (_layer.legend) {\n rehandle_legend(layer_name, _layer.legend);\n }\n if (_layer.current_position) {\n at_end.push([restorePreviousPosWaffle, layer_id, _layer.current_position, _layer.symbol]);\n }\n } else if (_layer.renderer && _layer.renderer.startsWith('TypoSymbol')) {\n var symbols_map = new Map(_layer.symbols_map);\n var new_layer_data = {\n type: 'FeatureCollection',\n features: _layer.current_state.map(function (d) {\n return d.data;\n })\n };\n\n var nb_features = new_layer_data.features.length;\n var context_menu = new _contextMenu2.default();\n var getItems = function getItems(self_parent) {\n return [{ name: _tr('app_page.common.edit_style'), action: function action() {\n (0, _symbols_picto.make_style_box_indiv_symbol)(self_parent);\n } }, { name: _tr('app_page.common.delete'), action: function action() {\n self_parent.style.display = 'none';\n } }];\n };\n layer_id = encodeId(layer_name);\n _app.layer_to_id.set(layer_name, layer_id);\n _app.id_to_layer.set(layer_id, layer_name);\n // Add the features at there original positions :\n map.append('g').attrs({ id: layer_id, class: 'layer' }).selectAll('image').data(new_layer_data.features).enter().insert('image').attrs(function (d, j) {\n var symb = symbols_map.get(d.properties.symbol_field),\n prop = _layer.current_state[j],\n coords = prop.pos;\n return {\n x: coords[0] - symb[1] / 2,\n y: coords[1] - symb[1] / 2,\n width: prop.size,\n height: prop.size,\n 'xlink:href': symb[0]\n };\n }).style('display', function (d, j) {\n return _layer.current_state[j].display;\n }).on('mouseover', function () {\n this.style.cursor = 'pointer';\n }).on('mouseout', function () {\n this.style.cursor = 'initial';\n }).on('contextmenu dblclick', function () {\n context_menu.showMenu(d3.event, document.querySelector('body'), getItems(this));\n }).call(_helpers.drag_elem_geo);\n\n (0, _helpers.create_li_layer_elem)(layer_name, nb_features, ['Point', 'symbol'], 'result');\n data_manager.current_layers[layer_name] = {\n n_features: nb_features,\n renderer: 'TypoSymbols',\n symbols_map: symbols_map,\n rendered_field: _layer.rendered_field,\n is_result: true,\n symbol: 'image',\n ref_layer_name: _layer.ref_layer_name\n };\n if (_layer.legend) {\n rehandle_legend(layer_name, _layer.legend);\n }\n } else {\n null;\n }\n // Had the layer a shadow effect ?\n if (_layer.filter_shadow) {\n (0, _layers_style_popup.createDropShadow)(layer_id);\n }\n // Was the layer visible when the project was saved :\n if (_layer.visible === 'hidden' && layer_name !== 'World') {\n (0, _interface.handle_active_layer)(layer_name);\n }\n // This function is called on each layer added\n // to delay the call to the function doing a final\n // adjusting of the zoom factor / translate values / layers orders :\n done += 1;\n if (done === map_config.n_layers) set_final_param();\n }\n };\n\n for (var i = map_config.n_layers - 1; i > -1; --i) {\n _loop(i);\n }\n}\n/* eslint-enable no-loop-func */\n\nvar beforeUnloadWindow = exports.beforeUnloadWindow = function beforeUnloadWindow(event) {\n get_map_project().then(function (jsonParams) {\n window.localStorage.removeItem('magrit_project');\n if (jsonParams.length < 5500000) {\n window.localStorage.setItem('magrit_project', jsonParams);\n }\n });\n // eslint-disable-next-line no-param-reassign\n event.returnValue = global._app.targeted_layer_added || Object.getOwnPropertyNames(data_manager.result_data).length > 0 ? 'Confirm exit' : undefined;\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\"), __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/map_project.js?");
-
-/***/ }),
-
-/***/ "./js/projection_others.js":
-/*!*********************************!*\
- !*** ./js/projection_others.js ***!
- \*********************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.hatanoRaw = hatanoRaw;\nexports.winkel1Raw = winkel1Raw;\nvar sin = Math.sin;\nvar asin = Math.asin;\nvar abs = Math.abs;\nvar cos = Math.cos;\n\nvar NITER = 20;\nvar EPS = 1e-7;\nvar ONETOL = 1.000001;\nvar CN = 2.67595;\nvar CS = 2.43763;\nvar RCN = 0.37369906014686373063;\nvar RCS = 0.41023453108141924738;\nvar FYCN = 1.75859;\nvar FYCS = 1.93052;\nvar RYCN = 0.56863737426006061674;\nvar RYCS = 0.51799515156538134803;\nvar FXC = 0.85;\nvar RXC = 1.17647058823529411764;\nvar M_HALFPI = Math.PI / 2;\n\nfunction hatanoRaw(lambda, phi) {\n var c = sin(phi) * (phi < 0 ? CS : CN);\n var y = phi;\n var th1 = void 0;\n var i = void 0;\n for (i = NITER; i; --i) {\n y -= th1 = (y + sin(y) - c) / (1 + cos(y));\n if (abs(th1) < EPS) break;\n }\n return [FXC * lambda * cos(y *= 0.5), sin(y) * (y < 0 ? FYCS : FYCN)];\n}\n\nhatanoRaw.invert = function (x, y) {\n var xx = x;\n var yy = y;\n var th = yy * (yy < 0 ? RYCS : RYCN);\n if (abs(th) > 1) {\n if (abs(th) > ONETOL) {\n console.log('Error');\n return [NaN, NaN];\n }\n th = th > 0 ? M_HALFPI : -M_HALFPI;\n } else {\n th = asin(th);\n }\n xx = RXC * xx / cos(th);\n th += th;\n yy = (th + sin(th)) * (yy < 0 ? RCS : RCN);\n if (abs(yy) > 1) {\n if (abs(yy) > ONETOL) {\n console.log('Error');\n return [NaN, NaN];\n }\n yy = yy > 0 ? M_HALFPI : -M_HALFPI;\n } else {\n yy = asin(yy);\n }\n return [xx, yy];\n};\n\nfunction winkel1Raw(latTrueScale) {\n var cosphi1 = cos(latTrueScale);\n\n function forward(lambda, phi) {\n var x = lambda;\n var y = phi;\n return [0.5 * x * (cosphi1 + cos(phi)), y];\n }\n\n forward.invert = function (x, y) {\n var lambda = x;\n var phi = y;\n return [2 * lambda / (cosphi1 + cos(phi)), phi];\n };\n\n return forward;\n}\n\n//# sourceURL=webpack:///./js/projection_others.js?");
-
-/***/ }),
-
-/***/ "./js/projections.js":
-/*!***************************!*\
- !*** ./js/projections.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.tryFindNameProj = exports.getD3ProjFromProj4 = exports.available_projections = exports.shortListContent = undefined;\nexports.handle_projection_select = handle_projection_select;\nexports.addLastProjectionSelect = addLastProjectionSelect;\nexports.isInterrupted = isInterrupted;\nexports.handleClipPath = handleClipPath;\nexports.change_projection = change_projection;\nexports.change_projection_4 = change_projection_4;\n\nvar _proj2 = __webpack_require__(/*! proj4 */ \"./node_modules/proj4/lib/index.js\");\n\nvar _proj3 = _interopRequireDefault(_proj2);\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _projection_others = __webpack_require__(/*! ./projection_others */ \"./js/projection_others.js\");\n\nvar _helpers2 = __webpack_require__(/*! ./layout_features/helpers */ \"./js/layout_features/helpers.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nd3.geoWinkel1 = function () {\n return d3.geoProjection((0, _projection_others.winkel1Raw)(45)).scale(200);\n};\nd3.geoHatano = function () {\n return d3.geoProjection(_projection_others.hatanoRaw).scale(200);\n};\n\nvar shortListContent = exports.shortListContent = ['AzimuthalEqualAreaEurope', 'ConicConformalFrance', 'HEALPix', 'Mercator', 'NaturalEarth2', 'Robinson', 'TransverseMercator', 'WinkelTriple', 'more', 'proj4'];\n\n/* eslint-disable object-curly-newline,max-len */\nvar available_projections = exports.available_projections = new Map([['Armadillo', { name: 'geoArmadillo', scale: '400', param_in: 'other', param_ex: 'aphylactic' }], ['AzimuthalEquidistant', { name: 'geoAzimuthalEquidistant', scale: '700', param_in: 'plan', param_ex: 'equidistant' }], ['AzimuthalEqualArea', { name: 'geoAzimuthalEqualArea', scale: '700', param_in: 'plan', param_ex: 'equalarea' }], ['AzimuthalEqualAreaEurope', { name: 'geoAzimuthalEqualArea', scale: '700', rotate: [-10, -52, 0], bounds: [-10.6700, 34.5000, 31.5500, 71.0500], param_in: 'plan', param_ex: 'equalarea' }], ['Baker', { name: 'geoBaker', scale: '400', param_in: 'other', param_ex: 'aphylactic' }], ['Berhmann', { name: 'geoCylindricalEqualArea', scale: '400', parallel: 30, param_in: 'cylindrical', param_ex: 'equalarea' }], ['Bertin', { name: 'geoBertin1953', scale: '400', param_in: 'other', param_ex: 'aphylactic' }], ['Boggs', { name: 'geoBoggs', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['InterruptedBoggs', { name: 'geoInterruptedBoggs', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Bonne', { name: 'geoBonne', scale: '400', param_in: 'pseudocone', param_ex: 'equalarea' }], ['Bromley', { name: 'geoBromley', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Collignon', { name: 'geoCollignon', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }],\n// [\"ConicConformalTangent\", {'name': 'geoConicConformal', 'scale': '400', 'parallels': [44, 44], bounds: [-25.5, -25.5, 75.5, 75.5], param_in: 'cone', param_ex: 'conformal'}],\n['ConicConformal', { name: 'geoConicConformal', scale: '400', parallels: [44, 49], bounds: [-25.5, -25.5, 75.5, 75.5], param_in: 'cone', param_ex: 'conformal' }], ['ConicConformalFrance', { name: 'geoConicConformal', scale: '400', parallels: [44, 49], rotate: [-3, -46.5, 0], bounds: [-10.6700, 34.5000, 31.5500, 71.0500], param_in: 'cone', param_ex: 'conformal' }], ['ConicEqualArea', { name: 'geoConicEqualArea', scale: '400', param_in: 'cone', param_ex: 'equalarea' }], ['ConicEquidistant', { name: 'geoConicEquidistant', scale: '400', parallels: [40, 45], param_in: 'cone', param_ex: 'equidistant' }],\n// [\"ConicEquidistantTangent\", {'name': 'geoConicEquidistant', 'scale': '400', parallels: [40, 40], param_in: 'cone', param_ex: 'equidistant'}],\n['CrasterParabolic', { name: 'geoCraster', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Equirectangular', { name: 'geoEquirectangular', scale: '400', param_in: 'cylindrical', param_ex: 'equidistant' }], ['CylindricalEqualArea', { name: 'geoCylindricalEqualArea', scale: '400', param_in: 'cylindrical', param_ex: 'equalarea' }], ['CylindricalStereographic', { name: 'geoCylindricalStereographic', scale: '400', param_in: 'cylindrical', param_ex: 'aphylactic' }], ['EckertI', { name: 'geoEckert1', scale: '400', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['EckertII', { name: 'geoEckert2', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['EckertIII', { name: 'geoEckert3', scale: '525', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['EckertIV', { name: 'geoEckert4', scale: '525', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['EckertV', { name: 'geoEckert5', scale: '400', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['EckertVI', { name: 'geoEckert6', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Eisenlohr', { name: 'geoEisenlohr', scale: '400', param_in: 'other', param_ex: 'conformal' }], ['GallPeters', { name: 'geoCylindricalEqualArea', scale: '400', parallel: 45, param_in: 'cylindrical', param_ex: 'equalarea' }], ['GallStereographic', { name: 'geoCylindricalStereographic', scale: '400', parallel: 45, param_in: 'cylindrical', param_ex: 'aphylactic' }], ['Gilbert', { name: 'geoGilbert', scale: '400', type: '', param_in: 'other', param_ex: 'aphylactic' }], ['Gnomonic', { name: 'geoGnomonic', scale: '400', param_in: 'plan', param_ex: 'aphylactic' }], ['Gringorten', { name: 'geoGringorten', scale: '400', param_in: 'other', param_ex: 'equalarea' }], ['GringortenQuincuncial', { name: 'geoGringortenQuincuncial', scale: '400', param_in: 'other', param_ex: 'equalarea' }], ['Hatano', { name: 'geoHatano', scale: '200', param_in: 'other', param_ex: 'equalarea' }], ['HEALPix', { name: 'geoHealpix', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['HoboDyer', { name: 'geoCylindricalEqualArea', scale: '400', parallel: 37.5, param_in: 'cylindrical', param_ex: 'equalarea' }], ['Homolosine', { name: 'geoHomolosine', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['InterruptedHomolosine', { name: 'geoInterruptedHomolosine', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Loximuthal', { name: 'geoLoximuthal', scale: '400', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['Mercator', { name: 'geoMercator', scale: '375', param_in: 'cylindrical', param_ex: 'conformal' }], ['Miller', { name: 'geoMiller', scale: '375', param_in: 'cylindrical', param_ex: 'aphylactic' }], ['MillerOblatedStereographic', { name: 'geoModifiedStereographicMiller', scale: '375', param_in: 'plan', param_ex: 'conformal' }], ['Mollweide', { name: 'geoMollweide', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['NaturalEarth', { name: 'geoNaturalEarth1', scale: '400', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['NaturalEarth2', { name: 'geoNaturalEarth2', scale: '400', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['Orthographic', { name: 'geoOrthographic', scale: '475', clipAngle: 90, param_in: 'plan', param_ex: 'aphylactic' }], ['Patterson', { name: 'geoPatterson', scale: '400', param_in: 'cylindrical', param_ex: 'aphylactic' }], ['Polyconic', { name: 'geoPolyconic', scale: '400', param_in: 'pseudocone', param_ex: 'aphylactic' }], ['Peircequincuncial', { name: 'geoPeirceQuincuncial', scale: '400', param_in: 'other', param_ex: 'conformal' }], ['Robinson', { name: 'geoRobinson', scale: '400', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['SinuMollweide', { name: 'geoSinuMollweide', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['InterruptedSinuMollweide', { name: 'geoInterruptedSinuMollweide', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Sinusoidal', { name: 'geoSinusoidal', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['InterruptedSinusoidal', { name: 'geoInterruptedSinusoidal', scale: '400', param_in: 'pseudocylindre', param_ex: 'equalarea' }], ['Stereographic', { name: 'geoStereographic', scale: '400', param_in: 'cylindrical', param_ex: 'aphylactic' }], ['TransverseMercator', { name: 'geoTransverseMercator', scale: '400', param_in: 'cylindrical', param_ex: 'conformal' }], ['Werner', { name: 'geoBonne', scale: '400', parallel: 90, param_in: 'pseudocone', param_ex: 'equalarea' }], ['Winkel1', { name: 'geoWinkel1', scale: '200', param_in: 'pseudocylindre', param_ex: 'aphylactic' }], ['WinkelTriple', { name: 'geoWinkel3', scale: '400', param_in: 'pseudoplan', param_ex: 'aphylactic' }]]);\n/* eslint-enable object-curly-newline,max-len */\n\nfunction storePrefProjection(type_proj, name_proj) {\n var props = (0, _helpers.getTargetLayerProps)();\n if (!props) return;\n props.last_projection = [type_proj, name_proj];\n}\n\n/**\n* Function to change (one of more of) the three rotations axis of a d3 projection\n* and redraw all the path (+ move symbols layers) in respect to that.\n*\n* @param {Array} param - The new [lambda, phi, gamma] properties to be used.\n* @return {void}\n*/\nfunction handle_proj_center_button(param) {\n // Fetch the current rotation params :\n var current_rotation = proj.rotate();\n // Reuse it for the missing value passed in arguments and do the rotation:\n // proj.rotate(param.map((val, i) => val !== null ? val : current_rotation[i]));\n proj.rotate(param.map(function (val, i) {\n return val || current_rotation[i];\n }));\n // Redraw the path and move the symbols :\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n}\n\nfunction handle_parallels_change(parallels) {\n var current_values = proj.parallels();\n proj.parallels(parallels.map(function (val, i) {\n return val || current_values[i];\n }));\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n}\n\nfunction handle_parallel_change(parallel) {\n proj.parallel(parallel);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n}\n\nvar createBoxProj4 = function createBoxProj4() {\n (0, _dialogs.make_dialog_container)('box_projection_input', _tr('app_page.section5.title'), 'dialog');\n var container = document.getElementById('box_projection_input');\n var dialog = container.querySelector('.modal-dialog');\n\n var content = d3.select(container).select('.modal-body').attr('id', 'box_proj4');\n\n dialog.style.width = undefined;\n dialog.style.maxWidth = '500px';\n dialog.style.minWidth = '400px';\n\n var input_section = content.append('p');\n input_section.append('span').style('float', 'left').html(_tr('app_page.proj4_box.enter_string'));\n input_section.append('input').styles({ width: '90%' }).attrs({\n id: 'input_proj_string',\n placeholder: 'EPSG:3035'\n // placeholder: '+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs',\n });\n\n var fn_cb = function fn_cb(evt) {\n helper_esc_key_twbs_cb(evt, clean_up_box);\n };\n var clean_up_box = function clean_up_box() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', fn_cb);\n };\n var _onclose_valid = function _onclose_valid() {\n var proj_str = document.getElementById('input_proj_string').value.trim();\n var _p = void 0;\n var error_msg = void 0;\n var custom_name = void 0;\n // Trim the input string from eventual superflous quotes:\n if (proj_str.startsWith('\"') || proj_str.startsWith(\"'\")) {\n proj_str = proj_str.substr(1);\n }\n if (proj_str.endsWith('\"') || proj_str.endsWith(\"'\")) {\n proj_str = proj_str.slice(0, -1);\n }\n // If the string is something like EPSG:xxxx, transform it to an actual proj4 string\n // using a list of EPSG code contained in Magrit:\n if (proj_str.toUpperCase().startsWith('EPSG:')) {\n var code = +proj_str.toUpperCase().split('EPSG:')[1];\n var _rv = _app.epsg_projections[code];\n if (!_rv) {\n error_msg = _tr('app_page.common.missing_epsg');\n proj_str = undefined;\n } else {\n custom_name = _rv.name;\n proj_str = _rv.proj4;\n }\n } else {\n custom_name = tryFindNameProj(proj_str);\n }\n clean_up_box();\n try {\n _p = (0, _proj3.default)(proj_str);\n } catch (e) {\n swal({\n title: 'Oops...',\n text: _tr('app_page.proj4_box.error', { detail: error_msg || e }),\n type: 'error',\n allowOutsideClick: false,\n allowEscapeKey: false\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n return;\n }\n var rv = change_projection_4(_p);\n if (rv) {\n _app.last_projection = proj_str;\n addLastProjectionSelect('def_proj4', _app.last_projection, custom_name);\n _app.current_proj_name = 'def_proj4';\n storePrefProjection('proj4', _app.last_projection);\n } else {\n swal({\n title: 'Oops...',\n text: _tr('app_page.proj4_box.error', { detail: '' }),\n type: 'error',\n allowOutsideClick: false,\n allowEscapeKey: false\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n }\n };\n container.querySelector('.btn_cancel').onclick = clean_up_box;\n container.querySelector('#xclose').onclick = clean_up_box;\n container.querySelector('.btn_ok').onclick = _onclose_valid;\n document.addEventListener('keydown', fn_cb);\n _dialogs.overlay_under_modal.display();\n};\n\nvar displayTooltipProj4 = function displayTooltipProj4(ev) {\n var target = ev.target;\n if (!(target && target.tagName === 'SELECT')) {\n // && target.value === 'last_projection')) {\n return;\n }\n var title = target.tooltip;\n var tooltipWrap = document.createElement('div');\n tooltipWrap.className = 'custom_tooltip';\n tooltipWrap.appendChild(document.createTextNode(title));\n\n var firstChild = document.body.firstChild;\n firstChild.parentNode.insertBefore(tooltipWrap, firstChild);\n\n var linkProps = this.getBoundingClientRect();\n var tooltipProps = tooltipWrap.getBoundingClientRect();\n var topPos = linkProps.bottom - tooltipProps.height / 2;\n tooltipWrap.setAttribute('style', 'top: ' + topPos + 'px; left: ' + (linkProps.right - 15) + 'px;');\n};\n\nvar removeTooltipProj4 = function removeTooltipProj4(ev) {\n var target = ev.target;\n if (!(target && target.tagName === 'SELECT')) {\n // && target.value === 'last_projection')) {\n return;\n }\n var a = document.querySelector('div.custom_tooltip');\n if (a) a.remove();\n};\n\nvar makeTooltipProj4 = function makeTooltipProj4(proj_select, proj4string) {\n proj_select.tooltip = proj4string; // eslint-disable-line no-param-reassign\n proj_select.addEventListener('mouseover', displayTooltipProj4);\n proj_select.addEventListener('mouseout', removeTooltipProj4);\n};\n\nfunction handle_projection_select() {\n var tmp = this.querySelector('[value=\"last_projection\"]');\n var val = this.value;\n if (val === 'more') {\n this.value = tmp && _app.current_proj_name === tmp.name ? 'last_projection' : _app.current_proj_name;\n createBoxCustomProjection();\n return;\n } else if (val === 'proj4') {\n this.value = tmp && _app.current_proj_name === tmp.name ? 'last_projection' : _app.current_proj_name;\n createBoxProj4();\n return;\n } else if (val === 'last_projection') {\n val = tmp.name;\n if (tmp.projValue) {\n _app.last_projection = tmp.projValue;\n }\n } else if (val === 'ConicConformalFrance') {\n val = 'def_proj4';\n _app.last_projection = '+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ';\n } else if (val === 'AzimuthalEqualAreaEurope') {\n val = 'def_proj4';\n _app.last_projection = '+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ';\n }\n\n if (val === 'def_proj4') {\n _app.current_proj_name = val;\n change_projection_4((0, _proj3.default)(_app.last_projection));\n makeTooltipProj4(this, _app.last_projection);\n storePrefProjection('proj4', _app.last_projection);\n } else {\n _app.current_proj_name = val;\n change_projection(_app.current_proj_name);\n storePrefProjection('d3', _app.current_proj_name);\n }\n}\n\nfunction addLastProjectionSelect(proj_name, proj4string, custom_name) {\n var proj_select = document.getElementById('form_projection2');\n if (shortListContent.indexOf(proj_name) > -1) {\n proj_select.value = proj_name;\n } else if (custom_name === 'RGF93 / Lambert-93') {\n proj_select.value = 'ConicConformalFrance';\n } else if (custom_name === 'ETRS89 / LAEA Europe') {\n proj_select.value = 'AzimuthalEqualAreaEurope';\n } else if (proj_select.options.length === 10) {\n var prev_elem = proj_select.querySelector(\"[value='more']\");\n var new_option = document.createElement('option');\n new_option.className = 'i18n';\n new_option.value = 'last_projection';\n new_option.name = proj_name;\n new_option.projValue = proj4string;\n new_option.innerHTML = custom_name || _tr('app_page.projection_name.' + proj_name);\n if (!custom_name) new_option.setAttribute('data-i18n', '[text]app_page.projection_name.' + proj_name);\n proj_select.insertBefore(new_option, prev_elem);\n proj_select.value = 'last_projection';\n } else {\n var option = proj_select.querySelector(\"[value='last_projection']\");\n option.name = proj_name;\n option.projValue = proj4string;\n option.innerHTML = custom_name || _tr('app_page.projection_name.' + proj_name);\n if (!custom_name) option.setAttribute('data-i18n', '[text]app_page.projection_name.' + proj_name);else option.removeAttribute('data-i18n');\n proj_select.value = 'last_projection';\n }\n if (proj4string) {\n makeTooltipProj4(proj_select, proj4string);\n }\n}\n\nvar createBoxCustomProjection = function createBoxCustomProjection() {\n function updateSelect(filter_in, filter_ex) {\n display_select_proj.remove();\n display_select_proj = p.append('select').attrs({ id: 'select_proj', size: 18 }).style('min-width', '195px');\n if (!filter_in && !filter_ex) {\n Array.from(available_projections.keys()).forEach(function (proj_name) {\n display_select_proj.append('option').attrs({ class: 'i18n', value: proj_name, 'data-i18n': 'app_page.projection_name.' + proj_name }).text(_tr('app_page.projection_name.' + proj_name));\n });\n } else if (!filter_ex) {\n available_projections.forEach(function (v, k) {\n if (v.param_in === filter_in) {\n display_select_proj.insert('option').attrs({ class: 'i18n', value: k }).text(_tr('app_page.projection_name.' + k));\n }\n });\n } else if (!filter_in) {\n available_projections.forEach(function (v, k) {\n if (v.param_ex === filter_ex) {\n display_select_proj.append('option').attrs({ class: 'i18n', value: k }).text(_tr('app_page.projection_name.' + k));\n }\n });\n } else {\n var empty = true;\n available_projections.forEach(function (v, k) {\n if (v.param_in === filter_in && v.param_ex === filter_ex) {\n empty = false;\n display_select_proj.append('option').attrs({ class: 'i18n', value: k }).text(_tr('app_page.projection_name.' + k));\n }\n });\n if (empty) {\n display_select_proj.append('option').attrs({ class: 'i18n', value: 'no_result' }).html(_tr('app_page.projection_box.no_result_projection'));\n }\n }\n display_select_proj.on('dblclick', function () {\n if (this.value === 'no_result') return;\n reproj(this.value);\n });\n }\n function onClickFilter() {\n var filter1_val = Array.prototype.filter.call(document.querySelector('.switch-field.f1').querySelectorAll('input'), function (f) {\n return f.checked;\n })[0];\n var filter2_val = Array.prototype.filter.call(document.querySelector('.switch-field.f2').querySelectorAll('input'), function (f) {\n return f.checked;\n })[0];\n filter1_val = filter1_val === undefined ? undefined : filter1_val.value;\n if (filter1_val === 'any') filter1_val = undefined;\n filter2_val = filter2_val === undefined ? undefined : filter2_val.value;\n if (filter2_val === 'any') filter2_val = undefined;\n updateSelect(filter1_val, filter2_val);\n }\n function updateProjOptions() {\n if (proj.rotate) {\n rotate_section.style('display', '');\n var param_rotate = proj.rotate();\n lambda_input.node().value = -param_rotate[0];\n phi_input.node().value = -param_rotate[1];\n gamma_input.node().value = -param_rotate[2];\n } else {\n rotate_section.style('display', 'none');\n }\n if (proj.parallels) {\n var param_parallels = proj.parallels();\n parallels_section.style('display', '');\n parallel_section.style('display', 'none');\n sp1_input.node().value = param_parallels[0];\n sp2_input.node().value = param_parallels[1];\n } else if (proj.parallel) {\n parallels_section.style('display', 'none');\n parallel_section.style('display', '');\n sp_input.node().value = proj.parallel();\n } else {\n parallels_section.style('display', 'none');\n parallel_section.style('display', 'none');\n }\n }\n\n function reproj(value) {\n _app.current_proj_name = value;\n addLastProjectionSelect(_app.current_proj_name);\n change_projection(_app.current_proj_name);\n updateProjOptions();\n storePrefProjection('d3', _app.current_proj_name);\n }\n\n var prev_projection = _app.current_proj_name,\n prev_translate = [].concat(t),\n prev_scale = s,\n prev_rotate = proj.rotate ? proj.rotate() : undefined,\n prev_parallels = proj.parallels ? proj.parallels() : undefined,\n prev_parallel = proj.parallel ? proj.parallel() : undefined;\n\n (0, _dialogs.make_dialog_container)('box_projection_customization', _tr('app_page.section5.title'), 'dialog');\n var container = document.getElementById('box_projection_customization'),\n dialog = container.querySelector('.modal-dialog');\n\n var content = d3.select(container).select('.modal-body').attr('id', 'box_projection');\n\n dialog.style.width = '700px';\n\n content.append('button').attrs({ class: 'accordion_proj active', id: 'btn_choice_proj' }).style('padding', '0 6px').html(_tr('app_page.projection_box.choice_projection'));\n var accordion_choice_projs = content.append('div').attrs({ class: 'panel show', id: 'accordion_choice_projection' }).style('padding', '10px').style('width', '98%');\n var choice_proj_content = accordion_choice_projs.append('div').attr('id', 'choice_proj_content').style('text-align', 'center');\n\n var column1 = choice_proj_content.append('div').styles({ float: 'left', width: '50%' });\n var column3 = choice_proj_content.append('div').styles({ float: 'right', width: '45%' });\n var column2 = choice_proj_content.append('div').styles({ float: 'left', width: '50%' });\n choice_proj_content.append('div').style('clear', 'both');\n\n var filtersection1 = column1.append('div').attr('class', 'switch-field f1');\n filtersection1.append('div').attrs({ class: 'switch-title' }).html(_tr('app_page.projection_box.filter_nature'));\n ['any', 'other', 'cone', 'cylindrical', 'plan', 'pseudocone', 'pseudocylindre', 'pseudoplan'].forEach(function (v, i) {\n var _id = 'switch_proj1_elem_' + i;\n filtersection1.append('input').attrs({\n type: 'radio', id: _id, class: 'filter1', name: 'switch_proj1', value: v\n });\n filtersection1.append('label').attr('for', _id).html(_tr('app_page.projection_box.' + v));\n });\n\n var filtersection2 = column2.append('div').attr('class', 'switch-field f2');\n filtersection2.append('div').attrs({ class: 'switch-title' }).html(_tr('app_page.projection_box.filter_prop'));\n ['any', 'aphylactic', 'conformal', 'equalarea', 'equidistant'].forEach(function (v, i) {\n var _id = 'switch_proj2_elem_' + i;\n filtersection2.append('input').attrs({\n type: 'radio', id: _id, class: 'filter2', name: 'switch_proj2', value: v\n });\n filtersection2.append('label').attr('for', _id).html(_tr('app_page.projection_box.' + v));\n });\n\n Array.prototype.forEach.call(document.querySelectorAll('.filter1,.filter2'), function (el) {\n el.onclick = onClickFilter;\n } // eslint-disable-line no-param-reassign\n );\n\n var p = column3.append('p').style('margin', 'auto');\n var display_select_proj = p.append('select').attrs({ id: 'select_proj', size: 18 });\n\n updateSelect(null, null);\n\n column3.append('button').style('margin', '5px 0 5px 0').attrs({ id: 'btn_valid_reproj', class: 'button_st4 i18n' }).html(_tr('app_page.projection_box.ok_reproject')).on('click', function () {\n var value = document.getElementById('select_proj').value;\n if (value === 'no_result') return;\n reproj(value);\n });\n\n content.append('button').attrs({ class: 'accordion_proj', id: 'btn_choice_proj' }).style('padding', '0 6px').html(_tr('app_page.projection_box.projection_options'));\n var accordion_choice_options = content.append('div').attrs({ class: 'panel', id: 'accordion_choice_projection' }).styles({ padding: '10px', width: '98%' });\n var options_proj_content = accordion_choice_options.append('div').attr('id', 'options_proj_content').styles({ transform: 'translateX(45%)', width: '60%' });\n\n var rotate_section = options_proj_content.append('div').style('display', prev_rotate ? '' : 'none');\n var lambda_section = rotate_section.append('p');\n lambda_section.append('span').style('float', 'left').html(_tr('app_page.section5.projection_center_lambda'));\n var lambda_input = lambda_section.append('input').styles({\n width: '60px', float: 'right', height: '2rem'\n }).attrs({\n type: 'number', min: -180, max: 180, step: 0.50\n }).property('value', prev_rotate ? -prev_rotate[0] : 0).on('input', function () {\n if (this.value > 180) this.value = 180;else if (this.value < -180) this.value = -180;\n handle_proj_center_button([-this.value, null, null]);\n });\n\n var phi_section = rotate_section.append('p').style('clear', 'both');\n phi_section.append('span').style('float', 'left').html(_tr('app_page.section5.projection_center_phi'));\n var phi_input = phi_section.append('input').styles({\n width: '60px', float: 'right', height: '2rem'\n }).attrs({\n type: 'number', min: -180, max: 180, step: 0.5\n }).property('value', prev_rotate ? -prev_rotate[1] : 0).on('input', function () {\n if (this.value > 180) {\n this.value = 180;\n } else if (this.value < -180) {\n this.value = -180;\n }\n handle_proj_center_button([null, -this.value, null]);\n });\n\n var gamma_section = rotate_section.append('p').style('clear', 'both');\n gamma_section.append('span').style('float', 'left').html(_tr('app_page.section5.projection_center_gamma'));\n var gamma_input = gamma_section.append('input').styles({\n width: '60px', float: 'right', height: '2rem'\n }).attrs({\n type: 'number', min: -90, max: 90, step: 0.5\n }).property('value', prev_rotate ? -prev_rotate[2] : 0).on('input', function () {\n if (this.value > 90) {\n this.value = 90;\n } else if (this.value < -90) {\n this.value = -90;\n }\n handle_proj_center_button([null, null, -this.value]);\n });\n\n var parallels_section = options_proj_content.append('div').styles({\n clear: 'both',\n display: prev_parallels ? '' : 'none',\n 'text-align': 'center'\n });\n parallels_section.append('span').html(_tr('app_page.section5.parallels'));\n var inputs = parallels_section.append('p').styles({ 'text-align': 'center', margin: 'auto' });\n\n var sp1_input = inputs.append('input').styles({ width: '60px', display: 'inline', 'margin-right': '2px' }).attrs({\n type: 'number', min: -90, max: 90, step: 0.5\n }).property('value', prev_parallels ? prev_parallels[0] : 0).on('input', function () {\n if (this.value > 90) this.value = 90;else if (this.value < -90) this.value = -90;\n handle_parallels_change([this.value, null]);\n });\n var sp2_input = inputs.append('input').styles({ width: '60px', display: 'inline', 'margin-left': '2px' }).attrs({\n type: 'number', min: -90, max: 90, step: 0.5\n }).property('value', prev_parallels ? prev_parallels[1] : 0).on('input', function () {\n if (this.value > 90) this.value = 90;else if (this.value < -90) this.value = -90;\n handle_parallels_change([null, this.value]);\n });\n\n var parallel_section = options_proj_content.append('div').styles({ 'text-align': 'center', clear: 'both' }).style('display', prev_parallel ? '' : 'none');\n parallel_section.append('span').html(_tr('app_page.section5.parallel'));\n\n var sp_input = parallel_section.append('p').styles({ 'text-align': 'center', margin: 'auto' }).append('input').styles({ width: '60px', display: 'inline', 'margin-right': '2px' }).attrs({\n type: 'number', min: -90, max: 90, step: 0.5\n }).property('value', prev_parallel || 0).on('input', function () {\n if (this.value > 90) this.value = 90;else if (this.value < -90) this.value = -90;\n handle_parallel_change(this.value);\n });\n\n if (prev_projection === 'def_proj4') {\n options_proj_content.selectAll('input').attr('disabled', 'disabled');\n options_proj_content.selectAll('span').styles({ color: 'darkgrey', 'font-style': 'italic' });\n }\n\n (0, _helpers.accordionize2)('.accordion_proj', container);\n var clean_up_box = function clean_up_box() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', fn_cb);\n };\n var fn_cb = function fn_cb(evt) {\n helper_esc_key_twbs_cb(evt, _onclose_cancel);\n };\n var _onclose_cancel = function _onclose_cancel() {\n clean_up_box();\n s = prev_scale;\n t = prev_translate.slice();\n _app.current_proj_name = prev_projection;\n\n if (prev_projection !== 'def_proj4') {\n change_projection(_app.current_proj_name);\n addLastProjectionSelect(_app.current_proj_name);\n storePrefProjection('d3', _app.current_proj_name);\n } else if (prev_projection === 'def_proj4') {\n change_projection_4((0, _proj3.default)(_app.last_projection));\n var custom_name = Object.keys(_app.epsg_projections).map(function (d) {\n return [d, _app.epsg_projections[d]];\n }).filter(function (ft) {\n return ft[1].proj4 === _app.last_projection;\n });\n custom_name = custom_name && custom_name.length > 0 && custom_name[0].length > 1 ? custom_name[0][1].name : undefined;\n addLastProjectionSelect(_app.current_proj_name, _app.last_projection, custom_name);\n storePrefProjection('proj4', _app.last_projection);\n }\n if (prev_rotate) {\n handle_proj_center_button(prev_rotate);\n }\n if (prev_parallels) {\n handle_parallels_change(prev_parallels);\n } else if (prev_parallel) {\n handle_parallel_change(prev_parallel);\n }\n };\n container.querySelector('.btn_cancel').onclick = _onclose_cancel;\n container.querySelector('#xclose').onclick = _onclose_cancel;\n container.querySelector('.btn_ok').onclick = clean_up_box;\n document.addEventListener('keydown', fn_cb);\n _dialogs.overlay_under_modal.display();\n};\n\n// const getD3ProjFromProj4 = function getD3ProjFromProj4(_proj) {\n// // Create the custom d3 projection using proj 4 forward and inverse functions:\n// const projRaw = function (lambda, phi) {\n// return _proj.forward([lambda, phi].map(radiansToDegrees));\n// };\n// projRaw.invert = function (x, y) {\n// return _proj.inverse([x, y]).map(degreesToRadians);\n// };\n// return d3.geoProjection(projRaw);\n// };\n// const pidegrad = 0.017453292519943295;\n// const piraddeg = 57.29577951308232;\n// const degreesToRadians = function degreesToRadians(degrees) { return degrees * pidegrad; };\n// const radiansToDegrees = function radiansToDegrees(radians) { return radians * piraddeg; };\n\n/**\n* Return a d3.geoProjection from a proj4 projection.\n* (code below should avoid some function calls compared to the previous commented\n* section but achieve exactly the same job).\n*\n* @param {Object} _proj - The valid proj4 object returned by proj4.\n* @return {Object} - The projection as a d3.geoProjection.\n*\n*/\nvar getD3ProjFromProj4 = exports.getD3ProjFromProj4 = function getD3ProjFromProj4(_proj) {\n // Create the custom d3 projection using proj 4 forward and inverse functions:\n var projRaw = function projRaw(lambda, phi) {\n return _proj.forward([lambda * 57.29577951308232, phi * 57.29577951308232]);\n };\n projRaw.invert = function (x, y) {\n var p = _proj.inverse([x, y]);\n return [p[0] * 0.017453292519943295, p[1] * 0.017453292519943295];\n };\n return d3.geoProjection(projRaw);\n};\n\nvar tryFindNameProj = exports.tryFindNameProj = function tryFindNameProj(proj_str) {\n var o = Object.entries(_app.epsg_projections).filter(function (proj) {\n return proj[1].proj4.indexOf(proj_str) > -1 || proj[1].proj4.replace('+towgs84=0,0,0,0,0,0,0 ', '').indexOf(proj_str) > -1;\n });\n if (o.length > 0) return o[0][1].name;\n return undefined;\n};\n\nfunction isInterrupted(proj_name) {\n return proj_name.indexOf('interrupted') > -1 || proj_name.indexOf('armadillo') > -1 || proj_name.indexOf('healpix') > -1;\n}\n\nfunction handleClipPath() {\n var proj_name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var main_layer = arguments[1];\n\n var proj_name_lower = proj_name.toLowerCase();\n var defs_sphere = defs.node().querySelector('#sphereClipPath');\n var defs_extent = defs.node().querySelector('#extent');\n var defs_clipPath = defs.node().querySelector('clipPath');\n if (defs_sphere) {\n defs_sphere.remove();\n }\n if (defs_extent) {\n defs_extent.remove();\n }\n if (defs_clipPath) {\n defs_clipPath.remove();\n }\n\n if (isInterrupted(proj_name_lower)) {\n defs.append('path').datum({ type: 'Sphere' }).attr('id', 'sphereClipPath').attr('d', path);\n\n defs.append('clipPath').attr('id', 'clip').append('use').attr('xlink:href', '#sphereClipPath');\n\n map.selectAll('.layer:not(.no_clip)').attr('clip-path', 'url(#clip)');\n\n svg_map.insertBefore(defs.node(), svg_map.childNodes[0]);\n } else if (proj_name_lower.indexOf('conicconformal') > -1) {\n var outline = d3.geoGraticule().extentMajor([[-180, -60], [180, 90]]).outline();\n\n // proj.fitSize([w, h], outline);\n // proj.scale(s).translate(t)\n // path.projection(proj);\n\n defs.append('path').attr('id', 'extent').attr('d', path(outline));\n defs.append('clipPath').attr('id', 'clip').append('use').attr('xlink:href', '#extent');\n\n map.selectAll('.layer:not(.no_clip)').attr('clip-path', 'url(#clip)');\n // map.selectAll('.layer')\n // .selectAll('path')\n // .attr('d', path);\n //\n // reproj_symbol_layer();\n // if (main_layer) {\n // center_map(main_layer);\n // zoom_without_redraw();\n // }\n } else {\n map.selectAll('.layer').attr('clip-path', null);\n }\n}\n\nfunction change_projection(new_proj_name) {\n // Disable the zoom by rectangle selection if the user is using it :\n map.select('.brush').remove();\n\n // Reactivate the graticule and the sphere options:\n d3.select('img#btn_graticule').style('opacity', '1').on('click', function () {\n return (0, _helpers2.add_layout_feature)('graticule');\n });\n d3.select('img#btn_sphere').style('opacity', '1').on('click', function () {\n return (0, _helpers2.add_layout_feature)('sphere');\n });\n\n // Only keep the first argument of the rotation parameter :\n var prev_rotate = proj.rotate ? [proj.rotate()[0], 0, 0] : [0, 0, 0];\n var def_proj = available_projections.get(new_proj_name);\n\n // Update global variables:\n // proj = def_proj.custom ? d3.geoProjection(window[def_proj.name]()).scale(def_proj.scale)\n // : d3[def_proj.name]();\n proj = d3[def_proj.name]();\n if (def_proj.parallels) proj = proj.parallels(def_proj.parallels);else if (def_proj.parallel) proj = proj.parallel(def_proj.parallel);\n if (def_proj.clipAngle) proj = proj.clipAngle(def_proj.clipAngle);\n if (def_proj.rotate) prev_rotate = def_proj.rotate;\n if (proj.rotate) proj.rotate(prev_rotate);\n\n path = d3.geoPath().projection(proj).pointRadius(4);\n\n // According to the availability of the invert method (as they both need it):\n // - Enable or disable the 'brush zoom' button\n // allowing to zoom according to a rectangle selection.\n // - Enable or disable the \"scale bar\" feature.\n if (proj.invert !== undefined) {\n document.getElementById('brush_zoom_button').style.display = '';\n d3.select('img#btn_scale').style('opacity', '1').on('click', function () {\n return (0, _helpers2.add_layout_feature)('scale');\n });\n } else {\n document.getElementById('brush_zoom_button').style.display = 'none';\n d3.select('img#btn_scale').style('opacity', '0.3').on('click', null);\n }\n\n // Reset the zoom on the targeted layer (or on the top layer if no targeted layer):\n var layer_name = Object.getOwnPropertyNames(data_manager.user_data)[0];\n if (!layer_name && def_proj.bounds) {\n (0, _helpers_calc.scale_to_bbox)(def_proj.bounds);\n } else if (!layer_name) {\n var layers_active = Array.prototype.filter.call(svg_map.querySelectorAll('.layer'), function (f) {\n return f.style.visibility !== 'hidden';\n });\n layer_name = layers_active.length > 0 ? global._app.id_to_layer.get(layers_active[layers_active.length - 1].id) : undefined;\n }\n if (layer_name) {\n (0, _interface.scale_to_lyr)(layer_name);\n (0, _interface.center_map)(layer_name);\n (0, _map_ctrl.zoom_without_redraw)();\n } else {\n proj.translate(t).scale(s);\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n }\n\n // Remove the tooltip used for projections using proj4 :\n var a = document.querySelector('div.custom_tooltip');\n if (a) a.remove();\n var selectProj = document.querySelector('#form_projection2');\n selectProj.removeAttribute('tooltip');\n selectProj.removeEventListener('mouseover', displayTooltipProj4);\n selectProj.removeEventListener('mouseout', removeTooltipProj4);\n\n // Set or remove the clip-path according to the projection:\n handleClipPath(new_proj_name, layer_name);\n}\n\nfunction change_projection_4(_proj) {\n (0, _interface.remove_layer_cleanup)('Sphere');\n\n // Disable the \"sphere\" and the \"graticule\" layers only if the projection is a conic one:\n if (global._app.last_projection && (global._app.last_projection.indexOf('=lcc') > -1 || global._app.last_projection.indexOf('Lambert_Conformal_Conic') > -1)) {\n d3.select('img#btn_graticule').style('opacity', '0.3').on('click', null);\n d3.select('img#btn_sphere').style('opacity', '0.3').on('click', null);\n } else {\n d3.select('img#btn_graticule').style('opacity', '1').on('click', function () {\n return (0, _helpers2.add_layout_feature)('graticule');\n });\n d3.select('img#btn_sphere').style('opacity', '1').on('click', function () {\n return (0, _helpers2.add_layout_feature)('sphere');\n });\n }\n // Disable the zoom by rectangle selection if the user is using it :\n map.select('.brush').remove();\n\n // // Only keep the first argument of the rotation parameter :\n // const prev_rotate = proj.rotate ? [proj.rotate()[0], 0, 0] : [0, 0, 0];\n\n proj = getD3ProjFromProj4(_proj);\n path = d3.geoPath().projection(proj).pointRadius(4);\n // According to the availability of the invert method (as they both need it):\n // - Enable or disable the 'brush zoom' button\n // allowing to zoom according to a rectangle selection.\n // - Enable or disable the \"scale bar\" feature.\n if (proj.invert !== undefined) {\n document.getElementById('brush_zoom_button').style.display = '';\n d3.select('img#btn_scale').style('opacity', '1').on('click', function () {\n return (0, _helpers2.add_layout_feature)('scale');\n });\n } else {\n document.getElementById('brush_zoom_button').style.display = 'none';\n d3.select('img#btn_scale').style('opacity', '0.3').on('click', null);\n }\n\n // // Reset the zoom on the targeted layer (or on the top layer if no targeted layer):\n var layer_name = Object.getOwnPropertyNames(data_manager.user_data)[0];\n if (!layer_name) {\n var layers_active = Array.prototype.filter.call(svg_map.querySelectorAll('.layer'), function (f) {\n return f.style.visibility !== 'hidden';\n });\n layer_name = layers_active.length > 0 ? global._app.id_to_layer.get(layers_active[layers_active.length - 1].id) : undefined;\n }\n if (!layer_name || layer_name === 'World' || layer_name === 'Sphere' || layer_name === 'Graticule') {\n (0, _helpers_calc.scale_to_bbox)([-10.6700, 34.5000, 31.5500, 71.0500]);\n } else {\n var rv = (0, _interface.fitLayer)(layer_name);\n s = rv[0];\n t = rv[1];\n if (isNaN(s) || s === 0 || isNaN(t[0]) || isNaN(t[1])) {\n s = 100;t = [0, 0];\n (0, _helpers_calc.scale_to_bbox)([-10.6700, 34.5000, 31.5500, 71.0500]);\n }\n }\n if (isNaN(s) || s === 0 || isNaN(t[0]) || isNaN(t[1])) {\n s = 100;t = [0, 0];\n console.log('Error');\n return false;\n }\n map.selectAll('.layer').selectAll('path').attr('d', path);\n (0, _map_ctrl.reproj_symbol_layer)();\n (0, _interface.center_map)(layer_name);\n (0, _map_ctrl.zoom_without_redraw)();\n\n // Remove the existing clip path if any :\n handleClipPath();\n return true;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/projections.js?");
-
-/***/ }),
-
-/***/ "./js/sample_topo.js":
-/*!***************************!*\
- !*** ./js/sample_topo.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/* eslint-disable */\nvar world_topology = exports.world_topology = { \"type\": \"Topology\", \"objects\": { \"World\": { \"type\": \"GeometryCollection\", \"crs\": { \"type\": \"name\", \"properties\": { \"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\" } }, \"geometries\": [{ \"type\": \"Polygon\", \"properties\": { \"id\": \"1\" }, \"arcs\": [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"2\" }, \"arcs\": [[10]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"3\" }, \"arcs\": [[11]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"4\" }, \"arcs\": [[12]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"5\" }, \"arcs\": [[13]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"6\" }, \"arcs\": [[14]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"7\" }, \"arcs\": [[15]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"8\" }, \"arcs\": [[16]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"9\" }, \"arcs\": [[17]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"10\" }, \"arcs\": [[18]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"11\" }, \"arcs\": [[19]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"12\" }, \"arcs\": [[20]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"13\" }, \"arcs\": [[21]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"14\" }, \"arcs\": [[22]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"15\" }, \"arcs\": [[23]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"16\" }, \"arcs\": [[24]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"17\" }, \"arcs\": [[25]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"18\" }, \"arcs\": [[26]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"19\" }, \"arcs\": [[27]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"20\" }, \"arcs\": [[28]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"21\" }, \"arcs\": [[29]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"22\" }, \"arcs\": [[30]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"23\" }, \"arcs\": [[31]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"24\" }, \"arcs\": [[32]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"25\" }, \"arcs\": [[33]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"26\" }, \"arcs\": [[34]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"27\" }, \"arcs\": [[35]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"28\" }, \"arcs\": [[36]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"29\" }, \"arcs\": [[37]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"30\" }, \"arcs\": [[38]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"31\" }, \"arcs\": [[39]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"32\" }, \"arcs\": [[40]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"33\" }, \"arcs\": [[41]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"34\" }, \"arcs\": [[42]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"35\" }, \"arcs\": [[43]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"36\" }, \"arcs\": [[44]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"37\" }, \"arcs\": [[45]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"38\" }, \"arcs\": [[46]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"39\" }, \"arcs\": [[47]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"40\" }, \"arcs\": [[48]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"41\" }, \"arcs\": [[49], [50], [51], [52], [53], [54]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"42\" }, \"arcs\": [[55]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"43\" }, \"arcs\": [[56]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"44\" }, \"arcs\": [[57]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"45\" }, \"arcs\": [[58]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"46\" }, \"arcs\": [[59]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"47\" }, \"arcs\": [[60]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"48\" }, \"arcs\": [[61]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"49\" }, \"arcs\": [[62]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"50\" }, \"arcs\": [[63]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"51\" }, \"arcs\": [[64]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"52\" }, \"arcs\": [[65]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"53\" }, \"arcs\": [[66]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"54\" }, \"arcs\": [[67]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"55\" }, \"arcs\": [[68]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"56\" }, \"arcs\": [[69]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"57\" }, \"arcs\": [[70]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"58\" }, \"arcs\": [[71]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"59\" }, \"arcs\": [[72]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"60\" }, \"arcs\": [[73]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"61\" }, \"arcs\": [[74]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"62\" }, \"arcs\": [[75]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"63\" }, \"arcs\": [[76]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"64\" }, \"arcs\": [[77]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"65\" }, \"arcs\": [[78]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"66\" }, \"arcs\": [[79]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"67\" }, \"arcs\": [[80]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"68\" }, \"arcs\": [[81]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"69\" }, \"arcs\": [[82]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"70\" }, \"arcs\": [[83]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"71\" }, \"arcs\": [[84]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"72\" }, \"arcs\": [[85]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"73\" }, \"arcs\": [[86]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"74\" }, \"arcs\": [[87]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"75\" }, \"arcs\": [[88]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"76\" }, \"arcs\": [[89]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"77\" }, \"arcs\": [[90]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"78\" }, \"arcs\": [[91]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"79\" }, \"arcs\": [[92]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"80\" }, \"arcs\": [[93]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"81\" }, \"arcs\": [[94]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"82\" }, \"arcs\": [[95]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"83\" }, \"arcs\": [[96]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"84\" }, \"arcs\": [[97]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"85\" }, \"arcs\": [[98]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"86\" }, \"arcs\": [[99]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"87\" }, \"arcs\": [[100]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"88\" }, \"arcs\": [[101]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"89\" }, \"arcs\": [[102]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"90\" }, \"arcs\": [[103]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"91\" }, \"arcs\": [[104]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"92\" }, \"arcs\": [[105]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"93\" }, \"arcs\": [[106]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"94\" }, \"arcs\": [[107]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"95\" }, \"arcs\": [[108]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"96\" }, \"arcs\": [[109]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"97\" }, \"arcs\": [[110]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"98\" }, \"arcs\": [[111]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"99\" }, \"arcs\": [[112]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"100\" }, \"arcs\": [[113]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"101\" }, \"arcs\": [[114]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"102\" }, \"arcs\": [[115]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"103\" }, \"arcs\": [[116]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"104\" }, \"arcs\": [[117]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"105\" }, \"arcs\": [[118]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"106\" }, \"arcs\": [[119]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"107\" }, \"arcs\": [[120]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"108\" }, \"arcs\": [[121]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"109\" }, \"arcs\": [[122]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"110\" }, \"arcs\": [[123]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"111\" }, \"arcs\": [[124]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"112\" }, \"arcs\": [[125]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"113\" }, \"arcs\": [[126]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"114\" }, \"arcs\": [[127]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"115\" }, \"arcs\": [[128]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"116\" }, \"arcs\": [[129]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"117\" }, \"arcs\": [[130]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"118\" }, \"arcs\": [[131]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"119\" }, \"arcs\": [[132]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"120\" }, \"arcs\": [[133]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"121\" }, \"arcs\": [[134]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"122\" }, \"arcs\": [[135]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"123\" }, \"arcs\": [[136]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"124\" }, \"arcs\": [[137]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"125\" }, \"arcs\": [[138]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"126\" }, \"arcs\": [[139]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"127\" }, \"arcs\": [[140]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"128\" }, \"arcs\": [[141]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"129\" }, \"arcs\": [[142]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"130\" }, \"arcs\": [[143]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"131\" }, \"arcs\": [[144]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"132\" }, \"arcs\": [[145]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"133\" }, \"arcs\": [[146]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"134\" }, \"arcs\": [[147]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"135\" }, \"arcs\": [[148]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"136\" }, \"arcs\": [[149]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"137\" }, \"arcs\": [[150]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"138\" }, \"arcs\": [[151]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"139\" }, \"arcs\": [[152]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"140\" }, \"arcs\": [[153]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"141\" }, \"arcs\": [[154]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"142\" }, \"arcs\": [[155]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"143\" }, \"arcs\": [[156]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"144\" }, \"arcs\": [[157]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"145\" }, \"arcs\": [[158]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"146\" }, \"arcs\": [[159]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"147\" }, \"arcs\": [[160]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"148\" }, \"arcs\": [[161]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"149\" }, \"arcs\": [[162]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"150\" }, \"arcs\": [[163]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"151\" }, \"arcs\": [[164]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"152\" }, \"arcs\": [[165]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"153\" }, \"arcs\": [[166]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"154\" }, \"arcs\": [[167]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"155\" }, \"arcs\": [[168]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"156\" }, \"arcs\": [[169]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"157\" }, \"arcs\": [[170]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"158\" }, \"arcs\": [[171]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"159\" }, \"arcs\": [[172]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"160\" }, \"arcs\": [[173]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"161\" }, \"arcs\": [[174]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"162\" }, \"arcs\": [[175]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"163\" }, \"arcs\": [[176]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"164\" }, \"arcs\": [[177]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"165\" }, \"arcs\": [[178]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"166\" }, \"arcs\": [[179]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"167\" }, \"arcs\": [[180]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"168\" }, \"arcs\": [[181]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"169\" }, \"arcs\": [[182]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"170\" }, \"arcs\": [[183]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"171\" }, \"arcs\": [[184]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"172\" }, \"arcs\": [[185]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"173\" }, \"arcs\": [[186]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"174\" }, \"arcs\": [[187]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"175\" }, \"arcs\": [[188]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"176\" }, \"arcs\": [[189]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"177\" }, \"arcs\": [[190]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"178\" }, \"arcs\": [[191]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"179\" }, \"arcs\": [[192]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"180\" }, \"arcs\": [[193]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"181\" }, \"arcs\": [[194]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"182\" }, \"arcs\": [[195]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"183\" }, \"arcs\": [[196]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"184\" }, \"arcs\": [[197]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"185\" }, \"arcs\": [[198]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"186\" }, \"arcs\": [[199]] }, { \"type\": \"Polygon\", \"properties\": { \"id\": \"187\" }, \"arcs\": [[200]] }] } }, \"arcs\": [[[52723, 52414], [-127, 105], [126, 669], [33, 510], [-84, 422], [-180, 81], [-104, 411], [-88, -154], [-268, 35], [-312, -188], [-165, 204], [-197, 789], [-134, 203], [-472, 6], [-302, -89], [-120, -65], [-910, -786], [-286, 204], [1, 10], [76, 24], [-320, 47], [-516, -116], [-469, -390], [-483, 457], [-310, 594], [-300, 427], [-287, 271], [-180, 450], [-40, 502], [-82, 422], [-396, 687], [-147, 441], [-327, 345], [-7, 422], [53, 301], [-171, 614], [176, 665], [139, 1073], [-46, 754], [-87, 240], [91, 471], [-226, 565], [14, 79], [49, 246], [233, 1143], [399, 1359], [253, 339], [172, 711], [414, 239], [253, 382], [256, 655], [-54, 735], [163, 676], [203, 399], [475, 444], [253, 1013], [150, 50], [276, -422], [397, 102], [9, -30], [192, -117], [908, 805], [524, 185], [515, 50], [125, -141], [596, 249], [339, -83], [369, 240], [382, -205], [-89, -541], [49, -473], [-288, -526], [57, -359], [326, -300], [235, -201], [278, 41], [513, -296], [235, -642], [367, -109], [470, -472], [192, 141], [111, 406], [-63, 289], [178, 484], [291, 214], [410, -163], [3, -186], [524, -205], [47, -180], [609, -166], [468, -311], [370, 392], [433, 9], [156, -187], [181, -88], [296, 154], [79, 155], [173, 868], [240, 899], [-16, 730], [30, 581], [-187, -220], [-220, 128], [-242, -359], [-244, -67], [-216, 297], [-373, 201], [-79, -371], [-202, -72], [-204, 362], [-352, -54], [59, 206], [-172, -30], [-41, 469], [-186, 198], [-78, 260], [149, 232], [-175, 288], [184, 535], [671, 17], [22, 465], [556, -86], [581, 534], [731, -163], [138, -285], [522, -186], [503, 3], [383, 340], [-6, 649], [-420, 431], [-280, 438], [-685, 544], [37, 146], [303, -21], [0, 787], [423, 191], [-290, 55], [-643, -260], [-303, -280], [145, -458], [258, 5], [-57, -167], [-583, -407], [-303, 718], [253, 173], [-720, 403], [-443, -617], [19, -197], [-283, -512], [-17, -338], [-264, -739], [108, -280], [152, -336], [159, -95], [-2, -124], [-446, -11], [-193, -223], [-170, -113], [-48, 192], [-279, 154], [-383, -180], [12, -194], [-104, -76], [-141, 159], [-70, -258], [215, -503], [-160, -228], [341, -330], [-242, -497], [68, -423], [-48, -105], [-290, 339], [-77, -169], [-209, 640], [240, 330], [-231, -62], [-321, 801], [-192, 547], [16, 696], [-242, 325], [-234, 273], [-20, 30], [-458, 423], [-228, 338], [-158, 536], [-83, 48], [-45, -263], [-52, 24], [-85, 361], [32, 60], [-359, -91], [-12, -682], [347, -415], [127, -537], [291, -383], [251, 6], [-1, -297], [332, -213], [335, -316], [-54, -215], [-265, 187], [-140, -471], [183, -170], [-244, -813], [-128, 7], [25, 460], [-158, 763], [-525, 680], [-188, -15], [-542, 677], [-274, 930], [-384, 234], [-340, -363], [-18, -29], [-62, -51], [-377, -351], [-532, 281], [-230, -246], [19, -388], [15, -269], [-326, -398], [-297, -135], [-365, -877], [153, -451], [-654, -1151], [-641, -14], [-251, -333], [-153, -56], [-170, 532], [-254, 134], [-440, -98], [56, 770], [-193, 201], [232, 1317], [-26, 561], [-151, 550], [392, 484], [181, -112], [790, -107], [720, 2], [175, 802], [15, 852], [-245, 457], [-481, 538], [-292, 291], [-10, 225], [478, -6], [113, -209], [364, 88], [-138, 543], [197, 38], [262, -225], [493, 541], [7, 375], [261, 126], [237, 218], [115, -8], [32, -2], [-124, 61], [292, 450], [66, 363], [551, 284], [129, -124], [9, 243], [372, -69], [123, 199], [-97, 578], [-149, 954], [198, 303], [228, 105], [261, 283], [-30, -500], [132, -251], [-407, -552], [-17, -391], [453, -421], [398, 227], [489, -184], [577, 271], [549, 123], [276, -144], [172, 296], [308, 114], [5, 445], [179, 854], [246, 118], [168, -256], [195, -21], [115, 339], [-209, 298], [-23, 476], [626, 261], [637, -106], [346, 295], [-144, 229], [-260, 94], [-1267, -364], [-519, 418], [-42, 1273], [596, 601], [550, 912], [-331, 195], [-641, -166], [-297, -954], [-418, -241], [-492, -715], [-95, -707], [521, -695], [-174, -371], [-452, -307], [-28, -654], [-232, -798], [-324, 35], [-90, -359], [-301, -103], [-569, 1725], [58, 375], [-269, 148], [-547, -571], [-547, -79], [-293, 366], [215, 301], [-297, 134], [145, 374], [-216, 369], [140, 798], [553, 237], [22, 181], [582, 570], [438, 704], [332, 198], [215, 780], [321, 359], [316, 570], [557, 389], [323, 572], [1212, 225], [514, 333], [819, 66], [920, -519], [-66, -276], [772, -275], [652, -87], [1403, -852], [-21, -549], [-274, -366], [-563, -12], [-1235, 370], [282, -354], [77, -899], [699, -425], [221, 125], [-457, 508], [157, 148], [975, -364], [-223, 495], [691, 651], [546, -372], [-98, 744], [83, 432], [-219, 395], [728, -96], [216, -346], [-333, -205], [91, -347], [520, 65], [28, 323], [1559, 782], [396, -423], [1116, 472], [525, 487], [933, -172], [1147, -701], [236, 314], [-557, 469], [-49, 925], [431, 309], [142, 501], [726, 468], [343, -465], [-126, -532], [80, -390], [76, -1143], [79, -552], [-473, -807], [-671, -85], [331, -350], [469, 127], [639, 787], [239, 756], [405, -156], [298, 142], [-384, 351], [-582, -5], [31, 596], [-20, 990], [332, -158], [79, -381], [291, -47], [91, 386], [325, 97], [311, 187], [652, -395], [525, -51], [-812, 538], [36, 591], [1653, 190], [-212, 208], [891, 714], [1846, 366], [267, -143], [1442, 767], [644, -49], [1000, -230], [887, 6], [645, -345], [-161, -665], [-1811, -1036], [1260, 283], [721, -101], [1377, 45], [3, -219], [716, -133], [929, 477], [1001, -193], [405, -255], [-293, -601], [278, -367], [327, -222], [548, 531], [308, -258], [649, 114], [578, -236], [444, 116], [-34, 617], [558, 160], [1498, -242], [572, -375], [891, -474], [1605, 96], [472, -217], [0, -449], [237, -306], [518, 183], [1499, 56], [396, -452], [280, 21], [104, 628], [1366, -150], [1228, -512], [-2, -1087], [-3, -1152], [-458, -418], [255, -354], [113, -596], [-186, -195], [-685, -57], [-628, -244], [-712, -561], [-210, -426], [-136, -95], [-321, 347], [-1144, -279], [-482, -269], [-88, -351], [-301, -530], [371, -218], [-151, -544], [162, -336], [-340, -30], [3, -736], [-584, -389], [-117, -529], [-273, -206], [-247, -781], [-289, -378], [-169, 1180], [-155, 1353], [138, 853], [395, 598], [431, 352], [234, 418], [1157, 1271], [158, 764], [-370, -87], [-236, -488], [-629, -633], [54, 788], [-610, -71], [-759, -897], [-62, -627], [-485, -190], [-316, 220], [-478, 351], [-460, -348], [-723, 277], [-881, -207], [-627, -560], [-623, -809], [-302, -496], [-654, -704], [462, -174], [-55, -451], [571, 292], [534, -42], [240, -615], [-27, -710], [-274, -805], [61, -280], [-138, -927], [-251, -381], [-323, -899], [-614, -1052], [-208, -514], [-551, -472], [-396, 279], [-286, -506], [-292, -429], [19, -412], [-610, -627], [-19, -334], [253, -312], [268, -773], [63, -691], [-154, -597], [-328, -236], [-338, -194], [-93, 482], [137, 470], [-113, 482], [139, 195], [-52, 403], [-553, 166], [213, 688], [-299, 454], [-418, -302], [-280, -406], [-195, -82], [174, 371], [-155, 91], [300, 561], [-313, 241], [-205, -419], [-250, -175], [-145, -403], [-349, -44], [-60, -284], [151, -278], [209, 8], [37, -502], [130, -92], [361, 411], [191, -191], [213, 21], [137, -75], [-460, -472], [-384, -579], [-127, -499], [296, -234], [348, -877], [119, -807], [-438, -110], [449, -163], [-359, -370], [192, 31], [168, -289], [-127, -315], [28, -422], [-125, -240], [-261, -692], [-109, -235], [-60, -609], [-112, -139], [-160, -375], [-425, -577], [-173, -361], [-475, -72], [-154, -149], [59, -82], [-21, -123], [-71, -47], [-61, 49], [7, 95], [46, 92], [-204, 208], [66, -376], [14, -37], [25, -70], [-42, -30], [-165, -121], [-325, -167], [-350, -188], [-5, -400], [-172, -132], [-48, 706], [-328, 129], [-158, -123], [-335, -272], [-60, -450], [-151, -134], [-114, -576], [227, -504], [56, -377], [594, -1200], [184, -739], [8, -685], [-48, -348], [-76, -549], [-220, -371], [-265, -192], [-106, -17], [-113, -462], [-481, -551], [39, 726], [-123, 327], [-229, 47], [14, 324], [-161, -74], [-51, 410], [-301, 591], [-275, 20], [35, 440], [-257, -39], [-5, -697], [-239, -1189], [26, -516], [166, 35], [116, -563], [37, -448], [165, -393], [158, -14], [141, -331], [291, -505], [91, -337], [-4, -1056], [239, -873], [-258, 53], [-578, 755], [-157, 587], [-103, 1235], [-62, 247], [-408, 1116], [-127, 89], [152, 1047], [6, 812], [-53, 821], [-116, 290], [-102, 686], [-39, 956], [-208, 481], [-29, -368], [-380, -578], [-338, 162], [111, 882], [-128, 734], [-182, 284], [69, 347], [-282, 198], [-130, 462], [-180, 851], [-183, 21], [-85, 162], [-10, -312], [-415, -414], [-242, -22], [-57, 178], [-335, -399], [44, -290], [-202, -438], [-259, -193], [-350, -751], [-494, -715], [2, -259], [-294, -150], [-69, -273], [-204, -99], [-58, -380], [81, -959], [-135, -765], [-3, -1002], [-163, -160], [-85, -420], [-199, -178], [-54, -326], [-149, -187], [-270, 498], [-280, 1586], [-198, 673], [-154, 1060], [-227, 787], [-221, 2173], [64, 387], [-94, 947], [-115, -100], [-7, -448], [-311, -285], [-257, 252], [-309, 660], [342, 154], [-432, 363], [-122, 375], [-153, -23], [-132, 495], [-251, 467], [-765, -161], [-531, 5], [-468, 73], [-716, 258], [-83, 619], [-187, 202], [-431, -406], [-302, 122], [-359, 540], [-289, 198], [-363, 1270], [-313, 118], [-116, -253], [-162, 19], [135, -837], [122, -535], [314, -458], [39, -624], [185, -568], [-10, 474], [178, 457], [203, -135], [-49, -613], [-209, -253], [98, -213], [109, -136], [600, 72], [490, 1002], [54, 129], [83, -28], [-28, -249], [29, -374], [214, -590], [454, -255], [279, -756], [-354, -1026], [-115, 91], [-112, -473], [39, -426], [-257, -118], [-158, -502], [-250, -56], [-116, -478], [-279, -15], [-259, -197], [-222, -218], [-18, -374], [-736, -506], [-249, -399], [-185, 8], [-365, -362], [-288, -50], [-218, -353], [-259, -76], [-194, 354], [-153, 1443], [25, 376], [-135, 624], [-162, 262], [-332, 1189], [-244, 281], [-157, 492], [0, 709], [-174, 713], [-259, 279], [-81, 533], [-157, 381], [-402, 1267], [-158, 25], [84, 722], [1, 119], [-19, -39], [-224, -973], [-233, 435], [-186, 806], [-65, -205], [148, -588], [178, -357], [140, -776], [416, -1518], [51, -602], [330, -539], [64, -413], [61, -1221], [60, -259], [292, -406], [176, -1092], [134, -486], [400, -359], [144, -404], [401, -710], [72, -405], [-173, -171], [135, -126], [287, -594], [191, -24], [220, 263], [193, -103], [255, 276], [437, 44], [369, 196], [147, 230], [137, -90], [-32, -731], [-93, -638], [-278, -860], [-223, -1047], [-303, -972], [-533, -1163], [-411, -506], [-300, -541], [-385, -854], [-152, -480], [-378, -614], [-176, -961], [-97, -142], [-115, -780], [191, -476], [-51, -836], [134, -964], [187, -284], [28, -1821], [85, -477], [-71, -583], [-204, -549], [-769, -829], [-168, -407], [-483, -757], [222, -1451], [-121, -1260], [-620, -545], [-99, -234], [104, -516], [-142, -983], [-332, -581], [-220, -741], [-512, -988], [-403, -554], [-395, -156], [-228, -225], [-637, 109], [-458, -209], [-267, -259], [-407, 545], [-179, 604], [119, 96], [-28, 567], [-247, 758], [-221, 1022], [-331, 720], [-228, 1822], [-24, 1085], [-278, 841], [-64, 381], [-363, 1159], [-23, 512], [-4, 838], [145, 604], [66, 753], [313, 688], [32, 923], [-210, 894], [103, 444], [-150, 817], [-154, 455], [253, 146], [-271, 56], [-56, 429], [-248, 623], [-337, 712], [-242, 808], [79, 1108], [136, 215]], [[86664, 77890], [100, -404], [251, 583], [-351, -179]], [[58657, 46892], [-162, 622], [-5, 318], [-227, 395], [55, 203], [-81, 845], [-125, 643], [-30, -1001], [112, -942], [190, -383], [107, -489], [166, -211]], [[59464, 51233], [50, 453], [-71, 294], [-202, 81], [-375, -299], [-38, -501], [-48, -597], [60, -379], [388, 103], [236, 845]], [[66682, 77670], [-33, 299], [139, 272], [-2, 146], [-70, 44], [-122, -261], [-162, -17], [-157, -81], [42, -42], [112, -110], [83, -82], [-70, -230], [48, -270], [152, -26], [40, 358]], [[65852, 75988], [80, -123], [80, -76], [67, 107], [-67, 222], [-74, 16], [-86, -146]], [[64565, 75886], [77, 565], [-217, 60], [-454, 1049], [305, 390], [325, 39], [173, 759], [-549, 232], [-551, -457], [-447, -328], [-255, -756], [151, -135], [60, -686], [311, -677], [365, -850], [-126, -168], [-157, -947], [71, -467], [283, -126], [261, -384], [228, -89], [584, 137], [-28, 301], [18, 898], [-114, 603], [-230, 60], [31, 585], [242, -255], [276, 282], [-227, 555], [-142, -16], [-145, -135], [-16, -392], [-103, 353]], [[57678, 85247], [20, 573], [-123, -116], [18, -376], [85, -81]], [[51407, 82322], [21, -127], [68, 53], [5, 132], [-94, -58]], [[59419, 46241], [100, -416], [13, -721], [-80, -285], [82, -696], [74, -103], [74, 35], [-45, 764], [75, 354], [-13, 89], [-7, 13], [-42, 73], [-6, 20], [-120, 879], [-27, 59], [-28, 48], [-3, 7], [-47, -120]], [[52421, 54028], [94, -40], [-100, -355], [-128, 113], [134, 282]], [[99745, 47026], [23, 54], [39, -103], [6, -119], [-33, 0], [-35, 168]], [[99771, 47233], [-53, -108], [-47, 98], [57, 127], [43, -117]], [[70473, 54273], [-3, -58], [-29, -44], [-51, 1], [-28, 47], [6, 65], [36, 46], [42, -3], [27, -54]], [[70391, 54827], [50, 30], [55, -44], [3, -86], [-40, -77], [-61, 13], [-22, 84], [15, 80]], [[70380, 53869], [65, 9], [32, -55], [12, -84], [-24, -48], [-56, -14], [-42, 42], [-8, 62], [21, 88]], [[32840, 61703], [29, -39], [-11, -41], [-39, 12], [-8, 49], [29, 19]], [[64004, 67159], [152, 16], [-63, -409], [-101, 68], [12, 325]], [[28292, 66386], [110, -210], [50, -206], [79, -207], [-6, -103], [-116, 0], [-54, 221], [-83, 121], [-77, 111], [61, 117], [-31, 155], [67, 1]], [[28541, 66314], [66, 44], [97, -28], [7, -89], [-117, -10], [-53, 83]], [[33463, 59361], [-42, 69], [3, 75], [32, -20], [21, -55], [20, -13], [37, 6], [-24, -55], [-47, -7]], [[62184, 44813], [-114, 80], [-53, 139], [-11, 268], [83, 16], [97, -332], [-2, -171]], [[43362, 60942], [212, -71], [79, -216], [-134, -211], [-208, 58], [-56, 218], [107, 222]], [[32931, 60804], [50, -33], [20, -83], [4, -73], [-38, -37], [-26, 75], [-38, 98], [-10, 92], [38, -39]], [[53320, 84087], [116, -347], [-37, -270], [-154, -129], [-46, 190], [-132, 41], [-112, 276], [149, 222], [216, 17]], [[45518, 68312], [38, -139], [-21, -127], [-52, -87], [-97, -10], [-74, 83], [-11, 139], [25, 140], [97, 54], [95, -53]], [[50890, 74810], [105, -121], [-128, -188], [-126, 195], [149, 114]], [[47940, 87630], [228, 248], [66, -164], [-118, -498], [-176, 414]], [[93905, 55860], [39, 92], [78, 6], [13, -99], [-27, -120], [-75, -28], [-42, 66], [14, 83]], [[49302, 80301], [-68, 6], [27, 36], [48, 30], [-7, -72]], [[32900, 58769], [-53, 3], [22, 115], [51, 132], [49, -7], [-25, -147], [-44, -96]], [[48720, 82994], [21, 159], [61, -46], [-42, -163], [-40, 50]], [[54348, 73970], [0, -249], [-149, -338], [55, -136], [-67, -293], [-735, 662], [92, 215], [364, -74], [440, 213]], [[52533, 75595], [67, 18], [129, -435], [-75, -795], [-195, -151], [-134, 203], [17, 412], [-56, 555], [247, 193]], [[49410, 80211], [48, -21], [-4, -44], [-75, 22], [31, 43]], [[5845, 53105], [71, 63], [103, -18], [51, -131], [-52, -125], [-105, -43], [-67, 105], [-1, 149]], [[32592, 61827], [48, -92], [-3, -55], [-33, 12], [-15, 58], [-44, 46], [-12, 55], [13, 28], [46, -52]], [[33069, 59738], [-35, 53], [0, 121], [56, 73], [25, -74], [-5, -149], [-41, -24]], [[97513, 55954], [34, -26], [68, 2], [17, 37], [-17, 61], [35, -45], [-4, -44], [-22, -31], [-84, -14], [-55, 30], [-15, 98], [43, -68]], [[54040, 72433], [-90, 6], [-34, 130], [57, 97], [108, -98], [-41, -135]], [[66031, 40264], [25, -109], [-37, -112], [-85, 12], [-16, 115], [47, 86], [66, 8]], [[96394, 51519], [-21, -13], [-19, 10], [-8, 28], [9, 27], [18, 8], [19, -10], [5, -25], [-3, -25]], [[87404, 56211], [25, 121], [47, 98], [-9, -152], [-40, -186], [-80, -201], [-45, -29], [36, 183], [66, 166]], [[78965, 52628], [-32, -76], [-74, -21], [-72, 42], [-49, 100], [227, -45]], [[51857, 51880], [-55, 27], [-26, 94], [15, 98], [58, 44], [70, -32], [12, -105], [-27, -78], [-47, -48]], [[65412, 49233], [40, -73], [15, -203], [-51, 43], [-42, 135], [38, 98]], [[1320, 39750], [117, -57], [-87, -159], [-75, 148], [45, 68]], [[32999, 59383], [0, 100], [5, 59], [29, 10], [27, -23], [-14, -142], [-34, -110], [-13, 106]], [[2148, 44096], [251, -309], [-87, -44], [-243, 131], [-64, 177], [143, 45]], [[34952, 54919], [63, 229], [264, -166], [277, -464], [87, -353], [98, -74], [66, -308], [174, -899], [155, -87], [5, -287], [-322, -709], [-287, -503], [228, 117], [241, 382], [228, -2], [285, -162], [-97, -885], [132, 143], [107, 567], [518, -150], [458, -533], [43, -405], [294, 117], [297, -281], [626, -8], [419, -489], [360, -699], [465, -134], [198, -1160], [-4, -431], [-137, -741], [-307, -754], [-137, -156], [-319, -1076], [-187, 10], [-88, -428], [-7, -754], [56, -673], [-76, -1057], [-163, -484], [4, -517], [-378, -1213], [29, -245], [-278, -338], [-25, -241], [-502, 27], [-232, -116], [-204, -321], [-426, -365], [-238, -343], [-209, -564], [-66, -1576], [-277, -480], [-140, -587], [-592, -1470], [49, 200], [288, 717], [109, 443], [-119, 16], [-74, -288], [-118, -319], [-183, -820], [-211, -367], [-107, -375], [-326, -333], [-381, 36], [-225, 256], [-204, -5], [-148, 305], [52, 861], [-103, -1061], [396, -689], [-29, -395], [162, -392], [-258, -750], [-408, -311], [-682, -183], [-242, 113], [102, -317], [-130, -543], [43, -325], [-401, -165], [-308, 261], [-50, -737], [350, -49], [52, -392], [-227, 140], [1, -270], [-250, -401], [-74, -781], [-166, 20], [-315, -357], [-80, -317], [232, -485], [224, -35], [3, -565], [-441, -558], [-77, -540], [-290, -217], [-81, -373], [200, -788], [-276, 54], [-393, -277], [-49, -620], [-601, 328], [-215, 263], [-196, 625], [-107, 709], [199, 220], [-78, 1335], [235, 518], [-308, -268], [-150, 46], [17, 464], [127, 549], [138, 613], [155, -51], [-38, -692], [-88, -388], [173, 42], [94, 786], [18, 451], [228, 1261], [-137, 289], [-223, -153], [-52, 447], [65, 573], [131, 281], [-119, 1020], [128, 322], [156, 918], [116, 259], [168, 907], [59, 675], [-62, 1228], [97, 189], [-66, 559], [97, 333], [203, 1737], [-39, 473], [146, 1780], [-93, 1783], [-276, 375], [-35, 232], [-608, 613], [-413, 497], [-306, 735], [19, 417], [-396, 1190], [-372, 1771], [-272, 823], [-315, 412], [-42, 1056], [253, 487], [107, 113], [-7, 267], [-95, 13], [-117, 351], [-48, 597], [236, 644], [6, 453], [293, 162], [45, 181], [137, 698], [155, -40], [207, 775], [-112, 134], [26, 1376], [-154, 398], [-161, 384], [79, 301], [-203, 214], [-229, -83], [-201, -248], [132, -413], [-189, -88], [-87, 186], [-125, 138], [-303, 136], [-102, -66], [-234, 339], [30, 237], [-291, 355], [-122, -55], [-210, 460], [48, 418], [-541, 1032], [93, 63], [-140, 245], [-269, -93], [-363, 278], [-340, 131], [-258, 340], [-459, 889], [-265, 196], [-162, -262], [-311, -182], [-338, 185], [-301, 316], [-612, 424], [-209, 360], [-469, 256], [-134, 311], [-288, 285], [-189, 598], [139, 625], [-167, 660], [-690, 1422], [-321, 395], [59, 312], [-386, 851], [-176, 138], [-251, 539], [-271, 1051], [22, 199], [-523, 433], [76, -994], [504, -1004], [20, -332], [266, -662], [407, -1498], [243, -319], [-117, -395], [-114, 384], [-495, 710], [-71, 809], [-228, 352], [-131, -37], [-394, 654], [246, 52], [35, 292], [-459, 748], [-103, 609], [-294, 990], [-268, 690], [-335, 314], [-327, 101], [-48, 397], [-178, 302], [-310, 881], [-75, 425], [-293, 568], [-35, 527], [-154, 352], [96, 571], [-135, 812], [110, 597], [70, 1651], [-237, 819], [706, -105], [-150, 579], [-45, 0], [-680, 894], [-241, -29], [-435, 430], [-18, 561], [-282, 628], [-440, 601], [139, 533], [-278, 5], [-109, 342], [-254, 330], [-548, 1016], [-432, 271], [-297, -182], [-395, 410], [-566, 358], [-687, 237], [-311, -67], [-870, 584], [-368, -133], [-17, -472], [-265, 22], [-492, -455], [-201, 333], [88, 696], [-413, -740], [-303, -189], [238, -310], [-244, -361], [-515, -369], [-147, -342], [-523, -314], [-78, -278], [-310, -59], [-659, -468], [-315, 46], [419, 438], [346, 63], [799, 949], [172, 720], [-297, -157], [-496, 140], [-395, -114], [-323, 771], [-303, -114], [-504, 434], [212, 157], [-426, 442], [-47, 865], [618, 96], [221, -133], [711, 412], [-109, 687], [-542, -303], [-849, 99], [-525, 580], [934, 555], [288, -275], [417, -1], [68, 388], [-487, 203], [-281, 396], [-513, 328], [86, 297], [525, 31], [678, 802], [1073, 297], [341, 270], [1343, -494], [692, 43], [1361, -311], [358, 77], [638, -268], [1427, -429], [806, 701], [1425, 66], [527, -475], [256, 367], [236, -344], [338, 222], [423, -41], [941, -428], [835, -86], [313, -274], [-452, -268], [465, -137], [1329, 15], [420, -650], [-199, 1168], [558, 164], [496, -503], [605, -179], [1003, 23], [-6, 349], [472, -25], [155, -490], [810, 628], [-216, 512], [-555, 287], [-155, 612], [647, 569], [433, -371], [291, -768], [-78, -313], [495, -352], [417, 209], [255, -244], [-63, -595], [485, -229], [329, 1422], [751, -116], [375, -580], [-335, -89], [343, -590], [-81, -267], [-601, -459], [-601, -21], [-424, -480], [-641, 355], [180, -356], [584, -107], [-290, -548], [-501, 34], [-131, -370], [-822, 175], [676, -296], [39, -189], [-503, -159], [-425, -769], [-233, -870], [107, -705], [356, 12], [204, -801], [-79, -230], [465, 178], [598, -233], [361, -468], [824, -462], [656, -73], [-14, -1239], [533, -936], [177, -84], [346, 668], [-51, 360], [-175, 697], [-125, 266], [381, 216], [482, 602], [19, 690], [-136, 398], [-415, 411], [371, 766], [-258, 497], [172, 355], [-169, 468], [184, 168], [756, -248], [306, 187], [638, -768], [455, -201], [-11, -283], [53, -470], [306, -543], [403, -211], [355, 244], [467, 1063], [412, -1072], [392, -959], [182, -649], [445, -544], [435, -167], [-416, -359], [400, 79], [214, -352], [230, -80], [36, -702], [-356, -395], [-413, -63], [-382, -569], [-566, -56], [-1263, 19], [-268, -533], [-470, -335], [2, -148], [644, 361], [221, 165], [187, 53], [199, -148], [80, -268], [-69, -245], [-163, -246], [-36, -523], [200, -451], [568, -360], [154, 173], [255, -335], [-604, -435], [-315, -7], [-325, -631], [-153, 134], [8, 505], [459, 425], [-114, 179], [-320, -241], [-352, -18], [-208, -366], [-371, -34], [-367, -696], [-54, -291], [39, -344], [193, -242], [-19, -100], [-409, -56], [-392, -137], [-211, -143], [-59, -192], [540, 211], [76, -175], [-639, -384], [45, -226], [-240, -479], [-173, 203], [108, -428], [2, -449], [-150, -239], [-87, 352], [-181, 481], [75, -565], [43, -363], [69, -190], [-99, -789], [-145, 95], [17, -471], [-170, -29], [-249, -455], [-203, -65], [-117, -343], [-319, -402], [-278, -542], [-52, -397], [217, -1429], [195, -900], [-130, -928], [-161, -46], [-176, 453], [-94, 552], [-216, 588], [57, 568], [-387, 711], [-240, -217], [-410, 375], [-693, 15], [-173, -189], [-67, -253], [70, -320], [-220, -30], [-296, 151], [-144, 309], [-120, -171], [-256, 138], [-469, -229], [-198, -353], [-234, -96], [-308, -914], [115, -601], [-143, -835], [-66, -1106], [206, -1123], [388, -1083], [357, -358], [843, 423], [195, 286], [103, 936], [159, 163], [507, 182], [315, -96], [-13, -333], [-241, -714], [86, -71], [-110, -718], [-73, 73], [-53, -456], [18, -360], [-133, -641], [132, -67], [138, 113], [385, -81], [116, 128], [452, -111], [58, -260], [265, -209], [-122, -985], [21, -511], [-104, -590], [62, -259], [298, -777], [91, -324], [261, -134], [353, 445], [285, -9], [273, -180], [181, -323], [118, -69], [369, 522], [31, 653], [185, 302], [134, -193], [48, 312], [249, -13], [312, 475], [29, 134], [102, 65], [106, -126], [-3, -228], [-176, -149], [98, -505], [-144, -512], [169, -447], [132, 410], [-132, 604], [397, 373], [50, 108], [-106, 80], [-18, 137], [67, 76], [104, -79], [8, -294], [235, -31], [256, -568], [469, 105], [118, -238], [300, -74], [171, 296], [393, 80], [113, -179], [-84, -406], [271, 89], [237, -322], [-74, -442], [286, -8], [238, -287], [305, -713], [250, -424], [-22, -346], [61, 320], [826, -145], [-33, -254]], [[25116, 79484], [-397, -290], [-301, -397], [142, -117], [194, 212], [125, -226], [596, 623], [68, -116], [-16, -260], [264, -268], [611, 142], [128, -189], [-98, 840], [-282, 39], [-160, 443], [-510, 136], [-364, -572]], [[26637, 78534], [-175, -282], [-629, 30], [-177, -520], [86, -117], [-161, -885], [24, -569], [147, -375], [176, 143], [121, 627], [-89, 382], [76, 611], [284, 393], [196, 146], [286, -153], [44, -593], [184, -235], [76, -521], [191, 210], [125, 706], [-91, 371], [416, -447], [91, 199], [-270, 637], [-931, 242]], [[27043, 76351], [-226, -481], [265, -188], [231, 73], [611, 510], [168, 252], [-16, 58], [-676, -171], [-351, -352], [-6, 299]], [[28039, 76766], [652, 35], [256, 667], [-346, -302], [-570, -84], [-191, -286], [199, -30]], [[30823, 42305], [116, 195], [-208, 400], [-180, -194], [251, -216], [41, 5], [-20, -190]], [[52621, 76475], [6, -441], [-23, -331], [-58, -12], [-77, 95], [-69, 390], [30, 166], [115, 52], [5, 105], [71, -24]], [[32806, 61180], [46, 92], [72, -80], [46, 133], [33, -144], [-8, -124], [-93, 47], [-48, -69], [-48, 145]], [[33165, 60197], [-31, -80], [-78, 31], [-30, 76], [-15, 115], [40, 54], [72, -83], [42, -113]], [[65484, 39987], [81, -29], [40, -94], [-13, -104], [-99, 15], [-51, 69], [-10, 99], [52, 44]], [[89749, 83174], [148, -902], [-58, -494], [294, -1550], [-340, 61], [-141, -774], [230, -865], [-240, 125], [-35, -406], [-137, -91], [-76, 403], [103, 786], [-32, 501], [127, 1356], [-119, 429], [12, 901], [125, 91], [46, 300], [93, 129]], [[12, 89353], [3, 1217], [1, 974], [1517, -1101], [823, -84], [420, -456], [-140, -244], [-409, -122], [-292, -712], [-623, 340], [-208, 386], [-655, 13], [-437, -211]], [[64052, 91773], [-307, -404], [-285, -8], [-17, 447], [283, 370], [283, -92], [43, -313]], [[21, 92731], [1, 298], [344, 35], [403, -224], [-748, -109]], [[89728, 94628], [413, -100], [-306, -443], [-810, 80], [703, 463]], [[90757, 95319], [974, -53], [777, -41], [-1350, -300], [-401, 394]], [[88641, 95670], [627, 48], [1115, -385], [-465, -326], [-1212, -149], [-610, 257], [-23, 341], [568, 214]], [[68651, 95674], [-1602, -444], [-620, -512], [-186, -152], [-385, -356], [-412, -696], [138, -631], [426, -305], [-688, -102], [-548, 161], [-267, 491], [390, 1195], [1472, 1214], [1118, 196], [715, 216], [312, -31], [137, -244]], [[78591, 97501], [521, -346], [-1643, -645], [672, 969], [450, 22]], [[77159, 97993], [700, -292], [-233, -632], [-1274, 38], [-442, 553], [1249, 333]], [[63563, 98386], [798, -78], [904, 59], [596, 97], [644, 10], [-1383, -924], [-752, -157], [-510, 266], [-297, 727]], [[76802, 98861], [546, -404], [-1528, -412], [982, 816]], [[30936, 21519], [49, -379], [547, -673], [369, -100], [-385, -237], [-587, 95], [-585, 26], [-268, 251], [326, 226], [37, 577], [278, 322], [219, -108]], [[99999, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-3, 0], [-135, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-123, 0], [-16, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [-139, 0], [-138, 0], [-139, 0], [0, 271], [0, 271], [0, 271], [0, 271], [0, 271], [0, 271], [0, 271], [0, 271], [0, 272], [0, 271], [0, 271], [0, 271], [1830, -95], [748, 760], [3657, -111], [307, 1291], [2047, 963], [-2069, 469], [-586, 460], [198, 465], [1781, -207], [657, -152], [1056, 359], [-792, 559], [552, 99], [2476, 384], [543, 396], [410, -212], [1924, 145], [1435, -63], [1091, 159], [1283, 62], [28, -274], [840, 190], [131, -400], [884, -43], [875, 134], [607, -200], [753, 113], [-832, 422], [-415, 529], [48, 338], [1389, -16], [3315, -83], [552, -331], [712, 8], [440, 398], [668, -445], [1931, 299], [773, 264], [212, 428], [15, 813], [-317, 601], [275, 266], [-41, 983], [311, 673], [555, 722], [435, 417], [395, 241], [708, 365], [357, -14], [-806, -654], [-624, -504], [-61, -217], [-313, -176], [-342, -596], [24, -629], [264, -264], [373, -543], [85, -595], [324, -455], [284, -953], [-216, -767], [-689, -625], [-1926, -729], [-2060, 69], [551, -568], [779, -20], [-603, -341], [-757, 72], [57, -217], [-801, -246], [-964, 506], [-33, -260], [960, -483], [1083, -31], [224, -868], [1278, 125], [1653, -524], [923, -1069], [661, -53], [1308, 668], [2356, 225], [630, -277], [804, 671], [1600, 351], [1555, 254], [-254, 338], [-1549, 424], [703, 888], [1350, 551], [809, 242], [1965, 394], [394, 526], [473, -54], [386, 330], [-368, 139], [341, 263], [862, 439], [143, 468], [386, 280], [500, -322], [-57, 479], [606, 54], [-132, -365], [1773, 9], [635, 259], [1847, 341], [746, -272], [310, 423], [244, -174], [1179, -112], [864, -155], [166, 332], [423, -331], [119, 235], [748, -363], [944, 415], [806, 172], [-51, 666], [733, -252], [12, -254], [707, 31], [257, -292], [318, 783], [2106, 818], [355, -157], [139, 497], [489, -201], [-182, 446], [948, 315], [521, -104], [1084, -910], [307, 119], [842, -59], [1313, -226], [327, 90], [174, -435], [-132, -480], [-688, -563], [545, -234], [-484, -682], [-125, -581], [731, 273], [833, 1288], [1448, 613], [358, 566], [1620, 617], [834, 176], [669, -29], [441, 186], [494, -144], [1330, 172], [83, -265], [697, 556], [715, -20], [1174, -372], [641, -19], [134, 347], [633, 167], [716, -589], [-14, -280], [732, 131], [145, -215], [1947, 641], [224, -311], [655, -189], [463, 592], [851, 24], [88, -230], [569, 149], [1172, -310], [859, -35], [331, -156], [217, -230], [788, -555], [1546, -162], [-3, 280], [699, -535], [945, -172], [621, -819], [29, 351], [1558, -275], [731, -582], [-195, -715], [-1400, -509], [-667, -842], [231, -936], [852, -895], [-1498, -271], [191, -524], [-348, -723], [2350, -1034], [3169, -780], [0, -271], [0, -271], [0, -271], [0, -272], [0, -271], [0, -271], [0, -271], [0, -271], [0, -271], [0, -271], [0, -271], [0, -271]], [[33312, 5936], [-160, -729], [-1680, 315], [1217, 262], [623, 152]], [[5474, 6183], [340, -319], [-1844, -177], [932, 791], [572, -295]], [[31435, 6660], [-975, -726], [-69, 468], [1044, 258]], [[37402, 6513], [448, -62], [58, -806], [-2953, -390], [227, 443], [856, 329], [330, 861], [872, 129], [588, -248], [-426, -256]], [[16335, 9502], [-142, -508], [-378, 409], [520, 99]], [[14976, 9617], [569, -197], [8, -356], [-906, 314], [329, 239]], [[29462, 10104], [106, -424], [-714, 20], [608, 404]], [[23128, 10579], [340, -443], [-1032, 15], [-851, 144], [963, 211], [580, 73]], [[30549, 11985], [479, -966], [-165, -696], [-596, -349], [-381, 353], [-443, -59], [-376, 144], [428, 419], [406, -45], [365, 164], [90, 352], [-336, 244], [-24, 575], [553, -136]], [[90109, 28535], [481, -348], [527, 265], [128, -218], [-49, -743], [-96, -548], [-165, -31], [-143, -209], [-231, 50], [-210, 546], [-242, 1236]], [[88211, 31313], [78, -352], [-389, 41], [-57, 380], [368, -69]], [[86176, 45448], [285, 61], [168, -280], [-245, -209], [-283, 72], [75, 356]], [[89596, 45671], [147, -933], [99, -164], [27, -655], [114, -438], [149, 202], [241, -451], [15, -864], [208, -685], [35, -716], [391, -549], [244, -129], [186, -598], [196, -643], [247, -283], [-3, -411], [268, -352], [396, -1101], [0, -640], [111, -1049], [-296, -2059], [-196, -244], [-252, -844], [-46, -489], [-169, -412], [-40, -1039], [-473, -72], [-426, -459], [-96, -297], [-292, 349], [-511, -189], [-316, 283], [-207, -19], [-359, 298], [-172, 404], [31, 322], [-164, 431], [-295, 116], [93, 536], [-64, 322], [-189, -452], [-125, 1005], [-275, -321], [-161, -634], [-192, 621], [-226, 724], [-518, 295], [-294, 320], [-607, -123], [-473, -335], [-306, 23], [-575, -512], [-164, -470], [-554, 68], [-425, -61], [-449, -566], [-485, -82], [-422, 396], [-37, 485], [189, 135], [4, 944], [-196, 826], [1, 423], [-226, 791], [-43, 455], [-88, 235], [-143, 322], [-99, 465], [230, -161], [110, 70], [-93, 331], [-83, 620], [93, 309], [-28, 538], [101, 414], [100, -83], [76, 92], [225, 190], [379, 555], [148, -102], [218, 210], [783, 420], [241, 681], [139, 173], [-42, 513], [219, 392], [165, -541], [85, 178], [-89, 544], [188, 60], [48, 368], [150, 106], [118, 480], [507, 463], [276, -574], [399, -141], [-70, 308], [214, 845], [241, 406], [467, 57], [-29, 375], [146, 50], [118, -264], [251, -73], [320, -91], [242, 115], [133, -234], [-77, -383], [-197, -140], [-9, -540], [-148, -298], [369, -693], [648, -576], [267, -456], [231, 147], [167, 800], [45, 2037], [161, 919], [104, 128]], [[81666, 54489], [309, 224], [204, 328], [258, 845], [269, -367], [8, -277], [177, -65], [238, -342], [-193, -176], [20, -261], [-299, -163], [-34, -418], [179, -675], [-63, -217], [317, -532], [-331, -87], [-103, -770], [-295, -714], [62, -264], [-177, -798], [-373, -323], [-25, 256], [-250, 155], [-143, 126], [-139, -107], [-221, -70], [-132, 289], [-301, 23], [-95, 1094], [-180, 144], [7, 498], [-123, 473], [67, 420], [152, 301], [158, -246], [260, 155], [81, 434], [435, 278], [276, 829]], [[31432, 20057], [-213, -172], [-247, -11], [-131, -232], [-141, -57], [-107, 126], [-130, 115], [-99, 307], [327, -6], [247, -9], [494, -61]], [[29676, 21015], [476, -253], [-215, -133], [-261, 386]], [[29257, 23038], [-134, -153], [-136, 581], [13, 631], [166, 89], [12, -569], [79, -579]], [[29474, 27613], [168, 73], [-134, -1022], [-195, 36], [161, 913]], [[29140, 63299], [-38, 2], [-696, -26], [182, 351], [-273, 142], [-195, 535], [-313, 34], [-155, 213], [-381, 69], [-15, 283], [-251, 9], [-176, -293], [-307, -230], [123, 506], [516, 304], [444, -60], [540, -422], [254, -313], [489, -424], [81, -223], [261, -37], [140, -321], [-230, -99]], [[59170, 71751], [-120, 63], [-56, 141], [57, 163], [118, 13], [20, 117], [157, -30], [233, 162], [-161, -292], [35, -127], [-104, -78], [-37, -103], [-142, -29]], [[30067, 63192], [205, 129], [312, -172], [80, -313], [348, -251], [-137, -163], [-515, 32], [-198, -475], [-100, 250], [-82, 114], [-438, 13], [-142, 230], [285, -97], [103, 224], [-112, 610], [391, -131]], [[99996, 42523], [2, -310], [-315, -200], [-72, 228], [385, 282]], [[99519, 41844], [117, -203], [20, -261], [-105, -144], [-174, 21], [-135, 161], [-13, 272], [97, 182], [193, -28]], [[33555, 22281], [-414, -543], [123, 709], [291, -166]], [[33671, 22279], [359, -43], [-95, -255], [-363, -216], [-244, -4], [343, 518]], [[47986, 83558], [319, 82], [157, -319], [-204, -323], [76, -652], [-193, -577], [-557, -223], [-468, 174], [80, 389], [148, 342], [-171, 153], [92, 527], [382, -30], [53, 510], [286, -53]], [[49070, 85622], [-203, -409], [644, -270], [-394, -816], [429, -272], [545, -1439], [400, -346], [-220, -381], [105, -399], [-301, -221], [-359, 55], [-687, -170], [-42, -186], [-498, -18], [527, 694], [-486, 298], [304, 209], [12, 546], [269, 86], [108, 431], [-660, 509], [154, 280], [-254, 331], [-181, 485], [104, 537], [228, 452], [456, 14]], [[56639, 72302], [518, -110], [132, -171], [-418, -62], [-339, 209], [107, 134]], [[56498, 74314], [253, -249], [-14, -173], [-314, 299], [75, 123]], [[35353, 92117], [163, -260], [-300, -105], [-423, 201], [81, 385], [479, -221]], [[42931, 92514], [-521, -239], [-125, 117], [37, 147], [620, 199], [228, -55], [63, -228], [-302, 59]], [[41053, 99999], [3019, -569], [-14, -312], [37, -326], [1042, -75], [476, 256], [625, -359], [-624, -463], [-914, -74], [34, -649], [-28, -597], [203, -521], [-938, -549], [490, 1], [142, -594], [-651, -454], [341, -570], [-492, -114], [-465, 200], [-600, -205], [445, -471], [777, -538], [76, -544], [-519, -60], [-256, 369], [-365, 61], [-650, -177], [-87, -293], [264, -219], [549, 243], [815, -172], [-1087, -818], [-1034, -328], [-552, -43], [-542, -748], [-591, -470], [-569, -69], [-815, -413], [151, -791], [-531, -511], [-198, -1589], [-383, -24], [-310, 353], [-393, 143], [-443, 196], [-671, 1120], [-307, 618], [-299, 823], [-202, 802], [375, 834], [408, 22], [51, 703], [-1004, 535], [195, 156], [404, -123], [-74, 378], [-387, 167], [-506, -20], [-103, 588], [68, 319], [-212, 474], [-271, 455], [-569, 597], [-1017, 271], [-1376, -172], [-549, 414], [-247, 518], [-444, 263], [85, 212], [1479, 269], [343, 211], [-726, 258], [505, 193], [1618, 779], [1822, 508], [1092, -336], [-166, 415], [1653, -414], [397, 355], [3200, 695]], [[83336, 46449], [248, -120], [131, -237], [-199, -102], [-203, 162], [-275, 174], [298, 123]], [[84738, 46375], [-178, -390], [-350, -214], [-47, 343], [180, 285], [67, 192], [166, 81], [110, 60], [75, 135], [490, 295], [237, -105], [-342, -267], [-408, -415]], [[82450, 47053], [-65, -308], [-147, 56], [51, 273], [161, -21]], [[82769, 47173], [282, -120], [15, -185], [-199, -20], [-242, -94], [-132, 53], [46, 253], [230, 113]], [[84455, 47255], [-1, -122], [-290, -164], [-52, -90], [-376, -216], [-426, 66], [-49, 259], [131, 74], [370, -36], [693, 229]], [[82081, 47144], [114, -162], [-103, -123], [-127, 64], [-92, 121], [4, 91], [204, 9]], [[88478, 47142], [-305, -176], [-54, 400], [137, 277], [227, 89], [73, -267], [-78, -323]], [[81944, 47870], [-95, -176], [-308, -22], [-141, 188], [544, 10]], [[79488, 48377], [331, -41], [305, -166], [153, -248], [409, -84], [159, 218], [433, -194], [172, -408], [346, -126], [-31, -333], [67, -211], [-389, 287], [-146, -98], [-610, 193], [-340, 221], [-257, -51], [-501, 234], [4, 247], [-301, 100], [-32, 186], [228, 274]], [[87383, 48714], [153, 78], [18, -490], [-26, -298], [-193, -93], [24, 391], [24, 412]], [[85297, 50004], [48, -242], [-140, -146], [-174, 59], [-34, 293], [141, 136], [159, -100]], [[85861, 50194], [555, -304], [-72, -277], [-259, 191], [-246, 74], [-248, -19], [-94, 283], [364, 52]], [[79957, 50370], [108, -98], [17, -184], [-109, -98], [-129, 92], [-3, 220], [116, 68]], [[84591, 50897], [745, 16], [-76, -253], [-704, 24], [35, 213]], [[87632, 50923], [-46, 267], [219, -101], [249, 36], [-4, -250], [-226, -18], [-192, 66]], [[79409, 50981], [159, -476], [133, -173], [-21, -161], [-147, -97], [-47, 191], [-96, 309], [-185, 57], [-30, 260], [88, -2], [146, 92]], [[77461, 51384], [113, -302], [51, -238], [-88, -48], [-101, 170], [-99, 277], [25, 177], [99, -36]], [[89159, 46594], [-290, 574], [-304, -17], [71, 333], [-283, 1233], [-584, 519], [-207, 33], [-371, 378], [-256, -177], [-10, 322], [-203, 505], [197, 183], [-233, 146], [-73, 337], [-236, 43], [79, 361], [407, 264], [352, -209], [135, -1232], [280, -288], [259, 658], [229, 84], [157, 340], [575, -511], [309, -132], [847, -497], [496, -805], [-23, -323], [478, -311], [113, -420], [-244, -29], [59, -416], [257, -341], [124, -563], [161, 34], [24, -295], [230, -132], [-32, -200], [209, -285], [-754, 225], [-257, 407], [-270, 790], [-590, 67], [-271, -209], [118, -361], [-209, -212], [-466, 129]], [[77059, 52830], [146, -423], [-66, -238], [-197, 543], [117, 118]], [[84739, 52803], [90, -153], [-296, -581], [-347, 67], [-642, -131], [-85, -366], [61, -604], [229, 309], [489, 204], [225, -49], [-114, -251], [-358, -164], [-188, -344], [172, -587], [-31, -363], [196, -368], [-395, -265], [40, 328], [-204, 315], [52, 450], [-193, -263], [-18, -1322], [-269, 89], [76, 600], [-92, 510], [-148, 194], [159, 646], [-2, 435], [113, 335], [91, 793], [78, 196], [157, 155], [159, -134], [639, -93], [356, 412]], [[85602, 52942], [-86, -436], [252, 278], [93, -145], [-234, -404], [317, -70], [-39, -275], [-285, -34], [111, -418], [-60, -217], [-266, 420], [-70, 441], [0, 436], [124, 607], [143, -183]], [[76528, 55067], [173, -186], [381, -17], [224, -675], [402, -518], [225, -590], [136, 78], [296, -522], [96, -352], [360, -308], [-115, -539], [287, -193], [140, -722], [206, -68], [125, -491], [-81, -1482], [-72, -35], [-113, 189], [-159, -162], [-236, 513], [-384, 553], [-335, 809], [-223, 1020], [-192, 527], [-131, 100], [-168, 958], [-243, 274], [-16, 262], [-604, 1129], [-95, 324], [116, 124]], [[75774, 59507], [77, 368], [75, -234], [-96, -591], [-76, -702], [-44, 254], [-5, 254], [69, 651]], [[45544, 90163], [551, -181], [196, -547], [-332, -500], [-459, -356], [-704, -225], [-677, 276], [-245, 490], [-514, 13], [290, 288], [-467, 149], [9, 445], [432, 234], [344, -370], [331, -206], [173, 324], [538, -116], [534, 282]], [[28693, 62468], [227, -91], [195, -176], [-87, -110], [-188, 29], [-201, -74], [-184, 87], [-255, 223], [191, 90], [302, 22]], [[86383, 71299], [208, -118], [82, -379], [-191, -893], [-189, -213], [-121, 140], [-12, 488], [70, 165], [-59, 261], [-107, -80], [-75, 298], [394, 331]], [[87266, 71631], [200, -128], [-192, -514], [-182, 110], [-195, -318], [-125, 334], [125, 300], [189, -13], [180, 229]], [[89242, 75658], [221, -1044], [-270, -674], [-16, -572], [-132, -631], [77, -311], [-254, -481], [-41, 234], [-435, -346], [-377, 15], [-207, -546], [-257, 32], [63, 410], [-287, 104], [-280, -211], [-646, -185], [-7, 203], [575, 690], [422, 77], [333, -120], [255, 1009], [158, 145], [44, -313], [219, 113], [330, 568], [171, 769], [-53, 625], [192, 276], [202, 164]], [[89448, 78021], [260, 142], [216, -915], [474, -33], [-21, -435], [-478, -369], [-115, -420], [-429, 272], [-239, -116], [56, -299], [-226, -163], [-92, 727], [359, 275], [235, 1334]], [[72335, 57431], [266, -707], [143, -665], [-55, -498], [-303, -310], [-203, 509], [-64, 1337], [216, 334]], [[63708, 44875], [164, -544], [151, -1387], [-71, -304], [-164, 245], [58, -580], [-97, -717], [-444, -2698], [-215, -1413], [-553, -374], [-307, 337], [-90, 341], [14, 549], [-148, 702], [79, 533], [270, 804], [-149, 1416], [253, 708], [379, 299], [209, 293], [493, 1029], [66, 621], [102, 140]], [[56347, 96975], [270, -168], [-387, -552], [-419, 190], [-159, 469], [425, 204], [270, -143]], [[54672, 97846], [1164, -634], [-561, -177], [-606, -1095], [-859, 692], [-836, 1033], [1067, 144], [500, -516], [131, 553]], [[56428, 98137], [1113, -303], [-860, -384], [-579, -35], [-936, 561], [1262, 161]], [[98028, 28506], [117, -328], [210, 74], [59, -449], [-521, -1156], [-298, -312], [-179, -938], [-296, -387], [-338, -13], [-536, 457], [189, 866], [712, 426], [386, 560], [273, 982], [222, 218]], [[98077, 32018], [414, -681], [69, -708], [327, -466], [333, -209], [221, 260], [159, -100], [-194, -795], [-266, -201], [-20, -421], [-418, -825], [-148, 136], [93, 482], [-85, 365], [-316, 243], [247, 370], [76, 619], [-230, 862], [-375, 1030], [113, 39]], [[84900, 57375], [182, -120], [46, -676], [41, -549], [-113, -563], [-82, 449], [-145, -179], [89, -356], [-89, -332], [-175, 4], [-253, 460], [-16, 675], [-160, -132], [-185, 70], [-169, -267], [98, 593], [408, 345], [107, -124], [176, 320], [208, 45], [32, 337]], [[84241, 58162], [85, -88], [-151, -1031], [-177, 462], [134, 162], [109, 495]], [[84443, 58219], [43, -467], [-171, -321], [128, 788]], [[83282, 58448], [43, -482], [-273, -475], [-106, -348], [-392, -504], [451, 1072], [112, 215], [165, 522]], [[84567, 58432], [150, -38], [68, -649], [-125, -59], [-93, 746]], [[83971, 58613], [263, -59], [-153, -622], [-207, -84], [97, 765]], [[84699, 59074], [161, -180], [19, -565], [-89, -101], [-270, 830], [179, 16]], [[83659, 59544], [160, -343], [-141, -327], [-246, 751], [227, -81]], [[83585, 62533], [316, -12], [134, -838], [-83, -445], [-181, -223], [-55, -359], [98, -641], [161, -82], [44, 169], [236, -100], [181, -255], [-94, -127], [223, -349], [-242, -50], [-157, 345], [-86, -108], [-238, 262], [-112, -15], [-223, 89], [1, 337], [-153, 235], [-75, 900], [136, -201], [9, 886], [160, 582]], [[93002, 48680], [307, -595], [-55, -205], [-267, 533], [15, 267]], [[92286, 49425], [-37, -729], [-251, -394], [-435, -92], [-346, 302], [13, 191], [470, -50], [437, 410], [-43, 370], [192, -8]], [[91956, 50277], [303, -193], [252, -570], [-40, -468], [-70, 475], [-176, 353], [-219, 169], [-50, 234]], [[31357, 62525], [455, -87], [54, -142], [-80, -170], [-435, 57], [-42, 228], [48, 114]], [[94913, 46056], [118, -240], [-56, -154], [-125, 107], [-44, 207], [107, 80]], [[94337, 46438], [132, 85], [193, -217], [38, -229], [-145, -43], [-157, 164], [-61, 240]], [[94666, 47024], [114, -119], [47, -543], [-142, 205], [-19, 457]], [[94053, 47469], [458, -399], [1, -245], [-385, 370], [-74, 274]], [[33272, 58060], [-85, -539], [-204, 216], [-37, 386], [326, -63]], [[83787, 66367], [48, -241], [-68, -941], [-136, -708], [-133, -29], [-149, 725], [36, 360], [242, 734], [160, 100]], [[6742, 63469], [205, -219], [275, -342], [-175, -159], [-202, 235], [-183, 213], [-287, 313], [367, -41]], [[4512, 83553], [108, -171], [-442, -103], [334, 274]], [[12908, 84435], [313, -255], [234, -352], [-31, -196], [-353, 371], [-163, 432]], [[12315, 84877], [310, -141], [276, -621], [-586, 762]], [[7496, 85205], [11, -237], [-319, -447], [-168, 396], [476, 288]], [[12301, 85378], [249, -428], [-444, 201], [195, 227]], [[12379, 85439], [298, -197], [322, -587], [-211, 25], [-409, 759]], [[3863, 86662], [217, -346], [-249, -86], [-430, 401], [462, 31]], [[2313, 88585], [873, -293], [3, -393], [-631, 335], [-245, 351]], [[96374, 43185], [132, -419], [104, -261], [-156, 31], [-75, 263], [-104, 114], [-48, 360], [147, -88]], [[26712, 78420], [548, -134], [-6, -303], [-587, 390], [45, 47]], [[32128, 78941], [294, -276], [362, -69], [-158, -278], [-432, 256], [-66, 367]], [[33194, 78911], [192, -479], [-163, -304], [-142, -68], [-176, 297], [289, 554]], [[32185, 80609], [625, -343], [-101, -165], [-372, 186], [-152, 322]], [[34527, 81397], [132, -264], [-126, -465], [-3, -359], [172, -75], [146, 133], [303, -165], [-125, -389], [187, -46], [-9, -310], [80, -169], [10, -498], [-171, -100], [-196, 301], [-275, -128], [-194, -8], [54, 366], [-932, 12], [-80, 184], [198, 416], [359, 1069], [213, 292], [257, 203]], [[27379, 82581], [256, -343], [-153, -81], [-277, 222], [174, 202]], [[13140, 82904], [235, -48], [260, -414], [232, -385], [-328, 238], [-166, 187], [-233, 422]], [[27295, 88162], [-285, -458], [-318, 129], [304, 342], [299, -13]], [[26253, 89737], [961, -529], [510, -617], [-230, -206], [-406, 136], [-148, 291], [-280, -118], [-247, -539], [-196, 360], [-299, 146], [206, 309], [129, 767]], [[29045, 91417], [131, -317], [-25, -312], [-299, 37], [-251, 286], [0, 376], [113, 179], [331, -249]], [[22491, 92265], [926, -399], [-482, -331], [-599, 55], [155, 675]], [[18279, 94063], [1005, -215], [1040, 213], [65, 234], [481, -333], [74, -533], [295, -926], [378, -402], [102, -516], [-428, -124], [-850, 229], [-1269, -368], [-658, 25], [-290, 366], [-439, 42], [-408, 397], [905, 188], [732, -27], [-539, 238], [-1138, -44], [-222, 240], [634, 204], [-819, 144], [-22, 210], [650, 386], [721, 372]], [[27482, 94373], [764, 9], [462, -466], [-394, 69], [-565, -177], [-267, 565]], [[25956, 94378], [446, -108], [-485, -490], [197, -452], [452, 736], [787, 234], [290, -884], [801, 331], [667, -149], [433, -387], [324, -102], [1142, -613], [346, -492], [125, -314], [209, -571], [511, -331], [606, -426], [-195, -700], [-402, -243], [-375, 427], [-408, 322], [-114, -516], [658, -867], [77, -708], [-498, 55], [-486, 186], [1009, -915], [-224, -128], [-1011, 514], [-793, 618], [-379, 421], [-447, 30], [-352, -39], [-539, 140], [-129, 455], [291, 131], [617, -119], [348, 85], [-142, 430], [589, 560], [-179, 643], [-748, 605], [-983, 628], [-704, -146], [-106, -172], [-1146, 166], [-673, 203], [-392, 836], [292, 769], [693, 347]], [[22269, 94402], [714, -20], [-69, -406], [248, -233], [15, -483], [-599, -370], [-873, 647], [503, 328], [-438, 304], [499, 233]], [[24237, 94511], [708, -106], [-192, -607], [-520, -214], [-102, -496], [-416, 338], [-173, 1041], [695, 44]], [[16227, 94782], [1310, -270], [429, -349], [-1372, -714], [-104, -432], [-685, -234], [-747, 498], [560, 1046], [-273, 336], [882, 119]], [[23779, 95386], [361, -517], [-359, -44], [-497, 293], [-239, 579], [734, -311]], [[22664, 95998], [286, -569], [-182, -376], [-638, -7], [-639, 279], [-179, 553], [538, 204], [814, -84]], [[19814, 96089], [911, -671], [-172, -348], [-782, 9], [-1167, -389], [-390, 65], [-856, 399], [-147, 316], [844, 385], [558, -84], [484, -433], [366, 163], [-125, 286], [476, 302]], [[23545, 96198], [1054, -185], [843, -512], [1298, 13], [1135, -206], [71, -341], [-665, -241], [-2267, 43], [-547, 242], [-297, 513], [-760, 379], [135, 295]], [[17743, 96462], [64, -446], [-1102, -483], [-712, 42], [871, 781], [879, 106]], [[19554, 96808], [128, -339], [-824, -92], [-314, 334], [1010, 97]], [[23271, 97132], [547, -621], [-972, 170], [-288, 480], [713, -29]], [[19065, 97493], [407, -412], [-848, -168], [441, 580]], [[21206, 97538], [1139, -427], [150, -406], [-1369, 201], [80, 632]], [[23681, 99139], [1904, -1311], [-434, -968], [-708, 28], [-1281, 963], [-170, 965], [689, 323]], [[30642, 99713], [1386, -119], [940, -411], [-938, -464], [-2356, -1067], [-555, -75], [17, -595], [-847, -477], [108, -509], [-1914, 89], [-210, -287], [-971, 52], [-293, 440], [848, 54], [-159, 495], [243, 393], [182, 322], [-496, 668], [-853, 687], [2250, 380], [316, 236], [3302, 188]], [[14497, 80889], [115, 142], [394, -305], [277, -85], [408, -527], [123, -415], [-327, 56], [-337, 272], [-354, 449], [-299, 413]], [[95422, 40299], [150, -7], [353, -411], [109, -304], [409, -512], [-47, -211], [-624, 659], [-350, 786]], [[80745, 63447], [155, -128], [-135, -346], [-37, -371], [-269, -333], [-267, 228], [-19, 444], [207, 297], [190, 117], [175, 92]]], \"bbox\": [-179.9999885408, -89.999999, 179.9999885408, 83.61347077], \"transform\": { \"scale\": [0.0036000357711737114, 0.001736152059220592], \"translate\": [-179.9999885408, -89.999999] } };\n\n/* eslint-enable */\n\n//# sourceURL=webpack:///./js/sample_topo.js?");
-
-/***/ }),
-
-/***/ "./js/symbols_picto.js":
-/*!*****************************!*\
- !*** ./js/symbols_picto.js ***!
- \*****************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.display_box_symbol_typo = undefined;\nexports.box_choice_symbol = box_choice_symbol;\nexports.make_style_box_indiv_symbol = make_style_box_indiv_symbol;\n\nvar _sortablejs = __webpack_require__(/*! sortablejs */ \"./node_modules/sortablejs/Sortable.js\");\n\nvar _sortablejs2 = _interopRequireDefault(_sortablejs);\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar display_box_symbol_typo = exports.display_box_symbol_typo = function display_box_symbol_typo(layer, field, categories) {\n var fetch_symbol_categories = function fetch_symbol_categories() {\n var categ = document.getElementsByClassName('typo_class');\n var symbol_map = new Map();\n for (var i = 0; i < categ.length; i++) {\n var selec = categ[i].querySelector('.symbol_section');\n var new_name = categ[i].querySelector('.typo_name').value;\n if (selec.style.backgroundImage.length > 7) {\n var img = selec.style.backgroundImage.split('url(')[1].substring(1).slice(0, -2);\n var size = +categ[i].querySelector('#symbol_size').value;\n symbol_map.set(categ[i].__data__.name, [img, size, new_name, cats[i].nb_elem]);\n } else {\n symbol_map.set(categ[i].__data__.name, [null, 0, new_name, cats[i].nb_elem]);\n }\n }\n return symbol_map;\n };\n\n var nb_features = data_manager.current_layers[layer].n_features,\n data_layer = data_manager.user_data[layer],\n cats = [],\n res_symbols = _app.default_symbols,\n default_d_url = 'url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAACMCAYAAACuwEE+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADVwAAA1cBPbpBvAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATySURBVHic7dxNiFVlHIDxZ5z8yvKjMgOTFLI0IrQMSg2jIFpESYSbyCGICqKINu6Kdm1KihZtomgRURRI9EH0YQXWLqJFqG1KIsiKQog+MFu8M1R3mo//nXPO+75znh+czVy55/+eeZy59753LkiSJEmSpCGN5B6gQRuAbQNfOwkcAc4GPux8IhXtLuDUwPErsAP4Dbg132jzx4LcA3RgFFgMvAzcmXmW6vUhmIk1jgLPAg9lnKV6fQoG0mO2x4HHMs1Svb4FM2Ef8PQUt2kafbhgU63xPuAFYGGHs1Svz8EA3A68BiztaJbq9SGY0Rluvwl4C1jewSzV60Mws1njLuB9YHXLs1TPYP5xBfARsK7FWapnMP+1CfgYuKilWapnMJNdQIpmawuzVM9g/t+5wAfAzoZnqV4fgpnpWdJUVgDvArsbnKV6fQhmLmtcDLwCjDU0S/UMZmanAc8BDzYwS/UMZnZGgP24aWkwQfuApxq+z6r0YeFNr/F+4HnSr6re6UMwwz5Lms4dwKvAkhbuu2h9CKatNd5M2rQ8s6X7L5LBzM21pE3Lc1o8R1EMZu62kTYtz2/5PEUwmGZsJu0/bezgXFkZTHPWk6LZ0tH5sjCYZq0hbVru6PCcnepDMG08rZ7OSuAd4MaOz9uJPgSTY42nAweAPRnO3SqDac8i4EXg7kznb4XBtGsUeIa0BzUvGEz7Rki73E8yDz5eJffF7EIpa3yAebBpWcrFbFNJa9xLegdftZuWJV3MtpS2xt3AG1S6aVnaxWxDiWu8DniP9FFqVSnxYjat1DVeSdq0XJt7kIhSL2aTSl7jJaT9pwtzDzJbJV/MpnS9NRC1gRTNZbkHmY0+BFPDGs8DDgLbM88xoxou5lzVssZVpE3LG3IPMp1aLuZc1LTGZcDrwG25B5lKTRdzWLWtcRHwEumDqotT9cvUs/Qo6a8WJ6wauH2UyR9XthA4Y+BrS5j8WXjLSN/gf1vO5Afag+dcQPpj/+nOuQc4THpAXIw+BPPD+KEG1PbjWpkZjEIMRiEGoxCDUYjBKMRgFGIwCjEYhRiMQgxGIQajEINRiMEoxGAUYjAKMRiFGIxCDEYhBqMQg1GIwSjEYBRiMAoxGIUYjEIMRiEGoxCDUYjBKMRgFGIwCjEYhRiMQgxGIQajEINRiMEoxGAUYjAKMRiFGIxCDEYhBqMQg1GIwSjEYBRiMAoxGIUYjEIMRiEGoxCDUYjBKMRgFGIwCjEYhRiMQgxGIQajEINRiMEoZCT3AENaDewErgEuBtYDG4ClA//uFHAUOAIcBj4BDgI/djSnMloJ3AscAv4ixTDMcRL4FLgHWN7pCtSJZcDDwAmGj2Sq4wTwyPg5NA9sB47RfCiDxzFgR0drUkvGgD9oP5aJ43dgbycrU+N2kb6BXcUycfwJXN/B+tSgRcDXdB/LxPHN+AyqxBj5Ypk4xlpfZaVKfOHuqtwDAFfnHqBUJQazLvcAlDFDkUoM5rvcAwDf5h6gVCUG82buAShjBs3SKPA5+R7wfjY+gyqyGThO97F8D2zqYH1qweV0G81xYGsnK1Nr1gAHaD+Wt4G1Ha1JLRsBbiG9raHpUA6N33et7wvSDLYD+4GvGD6Sr4An8MW5odT8P2sjsAW4lPQg+SzSm6xWjN/+C/Az8BPwJfAF6dnX0c4nlSRJkiRJgr8BhBGnmRww0QYAAAAASUVORK5CYII=\")';\n\n if (!categories) {\n categories = new Map();\n for (var i = 0; i < nb_features; ++i) {\n var value = data_layer[i][field];\n var ret_val = categories.get(value);\n if (ret_val) {\n categories.set(value, [ret_val[0] + 1, [i].concat(ret_val[1])]);\n } else {\n categories.set(value, [1, [i]]);\n }\n }\n categories.forEach(function (v, k) {\n cats.push({\n name: k, new_name: k, nb_elem: v[0], img: default_d_url\n });\n });\n } else {\n categories.forEach(function (v, k) {\n cats.push({\n name: k, new_name: v[2], nb_elem: v[3], img: 'url(' + v[0] + ')'\n });\n });\n }\n\n var nb_class = cats.length;\n\n var modal_box = (0, _dialogs.make_dialog_container)('symbol_box', _tr('app_page.symbol_typo_box.title', { layer: layer, nb_features: nb_features }), 'dialog');\n var newbox = d3.select('#symbol_box').select('.modal-body').styles({ 'overflow-y': 'scroll', 'max-height': window.innerHeight - 145 + 'px' });\n\n newbox.append('h3').html('');\n newbox.append('p').html(_tr('app_page.symbol_typo_box.field_categ', { field: field, nb_class: nb_class, nb_features: nb_features }));\n newbox.append('ul').styles({\n padding: 'unset',\n 'list-style': 'none'\n }).attr('id', 'typo_categories').selectAll('li').data(cats).enter().append('li').styles({\n margin: '1px',\n display: 'inline-flex'\n }).attr('class', 'typo_class').attr('id', function (_, i) {\n return ['line', i].join('_');\n });\n\n newbox.selectAll('.typo_class').append('span').attr('class', 'three_dots').style('cursor', 'grab');\n\n newbox.selectAll('.typo_class').append('input').styles({\n width: '200px',\n height: 'auto',\n 'vertical-align': 'middle'\n }).attrs(function (d) {\n return { class: 'typo_name', id: d.name };\n }).property('value', function (d) {\n return d.new_name;\n });\n\n newbox.selectAll('.typo_class').insert('p').attrs({ class: 'symbol_section', title: _tr('app_page.symbol_typo_box.title_click') }).style('background-image', function (d) {\n return d.img;\n }).styles({\n width: '32px',\n height: '32px',\n margin: 'auto auto auto 10px',\n 'border-radius': '10%',\n border: '1px dashed blue',\n display: 'inline-block',\n 'background-size': '32px 32px',\n 'vertical-align': 'middle'\n }).on('click', function () {\n var _this = this;\n\n modal_box.hide();\n box_choice_symbol(res_symbols, '.dialog').then(function (confirmed) {\n modal_box.show();\n if (confirmed) {\n _this.style.backgroundImage = confirmed;\n }\n });\n });\n\n newbox.selectAll('.typo_class').insert('input').attrs({ type: 'number', id: 'symbol_size' }).styles({ width: '50px', 'margin-left': '25px' }).property('value', 50);\n\n newbox.selectAll('.typo_class').insert('span').style('margin', 'auto auto auto 5px').html(' px');\n\n newbox.selectAll('.typo_class').insert('span').style('margin', 'auto auto auto 25px').html(function (d) {\n return _tr('app_page.symbol_typo_box.count_feature', { count: d.nb_elem });\n });\n\n new _sortablejs2.default(document.getElementById('typo_categories'));\n\n return new Promise(function (resolve, reject) {\n var container = document.getElementById('symbol_box');\n var fn_cb = function fn_cb(evt) {\n helper_esc_key_twbs_cb(evt, _onclose);\n };\n var clean_up_box = function clean_up_box() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', fn_cb);\n };\n var _onclose = function _onclose() {\n resolve(false);\n clean_up_box();\n };\n container.querySelector('.btn_ok').onclick = function () {\n var symbol_map = fetch_symbol_categories();\n resolve([nb_class, symbol_map]);\n clean_up_box();\n };\n container.querySelector('.btn_cancel').onclick = _onclose;\n container.querySelector('#xclose').onclick = _onclose;\n document.addEventListener('keydown', fn_cb);\n _dialogs.overlay_under_modal.display();\n });\n};\n\nfunction box_choice_symbol(sample_symbols, parent_css_selector) {\n (0, _dialogs.make_dialog_container)('box_choice_symbol', _tr('app_page.box_choice_symbol.title'), 'dialog');\n _dialogs.overlay_under_modal.display();\n var container = document.getElementById('box_choice_symbol');\n var btn_ok = container.querySelector('.btn_ok');\n container.querySelector('.modal-dialog').classList.add('fitContent');\n btn_ok.disabled = 'disabled';\n var newbox = d3.select(container).select('.modal-body').style('width', '220px');\n newbox.append('p').html('' + _tr('app_page.box_choice_symbol.select_symbol') + ' ');\n\n var box_select = newbox.append('div').styles({\n width: '190px', height: '100px', overflow: 'auto', border: '1.5px solid #1d588b'\n }).attr('id', 'symbols_select');\n\n box_select.selectAll('p').data(sample_symbols).enter().append('p').attrs(function (d) {\n return {\n id: 'p_' + d[0].replace('.png', ''),\n title: d[0]\n };\n }).styles(function (d) {\n return {\n width: '32px',\n height: '32px',\n margin: 'auto',\n display: 'inline-block',\n 'background-size': '32px 32px',\n 'background-image': 'url(\"' + d[1] + '\")' // ['url(\"', d[1], '\")'].join('')\n };\n }).on('click', function () {\n box_select.selectAll('p').each(function () {\n this.style.border = '';\n this.style.padding = '0px';\n });\n this.style.padding = '-1px';\n this.style.border = '1px dashed red';\n btn_ok.disabled = false;\n newbox.select('#current_symb').style('background-image', this.style.backgroundImage);\n });\n\n newbox.append('p').attr('display', 'inline').html('' + _tr('app_page.box_choice_symbol.upload_symbol') + ' ');\n newbox.append('p').styles({ margin: 'auto', 'text-align': 'center' }).append('button').html(_tr('app_page.box_choice_symbol.browse')).on('click', function () {\n var input = document.createElement('input');\n input.setAttribute('type', 'file');\n input.setAttribute('accept', '.jpeg,.jpg,.svg,.png,.gif');\n input.onchange = function (event) {\n var file = event.target.files[0];\n // const file_name = file.name;\n var reader = new FileReader();\n reader.onloadend = function () {\n var dataUrl_res = ['url(\"', reader.result, '\")'].join('');\n btn_ok.disabled = false;\n newbox.select('#current_symb').style('background-image', dataUrl_res);\n };\n reader.readAsDataURL(file);\n };\n input.dispatchEvent(new MouseEvent('click'));\n });\n\n newbox.insert('p').style('text-align', 'center').html(_tr('app_page.box_choice_symbol.selected_symbol'));\n newbox.insert('div').style('text-align', 'center').append('p').attrs({ class: 'symbol_section', id: 'current_symb' }).styles({\n width: '32px',\n height: '32px',\n margin: 'auto',\n display: 'inline-block',\n 'border-radius': '10%',\n 'background-size': '32px 32px',\n 'vertical-align': 'middle',\n 'background-image': \"url('')\"\n });\n return new Promise(function (resolve, reject) {\n var fn_cb = function fn_cb(evt) {\n helper_esc_key_twbs_cb(evt, _onclose);\n };\n var clean_up_box = function clean_up_box() {\n container.remove();\n if (parent_css_selector) {\n (0, _dialogs.reOpenParent)(parent_css_selector);\n } else {\n _dialogs.overlay_under_modal.hide();\n }\n document.removeEventListener('keydown', fn_cb);\n };\n container.querySelector('.btn_ok').onclick = function () {\n var res_url = newbox.select('#current_symb').style('background-image');\n resolve(res_url);\n clean_up_box();\n };\n var _onclose = function _onclose() {\n resolve(false);\n clean_up_box();\n };\n container.querySelector('.btn_cancel').onclick = _onclose;\n container.querySelector('#xclose').onclick = _onclose;\n document.addEventListener('keydown', fn_cb);\n });\n}\n\nfunction make_style_box_indiv_symbol(symbol_node) {\n var parent = symbol_node.parentElement;\n var type_obj = parent.classList.contains('layer') ? 'layer' : 'layout';\n var current_options = {\n size: +symbol_node.getAttribute('width').replace('px', ''),\n scalable: !!(type_obj === 'layout' && parent.classList.contains('scalable-legend'))\n };\n var ref_coords = {\n x: +symbol_node.getAttribute('x') + current_options.size / 2,\n y: +symbol_node.getAttribute('y') + current_options.size / 2\n };\n var ref_coords2 = (0, _helpers.cloneObj)(ref_coords);\n // const new_params = {};\n // const self = this;\n (0, _dialogs.make_confirm_dialog2)('styleSingleSymbol', _tr('app_page.single_symbol_edit_box.title'), { widthFitContent: true }).then(function (confirmed) {\n if (!confirmed) {\n symbol_node.setAttribute('width', current_options.size + 'px');\n symbol_node.setAttribute('height', current_options.size + 'px');\n symbol_node.setAttribute('x', ref_coords.x - current_options.size / 2);\n symbol_node.setAttribute('y', ref_coords.y - current_options.size / 2);\n if (current_options.scalable) {\n var zoom_scale = svg_map.__zoom;\n parent.setAttribute('transform', 'translate(' + zoom_scale.x + ',' + zoom_scale.y + ') scale(' + zoom_scale.k + ',' + zoom_scale.k + ')');\n if (!parent.classList.contains('scalable-legend')) {\n parent.classList.add('scalable-legend');\n }\n } else if (!parent.classList.contains('layer')) {\n parent.removeAttribute('transform', undefined);\n if (parent.classList.contains('scalable-legend')) {\n parent.classList.remove('scalable-legend');\n }\n }\n }\n });\n var box_content = d3.select('.styleSingleSymbol').select('.modal-body').style('width', '295px').insert('div');\n var a = box_content.append('p').attr('class', 'line_elem');\n a.append('span').html(_tr('app_page.single_symbol_edit_box.image_size'));\n a.append('input').styles({ float: 'right', width: '70px' }).attrs({\n type: 'number', id: 'font_size', min: 0, max: 150, step: 'any'\n }).property('value', current_options.size).on('change', function () {\n var val = +this.value;\n symbol_node.setAttribute('width', val + 'px');\n symbol_node.setAttribute('height', val + 'px');\n symbol_node.setAttribute('x', ref_coords2.x - val / 2);\n symbol_node.setAttribute('y', ref_coords2.y - val / 2);\n });\n\n if (type_obj === 'layout') {\n // const current_state = parent.classList.contains('scalable-legend');\n var b = box_content.append('p').attr('class', 'line_elem');\n b.append('label').attrs({ for: 'checkbox_symbol_zoom_scale', class: 'i18n', 'data-i18n': '[html]app_page.single_symbol_edit_box.scale_on_zoom' }).html(_tr('app_page.single_symbol_edit_box.scale_on_zoom'));\n b.append('input').style('float', 'right').attrs({ type: 'checkbox', id: 'checkbox_symbol_zoom_scale' }).on('change', function () {\n var zoom_scale = svg_map.__zoom;\n if (this.checked) {\n symbol_node.setAttribute('x', (symbol_node.x.baseVal.value - zoom_scale.x) / zoom_scale.k);\n symbol_node.setAttribute('y', (symbol_node.y.baseVal.value - zoom_scale.y) / zoom_scale.k);\n parent.setAttribute('transform', 'translate(' + zoom_scale.x + ',' + zoom_scale.y + ') scale(' + zoom_scale.k + ',' + zoom_scale.k + ')');\n parent.classList.add('scalable-legend');\n } else {\n symbol_node.setAttribute('x', symbol_node.x.baseVal.value * zoom_scale.k + zoom_scale.x);\n symbol_node.setAttribute('y', symbol_node.y.baseVal.value * zoom_scale.k + zoom_scale.y);\n parent.removeAttribute('transform');\n parent.classList.remove('scalable-legend');\n }\n ref_coords2.x = +symbol_node.getAttribute('x');\n ref_coords2.y = +symbol_node.getAttribute('y');\n });\n document.getElementById('checkbox_symbol_zoom_scale').checked = current_options.scalable;\n }\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/symbols_picto.js?");
-
-/***/ }),
-
-/***/ "./js/tables.js":
-/*!**********************!*\
- !*** ./js/tables.js ***!
- \**********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(Promise) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.boxExplore2 = undefined;\nexports.make_table = make_table;\n\nvar _dialogs = __webpack_require__(/*! ./dialogs */ \"./js/dialogs.js\");\n\nvar _helpers = __webpack_require__(/*! ./helpers */ \"./js/helpers.js\");\n\n/**\n* Return a basic operator as a function, each one taking two numbers in arguments\n*\n* @param {String} operator\n* @return {function}\n*/\nfunction get_fun_operator(operator) {\n var operators = new Map([['+', function (a, b) {\n return a + b;\n }], ['-', function (a, b) {\n return a - b;\n }], ['/', function (a, b) {\n if (b === 0) {\n return '';\n }return a / b;\n }], ['*', function (a, b) {\n return a * b;\n }], ['^', function (a, b) {\n return Math.pow(a, b);\n }]]);\n return operators.get(operator);\n}\n\n/**\n* Function to add a field to the targeted layer\n*\n* @param {Array} table - A reference to the \"table\" to work on\n* @param {String} layer - The name of the layer\n* @param {Bool} reOpenTableBox - Reopen the box table ?\n*\n*/\nfunction add_field_table(table, layer_name, reOpenTableBox) {\n function check_name() {\n if (regexp_name.test(this.value) || this.value === '') {\n chooses_handler.new_name = this.value;\n } else {\n // Rollback to the last correct name :\n this.value = chooses_handler.new_name;\n swal({\n title: _tr('Error') + '!',\n text: _tr('Unauthorized character!'),\n type: 'error',\n allowOutsideClick: false\n });\n }\n }\n\n function compute_and_add() {\n var options = chooses_handler,\n fi1 = options.field1,\n fi2 = options.field2,\n new_name_field = options.new_name,\n operation = options.operator;\n var opt_val = options.opt_val;\n\n if (!regexp_name.test(new_name_field)) {\n swal({\n title: '',\n text: _tr('app_page.explore_box.add_field_box.invalid_name'),\n type: 'error',\n allowOutsideClick: false\n });\n return Promise.reject('Invalid name');\n }\n if (options.type_operation === 'math_compute' && table.length > 3200) {\n var formToSend = new FormData();\n var var1 = [],\n var2 = fi2 === 'user_const_value' ? +opt_val : [];\n for (var i = 0; i < table.length; i++) {\n var1.push(+table[i][fi1]);\n }\n if (fi2 !== 'user_const_value') {\n for (var _i = 0; _i < table.length; _i++) {\n var2.push(+table[_i][fi2]);\n }\n }\n formToSend.append('var1', JSON.stringify(var1));\n formToSend.append('var2', JSON.stringify(var2));\n formToSend.append('operator', operation);\n return (0, _helpers.xhrequest)('POST', '/helpers/calc', formToSend, false).then(function (data) {\n var parsed_result = JSON.parse(data);\n for (var _i2 = 0; _i2 < table.length; _i2++) {\n table[_i2][new_name_field] = parsed_result[_i2];\n }\n return true;\n });\n } else if (options.type_operation === 'math_compute') {\n var math_func = get_fun_operator(operation);\n if (fi2 !== 'user_const_value') {\n for (var _i3 = 0; _i3 < table.length; _i3++) {\n if (table[_i3][fi1] != null && table[_i3][fi1] != '' && table[_i3][fi2] != null && table[_i3][fi2] != '') {\n table[_i3][new_name_field] = math_func(+table[_i3][fi1], +table[_i3][fi2]);\n } else {\n table[_i3][new_name_field] = '';\n }\n }\n } else {\n opt_val = +opt_val;\n for (var _i4 = 0; _i4 < table.length; _i4++) {\n if (table[_i4][fi1] != null && table[_i4][fi1] != '') {\n table[_i4][new_name_field] = math_func(+table[_i4][fi1], opt_val);\n } else {\n table[_i4][new_name_field] = '';\n }\n }\n }\n return Promise.resolve(true);\n } else if (operation === 'truncate') {\n opt_val = +opt_val;\n if (opt_val >= 0) {\n for (var _i5 = 0; _i5 < table.length; _i5++) {\n table[_i5][new_name_field] = table[_i5][fi1].substring(0, opt_val);\n }\n } else {\n for (var _i6 = 0; _i6 < table.length; _i6++) {\n table[_i6][new_name_field] = table[_i6][fi1].substr(opt_val);\n }\n }\n return Promise.resolve(true);\n } else if (operation === 'concatenate') {\n for (var _i7 = 0; _i7 < table.length; _i7++) {\n table[_i7][new_name_field] = [table[_i7][fi1], table[_i7][fi2]].join(opt_val);\n }\n return Promise.resolve(true);\n }\n\n return Promise.reject('Unknown error');\n }\n\n function refresh_type_content(type) {\n field1.node().remove();operator.node().remove();field2.node().remove();\n field1 = div1.append('select').on('change', function () {\n chooses_handler.field1 = this.value;\n });\n operator = div1.append('select').on('change', function () {\n chooses_handler.operator = this.value;\n refresh_subtype_content(chooses_handler.type_operation, this.value);\n });\n field2 = div1.append('select').on('change', function () {\n chooses_handler.field2 = this.value;\n val_opt.style('display', this.value === 'user_const_value' ? null : 'none');\n });\n if (type === 'math_compute') {\n math_operation.forEach(function (op) {\n operator.append('option').text(op).attr('value', op);\n });\n // for (const k in fields_type) {\n var _f = Object.getOwnPropertyNames(fields_type);\n for (var i = 0, n = _f.length; i < n; i++) {\n var k = _f[i];\n if (fields_type[k] === 'number') {\n field1.append('option').text(k).attr('value', k);\n field2.append('option').text(k).attr('value', k);\n }\n }\n field2.append('option').attr('value', 'user_const_value').text(_tr('app_page.explore_box.add_field_box.constant_value'));\n val_opt.style('display', 'none');\n txt_op.text('');\n chooses_handler.operator = math_operation[0];\n } else {\n string_operation.forEach(function (op) {\n operator.append('option').text(op[0]).attr('value', op[1]);\n });\n var _f2 = Object.getOwnPropertyNames(fields_type);\n for (var _i8 = 0, _n = _f2.length; _i8 < _n; _i8++) {\n var _k = _f2[_i8];\n if (fields_type[_k] === 'string') {\n field1.append('option').text(_k).attr('value', _k);\n field2.append('option').text(_k).attr('value', _k);\n }\n }\n val_opt.style('display', null);\n txt_op.html(_tr('app_page.explore_box.add_field_box.join_char'));\n chooses_handler.operator = string_operation[0][1];\n }\n chooses_handler.field1 = field1.node().value;\n chooses_handler.field2 = field2.node().value;\n }\n\n function refresh_subtype_content(type, subtype) {\n if (type !== 'string_field' && field2.node().value !== 'user_const_value') {\n val_opt.style('display', 'none');\n txt_op.text('');\n } else if (subtype === 'truncate') {\n txt_op.html(_tr('app_page.explore_box.add_field_box.keep_char'));\n field2.attr('disabled', true);\n } else {\n txt_op.html(_tr('app_page.explore_box.add_field_box.join_char'));\n field2.attr('disabled', null);\n }\n }\n\n var math_operation = ['+', '-', '*', '/', '^'];\n\n var string_operation = [[_tr('app_page.explore_box.add_field_box.concatenate'), 'concatenate'], [_tr('app_page.explore_box.add_field_box.truncate'), 'truncate']];\n\n var chooses_handler = {\n field1: undefined,\n field2: undefined,\n operator: undefined,\n type_operation: undefined,\n opt_val: undefined,\n new_name: _tr('app_page.explore_box.add_field_box.new_name_placeholder')\n };\n\n (0, _dialogs.make_confirm_dialog2)('addFieldBox', _tr('app_page.explore_box.button_add_field'), { width: w > 430 ? 430 : undefined, height: h > 280 ? 280 : undefined }).then(function (valid) {\n // reOpenParent('#browse_data_box');\n if (valid) {\n document.querySelector('body').style.cursor = 'wait';\n compute_and_add(chooses_handler).then(function () {\n var prop_layer = data_manager.current_layers[layer_name];\n if (prop_layer && prop_layer.targeted) {\n var type_field = (0, _helpers.type_col2)(table).find(function (el) {\n return el.name === chooses_handler.new_name;\n });\n var existing = prop_layer.fields_type.findIndex(function (el) {\n return el.name === type_field.name;\n });\n if (existing < 0) {\n prop_layer.fields_type.push(type_field);\n } else {\n prop_layer.fields_type[existing] = type_field;\n }\n (0, _helpers.getAvailablesFunctionnalities)(layer_name);\n if (window.fields_handler) {\n fields_handler.unfill();\n fields_handler.fill(layer_name);\n }\n }\n if (reOpenTableBox) {\n boxExplore2.create(layer_name);\n // parent.modal_box.show();\n // parent.display_table(layer_name);\n }\n }, function (error) {\n if (error !== 'Invalid name') {\n (0, _helpers.display_error_during_computation)();\n }\n console.log(error);\n document.querySelector('body').style.cursor = '';\n }).done(function () {\n document.querySelector('body').style.cursor = '';\n });\n }\n });\n\n var fields_type = (0, _helpers.type_col)(layer_name);\n // Only allow letters (lower & upper cases), number and underscore in the field name:\n var regexp_name = new RegExp(/^[a-z0-9_]+$/i);\n var container = document.querySelector('.twbs > .addFieldBox');\n var box_content = d3.select(container).select('.modal-body').append('div');\n var div1 = box_content.append('div').attr('id', 'field_div1');\n var div2 = box_content.append('div').attr('id', 'field_div2');\n\n div1.append('p').html(_tr('app_page.explore_box.add_field_box.new_name')).insert('input').property('value', _tr('app_page.explore_box.add_field_box.new_name_placeholder')).on('keyup', check_name);\n\n var type_content = div1.append('p').html(_tr('app_page.explore_box.add_field_box.new_content')).insert('select').attr('id', 'type_content_select').on('change', function () {\n chooses_handler.type_operation = this.value;\n refresh_type_content(this.value);\n });\n\n [[_tr('app_page.explore_box.add_field_box.between_numerical'), 'math_compute'], [_tr('app_page.explore_box.add_field_box.between_string'), 'string_field']].forEach(function (d) {\n type_content.append('option').text(d[0]).attr('value', d[1]);\n });\n\n var field1 = div1.append('select').on('change', function () {\n chooses_handler.field1 = this.value;\n });\n var operator = div1.append('select').on('change', function () {\n chooses_handler.operator = this.value;\n refresh_subtype_content(chooses_handler.type_operation, this.value);\n });\n var field2 = div1.append('select').on('change', function () {\n chooses_handler.field2 = this.value;\n });\n\n var txt_op = div2.append('p').attr('id', 'txt_opt').text('');\n var val_opt = div2.append('input').attr('id', 'val_opt').style('display', 'none').on('change', function () {\n chooses_handler.opt_val = this.value;\n });\n\n {\n var a = type_content.node();\n var b = false;\n var _f = Object.getOwnPropertyNames(fields_type);\n for (var i = 0, n = _f.length; i < n; i++) {\n var fi = _f[i];\n if (fields_type[fi] === 'number') {\n b = true;\n break;\n }\n }\n a.value = b ? 'math_compute' : 'string_field';\n a.dispatchEvent(new Event('change'));\n }\n}\n\nfunction createTableDOM(data, opts) {\n var options = opts || {};\n options.id = options.id || 'myTable';\n var doc = document,\n nb_features = data.length,\n column_names = Object.getOwnPropertyNames(data[0]),\n nb_columns = column_names.length;\n var myTable = doc.createElement('table'),\n headers = doc.createElement('thead'),\n body = doc.createElement('tbody'),\n headers_row = doc.createElement('tr');\n for (var i = 0; i < nb_columns; i++) {\n var cell = doc.createElement('th');\n cell.innerHTML = column_names[i];\n headers_row.appendChild(cell);\n }\n headers.appendChild(headers_row);\n myTable.appendChild(headers);\n for (var _i9 = 0; _i9 < nb_features; _i9++) {\n var row = doc.createElement('tr');\n for (var j = 0; j < nb_columns; j++) {\n var _cell = doc.createElement('td');\n _cell.innerHTML = data[_i9][column_names[j]];\n row.appendChild(_cell);\n }\n body.appendChild(row);\n }\n myTable.appendChild(body);\n myTable.setAttribute('id', options.id);\n return myTable;\n}\n\nfunction make_table(layer_name) {\n var features = svg_map.querySelector('#' + _app.layer_to_id.get(layer_name)).childNodes;\n var table = [];\n if (!features[0].__data__.properties || Object.getOwnPropertyNames(features[0].__data__.properties).length === 0) {\n for (var i = 0, nb_ft = features.length; i < nb_ft; i++) {\n table.push({ id: features[i].__data__.id || i });\n }\n } else {\n for (var _i10 = 0, _nb_ft = features.length; _i10 < _nb_ft; _i10++) {\n table.push(features[_i10].__data__.properties);\n }\n }\n return table;\n}\n\nvar boxExplore2 = exports.boxExplore2 = {\n clean: function clean() {\n this.box_table.remove();\n this.footer.remove();\n this.datatable.destroy();\n this.datatable = null;\n this.footer = null;\n this.box_table = null;\n this.nb_features = null;\n this.columns_names = null;\n this.columns_headers = null;\n this.tables = null;\n this.modal_box = null;\n },\n display_table: function display_table(table_name) {\n var _this = this;\n\n document.querySelector('body').style.cursor = '';\n var the_table = this.tables.get(table_name);\n the_table = the_table ? the_table[1] : make_table(table_name);\n\n this.nb_features = the_table.length;\n this.columns_names = Object.getOwnPropertyNames(the_table[0]);\n this.columns_headers = [];\n for (var i = 0, col = this.columns_names, len = col.length; i < len; ++i) {\n this.columns_headers.push({ data: col[i], title: col[i] });\n }\n\n if (this.tables.get(table_name) && (table_name !== data_manager.dataset_name || table_name === data_manager.dataset_name && data_manager.field_join_map.length === 0)) {\n this.footer.insert('button').attrs({ id: 'add_field_button', class: 'button_st4' }).styles({\n position: 'absolute', left: '15px', padding: '10px', 'font-size': '1.1em'\n }).html(_tr('app_page.explore_box.button_add_field')).on('click', function () {\n _this.modal_box.hide();\n document.getElementById('browse_data_box').querySelector('#xclose').click();\n add_field_table(the_table, table_name, _this);\n });\n }\n var txt_intro = ['', table_name, ' ', this.nb_features, ' ', _tr('app_page.common.feature', { count: this.nb_features }), ' - ', this.columns_names.length, ' ', _tr('app_page.common.field', { count: this.columns_names.length })].join('');\n this.box_table.append('p').attr('id', 'table_intro').html(txt_intro);\n this.box_table.node().appendChild(createTableDOM(the_table, { id: 'myTable' }));\n var list_per_page_select = [5, 10, 15, 20, 25];\n if (this.nb_features > 25) {\n if (this.nb_features > 100) {\n list_per_page_select.push(100);\n }\n list_per_page_select.push(this.nb_features);\n }\n var per_page_value = list_per_page_select[list_per_page_select.length - 1];\n if (per_page_value > 1000) {\n per_page_value = 100;\n }\n var myTable = document.getElementById('myTable');\n this.datatable = new DataTable(myTable, {\n sortable: true,\n searchable: true,\n perPage: per_page_value,\n perPageSelect: list_per_page_select,\n labels: {\n placeholder: _tr('app_page.table.search'), // The search input placeholder\n perPage: _tr('app_page.table.entries_page'), // per-page dropdown label\n noRows: _tr('app_page.table.no_rows'), // Message shown when there are no search results\n info: _tr('app_page.table.info') // \"Showing {start} to {end} of {rows} entries\"\n }\n });\n // Adjust the size of the box (on opening and after adding a new field)\n // and/or display scrollbar if its overflowing the size of the window minus a little margin :\n var box = document.getElementById('browse_data_box');\n var modal_body = box.querySelector('.modal-body');\n modal_body.style.padding = '12.5px 15px 15px 15px';\n modal_body.style.height = window.innerHeight - 150 + 'px';\n modal_body.style.overflow = 'auto';\n box.style.height = null;\n\n setTimeout(function () {\n var bbox = box.querySelector('#myTable').getBoundingClientRect();\n // const new_height = bbox.height\n // + box.querySelector('.dataTable-pagination').getBoundingClientRect().height;\n var new_width = bbox.width;\n if (new_width > window.innerWidth * 0.85) {\n new_width = window.innerWidth * 0.9;\n box.querySelector('.modal-content').style.overflow = 'auto';\n box.querySelector('.modal-dialog').style.width = new_width + 'px';\n } else {\n // if (new_width > 560) {\n new_width += 80;\n box.querySelector('.modal-dialog').style.width = new_width + 'px';\n }\n box.style.left = (window.innerWidth - new_width) / 2 + 'px';\n }, 200);\n },\n get_available_tables: function get_available_tables() {\n var target_layer = Object.getOwnPropertyNames(data_manager.user_data),\n ext_dataset = data_manager.dataset_name,\n result_layers = Object.getOwnPropertyNames(data_manager.result_data),\n available = new Map();\n for (var i = 0, n = target_layer.length; i < n; i++) {\n var lyr_name = target_layer[i];\n available.set(lyr_name, [_tr('app_page.common.target_layer'), data_manager.user_data[lyr_name]]);\n }\n if (ext_dataset) {\n available.set(data_manager.dataset_name, [_tr('app_page.common.ext_dataset'), data_manager.joined_dataset[0]]);\n }\n for (var _i11 = 0, _n2 = result_layers.length; _i11 < _n2; _i11++) {\n var _lyr_name = result_layers[_i11];\n available.set(_lyr_name, [_tr('app_page.common.result_layer'), data_manager.result_data[_lyr_name]]);\n }\n return available;\n },\n create: function create(layer_name) {\n var _this2 = this;\n\n this.columns_headers = [];\n this.nb_features = undefined;\n this.columns_names = undefined;\n this.tables = this.get_available_tables();\n this.modal_box = (0, _dialogs.make_dialog_container)('browse_data_box', _tr('app_page.explore_box.title'), 'discretiz_charts_dialog');\n var container = document.getElementById('browse_data_box');\n this.box_table = d3.select(container).select('.modal-body');\n this.footer = d3.select(container).select('.modal-footer');\n\n var fn_cb = function fn_cb(evt) {\n helper_esc_key_twbs_cb(evt, _onclose);\n };\n var _onclose = function _onclose() {\n container.remove();\n _dialogs.overlay_under_modal.hide();\n document.removeEventListener('keydown', fn_cb);\n _this2.clean();\n };\n container.querySelector('.btn_cancel').onclick = _onclose;\n container.querySelector('#xclose').onclick = _onclose;\n container.querySelector('.btn_ok').onclick = _onclose;\n document.addEventListener('keydown', fn_cb);\n _dialogs.overlay_under_modal.display();\n this.display_table(layer_name);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! bluebird */ \"./node_modules/bluebird/js/browser/bluebird.js\")))\n\n//# sourceURL=webpack:///./js/tables.js?");
-
-/***/ }),
-
-/***/ "./js/tooltips.js":
-/*!************************!*\
- !*** ./js/tooltips.js ***!
- \************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.bindTooltips = bindTooltips;\n/* eslint-disable object-property-newline */\nfunction parseMatrix(matrixString) {\n var c = matrixString.split(/\\s*[(),]\\s*/).slice(1, -1);\n\n if (c.length === 6) {\n return {\n m11: +c[0], m21: +c[2], m31: 0, m41: +c[4],\n m12: +c[1], m22: +c[3], m32: 0, m42: +c[5],\n m13: 0, m23: 0, m33: 1, m43: 0,\n m14: 0, m24: 0, m34: 0, m44: 1\n };\n } else if (c.length === 16) {\n return {\n m11: +c[0], m21: +c[4], m31: +c[8], m41: +c[12],\n m12: +c[1], m22: +c[5], m32: +c[9], m42: +c[13],\n m13: +c[2], m23: +c[6], m33: +c[10], m43: +c[14],\n m14: +c[3], m24: +c[7], m34: +c[11], m44: +c[15]\n };\n }\n // handle 'none' or invalid values.\n return {\n m11: 1, m21: 0, m31: 0, m41: 0,\n m12: 0, m22: 1, m32: 0, m42: 0,\n m13: 0, m23: 0, m33: 1, m43: 0,\n m14: 0, m24: 0, m34: 0, m44: 1\n };\n}\n/* eslint-enable object-property-newline */\nvar asin = Math.asin,\n atan2 = Math.atan2,\n cos = Math.cos;\n\n\nfunction getTransform(elem) {\n var matrix = parseMatrix(getComputedStyle(elem, null).transform);\n var rotateY = asin(-matrix.m13);\n var rotateX = void 0;\n var rotateZ = void 0;\n\n if (cos(rotateY) !== 0) {\n rotateX = atan2(matrix.m23, matrix.m33);\n rotateZ = atan2(matrix.m12, matrix.m11);\n } else {\n rotateX = atan2(-matrix.m31, matrix.m22);\n rotateZ = 0;\n }\n return {\n rotate: { x: rotateX, y: rotateY, z: rotateZ },\n translate: { x: matrix.m41, y: matrix.m42, z: matrix.m43 }\n };\n}\n\nfunction bindTooltips() {\n Opentip.defaultStyle = 'dark';\n Array.prototype.slice.call(document.querySelectorAll('div.opentip-container')).forEach(function (el) {\n el.remove();\n });\n Opentip.findElements();\n Opentip.tips.forEach(function (el) {\n if (el.options.target) el.setContent(function () {\n return el.options.target[0].getAttribute('data-ot');\n });\n });\n}\n\n//# sourceURL=webpack:///./js/tooltips.js?");
-
-/***/ }),
-
-/***/ "./js/ui/buttons.js":
-/*!**************************!*\
- !*** ./js/ui/buttons.js ***!
- \**************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n// A bunch of references to the buttons used in the layer manager\n// and some mapping to theses reference according to the type of geometry :\nvar button_replace = exports.button_replace = ' ';\nvar button_trash = exports.button_trash = ' ';\nvar button_legend = exports.button_legend = ' ';\nvar button_zoom_fit = exports.button_zoom_fit = ' ';\nvar button_table = exports.button_table = ' ';\nvar button_type = exports.button_type = new Map([['Point', ' '], ['Line', ' '], ['Polygon', ' ']]);\n\nvar button_result_type = exports.button_result_type = new Map([['flow', ' '], ['symbol', ' '], ['grid', ' '], ['propchoro', ' '], ['typo', ' '], ['discont', ' '], ['cartogram', ' '], ['label', ' '], ['choro', ' '], ['smooth', ' '], ['prop', ' '], ['waffle', ' ']]);\n\nvar eye_open0 = exports.eye_open0 = ' ';\n\n// Reference to the sys run button already in two requested sizes are they are called many times :\nvar sys_run_button = exports.sys_run_button = ' ';\nvar sys_run_button_t2 = exports.sys_run_button_t2 = ' ';\n\n//# sourceURL=webpack:///./js/ui/buttons.js?");
-
-/***/ }),
-
-/***/ "./js/ui/header.js":
-/*!*************************!*\
- !*** ./js/ui/header.js ***!
- \*************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeHeader;\n\nvar _map_project = __webpack_require__(/*! ./../map_project */ \"./js/map_project.js\");\n\nvar _projections = __webpack_require__(/*! ./../projections */ \"./js/projections.js\");\n\nvar _tooltips = __webpack_require__(/*! ./../tooltips */ \"./js/tooltips.js\");\n\nfunction change_lang() {\n var new_lang = this.name;\n if (new_lang !== i18next.language) {\n docCookies.setItem('user_lang', new_lang, 31536e3, '/');\n i18next.changeLanguage(new_lang, function () {\n localize('.i18n');\n (0, _tooltips.bindTooltips)();\n });\n document.getElementById('current_app_lang').innerHTML = new_lang;\n var menu = document.getElementById('menu_lang');\n if (menu) menu.remove();\n }\n}\n\nfunction makeHeader() {\n var proj_options = d3.select('.header_options_projection').append('div').attr('id', 'const_options_projection').style('display', 'inline-flex');\n\n var proj_select2 = proj_options.append('div').attr('class', 'styled-select').insert('select').attrs({ class: 'i18n', id: 'form_projection2' }).style('width', 'calc(100% + 20px)').on('change', _projections.handle_projection_select);\n\n for (var i = 0; i < _projections.shortListContent.length; i++) {\n var option = _projections.shortListContent[i];\n proj_select2.append('option').attrs({ class: 'i18n', value: option, 'data-i18n': 'app_page.projection_name.' + option }).text(_tr('app_page.projection_name.' + option));\n }\n proj_select2.node().value = 'NaturalEarth2';\n\n var const_options = d3.select('.header_options_right').append('div').attr('id', 'const_options').style('display', 'inline');\n\n const_options.append('button').attrs({\n class: 'const_buttons i18n tt',\n id: 'new_project',\n 'data-i18n': '[data-ot]app_page.tooltips.new_project',\n 'data-ot-fixed': true,\n 'data-ot-remove-elements-on-hide': true,\n 'data-ot-target': true\n }).html(' ').on('click', function () {\n window.localStorage.removeItem('magrit_project');\n window.removeEventListener('beforeunload', _map_project.beforeUnloadWindow);\n location.reload();\n });\n\n const_options.append('button').attrs({\n class: 'const_buttons i18n tt',\n 'data-i18n': '[data-ot]app_page.tooltips.load_project_file',\n 'data-ot-fixed': true,\n 'data-ot-remove-elements-on-hide': true,\n 'data-ot-target': true,\n id: 'load_project'\n }).html(' ').on('click', _map_project.load_map_project);\n\n const_options.append('button').attrs({\n class: 'const_buttons i18n tt',\n 'data-i18n': '[data-ot]app_page.tooltips.save_file',\n 'data-ot-fixed': true,\n 'data-ot-remove-elements-on-hide': true,\n 'data-ot-target': true,\n id: 'save_file_button'\n }).html(' ').on('click', _map_project.save_map_project);\n\n const_options.append('button').attrs({\n class: 'const_buttons i18n tt',\n 'data-i18n': '[data-ot]app_page.tooltips.documentation',\n 'data-ot-fixed': true,\n 'data-ot-remove-elements-on-hide': true,\n 'data-ot-target': true,\n id: 'documentation_link'\n }).html(' ').on('click', function () {\n window.open('static/book/index.html', 'DocWindow', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n });\n\n const_options.append('button').attrs({\n class: 'const_buttons i18n tt',\n 'data-i18n': '[data-ot]app_page.help_box.tooltip_btn',\n 'data-ot-fixed': true,\n 'data-ot-remove-elements-on-hide': true,\n 'data-ot-target': true,\n id: 'help_btn'\n }).html(' ').on('click', function () {\n if (document.getElementById('menu_lang')) {\n document.getElementById('menu_lang').remove();\n }\n\n var box_content = '' + '
' + _tr('app_page.help_box.version', { version: global._app.version }) + '
' + '
' + _tr('app_page.help_box.useful_links') + '
' + '
' + _tr('app_page.help_box.carnet_hypotheses') + '
' + '
' + _tr('app_page.help_box.contact') + '
' + '
' + _tr('app_page.help_box.gh_link') + '
' + '
' + _tr('app_page.help_box.credits') + '
';\n swal({\n title: _tr('app_page.help_box.title'),\n html: box_content,\n showCancelButton: true,\n showConfirmButton: false,\n cancelButtonText: _tr('app_page.common.close'),\n animation: 'slide-from-top',\n onOpen: function onOpen() {\n var content = document.getElementsByClassName('about_content')[0];\n var credit_link = content.querySelector('#credit_link');\n credit_link.style.fontWeight = 'bold';\n credit_link.style.cursor = 'pointer';\n credit_link.color = '#000';\n credit_link.onclick = function () {\n window.open('http://riate.cnrs.fr', 'RiatePage', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n };\n content.querySelector('.btn_doc').onclick = function () {\n window.open('http://magrit.hypotheses.org/', 'Carnet hypotheses', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n };\n content.querySelector('.btn_contact').onclick = function () {\n window.open('/contact', 'ContactWindow', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n };\n content.querySelector('.btn_gh').onclick = function () {\n window.open('https://www.github.com/riatelab/magrit', 'GitHubPage', 'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes').focus();\n };\n }\n }).then(function () {\n return null;\n }, function () {\n return null;\n });\n });\n\n const_options.append('button').attrs({ id: 'current_app_lang', class: 'const_buttons' }).styles({\n color: 'white',\n 'font-size': '14px',\n 'vertical-align': 'super',\n 'font-weight': 'bold'\n }).html(i18next.language).on('click', function () {\n if (document.getElementById('menu_lang')) {\n document.getElementById('menu_lang').remove();\n } else {\n (function () {\n var current_lang = i18next.language;\n var other_langs = current_lang === 'en' ? ['es', 'fr'] : current_lang === 'fr' ? ['en', 'es'] : ['en', 'fr'];\n var actions = [{ name: current_lang, callback: change_lang }, { name: other_langs[0], callback: change_lang }, { name: other_langs[1], callback: change_lang }];\n var menu = document.createElement('div');\n menu.style.top = '40px';\n menu.style.right = '0px';\n menu.className = 'context-menu';\n menu.id = 'menu_lang';\n menu.style.minWidth = '30px';\n menu.style.width = '50px';\n menu.style.background = '#000';\n var list_elems = document.createElement('ul');\n menu.appendChild(list_elems);\n\n var _loop = function _loop(_i) {\n var item = document.createElement('li');\n var name = document.createElement('span');\n list_elems.appendChild(item);\n item.setAttribute('data-index', _i);\n item.style.textAlign = 'right';\n item.style.paddingRight = '16px';\n name.className = 'context-menu-item-name';\n name.style.color = 'white';\n name.textContent = actions[_i].name;\n item.appendChild(name);\n item.onclick = function () {\n actions[_i].callback();\n menu.remove();\n };\n };\n\n for (var _i = 0; _i < actions.length; _i++) {\n _loop(_i);\n }\n document.querySelector('body').appendChild(menu);\n })();\n }\n });\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/ui/header.js?");
-
-/***/ }),
-
-/***/ "./js/ui/section1.js":
-/*!***************************!*\
- !*** ./js/ui/section1.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeSection1;\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _helpers = __webpack_require__(/*! ./../helpers */ \"./js/helpers.js\");\n\nvar _layers = __webpack_require__(/*! ./../layers */ \"./js/layers.js\");\n\n/**\n* Function triggered when some images of the interface are clicked\n* in order to create an element, simulate a click on it, let the user\n* browse its file and dispatch the files to the appropriate handler according\n* to the file type\n*/\nfunction click_button_add_layer() {\n var self = this;\n var input = document.createElement('input');\n input.style.display = 'none';\n if (self.id === 'img_data_ext' || self.id === 'data_ext') {\n input.setAttribute('accept', '.xls,.xlsx,.csv,.tsv,.ods,.txt');\n } else if (self.id === 'input_geom' || self.id === 'img_in_geom') {\n input.setAttribute('accept', '.gml,.kml,.geojson,.topojson,.shp,.dbf,.shx,.prj,.cpg,.json');\n }\n input.setAttribute('type', 'file');\n input.setAttribute('multiple', '');\n input.setAttribute('name', 'file[]');\n input.setAttribute('enctype', 'multipart/form-data');\n input.onchange = function (event) {\n var files = (0, _helpers.prepareFileExt)(event.target.files);\n (0, _interface.handle_upload_files)(files, self);\n input.remove();\n };\n document.body.appendChild(input);\n input.click();\n}\n\nfunction makeSection1() {\n var section1 = d3.select('#menu').select('#section1');\n\n // Section for current target layer:\n section1.append('div').attrs({\n class: 'i18n',\n id: 'target_layer_zone',\n 'data-i18n': '[html]app_page.section1.no_target'\n }).styles({\n border: '3px dashed #ccc',\n color: '#ccc',\n 'margin-bottom': '3px',\n padding: '3px',\n 'text-align': 'center'\n });\n\n // Section for current dataset:\n section1.append('div').attrs({\n class: 'i18n',\n id: 'ext_dataset_zone',\n 'data-i18n': '[html]app_page.section1.no_ext_dataset'\n }).styles({\n border: '3px dashed #ccc',\n color: '#ccc',\n 'margin-bottom': '3px',\n padding: '3px',\n 'text-align': 'center'\n });\n\n // Section about joining target layer and external dataset:\n section1.append('p').attr('id', 'join_section').styles({ 'text-align': 'center', 'margin-top': '2px', 'margin-bottom': '1px' }).html('');\n\n section1.append('p').attr('id', 'layout_layers_section').styles({ display: 'none', 'margin-top': '2px' });\n\n section1.append('hr').style('border-top', '2px #ccc');\n\n section1.append('p').attrs({\n id: 'info_section1',\n class: 'i18n',\n 'data-i18n': '[data-ot]app_page.tooltips.section1',\n 'data-ot-remove-elements-on-hide': true\n }).styles({\n margin: 'auto',\n float: 'right'\n }).append('img').attrs({\n alt: 'info',\n src: 'static/img/Information.png'\n });\n\n var dv11 = section1.append('div').style('width', 'auto');\n\n dv11.append('img').attrs({\n id: 'img_in_geom',\n src: 'static/img/b/addgeom.png',\n width: '25',\n height: '25',\n alt: 'Geometry layer'\n }).style('cursor', 'pointer').on('click', click_button_add_layer);\n\n dv11.append('p').attrs({ id: 'input_geom', class: 'i18n' }).styles({\n cursor: 'pointer',\n display: 'inline',\n 'font-weight': 'bold',\n 'margin-left': '4px',\n 'vertical-align': 'super'\n }).attr('data-i18n', '[html]app_page.section1.add_geom').on('click', click_button_add_layer);\n\n var dv12 = section1.append('div');\n dv12.append('img').attrs({\n id: 'img_data_ext',\n src: 'static/img/b/addtabular.png',\n width: '25',\n height: '25',\n alt: 'Additional dataset'\n }).style('cursor', 'pointer').on('click', click_button_add_layer);\n\n dv12.append('p').attrs({\n id: 'data_ext',\n class: 'i18n',\n 'data-i18n': '[html]app_page.section1.add_ext_dataset'\n }).styles({\n cursor: 'pointer',\n display: 'inline',\n 'font-weight': 'bold',\n 'margin-left': '4px',\n 'vertical-align': 'super'\n }).on('click', click_button_add_layer);\n\n var div_sample = section1.append('div').attr('id', 'sample_zone');\n div_sample.append('img').attrs({\n alt: 'Sample layers',\n id: 'sample_button',\n width: '25',\n height: '25',\n src: 'static/img/b/addsample.png'\n }).style('cursor', 'pointer').on('click', _layers.add_sample_layer);\n\n div_sample.append('span').attrs({\n id: 'sample_link',\n class: 'i18n',\n 'data-i18n': '[html]app_page.section1.add_sample_data'\n }).styles({\n cursor: 'pointer',\n display: 'inline',\n 'font-weight': 'bold',\n 'margin-left': '4px',\n 'vertical-align': 'super'\n }).on('click', _layers.add_sample_layer);\n\n section1.append('p').styles({ 'text-align': 'center', margin: '5px' }).insert('button').attrs({\n id: 'btn_type_fields',\n class: 'i18n',\n 'data-i18n': '[html]app_page.box_type_fields.title',\n disabled: true\n }).styles({\n 'border-radius': '4px',\n cursor: 'pointer',\n border: '1px solid lightgrey',\n padding: '3.5px'\n }).html(_tr('app_page.box_type_fields.title')).on('click', function () {\n var layer_name = Object.keys(data_manager.user_data)[0];\n (0, _helpers.make_box_type_fields)(layer_name);\n });\n}\n\n//# sourceURL=webpack:///./js/ui/section1.js?");
-
-/***/ }),
-
-/***/ "./js/ui/section2.js":
-/*!***************************!*\
- !*** ./js/ui/section2.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeSection2;\n\nvar _function = __webpack_require__(/*! ./../function */ \"./js/function.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nfunction makeSection2() {\n var list_fun_ico = ['prop.png', 'choro.png', 'typo.png', 'choroprop.png', 'proptypo.png', 'grid.png', 'cartogram.png', 'smooth.png', 'discont.png', 'typosymbol.png', 'flow.png', 'two_stocks.png'];\n\n var function_panel = d3.select('#section2_pre').append('div').attr('id', 'list_ico_func');\n\n var _loop = function _loop(i, len_i) {\n var ico_name = list_fun_ico[i],\n func_name = ico_name.split('.')[0],\n\n // func_desc = get_menu_option(func_name).desc,\n margin_value = '5px 16px';\n function_panel.insert('img').styles({\n margin: margin_value, cursor: 'pointer', width: '50px', float: 'left'\n }).attrs({\n class: 'i18n tt_func',\n 'data-i18n': ['[data-ot]app_page.func_description.', func_name].join(''),\n 'data-ot-delay': 0,\n 'data-ot-fixed': true,\n 'data-ot-hideDelay': 0,\n 'data-ot-target': true,\n id: 'button_' + func_name,\n src: ['static/img/func_icons2/', ico_name].join('')\n }).on('click', function () {\n // Do some clean-up related to the previously displayed options :\n if (window.fields_handler) {\n if (this.classList.contains('active')) {\n (0, _interface.switch_accordion_section)('btn_s2b');\n return;\n }\n (0, _function.clean_menu_function)();\n }\n\n document.getElementById('accordion2b').style.display = '';\n // Get the function to fill the menu with the appropriate options (and do it):\n _app.current_functionnality = (0, _function.get_menu_option)(func_name);\n // const make_menu = _app.current_functionnality.menu_factory();\n // make_menu();\n _app.current_functionnality.menu_factory()();\n window.fields_handler = _app.current_functionnality.fields_handler();\n\n // Replace the title of the section:\n var selec_title = document.getElementById('btn_s2b');\n // selec_title.innerHTML = '' +\n // _tr('app_page.common.representation') +\n // ' : ' +\n // _tr('app_page.func_title.' + global._app.current_functionnality.name) +\n // ' ';\n selec_title.innerHTML = '\\n' + _tr('app_page.common.representation') + ' \\n : \\n\\n' + _tr(['app_page.func_title.', global._app.current_functionnality.name].join('')) + ' ';\n\n selec_title.style.display = '';\n\n // Don't fill the menu / don't highlight the icon\n // if the type of representation is not allowed :\n if (this.style.filter !== 'grayscale(100%)') {\n this.classList.add('active');\n // Highlight the icon of the selected functionnality :\n this.style.filter = 'invert(100%) saturate(200%)';\n\n // Fill the field of the functionnality with the field\n // of the targeted layer if already uploaded by the user :\n if (global._app.targeted_layer_added) {\n var target_layer = Object.getOwnPropertyNames(data_manager.user_data)[0];\n fields_handler.fill(target_layer);\n }\n\n // Specific case for flow/link functionnality as we are also\n // filling the fields with data from the uploaded tabular file if any :\n if (func_name === 'flow' && data_manager.joined_dataset) {\n fields_handler.fill();\n }\n }\n (0, _interface.switch_accordion_section)('btn_s2b');\n });\n };\n\n for (var i = 0, len_i = list_fun_ico.length; i < len_i; i++) {\n _loop(i, len_i);\n }\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/ui/section2.js?");
-
-/***/ }),
-
-/***/ "./js/ui/section3.js":
-/*!***************************!*\
- !*** ./js/ui/section3.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeSection3;\n\nvar _sortablejs = __webpack_require__(/*! sortablejs */ \"./node_modules/sortablejs/Sortable.js\");\n\nvar _sortablejs2 = _interopRequireDefault(_sortablejs);\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction makeSection3() {\n var section3 = d3.select('#menu').select('#section3');\n\n section3.append('div').append('ul').attrs({ id: 'sortable', class: 'layer_list' });\n\n new _sortablejs2.default(document.getElementById('sortable'), {\n animation: 100,\n onUpdate: function onUpdate(a) {\n // Set the layer order on the map in concordance with the user changes\n // in the layer manager with a pretty rusty 'sorting' algorythm :\n var desired_order = [],\n actual_order = [],\n layers = svg_map.querySelectorAll('.layer');\n var at_end = null;\n if (document.getElementById('info_features').className === 'active') {\n (0, _interface.displayInfoOnMove)();\n at_end = true;\n }\n\n for (var i = 0, len_i = a.target.childNodes.length; i < len_i; i++) {\n var n = a.target.childNodes[i].getAttribute('layer_name');\n desired_order[i] = global._app.layer_to_id.get(n);\n actual_order[i] = layers[i].id;\n }\n for (var _i = 0, len = desired_order.length; _i < len; _i++) {\n // const lyr1 = document.getElementById(desired_order[i]),\n // lyr2 = document.getElementById(desired_order[i + 1]) ||\n // document.getElementById(desired_order[i]);\n // svg_map.insertBefore(lyr2, lyr1);\n var lyr = document.getElementById(desired_order[_i]);\n svg_map.insertBefore(document.getElementById(desired_order[_i + 1]) || lyr, lyr);\n }\n if (at_end) (0, _interface.displayInfoOnMove)();\n },\n onStart: function onStart() {\n document.body.classList.add('no-drop');\n },\n onEnd: function onEnd() {\n document.body.classList.remove('no-drop');\n }\n });\n}\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./js/ui/section3.js?");
-
-/***/ }),
-
-/***/ "./js/ui/section4.js":
-/*!***************************!*\
- !*** ./js/ui/section4.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeSection4;\n\nvar _section = __webpack_require__(/*! ./section5 */ \"./js/ui/section5.js\");\n\nvar _helpers_calc = __webpack_require__(/*! ./../helpers_calc */ \"./js/helpers_calc.js\");\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./../interface */ \"./js/interface.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./../map_ctrl */ \"./js/map_ctrl.js\");\n\nvar _helpers = __webpack_require__(/*! ./../layout_features/helpers */ \"./js/layout_features/helpers.js\");\n\nvar _buttons = __webpack_require__(/*! ./../ui/buttons */ \"./js/ui/buttons.js\");\n\nfunction makeSection4() {\n var zoom_prop = svg_map.__zoom;\n var section4 = d3.select('#section4');\n var dv4 = section4.append('div').style('margin', 'auto').append('ul').attr('class', 'config_map_options');\n\n var e = dv4.append('li').styles({\n 'text-align': 'center'\n });\n\n e.append('input').attrs({\n id: 'title',\n class: 'list_elem_section4 i18n',\n placeholder: '',\n 'data-i18n': '[placeholder]app_page.section4.map_title'\n }).styles({ margin: '0px 0px 0px 3px', width: '160px' }).on('keyup', function () {\n (0, _interface.handle_title)(this.value);\n });\n\n e.append('span').styles({\n display: 'inline', top: '4px', cursor: 'pointer', 'vertical-align': 'sub'\n }).html(_buttons.sys_run_button.replace('submit', 'Title properties')).on('click', _interface.handle_title_properties);\n\n var f = dv4.append('li');\n f.append('input').styles({\n position: 'absolute', right: '20px', width: '60px', 'margin-left': '15px'\n }).attrs({ type: 'color', id: 'bg_color', class: 'list_elem_section4 m_elem_right' }).property('value', '#ffffff').on('change', function () {\n (0, _map_ctrl.handle_bg_color)(this.value);\n });\n f.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.background_color'\n });\n\n var a1 = dv4.append('li');\n a1.append('input').attrs({ id: 'input-width', type: 'number', class: 'list_elem_section4 m_elem_right' }).property('value', w).on('change', function () {\n var new_width = +this.value;\n if (new_width === 0 || isNaN(new_width)) {\n this.value = w;\n return;\n }\n var ratio_type = document.getElementById('map_ratio_select').value;\n if (ratio_type === 'portrait') {\n h = (0, _helpers_calc.round_value)(new_width / 0.70707, 0);\n (0, _map_ctrl.canvas_mod_size)([new_width, h]);\n } else if (ratio_type === 'landscape') {\n h = (0, _helpers_calc.round_value)(new_width * 0.70707, 0);\n (0, _map_ctrl.canvas_mod_size)([new_width, h]);\n } else {\n (0, _map_ctrl.canvas_mod_size)([new_width, null]);\n }\n });\n a1.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.map_width'\n });\n\n var a2 = dv4.append('li');\n a2.append('input').attrs({ id: 'input-height', type: 'number', class: 'm_elem_right list_elem_section4' }).property('value', h).on('change', function () {\n var new_height = +this.value;\n if (new_height === 0 || isNaN(new_height)) {\n this.value = h;\n return;\n }\n var ratio_type = document.getElementById('map_ratio_select').value;\n if (ratio_type === 'portrait') {\n w = (0, _helpers_calc.round_value)(new_height * 0.70707, 0);\n (0, _map_ctrl.canvas_mod_size)([w, new_height]);\n } else if (ratio_type === 'landscape') {\n w = (0, _helpers_calc.round_value)(new_height / 0.70707, 0);\n (0, _map_ctrl.canvas_mod_size)([w, new_height]);\n } else {\n (0, _map_ctrl.canvas_mod_size)([null, new_height]);\n }\n });\n a2.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.map_height'\n });\n\n var b = dv4.append('li');\n var ratio_select = b.append('select').attrs({ class: 'list_elem_section4 i18n m_elem_right', id: 'map_ratio_select' });\n b.append('p').attr('class', 'list_elem_section4 i18n').style('padding', '4px 0').attr('data-i18n', '[html]app_page.section4.map_ratio');\n ratio_select.append('option').text('').attr('data-i18n', '[html]app_page.section4.ratio_user').attr('value', 'ratio_user');\n ratio_select.append('option').text('').attr('data-i18n', '[html]app_page.section4.ratio_landscape').attr('value', 'landscape');\n ratio_select.append('option').text('').attr('data-i18n', '[html]app_page.section4.ratio_portait').attr('value', 'portrait');\n ratio_select.on('change', function () {\n var map_xy = get_map_xy0();\n var dispo_w = document.innerWidth - map_xy.x - 1;\n var dispo_h = document.innerHeight - map_xy.y - 1;\n var diff_w = dispo_w - w;\n var diff_h = dispo_h - h;\n if (this.value === 'portrait') {\n if ((0, _helpers_calc.round_value)(w / h, 1) === 1.4) {\n var tmp = h;\n h = w;\n w = tmp;\n } else if (diff_h >= diff_w) {\n w = (0, _helpers_calc.round_value)(h * 0.70707, 0);\n } else {\n h = (0, _helpers_calc.round_value)(w / 0.70707, 0);\n }\n } else if (this.value === 'landscape') {\n if ((0, _helpers_calc.round_value)(h / w, 1) === 1.4) {\n var _tmp = h;\n h = w;\n w = _tmp;\n } else if (diff_h <= diff_w) {\n w = (0, _helpers_calc.round_value)(h / 0.70707, 0);\n } else {\n h = (0, _helpers_calc.round_value)(w * 0.70707, 0);\n }\n }\n (0, _map_ctrl.canvas_mod_size)([w, h]);\n (0, _section.fill_export_png_options)(this.value);\n });\n\n var d2 = dv4.append('li');\n d2.append('button').styles({ margin: 0, padding: 0 }).attrs({\n id: 'resize_fit',\n class: 'm_elem_right list_elem_section4 button_st4 i18n',\n 'data-i18n': '[html]app_page.common.ok'\n }).on('click', function () {\n document.getElementById('btn_s4').click();\n window.scrollTo(0, 0);\n w = (0, _helpers_math.Mround)(window.innerWidth - 361);\n h = window.innerHeight - 55;\n (0, _map_ctrl.canvas_mod_size)([w, h]);\n document.getElementById('map_ratio_select').value = 'ratio_user';\n });\n d2.append('p').attr('class', 'list_elem_section4 i18n').attr('data-i18n', '[html]app_page.section4.resize_fit');\n\n var c = dv4.append('li');\n c.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.map_center_menu'\n }).style('cursor', 'pointer');\n c.append('span').attr('id', 'map_center_menu_ico').styles({ display: 'inline-table', cursor: 'pointer' });\n c.on('click', function () {\n var sections = document.getElementsByClassName('to_hide');\n var arg = void 0;\n if (sections[0].style.display === 'none') {\n arg = '';\n document.getElementById('map_center_menu_ico').classList.add('active');\n } else {\n arg = 'none';\n document.getElementById('map_center_menu_ico').classList.remove('active');\n }\n sections[0].style.display = arg;\n sections[1].style.display = arg;\n sections[2].style.display = arg;\n sections[3].style.display = arg;\n });\n\n var c1 = dv4.append('li').style('display', 'none').attr('class', 'to_hide');\n c1.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.map_center_x'\n });\n c1.append('input').attrs({\n id: 'input-center-x',\n class: 'm_elem_right',\n type: 'number',\n step: 'any'\n }).property('value', (0, _helpers_calc.round_value)(zoom_prop.x, 2)).on('change', function () {\n svg_map.__zoom.x = +this.value;\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var c2 = dv4.append('li').style('display', 'none').attr('class', 'to_hide');\n c2.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.map_center_y'\n });\n c2.append('input').attrs({\n id: 'input-center-y',\n class: 'list_elem_section4 m_elem_right',\n type: 'number',\n step: 'any'\n }).property('value', (0, _helpers_calc.round_value)(zoom_prop.y, 2)).on('change', function () {\n svg_map.__zoom.y = +this.value;\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var d = dv4.append('li').style('display', 'none').attr('class', 'to_hide');\n d.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.map_scale_k'\n });\n d.append('input').attrs({\n id: 'input-scale-k',\n class: 'list_elem_section4 m_elem_right',\n type: 'number',\n step: 'any'\n }).property('value', function () {\n var _k = zoom_prop.k * proj.scale();\n return _k > 2 || _k < -2 ? (0, _helpers_calc.round_value)(_k, 2) : (0, _helpers_calc.round_value)(_k, Math.round((0, _helpers_calc.get_nb_decimals)(_k) / 2));\n }).on('change', function () {\n svg_map.__zoom.k = +this.value / proj.scale();\n (0, _map_ctrl.zoom_without_redraw)();\n });\n\n var g = dv4.append('li').style('display', 'none').attr('class', 'to_hide');\n g.append('p').attrs({\n class: 'list_elem_section4 i18n',\n 'data-i18n': '[html]app_page.section4.canvas_rotation'\n });\n\n g.append('span').style('float', 'right').html('°');\n\n g.append('input').attrs({\n id: 'canvas_rotation_value_txt',\n class: 'without_spinner',\n type: 'number',\n min: 0,\n max: 360,\n step: 'any'\n }).styles({ width: '30px', 'margin-left': '10px', float: 'right' }).property('value', 0).on('change', function () {\n var val = +this.value,\n old_value = document.getElementById('form_rotate').value;\n if (isNaN(val) || val < -361) {\n this.value = old_value;\n return;\n } else if (val < 0 && val > -361) {\n this.value = 360 + val;\n } else if (val > 360) {\n this.value = 360;\n } else {\n // Should remove trailing zeros (right/left) if any :\n this.value = +this.value;\n }\n (0, _map_ctrl.rotate_global)(this.value);\n document.getElementById('form_rotate').value = this.value;\n });\n\n g.append('input').attrs({\n type: 'range',\n id: 'form_rotate',\n min: 0,\n max: 360,\n step: 1\n }).styles({\n width: '80px',\n margin: '0px 10px 5px 15px',\n float: 'right'\n }).property('value', 0).on('input', function () {\n (0, _map_ctrl.rotate_global)(this.value);\n document.getElementById('canvas_rotation_value_txt').value = this.value;\n });\n\n var g2 = dv4.append('li');\n g2.append('input').styles({ margin: 0, padding: 0 }).attrs({\n id: 'autoalign_features',\n type: 'checkbox',\n class: 'm_elem_right list_elem_section4 i18n'\n }).on('change', function () {\n _app.autoalign_features = this.checked;\n });\n g2.append('p').attr('class', 'list_elem_section4 i18n').attr('data-i18n', '[html]app_page.section4.autoalign_features');\n\n var _i = dv4.append('li').styles({ 'text-align': 'center' });\n _i.insert('p').styles({ clear: 'both', display: 'block', margin: 0 }).attrs({\n class: 'i18n', 'data-i18n': '[html]app_page.section4.layout_features'\n });\n var p1 = _i.insert('p').styles({ display: 'inline-block', margin: 'auto' });\n p1.insert('span').insert('img').attrs({\n id: 'btn_arrow',\n src: 'static/img/layout_icons/arrow-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.arrow'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('arrow');\n });\n p1.insert('span').insert('img').attrs({\n id: 'btn_text_annot',\n src: 'static/img/layout_icons/text-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.text_annot'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('text_annot');\n });\n if (!window.isIE) {\n p1.insert('span').insert('img').attrs({\n id: 'btn_symbol',\n src: 'static/img/layout_icons/symbols-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.symbol'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('symbol');\n });\n }\n p1.insert('span').insert('img').attrs({\n id: 'btn_rectangle',\n src: 'static/img/layout_icons/rect-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.rectangle'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('rectangle');\n });\n p1.insert('span').insert('img').attrs({\n id: 'btn_ellipse',\n src: 'static/img/layout_icons/ellipse-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.ellipse'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('ellipse');\n });\n\n var p2 = _i.insert('p').styles({ display: 'inline-block', margin: 'auto' });\n p2.insert('span').insert('img').attrs({\n id: 'btn_graticule',\n src: 'static/img/layout_icons/graticule-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.graticule'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('graticule');\n });\n p2.insert('span').insert('img').attrs({\n id: 'btn_north',\n src: 'static/img/layout_icons/north-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.north_arrow'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('north_arrow');\n });\n p2.insert('span').insert('img').attrs({\n id: 'btn_scale',\n src: 'static/img/layout_icons/scale.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.scale'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('scale');\n });\n p2.insert('span').insert('img').attrs({\n id: 'btn_sphere',\n src: 'static/img/layout_icons/sphere-01.png',\n class: 'layout_ft_ico i18n tt',\n 'data-i18n': '[title]app_page.layout_features_box.sphere'\n }).on('click', function () {\n return (0, _helpers.add_layout_feature)('sphere');\n });\n}\n\n//# sourceURL=webpack:///./js/ui/section4.js?");
-
-/***/ }),
-
-/***/ "./js/ui/section5.js":
-/*!***************************!*\
- !*** ./js/ui/section5.js ***!
- \***************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.makeSection5 = makeSection5;\nexports.fill_export_png_options = fill_export_png_options;\n\nvar _helpers_math = __webpack_require__(/*! ./../helpers_math */ \"./js/helpers_math.js\");\n\nvar _map_export = __webpack_require__(/*! ./../map_export */ \"./js/map_export.js\");\n\nfunction makeSection5() {\n var section5b = d3.select('#section5');\n var dv5b = section5b.append('div');\n\n var type_export = dv5b.append('p');\n type_export.append('span').attrs({\n class: 'i18n', 'data-i18n': '[html]app_page.section5b.type'\n });\n var select_type_export = type_export.append('select').attrs({ id: 'select_export_type', class: 'm_elem_right' }).on('change', function () {\n var type = this.value,\n export_filename = document.getElementById('export_filename');\n if (type === 'svg') {\n document.getElementById('export_options_svg').style.display = '';\n document.getElementById('export_options_geo').style.display = 'none';\n document.getElementById('export_options_png').style.display = 'none';\n export_filename.value = 'export.svg';\n export_filename.style.display = '';\n export_filename.previousSibling.style.display = '';\n } else if (type === 'png') {\n document.getElementById('export_options_svg').style.display = 'none';\n document.getElementById('export_options_geo').style.display = 'none';\n document.getElementById('export_options_png').style.display = '';\n export_filename.value = 'export.png';\n export_filename.style.display = '';\n export_filename.previousSibling.style.display = '';\n } else if (type === 'geo') {\n document.getElementById('export_options_svg').style.display = 'none';\n document.getElementById('export_options_png').style.display = 'none';\n document.getElementById('export_options_geo').style.display = '';\n export_filename.style.display = 'none';\n export_filename.previousSibling.style.display = 'none';\n }\n });\n\n select_type_export.append('option').text('SVG').attr('value', 'svg');\n select_type_export.append('option').text('PNG').attr('value', 'png');\n select_type_export.append('option').text('GEO').attr('value', 'geo');\n\n var export_svg_options = dv5b.append('p').attr('id', 'export_options_svg').style('padding-top', '10px');\n\n export_svg_options.append('label').attrs({\n class: 'i18n',\n 'data-i18n': '[html]app_page.section5b.clip_svg_export',\n for: 'clip_svg_export'\n });\n\n export_svg_options.append('input').attrs({\n id: 'clip_svg_export',\n type: 'checkbox'\n }).styles({\n float: 'right',\n margin: 'auto'\n }).property('checked', true);\n\n var export_png_options = dv5b.append('p').attr('id', 'export_options_png').style('display', 'none');\n\n export_png_options.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.section5b.format' });\n\n var select_size_png = export_png_options.append('select').attrs({ id: 'select_png_format', class: 'm_elem_right' });\n\n fill_export_png_options('user_defined');\n\n select_size_png.on('change', function () {\n var value = this.value,\n unit = value === 'web' ? ' (px)' : ' (cm)',\n in_h = document.getElementById('export_png_height'),\n in_w = document.getElementById('export_png_width');\n if (value === 'web') {\n in_h.value = h;\n in_w.value = w;\n } else if (value === 'user_defined') {\n in_h.value = (0, _helpers_math.Mround)(h / 118.11 * 10) / 10;\n in_w.value = (0, _helpers_math.Mround)(w / 118.11 * 10) / 10;\n } else if (value === 'A4_landscape') {\n in_h.value = 21.0;\n in_w.value = 29.7;\n } else if (value === 'A4_portrait') {\n in_h.value = 29.7;\n in_w.value = 21.0;\n } else if (value === 'A3_landscape') {\n in_h.value = 42.0;\n in_w.value = 29.7;\n } else if (value === 'A3_portrait') {\n in_h.value = 29.7;\n in_w.value = 42.0;\n } else if (value === 'A5_landscape') {\n in_h.value = 14.8;\n in_w.value = 21.0;\n } else if (value === 'A5_portrait') {\n in_h.value = 21.0;\n in_w.value = 14.8;\n }\n document.getElementById('export_png_width_txt').innerHTML = unit;\n document.getElementById('export_png_height_txt').innerHTML = unit;\n if (value.indexOf('portrait') > -1 || value.indexOf('landscape') > -1) {\n in_h.disabled = 'disabled';\n in_w.disabled = 'disabled';\n } else {\n in_h.disabled = undefined;\n in_w.disabled = undefined;\n }\n });\n\n var exp_a = export_png_options.append('p').style('margin', '20px 0');\n exp_a.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.section5b.width' });\n\n exp_a.append('input').style('width', '60px').attrs({\n id: 'export_png_width', class: 'm_elem_right', type: 'number', step: 0.1\n }).property('value', w).on('change', function () {\n var ratio = h / w,\n export_png_height = document.getElementById('export_png_height');\n export_png_height.value = (0, _helpers_math.Mround)(+this.value * ratio * 10) / 10;\n });\n\n exp_a.append('span').attr('id', 'export_png_width_txt').html(' (px)');\n\n var exp_b = export_png_options.append('p').style('margin', '20px 0');\n exp_b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.section5b.height' });\n\n exp_b.append('input').style('width', '60px').attrs({\n id: 'export_png_height', class: 'm_elem_right', type: 'number', step: 0.1\n }).property('value', h).on('change', function () {\n var ratio = h / w,\n export_png_width = document.getElementById('export_png_width');\n export_png_width.value = (0, _helpers_math.Mround)(+this.value / ratio * 10) / 10;\n });\n\n exp_b.append('span').attr('id', 'export_png_height_txt').html(' (px)');\n\n var export_name = dv5b.append('p');\n export_name.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.section5b.filename' });\n\n export_name.append('input').attrs({ id: 'export_filename', class: 'm_elem_right', type: 'text' }).property('value', 'export.svg');\n\n var export_geo_options = dv5b.append('p').attr('id', 'export_options_geo').style('display', 'none');\n\n var geo_a = export_geo_options.append('p').style('margin', '5px 5px 40px 0');\n geo_a.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.export_box.option_layer' });\n\n geo_a.insert('select').styles({ margin: '20px 0', 'max-width': '280px' }).attrs({ id: 'layer_to_export', class: 'i18n m_elem_right' });\n\n var geo_b = export_geo_options.append('p').styles({ clear: 'both' }); // 'margin-top': '35px !important'\n geo_b.append('span').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.export_box.option_datatype' });\n var selec_type = geo_b.insert('select').attrs({ id: 'datatype_to_use', class: 'i18n m_elem_right' }).style('margin-top', '5px');\n\n export_geo_options.append('p').style('margin', 'auto').attrs({ class: 'i18n', 'data-i18n': '[html]app_page.export_box.option_projection' });\n var geo_c = export_geo_options.append('p').style('margin', '5px 5px 30px 5px');\n var selec_projection = geo_c.insert('select').styles({\n float: 'right', 'font-size': '10.5px'\n }).attrs({ id: 'projection_to_use', disabled: true, class: 'i18n m_elem_right' });\n\n var proj4_input = export_geo_options.append('p').style('margin', 'auto').insert('input').attr('id', 'proj4str').styles({\n display: 'none',\n width: '275px',\n position: 'relative',\n float: 'right',\n 'margin-right': '5px',\n 'font-size': '10.5px'\n });\n\n var ok_button = dv5b.append('p').style('float', 'left').append('button').attrs({\n id: 'export_button_section5b',\n class: 'i18n button_st4',\n 'data-i18n': '[html]app_page.section5b.export_button'\n });\n\n proj4_input.on('keyup', function () {\n ok_button.disabled = this.value.length === 0 ? 'true' : '';\n });\n\n ['GeoJSON', 'TopoJSON', 'ESRI Shapefile', 'GML', 'KML'].forEach(function (name) {\n selec_type.append('option').attr('value', name).text(name);\n });\n\n [['app_page.section5b.wgs84', 'epsg:4326'], ['app_page.section5b.web_mercator', 'epsg:3857'], ['app_page.section5b.laea_europe', 'epsg:3035'], ['app_page.section5b.usa_albers', '+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs'], ['app_page.section5b.british_national_grid', 'epsg:27700'], ['app_page.section5b.lambert93', 'epsg:2154'], ['app_page.section5b.eckert_4', '+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs '], ['app_page.section5b.proj4_prompt', 'proj4string']].forEach(function (projection) {\n selec_projection.append('option').attrs({ class: 'i18n', value: projection[1], 'data-i18n': projection[0] }).text(_tr(projection[0]));\n });\n\n selec_type.on('change', function () {\n if (this.value === 'TopoJSON' || this.value === 'KML' || this.value === 'GeoJSON') {\n selec_projection.node().options.selectedIndex = 0;\n selec_projection.attr('disabled', true);\n ok_button.disabled = '';\n } else {\n selec_projection.attr('disabled', null);\n }\n });\n\n selec_projection.on('change', function () {\n if (this.value === 'proj4string') {\n proj4_input.style('display', 'initial');\n if (proj4_input.node().value === '' || proj4_input.node().value === undefined) {\n ok_button.disabled = 'true';\n }\n } else {\n proj4_input.style('display', 'none');\n ok_button.disabled = '';\n }\n });\n\n ok_button.on('click', function () {\n var type_exp = document.getElementById('select_export_type').value;\n var exp_name = document.getElementById('export_filename').value;\n\n if (type_exp === 'svg') {\n var clip_svg = !!document.getElementById('clip_svg_export').checked;\n (0, _map_export.export_compo_svg)(exp_name, clip_svg);\n } else if (type_exp === 'geo') {\n var layer_name = document.getElementById('layer_to_export').value,\n type = document.getElementById('datatype_to_use').value,\n proj = document.getElementById('projection_to_use').value,\n proj4value = document.getElementById('proj4str').value;\n (0, _map_export.export_layer_geo)(layer_name, type, proj, proj4value);\n } else if (type_exp === 'png') {\n var exp_format = document.getElementById('select_png_format').value;\n var exp_height = +document.getElementById('export_png_height').value;\n var ratio = void 0;\n if (exp_format === 'web') {\n ratio = exp_height / +h;\n } else {\n ratio = exp_height * 118.11 / +h;\n }\n (0, _map_export.export_compo_png)(ratio, exp_name);\n }\n });\n}\n\nfunction fill_export_png_options(displayed_ratio) {\n var select_size_png = d3.select('#select_png_format');\n select_size_png.selectAll('option').remove();\n\n select_size_png.append('option').attrs({ value: 'web', class: 'i18n', 'data-i18n': '[text]app_page.section5b.web' });\n select_size_png.append('option').attrs({ value: 'user_defined', class: 'i18n', 'data-i18n': '[text]app_page.section5b.user_defined' });\n\n if (displayed_ratio === 'portrait') {\n select_size_png.append('option').attrs({ value: 'A5_portrait', class: 'i18n', 'data-i18n': '[text]app_page.section5b.A5_portrait' });\n select_size_png.append('option').attrs({ value: 'A4_portrait', class: 'i18n', 'data-i18n': '[text]app_page.section5b.A4_portrait' });\n select_size_png.append('option').attrs({ value: 'A3_portrait', class: 'i18n', 'data-i18n': '[text]app_page.section5b.A3_portrait' });\n } else if (displayed_ratio === 'landscape') {\n select_size_png.append('option').attrs({ value: 'A5_landscape', class: 'i18n', 'data-i18n': '[text]app_page.section5b.A5_landscape' });\n select_size_png.append('option').attrs({ value: 'A4_landscape', class: 'i18n', 'data-i18n': '[text]app_page.section5b.A4_landscape' });\n select_size_png.append('option').attrs({ value: 'A3_landscape', class: 'i18n', 'data-i18n': '[text]app_page.section5b.A3_landscape' });\n }\n localize('#select_png_format > .i18n');\n}\n\n//# sourceURL=webpack:///./js/ui/section5.js?");
-
-/***/ }),
-
-/***/ "./js/zoom_rect.js":
-/*!*************************!*\
- !*** ./js/zoom_rect.js ***!
- \*************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = handleZoomRect;\n\nvar _helpers_math = __webpack_require__(/*! ./helpers_math */ \"./js/helpers_math.js\");\n\nvar _interface = __webpack_require__(/*! ./interface */ \"./js/interface.js\");\n\nvar _map_ctrl = __webpack_require__(/*! ./map_ctrl */ \"./js/map_ctrl.js\");\n\n/**\n* Function handling the click on the map and the brush effect when\n* the \"zoom by tracing a rectangle\" is enabled.\n* It may fail on some projections when the user click outside of the sphere.\n*\n* @return {void}\n*/\nvar makeZoomRect = function makeZoomRect() {\n if (!proj.invert) return;\n var brush = d3.brush().on('end', brushended);\n var idleDelay = 350;\n var idleTimeout = void 0;\n function idled() {\n idleTimeout = null;\n }\n function brushended() {\n var s = d3.event.selection;\n if (!s) {\n if (!idleTimeout) {\n idleTimeout = setTimeout(idled, idleDelay);\n return idleTimeout;\n }\n } else {\n var x_min = s[0][0];\n var x_max = s[1][0];\n var y_min = s[1][1];\n var y_max = s[0][1];\n var transform = d3.zoomTransform(svg_map);\n var z_trans = [transform.x, transform.y];\n var z_scale = transform.k;\n\n var pt1 = proj.invert([(x_min - z_trans[0]) / z_scale, (y_min - z_trans[1]) / z_scale]);\n var pt2 = proj.invert([(x_max - z_trans[0]) / z_scale, (y_max - z_trans[1]) / z_scale]);\n var path_bounds = path.bounds({ type: 'MultiPoint', coordinates: [pt1, pt2] });\n // Todo : use these two points to make zoom on them\n map.select('.brush').call(brush.move, null);\n\n var zoom_scale = 0.95 / (0, _helpers_math.Mmax)((path_bounds[1][0] - path_bounds[0][0]) / w, (path_bounds[1][1] - path_bounds[0][1]) / h);\n // const zoom_translate = [\n // (w - zoom_scale * (path_bounds[1][0] + path_bounds[0][0])) / 2,\n // (h - zoom_scale * (path_bounds[1][1] + path_bounds[0][1])) / 2,\n // ];\n svg_map.__zoom.k = zoom_scale;\n svg_map.__zoom.x = (w - zoom_scale * (path_bounds[1][0] + path_bounds[0][0])) / 2;\n svg_map.__zoom.y = (h - zoom_scale * (path_bounds[1][1] + path_bounds[0][1])) / 2;\n (0, _map_ctrl.zoom_without_redraw)();\n }\n }\n\n map.append('g').attr('class', 'brush').call(brush);\n};\n\n/**\n* Function triggered when the user click on the \"zoom by tracing a rectangle\"\n* button.\n* If the feature is already active, it disable it. Otherwise it enable it.\n*\n* @return {void}\n*\n*/\nfunction handleZoomRect() {\n var b = map.select('.brush');\n if (b.node()) {\n d3.select('#brush_zoom_button').classed('active', false);\n b.remove();\n } else {\n if (d3.select('#info_button').classed('active')) {\n (0, _interface.displayInfoOnMove)();\n }\n d3.select('#brush_zoom_button').classed('active', true);\n makeZoomRect();\n }\n}\n\n//# sourceURL=webpack:///./js/zoom_rect.js?");
-
-/***/ }),
-
-/***/ "./node_modules/css-loader/dist/cjs.js!./css/context-menu.css":
-/*!********************************************************************!*\
- !*** ./node_modules/css-loader/dist/cjs.js!./css/context-menu.css ***!
- \********************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-eval("exports = module.exports = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Module\nexports.push([module.i, \".context-menu {\\n\\tfont-family: Arial, sans;\\n\\tposition: absolute;\\n\\tbackground: white;\\n\\tborder: 1px solid #c3c3c3;\\n\\tborder-radius: 5px;\\n\\tbox-shadow: 0 5px 5px #c3c3c3;\\n\\tpadding-top: 5px;\\n\\tpadding-bottom: 5px;\\n\\tmin-width: 200px;\\n\\tfont-size: 12pt;\\n}\\n\\n.context-menu ul {\\n\\tlist-style: none;\\n\\tpadding-left: 0;\\n\\tmargin: 0;\\n}\\n\\n.context-menu li {\\n\\tposition: relative;\\n\\tpadding-left: 20px;\\n\\tpadding-right: 30px;\\n\\tcursor: default;\\n}\\n\\n.context-menu li:hover {\\n\\t//background: #b1b1ff;\\n background: rgba(145, 209, 230, 0.52);\\n color: rgb(0,0,0);\\n}\\n\\n.context-menu li span.arrow {\\n\\tposition: absolute;\\n\\tfont-size: 0.8em;\\n\\tright: 10px;\\n}\\n\\n.context-menu li div.context-menu {\\n\\tleft: 100%;\\n\\ttop: -5px;\\n}\", \"\"]);\n\n\n//# sourceURL=webpack:///./css/context-menu.css?./node_modules/css-loader/dist/cjs.js");
-
-/***/ }),
-
-/***/ "./node_modules/css-loader/dist/cjs.js!./css/discretization.css":
-/*!**********************************************************************!*\
- !*** ./node_modules/css-loader/dist/cjs.js!./css/discretization.css ***!
- \**********************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-eval("exports = module.exports = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Module\nexports.push([module.i, \"#discretization_panel {\\n float: left;\\n font-size: 11px;\\n margin: 15px 0 0 27.5px;\\n}\\n\\n#ref_histo_box {\\n float: right;\\n margin-top: 11px;\\n font-size: 10.5px;\\n}\\n\\nlabel_it_inline {\\n font-size: 10px;\\n display: inline;\\n}\\n\\n#svg_discretization .y_axis, #svg_discretization .x_axis {\\n stroke-width: 0.2;\\n}\\n\\n.btn_mean {\\n background: #3498db;\\n background-image: -webkit-linear-gradient(top, #3498db, #2980b9);\\n background-image: -moz-linear-gradient(top, #3498db, #2980b9);\\n background-image: -ms-linear-gradient(top, #3498db, #2980b9);\\n background-image: -o-linear-gradient(top, #3498db, #2980b9);\\n background-image: linear-gradient(to bottom, #3498db, #2980b9);\\n -webkit-border-radius: 28;\\n -moz-border-radius: 28;\\n border-radius: 28px;\\n font-family: Arial;\\n color: #ffffff !important;\\n font-size: 14px;\\n padding: 10px 17px 10px 17px;\\n text-decoration: none;\\n}\\n\\n.btn_mean.active {\\n border: solid #1f628d 3px;\\n}\\n\\n.btn_mean:hover {\\n background: #3cb0fd;\\n background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);\\n background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);\\n background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);\\n background-image: -o-linear-gradient(top, #3cb0fd, #3498db);\\n background-image: linear-gradient(to bottom, #3cb0fd, #3498db);\\n text-decoration: none;\\n}\\n\\n.btn_median {\\n background: #64d95e;\\n background-image: -webkit-linear-gradient(top, #64d95e, #53ba4e);\\n background-image: -moz-linear-gradient(top, #64d95e, #53ba4e);\\n background-image: -ms-linear-gradient(top, #64d95e, #53ba4e);\\n background-image: -o-linear-gradient(top, #64d95e, #53ba4e);\\n background-image: linear-gradient(to bottom, #64d95e, #53ba4e);\\n -webkit-border-radius: 28;\\n -moz-border-radius: 28;\\n border-radius: 28px;\\n font-family: Arial;\\n color: #ffffff !important;\\n font-size: 14px;\\n padding: 10px 17px 10px 17px;\\n text-decoration: none;\\n}\\n\\n.btn_median.active {\\n border: solid #43963f 3px;\\n}\\n\\n.btn_median:hover {\\n background: #7afc74;\\n background-image: -webkit-linear-gradient(top, #7afc74, #62db5c);\\n background-image: -moz-linear-gradient(top, #7afc74, #62db5c);\\n background-image: -ms-linear-gradient(top, #7afc74, #62db5c);\\n background-image: -o-linear-gradient(top, #7afc74, #62db5c);\\n background-image: linear-gradient(to bottom, #7afc74, #62db5c);\\n text-decoration: none;\\n}\\n\\n.btn_population {\\n background: #d93434;\\n background-image: -webkit-linear-gradient(top, #d93434, #b82b2b);\\n background-image: -moz-linear-gradient(top, #d93434, #b82b2b);\\n background-image: -ms-linear-gradient(top, #d93434, #b82b2b);\\n background-image: -o-linear-gradient(top, #d93434, #b82b2b);\\n background-image: linear-gradient(to bottom, #d93434, #b82b2b);\\n -webkit-border-radius: 28;\\n -moz-border-radius: 28;\\n border-radius: 28px;\\n font-family: Arial;\\n color: #ffffff !important;\\n font-size: 14px;\\n padding: 10px 17px 10px 17px;\\n text-decoration: none;\\n}\\n\\n.btn_population.active {\\n border: solid #8c1f1f 3px;\\n}\\n\\n.btn_population:hover {\\n background: #fc3c3c;\\n background-image: -webkit-linear-gradient(top, #fc3c3c, #d9343c);\\n background-image: -moz-linear-gradient(top, #fc3c3c, #d9343c);\\n background-image: -ms-linear-gradient(top, #fc3c3c, #d9343c);\\n background-image: -o-linear-gradient(top, #fc3c3c, #d9343c);\\n background-image: linear-gradient(to bottom, #fc3c3c, #d9343c);\\n text-decoration: none;\\n}\\n\\n.btn_stddev {\\n background: #d6d934;\\n background-image: -webkit-linear-gradient(top, #d6d934, #afb82c);\\n background-image: -moz-linear-gradient(top, #d6d934, #afb82c);\\n background-image: -ms-linear-gradient(top, #d6d934, #afb82c);\\n background-image: -o-linear-gradient(top, #d6d934, #afb82c);\\n background-image: linear-gradient(to bottom, #d6d934, #afb82c);\\n -webkit-border-radius: 28;\\n -moz-border-radius: 28;\\n border-radius: 28px;\\n font-family: Arial;\\n color: #ffffff !important;\\n font-size: 14px;\\n padding: 10px 17px 10px 17px;\\n text-decoration: none;\\n}\\n\\n.btn_stddev.active {\\n border: solid #838a20 3px;\\n}\\n\\n.btn_stddev:hover {\\n background: #edfa3c;\\n background-image: -webkit-linear-gradient(top, #edfa3c, #d6d934);\\n background-image: -moz-linear-gradient(top, #edfa3c, #d6d934);\\n background-image: -ms-linear-gradient(top, #edfa3c, #d6d934);\\n background-image: -o-linear-gradient(top, #edfa3c, #d6d934);\\n background-image: linear-gradient(to bottom, #edfa3c, #d6d934);\\n text-decoration: none;\\n}\\n\", \"\"]);\n\n\n//# sourceURL=webpack:///./css/discretization.css?./node_modules/css-loader/dist/cjs.js");
-
-/***/ }),
-
-/***/ "./node_modules/css-loader/dist/cjs.js!./css/style.css":
-/*!*************************************************************!*\
- !*** ./node_modules/css-loader/dist/cjs.js!./css/style.css ***!
- \*************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-eval("exports = module.exports = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Module\nexports.push([module.i, \"body {\\n height:100%;\\n width:100%;\\n margin:0px;\\n padding:0px;\\n color: black;\\n background: #e3e3da;\\n -webkit-text-rendering: optimizeLegibility;\\n -moz-text-rendering: optimizeLegibility;\\n text-rendering: optimizeLegibility;\\n}\\n\\nselect {\\n padding: .4em;\\n background: #efefef;\\n border-radius: 0px;\\n border-color: rgb(169,169,169);\\n border-width: 1px;\\n}\\n\\n/* Style for sliders */\\ninput[type=range] {\\n -webkit-appearance: none;\\n width: 100%;\\n margin: 9px 5px 9px 0;\\n}\\ninput[type=range]:focus {\\n outline: none;\\n}\\ninput[type=range]::-webkit-slider-runnable-track {\\n width: 100%;\\n height: 4px;\\n cursor: pointer;\\n box-shadow: 1px 1px 2px #000000, 0px 0px 1px #0d0d0d;\\n background: #3071a9;\\n border-radius: 1.4px;\\n border: 0.2px solid #010101;\\n}\\ninput[type=range]::-webkit-slider-thumb {\\n box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;\\n border: 0.5px solid #000000;\\n height: 18px;\\n width: 8px;\\n border-radius: 3px;\\n background: #ffffff;\\n cursor: pointer;\\n -webkit-appearance: none;\\n margin-top: -9.2px;\\n}\\ninput[type=range]:focus::-webkit-slider-runnable-track {\\n background: #367ebd;\\n}\\ninput[type=range]::-moz-range-track {\\n width: 100%;\\n height: 4px;\\n cursor: pointer;\\n box-shadow: 1px 1px 2px #000000, 0px 0px 1px #0d0d0d;\\n background: #3071a9;\\n border-radius: 1.4px;\\n border: 0.2px solid #010101;\\n}\\ninput[type=range]::-moz-range-thumb {\\n box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;\\n border: 0.5px solid #000000;\\n height: 18px;\\n width: 8px;\\n border-radius: 3px;\\n background: #ffffff;\\n cursor: pointer;\\n}\\ninput[type=range]::-ms-track {\\n width: 100%;\\n height: 4px;\\n cursor: pointer;\\n background: transparent;\\n border-color: transparent;\\n color: transparent;\\n}\\ninput[type=range]::-ms-fill-lower {\\n background: #2a6495;\\n border: 0.2px solid #010101;\\n border-radius: 2.8px;\\n box-shadow: 1px 1px 2px #000000, 0px 0px 1px #0d0d0d;\\n}\\ninput[type=range]::-ms-fill-upper {\\n background: #3071a9;\\n border: 0.2px solid #010101;\\n border-radius: 2.8px;\\n box-shadow: 1px 1px 2px #000000, 0px 0px 1px #0d0d0d;\\n}\\ninput[type=range]::-ms-thumb {\\n box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;\\n border: 0.5px solid #000000;\\n height: 18px;\\n width: 8px;\\n border-radius: 3px;\\n background: #ffffff;\\n cursor: pointer;\\n height: 4px;\\n}\\ninput[type=range]:focus::-ms-fill-lower {\\n background: #3071a9;\\n}\\ninput[type=range]:focus::-ms-fill-upper {\\n background: #367ebd;\\n}\\n/* End of style for sliders */\\n\\n#header {\\n width: 100%;\\n height: 40px;\\n font-weight: bold;\\n color: rgb(0, 0, 0);\\n box-sizing: border-box;\\n background-color : #000;\\n line-height: 30px;\\n text-align: left;\\n font-family: \\\"Inconsolata\\\", Verdana, Tahoma;\\n letter-spacing: 3px;\\n}\\n\\n#menu {\\n position: absolute;\\n padding: 5px 2.5px 5px 2.5px;\\n width: 345px;\\n font-size: 12px;\\n}\\n\\n#map {\\n padding: 0px;\\n left: 355px;\\n margin-top: 5px;\\n background-color: white;\\n position: relative;\\n border: 1px solid lightgrey;\\n}\\n\\nh1.menu {\\n color:#2e91ce;\\n font-size:15px;\\n}\\n.icon {\\n box-sizing: border-box;\\n padding:10px;\\n box-sizing: border-box;\\n text-align:center;\\n vertical-align:middle;\\n display:inline-block;\\n}\\n\\nh1 {\\n font-family: 'Enriqueta', arial, serif;\\n line-height: 1.25;\\n margin: 0 0 10px;\\n font-size: 40px;\\n font-weight: bold;\\n}\\n\\nh2 {\\n font-family: 'Enriqueta', arial, serif;\\n font-size: 16px;\\n color : #2e91ce;\\n font-weight: bold;\\n}\\n\\nh3 {\\n font-family: 'Enriqueta', arial, serif;\\n font-size: 13px;\\n color : #2e91ce;\\n font-weight: bold;\\n}\\n\\n/* a.menu {\\n line-height:30px;\\n color: white;\\n} */\\n\\n/* Styles for menu located on the left of the interface */\\n#section1 {\\n padding: 0.9em 0.3em 0.8em 0.2em;\\n font-size: 12px !important;\\n}\\n\\n#section2 {\\n padding: 2px 8px 10px 8px;\\n}\\n\\n#section2 input[type=\\\"text\\\"], #section2 input[type=\\\"number\\\"], #section2 input[type=\\\"color\\\"] {\\n position: absolute;\\n right: 33px;\\n margin: auto;\\n min-width: 40px;\\n font-size: 12px;\\n}\\n\\n.params_section2.inactive {\\n display: none;\\n}\\n\\np.params_section2 {\\n margin: 15px 0;\\n clear: both;\\n}\\n\\np.params_section2:first-of-type {\\n margin-top: 9px;\\n}\\n\\np.params_section2 > span {\\n vertical-align: -moz-middle-with-baseline;\\n}\\n\\np.params_section2 > p {\\n margin: auto;\\n}\\n\\np.params_section2 > select {\\n position: relative;\\n float: right;\\n margin-bottom: 7.5px;\\n min-width: 40px;\\n font-size: 12px;\\n right: 20px;\\n max-width: 280px;\\n}\\n\\n#section3 {\\n padding: 0.8em 0.5em 0.8em 0.5em;\\n}\\n\\n#section4 {\\n font-size: 12px;\\n padding: 0.8em 1.2em 0.8em 1.2em;\\n}\\n\\nul.config_map_options {\\n display: inline-block;\\n line-height: 17px;\\n list-style: outside none none;\\n margin-top: 0px;\\n padding: 0px;\\n width: 100%;\\n}\\n\\n.config_map_options li {\\n margin: 1px;\\n padding: 4px;\\n\\n}\\n\\nli.to_hide {\\n margin-left: 8px;\\n}\\n\\nli.to_hide > input[type=\\\"number\\\"] {\\n width: 80px;\\n}\\n\\n.list_elem_section4 {\\n display: inline-flex;\\n margin: 2px;\\n}\\n\\n#section5 {\\n padding: 0.8em 1.2em 0.8em 1.2em;\\n}\\n\\n#section5 input[type=\\\"text\\\"], #section5 input[type=\\\"number\\\"], #section5 select {\\n margin-left: 5px;\\n}\\n/* End of styles for menu located on the left of the interface */\\n\\n/* Style for the two overlay div */\\n#overlay {\\n width: 100%;\\n height: 100%;\\n position: fixed;\\n z-index: 0;\\n top: 0;\\n left: 0;\\n background: rgba(227, 227, 218, 0.5);\\n font-family: Arimo;\\n text-align: center;\\n font-size: 20px;\\n}\\n\\n.overlay_drop {\\n background: black none repeat scroll 0% 0%;\\n font-family: Arimo;\\n font-size: 20px;\\n font-weight: 800;\\n height: 98%;\\n width: 99%;\\n left: 0;\\n top: 0;\\n opacity: 0.6;\\n padding: 10px;\\n position: fixed;\\n text-align: center;\\n z-index: 0;\\n}\\n\\n.overlay_drop.inner {\\n border: 2px dashed white;\\n margin: 10px;\\n background: rgba(0, 0, 0, 0.33) none repeat scroll 0% 0%;\\n border-radius: 1%;\\n}\\n\\n.overlay_drop.inner > p {\\n position: fixed;\\n top: 50%;\\n left: 50%;\\n transform: translateX(-50%) translateY(-50%);\\n font-size: 14px;\\n width: auto;\\n bottom: 0px;\\n opacity: 0.85;\\n text-align: center;\\n color: white;\\n padding: 0.5em;\\n}\\n/* End of style for the two overlay div */\\n\\n/* Styles for buttons located on the left of the map */\\n.light-menu {\\n bottom: 0px;\\n position: absolute;\\n right: 0px;\\n}\\n\\np.cont_map_btn {\\n margin: auto;\\n}\\n\\n.cont_map_btn > button {\\n display: block;\\n font-size: 1.1em;\\n font-weight: bold;\\n text-align: center;\\n margin: 0 3px 0 0;\\n color: #ccc;\\n background-color: #555;\\n background: -webkit-linear-gradient(#888,#555);\\n background: linear-gradient(#888,#555);\\n border: 0 none;\\n border-radius: 3px;\\n text-shadow: 0 -1px 0 #000;\\n box-shadow: 1px 0 0 #666,4px 0 0 #444,5px 0 0 rgba(0,0,0,0.6);\\n cursor: pointer;\\n -webkit-transition: all 150ms ease;\\n transition: all 150ms ease;\\n width: 30px;\\n height: 30px;\\n}\\n\\n.cont_map_btn > button:hover {\\n color: #fff; text-shadow: 0 -1px 0 #444, 0 0 5px #ffd, 0 0 8px #fff;\\n}\\n\\n.cont_map_btn > button.active, .cont_map_btn > button:active\\n{\\n color: #fff;\\n text-shadow: 0 -1px 0 #444,0 0 5px #ffd,0 0 8px #fff;\\n box-shadow: none;\\n -webkit-transform: translateX(5px);\\n transform: translateX(2px);\\n -webkit-animation: none;\\n animation: none;\\n background: linear-gradient(#555,#444);\\n width: 32px;\\n margin: 0;\\n}\\n/* End of styles for button located on the left of the map */\\n\\n/* Styles for elements located in the header */\\n.header_options_right {\\n clear: both;\\n float: right;\\n display:inline;\\n color: #99a8c4;\\n font-size:12px;\\n margin: auto;\\n}\\n\\n.header_options_projection {\\n position: absolute;\\n left: 350px;\\n top: 0px;\\n color: #99a8c4;\\n margin: auto;\\n}\\n\\na.logo {\\n position: absolute;\\n left : 0px;\\n top : 0px;\\n height:30px;\\n padding:0px;\\n vertical-align:middle;\\n font-weight : bold;\\n font-family: 'Helvetica Neue', sans-serif;\\n font-size: 20px;\\n margin-left:5px\\n}\\n\\n.const_buttons {\\n background: transparent;\\n border-color:transparent;\\n border-radius: 10%;\\n cursor: pointer;\\n height: 30px;\\n margin-top: 5px;\\n}\\n\\n.styled-select {\\n background: url(/static/img/arrow_select.png) no-repeat 100% 0;\\n height: 29px;\\n overflow: hidden;\\n background-color: #000;\\n -webkit-border-radius: 20px;\\n -moz-border-radius: 20px;\\n border-radius: 20px;\\n margin-top: 3px;\\n letter-spacing: 1.5px;\\n}\\n\\n.styled-select select {\\n background: transparent;\\n border: none;\\n font-size: 14px;\\n height: 29px;\\n padding: 5px;\\n width: 340px;\\n color: #fff;\\n}\\n\\n#form_projection2 * {\\n background-color: black;\\n}\\n/* End of styles for elements located in the header */\\n\\n\\n#trash_button,#zoom_fit_button,.style_button,\\n.style_target_layer,#legend_button,.active_button,#browse_data_button {\\n margin-left: 1.5px;\\n float: right;\\n}\\n\\n#replace_button {\\n float: left;\\n margin-left: 1.5px;\\n margin-top: 2px;\\n}\\n\\n.ico_type {\\n margin-top: 2px;\\n margin-right: 3px;\\n float: left;\\n}\\n\\n.popup.active {\\n background: rgba(220, 220, 220, 0.94) none repeat scroll 0% 0%;\\n border: 3px;\\n padding: 20px;\\n color: black;\\n border-radius: 2%;\\n font: 12px \\\"Enriqueta\\\", arial, sans-serif;\\n}\\n\\n#info_features {\\n position: absolute;\\n cursor: default;\\n right: 34px;\\n top: 45px;\\n border-radius: 9px;\\n background-color: rgba(255, 255, 255, 0.5);\\n border: 1px solid #999;\\n font: 14px 'Source Sans Pro', Helvetica, sans-serif;\\n padding-right:20px;\\n padding-left:20px;\\n color:black;\\n}\\n\\n#sortable {\\n list-style-type:none;\\n margin:auto;\\n padding:0;\\n width:100%;\\n border-radius:10%\\n}\\n\\n#sortable li {\\n margin: 5px 0 5px 0;\\n padding: 5px;\\n font-size: 10.5px;\\n line-height: 1.75em;\\n font-weight: bold;\\n background: #ffffff;\\n border-radius: 4%;\\n border: unset;\\n color: black;\\n cursor: pointer;\\n overflow-y: auto;\\n}\\n\\n#sortable li.sortable_target {\\n background: #fff8ac;\\n}\\n\\n#sortable li.sortable_target:hover {\\n background: #f3ec9e;\\n}\\n\\n#sortable li:hover{\\n background: #e8e8e8;\\n}\\n\\n#table_intro{\\n margin: 0 !important;\\n text-align: center;\\n}\\n\\n.dataTable-sorter::before, .dataTable-sorter::after {\\n position: unset !important;\\n}\\n\\n.dataTable-table > thead > tr > th {\\n vertical-align: middle;\\n}\\n\\n.dataTable-table a.dataTable-sorter {\\n margin: 3px 5px;\\n}\\n\\n.button_sys_run {\\n border-color: transparent;\\n color: transparent;\\n background-color: transparent;\\n}\\n\\n.noselect {\\n -webkit-touch-callout: none;\\n -webkit-user-select: none;\\n -khtml-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n.zoom_rect{\\n fill: transparent;\\n stroke: black;\\n stroke-width: 0.7px;\\n}\\n\\n.button_disc {\\n\\tbackground:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffffff), color-stop(1, #f6f6f6));\\n\\tbackground:-moz-linear-gradient(top, #ffffff 5%, #f6f6f6 100%);\\n\\tbackground:-webkit-linear-gradient(top, #ffffff 5%, #f6f6f6 100%);\\n\\tbackground:-o-linear-gradient(top, #ffffff 5%, #f6f6f6 100%);\\n\\tbackground:-ms-linear-gradient(top, #ffffff 5%, #f6f6f6 100%);\\n\\tbackground:linear-gradient(to bottom, #ffffff 5%, #f6f6f6 100%);\\n\\tbackground-color:#ffffff;\\n\\t-moz-border-radius:4px;\\n\\t-webkit-border-radius:4px;\\n\\tborder-radius:4px;\\n\\tborder:1px solid #dcdcdc;\\n\\tdisplay:inline-block;\\n\\tcursor:pointer;\\n\\tcolor:black;\\n\\tfont-family:Arial;\\n\\tfont-size:12px;\\n\\tfont-weight:bold;\\n\\tpadding:4px 13px;\\n\\ttext-decoration:none;\\n}\\n.button_disc:hover {\\n\\tbackground:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f6f6f6), color-stop(1, #ffffff));\\n\\tbackground:-moz-linear-gradient(top, #f6f6f6 5%, #ffffff 100%);\\n\\tbackground:-webkit-linear-gradient(top, #f6f6f6 5%, #ffffff 100%);\\n\\tbackground:-o-linear-gradient(top, #f6f6f6 5%, #ffffff 100%);\\n\\tbackground:-ms-linear-gradient(top, #f6f6f6 5%, #ffffff 100%);\\n\\tbackground:linear-gradient(to bottom, #f6f6f6 5%, #ffffff 100%);\\n\\tbackground-color:#f6f6f6;\\n}\\n\\n.button_disc:disabled {\\n color: #DDDFE4;\\n}\\n\\n.button_disc.active {\\n box-shadow: inset 0 0 6px #000;\\n}\\n\\n.button_st3 {\\n\\t-moz-box-shadow: 0px 1px 0px 0px #91b8b3;\\n\\t-webkit-box-shadow: 0px 1px 0px 0px #91b8b3;\\n\\tbox-shadow: 0px 1px 0px 0px #91b8b3;\\n\\tbackground:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #768d87), color-stop(1, #6c7c7c));\\n\\tbackground:-moz-linear-gradient(top, #768d87 5%, #6c7c7c 100%);\\n\\tbackground:-webkit-linear-gradient(top, #768d87 5%, #6c7c7c 100%);\\n\\tbackground:-o-linear-gradient(top, #768d87 5%, #6c7c7c 100%);\\n\\tbackground:-ms-linear-gradient(top, #768d87 5%, #6c7c7c 100%);\\n\\tbackground:linear-gradient(to bottom, #768d87 5%, #6c7c7c 100%);\\n\\tbackground-color:#768d87;\\n\\t-moz-border-radius:4px;\\n\\t-webkit-border-radius:4px;\\n\\tborder-radius:4px;\\n\\tborder:1px solid #566963;\\n\\tdisplay:inline-block;\\n\\tcursor:pointer;\\n\\tcolor:#ffffff;\\n\\tfont-family:Arial;\\n\\tfont-size:12px;\\n\\tpadding:3px 16px;\\n\\ttext-decoration:none;\\n\\tmargin: 0px 1px 0px 1px\\n}\\n.button_st3:hover {\\n\\tbackground:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #6c7c7c), color-stop(1, #768d87));\\n\\tbackground:-moz-linear-gradient(top, #6c7c7c 5%, #768d87 100%);\\n\\tbackground:-webkit-linear-gradient(top, #6c7c7c 5%, #768d87 100%);\\n\\tbackground:-o-linear-gradient(top, #6c7c7c 5%, #768d87 100%);\\n\\tbackground:-ms-linear-gradient(top, #6c7c7c 5%, #768d87 100%);\\n\\tbackground:linear-gradient(to bottom, #6c7c7c 5%, #768d87 100%);\\n\\tbackground-color:#6c7c7c;\\n}\\n\\n.button_st3:disabled {\\n border: 1px solid #DDDFE4;\\n background: none;\\n background-color: #DDDFE4;\\n color: #fff;\\n box-shadow: none;\\n}\\n\\n.button_st4 {\\n background:linear-gradient(to bottom, #3071a9 5%, #002e56 100%);\\n background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #3071a9), color-stop(1, #002e56));\\n background:-moz-linear-gradient(top, #3071a9 5%, #002e56 100%);\\n background:-webkit-linear-gradient(top, #3071a9 5%, #002e56 100%);\\n background:-o-linear-gradient(top, #3071a9 5%, #002e56 100%);\\n background:-ms-linear-gradient(top, #3071a9 5%, #002e56 100%);\\n background-color:#1d5966;\\n border-radius: 6px;\\n border: 1px solid #1d5966;\\n display: inline-block;\\n cursor: pointer;\\n color: #FFF !important;\\n padding: 4px 9px;\\n text-decoration: none;\\n}\\n\\n.button_st4:hover {\\n background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed));\\n background:-moz-linear-gradient(top, #dfdfdf 5%, #ededed 100%);\\n background:-webkit-linear-gradient(top, #dfdfdf 5%, #ededed 100%);\\n background:-o-linear-gradient(top, #dfdfdf 5%, #ededed 100%);\\n background:-ms-linear-gradient(top, #dfdfdf 5%, #ededed 100%);\\n background:linear-gradient(to bottom, #dfdfdf 5%, #ededed 100%);\\n background-color:#dfdfdf;\\n border: 1px solid #dfdfdf;\\n}\\n\\n.without_spinner {\\n -moz-appearance: textfield;\\n text-align: right;\\n border: none;\\n border-bottom-style: dashed;\\n border-bottom-width: 0.5px;\\n}\\n\\n.without_spinner::-webkit-inner-spin-button,\\n.without_spinner::-webkit-outer-spin-button {\\n -webkit-appearance: none;\\n margin: 0; /* Removes leftover margin */\\n}\\n\\n.mini_button_ok {\\n -webkit-border-radius: 12;\\n -moz-border-radius: 12;\\n border-radius: 12px;\\n font-family: Arial;\\n color: #ffffff;\\n font-size: 20px;\\n background: #4bc238;\\n padding: 3px 10px 3px 10px;\\n margin: 5px;\\n text-decoration: none;\\n display:inline-block;\\n}\\n\\n.mini_button_ok:hover {\\n background: #3dbf26;\\n background-image: -webkit-linear-gradient(top, #3dbf26, #519e41);\\n background-image: -moz-linear-gradient(top, #3dbf26, #519e41);\\n background-image: -ms-linear-gradient(top, #3dbf26, #519e41);\\n background-image: -o-linear-gradient(top, #3dbf26, #519e41);\\n background-image: linear-gradient(to bottom, #3dbf26, #519e41);\\n text-decoration: none;\\n}\\n\\n.mini_button_none {\\n -webkit-border-radius: 12;\\n -moz-border-radius: 12;\\n border-radius: 12px;\\n font-family: Arial;\\n color: #ffffff;\\n font-size: 20px;\\n background: #ed2828;\\n padding: 3px 10px 3px 10px;\\n margin: 5px;\\n text-decoration: none;\\n display:inline-block;\\n}\\n\\n.mini_button_none:hover {\\n background: #eb7373;\\n background-image: -webkit-linear-gradient(top, #eb7373, #ad0707);\\n background-image: -moz-linear-gradient(top, #eb7373, #ad0707);\\n background-image: -ms-linear-gradient(top, #eb7373, #ad0707);\\n background-image: -o-linear-gradient(top, #eb7373, #ad0707);\\n background-image: linear-gradient(to bottom, #eb7373, #ad0707);\\n text-decoration: none;\\n}\\n\\n.mini_button_none_orange {\\n -webkit-border-radius: 12;\\n -moz-border-radius: 12;\\n border-radius: 12px;\\n font-family: Arial;\\n color: #ffffff;\\n font-size: 20px;\\n background: #ed8228;\\n padding: 3px 10px 3px 10px;\\n margin: 5px;\\n text-decoration: none;\\n display:inline-block;\\n}\\n\\n.mini_button_none_orange:hover {\\n background: #eb7373;\\n background-image: -webkit-linear-gradient(top, #eca366, #e76e09);\\n background-image: -moz-linear-gradient(top, #eca366, #e76e09);\\n background-image: -ms-linear-gradient(top, #eca366, #e76e09);\\n background-image: -o-linear-gradient(top, #eca366, #e76e09);\\n background-image: linear-gradient(to bottom, #eca366, #e76e09);\\n text-decoration: none;\\n}\\n\\nbutton.accordion, button.accordion_disc, button.accordion_proj {\\n background-color: #595959;\\n color: #fff;\\n cursor: pointer;\\n padding: 4px 5px;\\n width: 100%;\\n border: none;\\n text-align: left;\\n outline: none;\\n font-size: 1.2em;\\n transition: 0.4s;\\n font-family: Baloo Bhaina;\\n margin: 1px;\\n}\\n\\nbutton.accordion:after, button.accordion_disc:after, button.accordion_projc:after {\\n content: '\\\\02795';\\n font-size: 13px;\\n color: #777;\\n float: right;\\n margin-left: 5px;\\n}\\n\\nbutton.accordion.active:after, button.accordion_disc.active:after, button.accordion_proj.active:after {\\n content: \\\"\\\\2796\\\";\\n}\\n\\n#map_center_menu_ico:after {\\n content: '\\\\02795';\\n font-size: 14px;\\n color: #777;\\n margin-left: 4px;\\n}\\n\\n#map_center_menu_ico.active:after {\\n content: \\\"\\\\2796\\\";\\n}\\n\\ndiv.panel {\\n font-family: Verdana,Arial,sans-serif;\\n font-size: 1.1em;\\n color: #222222;\\n background: #ffffff;\\n overflow: hidden;\\n visibility: hidden;\\n width: 335px;\\n height: 0;\\n /* max-height: 0; */\\n border: 1px solid #aaaaaa;\\n border-top-color: rgb(170, 170, 170);\\n border-top-style: solid;\\n border-top-width: 1px;\\n border-bottom-right-radius: 8px;\\n border-bottom-left-radius: 8px;\\n transition: all 350ms ease-in-out;\\n /* transform: scaleY(0); */\\n}\\n\\ndiv.panel.show {\\n height: auto;\\n max-height: 775px;\\n width: 335px;\\n margin: auto;\\n margin-bottom: 5px;\\n overflow: auto;\\n visibility: visible;\\n transition: all 350ms ease-in-out;\\n /* transform: scaleY(1); */\\n}\\n\\n.panel > div {\\n opacity:0;\\n}\\n.panel.show > div {\\n opacity: 1;\\n}\\n\\n.twbs .panel {\\n border: 1px solid #aaaaaa;\\n border-top-color: rgb(170, 170, 170);\\n border-top-style: solid;\\n border-top-width: 1px;\\n border-bottom-right-radius: 8px;\\n border-bottom-left-radius: 8px;\\n}\\n\\n.twbs h3 {\\n font-size: 1.2em;\\n font-weight: bold;\\n margin-top: 4px;\\n}\\n\\n.twbs .modal {\\n position: absolute;\\n overflow: visible;\\n}\\n\\n.twbs .modal-title {\\n margin: 0;\\n line-height: 1.42857143;\\n font-weight: bold;\\n font-size: 1.3em;\\n padding: 4px;\\n border-top-right-radius: 8px;\\n border-top-left-radius: 8px;\\n border-bottom-right-radius: 8px;\\n border-bottom-left-radius: 8px;\\n overflow-wrap: break-word;\\n word-wrap: break-word;\\n width: 90%;\\n}\\n\\n.twbs .modal-dialog {\\n font-family: arimo,Arial,sans-serif;\\n font-size: 11px;\\n}\\n\\n.twbs .modal-body > p > span {\\n display: inline-block;\\n}\\n\\n.twbs .modal-body > p > input {\\n display: inline-block;\\n margin: 0px 0px 0px 15px;\\n}\\n\\n.twbs .modal-footer {\\n padding: 6px;\\n}\\n\\n.twbs .modal-header {\\n padding: 8px;\\n background-color: #595959;\\n color: white;\\n}\\n\\n.twbs #xclose {\\n padding: 1px 2px;\\n font-size: 15px;\\n margin-right: 5px;\\n margin-top: 2px;\\n}\\n\\n.twbs .help-popover {\\n max-width: 500px;\\n width: 500px;\\n}\\n\\n.twbs .modal-body > p {\\n margin: 11px 0 !important;\\n clear: both;\\n}\\n\\n.twbs .modal-body > p.inp_bottom {\\n margin: 11px 0px 35px 0px !important;\\n}\\n\\n.fitContent {\\n width: intrinsic !important;\\n width: -moz-max-content !important;\\n width: -webkit-max-content !important;\\n}\\n\\nth {\\n border: 1px solid #d3d3d3;\\n text-align: center !important;\\n font-size: 12px;\\n}\\n\\ntr:nth-child(even) {background: #DBDADA}\\ntr:nth-child(odd) {background: ##EFECEC;}\\n\\n.m_elem_right {\\n position: absolute;\\n right: 20px;\\n width: 60px;\\n margin-left: 15px;\\n font-size: 12px;\\n}\\n\\nselect.m_elem_right {\\n width: auto !important;\\n}\\n\\n#export_filename.m_elem_right {\\n width: auto !important;\\n}\\n\\np.line_elem {\\n display: inline-table;\\n width: 100%;\\n}\\n\\np.line_elem2 {\\n display: inline-table;\\n width: 100%;\\n margin: 5px 0 10px;\\n}\\n\\np.line_elem2 > input[type=range] {\\n margin: 2px;\\n}\\n\\n\\n.styleBox > p > input {\\n float: right;\\n}\\n\\n.three_dots {\\n background: url(/static/img/3_dots_ico.png) no-repeat;\\n height: 20px;\\n float: left;\\n width: 10px;\\n}\\n\\n.cells path {\\n fill: none;\\n pointer-events: all;\\n}\\n\\n.cells :hover circle {\\n fill: red;\\n}\\n\\nimg.layout_ft_ico {\\n width: 27px;\\n height: auto;\\n margin: 2px;\\n -webkit-filter: grayscale(1); /* Webkit Nightlies & Chrome Canary */\\n -webkit-transform: scale(0.9);\\n -webkit-transition: all .2s;\\n}\\n\\nimg.layout_ft_ico:hover {\\n filter: none;\\n -webkit-filter: grayscale(0);\\n -webkit-transform: scale(1);\\n}\\n\\n.swal2_blue {\\n background-color: rgb(48, 133, 214);\\n border-left-color: rgb(48, 133, 214);\\n border-right-color: rgb(48, 133, 214);\\n}\\n\\n.swal2_custom {\\n overflow-wrap: break-word;\\n}\\n\\n.swal2_large {\\n min-width: 380px;\\n min-height: 310px;\\n}\\n\\n/*#txtwzr_table > tbody > tr > td, #txtwzr_table > thead > tr > th {\\n border-top: 1px solid #999;\\n padding: 8px;\\n vertical-align: top;\\n}*/\\n\\n#box_projection > p {\\n clear: both;\\n padding: 8px;\\n font-size: 13px;\\n}\\n\\n.ctrl_pt {\\n fill: red;\\n cursor: grab;\\n cursor: -webkit-grab;\\n}\\n\\n.ctrl_pt:active {\\n fill: red;\\n cursor: grabbing;\\n cursor: -webkit-grabbing;\\n}\\n\\n.alertify-notifier .ajs-message.ajs-warning {\\n background: rgb(228, 144, 83) !important;\\n}\\n\\n.alertify-notifier .ajs-message {\\n font: 13px Roboto !important;\\n padding: 12px !important;\\n}\\n\\n.alertify-notifier .ajs-message.ajs-warning {\\n background: rgb(228, 144, 83) !important;\\n}\\n\\n.alertify-notifier .ajs-message {\\n font: 13px Roboto !important;\\n padding: 12px !important;\\n}\\n\\n/*#_m_free_draw_layer > path {\\n fill: none;\\n stroke: #000;\\n stroke-width: 3px;\\n stroke-linejoin: round;\\n stroke-linecap: round;\\n}*/\\n\\n.switch-field {\\n font-family: \\\"Lucida Grande\\\", Tahoma, Verdana, sans-serif;\\n padding: 20px;\\n\\toverflow: hidden;\\n}\\n\\n.switch-title {\\n text-align: left;\\n margin-bottom: 6px;\\n}\\n\\n.switch-field input {\\n position: absolute !important;\\n clip: rect(0, 0, 0, 0);\\n height: 1px;\\n width: 1px;\\n border: 0;\\n overflow: hidden;\\n}\\n\\n.switch-field label {\\n float: left;\\n}\\n\\n.switch-field label {\\n display: inline-block;\\n background-color: #e4e4e4;\\n color: rgba(0, 0, 0, 0.6);\\n font-size: 13px;\\n font-weight: normal;\\n text-align: center;\\n text-shadow: none;\\n padding: 5px 12px;\\n border: 1px solid rgba(0, 0, 0, 0.2);\\n -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);\\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);\\n -webkit-transition: all 0.1s ease-in-out;\\n -moz-transition: all 0.1s ease-in-out;\\n -ms-transition: all 0.1s ease-in-out;\\n -o-transition: all 0.1s ease-in-out;\\n transition: all 0.1s ease-in-out;\\n margin: 2px;\\n}\\n\\n.switch-field label:hover {\\n\\tcursor: pointer;\\n}\\n\\n.switch-field input:checked + label {\\n background-color: #A5DC86;\\n -webkit-box-shadow: none;\\n box-shadow: none;\\n}\\n/*\\n.switch-field label:first-of-type {\\n border-radius: 4px 0 0 4px;\\n}\\n\\n.switch-field label:last-of-type {\\n border-radius: 0 4px 4px 0;\\n}\\n*/\\n\\n.custom_tooltip {\\n position: absolute;\\n background: #595959;\\n border-radius:4px;\\n padding: 6px 12px;\\n font-family: arial;\\n font-size: 12px;\\n text-shadow: 0px 1px 1px #000;\\n color: #ffc64a;\\n z-index: 1001;\\n overflow-wrap: break-word;\\n}\\n/*\\nSpinner adapted from https://github.com/tobiasahlin/SpinKit\\nCopyright (c) 2015 Tobias Ahlin (license MIT)\\n*/\\n.spinner {\\n margin: 30px auto;\\n width: 50px;\\n height: 50px;\\n text-align: center;\\n font-size: 10px;\\n}\\n\\n.spinner > div {\\n background-color: #005327;\\n height: 100%;\\n width: 6px;\\n display: inline-block;\\n\\n -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;\\n animation: sk-stretchdelay 1.2s infinite ease-in-out;\\n}\\n\\n.spinner .rect2 {\\n -webkit-animation-delay: -1.1s;\\n animation-delay: -1.1s;\\n}\\n\\n.spinner .rect3 {\\n -webkit-animation-delay: -1.0s;\\n animation-delay: -1.0s;\\n}\\n\\n.spinner .rect4 {\\n -webkit-animation-delay: -0.9s;\\n animation-delay: -0.9s;\\n}\\n\\n.spinner .rect5 {\\n -webkit-animation-delay: -0.8s;\\n animation-delay: -0.8s;\\n}\\n\\n@-webkit-keyframes sk-stretchdelay {\\n 0%, 40%, 100% { -webkit-transform: scaleY(0.4) }\\n 20% { -webkit-transform: scaleY(1.0) }\\n}\\n\\n@keyframes sk-stretchdelay {\\n 0%, 40%, 100% {\\n transform: scaleY(0.4);\\n -webkit-transform: scaleY(0.4);\\n } 20% {\\n transform: scaleY(1.0);\\n -webkit-transform: scaleY(1.0);\\n }\\n}\\n\\n.opts_lgd_layout {\\n margin: 2px;\\n cursor: pointer;\\n}\\n\\n.opts_lgd_layout.selected:before {\\n content: \\\"\\\\2713 \\\";\\n font-weight: 800;\\n font-size: 1.75em;\\n}\\n\\np.breaks_vals > input[type=\\\"number\\\"] {\\n width: 70px !important;\\n margin: 1px !important;\\n height: 1em !important;\\n}\\n\\np.breaks_vals > input[type=\\\"number\\\"].size_class {\\n width: 60px !important;\\n}\\n\\n#sizes_div > div > p.breaks_vals > input[type=\\\"number\\\"] {\\n width: 70px !important;\\n margin: 1px !important;\\n height: 2.5em !important;\\n}\\n\\n\\n/* Styles for modal box allowing to choose the type of each field */\\n#fields_select {\\n display: grid;\\n}\\n\\n#fields_select > li {\\n background: transparent;\\n /* background: aliceblue; */\\n padding: 5px;\\n line-height: 2em;\\n}\\n\\n#fields_select > li:nth-child(odd) {\\n background: lightgray;\\n}\\n\\n#fields_select > li:first-child {\\n border-top-left-radius: 3px 3px;\\n border-top-right-radius: 3px 3px;\\n}\\n\\n#fields_select > li:last-child {\\n border-bottom-left-radius: 3px 3px;\\n border-bottom-right-radius: 3px 3px;\\n}\\n/* End of styles for modal box allowing to choose the type of each field */\\n\\n/* Style for left menu section 1 */\\nimg#remove_target, img#downgrade_target, img#table_layer_s1, img#remove_dataset, img#table_dataset_s1 {\\n margin: 10px 5px 0 0;\\n float: right;\\n opacity: 1;\\n}\\n\\nimg#remove_target, img#remove_dataset {\\n opacity: 0.5;\\n}\\n\\nimg#remove_target:hover, img#remove_dataset:hover {\\n opacity: 1;\\n}\\n\\n#join_button {\\n border-color: transparent;\\n background-color: transparent;\\n}\\n/* End of style for left menu section 1 */\\n\", \"\"]);\n\n\n//# sourceURL=webpack:///./css/style.css?./node_modules/css-loader/dist/cjs.js");
-
-/***/ })
-
-/******/ });
\ No newline at end of file
diff --git a/client/dist/app.e83ff8.js b/client/dist/app.e83ff8.js
new file mode 100644
index 000000000..799ad916a
--- /dev/null
+++ b/client/dist/app.e83ff8.js
@@ -0,0 +1 @@
+(function(modules){function webpackJsonpCallback(data){var chunkIds=data[0];var moreModules=data[1];var executeModules=data[2];var moduleId,chunkId,i=0,resolves=[];for(;i\n \n... \n\n \n\n ';document.body.appendChild(bg);var btn=bg.querySelector("button.button_st3");btn.onclick=function(){if(global._app.xhr_to_cancel){global._app.xhr_to_cancel.abort();global._app.xhr_to_cancel=undefined}if(global._app.webworker_to_cancel){global._app.webworker_to_cancel.onmessage=null;global._app.webworker_to_cancel.terminate();global._app.webworker_to_cancel=undefined}bg.style.display="none"};return{display:function display(){var opts=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};bg.style.display="";if(opts.cancel_button&&opts.cancel_button===false){btn.style.display="none"}if(opts.zIndex){bg.style.zIndex=opts.zIndex}},hide:function hide(){bg.style.display="none";bg.style.zIndex="";btn.style.display=""}}};var drag_elem_geo=d3.drag().subject((function(){var t=d3.select(this);return{x:t.attr("x"),y:t.attr("y"),map_locked:!!map_div.select("#hand_button").classed("locked")}})).on("start",(function(){d3.event.sourceEvent.stopPropagation();d3.event.sourceEvent.preventDefault();Object(_interface__WEBPACK_IMPORTED_MODULE_2__["j"])("lock")})).on("end",(function(){if(d3.event.subject&&!d3.event.subject.map_locked){Object(_interface__WEBPACK_IMPORTED_MODULE_2__["j"])("unlock")}})).on("drag",(function(){d3.select(this).attr("x",d3.event.x).attr("y",d3.event.y)}));var drag_elem_geo2=d3.drag().filter((function(){return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable})).subject((function(){var symbol=data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].symbol;var t=d3.select(this);if(symbol==="rect"){return{x:t.attr("x"),y:t.attr("y"),symbol,map_locked:!!map_div.select("#hand_button").classed("locked")}}else if(symbol==="circle"){return{x:t.attr("cx"),y:t.attr("cy"),symbol,map_locked:!!map_div.select("#hand_button").classed("locked")}}})).on("start",(function(){d3.event.sourceEvent.stopPropagation();d3.event.sourceEvent.preventDefault();Object(_interface__WEBPACK_IMPORTED_MODULE_2__["j"])("lock");var zoom=svg_map.__zoom;var centroid=path.centroid(this.__data__.geometry);centroid[0]=centroid[0]*zoom.k+zoom.x;centroid[1]=centroid[1]*zoom.k+zoom.y;map.append("rect").attrs({x:centroid[0]-2,y:centroid[1]-2,height:4,width:4,id:"ref_symbol_location"}).style("fill","red")})).on("end",(function(){if(d3.event.subject&&!d3.event.subject.map_locked){Object(_interface__WEBPACK_IMPORTED_MODULE_2__["j"])("unlock")}map.selectAll("#ref_symbol_location").remove()})).on("drag",(function(){if(d3.event.subject.symbol==="rect"){d3.select(this).attr("x",d3.event.x).attr("y",d3.event.y)}else if(d3.event.subject.symbol==="circle"){d3.select(this).attr("cx",d3.event.x).attr("cy",d3.event.y)}}));var drag_waffle=d3.drag().filter((function(){return data_manager.current_layers[_app.id_to_layer.get(this.parentElement.id)].draggable})).subject((function(){var t=d3.select(this);var prev_translate=t.attr("transform");prev_translate=prev_translate?prev_translate.slice(10,-1).split(/[ ,]+/).map((function(f){return+f})):[0,0];return{x:t.attr("x")+prev_translate[0],y:t.attr("y")+prev_translate[1],map_locked:!!map_div.select("#hand_button").classed("locked")}})).on("start",(function(){d3.event.sourceEvent.stopPropagation();d3.event.sourceEvent.preventDefault();Object(_interface__WEBPACK_IMPORTED_MODULE_2__["j"])("lock")})).on("end",(function(){if(d3.event.subject&&!d3.event.subject.map_locked){Object(_interface__WEBPACK_IMPORTED_MODULE_2__["j"])("unlock")}d3.select(this).style("cursor","grab")})).on("drag",(function(){d3.select(this).attr("transform","translate(".concat([d3.event.x,d3.event.y],")")).style("cursor","grabbing")}));function setSelected(selectNode,value){selectNode.value=value;selectNode.dispatchEvent(new Event("change"))}function path_to_geojson(layerName){var id_layer=["#",global._app.layer_to_id.get(layerName)].join("");var result_geojson=[];d3.select(id_layer).selectAll("path").each((function(d,i){result_geojson.push({type:"Feature",id:i,properties:d.properties,geometry:{type:d.type,coordinates:d.coordinates}})}));return JSON.stringify({type:"FeatureCollection",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:result_geojson})}function path_to_geojson2(layerName){var id_layer=["#",global._app.layer_to_id.get(layerName)].join("");var result_geojson=[];d3.select(id_layer).selectAll("path").each((function(d,i){result_geojson.push({type:"Feature",id:i,properties:d.properties,geometry:d.geometry})}));return JSON.stringify({type:"FeatureCollection",crs:{type:"name",properties:{name:"urn:ogc:def:crs:OGC:1.3:CRS84"}},features:result_geojson})}function display_error_during_computation(msg){var message=msg?"".concat(_tr("app_page.common.details"),": ").concat(msg):"";swal({title:"".concat(_tr("app_page.common.error"),"!"),text:"".concat(_tr("app_page.common.error_message")).concat(message),customClass:"swal2_custom",type:"error",allowOutsideClick:false})}function request_data(method,url,data){return new Promise((function(resolve,reject){var request=new XMLHttpRequest;request.open(method,url,true);request.onload=resolve;request.onerror=reject;request.send(data)}))}function xhrequest(method,url,data,waitingMessage){if(waitingMessage){global._app.waitingOverlay.display()}return new Promise((function(resolve,reject){var request=new XMLHttpRequest;global._app.xhr_to_cancel=request;request.open(method,url,true);request.onload=function(resp){resolve(resp.target.responseText);global._app.xhr_to_cancel=undefined;if(waitingMessage){global._app.waitingOverlay.hide()}};request.onerror=function(err){reject(err);global._app.xhr_to_cancel=undefined;if(waitingMessage){global._app.waitingOverlay.hide()}};request.send(data)}))}function getImgDataUrl(url){return new Promise((function(resolve,reject){var request=new XMLHttpRequest;request.onload=function(){var reader=new FileReader;reader.onloadend=function(){resolve(reader.result)};reader.readAsDataURL(request.response)};request.onerror=function(err){reject(err)};request.open("GET",url,true);request.responseType="blob";request.send()}))}function make_content_summary(serie){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:6;return[_tr("app_page.stat_summary.population")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.pop(),precision)," ",_tr("app_page.stat_summary.min")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.min(),precision)," | ",_tr("app_page.stat_summary.max")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.max(),precision)," ",_tr("app_page.stat_summary.mean")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.mean(),precision)," ",_tr("app_page.stat_summary.median")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.median(),precision)," ",_tr("app_page.stat_summary.variance")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.variance(),precision)," ",_tr("app_page.stat_summary.stddev")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.stddev(),precision)," ",_tr("app_page.stat_summary.cov")," : ",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(serie.cov(),precision)].join("")}function copy_layer(ref_layer,new_name,type_result,fields_to_copy){var id_new_layer=encodeId(new_name);var id_ref_layer=global._app.layer_to_id.get(ref_layer);var node_ref_layer=svg_map.querySelector("#".concat(id_ref_layer));var current_layers=global.data_manager.current_layers;global._app.layer_to_id.set(new_name,id_new_layer);global._app.id_to_layer.set(id_new_layer,new_name);svg_map.appendChild(node_ref_layer.cloneNode(true));svg_map.lastChild.setAttribute("id",id_new_layer);var node_new_layer=document.getElementById(id_new_layer);svg_map.insertBefore(node_new_layer,svg_map.querySelector(".legend"));data_manager.result_data[new_name]=[];current_layers[new_name]={n_features:current_layers[ref_layer].n_features,type:current_layers[ref_layer].type,ref_layer_name:ref_layer};if(current_layers[ref_layer].pointRadius){current_layers[new_name].pointRadius=current_layers[ref_layer].pointRadius}var selec_src=node_ref_layer.getElementsByTagName("path"),selec_dest=node_new_layer.getElementsByTagName("path");if(!fields_to_copy){for(var i=0;i-1)otherLayers.splice(tmpIdx,1);tmpIdx=otherLayers.indexOf("World");if(tmpIdx>-1)otherLayers.splice(tmpIdx,1);tmpIdx=otherLayers.indexOf("Sphere");if(tmpIdx>-1)otherLayers.splice(tmpIdx,1);return otherLayers}function get_display_name_on_layer_list(layer_name_to_add){return+layer_name_to_add.length>40?[layer_name_to_add.substring(0,37),"(...)"].join(""):layer_name_to_add}function create_li_layer_elem(layerName,nbFt,typeGeom,typeLayer){var listDisplayName=get_display_name_on_layer_list(layerName);var layerId=encodeId(layerName);var layersListed=document.querySelector("#sortable.layer_list");var li=document.createElement("li");li.setAttribute("layer_name",layerName);if(typeLayer==="result"){li.setAttribute("class",["sortable_result ",layerId].join(""));var promotable=["flow","grid","discont","cartogram","smooth"];var legend_but=typeGeom[1]!=="cartogram"?_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["a"]:undefined;var replace_but=promotable.indexOf(typeGeom[1])>-1?_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["b"]:undefined;li.innerHTML=[listDisplayName,'',_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["e"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["j"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["g"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["d"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["h"],legend_but,_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["c"].get(typeGeom[1]),replace_but,"
"].join("")}else if(typeLayer==="target"){li.setAttribute("class",["sortable_target ",layerId].join(""));li.innerHTML=[listDisplayName,'',_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["e"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["j"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["g"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["d"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["h"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["f"].get(typeGeom),_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["b"],"
"].join("")}else{var _replace_but=!data_manager.current_layers[layerName].graticule&&!data_manager.current_layers[layerName].sphere?_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["b"]:undefined;li.setAttribute("class",["sortable ",layerId].join(""));li.innerHTML=[listDisplayName,'',_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["e"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["j"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["g"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["d"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["h"],_ui_buttons__WEBPACK_IMPORTED_MODULE_3__["f"].get(typeGeom),_replace_but,"
"].join("")}layersListed.insertBefore(li,layersListed.childNodes[0]);Object(_interface__WEBPACK_IMPORTED_MODULE_2__["e"])(layerName)}var type_col=function type_col(layerName,target){var table=data_manager.user_data.hasOwnProperty(layerName)?data_manager.user_data[layerName]:data_manager.result_data.hasOwnProperty(layerName)?data_manager.result_data[layerName]:data_manager.joined_dataset[0];var fields=Object.getOwnPropertyNames(table[0]);var nbFeatures=table.length;var deepthTest=nbFeatures>100?100:nbFeatures-1;var result={};var field;var tmpType;for(var j=0,len=fields.length;j-1){result[field]="number"}else{result[field]="string"}}if(target){var res=[];Object.keys(result).forEach((function(k){if(result[k]===target&&k!=="_uid"){res.push(k)}}));return res}return result};var type_col2=function type_col2(table,_field){var skip_if_empty_values=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var result=[];var nbFeatures=table.length;var tmp={};var dups={};var field=_field;var tmpType;var fields;if(!field){fields=Object.getOwnPropertyNames(table[0]).filter((function(v){return v!=="_uid"}));field=undefined}else{fields=[field];field=undefined}for(var j=0,len=fields.length;j-1||field.toLowerCase().indexOf("nom")>-1)&&!hasDup){result.push({name:field,type:"id",has_duplicate:hasDup});nb_id_field+=1}else if(field.toLowerCase().indexOf("id")>-1&&nb_id_field<1&&!hasDup){result.push({name:field,type:"id",has_duplicate:hasDup});nb_id_field+=1}else if(!hasDup&&nb_id_field<1&&tmp[field].every((function(ft){return ft==="string"||ft==="stock"}))){result.push({name:field,type:"id",has_duplicate:hasDup});nb_id_field+=1}else if(tmp[field].every((function(ft){return ft==="string"}))&&!hasDup){result.push({name:field,type:"id",has_duplicate:hasDup});nb_id_field+=1}else if(tmp[field].every((function(ft){return ft==="stock"||ft==="empty"}))&&tmp[field].indexOf("stock")>-1){result.push({name:field,type:"stock",has_duplicate:hasDup})}else if(tmp[field].every((function(ft){return ft==="string"||ft==="empty"}))&&tmp[field].indexOf("string")>-1){result.push({name:field,type:"category",has_duplicate:hasDup})}else if(tmp[field].every((function(ft){return ft==="ratio"||ft==="stock"||ft==="empty"}))&&tmp[field].indexOf("ratio")>-1){result.push({name:field,type:"ratio"})}else{result.push({name:field,type:"unknown",has_duplicate:hasDup})}}return result};var getFieldsType=function getFieldsType(type,layerName,ref){if(!layerName&&!ref)return null;var refField=ref||data_manager.current_layers[layerName].fields_type;if(!refField)return[];return refField.filter((function(d){return d.type===type})).map((function(d){return d.name}))};function make_box_type_fields(layerName){Object(_dialogs__WEBPACK_IMPORTED_MODULE_0__["c"])("box_type_fields",_tr("app_page.box_type_fields.title"),"dialog");d3.select("#box_type_fields").select(".modal-dialog").style("width","500px");var newbox=d3.select("#box_type_fields").select(".modal-body");var tmp=type_col2(data_manager.user_data[layerName]);var fields_type=data_manager.current_layers[layerName].fields_type;var f=fields_type.map((function(v){return v.name}));var refType=["id","stock","ratio","category","unknown"];var container=document.getElementById("box_type_fields");return new Promise((function(resolve,reject){var clean_up_box=function clean_up_box(){container.remove();_dialogs__WEBPACK_IMPORTED_MODULE_0__["d"].hide();document.removeEventListener("keydown",helper_esc_key_twbs);if(window.fields_handler){fields_handler.unfill();fields_handler.fill(layerName)}};if(f.length===0){fields_type=tmp.slice();container.querySelector(".btn_cancel").remove();var _onclose=function _onclose(){data_manager.current_layers[layerName].fields_type=tmp.slice();getAvailablesFunctionnalities(layerName);resolve(false);clean_up_box()};container.querySelector("#xclose").onclick=_onclose}else if(tmp.length>fields_type.length){tmp.forEach((function(d){if(f.indexOf(d.name)===-1){fields_type.push(d)}}));container.querySelector(".btn_cancel").remove();var _onclose2=function _onclose2(){data_manager.current_layers[layerName].fields_type=tmp.slice();getAvailablesFunctionnalities(layerName);resolve(false);clean_up_box()};container.querySelector("#xclose").onclick=_onclose2}else{var _onclose3=function _onclose3(){data_manager.current_layers[layerName].fields_type=fields_type;resolve(false);clean_up_box()};container.querySelector(".btn_cancel").onclick=_onclose3;container.querySelector("#xclose").onclick=_onclose3}container.querySelector(".btn_ok").onclick=function(){var r=[];Array.prototype.forEach.call(document.querySelectorAll("#fields_select > li"),(function(elem){r.push({name:elem.childNodes[0].innerHTML.trim(),type:elem.childNodes[1].value})}));resolve(true);data_manager.current_layers[layerName].fields_type=r.slice();getAvailablesFunctionnalities(layerName);clean_up_box()};function helper_esc_key_twbs(_evt){var evt=_evt||window.event;var isEscape="key"in evt?evt.key==="Escape"||evt.key==="Esc":evt.keyCode===27;if(isEscape){evt.stopPropagation();data_manager.current_layers[layerName].fields_type=tmp.slice();getAvailablesFunctionnalities(layerName);resolve(false);clean_up_box()}}document.addEventListener("keydown",helper_esc_key_twbs);document.getElementById("btn_type_fields").removeAttribute("disabled");newbox.append("h3").html(_tr("app_page.box_type_fields.message_invite"));var box_select=newbox.append("ul").attr("id","fields_select").styles({padding:"0","list-style":"none"});box_select.selectAll("li").data(fields_type).enter().append("li");box_select.selectAll("li").insert("span").html((function(d){return d.name}));box_select.selectAll("li").insert("select").style("float","right").selectAll("option").data(refType).enter().insert("option").attr("value",(function(d){return d})).text((function(d){return _tr("app_page.box_type_fields.".concat(d))})).exit();box_select.selectAll("select").each((function(d){this.value=d.type}));for(var i=0;i0||fields_ratio.length>0)){document.getElementById("button_discont").style.filter="invert(0%) saturate(100%)"}else{document.getElementById("button_discont").style.filter="grayscale(100%)"}if(fields_stock.length<2){document.getElementById("button_two_stocks").style.filter="grayscale(100%)"}else{document.getElementById("button_two_stocks").style.filter="invert(0%) saturate(100%)"}}var clickLinkFromDataUrl=function clickLinkFromDataUrl(url,filename){return fetch(url).then((function(res){return res.blob()})).then((function(blob){var blobUrl=URL.createObjectURL(blob);var dlAnchorElem=document.createElement("a");dlAnchorElem.setAttribute("href",blobUrl);dlAnchorElem.setAttribute("download",filename);if(window.isIE){swal({title:"",html:''.concat(_tr("app_page.common.download_link"),"
"),showCancelButton:true,showConfirmButton:false,allowEscapeKey:false,allowOutsideClick:false,cancelButtonText:_tr("app_page.common.close"),animation:"slide-from-top",onOpen:function onOpen(){dlAnchorElem.innerHTML=filename;var content=document.getElementsByClassName("link_download")[0];content.appendChild(dlAnchorElem)},onClose:function onClose(){URL.revokeObjectURL(blobUrl)}}).then((function(){return null}),(function(){return null}))}else{dlAnchorElem.style.display="none";document.body.appendChild(dlAnchorElem);dlAnchorElem.click();dlAnchorElem.remove();URL.revokeObjectURL(blobUrl)}}))};var cloneObj=function cloneObj(obj){if(obj===null||_typeof(obj)!=="object")return obj;else if(obj.toString()==="[object Map]")return new Map(obj.entries());return Object.assign({},obj)};function prepareFileExt(files_to_send){Array.prototype.forEach.call(files_to_send,(function(f){f._ext="";if(f.name.indexOf(".")>-1){var name=f.name.substring(0,f.name.lastIndexOf("."));var ext=f.name.substring(f.name.lastIndexOf(".")+1,f.name.length);f._name=[name,ext.toLowerCase()].join(".");f._ext=ext.toLowerCase()}}));return files_to_send}var isValidJSON=function isValidJSON(txt){try{var a=JSON.parse(txt);return[true,a]}catch(e){return[false,e]}};function accordionize2(){var css_selector=arguments.length>0&&arguments[0]!==undefined?arguments[0]:".accordion";var parent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var acc=parent.querySelectorAll(css_selector);for(var i=0;imax)max=val}return max}function has_negative(arr){for(var i=0;i-1;--i){if(arr[i]==null)return true;else if(isNaN(+arr[i]))return true}return false};function has_duplicate(arr){var _h={},len_arr=arr.length;for(var i=0;i=0?Object(_helpers_math__WEBPACK_IMPORTED_MODULE_0__["f"])(+val*dec_mult)/dec_mult:Object(_helpers_math__WEBPACK_IMPORTED_MODULE_0__["f"])(+val/dec_mult)*dec_mult};function get_nb_decimals(nb){var tmp=nb.toString().split(".");return tmp.length<2?0:tmp[1].length}function get_nb_left_separator(nb){var tmp=nb.toString().split(".");return tmp[0].length}function getDecimalSeparator(){return 1.1.toLocaleString().substr(1,1)}var get_precision_axis=function get_precision_axis(serie_min,serie_max,precision){var range_serie=serie_max-serie_min;if(serie_max>1&&range_serie>100){return".0f"}else if(range_serie>10){if(precision===0){return".0f"}return".1f"}else if(range_serie>1){if(precision<2){return".1f"}return".2f"}else if(range_serie>.1){return".3f"}else if(range_serie>.01){return".4f"}else if(range_serie>.001){return".5f"}else if(range_serie>1e-4){return".6f"}else if(range_serie>1e-5){return".7f"}return".8f"};var PropSizer=function PropSizer(fixed_value,fixed_size,type_symbol){var _this=this;this.fixed_value=fixed_value;var sqrt=Math.sqrt,abs=Math.abs,pi=Math.PI;if(type_symbol==="circle"){this.smax=fixed_size*fixed_size*pi;this.scale=function(val){return sqrt(abs(val)*_this.smax/_this.fixed_value)/pi};this.get_value=function(size){return Math.pow(size*pi,2)/_this.smax*_this.fixed_value}}else if(type_symbol==="line"){this.smax=fixed_size;this.scale=function(val){return abs(val)*_this.smax/_this.fixed_value};this.get_value=function(size){return size/_this.smax*_this.fixed_value}}else{this.smax=fixed_size*fixed_size;this.scale=function(val){return sqrt(abs(val)*_this.smax/_this.fixed_value)};this.get_value=function(size){return Math.pow(size,2)/_this.smax*_this.fixed_value}}};function prop_sizer3_e(arr,fixed_value,fixed_size,type_symbol){var pi=Math.PI,abs=Math.abs,sqrt=Math.sqrt,arr_len=arr.length,res=[];if(!fixed_value||fixed_value===0){fixed_value=max_fast(arr)}if(type_symbol==="circle"){var smax=fixed_size*fixed_size*pi;var _t=smax/fixed_value;for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:16;var values=_values.filter((function(a){return a})).sort((function(a,b){return a-b}));var nb_ft=values.length;var min=values[0],max=values[nb_ft-1],extend=max-min,bin_size=extend/bins,counts=new Array(bins),break_values=[min],ix_med=(nb_ft+1)/2;var sum=0;for(var i=0;i=0;x--){updateCache(x,cache);var width=0;for(var y=0;ywidth){stack.push({y,width});width=cache[y]}if(cache[y]area(bestUpperLeft,bestLowerRight)&&y-_y>=minQuadY&&width>=minQuadX){bestUpperLeft={x,y:_y};bestLowerRight={x:x+width-1,y:y-1}}width=w0;if(cache[y]>=width)break}width=cache[y];if(width!==0)stack.push({y:_y,width:w0})}}}return{x:bestUpperLeft.x,y:bestUpperLeft.y,lenX:bestLowerRight.x-bestUpperLeft.x+1,lenY:bestLowerRight.y-bestUpperLeft.y+1,area:area(bestUpperLeft,bestLowerRight)}}function area(upperLeft,lowerRight){if(upperLeft.x>lowerRight.x||upperLeft.y>lowerRight.y)return 0;return(lowerRight.x+1-upperLeft.x)*(lowerRight.y+1-upperLeft.y)}function updateCache(x,cache){for(var y=0;y=cols?cols-1:bx+Math.floor(bbox.width);var by2=by+Math.floor(bbox.height)>=rows?rows-1:by+Math.floor(bbox.height);fillMat([bx,bx2],[by,by2])}return getMaxRect(mat)}function getTranslateNewLegend(){var legends=svg_map.querySelectorAll(".legend_feature");if(legends.length===0){return{x:0,y:0}}try{return getMaximalAvailableRectangle(legends)}catch(e){console.log(e);return{x:0,y:0}}}function scale_to_bbox(bbox){var _bbox=_slicedToArray(bbox,4),xmin=_bbox[0],ymin=_bbox[1],xmax=_bbox[2],ymax=_bbox[3];var feature={type:"Feature",properties:{},id:0,geometry:{type:"LineString",coordinates:[[xmin,ymin],[xmax,ymin],[xmax,ymax],[xmin,ymax],[xmin,ymin]]}};var bboxPath=path.bounds(feature);s=.95/Object(_helpers_math__WEBPACK_IMPORTED_MODULE_0__["c"])((bboxPath[1][0]-bboxPath[0][0])/w,(bboxPath[1][1]-bboxPath[0][1])/h)*proj.scale();t=[0,0];proj.scale(s).translate(t);map.selectAll(".layer").selectAll("path").attr("d",path);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_1__["f"])();var zoom_scale=1;var zoom_translate=[(w-zoom_scale*(bboxPath[1][0]+bboxPath[0][0]))/2,(h-zoom_scale*(bboxPath[1][1]+bboxPath[0][1]))/2];var zoom=svg_map.__zoom;zoom.k=zoom_scale;zoom.x=zoom_translate[0];zoom.y=zoom_translate[1];Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_1__["j"])()}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global,Promise){__webpack_require__.d(__webpack_exports__,"s",(function(){return setUpInterface}));__webpack_require__.d(__webpack_exports__,"c",(function(){return askTypeLayer}));__webpack_require__.d(__webpack_exports__,"n",(function(){return handle_upload_files}));__webpack_require__.d(__webpack_exports__,"k",(function(){return handle_reload_TopoJSON}));__webpack_require__.d(__webpack_exports__,"v",(function(){return update_menu_dataset}));__webpack_require__.d(__webpack_exports__,"x",(function(){return update_section1_layout}));__webpack_require__.d(__webpack_exports__,"w",(function(){return update_section1}));__webpack_require__.d(__webpack_exports__,"d",(function(){return ask_join_now}));__webpack_require__.d(__webpack_exports__,"u",(function(){return updateLayer}));__webpack_require__.d(__webpack_exports__,"j",(function(){return handle_click_hand}));__webpack_require__.d(__webpack_exports__,"q",(function(){return scale_to_lyr}));__webpack_require__.d(__webpack_exports__,"f",(function(){return center_map}));__webpack_require__.d(__webpack_exports__,"h",(function(){return fitLayer}));__webpack_require__.d(__webpack_exports__,"r",(function(){return setSphereBottom}));__webpack_require__.d(__webpack_exports__,"b",(function(){return add_simplified_land_layer}));__webpack_require__.d(__webpack_exports__,"o",(function(){return prepare_available_symbols}));__webpack_require__.d(__webpack_exports__,"a",(function(){return accordionize}));__webpack_require__.d(__webpack_exports__,"t",(function(){return switch_accordion_section}));__webpack_require__.d(__webpack_exports__,"l",(function(){return handle_title}));__webpack_require__.d(__webpack_exports__,"m",(function(){return handle_title_properties}));__webpack_require__.d(__webpack_exports__,"g",(function(){return displayInfoOnMove}));__webpack_require__.d(__webpack_exports__,"i",(function(){return handle_active_layer}));__webpack_require__.d(__webpack_exports__,"p",(function(){return remove_layer_cleanup}));__webpack_require__.d(__webpack_exports__,"e",(function(){return binds_layers_buttons}));var alertifyjs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(17);var alertifyjs__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(alertifyjs__WEBPACK_IMPORTED_MODULE_0__);var jschardet__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(8);var jschardet__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(jschardet__WEBPACK_IMPORTED_MODULE_1__);var proj4__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(22);var topojson__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(25);var _colors_helpers__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(6);var _dialogs__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(4);var _fonts__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(23);var _function__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(9);var _helpers__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(0);var _helpers_calc__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(2);var _helpers_math__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(1);var _join_popup__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(36);var _layers_style_popup__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(24);var _layers__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(20);var _legend__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(7);var _map_ctrl__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(5);var _map_project__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(27);var _projections__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(11);var _sample_topo__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(48);var _tables__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(33);var _zoom_rect__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(51);var _ui_buttons__WEBPACK_IMPORTED_MODULE_21__=__webpack_require__(14);var _ui_header__WEBPACK_IMPORTED_MODULE_22__=__webpack_require__(52);var _ui_section1__WEBPACK_IMPORTED_MODULE_23__=__webpack_require__(53);var _ui_section2__WEBPACK_IMPORTED_MODULE_24__=__webpack_require__(54);var _ui_section3__WEBPACK_IMPORTED_MODULE_25__=__webpack_require__(55);var _ui_section4__WEBPACK_IMPORTED_MODULE_26__=__webpack_require__(56);var _ui_section5__WEBPACK_IMPORTED_MODULE_27__=__webpack_require__(42);function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var MAX_INPUT_SIZE=273e5;function setUpInterface(reload_project){global._app.waitingOverlay=Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["e"])();window.addEventListener("beforeunload",_map_project__WEBPACK_IMPORTED_MODULE_16__["b"]);window.addEventListener("unload",(function(){var layer_names=Object.getOwnPropertyNames(data_manager.current_layers).filter((function(name){if(!data_manager.current_layers[name].hasOwnProperty("key_name")){return 0}else if(data_manager.current_layers[name].targeted){return 0}else if(data_manager.current_layers[name].renderer&&(data_manager.current_layers[name].renderer.indexOf("PropSymbols")>-1||data_manager.current_layers[name].renderer.indexOf("Dorling")>-1||data_manager.current_layers[name].renderer.indexOf("Choropleth")>-1||data_manager.current_layers[name].renderer.indexOf("Categorical")>-1)){return 0}return 1}));if(layer_names.length){var formToSend=new FormData;layer_names.forEach((function(name){formToSend.append("layer_name",data_manager.current_layers[name].key_name)}));navigator.sendBeacon("/layers/delete",formToSend)}}),false);global.overlay_drop=document.querySelector("#overlay_drop");document.getElementById("menu").style.display=null;Object(_ui_header__WEBPACK_IMPORTED_MODULE_22__["a"])();Object(_ui_section1__WEBPACK_IMPORTED_MODULE_23__["a"])();Object(_ui_section2__WEBPACK_IMPORTED_MODULE_24__["a"])();Object(_ui_section3__WEBPACK_IMPORTED_MODULE_25__["a"])();Object(_ui_section4__WEBPACK_IMPORTED_MODULE_26__["a"])();add_simplified_land_layer();Object(_ui_section5__WEBPACK_IMPORTED_MODULE_27__["b"])();var lm=map_div.append("div").attr("class","light-menu");var lm_buttons=[{id:"zoom_out",i18n:"[data-ot]app_page.lm_buttons.zoom-",class:"zoom_button i18n tt",html:"-"},{id:"zoom_in",i18n:"[data-ot]app_page.lm_buttons.zoom+",class:"zoom_button i18n tt",html:"+"},{id:"info_button",i18n:"[data-ot]app_page.lm_buttons.i",class:"info_button i18n tt",html:"i"},{id:"brush_zoom_button",i18n:"[data-ot]app_page.lm_buttons.zoom_rect",class:"brush_zoom_button i18n tt",html:' '},{id:"hand_button",i18n:"[data-ot]app_page.lm_buttons.hand_button",class:"hand_button i18n tt",html:' '}];lm.selectAll("input").data(lm_buttons).enter().append("p").attr("class","cont_map_btn").insert("button").attrs((function(elem){return{class:elem["class"],"data-i18n":elem.i18n,"data-ot-delay":0,"data-ot-fixed":true,"data-ot-target":true,id:elem.id}})).html((function(elem){return elem.html}));d3.selectAll(".zoom_button").on("click",_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["i"]);document.getElementById("info_button").onclick=displayInfoOnMove;document.getElementById("hand_button").onclick=handle_click_hand;document.getElementById("brush_zoom_button").onclick=_zoom_rect__WEBPACK_IMPORTED_MODULE_20__["a"];d3.select("body").append("div").attr("id","info_features").classed("active",false).style("display","none").html("");accordionize(".accordion");document.getElementById("btn_s1").dispatchEvent(new MouseEvent("click"));prepare_drop_section();if(reload_project){var url;if(reload_project.startsWith("http")){url=reload_project}else{url="https://gist.githubusercontent.com/".concat(reload_project,"/raw/")}Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["B"])("GET",url,undefined,true).then((function(data){Object(_map_project__WEBPACK_IMPORTED_MODULE_16__["a"])(data)}))}else{var last_project=window.localStorage.getItem("magrit_project");if(last_project&&last_project.length&&last_project.length>0){swal({title:"",allowOutsideClick:false,allowEscapeKey:false,type:"question",showConfirmButton:true,showCancelButton:true,confirmButtonText:_tr("app_page.common.new_project"),cancelButtonText:_tr("app_page.common.resume_last")}).then((function(){window.localStorage.removeItem("magrit_project")}),(function(){Object(_map_project__WEBPACK_IMPORTED_MODULE_16__["a"])(last_project)}))}}alertifyjs__WEBPACK_IMPORTED_MODULE_0___default.a.set("notifier","position","bottom-left")}function askTypeLayer(){var opts={target:_tr("app_page.common.target_l"),layout:_tr("app_page.common.layout_l")};var target_layer_added=Object.keys(data_manager.user_data).length>0;var first_reject=false;return swal({title:"",text:_tr("app_page.common.layer_type_selection"),type:"info",showCancelButton:true,showCloseButton:false,allowEscapeKey:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:_tr("app_page.common.confirm"),input:"select",inputValue:target_layer_added?"layout":"target",inputPlaceholder:_tr("app_page.common.layer_type_selection"),inputOptions:opts,inputValidator:function inputValidator(value){return new Promise((function(resolve,reject){if(value.indexOf("target")<0&&value.indexOf("layout")<0){reject(_tr("app_page.common.no_value"))}else if(value.indexOf("target")>-1&&_app.targeted_layer_added&&!first_reject){first_reject=true;reject(_tr("app_page.common.ask_replace_target_layer"))}else{if(value.indexOf("target")>-1&&first_reject){downgradeTargetLayer()}resolve(value)}}))}})}function handle_upload_files(files){var tot_size=Array.prototype.map.call(files,(function(f){return f.size})).reduce((function(a,b){return a+b}),0);if(files[0]&&!files[0]._ext){files=Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["v"])(files)}if(tot_size>MAX_INPUT_SIZE){return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.too_large_input"),type:"error",customClass:"swal2_custom",allowEscapeKey:false,allowOutsideClick:false})}if(!(files.length===1)){var files_to_send=[];Array.prototype.forEach.call(files,(function(f){return f._ext==="shp"||f._ext==="dbf"||f._ext==="shx"||f._ext==="prj"||f._ext==="cpg"?files_to_send.push(f):null}));if(files_to_send.length>=4&&files_to_send.length<=6){handle_shapefile(files_to_send)}else{return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.alert_upload1"),customClass:"swal2_custom",type:"error",allowEscapeKey:false,allowOutsideClick:false})}}else if(files[0]._ext.indexOf("json")>-1||files[0]._ext==="zip"||files[0]._ext==="gml"||files[0]._ext==="kml"){if(files[0]._ext.indexOf("json")<0){handle_single_file(files[0])}else{var rd=new FileReader;rd.onloadend=function(){var _isValidJSON=Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["r"])(rd.result),_isValidJSON2=_slicedToArray(_isValidJSON,2),valid=_isValidJSON2[0],tmp=_isValidJSON2[1];if(!valid){console.log(tmp);return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.alert_upload_invalid"),type:"error",customClass:"swal2_custom",allowOutsideClick:false,allowEscapeKey:false})}if(tmp.type&&tmp.type==="FeatureCollection"){handle_single_file(files[0])}else if(tmp.type&&tmp.type==="Topology"){handle_TopoJSON_files(files)}else if(tmp.map_config&&tmp.layers){Object(_map_project__WEBPACK_IMPORTED_MODULE_16__["a"])(rd.result)}else{return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.alert_upload_invalid"),type:"error",customClass:"swal2_custom",allowOutsideClick:false,allowEscapeKey:false})}};rd.readAsText(files[0])}}else if(files[0]._ext==="csv"||files[0]._ext==="tsv"){handle_dataset(files[0])}else if(files[0]._ext.indexOf("xls")>-1||files[0]._ext.indexOf("ods")>-1){convert_dataset(files[0])}else{var shp_part;Array.prototype.forEach.call(files,(function(f){f._ext==="shp"||f._ext==="dbf"||f._ext==="shx"||f._ext==="prj"||f._ext==="cpg"?shp_part=true:null}));if(shp_part){return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.alert_upload_shp"),type:"error",customClass:"swal2_custom",allowOutsideClick:false,allowEscapeKey:false}).then((function(){return null}),(function(){return null}))}else{return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.alert_upload_invalid"),type:"error",customClass:"swal2_custom",allowOutsideClick:false,allowEscapeKey:false})}}}function handleOneByOneShp(files){function populate_shp_slot(slots,file){if(file.name.toLowerCase().indexOf(".shp")>-1){slots.set(".shp",file);document.getElementById("f_shp").className="mini_button_ok"}else if(file.name.toLowerCase().indexOf(".shx")>-1){slots.set(".shx",file);document.getElementById("f_shx").className="mini_button_ok"}else if(file.name.toLowerCase().indexOf(".prj")>-1){slots.set(".prj",file);document.getElementById("f_prj").className="mini_button_ok"}else if(file.name.toLowerCase().indexOf(".dbf")>-1){slots.set(".dbf",file);document.getElementById("f_dbf").className="mini_button_ok"}else if(file.name.toLowerCase().indexOf(".cpg")>-1){slots.set(".cpg",file);document.getElementById("f_cpg").className="mini_button_ok"}else{return false}}var name=files[0].name.substring(0,files[0].name.lastIndexOf("."));var shp_slots=new Map;swal({title:"",html:''+"
".concat(_tr("app_page.common.shp_one_by_one_msg1")," ")+'
'.concat(_tr("app_page.common.shp_one_by_one_msg2",{name}),"
")+"
".concat(_tr("app_page.common.shp_one_by_one_msg3"),"
")+'
'+'.shp
.shx
'+'.dbf
.prj
'+'.cpg
',type:"info",showCancelButton:true,showCloseButton:false,allowEscapeKey:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:_tr("app_page.common.confirm"),preConfirm:function preConfirm(){return new Promise((function(resolve,reject){setTimeout((function(){if(!(shp_slots.size===4&&!shp_slots.has(".cpg")||shp_slots.size===5)){reject(_tr("app_page.common.shp_one_by_one_missing_files"))}else{resolve()}}),50)}))}}).then((function(){var file_list=[shp_slots.get(".shp"),shp_slots.get(".shx"),shp_slots.get(".dbf"),shp_slots.get(".prj")];if(shp_slots.has(".cpg")){file_list.push(shp_slots.get(".cpg"))}for(var i=0;iMAX_INPUT_SIZE){overlay_drop.style.display="none";return swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.too_large_input"),type:"error",allowEscapeKey:false,allowOutsideClick:false})}}handle_shapefile(file_list)}),(function(dismiss){overlay_drop.style.display="none";console.log(dismiss)}));populate_shp_slot(shp_slots,files[0]);document.getElementById("dv_drop_shp").addEventListener("drop",(function(event){event.preventDefault();event.stopPropagation();var next_files=Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["v"])(event.dataTransfer.files);for(var f_ix=0;f_ix-1||field_names.indexOf("lat")>-1||field_names.indexOf("latitude")>-1)){if(field_names.indexOf("y")>-1||field_names.indexOf("lon")>-1||field_names.indexOf("longitude")>-1||field_names.indexOf("long")>-1||field_names.indexOf("lng")>-1){add_csv_geom(data.file,data.name);return}}data_manager.dataset_name=data.name;add_dataset(tmp_dataset)}),(function(){return null}))}}),(function(){Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["g"])()}))};if(data_manager.joined_dataset.length!==0){ask_replace_dataset().then((function(){remove_ext_dataset_cleanup();do_convert()}),(function(){return null}))}else{do_convert()}}function handle_shapefile(files){askTypeLayer().then((function(val){overlay_drop.style.display="none";var target_layer_on_add;if(val.indexOf("target")>-1){target_layer_on_add=true}else{target_layer_on_add=false}var ajaxData=new FormData;ajaxData.append("type","multiple");for(var j=0;j-1){target_layer_on_add=true}else{target_layer_on_add=false}var f=files[0],reader=new FileReader,ajaxData=new FormData;ajaxData.append("file[]",f);Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["B"])("POST","convert_topojson",ajaxData,true).then((function(res){var key=JSON.parse(res).key;reader.onloadend=function(){var text=reader.result;var topoObjText=['{"key": ',key,',"file":',text,"}"].join("");Object(_layers__WEBPACK_IMPORTED_MODULE_13__["a"])(topoObjText,{target_layer_on_add})};reader.readAsText(f)}),(function(){Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["g"])()}))}),(function(){overlay_drop.style.display="none"}))}function handle_reload_TopoJSON(text,param_add_func){var ajaxData=new FormData;var f=new Blob([text],{type:"application/json"});ajaxData.append("file[]",f);var layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_13__["a"])(['{"key":null,"file":',text,"}"].join(""),param_add_func);Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["B"])("POST","convert_topojson",ajaxData,false).then((function(response){var key=JSON.parse(response).key;data_manager.current_layers[layer_name].key_name=key}));return layer_name}function handle_dataset(f,target_layer_on_add){var check_dataset=function check_dataset(){var reader=new FileReader,name=f.name;reader.onload=function(e){var data=e.target.result;var encoding=jschardet__WEBPACK_IMPORTED_MODULE_1___default.a.detect(data).encoding;var new_reader=new FileReader;new_reader.onload=function(ev){data=ev.target.result;var sep=data.split("\n")[0];if(sep.indexOf("\t")>-1){sep="\t"}else if(sep.indexOf(";")>-1){sep=";"}else{sep=","}var tmp_dataset=d3.dsvFormat(sep).parse(data);var field_names=Object.getOwnPropertyNames(tmp_dataset[0]).map((function(el){return el.toLowerCase?el.toLowerCase():el}));if(field_names.indexOf("x")>-1||field_names.indexOf("lat")>-1||field_names.indexOf("latitude")>-1){if(field_names.indexOf("y")>-1||field_names.indexOf("lon")>-1||field_names.indexOf("longitude")>-1||field_names.indexOf("long")>-1||field_names.indexOf("lng")>-1){if(target_layer_on_add&&_app.targeted_layer_added){swal({title:"".concat(_tr("app_page.common.error"),"!"),text:_tr("app_page.common.error_only_one"),customClass:"swal2_custom",type:"error",allowEscapeKey:false,allowOutsideClick:false})}else{add_csv_geom(data,name.substring(0,name.indexOf(".csv")))}return}}data_manager.dataset_name=name.substring(0,name.indexOf(".csv"));add_dataset(tmp_dataset)};new_reader.readAsText(f,encoding)};reader.readAsBinaryString(f)};if(data_manager.joined_dataset.length!==0){ask_replace_dataset().then((function(){remove_ext_dataset_cleanup();check_dataset()}),(function(){return null}))}else{check_dataset()}}function update_menu_dataset(){var d_name=data_manager.dataset_name.length>20?[data_manager.dataset_name.substring(0,17),"(...)"].join(""):data_manager.dataset_name,nb_features=data_manager.joined_dataset[0].length,field_names=Object.getOwnPropertyNames(data_manager.joined_dataset[0][0]);d3.select("#ext_dataset_zone").attr("data-i18n",null).styles({border:null,color:"black","margin-bottom":"3px",padding:null,"text-align":"initial"}).html('\n\n '.concat(d_name,' \n').concat(nb_features," ").concat(_tr("app_page.common.feature",{count:+nb_features})," - ").concat(field_names.length," ").concat(_tr("app_page.common.field",{count:+field_names.length}),' \n
\n\n
\n
\n
'));document.getElementById("remove_dataset").onclick=function(){remove_ext_dataset()};if(_app.targeted_layer_added){Object(_join_popup__WEBPACK_IMPORTED_MODULE_11__["b"])(false)}document.getElementById("table_dataset_s1").onclick=function(){_tables__WEBPACK_IMPORTED_MODULE_19__["a"].create(data_manager.dataset_name)}}function add_dataset(readed_dataset){if(readed_dataset[0].hasOwnProperty("")){var new_col_name=!readed_dataset[0].hasOwnProperty("UID")?"UID":"Undefined_Name";for(var i=0;i-1){target_layer_on_add=true}else{target_layer_on_add=false}var ajaxData=new FormData;ajaxData.append("type","single");ajaxData.append("file[]",file);Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["B"])("POST","/convert_to_topojson",ajaxData,true).then((function(data){Object(_layers__WEBPACK_IMPORTED_MODULE_13__["a"])(data,{target_layer_on_add})}),(function(){Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["g"])()}))}),(function(){overlay_drop.style.display="none"}))}function update_section1_layout(){var nb_layout_layer=0;Object.keys(data_manager.current_layers).forEach((function(k){if(!data_manager.current_layers[k].is_result&&!data_manager.current_layers[k].targeted){nb_layout_layer+=1}}));if(nb_layout_layer>0){d3.select("#layout_layers_section").style("display","inline-flex").html('\n
\n\n'.concat(_tr("app_page.section1.plus_layout_layers",{count:nb_layout_layer}),"
"))}else{d3.select("#layout_layers_section").style("display","none").html("")}}function update_section1(type,nb_fields,nb_ft,lyr_name_to_add){var nb_char_display=lyr_name_to_add.length;var _lyr_name_display=+nb_char_display>35?[lyr_name_to_add.substring(0,30),"(...)"].join(""):lyr_name_to_add;var _button=_ui_buttons__WEBPACK_IMPORTED_MODULE_21__["f"].get(type);_button=_button.substring(10,_button.indexOf("class")-2);d3.select("#target_layer_zone").attr("data-i18n",null).styles({border:null,color:"black",padding:null,"text-align":"left"}).html('\n
\n
\n\n').concat(_lyr_name_display,' \n \n').concat(nb_ft," ").concat(_tr("app_page.common.feature",{count:+nb_ft})," - ").concat(nb_fields," ").concat(_tr("app_page.common.field",{count:+nb_fields}),' \n
\n'));document.getElementById("remove_target").onclick=function(){remove_layer(Object.getOwnPropertyNames(data_manager.user_data)[0])};document.getElementById("table_layer_s1").onclick=display_table_target_layer;document.getElementById("downgrade_target").onclick=function(){ask_downgrade_target_layer(Object.keys(data_manager.user_data)[0]).then((function(){downgradeTargetLayer()}),(function(){return null}))}}function ask_downgrade_target_layer(name_layer){return swal({title:"",text:_tr("app_page.common.replace_target_downgrade",{name_layer}),allowOutsideClick:false,allowEscapeKey:true,type:"question",showConfirmButton:true,showCancelButton:true,confirmButtonText:_tr("app_page.common.yes"),cancelButtonText:_tr("app_page.common.no")})}function ask_replace_target_layer(name_layer){return swal({title:"",text:_tr("app_page.common.replace_target_promote",{name_layer}),allowOutsideClick:false,allowEscapeKey:true,type:"question",showConfirmButton:true,showCancelButton:true,confirmButtonText:_tr("app_page.common.yes"),cancelButtonText:_tr("app_page.common.no")})}function ask_join_now(layer_name){var on_add=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"layer";swal({title:"",text:_tr("app_page.join_box.before_join_ask"),allowOutsideClick:false,allowEscapeKey:true,type:"question",showConfirmButton:true,showCancelButton:true,confirmButtonText:_tr("app_page.common.yes"),cancelButtonText:_tr("app_page.common.no")}).then((function(){Object(_join_popup__WEBPACK_IMPORTED_MODULE_11__["a"])(layer_name)}),(function(){if(on_add==="layer")Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["s"])(layer_name)}))}var display_table_target_layer=function display_table_target_layer(){var layer_name=Object.keys(data_manager.user_data)[0];_tables__WEBPACK_IMPORTED_MODULE_19__["a"].create(layer_name)};function updateLayer(layer_name){var fields=Object.keys(data_manager.user_data[layer_name][0]);data_manager.current_layers[layer_name].n_features=data_manager.user_data[layer_name].length;data_manager.current_layers[layer_name].original_fields=new Set(fields);var lyr_id=_app.layer_to_id.get(layer_name);var k=Object.keys(_target_layer_file.objects)[0];var selection=map.select("#".concat(lyr_id)).selectAll("path").data(topojson__WEBPACK_IMPORTED_MODULE_3__["feature"](_target_layer_file,_target_layer_file.objects[k]).features,(function(d){return d.id}));selection.exit().remove();scale_to_lyr(layer_name);center_map(layer_name);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["j"])();update_section1(data_manager.current_layers[layer_name].type,fields.length,data_manager.current_layers[layer_name].n_features,layer_name)}function handle_click_hand(behavior){var hb=d3.select("#hand_button");var b=_typeof(behavior)==="object"?!hb.classed("locked")?"lock":"unlock":behavior&&typeof behavior==="string"?behavior:false;if(b==="lock"){hb.classed("locked",true);hb.html(' ');map.select(".brush").remove();document.getElementById("zoom_in").parentElement.style.display="none";document.getElementById("zoom_out").parentElement.style.display="none";document.getElementById("brush_zoom_button").parentElement.style.display="none";_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["h"].on("zoom",function(){var blocked=svg_map.__zoom;return function(){this.__zoom=blocked}}())}else{hb.classed("locked",false);hb.html(' ');_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["h"].on("zoom",_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["j"]);document.getElementById("zoom_in").parentElement.style.display="";document.getElementById("zoom_out").parentElement.style.display="";document.getElementById("brush_zoom_button").parentElement.style.display="";map.select(".brush").remove()}}function get_bbox_layer_path(name){var selec=svg_map.querySelector("#"+_app.layer_to_id.get(name)).childNodes;var bbox_layer_path=[[Infinity,Infinity],[-Infinity,-Infinity]];for(var i=0,len_i=selec.length;ibbox_layer_path[1][0]?bbox_path[1][0]:bbox_layer_path[1][0];bbox_layer_path[1][1]=bbox_path[1][1]>bbox_layer_path[1][1]?bbox_path[1][1]:bbox_layer_path[1][1]}if(_app.current_proj_name==="ConicConformal"){var s1=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_10__["c"])((bbox_layer_path[1][0]-bbox_layer_path[0][0])/w,(bbox_layer_path[1][1]-bbox_layer_path[0][1])/h);var bbox_layer_path2=path.bounds({type:"MultiPoint",coordinates:[[-69.3,-55.1],[20.9,-36.7],[147.2,-42.2],[162.1,67],[-160.2,65.7]]});var s2=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_10__["c"])((bbox_layer_path2[1][0]-bbox_layer_path2[0][0])/w,(bbox_layer_path2[1][1]-bbox_layer_path2[0][1])/h);if(s20&&arguments[0]!==undefined?arguments[0]:{};var skip_rescale=options.skip_rescale||false;var stroke=options.stroke||"rgb(0,0,0)";var fill=options.fill||"#d3d3d3";var stroke_opacity=options.stroke_opacity||0;var fill_opacity=options.fill_opacity||.75;var stroke_width=options.stroke_width||"0.3px";var visible=!(options.visible===false);var drop_shadow=options.drop_shadow||false;var world_id=encodeId("World");_app.layer_to_id.set("World",world_id);_app.id_to_layer.set(world_id,"World");data_manager.current_layers.World={type:"Polygon",n_features:125,"stroke-width-const":+stroke_width.slice(0,-2),fill_color:{single:fill},default_layer:true};map.insert("g",".legend").attrs({id:world_id,class:"layer","clip-path":"url(#clip)"}).style("stroke-width",stroke_width).selectAll(".subunit").data(topojson__WEBPACK_IMPORTED_MODULE_3__["feature"](_sample_topo__WEBPACK_IMPORTED_MODULE_18__["a"],_sample_topo__WEBPACK_IMPORTED_MODULE_18__["a"].objects.World).features).enter().append("path").attr("d",path).styles({stroke,fill,"stroke-opacity":stroke_opacity,"fill-opacity":fill_opacity});Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["f"])("World",null,"Polygon","sample");if(drop_shadow){Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_12__["a"])("World")}if(!skip_rescale){scale_to_lyr("World");center_map("World")}if(!visible){handle_active_layer("World")}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["j"])()}function send_remove_server(layer_name){var formToSend=new FormData;formToSend.append("layer_name",data_manager.current_layers[layer_name].key_name);Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["B"])("POST","layers/delete",formToSend,true).then((function(data){var parsed=JSON.parse(data);if(!parsed.code||parsed.code!=="Ok")console.log(data)}))["catch"]((function(err){console.log(err)}))}function prepare_available_symbols(){return Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["B"])("GET","static/json/list_symbols.json",null).then((function(result){var list_res=JSON.parse(result);return Promise.all(list_res.map((function(name){return Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["m"])("static/img/svg_symbols/".concat(name))}))).then((function(symbols){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:".accordion";var parent=arguments.length>1?arguments[1]:undefined;var _parent=parent&&_typeof(parent)==="object"?parent:parent&&typeof parent==="string"?document.querySelector(parent):document;var acc=_parent.querySelectorAll(css_selector);for(var i=0;i .".concat(id_new_target_lyr)).classList.add("sortable_target");var d={};d[new_target]={type:"FeatureCollection",features:Array.prototype.slice.call(document.querySelectorAll("#".concat(id_new_target_lyr," > path"))).map((function(d){return d.__data__}))};window._target_layer_file=topojson__WEBPACK_IMPORTED_MODULE_3__["topology"](d);if(!data_manager.current_layers[new_target].key_name){Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["x"])(new_target,"/layers/add")}if(_app.current_functionnality!==undefined){fields_handler.unfill();fields_handler.fill(new_target)}}function resetSection1(){d3.select("#target_layer_zone").attrs({class:"i18n","data-i18n":"[html]app_page.section1.no_target"}).styles({border:"3px dashed #ccc",color:"#ccc","margin-bottom":"3px",padding:"3px","text-align":"center"}).html(_tr("app_page.section1.no_target"));document.getElementById("join_section").innerHTML="";document.getElementById("btn_type_fields").setAttribute("disabled","true");Object(_helpers__WEBPACK_IMPORTED_MODULE_8__["k"])();Object(_function__WEBPACK_IMPORTED_MODULE_7__["m"])()}function switch_accordion_section(id_elem){document.getElementById(id_elem||"btn_s3").dispatchEvent(new MouseEvent("click"))}function handle_title(txt){var title=d3.select("#map_title").select("text");if(title.node()){title.text(txt)}else{map.append("g").attrs({class:"legend title",id:"map_title"}).style("cursor","pointer").insert("text").attrs({x:w/2,y:h/12,"alignment-baseline":"middle","text-anchor":"middle"}).styles({"font-family":"verdana","font-size":"20px",position:"absolute",color:"black"}).text(txt).on("contextmenu dblclick",(function(){d3.event.preventDefault();d3.event.stopPropagation();handle_title_properties()})).call(_helpers__WEBPACK_IMPORTED_MODULE_8__["h"])}}function handle_title_properties(){var title=d3.select("#map_title").select("text");if(!title.node()||title.text()===""){swal({title:"",text:_tr("app_page.common.error_no_title"),type:"error",allowOutsideClick:true,allowEscapeKey:true}).then((function(){return null}),(function(){return null}));return}var title_props={size:title.style("font-size"),font_weight:title.style("font-weight"),font_style:title.style("font-style"),text_decoration:title.style("text-decoration"),color:title.style("fill"),position_x:title.attr("x"),position_x_pct:Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_9__["n"])(+title.attr("x")/w*100,1),position_y:title.attr("y"),position_y_pct:Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_9__["n"])(+title.attr("y")/h*100,1),font_family:title.style("font-family"),stroke:title.style("stroke"),stroke_width:title.style("stroke-width")};title_props.font_weight=title_props.font_weight==="400"||title_props.font_weight===""?"":"bold";title_props.font_family=title_props.font_family?title_props.font_family.replace(", ",","):title_props.font_family;Object(_dialogs__WEBPACK_IMPORTED_MODULE_5__["b"])("mapTitleitleDialogBox",_tr("app_page.title_box.title"),{widthFitContent:true}).then((function(confirmed){if(!confirmed){title.attrs({x:title_props.position_x,y:title_props.position_y}).styles({fill:title_props.color,stroke:title_props.stroke,"stroke-width":title_props.stroke_width,"font-family":title_props.font_family,"font-size":title_props.size,"font-style":title_props.font_style,"font-weight":title_props.font_weight,"text-decoration":title_props.text_decoration})}}));var box_content=d3.select(".mapTitleitleDialogBox").select(".modal-body").append("div").style("margin","15x");box_content.append("p").html(_tr("app_page.title_box.font_size")).insert("input").attrs({type:"number",min:2,max:40,step:1}).property("value",+title_props.size.split("px")[0]).style("width","65px").on("change",(function(){title.style("font-size","".concat(this.value,"px"))}));box_content.append("p").html(_tr("app_page.title_box.xpos")).insert("input").attrs({type:"number",min:0,max:100,step:1}).property("value",title_props.position_x_pct).style("width","65px").on("change",(function(){title.attr("x",w*+this.value/100)}));box_content.append("p").html(_tr("app_page.title_box.ypos")).insert("input").attrs({type:"number",min:0,max:100,step:1}).property("value",title_props.position_y_pct).style("width","65px").on("change",(function(){title.attr("y",h*+this.value/100)}));box_content.append("p").html(_tr("app_page.title_box.font_color")).insert("input").attr("type","color").property("value",Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_4__["g"])(title_props.color)).on("change",(function(){title.style("fill",this.value)}));var font_select=box_content.append("p").html(_tr("app_page.title_box.font_family")).insert("select").attr("class","params").on("change",(function(){title.style("font-family",this.value)}));_fonts__WEBPACK_IMPORTED_MODULE_6__["a"].forEach((function(font){font_select.append("option").text(font[0]).attr("value",font[1])}));font_select.node().selectedIndex=_fonts__WEBPACK_IMPORTED_MODULE_6__["a"].map((function(d){return d[1]===title_props.font_family?"1":"0"})).indexOf("1");var options_format=box_content.append("p"),btn_bold=options_format.insert("span").attr("class",title_props.font_weight==="bold"?"active button_disc":"button_disc").html(' '),btn_italic=options_format.insert("span").attr("class",title_props.font_style==="italic"?"active button_disc":"button_disc").html(' '),btn_underline=options_format.insert("span").attr("class",title_props.text_decoration==="underline"?"active button_disc":"button_disc").html(' ');btn_bold.on("click",(function(){if(this.classList.contains("active")){this.classList.remove("active");title.style("font-weight","")}else{this.classList.add("active");title.style("font-weight","bold")}}));btn_italic.on("click",(function(){if(this.classList.contains("active")){this.classList.remove("active");title.style("font-style","")}else{this.classList.add("active");title.style("font-style","italic")}}));btn_underline.on("click",(function(){if(this.classList.contains("active")){this.classList.remove("active");title.style("text-decoration","")}else{this.classList.add("active");title.style("text-decoration","underline")}}));var hasBuffer=title_props.stroke!=="none";var buffer_section1=box_content.append("p");var buffer_section2=box_content.append("p").style("display",hasBuffer?"":"none");box_content.append("p").style("clear","both");buffer_section1.append("input").attrs({type:"checkbox",id:"title_buffer_chkbox",checked:hasBuffer?true:null}).on("change",(function(){if(this.checked){buffer_section2.style("display","");title.style("stroke",buffer_color.node().value).style("stroke-width","".concat(buffer_width.node().value,"px"))}else{buffer_section2.style("display","none");title.style("stroke","none").style("stroke-width","1px")}}));buffer_section1.append("label").attrs({for:"title_buffer_chkbox"}).text(_tr("app_page.title_box.buffer"));var buffer_color=buffer_section2.insert("input").style("float","left").attrs({type:"color"}).property("value",hasBuffer?Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_4__["g"])(title_props.stroke):"#ffffff").on("change",(function(){title.style("stroke",this.value)}));buffer_section2.insert("span").style("float","right").html(" px");var buffer_width=buffer_section2.insert("input").styles({float:"right",width:"60px"}).attrs({type:"number",step:"0.1"}).property("value",hasBuffer?+title_props.stroke_width.replace("px",""):1).on("change",(function(){title.style("stroke-width","".concat(this.value,"px"))}))}function displayInfoOnMove(){var info_features=d3.select("#info_features");if(info_features.classed("active")){map.selectAll(".layer").selectAll("path").on("mouseover",null);map.selectAll(".layer").selectAll("circle").on("mouseover",null);map.selectAll(".layer").selectAll("rect").on("mouseover",null);info_features.classed("active",false);info_features.style("display","none").html("");d3.select("#info_button").classed("active",false);svg_map.style.cursor=""}else{map.select(".brush").remove();d3.select("#brush_zoom_button").classed("active",false);var layers=svg_map.querySelectorAll(".layer"),nb_layer=layers.length;var top_visible_layer=null;for(var i=nb_layer-1;i>-1;i--){if(layers[i].style.visibility!=="hidden"){top_visible_layer=global._app.id_to_layer.get(layers[i].id);break}}if(!top_visible_layer){swal("",_tr("app_page.common.error_no_visible"),"error");return}var id_top_layer="#".concat(global._app.layer_to_id.get(top_visible_layer));var symbol=data_manager.current_layers[top_visible_layer].symbol||"path";map.select(id_top_layer).selectAll(symbol).on("mouseover",(function(d,i){var txt_info=["",top_visible_layer," Feature ",i+1,"/",data_manager.current_layers[top_visible_layer].n_features," "];var properties=data_manager.result_data[top_visible_layer]?data_manager.result_data[top_visible_layer][i]:d.properties;Object.getOwnPropertyNames(properties).forEach((function(el){txt_info.push("".concat(el," : ").concat(properties[el]))}));txt_info.push("
");info_features.style("display",null).html(txt_info.join(""))}));map.select(id_top_layer).selectAll(symbol).on("mouseout",(function(){info_features.style("display","none").html("")}));info_features.classed("active",true);svg_map.style.cursor="help";d3.select("#info_button").classed("active",true)}}function handle_active_layer(name){var fill_value,parent_div,selec,at_end;if(document.getElementById("info_features").className==="active"){displayInfoOnMove();at_end=true}if(!name){selec=this;parent_div=selec.parentElement;name=parent_div.parentElement.getAttribute("layer_name")}else{selec=document.querySelector("#sortable .".concat(global._app.layer_to_id.get(name)," .active_button"));parent_div=selec.parentElement}var func=function func(){handle_active_layer(name)};if(selec.id==="eye_closed"){fill_value=1;var eye_open=make_eye_button("open");eye_open.onclick=func;parent_div.replaceChild(eye_open,selec)}else{fill_value=0;var eye_closed=make_eye_button("closed");eye_closed.onclick=func;parent_div.replaceChild(eye_closed,selec)}map.select("#".concat(global._app.layer_to_id.get(name))).style("visibility",fill_value===0?"hidden":"initial");map.selectAll(".lgdf_".concat(global._app.layer_to_id.get(name))).style("visibility",fill_value===0?"hidden":"initial");if(at_end){displayInfoOnMove()}}function make_eye_button(state){if(state==="open"){var eye_open=document.createElement("img");eye_open.setAttribute("src","static/img/b/eye_open.png");eye_open.setAttribute("class","active_button i18n");eye_open.setAttribute("id","eye_open");eye_open.setAttribute("width",17);eye_open.setAttribute("height",17);eye_open.setAttribute("alt","Visible");return eye_open}else if(state==="closed"){var eye_closed=document.createElement("img");eye_closed.setAttribute("src","static/img/b/eye_closed.png");eye_closed.setAttribute("class","active_button i18n");eye_closed.setAttribute("id","eye_closed");eye_closed.setAttribute("width",17);eye_closed.setAttribute("height",17);eye_closed.setAttribute("alt","Not visible");return eye_closed}}function remove_layer(name){name=name||this.parentElement.parentElement.getAttribute("layer_name");swal({title:"",text:_tr("app_page.common.remove_layer",{layer:name}),type:"warning",customClass:"swal2_custom",showCancelButton:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:"".concat(_tr("app_page.common.delete"),"!"),cancelButtonText:_tr("app_page.common.cancel")}).then((function(){remove_layer_cleanup(name)}),(function(){return null}))}function remove_ext_dataset(){swal({title:"",text:_tr("app_page.common.remove_tabular"),type:"warning",showCancelButton:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:"".concat(_tr("app_page.common.delete"),"!"),cancelButtonText:_tr("app_page.common.cancel")}).then((function(){remove_ext_dataset_cleanup()}),(function(){return null}))}function remove_ext_dataset_cleanup(){data_manager.field_join_map=[];data_manager.joined_dataset=[];data_manager.dataset_name=undefined;d3.select("#ext_dataset_zone").attr("data-i18n","[html]app_page.section1.no_ext_dataset").styles({border:"3px dashed #ccc",color:"rgb(204, 204, 204)",padding:"3px","text-align":"center"}).html(_tr("app_page.section1.no_ext_dataset"));document.getElementById("join_section").innerHTML=""}function remove_layer_cleanup(name){if(!data_manager.current_layers[name])return;var layer_id=global._app.layer_to_id.get(name);if(data_manager.current_layers[name].is_result||data_manager.current_layers[name].layout_legend_displayed){map.selectAll([".lgdf_",layer_id].join("")).remove()}if(data_manager.result_data.hasOwnProperty(name)){delete data_manager.result_data[name]}if(data_manager.current_layers[name].hasOwnProperty("key_name")&&data_manager.current_layers[name].renderer&&data_manager.current_layers[name].renderer.indexOf("Choropleth")<0&&data_manager.current_layers[name].renderer.indexOf("Categorical")<0){send_remove_server(name)}var filter_id=map.select("#".concat(layer_id)).attr("filter");if(filter_id){svg_map.querySelector(filter_id.substr(4).replace(")","")).remove()}map.select("#".concat(layer_id)).remove();document.querySelector("#sortable .".concat(layer_id)).remove();var a=document.getElementById("layer_to_export").querySelector('option[value="'.concat(name,'"]'));if(a)a.remove();if(global._app.current_functionnality&&(global._app.current_functionnality.name==="smooth"||global._app.current_functionnality.name==="grid")){Array.prototype.slice.call(document.querySelectorAll(".mask_field")).forEach((function(elem){var aa=elem.querySelector('option[value="'.concat(name,'"]'));if(aa)aa.remove()}))}if(data_manager.current_layers[name].targeted){if(global._app.current_functionnality){Object(_function__WEBPACK_IMPORTED_MODULE_7__["b"])()}data_manager.field_join_map=[];data_manager.user_data={};global._app.targeted_layer_added=false;resetSection1();if(_app.current_proj_name==="def_proj4"){_app.current_proj_name="NaturalEarth2";Object(_projections__WEBPACK_IMPORTED_MODULE_17__["c"])(_app.current_proj_name);Object(_projections__WEBPACK_IMPORTED_MODULE_17__["a"])(_app.current_proj_name)}}delete data_manager.current_layers[name];if(name!=="Graticule"){global._app.layer_to_id["delete"](name);global._app.id_to_layer["delete"](layer_id)}}function binds_layers_buttons(layer_name){var layer_id=global._app.layer_to_id.get(layer_name);var sortable_elem=d3.select("#sortable").select(".".concat(layer_id));sortable_elem.on("dblclick",(function(){Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_12__["c"])(layer_name)}));sortable_elem.on("contextmenu",(function(){d3.event.preventDefault()}));sortable_elem.select("#trash_button").on("click",(function(){remove_layer(layer_name)}));sortable_elem.select(".active_button").on("click",(function(){handle_active_layer(layer_name)}));sortable_elem.select(".style_button").on("click",(function(){Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_12__["c"])(layer_name)}));sortable_elem.select(".style_target_layer").on("click",(function(){Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_12__["c"])(layer_name)}));sortable_elem.select("#legend_button").on("click",(function(){Object(_legend__WEBPACK_IMPORTED_MODULE_14__["j"])(layer_name)}));sortable_elem.select("#browse_data_button").on("click",(function(){_tables__WEBPACK_IMPORTED_MODULE_19__["a"].create(layer_name)}));sortable_elem.select("#replace_button").on("click",(function(){ask_replace_target_layer(layer_name).then((function(){changeTargetLayer(layer_name)}),(function(){return null}))}));sortable_elem.select("#zoom_fit_button").on("click",(function(){center_map(layer_name);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_15__["j"])()}))}}).call(this,__webpack_require__(19),__webpack_require__(21))},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(Promise){__webpack_require__.d(__webpack_exports__,"a",(function(){return check_remove_existing_box}));__webpack_require__.d(__webpack_exports__,"c",(function(){return make_dialog_container}));__webpack_require__.d(__webpack_exports__,"d",(function(){return overlay_under_modal}));__webpack_require__.d(__webpack_exports__,"b",(function(){return make_confirm_dialog2}));__webpack_require__.d(__webpack_exports__,"e",(function(){return reOpenParent}));function check_remove_existing_box(box_selector){var existing_box=document.querySelector(box_selector);if(existing_box)existing_box.remove()}function make_dialog_container(id_box,title,class_box){var _id_box=id_box||"dialog";var _title=title||"";var _class_box=class_box||"dialog";var container=document.createElement("div");container.setAttribute("id",id_box);container.setAttribute("class","twbs modal fade ".concat(_class_box));container.setAttribute("tabindex","-1");container.setAttribute("role","dialog");container.setAttribute("aria-labelledby","myModalLabel");container.setAttribute("aria-hidden","true");container.innerHTML='';document.getElementById("twbs").appendChild(container);var html_content='\n
\n ");var modal_box=new Modal(document.getElementById(_id_box),{content:html_content});modal_box.show();return modal_box}var overlay_under_modal=function(){var twbs_div=document.querySelector(".twbs");var bg=document.createElement("div");bg.id="overlay_twbs";bg.style.width="100%";bg.style.height="100%";bg.style.position="fixed";bg.style.zIndex=99;bg.style.top=0;bg.style.left=0;bg.style.background="rgba(0,0,0,0.4)";bg.style.display="none";twbs_div.insertBefore(bg,twbs_div.childNodes[0]);return{display:function display(){bg.style.display=""},hide:function hide(){bg.style.display="none"}}}();var make_confirm_dialog2=function(class_box,title,options){var get_available_id=function get_available_id(){for(var i=0;i<50;i++){if(!existing.has(i)){existing.add(i);return i}}};var existing=new Set;return function(class_box,title,options){class_box=class_box||"dialog";title=title||_tr("app_page.common.ask_confirm");options=options||{};var container=document.createElement("div");var new_id=get_available_id();container.setAttribute("id","myModal_".concat(new_id));container.setAttribute("class","twbs modal fade ".concat(class_box));container.setAttribute("tabindex","-1");container.setAttribute("role","dialog");container.setAttribute("aria-labelledby","myModalLabel");container.setAttribute("aria-hidden","true");container.innerHTML=options.widthFitContent?'':'';document.getElementById("twbs").appendChild(container);container=document.getElementById("myModal_".concat(new_id));var text_ok=options.text_ok||_tr("app_page.common.confirm");var text_cancel=options.text_cancel||_tr("app_page.common.cancel");var html_content='\n ').concat(options.html_content||"",'
\n ");return new Promise((function(resolve,reject){var modal_box=new Modal(container,{backdrop:true,keyboard:false,content:html_content});modal_box.show();container.modal=modal_box;overlay_under_modal.display();var func_cb=function func_cb(evt){helper_esc_key_twbs_cb(evt,_onclose_false)};var clean_up_box=function clean_up_box(){document.removeEventListener("keydown",func_cb);existing["delete"](new_id);overlay_under_modal.hide();container.remove()};var _onclose_false=function _onclose_false(){resolve(false);clean_up_box()};container.querySelector(".btn_cancel").onclick=_onclose_false;container.querySelector("#xclose").onclick=_onclose_false;container.querySelector(".btn_ok").onclick=function(){resolve(true);clean_up_box()};document.addEventListener("keydown",func_cb)}))}}();function reOpenParent(css_selector){var parent_style_box=css_selector!==undefined?document.querySelector(css_selector):document.querySelector(".styleBox");if(parent_style_box&&parent_style_box.modal&&parent_style_box.modal.show){parent_style_box.modal.show();return true}return false}}).call(this,__webpack_require__(21))},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){__webpack_require__.d(__webpack_exports__,"h",(function(){return zoom}));__webpack_require__.d(__webpack_exports__,"b",(function(){return canvas_rotation_value}));__webpack_require__.d(__webpack_exports__,"d",(function(){return makeSvgMap}));__webpack_require__.d(__webpack_exports__,"j",(function(){return zoom_without_redraw}));__webpack_require__.d(__webpack_exports__,"f",(function(){return reproj_symbol_layer}));__webpack_require__.d(__webpack_exports__,"g",(function(){return rotate_global}));__webpack_require__.d(__webpack_exports__,"e",(function(){return redraw_legends_symbols}));__webpack_require__.d(__webpack_exports__,"i",(function(){return zoomClick}));__webpack_require__.d(__webpack_exports__,"c",(function(){return handle_bg_color}));__webpack_require__.d(__webpack_exports__,"a",(function(){return canvas_mod_size}));var alertifyjs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(17);var alertifyjs__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(alertifyjs__WEBPACK_IMPORTED_MODULE_0__);var _helpers_calc__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2);var _helpers_math__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1);var _legend__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(7);var _layout_features_scalebar__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(12);var _layout_features_north_arrow__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(15);var zoom=d3.zoom().on("zoom",zoom_without_redraw);var canvas_rotation_value=null;function makeSvgMap(){var map_div=d3.select("#map");map_div.selectAll("*").remove();var map=map_div.styles({width:"".concat(w,"px"),height:"".concat(h,"px")}).append("svg").attrs({id:"svg_map",width:w,height:h}).styles({position:"absolute","background-color":"rgba(255, 255, 255, 0)"}).on("contextmenu",(function(){d3.event.preventDefault()})).call(zoom);var svg_map=map.node();var defs=map.append("defs");return{map_div,map,svg_map,defs}}function zoom_without_redraw(){var rot_val=canvas_rotation_value||"";var transform;var t_val;if(!d3.event||!d3.event.transform||!d3.event.sourceEvent){transform=d3.zoomTransform(svg_map);t_val=transform.toString()+rot_val;map.selectAll(".layer").transition().duration(50).style("stroke-width",(function(){var lyr_name=global._app.id_to_layer.get(this.id);return data_manager.current_layers[lyr_name].fixed_stroke?this.style.strokeWidth:"".concat(data_manager.current_layers[lyr_name]["stroke-width-const"]/transform.k,"px")})).attr("transform",t_val);map.selectAll(".scalable-legend").transition().duration(50).attr("transform",t_val)}else{t_val=d3.event.transform.toString()+rot_val;map.selectAll(".layer").transition().duration(50).style("stroke-width",(function(){var lyr_name=global._app.id_to_layer.get(this.id);return data_manager.current_layers[lyr_name].fixed_stroke?this.style.strokeWidth:"".concat(data_manager.current_layers[lyr_name]["stroke-width-const"]/d3.event.transform.k,"px")})).attr("transform",t_val);map.selectAll(".scalable-legend").transition().duration(50).attr("transform",t_val)}if(_layout_features_scalebar__WEBPACK_IMPORTED_MODULE_4__["a"].displayed){_layout_features_scalebar__WEBPACK_IMPORTED_MODULE_4__["a"].update()}if(_app.legendRedrawTimeout){clearTimeout(_app.legendRedrawTimeout)}_app.legendRedrawTimeout=setTimeout(redraw_legends_symbols,650);var zoom_params=svg_map.__zoom;var _k=proj.scale()*zoom_params.k;document.getElementById("input-center-x").value=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(zoom_params.x,2);document.getElementById("input-center-y").value=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(zoom_params.y,2);document.getElementById("input-scale-k").value=_k>2||_k<-2?Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(_k,2):Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["n"])(_k,Math.round(Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_1__["e"])(_k)/2))}function reproj_symbol_layer(){var layers=Object.keys(data_manager.current_layers);var n_layers=layers.length;var lyr_name;for(var ix=0;ix-1||data_manager.current_layers[lyr_name].renderer.indexOf("TypoSymbols")>-1||data_manager.current_layers[lyr_name].renderer.indexOf("Label")>-1)){var symbol=data_manager.current_layers[lyr_name].symbol;if(symbol==="text"){map.select("#".concat(global._app.layer_to_id.get(lyr_name))).selectAll(symbol).attrs((function(d){var pt=path.centroid(d.geometry);return{x:pt[0],y:pt[1]}}))}else if(symbol==="image"){map.select("#".concat(global._app.layer_to_id.get(lyr_name))).selectAll(symbol).attrs((function(d){var coords=path.centroid(d.geometry),size=+this.getAttribute("width").replace("px","")/2;return{x:coords[0]-size,y:coords[1]-size}}))}else if(symbol==="circle"){map.select("#".concat(global._app.layer_to_id.get(lyr_name))).selectAll(symbol).style("display",(function(d){return isNaN(+path.centroid(d)[0])?"none":undefined})).attrs((function(d){var centroid=path.centroid(d);return{r:d.properties.prop_value,cx:centroid[0],cy:centroid[1]}}))}else if(symbol==="rect"){map.select("#".concat(global._app.layer_to_id.get(lyr_name))).selectAll(symbol).style("display",(function(d){return isNaN(+path.centroid(d)[0])?"none":undefined})).attrs((function(d){var centroid=path.centroid(d),size=d.properties.prop_value;return{height:size,width:size,x:centroid[0]-size/2,y:centroid[1]-size/2}}))}}else if(data_manager.current_layers[lyr_name].pointRadius!==undefined){map.select("#".concat(global._app.layer_to_id.get(lyr_name))).selectAll("path").attr("d",path.pointRadius(data_manager.current_layers[lyr_name].pointRadius))}else if(data_manager.current_layers[lyr_name].renderer==="TwoStocksWaffle"){var selection=svg_map.querySelector("#".concat(global._app.layer_to_id.get(lyr_name))).querySelectorAll("g");var nbFt=selection.length;if(data_manager.current_layers[lyr_name].symbol==="circle"){for(var i=0;i5||svg_map.__zoom.k<.15;var hidden_message=false;for(var i=0;i text").innerHTML;legend_nodes[i].remove();Object(_legend__WEBPACK_IMPORTED_MODULE_3__["d"])(layer_name,type_lgd_layout,lgd_title,lgd_subtitle,rect_fill_value,text_value,notes);new_lgd=document.querySelector(["#legend_root_layout.lgdf_",layer_id].join(""))}else if(rendered_field&&["Carto_doug","OlsonCarto"].indexOf(data_manager.current_layers[layer_name].renderer)<0){var nested=legend_nodes[i].getAttribute("nested"),join_line=legend_nodes[i].getAttribute("join_line");legend_nodes[i].remove();Object(_legend__WEBPACK_IMPORTED_MODULE_3__["f"])(layer_name,rendered_field,lgd_title,lgd_subtitle,nested,join_line,rect_fill_value,rounding_precision,notes);new_lgd=document.querySelector(["#legend_root_symbol.lgdf_",layer_id].join(""))}else{continue}new_lgd.style.visibility=visible;if(transform_param){new_lgd.setAttribute("transform",transform_param)}if(display_value){new_lgd.setAttribute("display",display_value)}else if(hide&&rendered_field){new_lgd.setAttribute("display","none");hidden_message=true}}if(hidden_message){alertifyjs__WEBPACK_IMPORTED_MODULE_0___default.a.notify(_tr("app_page.notification.warning_deactivation_prop_symbol_legend"),"warning",5)}var legend_nodes_links_discont=document.querySelectorAll("#legend_root_lines_class");for(var _i2=0;_i2-1||rgb.indexOf("rgb")<0){return rgb}var _rgb=rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return _rgb&&_rgb.length===4?"#".concat("0".concat(parseInt(_rgb[1],10).toString(16)).slice(-2)).concat("0".concat(parseInt(_rgb[2],10).toString(16)).slice(-2)).concat("0".concat(parseInt(_rgb[3],10).toString(16)).slice(-2)):""}return rgb&&rgb.length===3?"#".concat("0".concat(parseInt(rgb[0],10).toString(16)).slice(-2)).concat("0".concat(parseInt(rgb[1],10).toString(16)).slice(-2)).concat("0".concat(parseInt(rgb[2],10).toString(16)).slice(-2)):""}function hexToRgb(hex,out){var res=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);if(out==="string"){return res?"rgb(".concat(parseInt(res[1],16),",").concat(parseInt(res[2],16),",").concat(parseInt(res[3],16),")"):null}return res?[parseInt(res[1],16),parseInt(res[2],16),parseInt(res[3],16)]:null}var getColorBrewerArray=function getColorBrewerArray(nbClass,name){if(nbClass<10&&nbClass>=3){var _colors=colorbrewer__WEBPACK_IMPORTED_MODULE_0___default.a[name][nbClass];return _colors}else if(nbClass<3){var _colors2=colorbrewer__WEBPACK_IMPORTED_MODULE_0___default.a[name][3];return[rgb2hex(interpolateColor(hexToRgb(_colors2[0]),hexToRgb(_colors2[1]))),rgb2hex(interpolateColor(hexToRgb(_colors2[1]),hexToRgb(_colors2[2])))]}else if(nbClass>9&&nbClass<18){var _colors3=colorbrewer__WEBPACK_IMPORTED_MODULE_0___default.a[name][9];var diff=nbClass-9;return interp_n(_colors3,diff,9)}var colors=colorbrewer__WEBPACK_IMPORTED_MODULE_0___default.a[name][9];colors=interp_n(colors,8,9);return interp_n(colors,nbClass-colors.length,nbClass)};var interp_n=function interp_n(colors,diff,k){var tmp=[];var new_colors=[];for(var i=0;i2&&arguments[2]!==undefined?arguments[2]:.5;var result=color1.slice();for(var i=0;i<3;i++){result[i]=Math.round(result[i]+factor*(color2[i]-color1[i]))}return result};var Colors={names:{aqua:"#00ffff",azure:"#f0ffff",beige:"#f5f5dc",black:"#000000",blue:"#0000ff",brown:"#a52a2a",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkviolet:"#9400d3",fuchsia:"#ff00ff",gold:"#ffd700",green:"#008000",indigo:"#4b0082",khaki:"#f0e68c",lightblue:"#add8e6",lightcyan:"#e0ffff",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightyellow:"#ffffe0",lime:"#00ff00",magenta:"#ff00ff",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",pink:"#ffc0cb",purple:"#800080",violet:"#800080",red:"#ff0000",silver:"#c0c0c0",white:"#ffffff",yellow:"#ffff00"},random:function random(){var keys=Object.keys(this.names);var n=keys.length;var result=0;var count=0;for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:false;var nb_color=this.colorCodes.length;var seen=this.seen;var result_color=this.colorCodes[0],attempts=40;if(seen.size===nb_color){seen=new Set}while(attempts>0){var ix=Math.round(Math.random()*(nb_color-1));result_color=this.colorCodes[ix];if(!seen.has(result_color)){seen.add(result_color);break}else{attempts-=1}}return to_rgb?hexToRgb(result_color):result_color}};function hue2rgb(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p}var randomColor=function(){var golden_ratio_conjugate=.618033988749895;var _h=Math.random();var hslToRgb=function hslToRgb(h,s,l){var r,g,b;if(s===0){r=g=b=l}else{var q=l<.5?l*(1+s):l+s-l*s;var p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)}return"#".concat(Math.round(r*255).toString(16)).concat(Math.round(g*255).toString(16)).concat(Math.round(b*255).toString(16))};return function(){_h+=golden_ratio_conjugate;_h%=1;return hslToRgb(_h,.5,.6)}}();var addNewCustomPalette=function addNewCustomPalette(palette_name,colors){_app.custom_palettes.set(palette_name,colors)}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(Promise){__webpack_require__.d(__webpack_exports__,"j",(function(){return handle_legend}));__webpack_require__.d(__webpack_exports__,"m",(function(){return up_legends}));__webpack_require__.d(__webpack_exports__,"l",(function(){return up_legend}));__webpack_require__.d(__webpack_exports__,"h",(function(){return down_legend}));__webpack_require__.d(__webpack_exports__,"i",(function(){return drag_legend_func}));__webpack_require__.d(__webpack_exports__,"g",(function(){return createLegend_waffle}));__webpack_require__.d(__webpack_exports__,"c",(function(){return createLegend_discont_links}));__webpack_require__.d(__webpack_exports__,"f",(function(){return createLegend_symbol}));__webpack_require__.d(__webpack_exports__,"e",(function(){return createLegend_line_symbol}));__webpack_require__.d(__webpack_exports__,"d",(function(){return createLegend_layout}));__webpack_require__.d(__webpack_exports__,"a",(function(){return createLegend_choro}));__webpack_require__.d(__webpack_exports__,"b",(function(){return createLegend_choro_horizontal}));__webpack_require__.d(__webpack_exports__,"k",(function(){return move_legends}));var _context_menu__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(16);var _colors_helpers__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(6);var _dialogs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(4);var _helpers__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(0);var _helpers_calc__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2);var _helpers_math__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(1);var _interface__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(3);var _map_ctrl__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(5);var _layout_features_snap_lines__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(13);function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function handle_legend(layer){var state=data_manager.current_layers[layer].renderer;if(state!=undefined){var class_name=[".lgdf",_app.layer_to_id.get(layer)].join("_");var legends=svg_map.querySelectorAll(class_name);if(legends.length>0){if(legends[0].getAttribute("display")==null){Array.prototype.forEach.call(legends,(function(el){return el.setAttribute("display","none")}))}else{Array.prototype.forEach.call(legends,(function(el){return el.removeAttribute("display")}));var tol=10;var _get_map_xy=get_map_xy0(),x0=_get_map_xy.x,y0=_get_map_xy.y;var limit_left=x0-tol;var limit_right=x0+ +w+tol;var limit_top=y0-tol;var limit_bottom=y0+ +h+tol;for(var i=0;ilimit_right||bboxLegend.toplimit_bottom){legends[i].setAttribute("transform","translate(0, 0)")}}}}else{createLegend(layer,"");up_legends()}}}function up_legends(){var legend_features=svg_map.querySelectorAll(".legend");for(var i=0;i-1||renderer.indexOf("Gridded")>-1||renderer.indexOf("Stewart")>-1||renderer.indexOf("TypoSymbols")>-1){el=createLegend_choro(layer,field,title,field,0)}else if(renderer.indexOf("Categorical")>-1){el=createLegend_choro(layer,field,title,field,4)}else if(renderer.indexOf("LinksGraduated")!==-1||renderer.indexOf("DiscLayer")!==-1){el=createLegend_discont_links(layer,field,title,field)}else if(renderer.indexOf("PropSymbolsChoro")!==-1){el=createLegend_choro(layer,field2,title,field2,0);el2=type_layer==="Line"?createLegend_line_symbol(layer,field,title,field):createLegend_symbol(layer,field,title,field)}else if(renderer.indexOf("PropSymbolsTypo")!==-1){el=createLegend_choro(layer,field2,title,field2,4);el2=type_layer==="Line"?createLegend_line_symbol(layer,field,title,field):createLegend_symbol(layer,field,title,field)}else if(renderer.indexOf("PropSymbols")!==-1){el=type_layer==="Line"?createLegend_line_symbol(layer,field,title,field):createLegend_symbol(layer,field,title,field)}else if(renderer.indexOf("LinksProp")!==-1){el=createLegend_line_symbol(layer,field,title,field)}else if(renderer.indexOf("TwoStocksWaffle")!==-1){el=createLegend_waffle(layer,field,title,"")}else if(!renderer){el=createLegend_layout(layer,data_manager.current_layers[layer].type,title,"",undefined,layer)}else{swal("Oops..","".concat(_tr("No legend available for this representation"),". ").concat(_tr('Want to make a suggestion ?')),"warning");return}if(el&&lgd_pos&&lgd_pos.x){el.attr("transform","translate(".concat(lgd_pos.x,",").concat(lgd_pos.y,")"))}_layout_features_snap_lines__WEBPACK_IMPORTED_MODULE_8__["c"].set("".concat(el.attr("id")," ").concat(el.attr("class")),get_bounding_rect(el.node()));if(el2){var prev_bbox=get_bounding_rect(el.node()),dim_h=lgd_pos.y+prev_bbox.height,dim_w=lgd_pos.x+prev_bbox.width;var lgd_pos2=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["d"])();if(lgd_pos2.x!==lgd_pos.x||lgd_pos2.y!==lgd_pos.y){el2.attr("transform","translate(".concat(lgd_pos2.x,",").concat(lgd_pos2.y,")"))}else if(dim_h+w+10){val_x=prev_value[0];change=true}if(bbox_elem.height+h+10){val_y=prev_value[1];change=true}if(change){legend_group.attr("transform","translate(".concat([val_x,val_y],")"))}}))};function createLegend_waffle(layer,fields,title,subtitle,rect_fill_value,ratio_txt,note_bottom){var space_elem=18;var boxheight=18;var boxwidth=18;var boxgap=12;var xpos=30;var ypos=30;var y_pos2=ypos+space_elem;var tmp_class_name="legend legend_feature lgdf_".concat(_app.layer_to_id.get(layer));var nbVar=fields.length;var ref_colors=data_manager.current_layers[layer].fill_color;var symbol=data_manager.current_layers[layer].symbol;var size_symbol=data_manager.current_layers[layer].size;var last_pos;var legend_root=map.insert("g").attrs({id:"legend_root_waffle",class:tmp_class_name,transform:"translate(0,0)",layer_name:layer}).styles({cursor:"grab","font-size":"11px","font-family":"verdana"});var rect_under_legend=legend_root.insert("rect");legend_root.insert("text").attrs(subtitle!=""?{id:"legendtitle",x:xpos+space_elem,y:ypos}:{id:"legendtitle",x:xpos+space_elem,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-weight":"bold"}).text(title||"");legend_root.insert("text").attrs({id:"legendsubtitle",x:xpos+space_elem,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-style":"italic"}).text(subtitle);var fields_colors=[];for(var i=0;i=+_b_val[0][0]&¤t_min_value<+_b_val[0][1]){ref_symbols_params.push({value:[current_min_value,_b_val[0][1]],size:_b_val[1]})}else if(current_min_value<+_b_val[0][0]&¤t_min_value<+_b_val[0][1]){ref_symbols_params.push({value:_b_val[0],size:_b_val[1]})}}}ref_symbols_params.reverse();var legend_elems=legend_root.selectAll(".legend").append("g").data(ref_symbols_params).enter().insert("g").attr("class",(function(d,i){return"lg legend_".concat(i)}));var max_size=data_manager.current_layers[layer].size[1],color=data_manager.current_layers[layer].fill_color.single,xrect=xpos+space_elem+max_size/2;var last_size=0,last_pos=y_pos2;legend_elems.append("rect").styles({fill:color,stroke:"rgb(0, 0, 0)","fill-opacity":1,"stroke-width":0}).attrs((function(d){last_pos=boxgap+last_pos+last_size;last_size=d.size*svg_map.__zoom.k;return{x:xrect,y:last_pos,width:45,height:last_size}}));last_pos=y_pos2;last_size=0;var x_text_pos=xpos+space_elem+max_size*1.5+45;var tmp_pos;legend_elems.append("text").attrs((function(d){last_pos=boxgap+last_pos+last_size;last_size=d.size*svg_map.__zoom.k;tmp_pos=last_pos-last_size/4;return{x:x_text_pos,y:tmp_pos}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value[1],rounding_precision).toLocaleString()}));legend_root.insert("text").attrs({id:"lgd_choro_min_val",x:x_text_pos,y:tmp_pos+boxgap}).styles({"alignment-baseline":"middle","font-size":"10px"}).text(Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(ref_symbols_params[ref_symbols_params.length-1].value[0],rounding_precision).toLocaleString());legend_root.call(drag_legend_func(legend_root));legend_root.append("g").insert("text").attrs({id:"legend_bottom_note",x:xpos+space_elem,y:last_pos+2*space_elem}).styles({"font-size":"11px","font-family":"verdana"}).text(note_bottom!=null?note_bottom:"");make_underlying_rect(legend_root,rect_under_legend,rect_fill_value);make_legend_context_menu(legend_root,layer);return legend_root}function make_underlying_rect(legend_root,under_rect,fill){under_rect.attrs({width:0,height:0});var bboxLegend=get_bounding_rect(legend_root.node());var translate=legend_root.attr("transform");translate=translate?translate.split("translate(")[1].split(")")[0].split(/[ ,]+/).map((function(d){return+d})):[0,0];if(translate.length===1)translate=[translate[0],0];var x_top_left=bboxLegend.x-12.5-translate[0];var y_top_left=bboxLegend.y-12.5-translate[1];var x_top_right=bboxLegend.x+bboxLegend.width+12.5-translate[0];var y_bottom_left=bboxLegend.y+bboxLegend.height+12.5-translate[1];var rect_height=y_bottom_left-y_top_left;var rect_width=x_top_right-x_top_left;under_rect.attrs({id:"under_rect",x:x_top_left,y:y_top_left,height:rect_height,width:rect_width});if(!fill||!fill.color||!fill.opacity){under_rect.styles({fill:"green","fill-opacity":0});legend_root.attr("visible_rect","false").on("mouseover",(function(){under_rect.style("fill-opacity",.1)})).on("mouseout",(function(){under_rect.style("fill-opacity",0)}))}else{under_rect.styles({fill:fill.color,"fill-opacity":fill.opacity});legend_root.attr("visible_rect","true").on("mouseover",null).on("mouseout",null)}}function createLegend_symbol(layer,field,title,subtitle){var nested=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"false";var join_line=arguments.length>5&&arguments[5]!==undefined?arguments[5]:"false";var rect_fill_value=arguments.length>6?arguments[6]:undefined;var rounding_precision=arguments.length>7?arguments[7]:undefined;var note_bottom=arguments.length>8?arguments[8]:undefined;var options=arguments.length>9&&arguments[9]!==undefined?arguments[9]:{};var parent=options.parent||window.map;var layer_prop=data_manager.current_layers[layer];var space_elem=18;var boxgap=4;var xpos=30;var ypos=30;var y_pos2=ypos+space_elem*1.5;var tmp_class_name="legend legend_feature lgdf_".concat(_app.layer_to_id.get(layer));var symbol_type=layer_prop.symbol;var color_symb_lgd=layer_prop.renderer==="PropSymbolsChoro"||layer_prop.renderer==="PropSymbolsTypo"||layer_prop.fill_color.two!==undefined||layer_prop.fill_color.random!==undefined?"#FFF":layer_prop.fill_color.single;var stroke_color=layer_prop.renderer==="PropSymbolsChoro"||layer_prop.renderer==="PropSymbolsTypo"||layer_prop.fill_color.two!==undefined||layer_prop.fill_color.random!==undefined?"rgb(0, 0, 0)":map.select("#".concat(_app.layer_to_id.get(layer))).select(symbol_type).style("stroke");var ref_symbols=document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName(symbol_type);var type_param=symbol_type==="circle"?"r":"width";var z_scale=+d3.zoomTransform(map.node()).k;var _layer_prop$size=_slicedToArray(layer_prop.size,2),ref_value=_layer_prop$size[0],ref_size=_layer_prop$size[1];var propSize=new _helpers_calc__WEBPACK_IMPORTED_MODULE_4__["a"](ref_value,ref_size,symbol_type);if(!layer_prop.size_legend_symbol){var non_empty=Array.prototype.filter.call(ref_symbols,(function(d){if(d[type_param].baseVal.value!==0)return d[type_param].baseVal.value}));var size_max=+non_empty[0].getAttribute(type_param),size_min=+non_empty[non_empty.length-1].getAttribute(type_param),val_max=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["a"])(+non_empty[0].__data__.properties[field]),val_min=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["a"])(+non_empty[non_empty.length-1].__data__.properties[field]);var r=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["c"])(Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["e"])(val_max),Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["e"])(val_min)),diff_size=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["g"])(size_max)-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["g"])(size_min),size_interm1=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["g"])(size_min)+diff_size/3,size_interm2=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["e"])(size_interm1+diff_size/3,2);size_interm1=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["e"])(size_interm1,2);layer_prop.size_legend_symbol=[{value:val_max},{value:Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(propSize.get_value(size_interm2),r)},{value:Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(propSize.get_value(size_interm1),r)},{value:val_min}];if(layer_prop.size_legend_symbol[0].value-layer_prop.size_legend_symbol[1].value>1){rounding_precision=0}else{rounding_precision=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["c"])(Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["e"])(val_max),Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["e"])(val_min))}}var t=layer_prop.size_legend_symbol;var ref_symbols_params=[{size:propSize.scale(t[0].value)*z_scale,value:t[0].value},{size:propSize.scale(t[1].value)*z_scale,value:t[1].value},{size:propSize.scale(t[2].value)*z_scale,value:t[2].value},{size:propSize.scale(t[3].value)*z_scale,value:t[3].value}];if(ref_symbols_params[3].value===0){ref_symbols_params.pop()}if(ref_symbols_params[2].value===0){ref_symbols_params.pop()}var legend_root=parent.insert("g").styles({cursor:"grab","font-size":"11px","font-family":"verdana"}).attrs({id:"legend_root_symbol",class:tmp_class_name,transform:"translate(0,0)",layer_name:layer,nested,join_line,rounding_precision,layer_field:field});var rect_under_legend=legend_root.insert("rect");legend_root.insert("text").attrs(subtitle!=""?{id:"legendtitle",x:xpos+space_elem,y:ypos}:{id:"legendtitle",x:xpos+space_elem,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-weight":"bold"}).text(title);legend_root.insert("text").attrs({id:"legendsubtitle",x:xpos+space_elem,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-style":"italic"}).text(subtitle);var legend_elems=legend_root.selectAll(".legend").append("g").data(ref_symbols_params).enter().insert("g").attr("class",(function(d,i){return"lg legend_".concat(i)}));var max_size=ref_symbols_params[0].size*2;var last_size=0;if(symbol_type==="rect"){y_pos2-=max_size/4}var last_pos=y_pos2;if(nested==="false"){if(symbol_type==="circle"){legend_elems.append("circle").styles({fill:color_symb_lgd,stroke:stroke_color,"fill-opacity":1}).attrs((function(d,i){last_pos=i*boxgap+d.size+last_pos+last_size;last_size=d.size;return{cx:xpos+space_elem+boxgap+max_size/4,cy:last_pos,r:d.size}}));last_pos=y_pos2;last_size=0;legend_elems.append("text").attrs((function(d,i){last_pos=i*boxgap+d.size+last_pos+last_size;last_size=d.size;return{x:xpos+space_elem+boxgap+max_size*.75+7,y:last_pos+i*2/3}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value,rounding_precision).toLocaleString()}))}else if(symbol_type==="rect"){legend_elems.append("rect").styles({fill:color_symb_lgd,stroke:stroke_color,"fill-opacity":1}).attrs((function(d,i){last_pos=i*boxgap+d.size/2+last_pos+last_size;last_size=d.size;return{x:xpos+space_elem+boxgap+max_size/4-last_size/2,y:last_pos,width:last_size,height:last_size}}));last_pos=y_pos2;last_size=0;var x_text_pos=xpos+space_elem+boxgap+max_size/2+7;legend_elems.append("text").attrs((function(d,i){last_pos=i*boxgap+d.size/2+last_pos+last_size;last_size=d.size;return{x:x_text_pos,y:last_pos+d.size*.51}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value,rounding_precision).toLocaleString()}))}}else if(nested==="true"){var dist_to_title=30;if(symbol_type==="circle"){if(join_line==="true"){legend_elems.append("line").attrs((function(d){return{x1:xpos+space_elem+boxgap+max_size/4-d.size,x2:xpos+space_elem+boxgap+max_size*.75+6.5,y1:ypos+dist_to_title+max_size-d.size+.5,y2:ypos+dist_to_title+max_size-d.size+.5,stroke:"#3f3f3f","stroke-width":.8}}));legend_elems.append("circle").attrs((function(d){return{cx:xpos+space_elem+boxgap+max_size/4,cy:ypos+dist_to_title+max_size-d.size,r:d.size}})).styles({fill:color_symb_lgd,stroke:stroke_color,"fill-opacity":1});last_pos=y_pos2;last_size=0;legend_elems.append("text").attrs((function(d){return{x:xpos+space_elem+boxgap+max_size*.75+7,y:ypos+dist_to_title+3+max_size-d.size}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value,rounding_precision).toLocaleString()}))}else{legend_elems.append("circle").attrs((function(d){return{cx:xpos+space_elem+boxgap+max_size/4,cy:ypos+dist_to_title+max_size-d.size,r:d.size}})).styles({fill:color_symb_lgd,stroke:stroke_color,"fill-opacity":1});last_pos=y_pos2;last_size=0;legend_elems.append("text").attrs((function(d){return{x:xpos+space_elem+boxgap+max_size*.75+7,y:ypos+dist_to_title+1+max_size-d.size*2}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value,rounding_precision).toLocaleString()}))}last_pos=ypos+20+max_size}else if(symbol_type==="rect"){legend_elems.append("rect").attrs((function(d){return{x:xpos+space_elem+boxgap,y:ypos+dist_to_title+max_size/2-d.size,width:d.size,height:d.size}})).styles({fill:color_symb_lgd,stroke:stroke_color,"fill-opacity":1});last_pos=y_pos2;last_size=0;legend_elems.append("text").attrs((function(d){return{x:xpos+space_elem+boxgap+max_size/2+7,y:ypos+dist_to_title+1+max_size/2-d.size}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value,rounding_precision).toLocaleString()}));last_pos=ypos+20+max_size/2}}if(layer_prop.break_val!==undefined){var bottom_colors=legend_root.append("g");bottom_colors.insert("text").attrs({id:"col1_txt",x:xpos+space_elem,y:last_pos+1.75*space_elem}).styles({"alignment-baseline":"middle","font-size":"10px"}).html("< ".concat(layer_prop.break_val.toLocaleString()));bottom_colors.insert("rect").attrs({id:"col1",x:xpos+space_elem,y:last_pos+2*space_elem,width:space_elem,height:space_elem}).style("fill",layer_prop.fill_color.two[0]);bottom_colors.insert("text").attrs({id:"col1_txt",x:xpos+3*space_elem,y:last_pos+1.75*space_elem}).styles({"alignment-baseline":"middle","font-size":"10px"}).html("> ".concat(layer_prop.break_val.toLocaleString()));bottom_colors.insert("rect").attrs({id:"col2",x:xpos+3*space_elem,y:last_pos+2*space_elem,width:space_elem,height:space_elem}).style("fill",layer_prop.fill_color.two[1]);last_pos+=2.5*space_elem}legend_root.append("g").insert("text").attrs({id:"legend_bottom_note",x:xpos+space_elem,y:last_pos+2*space_elem}).styles({"font-size":"11px","font-family":"verdana"}).text(note_bottom!=null?note_bottom:"");legend_root.call(drag_legend_func(legend_root));make_underlying_rect(legend_root,rect_under_legend,rect_fill_value);if(parent==map)make_legend_context_menu(legend_root,layer);return legend_root}function createLegend_line_symbol(layer,field,title,subtitle,rect_fill_value,rounding_precision,note_bottom){var space_elem=18,boxgap=12,xpos=30,ypos=30,y_pos2=ypos+space_elem,tmp_class_name="legend legend_feature lgdf_".concat(_app.layer_to_id.get(layer));var ref_symbols=document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName("path");var type_param="strokeWidth";var non_empty=Array.prototype.filter.call(ref_symbols,(function(d){return d.style[type_param]!=="0"})),size_max=+non_empty[0].style[type_param],size_min=+non_empty[non_empty.length-1].style[type_param],val_max=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["a"])(+non_empty[0].__data__.properties[field]),val_min=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["a"])(+non_empty[non_empty.length-1].__data__.properties[field]),diff_size=size_max-size_min,diff_val=val_max-val_min,val_interm1=val_min+diff_val/3,val_interm2=val_interm1+diff_val/3,size_interm1=size_min+diff_size/3,size_interm2=size_interm1+diff_size/3,ref_symbols_params=[{size:size_max,value:val_max},{size:size_interm2,value:val_interm2},{size:size_interm1,value:val_interm1},{size:size_min,value:val_min}];if(rounding_precision===undefined){rounding_precision=get_lgd_display_precision(ref_symbols_params.map((function(d){return d.value})))}var legend_root=map.insert("g").attrs({id:"legend_root_lines_symbol",class:tmp_class_name,transform:"translate(0,0)",rounding_precision,layer_field:field,layer_name:layer}).styles({cursor:"grab","font-size":"11px","font-family":"verdana"});var rect_under_legend=legend_root.insert("rect");legend_root.insert("text").attrs(subtitle!=""?{id:"legendtitle",x:xpos+space_elem,y:ypos}:{id:"legendtitle",x:xpos+space_elem,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-weight":"bold"}).text(title||"Title");legend_root.insert("text").attrs({id:"legendsubtitle",x:xpos+space_elem,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-style":"italic"}).text(subtitle);var legend_elems=legend_root.selectAll(".legend").append("g").data(ref_symbols_params).enter().insert("g").attr("class",(function(d,i){return"lg legend_".concat(i)}));var last_size=0;var last_pos=y_pos2;var color=data_manager.current_layers[layer].fill_color.single;var xrect=xpos+space_elem;legend_elems.append("rect").styles({fill:color,stroke:"rgb(0, 0, 0)","fill-opacity":1,"stroke-width":0}).attrs((function(d){last_pos=boxgap+last_pos+last_size;last_size=d.size;return{x:xrect,y:last_pos,width:45,height:d.size}}));last_pos=y_pos2;last_size=0;var x_text_pos=xrect+75;legend_elems.append("text").attrs((function(d){last_pos=boxgap+last_pos+d.size;return{x:x_text_pos,y:last_pos+4-d.size/2}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(d.value,rounding_precision).toLocaleString()}));legend_root.append("g").insert("text").attrs({id:"legend_bottom_note",x:xpos+space_elem,y:last_pos+space_elem}).styles({"font-size":"11px","font-family":"verdana"}).text(note_bottom!=null?note_bottom:"");legend_root.call(drag_legend_func(legend_root));make_underlying_rect(legend_root,rect_under_legend,rect_fill_value);legend_root.select("#legendtitle").text(title||"");make_legend_context_menu(legend_root,layer);return legend_root}var get_lgd_display_precision=function get_lgd_display_precision(breaks){if(breaks.filter((function(b){return(b|0)===b})).length===breaks.length){return 0}var diff;for(var i=0;i1||diff>.1){return 1}else if(diff>.01){return 2}else if(diff>.001){return 3}else if(diff>1e-4){return 4}else if(diff>1e-5){return 5}else if(diff>1e-6){return 6}else if(diff>1e-7){return 7}return undefined};function createLegend_layout(layer,type_geom,title,subtitle,rect_fill_value,text_value,note_bottom){var space_elem=18;var boxheight=18;var boxwidth=18;var xpos=30;var ypos=30;var tmp_class_name="legend legend_feature lgdf_".concat(_app.layer_to_id.get(layer));var color_layer=data_manager.current_layers[layer].fill_color.single;var legend_root=map.insert("g").styles({cursor:"grab","font-size":"11px","font-family":"verdana"}).attrs({id:"legend_root_layout",class:tmp_class_name,transform:"translate(0,0)",layer_name:layer});var rect_under_legend=legend_root.insert("rect");legend_root.insert("text").attrs(subtitle!=""?{id:"legendtitle",x:xpos+boxheight,y:ypos}:{id:"legendtitle",x:xpos+boxheight,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-weight":"bold"}).text(title||"");legend_root.insert("text").attrs({id:"legendsubtitle",x:xpos+boxheight,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-style":"italic"}).text(subtitle);var legend_elems=legend_root.append("g").insert("g").attr("class","lg legend_0");if(type_geom==="Polygon"){var stroke_color=map.select("#".concat(_app.layer_to_id.get(layer))).select("path").style("stroke");var stroke_width=map.select("#".concat(_app.layer_to_id.get(layer))).select("path").style("stroke-width");legend_elems.append("rect").attrs({x:xpos+boxwidth,y:ypos+boxheight*1.8,width:boxwidth,height:boxheight}).styles({fill:color_layer,stroke:stroke_color,"stroke-width":stroke_width});legend_elems.append("text").attrs({x:xpos+boxwidth*2+10,y:ypos+boxheight*2.6}).styles({"alignment-baseline":"middle","font-size":"10px"}).text(text_value);ypos+=30+boxheight}else if(type_geom==="Line"){var _stroke_width=+data_manager.current_layers[layer]["stroke-width-const"];legend_elems.append("rect").styles({fill:color_layer,stroke:"rgb(0, 0, 0)","fill-opacity":1,"stroke-width":0}).attrs({x:xpos+boxwidth,y:ypos+boxheight*1.9+boxheight/2-_stroke_width/2,width:boxwidth,height:_stroke_width});legend_elems.append("text").attrs({x:xpos+boxwidth*2+10,y:ypos+boxheight*2.6}).styles({"alignment-baseline":"middle","font-size":"10px"}).text(text_value);ypos=ypos+boxheight*1.9+boxheight/2+_stroke_width/2}else if(type_geom==="Point"){var radius=data_manager.current_layers[layer].pointRadius*svg_map.__zoom.k;var _stroke_color=map.select("#".concat(_app.layer_to_id.get(layer))).select("path").style("stroke");var _stroke_width2=map.select("#".concat(_app.layer_to_id.get(layer))).style("stroke-width");console.log(_stroke_color,_stroke_width2);var dist_to_title=30;legend_elems.append("circle").styles({fill:color_layer,stroke:_stroke_color,"fill-opacity":1,"stroke-width":_stroke_width2}).attrs((function(d){return{cx:xpos+space_elem+4+radius/2,cy:ypos+dist_to_title+radius,r:radius}}));legend_elems.append("text").attrs((function(d){return{x:xpos+space_elem+4+radius*2*.75+7,y:ypos+dist_to_title+1+radius}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text(text_value);ypos=ypos+dist_to_title+1+radius*2}legend_root.append("g").insert("text").attrs({id:"legend_bottom_note",x:xpos+boxheight,y:ypos+boxheight}).styles({"font-size":"11px","font-family":"verdana"}).text(note_bottom!=null?note_bottom:"");legend_root.call(drag_legend_func(legend_root));make_underlying_rect(legend_root,rect_under_legend,rect_fill_value);make_legend_context_menu(legend_root,layer);return legend_root}function createLegend_choro(layer,field,title,subtitle){var box_gap=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var rect_fill_value=arguments.length>5?arguments[5]:undefined;var rounding_precision=arguments.length>6?arguments[6]:undefined;var no_data_txt=arguments.length>7?arguments[7]:undefined;var note_bottom=arguments.length>8?arguments[8]:undefined;var layer_prop=data_manager.current_layers[layer];var boxheight=18,boxwidth=18,xpos=30,ypos=30,y_pos2=ypos+boxheight*1.8,tmp_class_name="legend legend_feature lgdf_".concat(_app.layer_to_id.get(layer));var boxgap=+box_gap;var last_pos=null,data_colors_label;if(layer_prop.renderer.indexOf("Categorical")>-1||layer_prop.renderer.indexOf("PropSymbolsTypo")>-1){data_colors_label=[];layer_prop.color_map.forEach((function(v){data_colors_label.push({value:v[1],color:v[0]})}))}else if(layer_prop.renderer.indexOf("TypoSymbols")>-1){data_colors_label=[];layer_prop.symbols_map.forEach((function(v){data_colors_label.push({value:v[2],image:v[0]})}))}else{data_colors_label=layer_prop.colors_breaks.map((function(obj){return{value:obj[0],color:obj[1]}}));if(rounding_precision===undefined){var breaks=layer_prop.options_disc.breaks;rounding_precision=get_lgd_display_precision(breaks)}}var legend_root=map.insert("g").styles({cursor:"grab","font-size":"11px","font-family":"verdana"}).attrs({id:"legend_root",class:tmp_class_name,layer_field:field,transform:"translate(0,0)",boxgap,rounding_precision,layer_name:layer});var rect_under_legend=legend_root.insert("rect");legend_root.insert("text").attrs(subtitle!=""?{id:"legendtitle",x:xpos+boxheight,y:ypos}:{id:"legendtitle",x:xpos+boxheight,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-weight":"bold"}).text(title||"");legend_root.insert("text").attrs({id:"legendsubtitle",x:xpos+boxheight,y:ypos+15}).styles({"font-size":"12px","font-family":"verdana","font-style":"italic"}).text(subtitle);var legend_elems=legend_root.selectAll(".legend").append("g").data(data_colors_label).enter().insert("g").attr("class",(function(d,i){return"lg legend_".concat(i)}));if(layer_prop.renderer.indexOf("TypoSymbols")===-1){legend_elems.append("rect").attrs((function(d,i){last_pos=y_pos2+i*boxgap+i*boxheight;return{x:xpos+boxwidth,y:last_pos,width:boxwidth,height:boxheight}})).styles((function(d){return{fill:d.color,stroke:d.color}}))}else{legend_elems.append("image").attrs((function(d,i){return{x:xpos+boxwidth,y:y_pos2+i*boxgap+i*boxheight,width:boxwidth,height:boxheight,"xlink:href":d.image}}))}if(layer_prop.renderer.indexOf("Choropleth")>-1||layer_prop.renderer.indexOf("PropSymbolsChoro")>-1||layer_prop.renderer.indexOf("Gridded")>-1||layer_prop.renderer.indexOf("Stewart")>-1){var tmp_pos;legend_elems.append("text").attrs((function(d,i){tmp_pos=y_pos2+i*boxheight+i*boxgap;return{x:xpos+boxwidth*2+10,y:tmp_pos}})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(+d.value.split(" - ")[1],rounding_precision).toLocaleString()}));legend_root.insert("text").attrs({id:"lgd_choro_min_val",x:xpos+boxwidth*2+10,y:tmp_pos+boxheight+boxgap}).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(data_colors_label[data_colors_label.length-1].value.split(" - ")[0],rounding_precision).toLocaleString()}))}else{legend_elems.append("text").attr("x",xpos+boxwidth*2+10).attr("y",(function(d,i){return y_pos2+i*boxheight+i*boxgap+boxheight*2/3})).styles({"alignment-baseline":"middle","font-size":"10px"}).text((function(d){return d.value}))}if(layer_prop.options_disc&&layer_prop.options_disc.no_data){var gp_no_data=legend_root.append("g");gp_no_data.append("rect").attrs({x:xpos+boxheight,y:last_pos+2*boxheight,width:boxwidth,height:boxheight}).styles({fill:layer_prop.options_disc.no_data,stroke:layer_prop.options_disc.no_data});gp_no_data.append("text").attrs({x:xpos+boxwidth*2+10,y:last_pos+2.7*boxheight,id:"no_data_txt"}).styles({"alignment-baseline":"middle","font-size":"10px"}).text(no_data_txt!=null?no_data_txt:"No data");last_pos+=2*boxheight}legend_root.append("g").insert("text").attrs({id:"legend_bottom_note",x:xpos+boxheight,y:last_pos+2*boxheight}).styles({"font-size":"11px","font-family":"verdana"}).text(note_bottom!=null?note_bottom:"");legend_root.call(drag_legend_func(legend_root));make_underlying_rect(legend_root,rect_under_legend,rect_fill_value);make_legend_context_menu(legend_root,layer);return legend_root}function createLegend_choro_horizontal(layer,field,title,subtitle){var box_gap=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var rect_fill_value=arguments.length>5?arguments[5]:undefined;var rounding_precision=arguments.length>6?arguments[6]:undefined;var no_data_txt=arguments.length>7?arguments[7]:undefined;var note_bottom=arguments.length>8?arguments[8]:undefined;var layer_prop=data_manager.current_layers[layer];var boxheight=16,boxwidth=42,xpos=30,ypos=30,y_pos2=ypos+boxheight*1.8,tmp_class_name="legend legend_feature lgdf_".concat(_app.layer_to_id.get(layer));var boxgap=+box_gap;var data_colors_label=layer_prop.colors_breaks.map((function(obj){return{value:obj[0],color:obj[1]}})).reverse();if(rounding_precision===undefined){rounding_precision=get_lgd_display_precision(layer_prop.options_disc.breaks)}var legend_root=map.insert("g").styles({cursor:"grab","font-size":"11px","font-family":"verdana"}).attrs({id:"legend_root_horiz",class:tmp_class_name,layer_field:field,transform:"translate(0,0)",boxgap,rounding_precision,layer_name:layer});var rect_under_legend=legend_root.insert("rect");var lgd_title=legend_root.insert("text").styles({"font-size":"12px","font-family":"verdana","font-weight":"bold"}).attrs({id:"legendtitle",x:xpos+boxwidth,y:subtitle!==""?ypos:ypos+15,"text-anchor":"middle"});var lgd_subtitle=legend_root.insert("text").styles({"font-size":"12px","font-family":"verdana","font-style":"italic"}).attrs({id:"legendsubtitle",x:xpos+boxwidth,y:ypos+15,"text-anchor":"middle"});var legend_elems=legend_root.selectAll(".legend").append("g").data(data_colors_label).enter().insert("g").attr("class",(function(d,i){return"lg legend_".concat(i)}));legend_elems.append("rect").attr("x",(function(d,i){return xpos+(boxgap+boxwidth)*i})).attr("y",y_pos2).attrs({width:boxwidth,height:boxheight}).styles((function(d){return{fill:d.color,stroke:d.color}}));legend_elems.append("text").attr("x",(function(d,i){return xpos+(boxgap+boxwidth)*i})).attr("y",y_pos2+boxheight+20).attr("text-anchor","middle").styles({"font-size":"10px"}).text((function(d){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(+d.value.split(" - ")[0],rounding_precision).toLocaleString()}));legend_root.insert("text").attrs({id:"lgd_choro_min_val",x:xpos+(boxgap+boxwidth)*data_colors_label.length,y:y_pos2+boxheight+20,"text-anchor":"middle"}).styles({"font-size":"10px"}).text((function(){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["n"])(data_colors_label[data_colors_label.length-1].value.split(" - ")[1],rounding_precision).toLocaleString()}));if(layer_prop.options_disc&&layer_prop.options_disc.no_data){var gp_no_data=legend_root.append("g");gp_no_data.append("rect").attrs({x:xpos+boxwidth+(boxgap+boxwidth)*data_colors_label.length,y:y_pos2,width:boxwidth,height:boxheight}).styles({fill:layer_prop.options_disc.no_data,stroke:layer_prop.options_disc.no_data});gp_no_data.append("text").attrs({x:xpos+boxwidth/2+(boxgap+boxwidth)*(data_colors_label.length+1),y:y_pos2+boxheight+20,id:"no_data_txt","text-anchor":"middle"}).styles({"font-size":"10px"}).text(no_data_txt!=null?no_data_txt:"No data")}var bottom_note=legend_root.append("g").insert("text").attrs({id:"legend_bottom_note",x:xpos+boxwidth,y:y_pos2+boxheight+40,"text-anchor":"middle"}).styles({"font-size":"11px","font-family":"verdana"});var bb=get_bounding_rect(legend_root.node());var x_middle=bb.x+bb.width/2;lgd_title.attr("x",x_middle).text(title||"");lgd_subtitle.attr("x",x_middle).text(subtitle);bottom_note.attr("x",x_middle).text(note_bottom!=null?note_bottom:"");legend_root.call(drag_legend_func(legend_root));make_underlying_rect(legend_root,rect_under_legend,rect_fill_value);make_legend_context_menu(legend_root,layer);return legend_root}function display_box_value_symbol(layer_name){var symbol_type=data_manager.current_layers[layer_name].symbol,field=data_manager.current_layers[layer_name].rendered_field,ref_symbols=document.getElementById(_app.layer_to_id.get(layer_name)).getElementsByTagName(symbol_type),type_param=symbol_type==="circle"?"r":"width";var non_empty=Array.prototype.filter.call(ref_symbols,(function(d){if(d[type_param].baseVal.value!=0)return d[type_param].baseVal.value}));var val_max=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["a"])(+non_empty[0].__data__.properties[field]);var redraw_sample_legend=function(){var legend_node=svg_map.querySelector(["#legend_root_symbol.lgdf_",_app.layer_to_id.get(layer_name)].join(""));var rendered_field=data_manager.current_layers[layer_name].rendered_field;var nested=legend_node.getAttribute("nested");var join_line=legend_node.getAttribute("join_line");var rounding_precision=legend_node.getAttribute("rounding_precision");var lgd_title=legend_node.querySelector("#legendtitle").innerHTML,lgd_subtitle=legend_node.querySelector("#legendsubtitle").innerHTML,note=legend_node.querySelector("#legend_bottom_note").innerHTML;return function(values){if(values){data_manager.current_layers[layer_name].size_legend_symbol=values.sort((function(a,b){return b.value-a.value}));val1.property("value",values[0].value);val2.property("value",values[1].value);val3.property("value",values[2].value);val4.property("value",values[3].value)}sample_svg.selectAll("g").remove();createLegend_symbol(layer_name,rendered_field,lgd_title,lgd_subtitle,nested,join_line,{},rounding_precision,note,{parent:sample_svg});sample_svg.select("g").select("#under_rect").remove();sample_svg.select("#legend_root_symbol").on(".drag",null)}}();var prom=Object(_dialogs__WEBPACK_IMPORTED_MODULE_2__["b"])("legend_symbol_values_box","".concat(layer_name," - ").concat(_tr("app_page.legend_symbol_values_box.title"))).then((function(confirmed){data_manager.current_layers[layer_name].size_legend_symbol=confirmed?data_manager.current_layers[layer_name].size_legend_symbol:original_values;return Promise.resolve(confirmed)}));var box_body=d3.select(".legend_symbol_values_box").select(".modal-content").style("width","400px").select(".modal-body");box_body.append("p").style("text-align","center").insert("h3");var sample_svg=box_body.append("div").attr("id","sample_svg").style("float","left").append("svg").attrs({width:200,height:300,id:"svg_sample_legend"});var values_to_use=[].concat(data_manager.current_layers[layer_name].size_legend_symbol.map((function(f){return Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["c"])(f)})));var _data_manager$current=_slicedToArray(data_manager.current_layers[layer_name].size,2),ref_value=_data_manager$current[0],ref_size=_data_manager$current[1];var propSize=new _helpers_calc__WEBPACK_IMPORTED_MODULE_4__["a"](ref_value,ref_size,symbol_type);var input_zone=box_body.append("div").styles({float:"right",top:"100px",right:"20px",position:"relative"});var a=input_zone.append("p");var b=input_zone.append("p");var c=input_zone.append("p");var d=input_zone.append("p");var original_values=[].concat(values_to_use);var val1=a.insert("input").style("width","80px").attrs({class:"without_spinner",type:"number",max:val_max}).property("value",values_to_use[0].value).on("change",(function(){var val=+this.value;if(isNaN(val))return;values_to_use[0]={size:propSize.scale(val),value:val};val2.attr("max",val);redraw_sample_legend(values_to_use)}));var val2=b.insert("input").style("width","80px").attrs({class:"without_spinner",type:"number",max:values_to_use[0].value,min:values_to_use[2]}).property("value",values_to_use[1].value).on("change",(function(){var val=+this.value;if(isNaN(val))return;values_to_use[1]={size:propSize.scale(val),value:val};val1.attr("min",val);val3.attr("max",val);redraw_sample_legend(values_to_use)}));var val3=c.insert("input").style("width","80px").attrs({class:"without_spinner",type:"number",max:values_to_use[1].value,min:values_to_use[3].value}).property("value",values_to_use[2].value).on("change",(function(){var val=+this.value;if(isNaN(val))return;values_to_use[2]={size:propSize.scale(val),value:val};val2.attr("min",val);val4.attr("max",val);redraw_sample_legend(values_to_use)}));var val4=d.insert("input").style("width","80px").attrs({class:"without_spinner",type:"number",min:0,max:values_to_use[2].value}).property("value",values_to_use[3].value).on("change",(function(){var val=+this.value;if(isNaN(val))return;values_to_use[3]={size:propSize.scale(val),value:val};val3.attr("min",val);redraw_sample_legend(values_to_use)}));box_body.append("div").styles({clear:"both","text-align":"center"}).append("p").styles({"text-align":"center"}).insert("span").attrs({class:"button_st3"}).html(_tr("app_page.legend_symbol_values_box.reset")).on("click",(function(){data_manager.current_layers[layer_name].size_legend_symbol=undefined;redraw_sample_legend(original_values)}));redraw_sample_legend();return prom}function createlegendEditBox(legend_id,layer_name){function bind_selections(){box_class=[layer_id,"_legend_popup"].join("");legend_node=svg_map.querySelector(["#",legend_id,".lgdf_",layer_id].join(""));title_content=legend_node.querySelector("#legendtitle");subtitle_content=legend_node.querySelector("#legendsubtitle");note_content=legend_node.querySelector("#legend_bottom_note");no_data_txt=legend_node.querySelector("#no_data_txt");ratio_waffle_txt=legend_node.querySelector("#ratio_txt");legend_node_d3=d3.select(legend_node);legend_boxes=legend_node_d3.selectAll(["#",legend_id," .lg"].join("")).select("text")}var layer_id=_app.layer_to_id.get(layer_name);var box_class,legend_node,title_content,subtitle_content,note_content;var legend_node_d3,legend_boxes,no_data_txt,ratio_waffle_txt,rect_fill_value={},original_rect_fill_value;bind_selections();if(document.querySelector(".".concat(box_class)))document.querySelector(".".concat(box_class)).remove();var original_params={title_content:title_content.textContent,y_title:title_content.y.baseVal.getItem(0).value,subtitle_content:subtitle_content.textContent,y_subtitle:subtitle_content.y.baseVal.getItem(0).value,note_content:note_content.textContent,no_data_txt:no_data_txt!=null?no_data_txt.textContent:null,ratio_waffle_txt:ratio_waffle_txt!=null?ratio_waffle_txt.textContent:null,boxgap:+legend_node.getAttribute("boxgap"),layout_text_value:legend_id==="legend_root_layout"?legend_node.querySelector(".lg.legend_0 > text").innerHTML:undefined};if(legend_node.getAttribute("visible_rect")==="true"){rect_fill_value={color:legend_node.querySelector("#under_rect").style.fill,opacity:legend_node.querySelector("#under_rect").style.fillOpacity};original_rect_fill_value=Object(_helpers__WEBPACK_IMPORTED_MODULE_3__["c"])(rect_fill_value)}Object(_dialogs__WEBPACK_IMPORTED_MODULE_2__["b"])(box_class,layer_name).then((function(confirmed){if(!confirmed){title_content.textContent=original_params.title_content;title_content.y.baseVal.getItem(0).value=original_params.y_title;subtitle_content.textContent=original_params.subtitle_content;subtitle_content.y.baseVal.getItem(0).value=original_params.y_subtitle;note_content.textContent=original_params.note_content;if(no_data_txt){no_data_txt.textContent=original_params.no_data_txt}else if(ratio_waffle_txt){ratio_waffle_txt.textContent=original_params.ratio_waffle_txt}rect_fill_value=original_rect_fill_value;if(original_params.layout_text_value){legend_node.querySelector(".lg.legend_0 > text").innerHTML=original_params.layout_text_value}}make_underlying_rect(legend_node_d3,legend_node_d3.select("#under_rect"),rect_fill_value);bind_selections()}));var container=document.querySelectorAll(".".concat(box_class))[0];var box_body=d3.select(container).select(".modal-dialog").style("width","375px").select(".modal-body");var current_nb_dec;box_body.append("p").style("text-align","center").insert("h3").html(_tr("app_page.legend_style_box.subtitle"));var a=box_body.append("p");a.append("span").html(_tr("app_page.legend_style_box.lgd_title"));a.append("input").style("float","right").property("value",title_content.textContent).on("keyup",(function(){title_content.textContent=this.value}));var b=box_body.append("p");b.insert("span").html(_tr("app_page.legend_style_box.var_name"));b.insert("input").style("float","right").property("value",subtitle_content.textContent).on("keyup",(function(){var empty=subtitle_content.textContent=="";if(empty&&this.value!=""){title_content.y.baseVal.getItem(0).value=title_content.y.baseVal.getItem(0).value-15}subtitle_content.textContent=this.value;if(!empty&&subtitle_content.textContent==""){title_content.y.baseVal.getItem(0).value=title_content.y.baseVal.getItem(0).value+15}}));var c=box_body.insert("p");c.insert("span").html(_tr("app_page.legend_style_box.additionnal_notes"));c.insert("input").styles({float:"right","font-family":"12px Gill Sans Extrabold, sans-serif"}).property("value",note_content.textContent).on("keyup",(function(){note_content.textContent=this.value}));if(no_data_txt){var d=box_body.insert("p");d.insert("span").html(_tr("app_page.legend_style_box.no_data"));d.insert("input").styles({float:"right","font-family":"12px Gill Sans Extrabold, sans-serif"}).property("value",no_data_txt.textContent).on("keyup",(function(){no_data_txt.textContent=this.value}))}else if(ratio_waffle_txt){var _d2=box_body.insert("p");_d2.insert("span").html(_tr("app_page.legend_style_box.ratio_waffle_txt"));_d2.insert("input").styles({float:"right","font-family":"12px Gill Sans Extrabold, sans-serif"}).property("value",ratio_waffle_txt.textContent).on("keyup",(function(){ratio_waffle_txt.textContent=this.value}))}if(legend_id==="legend_root_symbol"){var choice_break_value_section1=box_body.insert("p").styles({"text-align":"center","margin-top":"25px !important"});choice_break_value_section1.append("span").attr("class","button_disc").styles({cursor:"pointer"}).html(_tr("app_page.legend_style_box.choice_break_symbol")).on("click",(function(){container.modal.hide();display_box_value_symbol(layer_name).then((function(confirmed){container.modal.show();if(confirmed){Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_7__["e"])(svg_map.querySelector(["#legend_root_symbol.lgdf_",_app.layer_to_id.get(layer_name)].join("")))}}))}))}if(data_manager.current_layers[layer_name].renderer!=="TwoStocksWaffle"&&data_manager.current_layers[layer_name].renderer!=="Categorical"&&data_manager.current_layers[layer_name].renderer!=="TypoSymbols"&&!(data_manager.current_layers[layer_name].renderer==="PropSymbolsTypo"&&legend_id.indexOf("legend_root_symbol")<0)&&!data_manager.current_layers[layer_name].layout_legend_displayed){var max_nb_decimals=0;var max_nb_left=0;if(legend_id.indexOf("legend_root_symbol")===-1){max_nb_decimals=get_max_nb_dec(layer_name);max_nb_left=get_max_nb_left_sep(layer_name)}else{var nb_dec=[],nb_left=[];legend_boxes.each((function(d){nb_dec.push(Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["e"])(d.value));nb_left.push(Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["f"])(d.value))}));max_nb_decimals=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["k"])(nb_dec);max_nb_left=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["l"])(nb_left)}max_nb_left=max_nb_left>2?max_nb_left:2;if(max_nb_decimals>0||max_nb_left>=2){if(legend_node.getAttribute("rounding_precision")){current_nb_dec=legend_node.getAttribute("rounding_precision")}else{var nbs=[],_nb_dec=[];legend_boxes.each((function(){nbs.push(this.textContent)}));for(var i=0;i+current_nb_dec&&max_nb_decimals>18){max_nb_decimals=18}var e=box_body.append("p");e.append("span").html(_tr("app_page.legend_style_box.float_rounding"));e.append("input").attrs({id:"precision_range",type:"range",min:-+max_nb_left,max:max_nb_decimals,step:1}).styles({float:"right",width:"90px","vertical-align":"middle","margin-left":"10px"}).property("value",current_nb_dec).on("change",(function(){var nb_float=+this.value;d3.select("#precision_change_txt").html(nb_float);legend_node.setAttribute("rounding_precision",nb_float);if(legend_id==="legend_root"){for(var _i2=0;_i2 text").innerHTML).on("keyup",(function(){legend_node.querySelector(".lg.legend_0 > text").innerHTML=this.value}))}var rectangle_options1=box_body.insert("p");rectangle_options1.insert("input").style("margin-left","0px").property("checked",rect_fill_value.color===undefined?null:true).attrs({type:"checkbox",id:"rect_lgd_checkbox"}).on("change",(function(){if(this.checked){rectangle_options2.style("display","");var r=document.getElementById("choice_color_under_rect");rect_fill_value=r?{color:r.value,opacity:1}:{color:"#ffffff",opacity:1}}else{rectangle_options2.style("display","none");rect_fill_value={}}make_underlying_rect(legend_node_d3,legend_node_d3.select("#under_rect"),rect_fill_value)}));rectangle_options1.append("label").attrs({for:"rect_lgd_checkbox",class:"i18n","data-i18n":"[html]app_page.legend_style_box.under_rectangle"}).html(_tr("app_page.legend_style_box.under_rectangle"));var rectangle_options2=rectangle_options1.insert("span").styles({float:"right",display:rect_fill_value.color===undefined?"none":""});rectangle_options2.insert("input").attrs({id:"choice_color_under_rect",type:"color"}).property("value",rect_fill_value.color===undefined?"#ffffff":Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_1__["g"])(rect_fill_value.color)).on("change",(function(){rect_fill_value={color:this.value,opacity:1};make_underlying_rect(legend_node_d3,legend_node_d3.select("#under_rect"),rect_fill_value)}));if(legend_id==="legend_root_horiz"||legend_id==="legend_root"&&data_manager.current_layers[layer_name].options_disc){var change_legend_type=box_body.insert("p");change_legend_type.append("p").attr("id","vert_layout").attr("class",legend_id==="legend_root"?"opts_lgd_layout selected":"opts_lgd_layout").text(_tr("app_page.legend_style_box.lgd_layout_vertical"));change_legend_type.append("p").attr("id","horiz_layout").attr("class",legend_id!=="legend_root"?"opts_lgd_layout selected":"opts_lgd_layout").text(_tr("app_page.legend_style_box.lgd_layout_horizontal"));change_legend_type.selectAll(".opts_lgd_layout").on("click",(function(){if(this.classList.contains("selected")){return}change_legend_type.selectAll(".opts_lgd_layout").attr("class","opts_lgd_layout");this.classList.add("selected");var rendered_field=data_manager.current_layers[layer_name].rendered_field2?data_manager.current_layers[layer_name].rendered_field2:data_manager.current_layers[layer_name].rendered_field;legend_node=svg_map.querySelector("#".concat(legend_id,".lgdf_").concat(_app.layer_to_id.get(layer_name)));var boxgap=+legend_node.getAttribute("boxgap");var rounding_precision=legend_node.getAttribute("rounding_precision");var transform_param=legend_node.getAttribute("transform"),lgd_title=legend_node.querySelector("#legendtitle").innerHTML,lgd_subtitle=legend_node.querySelector("#legendsubtitle").innerHTML,note=legend_node.querySelector("#legend_bottom_note").innerHTML;var _no_data_txt=legend_node.querySelector("#no_data_txt");_no_data_txt=_no_data_txt!=null?_no_data_txt.textContent:null;legend_node.remove();if(this.id==="horiz_layout"){createLegend_choro_horizontal(layer_name,rendered_field,lgd_title,lgd_subtitle,boxgap,rect_fill_value,rounding_precision,_no_data_txt,note);legend_id="legend_root_horiz"}else{createLegend_choro(layer_name,rendered_field,lgd_title,lgd_subtitle,boxgap,rect_fill_value,rounding_precision,_no_data_txt,note);legend_id="legend_root"}bind_selections();if(transform_param){svg_map.querySelector("#".concat(legend_id,".lgdf_").concat(_app.layer_to_id.get(layer_name))).setAttribute("transform",transform_param)}}))}}function move_legends(){var xy0_map=get_map_xy0();var dim_width=w+xy0_map.x;var dim_height=h+xy0_map.y;var legends=[svg_map.querySelectorAll(".legend_feature"),svg_map.querySelectorAll("#scale_bar.legend")];for(var j=0;j<2;++j){var legends_type=legends[j];for(var i=0,i_len=legends_type.length;idim_width){var current_transform=legends_type[i].getAttribute("transform");var _$exec$1$split=/\(([^\)]+)\)/.exec(current_transform)[1].split(/[ ,]+/),_$exec$1$split2=_slicedToArray(_$exec$1$split,2),val_x=_$exec$1$split2[0],val_y=_$exec$1$split2[1];var trans_x=legend_bbox.left+legend_bbox.width-dim_width;legends_type[i].setAttribute("transform",["translate(",[+val_x-trans_x,val_y],")"].join(""))}if(legend_bbox.top+legend_bbox.height>dim_height){var _current_transform=legends_type[i].getAttribute("transform");var _$exec$1$split3=/\(([^\)]+)\)/.exec(_current_transform)[1].split(/[ ,]+/),_$exec$1$split4=_slicedToArray(_$exec$1$split3,2),_val_x=_$exec$1$split4[0],_val_y=_$exec$1$split4[1];var trans_y=legend_bbox.top+legend_bbox.height-dim_height;legends_type[i].setAttribute("transform",["translate(",[_val_x,+_val_y-trans_y],")"].join(""))}}}var text_annot=document.querySelectorAll(".txt_annot");for(var _i6=0,len_i=text_annot.length;_i6dim_width){var _trans_x=_legend_bbox.left+_legend_bbox.width-dim_width;var annot=d3.select(text_annot[_i6]);var x_rect=+annot.select("rect").attr("x")-_trans_x;var x_txt=+annot.select("text").attr("x")-_trans_x;if(x_txt>0){annot.select("rect").attr("x",x_rect);annot.select("text").attr("x",x_txt).selectAll("tspan").attr("x",x_txt)}}if(_legend_bbox.top+_legend_bbox.height>dim_height){var _trans_y=_legend_bbox.top+_legend_bbox.height-dim_height;var _annot=d3.select(text_annot[_i6]);var y_rect=+_annot.select("rect").attr("y")-_trans_y;var y_txt=+_annot.select("text").attr("y")-_trans_y;if(y_txt>0){_annot.select("rect").attr("y",y_rect);_annot.select("text").attr("y",y_txt)}}}}var get_max_nb_dec=function get_max_nb_dec(layer_name){if(!data_manager.current_layers[layer_name]||!data_manager.current_layers[layer_name].colors_breaks){return undefined}var max=0;data_manager.current_layers[layer_name].colors_breaks.forEach((function(el){var tmp=el[0].split(" - ");var p1=tmp[0].indexOf(".");var p2=tmp[1].indexOf(".");if(p1>-1){if(tmp[0].length-1-p1>max){max=tmp[0].length-1-tmp[0].indexOf(".")}}if(p2>-1){if(tmp[1].length-1-p2>max){max=tmp[1].length-1-tmp[1].indexOf(".")}}}));return max};var get_max_nb_left_sep=function get_max_nb_left_sep(layer_name){if(!data_manager.current_layers[layer_name]||!data_manager.current_layers[layer_name].colors_breaks){return undefined}var nb_left=[];data_manager.current_layers[layer_name].colors_breaks.forEach((function(el){var tmp=el[0].split(" - ");var p1=tmp[0].indexOf(".");var p2=tmp[1].indexOf(".");nb_left.push(p1);nb_left.push(p2)}));return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["l"])(nb_left)}}).call(this,__webpack_require__(21))},,function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"d",(function(){return get_menu_option}));__webpack_require__.d(__webpack_exports__,"b",(function(){return clean_menu_function}));__webpack_require__.d(__webpack_exports__,"m",(function(){return reset_user_values}));__webpack_require__.d(__webpack_exports__,"a",(function(){return check_layer_name}));__webpack_require__.d(__webpack_exports__,"e",(function(){return make_min_max_tableau}));__webpack_require__.d(__webpack_exports__,"c",(function(){return fetch_min_max_table_value}));__webpack_require__.d(__webpack_exports__,"l",(function(){return render_twostocks_waffle}));__webpack_require__.d(__webpack_exports__,"f",(function(){return make_prop_line}));__webpack_require__.d(__webpack_exports__,"g",(function(){return make_prop_symbols}));__webpack_require__.d(__webpack_exports__,"i",(function(){return render_categorical}));__webpack_require__.d(__webpack_exports__,"h",(function(){return prepare_categories_array}));__webpack_require__.d(__webpack_exports__,"j",(function(){return render_label}));__webpack_require__.d(__webpack_exports__,"k",(function(){return render_label_graticule}));var _context_menu__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(16);var _colors_helpers__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(6);var _classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(26);var _classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(29);var _classification_common__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(10);var _helpers__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(0);var _helpers_calc__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(2);var _helpers_math__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(1);var _interface__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(3);var _layers__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(20);var _layers_style_popup__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(24);var _legend__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(7);var _map_ctrl__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(5);var _projections__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(11);var _symbols_picto__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(28);function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var section2=d3.select("#menu").select("#section2");var get_menu_option=function(){var menu_option={smooth:{name:"smooth",menu_factory:function menu_factory(){return fillMenu_Stewart},fields_handler:function fields_handler(){return fields_Stewart}},prop:{name:"prop",menu_factory:function menu_factory(){return fillMenu_PropSymbol},fields_handler:function fields_handler(){return fields_PropSymbol}},choroprop:{name:"choroprop",menu_factory:function menu_factory(){return fillMenu_PropSymbolChoro},fields_handler:function fields_handler(){return fields_PropSymbolChoro}},proptypo:{name:"proptypo",menu_factory:function menu_factory(){return fillMenu_PropSymbolTypo},fields_handler:function fields_handler(){return fields_PropSymbolTypo}},choro:{name:"choro",menu_factory:function menu_factory(){return fillMenu_Choropleth},fields_handler:function fields_handler(){return fields_Choropleth}},cartogram:{name:"cartogram",menu_factory:function menu_factory(){return fillMenu_Anamorphose},fields_handler:function fields_handler(){return fields_Anamorphose}},grid:{name:"grid",menu_factory:function menu_factory(){return fillMenu_griddedMap},fields_handler:function fields_handler(){return fields_griddedMap}},flow:{name:"flow",menu_factory:function menu_factory(){return fillMenu_FlowMap},fields_handler:function fields_handler(){return fields_FlowMap}},discont:{name:"discont",menu_factory:function menu_factory(){return fillMenu_Discont},fields_handler:function fields_handler(){return fields_Discont}},typo:{name:"typo",menu_factory:function menu_factory(){return fillMenu_Typo},fields_handler:function fields_handler(){return fields_Typo}},typosymbol:{name:"typosymbol",menu_factory:function menu_factory(){return fillMenu_TypoSymbol},fields_handler:function fields_handler(){return fields_TypoSymbol}},two_stocks:{name:"two_stocks",menu_factory:function menu_factory(){return fillMenu_TwoStocks},fields_handler:function fields_handler(){return fields_TwoStocks}}};return function(func){return menu_option[func.toLowerCase()]||{}}}();function clean_menu_function(){if(fields_handler&&fields_handler.unfill){fields_handler.unfill();fields_handler=undefined}if(_app.current_functionnality&&_app.current_functionnality.name){var previous_button=document.getElementById("button_".concat(_app.current_functionnality.name));if(previous_button.style.filter!=="grayscale(100%)"){previous_button.style.filter="invert(0%) saturate(100%)"}previous_button.classList.remove("active");_app.current_functionnality=undefined}section2.select(".func-options").remove();document.getElementById("accordion2b").style.display="none";var btn_s2b=document.getElementById("btn_s2b");btn_s2b.innerHTML=_tr("app_page.section2_.title_no_choice");btn_s2b.setAttribute("data-i18n","app_page.section2_.title_no_choice");btn_s2b.style.display="none"}function reset_user_values(){fields_TypoSymbol.box_typo=undefined;fields_TypoSymbol.rendering_params={};fields_TypoSymbol.cats={};fields_PropSymbolChoro.rendering_params={};fields_Typo.rendering_params={};fields_Choropleth.rendering_params={};fields_PropSymbolTypo.rendering_params={}}function unfillSelectInput(select_node){select_node.innerHTML=""}function check_layer_name(name){var clean_name=name.replace(/[^a-zA-Z0-9_-]/g,"_");if(clean_name.match(/^\d+/)){clean_name="_".concat(clean_name)}if(!data_manager.current_layers.hasOwnProperty(clean_name)&&["Graticule","World"].indexOf(clean_name)<0){return clean_name}var i=1;var match=clean_name.match(/_\d+$/);if(!match){return check_layer_name([clean_name,i].join("_"))}i=match[0];clean_name=clean_name.substring(clean_name,clean_name.indexOf(i));return check_layer_name([clean_name,parseInt(i.slice(1,i.length),10)+1].join("_"))}function display_error_num_field(){clean_menu_function()}function display_warning_empty_geom(features){swal({title:"",text:_tr("app_page.common.warning_empty_geom",{count:features.length}),type:"warning",showCancelButton:false,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:"".concat(_tr("app_page.common.valid"),"!")})}var get_first_guess_span=function get_first_guess_span(func_name){var bbox=_target_layer_file.bbox,const_mult=func_name==="grid"?.09:.05;var width_km=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["j"])([bbox[0],Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[3])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[1])],[bbox[2],Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[3])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[1])]);var height_km=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["j"])([Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[2])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[0]),bbox[1]],[Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[2])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[0]),bbox[3]]);var val=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["c"])(width_km,height_km)*const_mult;return val>10?Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["f"])(val/10)*10:Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["f"])(val)};function test_maxmin_resolution(cell_value){var bbox=_target_layer_file.bbox;var width_km=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["j"])([bbox[0],Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[3])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[1])],[bbox[2],Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[3])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[1])]);var height_km=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["j"])([Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[2])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[0]),bbox[1]],[Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[2])-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["a"])(bbox[0]),bbox[3]]);var bigger_side=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_7__["c"])(height_km,width_km);if(width_km*height_km/(cell_value*cell_value)>15e3){return"higher"}else if(cell_value>bigger_side/1.66){return"lower"}}var color_disc_icons=function(){var types=new Set(["q6","equal_interval","jenks","quantiles"]);return function(type_disc){if(!type_disc)return;var t_disc=type_disc.toLowerCase();if(types.has(t_disc)){document.getElementById("ico_".concat(t_disc)).style.border="solid 1px green"}}}();function make_template_functionnality(parent_node){return parent_node.append("div").attr("class","func-options")}function make_layer_name_input(parent,id){var a=parent.append("p").style("clear","both");a.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.common.output"}).html(_tr("app_page.func_options.common.output"));a.insert("input").attrs({class:"params",id}).styles({width:"240px",float:"right","font-size":"11.5px","margin-bottom":"20px","margin-right":"20px","margin-top":"8px"})}function make_discretization_icons(discr_section){var subsection1=discr_section.append("div");subsection1.insert("span").attrs({"data-i18n":"[html]app_page.func_options.common.discretization_choice",class:"i18n"}).html(_tr("app_page.func_options.common.discretization_choice"));var subsection2=discr_section.append("p").style("margin","10px 0 0");subsection2.append("img").styles({margin:"0 7.5px",cursor:"pointer"}).attrs({title:_tr("app_page.common.Q6"),src:"static/img/discr_icons/q6.png",id:"ico_q6",class:"i18n","data-i18n":"[title]app_page.common.Q6"});subsection2.append("img").styles({margin:"0 7.5px",cursor:"pointer"}).attrs({title:_tr("app_page.common.jenks"),src:"static/img/discr_icons/jenks.png",id:"ico_jenks",class:"i18n","data-i18n":"[title]app_page.common.jenks"});subsection2.append("img").styles({margin:"0 7.5px",cursor:"pointer"}).attrs({title:_tr("app_page.common.equal_interval"),src:"static/img/discr_icons/equal_intervals.png",id:"ico_equal_interval",class:"i18n","data-i18n":"[title]app_page.common.equal_interval"});subsection2.append("img").styles({margin:"0 7.5px",cursor:"pointer"}).attrs({title:_tr("app_page.common.quantiles"),src:"static/img/discr_icons/quantiles.png",id:"ico_quantiles",class:"i18n","data-i18n":"[title]app_page.common.quantiles"});subsection2.append("img").styles({margin:"0 7.5px",cursor:"pointer",width:"20px"}).attrs({title:_tr("app_page.common.user_defined"),src:"static/img/High-contrast-system-run24.png",id:"ico_others",class:"i18n","data-i18n":"[title]app_page.common.user_defined"});subsection2.append("span").attrs({id:"choro_mini_choice_disc"}).styles({float:"right","margin-top":"5px","margin-left":"15px"});subsection2.append("img").styles({width:"15px",position:"absolute",right:"25px"}).attrs({id:"img_choice_disc",src:"static/img/Red_x.png"})}function make_ok_button(parent,id){var disabled=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var a=parent.append("p").styles({clear:"both","text-align":"center",margin:"auto"});a.append("button").attrs({id,class:"params button_st3 i18n","data-i18n":"[html]app_page.func_options.common.render",disabled:disabled?true:null}).html(_tr("app_page.func_options.common.render"))}function make_min_max_tableau(values,nb_class,discontinuity_type,min_size,max_size,id_parent,breaks,callback){var parent_nd=document.getElementById(id_parent);parent_nd.innerHTML="";if(values&&breaks===undefined){var disc_result=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["c"])(values,discontinuity_type,nb_class,min_size,max_size);breaks=disc_result[2];if(!breaks)return false}parent_nd.style.marginTop="3px";parent_nd.style.marginBottom="3px";var title=document.createElement("p");title.style.margin="1px";title.style.wordSpacing="1.8em";title.style.paddingLeft="22px";title.innerHTML="Min - Max - Size";parent_nd.appendChild(title);var div_table=document.createElement("div");parent_nd.appendChild(div_table);for(var i=0;i0){(function(){var prev_ix=_i-1;mins[_i].onchange=function(){maxs[prev_ix].value=this.value;if(callback)callback()}})()}if(_i0?new_layer_name:"".concat(layer,"_Waffle"));rendering_params.ratio=+document.getElementById("TwoStocks_waffle_ratio").value;rendering_params.fields=Array.prototype.slice.call(fields_list.node().selectedOptions).map((function(elem){return elem.value}));if(rendering_params.fields.length<2){swal({title:"".concat(_tr("app_page.common.error"),"!"),text:"".concat(_tr("app_page.common.error_multiple_fields")),customClass:"swal2_custom",type:"error",allowOutsideClick:false});return}var t_max=0;var _loop=function _loop(i){var field=rendering_params.fields[i];t_max+=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["k"])(data_manager.user_data[layer].map((function(obj){return+obj[field]})))/rendering_params.ratio};for(var i=0;i900){swal({title:"".concat(_tr("app_page.common.error"),"!"),text:"".concat(_tr("app_page.common.error_waffle_too_many")),customClass:"swal2_custom",type:"error",allowOutsideClick:false});return}rendering_params.new_name=new_layer_name;rendering_params.symbol_type=symbol_choice.node().value;rendering_params.size=+document.getElementById("TwoStocks_waffle_size").value;rendering_params.nCol=+document.getElementById("TwoStocks_waffle_WidthRow").value;render_twostocks_waffle(layer,rendering_params);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])();Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(new_layer_name)}))},unfill:function unfill(){unfillSelectInput(document.getElementById("TwoStocks_waffle_symbol"));unfillSelectInput(document.getElementById("TwoStocks_fields"));unfillSelectInput(document.getElementById("TwoStocks_waffle_ratio"));document.getElementById("TwoStocks_fields").size=2;document.getElementById("TwoStocks_fields").parentElement.style.marginBottom="25px";section2.selectAll(".params").attr("disabled",true)}};function render_twostocks_waffle(layer,rendering_params){var get_colors=function get_colors(nb){var res=[];for(var i=0;i0){display_warning_empty_geom(empty_geoms)}}else{ref_colors=rendering_params.ref_colors;data_manager.result_data[layer_to_add]=JSON.parse(rendering_params.result_data)}for(var i=0,_length=data_manager.result_data[layer_to_add].length;i<_length;i++){var c=[];var sum=0;var color=void 0;for(var j=0;j7500){ico_jenks.style("display","none")}else{ico_jenks.style("display",null)}};if(fields_stock.length===0||fields_ratio.length===0){display_error_num_field();return}{var first_field=fields_ratio[0];prepare_disc_quantiles(first_field);ok_button.attr("disabled",self.rendering_params[first_field]?null:true)}fields_stock.forEach((function(field){field_size.append("option").text(field).attr("value",field)}));fields_ratio.forEach((function(field){field_color.append("option").text(field).attr("value",field)}));field_size.on("change",(function(){var field_name=this.value,max_val_field=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["k"])(data_manager.user_data[layer].map((function(obj){return+obj[field_name]})));ref_value_field.attrs({max:max_val_field,value:max_val_field});uo_layer_name.attr("value",["PropSymbols",field_name,field_color.node().value,layer].join("_"))}));field_color.on("change",(function(){var field_name=this.value;var vals=data_manager.user_data[layer].map((function(a){return+a[field_name]}));render_mini_chart_serie(vals,document.getElementById("container_sparkline_propsymbolchoro"));uo_layer_name.attr("value",["PropSymbols",field_size.node().value,field_name,layer].join("_"));if(self.rendering_params[field_name]!==undefined){img_valid_disc.attr("src","static/img/Light_green_check.png");choro_mini_choice_disc.html([_tr("app_page.common.".concat(self.rendering_params[field_name].type)),", ",_tr("app_page.common.class",{count:self.rendering_params[field_name].nb_class})].join(""));uncolor_icons();color_disc_icons(self.rendering_params[field_name].type)}else{prepare_disc_quantiles(field_name)}}));ico_jenks.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_color.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);var _discretize_to_colors3=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"jenks",n_class,"BuGn"),_discretize_to_colors4=_slicedToArray(_discretize_to_colors3,6),nb_class=_discretize_to_colors4[0],type=_discretize_to_colors4[1],breaks=_discretize_to_colors4[2],color_array=_discretize_to_colors4[3],colors_map=_discretize_to_colors4[4],no_data_color=_discretize_to_colors4[5];self.rendering_params[selected_field]={nb_class,type:"jenks",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"PropSymbolsChoro",rendered_field:selected_field,schema:["BuGn"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.jenks"),", ").concat(_tr("app_page.common.class",{count:nb_class})));ok_button.attr("disabled",null);img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_quantiles.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_color.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);var _discretize_to_colors5=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"quantiles",n_class,"BuGn"),_discretize_to_colors6=_slicedToArray(_discretize_to_colors5,6),nb_class=_discretize_to_colors6[0],type=_discretize_to_colors6[1],breaks=_discretize_to_colors6[2],color_array=_discretize_to_colors6[3],colors_map=_discretize_to_colors6[4],no_data_color=_discretize_to_colors6[5];self.rendering_params[selected_field]={nb_class,type:"quantiles",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"PropSymbolsChoro",rendered_field:selected_field,schema:["BuGn"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.quantiles"),", ").concat(_tr("app_page.common.class",{count:nb_class})));ok_button.attr("disabled",null);img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_equal_interval.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_color.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);var _discretize_to_colors7=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"equal_interval",n_class,"BuGn"),_discretize_to_colors8=_slicedToArray(_discretize_to_colors7,6),nb_class=_discretize_to_colors8[0],type=_discretize_to_colors8[1],breaks=_discretize_to_colors8[2],color_array=_discretize_to_colors8[3],colors_map=_discretize_to_colors8[4],no_data_color=_discretize_to_colors8[5];self.rendering_params[selected_field]={nb_class,type:"equal_interval",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"PropSymbolsChoro",rendered_field:selected_field,schema:["BuGn"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.equal_interval"),", ").concat(_tr("app_page.common.class",{count:nb_class})));ok_button.attr("disabled",null);img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_q6.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_color.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]}));var _discretize_to_colors9=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"Q6",6,"BuGn"),_discretize_to_colors10=_slicedToArray(_discretize_to_colors9,6),nb_class=_discretize_to_colors10[0],type=_discretize_to_colors10[1],breaks=_discretize_to_colors10[2],color_array=_discretize_to_colors10[3],colors_map=_discretize_to_colors10[4],no_data_color=_discretize_to_colors10[5];self.rendering_params[selected_field]={nb_class,type:"Q6",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"PropSymbolsChoro",rendered_field:selected_field,schema:["BuGn"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.Q6"),", ").concat(_tr("app_page.common.class",{count:nb_class})));ok_button.attr("disabled",null);img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_disc.on("click",(function(){var selected_field=field_color.node().value;var opt_nb_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(data_manager.user_data[layer].length);var conf_disc_box;if(self.rendering_params[selected_field]){conf_disc_box=Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer,selected_field,self.rendering_params[selected_field].nb_class,{schema:self.rendering_params[selected_field].schema,colors:self.rendering_params[selected_field].colors,no_data:self.rendering_params[selected_field].no_data,type:self.rendering_params[selected_field].type,breaks:self.rendering_params[selected_field].breaks,extra_options:self.rendering_params[selected_field].extra_options})}else{conf_disc_box=Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer,selected_field,opt_nb_class,{type:"quantiles"})}conf_disc_box.then((function(confirmed){if(confirmed){img_valid_disc.attr("src","static/img/Light_green_check.png");choro_mini_choice_disc.html([_tr("app_page.common.".concat(confirmed[1])),", ",_tr("app_page.common.class",{count:confirmed[0]})].join(""));uncolor_icons();color_disc_icons(confirmed[1]);self.rendering_params[selected_field]={nb_class:confirmed[0],type:confirmed[1],schema:confirmed[5],no_data:confirmed[6],breaks:confirmed[2],colors:confirmed[3],colorsByFeature:confirmed[4],renderer:"PropSymbolsChoro",extra_options:confirmed[7]}}}))}));ok_button.on("click",(function(){if(!ref_value_field.node().value)return;var rendering_params=self.rendering_params;if(rendering_params[field_color.node().value]){var symbol_to_use=symb_selec.node().value,rd_params={},color_field=field_color.node().value;var new_layer_name=uo_layer_name.node().value;new_layer_name=check_layer_name(new_layer_name.length>0?new_layer_name:"".concat(layer,"_PropSymbolsChoro"));rd_params.field=field_size.node().value;rd_params.new_name=new_layer_name;rd_params.nb_features=nb_features;rd_params.ref_layer_name=layer;rd_params.symbol=symbol_to_use;rd_params.ref_value=+ref_value_field.node().value;rd_params.ref_size=+ref_size.node().value;rd_params.fill_color=rendering_params[color_field].colorsByFeature;rd_params.color_field=color_field;if(symbol_to_use==="line"){make_prop_line(rd_params)}else{make_prop_symbols(rd_params)}var colors_breaks=[];for(var i=rendering_params[color_field].breaks.length-1;i>0;--i){colors_breaks.push([[rendering_params[color_field].breaks[i-1]," - ",rendering_params[color_field].breaks[i]].join(""),rendering_params[color_field].colors[i-1]])}var options_disc={schema:rendering_params[color_field].schema,colors:rendering_params[color_field].colors,no_data:rendering_params[color_field].no_data,type:rendering_params[color_field].type,breaks:rendering_params[color_field].breaks,extra_options:rendering_params[color_field].extra_options};Object.assign(data_manager.current_layers[new_layer_name],{renderer:"PropSymbolsChoro",options_disc,rendered_field:field_size.node().value,rendered_field2:field_color.node().value,colors_breaks});Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])();Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(new_layer_name)}}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_size.node(),fields_stock[0]);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_color.node(),fields_ratio[0])},unfill:function unfill(){unfillSelectInput(document.getElementById("PropSymbolChoro_field_1"));unfillSelectInput(document.getElementById("PropSymbolChoro_field_2"));unfillSelectInput(document.getElementById("PropSymbolChoro_symbol_type"));section2.selectAll(".params").attr("disabled",true)},rendering_params:{}};var fillMenu_Typo=function fillMenu_Typo(){var dv2=make_template_functionnality(section2);var a=dv2.append("p").attr("class","params_section2");a.append("p").style("margin","auto").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.typo.field"}).html(_tr("app_page.func_options.typo.field"));a.insert("select").attrs({id:"Typo_field_1",class:"params"}).styles({position:"relative",float:"right","margin-bottom":"7.5px"});var b=dv2.insert("p").attr("class","params_section2").styles({margin:"auto","text-align":"center",clear:"both"});b.append("button").attrs({id:"Typo_class",class:"button_disc params i18n","data-i18n":"[html]app_page.func_options.typo.color_choice"}).styles({"font-size":"0.8em","text-align":"center"}).html(_tr("app_page.func_options.typo.color_choice"));make_layer_name_input(dv2,"Typo_output_name");make_ok_button(dv2,"Typo_yes");dv2.selectAll(".params").attr("disabled",true)};var fields_Typo={fill:function fill(layer){if(!layer)return;var self=this,fields_name=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["l"])("category",layer),field_selec=section2.select("#Typo_field_1"),ok_button=section2.select("#Typo_yes"),btn_typo_class=section2.select("#Typo_class"),uo_layer_name=section2.select("#Typo_output_name");var prepare_colors=function prepare_colors(field){var _prepare_categories_a=prepare_categories_array(layer,field,null),_prepare_categories_a2=_slicedToArray(_prepare_categories_a,2),col_map=_prepare_categories_a2[1];var nb_class=col_map.size;var colorByFeature=data_manager.user_data[layer].map((function(ft){return col_map.get(ft[field])[0]}));self.rendering_params[field]={nb_class,color_map:col_map,colorByFeature,renderer:"Categorical",rendered_field:field,skip_alert:false}};fields_name.forEach((function(f_name){field_selec.append("option").text(f_name).attr("value",f_name)}));field_selec.on("change",(function(){var selected_field=this.value;uo_layer_name.attr("value",["Typo",selected_field,layer].join("_"));prepare_colors(selected_field)}));{var first_field=fields_name[0];prepare_colors(first_field);ok_button.attr("disabled",self.rendering_params[first_field]?null:true)}btn_typo_class.on("click",(function(){var selected_field=field_selec.node().value;var col_map=self.rendering_params[selected_field]?self.rendering_params[selected_field].color_map:undefined;var _prepare_categories_a3=prepare_categories_array(layer,selected_field,col_map),_prepare_categories_a4=_slicedToArray(_prepare_categories_a3,1),cats=_prepare_categories_a4[0];if(cats.length>15){swal({title:"",text:_tr("app_page.common.error_too_many_features_color"),type:"warning",showCancelButton:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:"".concat(_tr("app_page.common.valid"),"!"),cancelButtonText:_tr("app_page.common.cancel")}).then((function(){Object(_classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__["a"])(data_manager.user_data[layer],layer,selected_field,cats).then((function(confirmed){if(confirmed){self.rendering_params[selected_field]={nb_class:confirmed[0],color_map:confirmed[1],colorByFeature:confirmed[2],renderer:"Categorical",rendered_field:selected_field,skip_alert:true}}}))}),(function(){return null}))}else{Object(_classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__["a"])(data_manager.user_data[layer],layer,selected_field,cats).then((function(confirmed){if(confirmed){self.rendering_params[selected_field]={nb_class:confirmed[0],color_map:confirmed[1],colorByFeature:confirmed[2],renderer:"Categorical",rendered_field:selected_field,skip_alert:true}}}))}}));ok_button.on("click",(function(){var selected_field=field_selec.node().value;var params=self.rendering_params[selected_field];var render=function render(){if(params){var _layer=Object.getOwnPropertyNames(data_manager.user_data)[0];var output_name=uo_layer_name.node().value;params.new_name=check_layer_name(output_name.length>0?output_name:["Typo",selected_field,_layer].join("_"));render_categorical(_layer,params);Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(params.new_name)}};if(params.color_map.size>15&&!params.skip_alert){swal({title:"",text:_tr("app_page.common.error_too_many_features_color"),type:"warning",showCancelButton:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:"".concat(_tr("app_page.common.valid"),"!"),cancelButtonText:_tr("app_page.common.cancel")}).then((function(){render()}),(function(){return null}))}else{render()}}));uo_layer_name.attr("value","Typo_".concat(layer));section2.selectAll(".params").attr("disabled",null);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_selec.node(),fields_name[0])},unfill:function unfill(){unfillSelectInput(document.getElementById("Typo_field_1"));section2.selectAll(".params").attr("disabled",true)},rendering_params:{}};function fillMenu_Choropleth(){var dv2=make_template_functionnality(section2);var field_selec_section=dv2.append("p").attr("class","params_section2");field_selec_section.insert("p").style("margin","auto").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.common.field"}).html(_tr("app_page.func_options.common.field"));field_selec_section.insert("select").attrs({id:"choro_field1",class:"params"}).styles({position:"relative",float:"right","margin-bottom":"7.5px"});var discr_section=dv2.insert("p").attr("class","params_section2").styles({margin:"auto"});discr_section.insert("span").attr("id","container_sparkline_choro").styles({margin:"16px 50px 0px 4px",float:"right"});make_discretization_icons(discr_section);make_layer_name_input(dv2,"Choro_output_name");make_ok_button(dv2,"choro_yes");dv2.selectAll(".params").attr("disabled",true)}var fields_Choropleth={fill:function fill(layer){if(!layer)return;var self=this,fields=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["l"])("ratio",layer),field_selec=section2.select("#choro_field1"),uo_layer_name=section2.select("#Choro_output_name"),ok_button=section2.select("#choro_yes"),img_valid_disc=section2.select("#img_choice_disc"),ico_jenks=section2.select("#ico_jenks"),ico_quantiles=section2.select("#ico_quantiles"),ico_q6=section2.select("#ico_q6"),ico_equal_interval=section2.select("#ico_equal_interval"),btn_class=section2.select("#ico_others"),choro_mini_choice_disc=section2.select("#choro_mini_choice_disc");var uncolor_icons=function uncolor_icons(){ico_jenks.style("border",null);ico_q6.style("border",null);ico_quantiles.style("border",null);ico_equal_interval.style("border",null)};var prepare_disc_quantiles=function prepare_disc_quantiles(field){var _values=data_manager.user_data[layer].map((function(v){return v[field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);render_mini_chart_serie(_values.map((function(v){return+v})),document.getElementById("container_sparkline_choro"));var _discretize_to_colors11=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"quantiles",n_class),_discretize_to_colors12=_slicedToArray(_discretize_to_colors11,6),nb_class=_discretize_to_colors12[0],type=_discretize_to_colors12[1],breaks=_discretize_to_colors12[2],color_array=_discretize_to_colors12[3],colors_map=_discretize_to_colors12[4],no_data_color=_discretize_to_colors12[5];self.rendering_params[field]={nb_class,type:"quantiles",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"Choropleth",rendered_field:field,schema:["Reds"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.quantiles"),", ").concat(_tr("app_page.common.class",{count:nb_class})));ok_button.attr("disabled",null);img_valid_disc.attr("src","static/img/Light_green_check.png");uncolor_icons();ico_quantiles.style("border","solid 1px green");if(_values.length>7500){ico_jenks.style("display","none")}else{ico_jenks.style("display",null)}};if(fields.length===0){display_error_num_field();return}section2.selectAll(".params").attr("disabled",null);fields.forEach((function(field){field_selec.append("option").text(field).attr("value",field)}));{var first_field=fields[0];prepare_disc_quantiles(first_field);ok_button.attr("disabled",self.rendering_params[first_field]?null:true)}field_selec.on("change",(function(){var field_name=this.value,vals=data_manager.user_data[layer].map((function(a){return+a[field_name]}));render_mini_chart_serie(vals,document.getElementById("container_sparkline_choro"));uo_layer_name.attr("value",["Choro",field_name,layer].join("_"));if(self.rendering_params[field_name]!==undefined){img_valid_disc.attr("src","static/img/Light_green_check.png");var keyi18n="app_page.common.".concat(self.rendering_params[field_name].type);choro_mini_choice_disc.html("".concat(_tr(keyi18n),", ").concat(_tr("app_page.common.class",{count:self.rendering_params[field_name].nb_class})));uncolor_icons();color_disc_icons(self.rendering_params[field_name].type)}else{prepare_disc_quantiles(field_name)}}));ico_jenks.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_selec.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);var _discretize_to_colors13=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"jenks",n_class),_discretize_to_colors14=_slicedToArray(_discretize_to_colors13,6),nb_class=_discretize_to_colors14[0],type=_discretize_to_colors14[1],breaks=_discretize_to_colors14[2],color_array=_discretize_to_colors14[3],colors_map=_discretize_to_colors14[4],no_data_color=_discretize_to_colors14[5];self.rendering_params[selected_field]={nb_class,type:"jenks",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"Choropleth",rendered_field:selected_field,schema:["Reds"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.jenks"),", ").concat(_tr("app_page.common.class",{count:nb_class})));img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_quantiles.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_selec.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);var _discretize_to_colors15=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"quantiles",n_class),_discretize_to_colors16=_slicedToArray(_discretize_to_colors15,6),nb_class=_discretize_to_colors16[0],type=_discretize_to_colors16[1],breaks=_discretize_to_colors16[2],color_array=_discretize_to_colors16[3],colors_map=_discretize_to_colors16[4],no_data_color=_discretize_to_colors16[5];self.rendering_params[selected_field]={nb_class,type:"quantiles",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"Choropleth",rendered_field:selected_field,schema:["Reds"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.quantiles"),", ").concat(_tr("app_page.common.class",{count:nb_class})));img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_equal_interval.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_selec.node().value,_values=data_manager.user_data[layer].map((function(v){return v[selected_field]})),n_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(_values.length);var _discretize_to_colors17=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"equal_interval",n_class),_discretize_to_colors18=_slicedToArray(_discretize_to_colors17,6),nb_class=_discretize_to_colors18[0],type=_discretize_to_colors18[1],breaks=_discretize_to_colors18[2],color_array=_discretize_to_colors18[3],colors_map=_discretize_to_colors18[4],no_data_color=_discretize_to_colors18[5];self.rendering_params[selected_field]={nb_class,type:"equal_interval",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"Choropleth",rendered_field:selected_field,schema:["Reds"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.equal_interval"),", ").concat(_tr("app_page.common.class",{count:nb_class})));img_valid_disc.attr("src","static/img/Light_green_check.png")}));ico_q6.on("click",(function(){uncolor_icons();this.style.border="solid 1px green";var selected_field=field_selec.node().value;var _values=data_manager.user_data[layer].map((function(v){return v[selected_field]}));var _discretize_to_colors19=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["b"])(_values,"Q6",6),_discretize_to_colors20=_slicedToArray(_discretize_to_colors19,6),nb_class=_discretize_to_colors20[0],type=_discretize_to_colors20[1],breaks=_discretize_to_colors20[2],color_array=_discretize_to_colors20[3],colors_map=_discretize_to_colors20[4],no_data_color=_discretize_to_colors20[5];self.rendering_params[selected_field]={nb_class,type:"Q6",colors:color_array,breaks,no_data:no_data_color,colorsByFeature:colors_map,renderer:"Choropleth",rendered_field:selected_field,schema:["Reds"]};choro_mini_choice_disc.html("".concat(_tr("app_page.common.Q6"),", ").concat(_tr("app_page.common.class",{count:nb_class})));img_valid_disc.attr("src","static/img/Light_green_check.png")}));btn_class.on("click",(function(){var selected_field=field_selec.node().value,opt_nb_class=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["g"])(data_manager.user_data[layer].length);var conf_disc_box;if(self.rendering_params[selected_field]){conf_disc_box=Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer,selected_field,self.rendering_params[selected_field].nb_class,{schema:self.rendering_params[selected_field].schema,colors:self.rendering_params[selected_field].colors,type:self.rendering_params[selected_field].type,no_data:self.rendering_params[selected_field].no_data,breaks:self.rendering_params[selected_field].breaks,extra_options:self.rendering_params[selected_field].extra_options})}else{conf_disc_box=Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer,selected_field,opt_nb_class,{type:"quantiles"})}conf_disc_box.then((function(confirmed){if(confirmed){img_valid_disc.attr("src","static/img/Light_green_check.png");var keyi18n="app_page.common.".concat(confirmed[1]);choro_mini_choice_disc.html("".concat(_tr(keyi18n),", ").concat(_tr("app_page.common.class",{count:confirmed[0]})));uncolor_icons();color_disc_icons(confirmed[1]);self.rendering_params[selected_field]={nb_class:confirmed[0],type:confirmed[1],breaks:confirmed[2],colors:confirmed[3],schema:confirmed[5],no_data:confirmed[6],colorsByFeature:confirmed[4],renderer:"Choropleth",rendered_field:selected_field,new_name:"",extra_options:confirmed[7]}}}))}));ok_button.on("click",(function(){var field_to_render=field_selec.node().value;if(self.rendering_params[field_to_render]){var user_new_layer_name=uo_layer_name.node().value;self.rendering_params[field_to_render].new_name=check_layer_name(user_new_layer_name.length>0?user_new_layer_name:["Choro",field_to_render,layer].join("_"));render_choro(layer,self.rendering_params[field_to_render]);Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(self.rendering_params[field_to_render].new_name);Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])()}}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_selec.node(),fields[0])},unfill:function unfill(){unfillSelectInput(document.getElementById("choro_field1"));d3.selectAll(".params").attr("disabled",true)},rendering_params:{}};var fields_Stewart={fill:function fill(layer){var other_layers=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["p"])(),mask_selec=d3.select("#stewart_mask");var default_selected_mask;unfillSelectInput(mask_selec.node());mask_selec.append("option").text("None").attr("value","None");for(var i=0,n_layer=other_layers.length,lyr_name;i0){var res_test=test_maxmin_resolution(reso);if(res_test){var message=res_test==="low"?_tr("app_page.common.error_too_low_resolution"):_tr("app_page.common.error_too_high_resolution");Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])(message);return}reso*=1e3}else{reso=null}bval=bval.length>0?bval.split("-").map((function(val){return+val.trim()})):null;var1_to_send[field1_n]=data_manager.current_layers[layer].original_fields.has(field1_n)?[]:data_manager.user_data[layer].map((function(i){return+i[field1_n]}));if(field2_n!=="None"){var2_to_send[field2_n]=data_manager.current_layers[layer].original_fields.has(field2_n)?[]:data_manager.user_data[layer].map((function(i){return+i[field2_n]}))}formToSend.append("json",JSON.stringify({topojson:data_manager.current_layers[layer].key_name,variable1:var1_to_send,variable2:var2_to_send,span:span*1e3,beta,typefct:func_selec,resolution:reso,nb_class,user_breaks:bval,mask_layer:mask_name!=="None"?data_manager.current_layers[mask_name].key_name:""}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["B"])("POST","compute/stewart",formToSend,true).then((function(res){var data_split=res.split("|||"),raw_topojson=data_split[0],options={result_layer_on_add:true,func_name:"smooth"};if(new_user_layer_name.length>0){options.choosed_name=new_user_layer_name}var n_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(raw_topojson,options);if(!n_layer_name)return;var class_lim=JSON.parse(data_split[1]),col_pal=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_1__["d"])(class_lim.min.length,"Oranges"),n_class=class_lim.min.length,colors_breaks=[];for(var i=0;i0?new_user_layer_name:["OlsonCartogram",field_name,layer].join("_")),func_name:"cartogram",result_layer_on_add:true};var n_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(result,options);data_manager.current_layers[n_layer_name].renderer="OlsonCarto";data_manager.current_layers[n_layer_name].rendered_field=field_name;data_manager.current_layers[n_layer_name].scale_max=1;data_manager.current_layers[n_layer_name].ref_layer_name=layer;data_manager.current_layers[n_layer_name].scale_byFeature=transform;map.select("#".concat(_app.layer_to_id.get(n_layer_name))).selectAll("path").styles({stroke:"black","stroke-opacity":.8,"fill-opacity":.8});Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])()}),(function(err){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])();console.log(err)}))}else if(algo==="dougenik"){var _formToSend=new FormData,var_to_send={},nb_iter=document.getElementById("Anamorph_dougenik_iterations").value;var_to_send[field_name]=[];if(!data_manager.current_layers[layer].original_fields.has(field_name)){var table=data_manager.user_data[layer],to_send=var_to_send[field_name];for(var _i6=0,i_len=table.length;_i60?new_user_layer_name:["Cartogram",field_name,layer].join("_")),func_name:"cartogram",result_layer_on_add:true};var n_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(data,options);data_manager.current_layers[n_layer_name].fill_color={random:true};data_manager.current_layers[n_layer_name].is_result=true;data_manager.current_layers[n_layer_name]["stroke-width-const"]=.8;data_manager.current_layers[n_layer_name].renderer="Carto_doug";data_manager.current_layers[n_layer_name].rendered_field=field_name;map.select("#".concat(_app.layer_to_id.get(n_layer_name))).selectAll("path").style("fill",(function(){return Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_1__["f"])()})).style("fill-opacity",.8).style("stroke","black").style("stroke-opacity",.8);Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])()}),(function(error){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])();console.log(error)}))}}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_selec.node(),field_selec.node().options[0].value)},unfill:function unfill(){var field_selec=document.getElementById("Anamorph_field");section2.selectAll(".params").attr("disabled",true);unfillSelectInput(field_selec)}};function fillMenu_Anamorphose(){var dialog_content=make_template_functionnality(section2);var algo_choice=dialog_content.append("p").attr("class","params_section2");algo_choice.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.cartogram.algo"}).html(_tr("app_page.func_options.cartogram.algo"));var algo_selec=algo_choice.insert("select").attrs({id:"Anamorph_algo",class:"params i18n"});var field_choice=dialog_content.append("p").attr("class","params_section2");field_choice.append("p").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.cartogram.field"}).html(_tr("app_page.func_options.cartogram.field"));field_choice.insert("select").attrs({class:"params",id:"Anamorph_field"});var doug1=dialog_content.append("p").attr("class","params_section2 opt_dougenik");doug1.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.cartogram.dougenik_iterations"}).html(_tr("app_page.func_options.cartogram.dougenik_iterations"));doug1.insert("input").attrs({type:"number",class:"params",value:5,min:1,max:12,step:1,id:"Anamorph_dougenik_iterations"});[["Dougenik & al. (1985)","dougenik"],["Olson (2005)","olson"]].forEach((function(fun_name){algo_selec.append("option").text(fun_name[0]).attr("value",fun_name[1])}));make_layer_name_input(dialog_content,"Anamorph_output_name");make_ok_button(dialog_content,"Anamorph_yes",false);dialog_content.selectAll(".params").attr("disabled",true);dialog_content.selectAll(".opt_olson").style("display","none")}function getCentroids(ref_layer_selection){var centroids=[];for(var i=0,nb_features=ref_layer_selection.length;irendering_params.break_val?col2:col1}}else if(rendering_params.fill_color instanceof Array&&rendering_params.fill_color.length===nb_features){get_color=function get_color(_,ix){return rendering_params.fill_color[ix]}}else{get_color=function get_color(){return rendering_params.fill_color}}geojson_line_layer=make_geojson_line_layer()}var require_clip_path=Object(_projections__WEBPACK_IMPORTED_MODULE_13__["h"])(_app.current_proj_name.toLowerCase())||_app.current_proj_name.toLowerCase().indexOf("conicconformal")>-1?"url(#clip)":null;var layer_id=encodeId(layer_to_add);_app.layer_to_id.set(layer_to_add,layer_id);_app.id_to_layer.set(layer_id,layer_to_add);data_manager.result_data[layer_to_add]=[];map.insert("g",".legend").attrs({id:layer_id,class:"layer","clip-path":require_clip_path}).styles({"stroke-linecap":"round","stroke-linejoin":"round"}).selectAll("path").data(geojson_line_layer.features).enter().append("path").attr("d",path).styles((function(d){data_manager.result_data[layer_to_add].push(d.properties);return{fill:"transparent",stroke:d.properties.color,"stroke-width":d.properties[t_field_name]}}));data_manager.current_layers[layer_to_add]={n_features:nb_features,renderer:rendering_params.renderer||"PropSymbols",symbol:"path",rendered_field:field,size:[ref_value,ref_size],is_result:true,ref_layer_name:layer,type:"Line"};if(rendering_params.fill_color.two!==undefined){data_manager.current_layers[layer_to_add].fill_color=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["c"])(rendering_params.fill_color)}else if(rendering_params.fill_color instanceof Array){data_manager.current_layers[layer_to_add].fill_color={class:geojson_line_layer.features.map((function(v){return v.properties.color}))}}else{data_manager.current_layers[layer_to_add].fill_color={single:rendering_params.fill_color}}if(rendering_params.break_val!==undefined){data_manager.current_layers[layer_to_add].break_val=rendering_params.break_val}Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["f"])(layer_to_add,nb_features,["Line","prop"],"result")}function make_prop_symbols(rendering_params,_pt_layer){var layer=rendering_params.ref_layer_name,field=rendering_params.field,color_field=rendering_params.color_field,t_field_name="prop_value",nb_features=rendering_params.nb_features,abs=Math.abs,ref_size=rendering_params.ref_size,ref_value=rendering_params.ref_value,symbol_type=rendering_params.symbol,layer_to_add=rendering_params.new_name,zs=d3.zoomTransform(svg_map).k,propSize=new _helpers_calc__WEBPACK_IMPORTED_MODULE_6__["a"](ref_value,ref_size,symbol_type),warn_empty_features=[];var geojson_pt_layer;if(!_pt_layer){var make_geojson_pt_layer=function make_geojson_pt_layer(){var ref_layer_selection=document.getElementById(_app.layer_to_id.get(layer)).getElementsByTagName("path");var result=[];for(var i=0,n_features=ref_layer_selection.length;irendering_params.break_val?col2:col1}}else if(rendering_params.fill_color instanceof Array&&rendering_params.fill_color.length===nb_features){get_color=function get_color(_,ix){return rendering_params.fill_color[ix]}}else{get_color=function get_color(){return rendering_params.fill_color}}geojson_pt_layer=make_geojson_pt_layer()}else{geojson_pt_layer=_pt_layer}var layer_id=encodeId(layer_to_add);_app.layer_to_id.set(layer_to_add,layer_id);_app.id_to_layer.set(layer_id,layer_to_add);data_manager.result_data[layer_to_add]=[];if(symbol_type==="circle"){map.insert("g",".legend").attrs({id:layer_id,class:"layer no_clip"}).selectAll("circle").data(geojson_pt_layer.features).enter().append("circle").attrs((function(d,i){data_manager.result_data[layer_to_add].push(d.properties);return{id:["PropSymbol_",i," feature_",d.id].join(""),r:d.properties[t_field_name],cx:path.centroid(d)[0],cy:path.centroid(d)[1]}})).styles((function(d){return{fill:d.properties.color,stroke:"black","stroke-width":1/zs}})).call(_helpers__WEBPACK_IMPORTED_MODULE_5__["i"])}else if(symbol_type==="rect"){map.insert("g",".legend").attrs({id:layer_id,class:"layer no_clip"}).selectAll("circle").data(geojson_pt_layer.features).enter().append("rect").attrs((function(d,i){var size=d.properties[t_field_name];data_manager.result_data[layer_to_add].push(d.properties);return{id:["PropSymbol_",i," feature_",d.id].join(""),height:size,width:size,x:path.centroid(d)[0]-size/2,y:path.centroid(d)[1]-size/2}})).styles((function(d){return{fill:d.properties.color,stroke:"black","stroke-width":1/zs}})).call(_helpers__WEBPACK_IMPORTED_MODULE_5__["i"])}data_manager.current_layers[layer_to_add]={n_features:nb_features,renderer:rendering_params.renderer||"PropSymbols",symbol:symbol_type,rendered_field:field,size:[ref_value,ref_size],"stroke-width-const":1,is_result:true,ref_layer_name:layer,draggable:false};if(rendering_params.fill_color.two!==undefined){data_manager.current_layers[layer_to_add].fill_color=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["c"])(rendering_params.fill_color)}else if(rendering_params.fill_color instanceof Array){data_manager.current_layers[layer_to_add].fill_color={class:geojson_pt_layer.features.map((function(v){return v.properties.color}))}}else{data_manager.current_layers[layer_to_add].fill_color={single:rendering_params.fill_color}}if(rendering_params.break_val!==undefined){data_manager.current_layers[layer_to_add].break_val=rendering_params.break_val}Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["f"])(layer_to_add,nb_features,["Point","prop"],"result");if(warn_empty_features.length>0){display_warning_empty_geom(warn_empty_features)}}function render_categorical(layer,rendering_params){var layer_name;if(rendering_params.new_name){var fields=[].concat(Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["l"])("id",layer),rendering_params.rendered_field);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["d"])(layer,rendering_params.new_name,"typo",fields);data_manager.current_layers[rendering_params.new_name].key_name=data_manager.current_layers[layer].key_name;data_manager.current_layers[rendering_params.new_name].type=data_manager.current_layers[layer].type;layer_name=rendering_params.new_name}else{layer_name=layer}var colorsByFeature=rendering_params.colorByFeature,color_map=rendering_params.color_map,field=rendering_params.rendered_field;var layer_to_render=map.select("#".concat(_app.layer_to_id.get(layer_name)));layer_to_render.style("opacity",1).style("stroke-width","".concat(.75/d3.zoomTransform(svg_map).k,"px"));if(data_manager.current_layers[layer_name].type==="Line"){layer_to_render.selectAll("path").styles((function(_,i){return{fill:"transparent",stroke:colorsByFeature[i],"stroke-opacity":1}}))}else{layer_to_render.selectAll("path").styles((function(_,i){return{fill:colorsByFeature[i],"fill-opacity":.9,stroke:"#000","stroke-opacity":.9}}))}data_manager.current_layers[layer_name].renderer=rendering_params.renderer;data_manager.current_layers[layer_name].rendered_field=field;data_manager.current_layers[layer_name].fill_color={class:rendering_params.colorByFeature};data_manager.current_layers[layer_name]["stroke-width-const"]=.75;data_manager.current_layers[layer_name].is_result=true;data_manager.current_layers[layer_name].color_map=color_map;Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])()}function render_choro(layer,rendering_params){var layer_name;if(rendering_params.new_name){var fields=[].concat(Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["l"])("id",layer),rendering_params.rendered_field);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["d"])(layer,rendering_params.new_name,"choro",fields);data_manager.current_layers[rendering_params.new_name].key_name=data_manager.current_layers[layer].key_name;data_manager.current_layers[rendering_params.new_name].type=data_manager.current_layers[layer].type;layer_name=rendering_params.new_name}else{layer_name=layer}var breaks=rendering_params.breaks;var options_disc={schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks,extra_options:rendering_params.extra_options};var layer_to_render=map.select("#".concat(_app.layer_to_id.get(layer_name)));layer_to_render.style("opacity",1).style("stroke-width","".concat(.75/d3.zoomTransform(svg_map).k,"px"));if(data_manager.current_layers[layer_name].type==="Line"){layer_to_render.selectAll("path").styles({fill:"transparent","stroke-opacity":1}).style("stroke",(function(d,i){return rendering_params.colorsByFeature[i]}))}else{layer_to_render.selectAll("path").styles({"fill-opacity":1,"stroke-opacity":1,stroke:"#000"}).style("fill",(function(d,i){return rendering_params.colorsByFeature[i]}))}data_manager.current_layers[layer_name].renderer=rendering_params.renderer;data_manager.current_layers[layer_name].rendered_field=rendering_params.rendered_field;data_manager.current_layers[layer_name].fill_color={class:rendering_params.colorsByFeature};data_manager.current_layers[layer_name]["stroke-width-const"]=.75;data_manager.current_layers[layer_name].is_result=true;data_manager.current_layers[layer_name].options_disc=options_disc;var colors_breaks=[];for(var i=breaks.length-1;i>0;--i){colors_breaks.push([[breaks[i-1]," - ",breaks[i]].join(""),rendering_params.colors[i-1]])}data_manager.current_layers[layer_name].colors_breaks=colors_breaks;Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])()}function render_mini_chart_serie(values,parent,max_h,nb_bins){var bins=nb_bins||(values.length>20?16:undefined)||(values.length>15?10:5);var class_count=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["c"])(values,bins),background="#f1f1f1",color="#6633ff",width=3*bins-3,height=25,canvas=document.createElement("canvas");var cap=max_h||Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["k"])(class_count.counts);canvas.width=width;canvas.height=height;var old=parent.querySelector("canvas");if(old)old.remove();parent.appendChild(canvas);var ctx=canvas.getContext("2d");ctx.fillStyle=background;ctx.fillRect(0,0,canvas.width,canvas.height);var barwidth=2;var barspace=1;var x=0;ctx.fillStyle=color;for(var i=0;i15){askManyFeaturesCategorical().then(fun,(function(){return null}))}else{fun()}}));ok_button.on("click",(function(){var render=function render(){render_PropSymbolTypo(field1_selec.node().value,field2_selec.node().value,uo_layer_name.node().value,ref_value_field.node().value,section2.select("#PropSymbolTypo_ref_size").node().value,section2.select("#PropSymbolTypo_symbol_type").node().value)};var field_color=field2_selec.node().value;if(self.rendering_params[field_color].color_map.size>15&&!self.rendering_params[field_color].skip_alert){askManyFeaturesCategorical().then(render,(function(){return null}))}else{render()}}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field1_selec.node(),fields_num[0]);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field2_selec.node(),fields_categ[0])},unfill:function unfill(){unfillSelectInput(document.getElementById("PropSymbolTypo_field_1"));unfillSelectInput(document.getElementById("PropSymbolTypo_field_2"));unfillSelectInput(document.getElementById("PropSymbolTypo_symbol_type"));section2.selectAll(".params").attr("disabled",true)},rendering_params:{}};function render_PropSymbolTypo(field1,color_field,n_layer_name,ref_value,ref_size,symb_selec){if(!ref_value||!color_field||!fields_PropSymbolTypo.rendering_params[color_field]){return}var layer=Object.getOwnPropertyNames(data_manager.user_data)[0],nb_features=data_manager.user_data[layer].length,rendering_params=fields_PropSymbolTypo.rendering_params[color_field],rd_params={};var new_layer_name=check_layer_name(n_layer_name.length>0?n_layer_name:["PropSymbolsTypo",field1,color_field,layer].join("_"));rd_params.field=field1;rd_params.new_name=new_layer_name;rd_params.nb_features=nb_features;rd_params.ref_layer_name=layer;rd_params.symbol=symb_selec;rd_params.ref_value=+ref_value;rd_params.color_field=color_field;rd_params.ref_size=+ref_size;rd_params.fill_color=rendering_params.colorByFeature;if(symb_selec==="line"){make_prop_line(rd_params)}else{make_prop_symbols(rd_params)}Object.assign(data_manager.current_layers[new_layer_name],{renderer:"PropSymbolsTypo",rendered_field:field1,rendered_field2:color_field,color_map:rendering_params.color_map});Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])();Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(new_layer_name)}function fillMenu_Discont(){var dv2=make_template_functionnality(section2);var a=dv2.append("p").attr("class","params_section2");a.append("p").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.discont.field"}).html(_tr("app_page.func_options.discont.field"));a.insert("select").attrs({class:"params",id:"field_Discont"});var c=dv2.append("p").attr("class","params_section2");c.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.discont.type_discontinuity"}).html(_tr("app_page.func_options.discont.type_discontinuity"));var discontinuity_type=c.insert("select").attrs({class:"params i18n",id:"kind_Discont"});[["app_page.func_options.discont.type_relative","rel"],["app_page.func_options.discont.type_absolute","abs"]].forEach((function(k){discontinuity_type.append("option").text(_tr(k[0])).attrs({value:k[1],"data-i18n":"[text]".concat(k[0])})}));var e=dv2.append("p").attr("class","params_section2");e.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.discont.discretization"}).html(_tr("app_page.func_options.discont.discretization"));var disc_type=e.insert("select").attrs({class:"params i18n",id:"Discont_discKind"});[["app_page.common.equal_interval","equal_interval"],["app_page.common.quantiles","quantiles"],["app_page.common.Q6","Q6"],["app_page.common.jenks","jenks"]].forEach((function(field){disc_type.append("option").text(_tr(field[0])).attrs({value:field[1],"data-i18n":"[text]".concat(field[0])})}));var f=dv2.append("p").attr("class","params_section2");f.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.discont.color"}).html(_tr("app_page.func_options.discont.color"));f.insert("input").attrs({class:"params",id:"color_Discont",type:"color",value:_colors_helpers__WEBPACK_IMPORTED_MODULE_1__["b"].random()});make_layer_name_input(dv2,"Discont_output_name");make_ok_button(dv2,"yes_Discont",false);dv2.selectAll(".params").attr("disabled",true)}var fields_Discont={fill:function fill(layer){if(!layer)return;var fields_num=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["l"])("stock",layer).concat(Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["l"])("ratio",layer)),select_type_discont=section2.select("#kind_Discont"),field_discont=section2.select("#field_Discont"),ok_button=section2.select("#yes_Discont");if(fields_num.length===0){display_error_num_field();return}select_type_discont.on("change",(function(){var field_name=field_discont.node().value;document.getElementById("Discont_output_name").value=["Disc",field_name,this.value,layer].join("_")}));fields_num.forEach((function(field){field_discont.append("option").text(field).attr("value",field)}));field_discont.on("change",(function(){var discontinuity_type=document.getElementById("kind_Discont").value;document.getElementById("Discont_output_name").value=["Disc",this.value,discontinuity_type,layer].join("_")}));ok_button.on("click",render_discont);section2.selectAll(".params").attr("disabled",null);document.getElementById("Discont_output_name").value=["Disc",field_discont.node().value,select_type_discont.node().value,layer].join("_")},unfill:function unfill(){unfillSelectInput(document.getElementById("field_Discont"));section2.selectAll(".params").attr("disabled",true)}};var render_discont=function render_discont(){var layer=Object.getOwnPropertyNames(data_manager.user_data)[0],field=document.getElementById("field_Discont").value,min_size=1,max_size=10,discontinuity_type=document.getElementById("kind_Discont").value,discretization_type=document.getElementById("Discont_discKind").value,nb_class=4,user_color=document.getElementById("color_Discont").value;var new_layer_name=document.getElementById("Discont_output_name").value;new_layer_name=check_layer_name(new_layer_name.length>0?new_layer_name:["Disc",field,discontinuity_type,layer].join("_"));var id_layer=encodeId(new_layer_name);_app.layer_to_id.set(new_layer_name,id_layer);_app.id_to_layer.set(id_layer,new_layer_name);var field_id=undefined;var topo_to_use=_target_layer_file;_app.waitingOverlay.display();var discont_worker=new Worker("static/dist/webworker_discont.js");_app.webworker_to_cancel=discont_worker;discont_worker.postMessage([topo_to_use,layer,field,discontinuity_type,discretization_type,field_id]);discont_worker.onmessage=function(e){var _e$data=_slicedToArray(e.data,2),arr_tmp=_e$data[0],d_res=_e$data[1];_app.webworker_to_cancel=undefined;var nb_ft=arr_tmp.length,step=(max_size-min_size)/(nb_class-1),class_size=Array(nb_class).fill(0).map((function(d,i){return min_size+i*step}));var _discretize_to_size=Object(_classification_common__WEBPACK_IMPORTED_MODULE_4__["c"])(arr_tmp,discretization_type,nb_class,min_size,max_size),_discretize_to_size2=_slicedToArray(_discretize_to_size,4),breaks=_discretize_to_size2[2],serie=_discretize_to_size2[3];if(!serie||!breaks){var opt_nb_class=Math.floor(1+3.3*Math.log10(nb_ft));var w=nb_class>opt_nb_class?_tr("app_page.common.smaller"):_tr("app_page.common.larger");swal("",_tr("app_page.common.error_discretization",{arg:w}),"error");return}var require_clip_path=Object(_projections__WEBPACK_IMPORTED_MODULE_13__["h"])(_app.current_proj_name.toLowerCase())||_app.current_proj_name.toLowerCase().indexOf("conicconformal")>-1?"url(#clip)":null;breaks=breaks.map((function(ft){return[ft[0],ft[1]]})).filter((function(d){return d[1]!==undefined}));data_manager.result_data[new_layer_name]=[];var result_layer=map.insert("g",".legend").attrs({id:id_layer,class:"layer","clip-path":require_clip_path}).styles({"stroke-linecap":"round","stroke-linejoin":"round"});var data_result=data_manager.result_data[new_layer_name];for(var i=0;i0?user_new_layer_name:["PropSymbols",field_to_render,layer].join("_"));var rendering_params={field:field_to_render,nb_features,new_name:new_layer_name,ref_layer_name:layer,symbol:symbol_to_use,ref_size:+ref_size.node().value,ref_value:+ref_value_field.node().value,fill_color:fill_color.node().value};if(+nb_color.node().value===2){rendering_params.break_val=+fill_color_opt.node().value;rendering_params.fill_color={two:[fill_color.node().value,fill_color2.node().value]}}if(symbol_to_use==="line"){make_prop_line(rendering_params)}else{make_prop_symbols(rendering_params)}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])();Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(new_layer_name)}));uo_layer_name.attr("value",["PropSymbols",layer].join("_"));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_selec.node(),fields[0])},unfill:function unfill(){unfillSelectInput(document.getElementById("PropSymbol_field_1"));unfillSelectInput(document.getElementById("PropSymbol_symbol"));section2.selectAll(".params").attr("disabled",true)}};function fillMenu_TypoSymbol(){var dv2=make_template_functionnality(section2);var a=dv2.append("p").attr("class","params_section2");a.append("span").attrs({class:"i18n","data-i18n":"[html]app_page.func_options.typosymbol.field"}).html(_tr("app_page.func_options.typosymbol.field"));a.insert("select").attrs({class:"params",id:"field_Symbol"});var b=dv2.insert("p").attr("class","params_section2").styles({"text-align":"center",margin:"auto"});b.append("button").attrs({id:"selec_Symbol",class:"button_disc params i18n","data-i18n":"[html]app_page.func_options.typosymbol.symbols_choice"}).styles({"font-size":"0.8em","text-align":"center"}).html(_tr("app_page.func_options.typosymbol.symbols_choice"));make_layer_name_input(dv2,"TypoSymbols_output_name");make_ok_button(dv2,"yesTypoSymbols");dv2.selectAll(".params").attr("disabled",true);if(!_app.default_symbols||_app.default_symbols.length===0){_app.default_symbols=[];Object(_interface__WEBPACK_IMPORTED_MODULE_8__["o"])()}}function discard_rendering_empty_val(){swal({title:"",type:"error",text:_tr("app_page.common.error_empty_vals")})}var fields_TypoSymbol={fill:function fill(layer){if(!layer)return;var fields_all=Object.getOwnPropertyNames(data_manager.user_data[layer][0]),field_to_use=section2.select("#field_Symbol"),selec_symbol=section2.select("#selec_Symbol"),uo_layer_name=section2.select("#TypoSymbols_output_name"),ok_button=section2.select("#yesTypoSymbols"),self=this;section2.selectAll(".params").attr("disabled",null);fields_all.forEach((function(field){field_to_use.append("option").text(field).attr("value",field)}));field_to_use.on("change",(function(){var field=this.value;ok_button.attr("disabled",self.rendering_params[field]?null:true)}));selec_symbol.on("click",(function(){swal({title:"",text:_tr("app_page.common.error_too_many_features"),type:"warning",showCancelButton:true,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:"".concat(_tr("app_page.common.valid"),"!"),cancelButtonText:_tr("app_page.common.cancel")}).then((function(){var field=document.getElementById("field_Symbol").value;var symbol_map=self.rendering_params[field]?self.rendering_params[field].symbols_map:undefined;Object(_symbols_picto__WEBPACK_IMPORTED_MODULE_14__["b"])(layer,field,symbol_map).then((function(confirmed){if(confirmed){document.getElementById("yesTypoSymbols").disabled=null;self.rendering_params[field]={nb_cat:confirmed[0],symbols_map:confirmed[1],field}}}))}),(function(){return null}))}));ok_button.on("click",(function(){var field=field_to_use.node().value;render_TypoSymbols(self.rendering_params[field],uo_layer_name.node().value)}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["y"])(field_to_use.node(),fields_all[0]);uo_layer_name.attr("value",["Symbols",layer].join("_"))},unfill:function unfill(){unfillSelectInput(document.getElementById("field_Symbol"));section2.selectAll(".params").attr("disabled",true)},rendering_params:{}};function render_TypoSymbols(rendering_params,new_name){var layer_name=Object.getOwnPropertyNames(data_manager.user_data)[0];var ref_layer_id=_app.layer_to_id.get(layer_name);var field=rendering_params.field;var layer_to_add=check_layer_name(new_name.length>0?new_name:["Symbols",field,layer_name].join("_"));var ref_selection=document.getElementById(ref_layer_id).getElementsByTagName("path");var nb_ft=ref_selection.length;function make_geojson_pt_layer(){var result=[];for(var i=0,nb_features=ref_selection.length;imaxval){maxval=v}}));var symbol_to_use="circle",new_layer_name=check_layer_name(new_user_layer_name.length>0?new_user_layer_name:["PropSymbols",field_to_render,params.polygon_layer].join("_"));var rendering_params={field:field_to_render,nb_features,new_name:new_layer_name,ref_layer_name:params.polygon_layer,symbol:symbol_to_use,ref_size:40,ref_value:maxval,fill_color:"pink"};make_prop_symbols(rendering_params);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])();Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(new_layer_name)}else{var rendered_field=params.func_type;var _options={choosed_name:check_layer_name(new_user_layer_name.length>0?new_user_layer_name:["PropSymbols",rendered_field,params.polygon_layer].join("_")),func_name:"grid",result_layer_on_add:true};var n_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(data,_options);if(!n_layer_name)return;var res_data=data_manager.result_data[n_layer_name],nb_ft=res_data.length,d_values=[];var opt_nb_class=Math.floor(1+3.3*Math.log10(nb_ft));opt_nb_class=opt_nb_class>4?opt_nb_class-1:opt_nb_class;for(var i=0;i0?new_user_layer_name:["Gridded",resolution,layer].join("_")),func_name:"grid",result_layer_on_add:true};var rendered_field="".concat(field_n,"_densitykm");var n_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(data,_options);if(!n_layer_name)return;var res_data=data_manager.result_data[n_layer_name],nb_ft=res_data.length,opt_nb_class=Math.floor(1+3.3*Math.log10(nb_ft)),d_values=[];for(var i=0;i0&&document.getElementById("FlowMap_field_i").options.length===0){var fields=Object.getOwnPropertyNames(data_manager.joined_dataset[0][0]);fields.forEach((function(field){field_i.append("option").text(field).attr("value",field);field_j.append("option").text(field).attr("value",field);field_fij.append("option").text(field).attr("value",field)}))}if(layer){var ref_fields=Object.getOwnPropertyNames(data_manager.user_data[layer][0]);ref_fields.forEach((function(field){join_field.append("option").text(field).attr("value",field)}));uo_layer_name.attr("value",ref_fields.length>=1?["Links",ref_fields[0]].join("_"):"LinksLayer")}else{uo_layer_name.attr("value","LinksLayer")}join_field.on("change",(function(){uo_layer_name.attr("value",["Links",this.value].join("_"))}));var values_fij;field_fij.on("change",(function(){var name=this.value;var disc=disc_type.node().value;values_fij=data_manager.joined_dataset[0].map((function(obj){return+obj[name]}));if(disc==="no_classification"){ref_value.property("value",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["k"])(values_fij))}else{var nclass=+nb_class_input.node().value,min_size=.5,max_size=10;make_min_max_tableau(values_fij,nclass,disc,min_size,max_size,"FlowMap_discTable")}}));disc_type.on("change",(function(){var disc=this.value;var name=field_fij.node().value;values_fij=data_manager.joined_dataset[0].map((function(obj){return+obj[name]}));if(disc==="no_classification"){section2.select("#FlowMap_noDiscSection").style("display",null);section2.select("#FlowMap_discSection").style("display","none");ref_value.property("value",Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["k"])(values_fij))}else{section2.select("#FlowMap_noDiscSection").style("display","none");section2.select("#FlowMap_discSection").style("display",null);var min_size=.5,max_size=10;var nclass=+nb_class_input.node().value;if(disc==="Q6"){nclass=6;nb_class_input.property("value",6)}make_min_max_tableau(values_fij,nclass,disc,min_size,max_size,"FlowMap_discTable")}}));nb_class_input.on("change",(function(){var nclass=this.value,disc=disc_type.node().value,min_size=.5,max_size=10;make_min_max_tableau(values_fij,nclass,disc,min_size,max_size,"FlowMap_discTable")}));ok_button.on("click",(function(){var discretisation=disc_type.node().value;if(discretisation==="no_classification"){render_ProportionalFlowMap(field_i.node().value,field_j.node().value,field_fij.node().value,join_field.node().value,+ref_size.node().value,+ref_value.node().value,uo_layer_name.node().value)}else{render_GraduatedFlowMap(field_i.node().value,field_j.node().value,field_fij.node().value,join_field.node().value,discretisation,uo_layer_name.node().value)}}));if(layer&&data_manager.joined_dataset.length>0){section2.selectAll(".params").attr("disabled",null);var _fields=Object.getOwnPropertyNames(data_manager.joined_dataset[0][0]);if(_fields.length>=3){field_j.node().value=_fields[1];field_fij.node().value=_fields[2];field_j.node().dispatchEvent(new Event("change"));field_fij.node().dispatchEvent(new Event("change"))}}},unfill:function unfill(){unfillSelectInput(document.getElementById("FlowMap_field_i"));unfillSelectInput(document.getElementById("FlowMap_field_j"));unfillSelectInput(document.getElementById("FlowMap_field_fij"));unfillSelectInput(document.getElementById("FlowMap_field_join"));document.getElementById("FlowMap_discTable").innerHTML="";document.getElementById("FlowMap_output_name").value="";section2.selectAll(".params").attr("disabled",true)}};function render_ProportionalFlowMap(field_i,field_j,field_fij,name_join_field,ref_size,ref_value,new_user_layer_name){var ref_layer=Object.getOwnPropertyNames(data_manager.user_data)[0],formToSend=new FormData,join_field_to_send={};join_field_to_send[name_join_field]=data_manager.user_data[ref_layer].map((function(obj){return obj[name_join_field]}));formToSend.append("json",JSON.stringify({topojson:data_manager.current_layers[ref_layer].key_name,csv_table:JSON.stringify(data_manager.joined_dataset[0]),field_i,field_j,field_fij,join_field:join_field_to_send}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["B"])("POST","compute/links",formToSend,true).then((function(data){var options={choosed_name:check_layer_name(new_user_layer_name.length>0?new_user_layer_name:["Links",name_join_field].join("_")),func_name:"flow",result_layer_on_add:true};var temp=JSON.parse(data);temp.file.objects.LinksLayer.geometries=temp.file.objects.LinksLayer.geometries.sort((function(a,b){return+b.properties[field_fij]-+a.properties[field_fij]}));var new_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(JSON.stringify(temp),options);if(!new_layer_name)return;var layer_to_render=map.select("#".concat(_app.layer_to_id.get(new_layer_name))).selectAll("path"),fij_field_name=field_fij,fij_values=data_manager.result_data[new_layer_name].map((function(obj){return+obj[fij_field_name]})),nb_ft=fij_values.length,t_field_name="prop_value";var propSize=new _helpers_calc__WEBPACK_IMPORTED_MODULE_6__["a"](ref_value,ref_size,"line");layer_to_render.each((function(d){d.properties.color="#FF0000";d.properties[t_field_name]=propSize.scale(d.properties[field_fij])}));layer_to_render.styles((function(d){return{fill:"transparent",stroke:d.properties.color,"stroke-width":d.properties[t_field_name]}}));Object.assign(data_manager.current_layers[new_layer_name],{n_features:nb_ft,renderer:"LinksProportional",symbol:"path",rendered_field:field_fij,size:[ref_value,ref_size],"stroke-width-const":undefined,is_result:true,ref_layer_name:ref_layer,fill_color:{single:"#FF0000"},type:"Line"});Object(_interface__WEBPACK_IMPORTED_MODULE_8__["t"])();Object(_legend__WEBPACK_IMPORTED_MODULE_11__["j"])(new_layer_name)}))}function render_GraduatedFlowMap(field_i,field_j,field_fij,name_join_field,disc_type,new_user_layer_name){var ref_layer=Object.getOwnPropertyNames(data_manager.user_data)[0],formToSend=new FormData,join_field_to_send={};var disc_params=fetch_min_max_table_value("FlowMap_discTable"),mins=disc_params.mins,maxs=disc_params.maxs,sizes=disc_params.sizes,nb_class=mins.length,user_breaks=[].concat(mins,maxs[nb_class-1]),min_size=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["l"])(sizes),max_size=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_6__["k"])(sizes);join_field_to_send[name_join_field]=data_manager.user_data[ref_layer].map((function(obj){return obj[name_join_field]}));formToSend.append("json",JSON.stringify({topojson:data_manager.current_layers[ref_layer].key_name,csv_table:JSON.stringify(data_manager.joined_dataset[0]),field_i,field_j,field_fij,join_field:join_field_to_send}));Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["B"])("POST","compute/links",formToSend,true).then((function(data){var options={choosed_name:check_layer_name(new_user_layer_name.length>0?new_user_layer_name:["Links",name_join_field].join("_")),func_name:"flow",result_layer_on_add:true};var new_layer_name=Object(_layers__WEBPACK_IMPORTED_MODULE_9__["a"])(data,options);if(!new_layer_name)return;var layer_to_render=map.select("#".concat(_app.layer_to_id.get(new_layer_name))).selectAll("path"),fij_field_name=field_fij,fij_values=data_manager.result_data[new_layer_name].map((function(obj){return+obj[fij_field_name]})),nb_ft=fij_values.length,serie=new geostats(fij_values);if(user_breaks[0]serie.max())user_breaks[nb_class]=serie.max();serie.setClassManually(user_breaks);data_manager.current_layers[new_layer_name].fixed_stroke=true;data_manager.current_layers[new_layer_name].renderer="LinksGraduated";data_manager.current_layers[new_layer_name].breaks=[];data_manager.current_layers[new_layer_name].linksbyId=[];data_manager.current_layers[new_layer_name].size=[min_size,max_size];data_manager.current_layers[new_layer_name].rendered_field=fij_field_name;data_manager.current_layers[new_layer_name].ref_layer_name=ref_layer;data_manager.current_layers[new_layer_name].min_display=0;var links_byId=data_manager.current_layers[new_layer_name].linksbyId;for(var i=0;i0?check_layer_name(rendering_params.uo_layer_name):check_layer_name("Labels_".concat(layer));var filter_test=function filter_test(){return true};if(rendering_params.filter_options!==undefined){if(rendering_params.filter_options.type_filter==="sup"){filter_test=function filter_test(prop){return prop[rendering_params.filter_options.field]>rendering_params.filter_options.filter_value}}else if(rendering_params.filter_options.type_filter==="inf"){filter_test=function filter_test(prop){return prop[rendering_params.filter_options.field]0){setTimeout((function(){display_warning_empty_geom(warn_empty_features)}),50)}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_12__["j"])();return layer_to_add};var render_label_graticule=function render_label_graticule(layer,rendering_params,options){var txt_color=rendering_params.color;var selected_font=rendering_params.font;var font_size="".concat(rendering_params.ref_font_size,"px");var position_lat=rendering_params.position_lat||"bottom";var position_lon=rendering_params.position_lon||"left";var new_layer_data=[];var layer_to_add=check_layer_name("Labels_Graticule");var layer_id=encodeId(layer_to_add);_app.layer_to_id.set(layer_to_add,layer_id);_app.id_to_layer.set(layer_id,layer_to_add);var nb_ft;if(options&&options.data){new_layer_data=options.data;nb_ft=new_layer_data.length}else if(layer){var grat=d3.geoGraticule().step([data_manager.current_layers.Graticule.step,data_manager.current_layers.Graticule.step]);grat=data_manager.current_layers.Graticule.extent?grat.extent(data_manager.current_layers.Graticule.extent).lines():grat.lines();nb_ft=grat.length;for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:null;var len_serie=serie.length;var q6_class=[1,.05*len_serie,.275*len_serie,.5*len_serie,.725*len_serie,.95*len_serie,len_serie];var breaks=[];var tmp=0;var j;var stock_class=[];for(var i=0;i<7;++i){j=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(q6_class[i])-1;breaks.push(+serie[j]);stock_class.push(j-tmp);tmp=j}stock_class.shift();if(breaks[0]===breaks[1]){breaks[1]=(+serie[1]+breaks[0])/2}if(breaks[6]===breaks[5]){breaks[5]=serie[len_serie-2]}if(precision!=null){breaks=breaks.map((function(val){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_2__["n"])(val,precision)}))}return{breaks,stock_class}}function getBreaksStdDev(serie,share){var mean_position=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"center";var precision=arguments.length>3?arguments[3]:undefined;var min=serie.min(),max=serie.max(),mean=serie.mean(),std_dev=serie.stddev(),class_size=std_dev*share;var breaks=mean_position==="center"?[mean-class_size/2,mean+class_size/2]:[mean-class_size,mean,mean+class_size];var _precision=precision||serie.precision;while(breaks[0]>min){breaks.unshift(breaks[0]-class_size)}while(breaks[breaks.length-1]max){if(breaks[nb_class-1]>max){console.log("This shouldn't happen (max)")}breaks[nb_class]=max}return{nb_class,breaks:breaks.map((function(v){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_2__["n"])(v,_precision)}))}}function getBreaks(values,type,n_class){var _values=values.filter((function(v){return Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["q"])(v)})),no_data=values.length-_values.length,nb_class=+n_class||getOptNbClass(_values.length);var serie=new geostats(_values);var breaks;if(type==="Q6"){var tmp=getBreaksQ6(serie.sorted(),serie.precision);breaks=tmp.breaks;breaks[0]=serie.min();breaks[nb_class]=serie.max();serie.setClassManually(breaks)}else{var _func=discretiz_geostats_switch.get(type);breaks=serie[_func](nb_class);if(serie.precision)breaks=breaks.map((function(val){return Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_2__["n"])(val,serie.precision)}))}return[serie,breaks,nb_class,no_data]}function discretize_to_size(values,type,nb_class,min_size,max_size){var _getBreaks=getBreaks(values,type,nb_class),_getBreaks2=_slicedToArray(_getBreaks,3),serie=_getBreaks2[0],breaks=_getBreaks2[1],n_class=_getBreaks2[2];var step=(max_size-min_size)/(n_class-1),class_size=Array(n_class).fill(0).map((function(d,i){return min_size+i*step})),breaks_prop=[];for(var i=0;i0?"#e7e7e7":null,colors_map=[];for(var j=0;j80?h/7.25:80,svg_w=w/4>320?320:w/4,values=serie.sorted(),nb_bins=values.length/3>51?50:Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["b"])(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["g"])(values.length))+1;var q5=serie.getQuantile(4).map((function(v){return+v}));var m_margin={top:10,right:20,bottom:10,left:20},m_width=svg_w-m_margin.right-m_margin.left,m_height=svg_h-m_margin.top-m_margin.bottom;var ref_histo=parent_node.select("#ref_histo_box").select("#inner_ref_histo_box");ref_histo.append("p").attrs({id:"ref_histo_title"}).styles({margin:"auto","text-align":"center"}).html("".concat(_tr("disc_box.hist_ref_title")," "));var c=ref_histo.append("svg").attrs({id:"svg_ref_histo",width:svg_w+m_margin.left+m_margin.right,height:svg_h+m_margin.top+m_margin.bottom});var x=d3.scaleLinear().domain([serie.min(),serie.max()]).rangeRound([0,m_width]);var svg_ref_histo=c.append("g").attr("transform","translate(".concat(m_margin.left+m_margin.right,", ").concat(m_margin.top,")"));return function(type){svg_ref_histo.remove();svg_ref_histo=c.append("g").attr("transform","translate(".concat(m_margin.left+m_margin.right,", ").concat(m_margin.top,")"));if(type==="histogram"){var data=d3.histogram().domain(x.domain()).thresholds(x.ticks(nb_bins))(values);var y=d3.scaleLinear().domain([0,d3.max(data,(function(d){return d.length}))]).range([m_height,0]);var bar=svg_ref_histo.selectAll(".bar").data(data).enter().append("rect").attrs((function(d){return{class:"bar",width:Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["a"])(x(d.x1))-Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["a"])(x(d.x0)),height:m_height-y(d.length),x:0,transform:"translate(".concat(x(d.x0),",").concat(y(d.length),")")}})).styles({fill:"beige",stroke:"black","stroke-width":"0.4px"});svg_ref_histo.append("g").style("font-size","10px").attrs({class:"x_axis",transform:"translate(0,".concat(m_height,")")}).call(d3.axisBottom().scale(x).ticks(4).tickFormat(formatCount)).selectAll("text").attrs({x:-4,y:4,dy:".45em",transform:"rotate(-40)"}).style("text-anchor","end");svg_ref_histo.append("g").attr("class","y_axis").style("font-size","10px").call(d3.axisLeft().scale(y).ticks(5).tickFormat(d3.format(".0f")))}else if(type==="box_plot"){svg_ref_histo.append("g").style("font-size","10px").attrs({class:"x_axis",transform:"translate(0,".concat(m_height,")")}).call(d3.axisBottom().scale(x).ticks(4).tickFormat(formatCount)).selectAll("text").attrs({x:-4,y:4,dy:".45em",transform:"rotate(-40)"}).style("text-anchor","end");var y_mid=(m_margin.top+m_height-m_margin.bottom)/2;svg_ref_histo.append("g").insert("line").attrs({x1:x(q5[0]),y1:m_margin.top*2,x2:x(q5[0]),y2:m_height-m_margin.bottom*2}).styles({"stroke-width":1,stroke:"black",fill:"none"});svg_ref_histo.append("g").insert("rect").attrs({x:x(q5[1]),y:m_margin.top,width:x(q5[2])-x(q5[1]),height:m_height-m_margin.bottom-m_margin.top}).styles({"stroke-width":1,stroke:"black",fill:"lightblue"});svg_ref_histo.append("g").insert("line").attrs({x1:x(q5[2]),y1:m_margin.top,x2:x(q5[2]),y2:m_height-m_margin.bottom}).styles({"stroke-width":3,stroke:"black",fill:"none"});svg_ref_histo.append("g").insert("rect").attrs({x:x(q5[2]),y:m_margin.top,width:x(q5[3])-x(q5[2]),height:m_height-m_margin.bottom-m_margin.top}).styles({"stroke-width":1,stroke:"black",fill:"lightblue"});svg_ref_histo.append("g").insert("line").attrs({x1:x(q5[4]),y1:m_margin.top*2,x2:x(q5[4]),y2:m_height-m_margin.bottom*2}).styles({"stroke-width":1,stroke:"black",fill:"none"});svg_ref_histo.append("g").insert("line").attrs({x1:x(q5[0]),y1:y_mid,x2:x(q5[1]),y2:y_mid}).styles({"stroke-width":1,stroke:"black",fill:"none","stroke-dasharray":"3,3"});svg_ref_histo.append("g").insert("line").attrs({x1:x(q5[3]),y1:y_mid,x2:x(q5[4]),y2:y_mid}).styles({"stroke-width":1,stroke:"black",fill:"none","stroke-dasharray":"3,3"})}else if(type==="beeswarm"){var _data=values.map((function(v){return{value:+v}}));var simulation=d3.forceSimulation(_data).force("x",d3.forceX((function(d){return x(d.value)})).strength(1)).force("y",d3.forceY(m_height/2).strength(2)).force("collide",d3.forceCollide(4)).stop();for(var i=0;i<75;++i){simulation.tick()}svg_ref_histo.append("g").style("font-size","10px").attrs({class:"x_axis",transform:"translate(0,".concat(m_height,")")}).call(d3.axisBottom().scale(x).ticks(4).tickFormat(formatCount)).selectAll("text").attrs({x:-4,y:4,dy:".45em",transform:"rotate(-40)"}).style("text-anchor","end");var cell=svg_ref_histo.append("g").attr("class","cells").selectAll("g").data(d3.voronoi().extent([[0,0],[m_width,m_height]]).x((function(d){return d.x})).y((function(d){return d.y})).polygons(_data)).enter().append("g");cell.append("circle").attrs((function(d){if(d){return{r:_data.lenght<250?2.5:_data.lenght<500?1.5:1,transform:"translate(".concat(d.data.x,",").concat(d.data.y,")")}}return undefined}));cell.append("path").attr("d",(function(d){if(d)return"M".concat(d.join("L"),"Z");return undefined}))}}}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){__webpack_require__.d(__webpack_exports__,"i",(function(){return shortListContent}));__webpack_require__.d(__webpack_exports__,"b",(function(){return available_projections}));__webpack_require__.d(__webpack_exports__,"g",(function(){return handle_projection_select}));__webpack_require__.d(__webpack_exports__,"a",(function(){return addLastProjectionSelect}));__webpack_require__.d(__webpack_exports__,"e",(function(){return getD3ProjFromProj4}));__webpack_require__.d(__webpack_exports__,"j",(function(){return tryFindNameProj}));__webpack_require__.d(__webpack_exports__,"h",(function(){return isInterrupted}));__webpack_require__.d(__webpack_exports__,"f",(function(){return handleClipPath}));__webpack_require__.d(__webpack_exports__,"c",(function(){return change_projection}));__webpack_require__.d(__webpack_exports__,"d",(function(){return change_projection_4}));var proj4__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(22);var _dialogs__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4);var _helpers__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(0);var _helpers_calc__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2);var _interface__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3);var _map_ctrl__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5);var _projection_others__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(46);var _layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(18);d3.geoWinkel1=function(){return d3.geoProjection(Object(_projection_others__WEBPACK_IMPORTED_MODULE_6__["b"])(45)).scale(200)};d3.geoHatano=function(){return d3.geoProjection(_projection_others__WEBPACK_IMPORTED_MODULE_6__["a"]).scale(200)};var shortListContent=["AzimuthalEqualAreaEurope","ConicConformalFrance","HEALPix","Mercator","NaturalEarth2","Robinson","TransverseMercator","WinkelTriple","more","proj4"];var available_projections=new Map([["Armadillo",{name:"geoArmadillo",scale:"400",param_in:"other",param_ex:"aphylactic"}],["AzimuthalEquidistant",{name:"geoAzimuthalEquidistant",scale:"700",param_in:"plan",param_ex:"equidistant"}],["AzimuthalEqualArea",{name:"geoAzimuthalEqualArea",scale:"700",param_in:"plan",param_ex:"equalarea"}],["AzimuthalEqualAreaEurope",{name:"geoAzimuthalEqualArea",scale:"700",rotate:[-10,-52,0],bounds:[-10.67,34.5,31.55,71.05],param_in:"plan",param_ex:"equalarea"}],["Baker",{name:"geoBaker",scale:"400",param_in:"other",param_ex:"aphylactic"}],["Berhmann",{name:"geoCylindricalEqualArea",scale:"400",parallel:30,param_in:"cylindrical",param_ex:"equalarea"}],["Bertin",{name:"geoBertin1953",scale:"400",param_in:"other",param_ex:"aphylactic"}],["Boggs",{name:"geoBoggs",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["InterruptedBoggs",{name:"geoInterruptedBoggs",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Bonne",{name:"geoBonne",scale:"400",param_in:"pseudocone",param_ex:"equalarea"}],["Bromley",{name:"geoBromley",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Collignon",{name:"geoCollignon",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["ConicConformal",{name:"geoConicConformal",scale:"400",parallels:[44,49],bounds:[-25.5,-25.5,75.5,75.5],param_in:"cone",param_ex:"conformal"}],["ConicConformalFrance",{name:"geoConicConformal",scale:"400",parallels:[44,49],rotate:[-3,-46.5,0],bounds:[-10.67,34.5,31.55,71.05],param_in:"cone",param_ex:"conformal"}],["ConicEqualArea",{name:"geoConicEqualArea",scale:"400",param_in:"cone",param_ex:"equalarea"}],["ConicEquidistant",{name:"geoConicEquidistant",scale:"400",parallels:[40,45],param_in:"cone",param_ex:"equidistant"}],["CrasterParabolic",{name:"geoCraster",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Equirectangular",{name:"geoEquirectangular",scale:"400",param_in:"cylindrical",param_ex:"equidistant"}],["CylindricalEqualArea",{name:"geoCylindricalEqualArea",scale:"400",param_in:"cylindrical",param_ex:"equalarea"}],["CylindricalStereographic",{name:"geoCylindricalStereographic",scale:"400",param_in:"cylindrical",param_ex:"aphylactic"}],["EckertI",{name:"geoEckert1",scale:"400",param_in:"pseudocylindre",param_ex:"aphylactic"}],["EckertII",{name:"geoEckert2",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["EckertIII",{name:"geoEckert3",scale:"525",param_in:"pseudocylindre",param_ex:"aphylactic"}],["EckertIV",{name:"geoEckert4",scale:"525",param_in:"pseudocylindre",param_ex:"equalarea"}],["EckertV",{name:"geoEckert5",scale:"400",param_in:"pseudocylindre",param_ex:"aphylactic"}],["EckertVI",{name:"geoEckert6",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Eisenlohr",{name:"geoEisenlohr",scale:"400",param_in:"other",param_ex:"conformal"}],["GallPeters",{name:"geoCylindricalEqualArea",scale:"400",parallel:45,param_in:"cylindrical",param_ex:"equalarea"}],["GallStereographic",{name:"geoCylindricalStereographic",scale:"400",parallel:45,param_in:"cylindrical",param_ex:"aphylactic"}],["Gilbert",{name:"geoGilbert",scale:"400",type:"",param_in:"other",param_ex:"aphylactic"}],["Gnomonic",{name:"geoGnomonic",scale:"400",param_in:"plan",param_ex:"aphylactic"}],["Gringorten",{name:"geoGringorten",scale:"400",param_in:"other",param_ex:"equalarea"}],["GringortenQuincuncial",{name:"geoGringortenQuincuncial",scale:"400",param_in:"other",param_ex:"equalarea"}],["Hatano",{name:"geoHatano",scale:"200",param_in:"other",param_ex:"equalarea"}],["HEALPix",{name:"geoHealpix",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["HoboDyer",{name:"geoCylindricalEqualArea",scale:"400",parallel:37.5,param_in:"cylindrical",param_ex:"equalarea"}],["Homolosine",{name:"geoHomolosine",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["InterruptedHomolosine",{name:"geoInterruptedHomolosine",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Loximuthal",{name:"geoLoximuthal",scale:"400",param_in:"pseudocylindre",param_ex:"aphylactic"}],["Mercator",{name:"geoMercator",scale:"375",param_in:"cylindrical",param_ex:"conformal"}],["Miller",{name:"geoMiller",scale:"375",param_in:"cylindrical",param_ex:"aphylactic"}],["MillerOblatedStereographic",{name:"geoModifiedStereographicMiller",scale:"375",param_in:"plan",param_ex:"conformal"}],["Mollweide",{name:"geoMollweide",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["NaturalEarth",{name:"geoNaturalEarth1",scale:"400",param_in:"pseudocylindre",param_ex:"aphylactic"}],["NaturalEarth2",{name:"geoNaturalEarth2",scale:"400",param_in:"pseudocylindre",param_ex:"aphylactic"}],["Orthographic",{name:"geoOrthographic",scale:"475",clipAngle:90,param_in:"plan",param_ex:"aphylactic"}],["Patterson",{name:"geoPatterson",scale:"400",param_in:"cylindrical",param_ex:"aphylactic"}],["Polyconic",{name:"geoPolyconic",scale:"400",param_in:"pseudocone",param_ex:"aphylactic"}],["Peircequincuncial",{name:"geoPeirceQuincuncial",scale:"400",param_in:"other",param_ex:"conformal"}],["Robinson",{name:"geoRobinson",scale:"400",param_in:"pseudocylindre",param_ex:"aphylactic"}],["SinuMollweide",{name:"geoSinuMollweide",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["InterruptedSinuMollweide",{name:"geoInterruptedSinuMollweide",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Sinusoidal",{name:"geoSinusoidal",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["InterruptedSinusoidal",{name:"geoInterruptedSinusoidal",scale:"400",param_in:"pseudocylindre",param_ex:"equalarea"}],["Stereographic",{name:"geoStereographic",scale:"400",param_in:"cylindrical",param_ex:"aphylactic"}],["TransverseMercator",{name:"geoTransverseMercator",scale:"400",param_in:"cylindrical",param_ex:"conformal"}],["Werner",{name:"geoBonne",scale:"400",parallel:90,param_in:"pseudocone",param_ex:"equalarea"}],["Winkel1",{name:"geoWinkel1",scale:"200",param_in:"pseudocylindre",param_ex:"aphylactic"}],["WinkelTriple",{name:"geoWinkel3",scale:"400",param_in:"pseudoplan",param_ex:"aphylactic"}]]);function storePrefProjection(type_proj,name_proj){var props=Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["n"])();if(!props)return;props.last_projection=[type_proj,name_proj]}function handle_proj_center_button(param){var current_rotation=proj.rotate();proj.rotate(param.map((function(val,i){return val||current_rotation[i]})));map.selectAll(".layer").selectAll("path").attr("d",path);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["f"])()}function handle_parallels_change(parallels){var current_values=proj.parallels();proj.parallels(parallels.map((function(val,i){return val||current_values[i]})));map.selectAll(".layer").selectAll("path").attr("d",path);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["f"])()}function handle_parallel_change(parallel){proj.parallel(parallel);map.selectAll(".layer").selectAll("path").attr("d",path);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["f"])()}var createBoxProj4=function createBoxProj4(){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["c"])("box_projection_input",_tr("app_page.section5.title"),"dialog");var container=document.getElementById("box_projection_input");var dialog=container.querySelector(".modal-dialog");var content=d3.select(container).select(".modal-body").attr("id","box_proj4");dialog.style.width=undefined;dialog.style.maxWidth="500px";dialog.style.minWidth="400px";var input_section=content.append("p");input_section.append("span").style("float","left").html(_tr("app_page.proj4_box.enter_string"));input_section.append("input").styles({width:"90%"}).attrs({id:"input_proj_string",placeholder:"EPSG:3035"});var fn_cb=function fn_cb(evt){helper_esc_key_twbs_cb(evt,clean_up_box)};var clean_up_box=function clean_up_box(){container.remove();_dialogs__WEBPACK_IMPORTED_MODULE_1__["d"].hide();document.removeEventListener("keydown",fn_cb)};var _onclose_valid=function _onclose_valid(){var proj_str=document.getElementById("input_proj_string").value.trim();var _p;var error_msg;var custom_name;if(proj_str.startsWith('"')||proj_str.startsWith("'")){proj_str=proj_str.substr(1)}if(proj_str.endsWith('"')||proj_str.endsWith("'")){proj_str=proj_str.slice(0,-1)}if(proj_str.toUpperCase().startsWith("EPSG:")){var code=+proj_str.toUpperCase().split("EPSG:")[1];var _rv=_app.epsg_projections[code];if(!_rv){error_msg=_tr("app_page.common.missing_epsg");proj_str=undefined}else{custom_name=_rv.name;proj_str=_rv.proj4}}else{custom_name=tryFindNameProj(proj_str)}clean_up_box();try{_p=Object(proj4__WEBPACK_IMPORTED_MODULE_0__["default"])(proj_str)}catch(e){swal({title:"Oops...",text:_tr("app_page.proj4_box.error",{detail:error_msg||e}),type:"error",allowOutsideClick:false,allowEscapeKey:false}).then((function(){return null}),(function(){return null}));return}var rv=change_projection_4(_p);if(rv){_app.last_projection=proj_str;addLastProjectionSelect("def_proj4",_app.last_projection,custom_name);_app.current_proj_name="def_proj4";storePrefProjection("proj4",_app.last_projection)}else{swal({title:"Oops...",text:_tr("app_page.proj4_box.error",{detail:""}),type:"error",allowOutsideClick:false,allowEscapeKey:false}).then((function(){return null}),(function(){return null}))}};container.querySelector(".btn_cancel").onclick=clean_up_box;container.querySelector("#xclose").onclick=clean_up_box;container.querySelector(".btn_ok").onclick=_onclose_valid;document.addEventListener("keydown",fn_cb);_dialogs__WEBPACK_IMPORTED_MODULE_1__["d"].display()};var displayTooltipProj4=function displayTooltipProj4(ev){var target=ev.target;if(!(target&&target.tagName==="SELECT")){return}var title=target.tooltip;var tooltipWrap=document.createElement("div");tooltipWrap.className="custom_tooltip";tooltipWrap.appendChild(document.createTextNode(title));var firstChild=document.body.firstChild;firstChild.parentNode.insertBefore(tooltipWrap,firstChild);var linkProps=this.getBoundingClientRect();var tooltipProps=tooltipWrap.getBoundingClientRect();var topPos=linkProps.bottom-tooltipProps.height/2;tooltipWrap.setAttribute("style","top: ".concat(topPos,"px; left: ").concat(linkProps.right-15,"px;"))};var removeTooltipProj4=function removeTooltipProj4(ev){var target=ev.target;if(!(target&&target.tagName==="SELECT")){return}var a=document.querySelector("div.custom_tooltip");if(a)a.remove()};var makeTooltipProj4=function makeTooltipProj4(proj_select,proj4string){proj_select.tooltip=proj4string;proj_select.addEventListener("mouseover",displayTooltipProj4);proj_select.addEventListener("mouseout",removeTooltipProj4)};function handle_projection_select(){var tmp=this.querySelector('[value="last_projection"]');var val=this.value;if(val==="more"){this.value=tmp&&_app.current_proj_name===tmp.name?"last_projection":_app.current_proj_name;createBoxCustomProjection();return}else if(val==="proj4"){this.value=tmp&&_app.current_proj_name===tmp.name?"last_projection":_app.current_proj_name;createBoxProj4();return}else if(val==="last_projection"){val=tmp.name;if(tmp.projValue){_app.last_projection=tmp.projValue}}else if(val==="ConicConformalFrance"){val="def_proj4";_app.last_projection="+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "}else if(val==="AzimuthalEqualAreaEurope"){val="def_proj4";_app.last_projection="+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "}if(val==="def_proj4"){_app.current_proj_name=val;change_projection_4(Object(proj4__WEBPACK_IMPORTED_MODULE_0__["default"])(_app.last_projection));makeTooltipProj4(this,_app.last_projection);storePrefProjection("proj4",_app.last_projection)}else{_app.current_proj_name=val;change_projection(_app.current_proj_name);storePrefProjection("d3",_app.current_proj_name)}}function addLastProjectionSelect(proj_name,proj4string,custom_name){var proj_select=document.getElementById("form_projection2");if(shortListContent.indexOf(proj_name)>-1){proj_select.value=proj_name}else if(custom_name==="RGF93 / Lambert-93"){proj_select.value="ConicConformalFrance"}else if(custom_name==="ETRS89 / LAEA Europe"){proj_select.value="AzimuthalEqualAreaEurope"}else if(proj_select.options.length===10){var prev_elem=proj_select.querySelector("[value='more']");var new_option=document.createElement("option");new_option.className="i18n";new_option.value="last_projection";new_option.name=proj_name;new_option.projValue=proj4string;new_option.innerHTML=custom_name||_tr("app_page.projection_name.".concat(proj_name));if(!custom_name)new_option.setAttribute("data-i18n","[text]app_page.projection_name.".concat(proj_name));proj_select.insertBefore(new_option,prev_elem);proj_select.value="last_projection"}else{var option=proj_select.querySelector("[value='last_projection']");option.name=proj_name;option.projValue=proj4string;option.innerHTML=custom_name||_tr("app_page.projection_name.".concat(proj_name));if(!custom_name)option.setAttribute("data-i18n","[text]app_page.projection_name.".concat(proj_name));else option.removeAttribute("data-i18n");proj_select.value="last_projection"}if(proj4string){makeTooltipProj4(proj_select,proj4string)}}var createBoxCustomProjection=function createBoxCustomProjection(){function updateSelect(filter_in,filter_ex){display_select_proj.remove();display_select_proj=p.append("select").attrs({id:"select_proj",size:18}).style("min-width","195px");if(!filter_in&&!filter_ex){Array.from(available_projections.keys()).forEach((function(proj_name){display_select_proj.append("option").attrs({class:"i18n",value:proj_name,"data-i18n":"app_page.projection_name.".concat(proj_name)}).text(_tr("app_page.projection_name.".concat(proj_name)))}))}else if(!filter_ex){available_projections.forEach((function(v,k){if(v.param_in===filter_in){display_select_proj.insert("option").attrs({class:"i18n",value:k}).text(_tr("app_page.projection_name.".concat(k)))}}))}else if(!filter_in){available_projections.forEach((function(v,k){if(v.param_ex===filter_ex){display_select_proj.append("option").attrs({class:"i18n",value:k}).text(_tr("app_page.projection_name.".concat(k)))}}))}else{var empty=true;available_projections.forEach((function(v,k){if(v.param_in===filter_in&&v.param_ex===filter_ex){empty=false;display_select_proj.append("option").attrs({class:"i18n",value:k}).text(_tr("app_page.projection_name.".concat(k)))}}));if(empty){display_select_proj.append("option").attrs({class:"i18n",value:"no_result"}).html(_tr("app_page.projection_box.no_result_projection"))}}display_select_proj.on("dblclick",(function(){if(this.value==="no_result")return;reproj(this.value)}))}function onClickFilter(){var filter1_val=Array.prototype.filter.call(document.querySelector(".switch-field.f1").querySelectorAll("input"),(function(f){return f.checked}))[0];var filter2_val=Array.prototype.filter.call(document.querySelector(".switch-field.f2").querySelectorAll("input"),(function(f){return f.checked}))[0];filter1_val=filter1_val===undefined?undefined:filter1_val.value;if(filter1_val==="any")filter1_val=undefined;filter2_val=filter2_val===undefined?undefined:filter2_val.value;if(filter2_val==="any")filter2_val=undefined;updateSelect(filter1_val,filter2_val)}function updateProjOptions(){if(proj.rotate){rotate_section.style("display","");var param_rotate=proj.rotate();lambda_input.node().value=-param_rotate[0];phi_input.node().value=-param_rotate[1];gamma_input.node().value=-param_rotate[2]}else{rotate_section.style("display","none")}if(proj.parallels){var param_parallels=proj.parallels();parallels_section.style("display","");parallel_section.style("display","none");sp1_input.node().value=param_parallels[0];sp2_input.node().value=param_parallels[1]}else if(proj.parallel){parallels_section.style("display","none");parallel_section.style("display","");sp_input.node().value=proj.parallel()}else{parallels_section.style("display","none");parallel_section.style("display","none")}}function reproj(value){_app.current_proj_name=value;addLastProjectionSelect(_app.current_proj_name);change_projection(_app.current_proj_name);updateProjOptions();storePrefProjection("d3",_app.current_proj_name)}var prev_projection=_app.current_proj_name,prev_translate=[].concat(t),prev_scale=s,prev_rotate=proj.rotate?proj.rotate():undefined,prev_parallels=proj.parallels?proj.parallels():undefined,prev_parallel=proj.parallel?proj.parallel():undefined;Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["c"])("box_projection_customization",_tr("app_page.section5.title"),"dialog");var container=document.getElementById("box_projection_customization"),dialog=container.querySelector(".modal-dialog");var content=d3.select(container).select(".modal-body").attr("id","box_projection");dialog.style.width="700px";content.append("button").attrs({class:"accordion_proj active",id:"btn_choice_proj"}).style("padding","0 6px").html(_tr("app_page.projection_box.choice_projection"));var accordion_choice_projs=content.append("div").attrs({class:"panel show",id:"accordion_choice_projection"}).style("padding","10px").style("width","98%");var choice_proj_content=accordion_choice_projs.append("div").attr("id","choice_proj_content").style("text-align","center");var column1=choice_proj_content.append("div").styles({float:"left",width:"50%"});var column3=choice_proj_content.append("div").styles({float:"right",width:"45%"});var column2=choice_proj_content.append("div").styles({float:"left",width:"50%"});choice_proj_content.append("div").style("clear","both");var filtersection1=column1.append("div").attr("class","switch-field f1");filtersection1.append("div").attrs({class:"switch-title"}).html(_tr("app_page.projection_box.filter_nature"));["any","other","cone","cylindrical","plan","pseudocone","pseudocylindre","pseudoplan"].forEach((function(v,i){var _id="switch_proj1_elem_".concat(i);filtersection1.append("input").attrs({type:"radio",id:_id,class:"filter1",name:"switch_proj1",value:v});filtersection1.append("label").attr("for",_id).html(_tr("app_page.projection_box.".concat(v)))}));var filtersection2=column2.append("div").attr("class","switch-field f2");filtersection2.append("div").attrs({class:"switch-title"}).html(_tr("app_page.projection_box.filter_prop"));["any","aphylactic","conformal","equalarea","equidistant"].forEach((function(v,i){var _id="switch_proj2_elem_".concat(i);filtersection2.append("input").attrs({type:"radio",id:_id,class:"filter2",name:"switch_proj2",value:v});filtersection2.append("label").attr("for",_id).html(_tr("app_page.projection_box.".concat(v)))}));Array.prototype.forEach.call(document.querySelectorAll(".filter1,.filter2"),(function(el){el.onclick=onClickFilter}));var p=column3.append("p").style("margin","auto");var display_select_proj=p.append("select").attrs({id:"select_proj",size:18});updateSelect(null,null);column3.append("button").style("margin","5px 0 5px 0").attrs({id:"btn_valid_reproj",class:"button_st4 i18n"}).html(_tr("app_page.projection_box.ok_reproject")).on("click",(function(){var value=document.getElementById("select_proj").value;if(value==="no_result")return;reproj(value)}));content.append("button").attrs({class:"accordion_proj",id:"btn_choice_proj"}).style("padding","0 6px").html(_tr("app_page.projection_box.projection_options"));var accordion_choice_options=content.append("div").attrs({class:"panel",id:"accordion_choice_projection"}).styles({padding:"10px",width:"98%"});var options_proj_content=accordion_choice_options.append("div").attr("id","options_proj_content").styles({transform:"translateX(45%)",width:"60%"});var rotate_section=options_proj_content.append("div").style("display",prev_rotate?"":"none");var lambda_section=rotate_section.append("p");lambda_section.append("span").style("float","left").html(_tr("app_page.section5.projection_center_lambda"));var lambda_input=lambda_section.append("input").styles({width:"60px",float:"right",height:"2rem"}).attrs({type:"number",min:-180,max:180,step:.5}).property("value",prev_rotate?-prev_rotate[0]:0).on("input",(function(){if(this.value>180)this.value=180;else if(this.value<-180)this.value=-180;handle_proj_center_button([-this.value,null,null])}));var phi_section=rotate_section.append("p").style("clear","both");phi_section.append("span").style("float","left").html(_tr("app_page.section5.projection_center_phi"));var phi_input=phi_section.append("input").styles({width:"60px",float:"right",height:"2rem"}).attrs({type:"number",min:-180,max:180,step:.5}).property("value",prev_rotate?-prev_rotate[1]:0).on("input",(function(){if(this.value>180){this.value=180}else if(this.value<-180){this.value=-180}handle_proj_center_button([null,-this.value,null])}));var gamma_section=rotate_section.append("p").style("clear","both");gamma_section.append("span").style("float","left").html(_tr("app_page.section5.projection_center_gamma"));var gamma_input=gamma_section.append("input").styles({width:"60px",float:"right",height:"2rem"}).attrs({type:"number",min:-90,max:90,step:.5}).property("value",prev_rotate?-prev_rotate[2]:0).on("input",(function(){if(this.value>90){this.value=90}else if(this.value<-90){this.value=-90}handle_proj_center_button([null,null,-this.value])}));var parallels_section=options_proj_content.append("div").styles({clear:"both",display:prev_parallels?"":"none","text-align":"center"});parallels_section.append("span").html(_tr("app_page.section5.parallels"));var inputs=parallels_section.append("p").styles({"text-align":"center",margin:"auto"});var sp1_input=inputs.append("input").styles({width:"60px",display:"inline","margin-right":"2px"}).attrs({type:"number",min:-90,max:90,step:.5}).property("value",prev_parallels?prev_parallels[0]:0).on("input",(function(){if(this.value>90)this.value=90;else if(this.value<-90)this.value=-90;handle_parallels_change([this.value,null])}));var sp2_input=inputs.append("input").styles({width:"60px",display:"inline","margin-left":"2px"}).attrs({type:"number",min:-90,max:90,step:.5}).property("value",prev_parallels?prev_parallels[1]:0).on("input",(function(){if(this.value>90)this.value=90;else if(this.value<-90)this.value=-90;handle_parallels_change([null,this.value])}));var parallel_section=options_proj_content.append("div").styles({"text-align":"center",clear:"both"}).style("display",prev_parallel?"":"none");parallel_section.append("span").html(_tr("app_page.section5.parallel"));var sp_input=parallel_section.append("p").styles({"text-align":"center",margin:"auto"}).append("input").styles({width:"60px",display:"inline","margin-right":"2px"}).attrs({type:"number",min:-90,max:90,step:.5}).property("value",prev_parallel||0).on("input",(function(){if(this.value>90)this.value=90;else if(this.value<-90)this.value=-90;handle_parallel_change(this.value)}));if(prev_projection==="def_proj4"){options_proj_content.selectAll("input").attr("disabled","disabled");options_proj_content.selectAll("span").styles({color:"darkgrey","font-style":"italic"})}Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["a"])(".accordion_proj",container);var clean_up_box=function clean_up_box(){container.remove();_dialogs__WEBPACK_IMPORTED_MODULE_1__["d"].hide();document.removeEventListener("keydown",fn_cb)};var fn_cb=function fn_cb(evt){helper_esc_key_twbs_cb(evt,_onclose_cancel)};var _onclose_cancel=function _onclose_cancel(){clean_up_box();s=prev_scale;t=prev_translate.slice();_app.current_proj_name=prev_projection;if(prev_projection!=="def_proj4"){change_projection(_app.current_proj_name);addLastProjectionSelect(_app.current_proj_name);storePrefProjection("d3",_app.current_proj_name)}else if(prev_projection==="def_proj4"){change_projection_4(Object(proj4__WEBPACK_IMPORTED_MODULE_0__["default"])(_app.last_projection));var custom_name=Object.keys(_app.epsg_projections).map((function(d){return[d,_app.epsg_projections[d]]})).filter((function(ft){return ft[1].proj4===_app.last_projection}));custom_name=custom_name&&custom_name.length>0&&custom_name[0].length>1?custom_name[0][1].name:undefined;addLastProjectionSelect(_app.current_proj_name,_app.last_projection,custom_name);storePrefProjection("proj4",_app.last_projection)}if(prev_rotate){handle_proj_center_button(prev_rotate)}if(prev_parallels){handle_parallels_change(prev_parallels)}else if(prev_parallel){handle_parallel_change(prev_parallel)}};container.querySelector(".btn_cancel").onclick=_onclose_cancel;container.querySelector("#xclose").onclick=_onclose_cancel;container.querySelector(".btn_ok").onclick=clean_up_box;document.addEventListener("keydown",fn_cb);_dialogs__WEBPACK_IMPORTED_MODULE_1__["d"].display()};var getD3ProjFromProj4=function getD3ProjFromProj4(_proj){var projRaw=function projRaw(lambda,phi){return _proj.forward([lambda*57.29577951308232,phi*57.29577951308232])};projRaw.invert=function(x,y){var p=_proj.inverse([x,y]);return[p[0]*.017453292519943295,p[1]*.017453292519943295]};return d3.geoProjection(projRaw)};var tryFindNameProj=function tryFindNameProj(proj_str){var o=Object.entries(_app.epsg_projections).filter((function(proj){return proj[1].proj4.indexOf(proj_str)>-1||proj[1].proj4.replace("+towgs84=0,0,0,0,0,0,0 ","").indexOf(proj_str)>-1}));if(o.length>0)return o[0][1].name;return undefined};function isInterrupted(proj_name){return proj_name.indexOf("interrupted")>-1||proj_name.indexOf("armadillo")>-1||proj_name.indexOf("healpix")>-1}function handleClipPath(){var proj_name=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var main_layer=arguments.length>1?arguments[1]:undefined;var proj_name_lower=proj_name.toLowerCase();var defs_sphere=defs.node().querySelector("#sphereClipPath");var defs_extent=defs.node().querySelector("#extent");var defs_clipPath=defs.node().querySelector("clipPath");if(defs_sphere){defs_sphere.remove()}if(defs_extent){defs_extent.remove()}if(defs_clipPath){defs_clipPath.remove()}if(isInterrupted(proj_name_lower)){defs.append("path").datum({type:"Sphere"}).attr("id","sphereClipPath").attr("d",path);defs.append("clipPath").attr("id","clip").append("use").attr("xlink:href","#sphereClipPath");map.selectAll(".layer:not(.no_clip)").attr("clip-path","url(#clip)");svg_map.insertBefore(defs.node(),svg_map.childNodes[0])}else if(proj_name_lower.indexOf("conicconformal")>-1){var outline=d3.geoGraticule().extentMajor([[-180,-60],[180,90]]).outline();defs.append("path").attr("id","extent").attr("d",path(outline));defs.append("clipPath").attr("id","clip").append("use").attr("xlink:href","#extent");map.selectAll(".layer:not(.no_clip)").attr("clip-path","url(#clip)")}else{map.selectAll(".layer").attr("clip-path",null)}}function change_projection(new_proj_name){map.select(".brush").remove();d3.select("img#btn_graticule").style("opacity","1").on("click",(function(){return Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__["a"])("graticule")}));d3.select("img#btn_sphere").style("opacity","1").on("click",(function(){return Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__["a"])("sphere")}));var prev_rotate=proj.rotate?[proj.rotate()[0],0,0]:[0,0,0];var def_proj=available_projections.get(new_proj_name);proj=d3[def_proj.name]();if(def_proj.parallels)proj=proj.parallels(def_proj.parallels);else if(def_proj.parallel)proj=proj.parallel(def_proj.parallel);if(def_proj.clipAngle)proj=proj.clipAngle(def_proj.clipAngle);if(def_proj.rotate)prev_rotate=def_proj.rotate;if(proj.rotate)proj.rotate(prev_rotate);path=d3.geoPath().projection(proj).pointRadius(4);if(proj.invert!==undefined){document.getElementById("brush_zoom_button").style.display="";d3.select("img#btn_scale").style("opacity","1").on("click",(function(){return Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__["a"])("scale")}))}else{document.getElementById("brush_zoom_button").style.display="none";d3.select("img#btn_scale").style("opacity","0.3").on("click",null)}var layer_name=Object.getOwnPropertyNames(data_manager.user_data)[0];if(!layer_name&&def_proj.bounds){Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_3__["o"])(def_proj.bounds)}else if(!layer_name){var layers_active=Array.prototype.filter.call(svg_map.querySelectorAll(".layer"),(function(f){return f.style.visibility!=="hidden"}));layer_name=layers_active.length>0?global._app.id_to_layer.get(layers_active[layers_active.length-1].id):undefined}if(layer_name){Object(_interface__WEBPACK_IMPORTED_MODULE_4__["q"])(layer_name);Object(_interface__WEBPACK_IMPORTED_MODULE_4__["f"])(layer_name);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["j"])()}else{proj.translate(t).scale(s);map.selectAll(".layer").selectAll("path").attr("d",path);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["f"])()}var a=document.querySelector("div.custom_tooltip");if(a)a.remove();var selectProj=document.querySelector("#form_projection2");selectProj.removeAttribute("tooltip");selectProj.removeEventListener("mouseover",displayTooltipProj4);selectProj.removeEventListener("mouseout",removeTooltipProj4);handleClipPath(new_proj_name,layer_name)}function change_projection_4(_proj){Object(_interface__WEBPACK_IMPORTED_MODULE_4__["p"])("Sphere");if(global._app.last_projection&&(global._app.last_projection.indexOf("=lcc")>-1||global._app.last_projection.indexOf("Lambert_Conformal_Conic")>-1)){d3.select("img#btn_graticule").style("opacity","0.3").on("click",null);d3.select("img#btn_sphere").style("opacity","0.3").on("click",null)}else{d3.select("img#btn_graticule").style("opacity","1").on("click",(function(){return Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__["a"])("graticule")}));d3.select("img#btn_sphere").style("opacity","1").on("click",(function(){return Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__["a"])("sphere")}))}map.select(".brush").remove();proj=getD3ProjFromProj4(_proj);path=d3.geoPath().projection(proj).pointRadius(4);if(proj.invert!==undefined){document.getElementById("brush_zoom_button").style.display="";d3.select("img#btn_scale").style("opacity","1").on("click",(function(){return Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_7__["a"])("scale")}))}else{document.getElementById("brush_zoom_button").style.display="none";d3.select("img#btn_scale").style("opacity","0.3").on("click",null)}var layer_name=Object.getOwnPropertyNames(data_manager.user_data)[0];if(!layer_name){var layers_active=Array.prototype.filter.call(svg_map.querySelectorAll(".layer"),(function(f){return f.style.visibility!=="hidden"}));layer_name=layers_active.length>0?global._app.id_to_layer.get(layers_active[layers_active.length-1].id):undefined}if(!layer_name||layer_name==="World"||layer_name==="Sphere"||layer_name==="Graticule"){Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_3__["o"])([-10.67,34.5,31.55,71.05])}else{var rv=Object(_interface__WEBPACK_IMPORTED_MODULE_4__["h"])(layer_name);s=rv[0];t=rv[1];if(isNaN(s)||s===0||isNaN(t[0])||isNaN(t[1])){s=100;t=[0,0];Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_3__["o"])([-10.67,34.5,31.55,71.05])}}if(isNaN(s)||s===0||isNaN(t[0])||isNaN(t[1])){s=100;t=[0,0];console.log("Error");return false}map.selectAll(".layer").selectAll("path").attr("d",path);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["f"])();Object(_interface__WEBPACK_IMPORTED_MODULE_4__["f"])(layer_name);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_5__["j"])();handleClipPath();return true}}).call(this,__webpack_require__(19))},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return scaleBar}));var _context_menu__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(16);var _dialogs__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4);var _helpers_calc__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(2);var _helpers_math__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(1);var _legend__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(7);var _snap_lines__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(13);var convert_dist=function convert_dist(unit_in,unit_out,value){if(unit_in===unit_out){return value}else if(unit_in==="km"&&unit_out==="m"){return+value*1e3}else if(unit_in==="km"&&unit_out==="mi"){return+value*.621371}else if(unit_in==="m"&&unit_out==="km"){return+value/1e3}else if(unit_in==="m"&&unit_out==="mi"){return+value*621371e-9}else if(unit_in==="mi"&&unit_out==="km"){return+value*1.60934}else if(unit_in==="mi"&&unit_out==="m"){return+value*1609.34}throw"Invalid unit"};var scaleBar={create:function create(x,y){var _this=this;var scale_gp=map.append("g").attrs({id:"scale_bar",class:"legend scale"}),x_pos=40,y_pos=h-100,bar_size=50,self=this;this.x=x_pos;this.y=y_pos;this.bar_size=bar_size;this.unit="km";this.precision=0;this.start_end_bar=false;this.fixed_size=false;var rv=this.getDist();if(rv)return;var getItems=function getItems(){return[{name:_tr("app_page.common.edit_style"),action:function action(){_this.editStyle()}},{name:_tr("app_page.common.up_element"),action:function action(){_this.up_element()}},{name:_tr("app_page.common.down_element"),action:function action(){_this.down_element()}},{name:_tr("app_page.common.delete"),action:function action(){_this.remove()}}]};var scale_context_menu=new _context_menu__WEBPACK_IMPORTED_MODULE_0__["a"];this.under_rect=scale_gp.insert("rect").attrs({x:x_pos-10,y:y_pos-20,height:30,width:this.bar_size+20,id:"under_rect"}).styles({fill:"green","fill-opacity":0});scale_gp.insert("rect").attrs({id:"rect_scale",x:x_pos,y:y_pos,height:2,width:this.bar_size}).style("fill","black");scale_gp.insert("text").attrs({id:"text_limit_sup_scale",x:x_pos+bar_size,y:y_pos-5}).styles({"font-family":"verdana","font-size":"11px","text-anchor":"middle"}).text("".concat(this.dist_txt," km"));scale_gp.call(Object(_legend__WEBPACK_IMPORTED_MODULE_4__["i"])(scale_gp));scale_gp.on("mouseover",(function(){this.style.cursor="pointer";self.under_rect.style("fill-opacity",.1)})).on("mouseout",(function(){this.style.cursor="pointer";self.under_rect.style("fill-opacity",0)})).on("contextmenu dblclick",(function(){d3.event.preventDefault();d3.event.stopPropagation();return scale_context_menu.showMenu(d3.event,document.querySelector("body"),getItems())}));if(x&&y){scale_gp.attr("transform","translate(".concat([x-this.x,y-this.y],")"))}this.Scale=scale_gp;this.displayed=true;if(this.dist>100){this.resize(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(this.dist/100)*100)}else if(this.dist>10){this.resize(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(this.dist/10)*10)}else if(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(this.dist)>1){this.resize(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(this.dist))}else if(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(this.dist*10)/10>.1){this.precision=1;this.resize(Object(_helpers_math__WEBPACK_IMPORTED_MODULE_3__["f"])(this.dist*10)/10)}else{var t=this.dist.toString().split(".");this.precision=t&&t.length>1?t[1].length:"".concat(this.dist).length;this.resize(this.dist)}_snap_lines__WEBPACK_IMPORTED_MODULE_5__["c"].set("".concat(scale_gp.attr("id")," ").concat(scale_gp.attr("class")),get_bounding_rect(scale_gp.node()))},getDist:function getDist(){var x_pos=w/2,y_pos=h/2,transform=d3.zoomTransform(svg_map),z_trans=[transform.x,transform.y],z_scale=transform.k;if(isNaN(+this.bar_size)){console.log("scaleBar.bar_size : NaN");this.bar_size=50}var pt1=proj.invert([(x_pos-z_trans[0])/z_scale,(y_pos-z_trans[1])/z_scale]);var pt2=proj.invert([(x_pos+this.bar_size-z_trans[0])/z_scale,(y_pos-z_trans[1])/z_scale]);if(!pt1||!pt2){this.remove();return true}this.dist=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_2__["b"])([pt1[1],pt1[0]],[pt2[1],pt2[0]]);var mult=this.unit=="km"?1:this.unit=="m"?1e3:this.unit=="mi"?.621371:1;this.dist_txt=(this.dist*mult).toFixed(this.precision)},resize:function resize(desired_dist){desired_dist=desired_dist||this.fixed_size;var ratio=+this.dist/desired_dist;var new_size=this.bar_size/ratio;this.Scale.select("#rect_scale").attr("width",new_size);this.Scale.select("#text_limit_sup_scale").attr("x",this.x+new_size/2);this.bar_size=new_size;this.fixed_size=desired_dist;this.under_rect.attr("width",new_size+20);var err=this.getDist();if(err){this.remove();return}this.Scale.select("#text_limit_sup_scale").text("".concat(this.dist_txt," ").concat(this.unit));this.handle_start_end_bar()},update:function update(){var err=this.getDist();if(err){this.remove();return}if(this.fixed_size){this.resize()}else{this.Scale.select("#text_limit_sup_scale").text("".concat(this.dist_txt," ").concat(this.unit))}},up_element:function up_element(){Object(_legend__WEBPACK_IMPORTED_MODULE_4__["l"])(this.Scale.node())},down_element:function down_element(){Object(_legend__WEBPACK_IMPORTED_MODULE_4__["h"])(this.Scale.node())},remove:function remove(){_snap_lines__WEBPACK_IMPORTED_MODULE_5__["c"]["delete"]("".concat(this.Scale.attr("id")," ").concat(this.Scale.attr("class")));this.Scale.remove();this.Scale=null;this.displayed=false},handle_start_end_bar:function handle_start_end_bar(){this.Scale.selectAll(".se_bar").remove();if(this.start_end_bar){this.Scale.insert("rect").attrs({class:"start_bar se_bar",x:this.x,y:this.y-4.5,width:"1.5px",height:"4.5px"});this.Scale.insert("rect").attrs({class:"end_bar se_bar",x:this.x+this.bar_size-1.5,y:this.y-4.5,width:"1.5px",height:"4.5px"})}},editStyle:function editStyle(){var new_val;var self=this;var initial_params={bar_size:self.bar_size,displayed:self.displayed,dist:self.dist,dist_txt:self.dist_txt,fixed_size:self.fixed_size,precision:self.precision,unit:self.unit,x:self.x,y:self.y,transform:self.Scale._groups[0][0].getAttribute("transform")||""};Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["b"])("scaleBarEditBox",_tr("app_page.scale_bar_edit_box.title"),{widthFitContent:true}).then((function(confirmed){if(!confirmed){var _t=self.dist_txt;self.bar_size=initial_params.bar_size;self.displayed=initial_params.displayed;self.dist=initial_params.dist;self.dist_txt=initial_params.dist_txt;self.fixed_size=initial_params.fixed_size;self.precision=initial_params.precision;self.unit=initial_params.unit;self.x=initial_params.x;self.y=initial_params.y;if(_t==initial_params.dist_txt){self.update()}else{self.resize(+_t)}}}));var box_body=d3.select(".scaleBarEditBox").select(".modal-body").style("width","295px");box_body.append("h3").html(_tr("app_page.scale_bar_edit_box.title"));var a=box_body.append("p").attr("class","line_elem2");a.append("span").html(_tr("app_page.scale_bar_edit_box.fixed_size"));a.append("input").style("float","right").attrs({id:"scale_fixed_field",type:"number"}).property("disabled",initial_params.fixed_size?null:true).property("value",+this.dist_txt).on("change",(function(){var v=convert_dist(self.unit,"km",+this.value);self.resize(v)}));a.append("input").style("float","right").attrs({type:"checkbox",checked:self.fixed_size?true:null}).on("change",(function(){if(!self.fixed_size){box_body.select("#scale_fixed_field").property("disabled",false);var v=convert_dist(self.unit,"km",+box_body.select("#scale_fixed_field").property("value"));self.fixed_size=v;self.resize(v)}else{box_body.select("#scale_fixed_field").property("disabled",true);self.fixed_size=false;self.update()}}));var b=box_body.append("p").attr("class","line_elem2");b.insert("span").html(_tr("app_page.scale_bar_edit_box.precision"));b.insert("input").attrs({id:"scale_precision",type:"number",min:0,max:6,step:1}).styles({float:"right",width:"60px"}).property("value",+self.precision).on("change",(function(){self.precision=+this.value;self.update()}));var c=box_body.append("p").attr("class","line_elem2");c.insert("span").html(_tr("app_page.scale_bar_edit_box.unit"));var unit_select=c.insert("select").style("float","right").attr("id","scale_unit").on("change",(function(){var old_unit=self.unit;var v;self.unit=this.value;if(self.fixed_size!=false){v=convert_dist(old_unit,self.unit,+self.fixed_size).toFixed(self.precision);self.fixed_size=+self.dist}else{v=convert_dist(old_unit,self.unit,+self.dist_txt).toFixed(self.precision)}box_body.select("#scale_fixed_field").property("value",+v);self.update()}));unit_select.append("option").text("km").attr("value","km");unit_select.append("option").text("m").attr("value","m");unit_select.append("option").text("mi").attr("value","mi");unit_select.node().value=self.unit;var e=box_body.append("p").attr("class","line_elem2");e.append("span").html(_tr("app_page.scale_bar_edit_box.start_end_bar"));e.append("input").style("float","right").attrs({id:"checkbox_start_end_bar",type:"checkbox"}).on("change",(function(){self.start_end_bar=self.start_end_bar!==true;self.handle_start_end_bar()}));document.getElementById("checkbox_start_end_bar").checked=self.start_end_bar},displayed:false}},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"c",(function(){return pos_lgds_elem}));__webpack_require__.d(__webpack_exports__,"a",(function(){return get_coords_snap_lines}));__webpack_require__.d(__webpack_exports__,"b",(function(){return make_red_line_snap}));var pos_lgds_elem=new Map;var get_coords_snap_lines=function get_coords_snap_lines(uid){var snap_lines={x:[],y:[]};pos_lgds_elem.forEach((function(v,k){if(k!=uid){snap_lines.y.push([v.top+v.height,v.top],[v.top,v.top+v.height]);snap_lines.x.push([v.left,v.left+v.width],[v.left+v.width,v.left])}}));return snap_lines};var make_red_line_snap=function make_red_line_snap(x1,x2,y1,y2){var timeout=arguments.length>4&&arguments[4]!==undefined?arguments[4]:750;var current_timeout;return function(){if(current_timeout){clearTimeout(current_timeout)}map.select(".snap_line").remove();var line=map.append("line").attrs({x1,x2,y1,y2,class:"snap_line"}).styles({stroke:"red","stroke-width":.7});current_timeout=setTimeout((function(){line.remove()}),timeout)}()}},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",(function(){return button_replace}));__webpack_require__.d(__webpack_exports__,"e",(function(){return button_trash}));__webpack_require__.d(__webpack_exports__,"a",(function(){return button_legend}));__webpack_require__.d(__webpack_exports__,"g",(function(){return button_zoom_fit}));__webpack_require__.d(__webpack_exports__,"d",(function(){return button_table}));__webpack_require__.d(__webpack_exports__,"f",(function(){return button_type}));__webpack_require__.d(__webpack_exports__,"c",(function(){return button_result_type}));__webpack_require__.d(__webpack_exports__,"h",(function(){return eye_open0}));__webpack_require__.d(__webpack_exports__,"i",(function(){return sys_run_button}));__webpack_require__.d(__webpack_exports__,"j",(function(){return sys_run_button_t2}));var button_replace=' ';var button_trash=' ';var button_legend=' ';var button_zoom_fit=' ';var button_table=' ';var button_type=new Map([["Point",' '],["Line",' '],["Polygon",' ']]);var button_result_type=new Map([["flow",' '],["symbol",' '],["grid",' '],["propchoro",' '],["typo",' '],["discont",' '],["cartogram",' '],["label",' '],["choro",' '],["smooth",' '],["prop",' '],["waffle",' ']]);var eye_open0=' ';var sys_run_button=' ';var sys_run_button_t2=' '},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return northArrow}));var _context_menu__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(16);var _dialogs__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4);var _helpers_math__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1);var _interface__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(3);var _legend__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(7);var _snap_lines__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(13);var northArrow={display:function display(x,y){var _this=this;var x_pos=x||w-100,y_pos=y||h-100,self=this;var arrow_gp=map.append("g").attrs({id:"north_arrow",class:"legend",scale:1,rotate:null}).style("cursor","all-scroll");this.svg_node=arrow_gp;this.displayed=true;this.arrow_img=arrow_gp.insert("image").attrs({x:x_pos,y:y_pos,height:"30px",width:"30px"}).attr("xlink:href","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABVCAYAAAD5cuL2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAVjwAAFY8BlpPm3wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAWvSURBVHic7ZxtiFVFGMd/e3W3dJdyFWpVSipcYiNrMYhACWspKLOICqPCKOyF7EXK0sIMytKSIoperKg2I+lDEJYIQWC1RAW1ZST2IlHZi1qxYi+7dO7twzNn773nnnPuOWfOzNxd7x/OhztnZp7//M+cmXmemXOhiSaaMICbge8C18KEZa8LKXuaAY4ATDRUbydwfCBtI3AS8GedslNCyh6eE68aFExVHILpwMMW7SWCTQEArgXOsWwzFrYFaEFehQ7LdiNhWwCAWcBaB3ZD4UIAgGXAfEe2q+BKgALwPDDJkf0qIrbwe+B3N7DGov1Q2BRgBTASSLsdg4ucJLApwA7goUDaROAFoM0ijyrYHgMeRISoxBxgpWUeo7AtwAiwBPgvkH4PcLJlLoCbWeAz4LFAWhvwMuZ8k0i4mgZXAzsDab3AbbaJuBJgGPELioH0B4ATbRJxJQDAh8DTgbTDkDHCGlwKAHAXsDuQZpWTawH+ApYCJVcEXAsA8C7wkivjjSAAwHLgJxeGG0WAIeBGF4YbRQCAt4DNto02kgAg4fS9Ng2aWnoOAOsDab+G5GtHZgIf+4ErgL5APifjgw2sBc52TcIVjkP8gY+RaPEhh1eBb5FF0CWOuVjHKYBHWYBvgFanjCzjbaThvgAl4AanjCxiHuVGVwrwGzIrWMUE2waBfmQHeAeyLzBVpbcDfwPvO+BkDQuRp70S2EZ1DygCB4GjnLEzjAISD/wZmEytAP71qCuCpnEl0kDf6YkSYITaAxJjHq1IY3dT3gSJEqCIRIjHFW5CGnd5RVqUAL4IvZY5GsMkxJn5gmrvM04AD9hql6Y53I006rxAepwA/nWWPZpmMAXZFg+b2+sJ4DEOHKX1SGPODLmXpAeUgIutMDWA6UiwY0vE/SQCeIijZH3PMA88gzTg1Ij7SXtACTk9OqYwG1nQvBKTJ6kAHhJOs+4o6eA1RIATYvKk6QElYJVBvrliDvLUnqyTL40AReAAMM0M5XyxFXFrZ9bJl7YHlIANZijnh/kI0SQnQbMIMAwcmzvrHDGAHIefWi8j2QQoAi/mzjonLEJI3pkwfxYBfBGiplZnKACDlIMdSZBVAA/ZR2woXIWQuz5FmawC+NeCnLhrww92fE262L6OAA3lKC1DSC1OWU63B5SAi/Tp66Ed+AX4nPRb7boCeEiv03KUdM8HLAe6kNNewTN/plFAfI6rLdsdRSfwB/BexvJ5vAIe0gOTzjw10OkBqxARnJ30Rvh3ISdLrGIGEux4U6OOPHqAvzAaIqOjlLUHrEG+5rw3Y/k80QIcgYxDVuAHO/o168mrB/iXNUdpszKmu321nXwFKCKf3xhFrzL0hEYdc5HGl5DV3D+qzjxE8JAPtI1hG7KF3ZWh7AzgWeRzmYPAfcg4MlOle+rSFUBnYI6FH+y4P2W5ycgAdQAh2A8cHZKvB/Hy/IboCDEvJcdEGEAWPp0J87cAlwLfK1LvIPHCeuhDltZZhfCAj8jZUbpQVX5HwvwLgE9VmZ2IEGlQUGV+oDzApRViUUqbsWQGgT3UX3LOBl5XBPYDt6LnrFS+Pml7wS5N26NYoipdGpOnE1gH/ItMkY8DR+ZhXGGaqn+EdL3hGl3DbcifmEQFO1qRbau9yuAWzB5v6UZ6WJH644NHuhBdKG5RlV0Wcq8P+FLd/wS7/wdwOvAByQbKFVmNdCB7coNU+ww9yOZHCfgR6QGuvju4AOmhUUL4jlKSMH0NVqtKzlW/wxYyzv8AgfJruI/oGWNd2kr9YMd2yiPxEOWFTJaVoGl0IA9lmFoRhoFj0lT2iCr4FNLN0yxkXGMWsInagfK5pBX4wQ6/4C7SL2QaAXORbxIrZ4WeJAU3qgL7kJD3WD/Hfz7wFdKmN+pl7kae/gbkhNd4wQRkIbcHOCMu42LiT3WMdbRT+0VaE00cyvgfEKvQLuWtHAIAAAAASUVORK5CYII=");this.drag_behavior=d3.drag().subject((function(){var t=d3.select(this.querySelector("image"));var snap_lines=Object(_snap_lines__WEBPACK_IMPORTED_MODULE_5__["a"])(this.id);return{x:+t.attr("x"),y:+t.attr("y"),map_locked:!!map_div.select("#hand_button").classed("locked"),snap_lines}})).on("start",(function(){d3.event.sourceEvent.stopPropagation();Object(_interface__WEBPACK_IMPORTED_MODULE_3__["j"])("lock")})).on("end",(function(){if(d3.event.subject&&!d3.event.subject.map_locked){Object(_interface__WEBPACK_IMPORTED_MODULE_3__["j"])("unlock")}_snap_lines__WEBPACK_IMPORTED_MODULE_5__["c"].set(this.id,get_bounding_rect(this))})).on("drag",(function(){d3.event.sourceEvent.preventDefault();var t1=this.querySelector("image"),t2=this.querySelector("rect"),dim=t2.width.baseVal.value/2;var tx=+d3.event.x,ty=+d3.event.y;if(tx<0-dim||tx>w+dim||ty<0-dim||ty>h+dim){return}t1.x.baseVal.value=tx;t1.y.baseVal.value=ty;t2.x.baseVal.value=tx-7.5;t2.y.baseVal.value=ty-7.5;self.x_center=tx-7.5+dim;self.y_center=ty-7.5+dim;if(_app.autoalign_features){var _bbox=get_bounding_rect(t2),xmin=t2.x.baseVal.value,xmax=xmin+_bbox.width,ymin=t2.y.baseVal.value,ymax=ymin+_bbox.height,snap_lines_x=d3.event.subject.snap_lines.x,snap_lines_y=d3.event.subject.snap_lines.y;for(var i=0;i0;i--){if(this.items[i].name.valueOf()===name.valueOf()){this.items.splice(i,1);break}}};this.setItems=function setItems(items){this.items=[];for(var i=0;i30){swal(_tr("app_page.common.error"),_tr("app_page.common.".concat(error_name)),"error")["catch"](swal.noop);return null}var ids=[];for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:{};if(document.body.style.cursor==="not-allowed"){return}if(selected_feature==="text_annot"){var existing_annotation=document.getElementsByClassName("txt_annot");var existing_id=[];var new_id;if(existing_annotation){existing_id=Array.prototype.map.call(existing_annotation,(function(elem){return+elem.id.split("text_annotation_")[1]}))}for(var i=0;i<50;i++){if(existing_id.indexOf(i)===-1){existing_id.push(i);new_id=["text_annotation_",i].join("");break}}if(!new_id){swal("".concat(_tr("app_page.common.error"),"!"),_tr("app_page.common.error_max_text_annot"),"error");return}handleClickTextBox(new_id)}else if(selected_feature==="sphere"){var layer_to_add=Object(_function__WEBPACK_IMPORTED_MODULE_8__["a"])(options.layer_name||"Sphere");var layer_id=encodeId(layer_to_add);var fill=options.fill||"#add8e6";var fill_opacity=options.fill_opacity||.2;var stroke_width=options.stroke_width||"0.5px";var stroke_opacity=options.stroke_opacity||1;var stroke=options.stroke||"#ffffff";_app.layer_to_id.set(layer_to_add,layer_id);_app.id_to_layer.set(layer_id,layer_to_add);data_manager.current_layers[layer_to_add]={sphere:true,type:"Polygon",n_features:1,"stroke-width-const":+stroke_width.slice(0,-2),fill_color:{single:fill}};map.append("g").attrs({id:layer_id,class:"layer"}).styles({"stroke-width":stroke_width}).append("path").datum({type:"Sphere"}).styles({fill,"fill-opacity":fill_opacity,"stroke-opacity":stroke_opacity,stroke}).attrs({d:path});if(Object(_projections__WEBPACK_IMPORTED_MODULE_14__["h"])(_app.current_proj_name.toLowerCase())){map.select("g#".concat(layer_id)).attr("clip-path","url(#clip)")}Object(_helpers__WEBPACK_IMPORTED_MODULE_9__["f"])(layer_to_add,null,"Polygon","sample");alertifyjs__WEBPACK_IMPORTED_MODULE_0___default.a.notify(_tr("app_page.notification.success_sphere_added"),"success",5);Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_13__["j"])();Object(_interface__WEBPACK_IMPORTED_MODULE_11__["r"])(layer_id)}else if(selected_feature==="graticule"){if(data_manager.current_layers.Graticule!==undefined)return;var _stroke=options.stroke||"#808080";var _stroke_width=options.stroke_width||"1px";var _stroke_opacity=options.stroke_opacity||1;var stroke_dasharray=options.stroke_dasharray||5;var step=options.step||10;var graticule=d3.geoGraticule().step([step,step]);var extent;if(options.extent){if(options.extent instanceof Array){extent=options.extent}else{var bbox_layer=_target_layer_file.bbox;extent=[[Object(_helpers_math__WEBPACK_IMPORTED_MODULE_10__["f"])((bbox_layer[0]-10)/10)*10,Object(_helpers_math__WEBPACK_IMPORTED_MODULE_10__["f"])((bbox_layer[1]-10)/10)*10],[Object(_helpers_math__WEBPACK_IMPORTED_MODULE_10__["f"])((bbox_layer[2]+10)/10)*10,Object(_helpers_math__WEBPACK_IMPORTED_MODULE_10__["f"])((bbox_layer[3]+10)/10)*10]]}graticule=graticule.extent(extent)}var _layer_to_add="Graticule";var _layer_id=encodeId(_layer_to_add);_app.layer_to_id.set(_layer_to_add,_layer_id);_app.id_to_layer.set(_layer_id,_layer_to_add);map.insert("g",".legend").attrs({id:_layer_id,class:"layer"}).styles({"stroke-width":_stroke_width}).append("path").datum(graticule).attrs({d:path,class:"graticule"}).styles({"stroke-dasharray":stroke_dasharray,fill:"none",stroke:_stroke});data_manager.current_layers.Graticule={dasharray:stroke_dasharray,extent,fill_color:{single:_stroke},graticule:true,n_features:1,opacity:_stroke_opacity,step,"stroke-width-const":+_stroke_width.slice(0,-2),type:"Line"};if(Object(_projections__WEBPACK_IMPORTED_MODULE_14__["h"])(_app.current_proj_name.toLowerCase())){map.select("g#".concat(_layer_id)).attr("clip-path","url(#clip)")}Object(_helpers__WEBPACK_IMPORTED_MODULE_9__["f"])("Graticule",null,"Line","sample");alertifyjs__WEBPACK_IMPORTED_MODULE_0___default.a.notify(_tr("app_page.notification.success_graticule_added"),"success",5);Object(_legend__WEBPACK_IMPORTED_MODULE_12__["m"])();Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_13__["j"])()}else if(selected_feature==="scale"){if(!_scalebar__WEBPACK_IMPORTED_MODULE_5__["a"].displayed){handleClickAddOther("scalebar")}else{ask_existing_feature("scalebar").then((function(){_scalebar__WEBPACK_IMPORTED_MODULE_5__["a"].remove();handleClickAddOther("scalebar")}),(function(){return null}))}}else if(selected_feature==="north_arrow"){if(!_north_arrow__WEBPACK_IMPORTED_MODULE_3__["a"].displayed){handleClickAddOther("north_arrow")}else{ask_existing_feature("north_arrow").then((function(){_north_arrow__WEBPACK_IMPORTED_MODULE_3__["a"].remove();handleClickAddOther("north_arrow")}),(function(){return null}))}}else if(selected_feature==="arrow"){handleClickAddArrow()}else if(selected_feature==="ellipse"){handleClickAddEllipse()}else if(selected_feature==="rectangle"){handleClickAddRectangle()}else if(selected_feature==="symbol"){handleClickAddPicto()}else{swal("".concat(_tr("app_page.common.error"),"!"),_tr("app_page.common.error"),"error")}}function add_single_symbol(symbol_dataurl,x,y){var width=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"30";var height=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"30";var symbol_id=arguments.length>5&&arguments[5]!==undefined?arguments[5]:null;var context_menu=new _context_menu__WEBPACK_IMPORTED_MODULE_7__["a"];var getItems=function getItems(self_parent){return[{name:_tr("app_page.common.options"),action:function action(){Object(_symbols_picto__WEBPACK_IMPORTED_MODULE_15__["c"])(self_parent)}},{name:_tr("app_page.common.up_element"),action:function action(){Object(_legend__WEBPACK_IMPORTED_MODULE_12__["l"])(self_parent.parentElement)}},{name:_tr("app_page.common.down_element"),action:function action(){Object(_legend__WEBPACK_IMPORTED_MODULE_12__["h"])(self_parent.parentElement)}},{name:_tr("app_page.common.delete"),action:function action(){self_parent.parentElement.remove()}}]};return map.append("g").attrs({class:"legend single_symbol",id:symbol_id}).insert("image").attrs({x:x||w/2,y:y||h/2,width,height,"xlink:href":symbol_dataurl}).on("mouseover",(function(){this.style.cursor="pointer"})).on("mouseout",(function(){this.style.cursor="initial"})).on("dblclick contextmenu",(function(){context_menu.showMenu(d3.event,document.querySelector("body"),getItems(this))})).call(_helpers__WEBPACK_IMPORTED_MODULE_9__["h"])}},,function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",(function(){return add_sample_layer}));__webpack_require__.d(__webpack_exports__,"a",(function(){return add_layer_topojson}));var proj4__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(22);var topojson__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(25);var _colors_helpers__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6);var _dialogs__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4);var _function__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(9);var _helpers__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(0);var _join_popup__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(36);var _map_ctrl__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(5);var _projections__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(11);var _interface__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(3);function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function add_sample_layer(){var prepare_extra_dataset_availables=function prepare_extra_dataset_availables(){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["w"])("GET","extrabasemaps").then((function(result){_app.list_extrabasemaps=JSON.parse(result.target.responseText).filter((function(elem){return elem[0]!=="Tunisia"}))}))};Object(_dialogs__WEBPACK_IMPORTED_MODULE_3__["a"])(".sampleDialogBox");if(!_app.list_extrabasemaps){prepare_extra_dataset_availables()}var selec;var selec_url;var content;Object(_dialogs__WEBPACK_IMPORTED_MODULE_3__["b"])("sampleDialogBox",_tr("app_page.sample_layer_box.title")).then((function(confirmed){if(confirmed){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["c"])().then((function(_type_layer){var target_layer=_type_layer.indexOf("target")>-1;if(content.attr("id")==="panel1"){if(selec){var layer_info=_app.sample_layers.find((function(_o){return _o.name===selec}));add_sample_geojson(selec,{target_layer_on_add:target_layer,fields_type:layer_info["fields_type"],default_projection:layer_info["suggested_projection"]})}}else if(content.attr("id")==="panel2"){var formToSend=new FormData;formToSend.append("url",selec_url[1]);formToSend.append("layer_name",selec_url[0]);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["B"])("POST","/convert_extrabasemap",formToSend,true).then((function(data){add_layer_topojson(data,{target_layer_on_add:target_layer})}),(function(){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])()}))}}),(function(dismiss){console.log(dismiss)}))}}));function make_panel2(){box_body.selectAll("div").remove();content=box_body.append("div").attr("id","panel2");content.append("h3").html(_tr("app_page.sample_layer_box.subtitle1"));content.append("p").append("span").html(_tr("app_page.sample_layer_box.extra_basemaps_info"));var select_extrabasemap=content.append("p").insert("select").on("change",(function(){var id_elem=this.value;selec_url=[_app.list_extrabasemaps[id_elem][0],_app.list_extrabasemaps[id_elem][1],id_elem]}));for(var i=0,len_i=_app.list_extrabasemaps.length;i1&&arguments[1]!==undefined?arguments[1]:{};var _isValidJSON=Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["r"])(text),_isValidJSON2=_slicedToArray(_isValidJSON,2),valid=_isValidJSON2[0],parsedJSON=_isValidJSON2[1];if(!valid){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])("Unable to load the layer");return}if(parsedJSON.Error){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])(parsedJSON.Error);return}var result_layer_on_add=options.result_layer_on_add?true:false,target_layer_on_add=options.target_layer_on_add?true:false,skip_alert=options.skip_alert?true:false,skip_rescale=options.skip_rescale===true?true:false,fields_type=options.fields_type?options.fields_type:undefined;var topoObj=parsedJSON.file.transform?parsedJSON.file:topojson__WEBPACK_IMPORTED_MODULE_1__["quantize"](parsedJSON.file,1e5);var layers_names=Object.getOwnPropertyNames(topoObj.objects);var random_color1=_colors_helpers__WEBPACK_IMPORTED_MODULE_2__["b"].random();var lyr_name=layers_names[0];var lyr_name_to_add=Object(_function__WEBPACK_IMPORTED_MODULE_4__["a"])(options.choosed_name?options.choosed_name:lyr_name);var lyr_id=encodeId(lyr_name_to_add);var nb_ft=topoObj.objects[lyr_name].geometries.length;var topoObj_objects=topoObj.objects[lyr_name];var data_to_load=false;var type,_proj;if(layers_names.length>1){swal("",_tr("app_page.common.warning_multiple_layers"),"warning")}if(!topoObj_objects.geometries||topoObj_objects.geometries.length===0){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])(_tr("app_page.common.error_invalid_empty"));return}_app.layer_to_id.set(lyr_name_to_add,lyr_id);_app.id_to_layer.set(lyr_id,lyr_name_to_add);for(var _t_ix=0;_t_ix-1)type="Point";else if(topoObj_objects.geometries[_t_ix].type.indexOf("LineString")>-1)type="Line";else if(topoObj_objects.geometries[_t_ix].type.indexOf("Polygon")>-1)type="Polygon";break}}if(!type){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["g"])(_tr("app_page.common.error_invalid_empty"));return}if(data_manager.current_layers.World&&data_manager.current_layers.World.default_layer){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["p"])("World")}if(parsedJSON.proj){try{_proj=Object(proj4__WEBPACK_IMPORTED_MODULE_0__["default"])(parsedJSON.proj)}catch(e){_proj=undefined;console.log(e)}}data_manager.current_layers[lyr_name_to_add]={type,n_features:nb_ft,"stroke-width-const":type==="Line"?1.5:.4,fill_color:{single:random_color1},key_name:parsedJSON.key};if(target_layer_on_add){data_manager.current_layers[lyr_name_to_add].targeted=true;data_manager.user_data[lyr_name_to_add]=[];data_to_load=true;data_manager.current_layers[lyr_name_to_add].fields_type=[]}else if(result_layer_on_add){data_manager.result_data[lyr_name_to_add]=[];data_manager.current_layers[lyr_name_to_add].is_result=true}var field_names=topoObj_objects.geometries[0].properties?Object.getOwnPropertyNames(topoObj_objects.geometries[0].properties):[];var path_to_use=options.pointRadius?path.pointRadius(options.pointRadius):path;var nb_fields=field_names.length;topoObj_objects.geometries.forEach((function(d,ix){if(data_to_load&&nb_fields>0){if(d.id!==undefined&&d.id!==ix){d.properties._uid=d.id;d.id=+ix}else if(!d.id){d.id=+ix}data_manager.user_data[lyr_name_to_add].push(d.properties)}else if(data_to_load){d.properties.id=d.id=ix;data_manager.user_data[lyr_name_to_add].push({id:d.properties.id})}else if(result_layer_on_add){data_manager.result_data[lyr_name_to_add].push(d.properties)}}));var func_data_idx=function func_data_idx(_,ix){return"feature_".concat(ix)};map.insert("g",".legend").attrs({id:lyr_id,class:data_to_load?"targeted_layer layer":"layer"}).styles({"stroke-linecap":"round","stroke-linejoin":"round"}).selectAll(".subunit").data(topojson__WEBPACK_IMPORTED_MODULE_1__["feature"](topoObj,topoObj_objects).features,(function(d){return d.id})).enter().append("path").attrs({d:path_to_use,id:func_data_idx}).styles({stroke:type!=="Line"?"rgb(0, 0, 0)":random_color1,"stroke-opacity":1,fill:type!=="Line"?random_color1:null,"fill-opacity":type!=="Line"?.9:0});d3.select("#layer_to_export").append("option").attr("value",lyr_name_to_add).text(lyr_name_to_add);Object(_interface__WEBPACK_IMPORTED_MODULE_9__["x"])();if(target_layer_on_add){data_manager.current_layers[lyr_name_to_add].original_fields=new Set(Object.getOwnPropertyNames(data_manager.user_data[lyr_name_to_add][0]));if(data_manager.joined_dataset.length!==0){Object(_join_popup__WEBPACK_IMPORTED_MODULE_6__["b"])(false)}Object(_interface__WEBPACK_IMPORTED_MODULE_9__["w"])(type,nb_fields,nb_ft,lyr_name_to_add);Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["f"])(lyr_name_to_add,nb_ft,type,"target");_app.targeted_layer_added=true;window._target_layer_file=topoObj;if(!skip_rescale){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["q"])(lyr_name_to_add);Object(_interface__WEBPACK_IMPORTED_MODULE_9__["f"])(lyr_name_to_add)}if(_app.current_functionnality!==undefined){fields_handler.fill(lyr_name_to_add)}Object(_interface__WEBPACK_IMPORTED_MODULE_9__["j"])("lock");document.getElementById("button_grid").setAttribute("data-i18n",type==="Point"?"[title]app_page.func_description.grid_point":"[title]app_page.func_description.grid");localize("#button_grid")}else if(result_layer_on_add){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["f"])(lyr_name_to_add,nb_ft,[type,options.func_name],"result")}else{Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["f"])(lyr_name_to_add,nb_ft,type,"")}if(!target_layer_on_add&&_app.current_functionnality!==undefined&&(_app.current_functionnality.name==="smooth"||_app.current_functionnality.name==="grid")){fields_handler.fill()}if(type==="Point"){data_manager.current_layers[lyr_name_to_add].pointRadius=options.pointRadius||path.pointRadius()}Object(_projections__WEBPACK_IMPORTED_MODULE_8__["f"])(_app.current_proj_name);Object(_interface__WEBPACK_IMPORTED_MODULE_9__["e"])(lyr_name_to_add);if(!skip_rescale){Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_7__["j"])()}if(!skip_alert){if(fields_type){data_manager.current_layers[lyr_name_to_add].fields_type=fields_type}if(_proj===undefined){swal({title:"",text:_tr("app_page.common.layer_success"),allowOutsideClick:true,allowEscapeKey:true,type:"success"}).then((function(){if(target_layer_on_add&&data_manager.joined_dataset.length>0){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["d"])(lyr_name_to_add)}else if(target_layer_on_add){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["s"])(lyr_name_to_add)}}),(function(){if(target_layer_on_add&&data_manager.joined_dataset.length>0){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["d"])(lyr_name_to_add)}else if(target_layer_on_add){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["s"])(lyr_name_to_add)}}))}else{swal({title:"",text:_tr("app_page.common.layer_success_and_proj"),showCancelButton:true,showCloseButton:false,allowEscapeKey:true,allowOutsideClick:true,type:"success"}).then((function(){_app.last_projection=parsedJSON.proj;_app.current_proj_name="def_proj4";Object(_projections__WEBPACK_IMPORTED_MODULE_8__["d"])(_proj);var custom_name=Object(_projections__WEBPACK_IMPORTED_MODULE_8__["j"])(_app.last_projection);Object(_projections__WEBPACK_IMPORTED_MODULE_8__["a"])("def_proj4",_app.last_projection,custom_name);if(target_layer_on_add&&data_manager.joined_dataset.length>0){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["d"])(lyr_name_to_add)}else if(target_layer_on_add){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["s"])(lyr_name_to_add)}}),(function(){if(target_layer_on_add&&data_manager.joined_dataset.length>0){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["d"])(lyr_name_to_add)}else if(target_layer_on_add){Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["s"])(lyr_name_to_add)}}))}}if(options.default_projection){data_manager.current_layers[lyr_name_to_add].default_projection=options.default_projection;if(options.target_layer_on_add){if(options.default_projection[0]==="proj4"){var proj_str=options.default_projection[1];var custom_name;if(proj_str.startsWith("EPSG:")){var code=+proj_str.split("EPSG:")[1];var rv=_app.epsg_projections[code];proj_str=rv.proj4;custom_name=rv.name}_app.current_proj_name="def_proj4";_app.last_projection=proj_str;Object(_projections__WEBPACK_IMPORTED_MODULE_8__["d"])(Object(proj4__WEBPACK_IMPORTED_MODULE_0__["default"])(proj_str));Object(_projections__WEBPACK_IMPORTED_MODULE_8__["a"])("def_proj4",_app.last_projection,custom_name)}else if(options.default_projection[0]==="d3"){_app.current_proj_name=options.default_projection[1];Object(_projections__WEBPACK_IMPORTED_MODULE_8__["c"])(options.default_projection[1]);Object(_projections__WEBPACK_IMPORTED_MODULE_8__["a"])(_app.current_proj_name)}}}else if(parsedJSON.proj){data_manager.current_layers[lyr_name_to_add].default_projection=["proj4",parsedJSON.proj]}return lyr_name_to_add}},,,function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return available_fonts}));__webpack_require__.d(__webpack_exports__,"b",(function(){return custom_fonts}));var available_fonts=[["Arial","Arial,sans-serif"],["Arial Black","Arial Black,sans-serif"],["Arimo","Arimo,sans-serif"],["Baloo Bhaina","Baloo Bhaina,sans-serif"],["Bitter","Bitter,sans-serif"],["Dosis","Dosis,sans-serif"],["Impact","Impact,Charcoal,sans-serif"],["Inconsolata","Inconsolata,sans-serif"],["Georgia","Georgia,serif"],["Lobster","Lobster,serif"],["Lucida","Lucida Sans Unicode,Lucida Grande,sans-serif"],["Palatino","Palatino Linotype,Book Antiqua,Palatino,serif"],["Roboto","Roboto"],["Scope One","Scope One"],["Tahoma","Tahoma,Geneva,sans-serif"],["Trebuchet MS","Trebuchet MS,elvetica,sans-serif"],["Verdana","verdana"]];var custom_fonts=["Arimo","Baloo Bhaina","Bitter","Dosis","Inconsolata","Lobster","Roboto","Scope One"]},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(Promise,global){__webpack_require__.d(__webpack_exports__,"c",(function(){return handle_click_layer}));__webpack_require__.d(__webpack_exports__,"d",(function(){return make_style_box_indiv_label}));__webpack_require__.d(__webpack_exports__,"a",(function(){return createDropShadow}));__webpack_require__.d(__webpack_exports__,"b",(function(){return handleEdgeShapeRendering}));var _colors_helpers__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6);var _dialogs__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4);var _classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(26);var _classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(29);var _classification_discrtiz_links_discont__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(47);var _fonts__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(23);var _function__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9);var _helpers__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(0);var _helpers_calc__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(2);var _interface__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(3);var _legend__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(7);var _map_ctrl__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(5);var _tables__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(33);function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){if(!(Symbol.iterator in Object(arr)||Object.prototype.toString.call(arr)==="[object Arguments]")){return}var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function handle_click_layer(layer_name){if(data_manager.current_layers[layer_name].graticule){createStyleBoxGraticule()}else if(data_manager.current_layers[layer_name].type==="Line"){createStyleBox_Line(layer_name)}else if(data_manager.current_layers[layer_name].renderer&&data_manager.current_layers[layer_name].renderer.indexOf("PropSymbol")>-1){createStyleBox_ProbSymbol(layer_name)}else if(data_manager.current_layers[layer_name].renderer&&data_manager.current_layers[layer_name].renderer==="Label"){createStyleBoxLabel(layer_name)}else if(data_manager.current_layers[layer_name].renderer&&data_manager.current_layers[layer_name].renderer==="TypoSymbols"){createStyleBoxTypoSymbols(layer_name)}else if(data_manager.current_layers[layer_name].renderer&&data_manager.current_layers[layer_name].renderer==="TwoStocksWaffle"){createStyleBoxWaffle(layer_name)}else if(data_manager.current_layers[layer_name].renderer==="Stewart"){createStyleBoxStewart(layer_name)}else{createStyleBox(layer_name)}}function make_single_color_menu(layer,fill_prev){var symbol=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"path";var fill_color_section=d3.select("#fill_color_section"),g_lyr_name="#".concat(_app.layer_to_id.get(layer)),last_color=fill_prev&&fill_prev.single?fill_prev.single:"#FFF";var block=fill_color_section.insert("p");block.insert("span").html(_tr("app_page.layer_style_popup.fill_color"));block.insert("input").attr("type","color").style("float","right").property("value",last_color).on("change",(function(){map.select(g_lyr_name).selectAll(symbol).transition().style("fill",this.value);data_manager.current_layers[layer].fill_color={single:this.value}}));map.select(g_lyr_name).selectAll(symbol).transition().style("fill",last_color);data_manager.current_layers[layer].fill_color={single:last_color}}function make_random_color(layer){var symbol=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"path";var block=d3.select("#fill_color_section");block.insert("p").styles({cursor:"pointer","text-align":"center",margin:"auto !important"}).insert("span").attr("id","random_color_btn").html(_tr("app_page.layer_style_popup.toggle_colors")).on("click",(function(){map.select("#".concat(_app.layer_to_id.get(layer))).selectAll(symbol).transition().style("fill",(function(){return Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["f"])()}));data_manager.current_layers[layer].fill_color={random:true}}))}function fill_categorical(layer,field_name,symbol,color_cat_map){map.select("#".concat(_app.layer_to_id.get(layer))).selectAll(symbol).transition().style("fill",(function(d){return color_cat_map.get(d.properties[field_name])}))}function make_categorical_color_menu(fields,layer,fill_prev){var symbol=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"path";var fill_color_section=d3.select("#fill_color_section").append("p");fill_color_section.insert("span").html(_tr("app_page.layer_style_popup.categorical_field"));var field_selec=fill_color_section.insert("select").styles({display:"inline",float:"right"});fields.forEach((function(field){if(field!=="id")field_selec.append("option").text(field).attr("value",field)}));if(fill_prev.categorical&&fill_prev.categorical instanceof Array){Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["y"])(field_selec.node(),fill_prev.categorical[0])}field_selec.on("change",(function(){var field_name=this.value,data_layer=data_manager.current_layers[layer].is_result?data_manager.result_data[layer]:data_manager.user_data[layer],values=data_layer.map((function(i){return i[field_name]})),cats=new Set(values),txt=[cats.size," cat."].join("");d3.select("#nb_cat_txt").html(txt);var color_cat_map=new Map;Array.from(cats.keys()).forEach((function(val){color_cat_map.set(val,_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].names[_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].random()])}));data_manager.current_layers[layer].fill_color={categorical:[field_name,color_cat_map]};fill_categorical(layer,field_name,symbol,color_cat_map)}));if((!fill_prev||!fill_prev.categorical)&&field_selec.node().options.length>0){Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["y"])(field_selec.node(),field_selec.node().options[0].value)}fill_color_section.append("span").attr("id","nb_cat_txt").html("")}function make_change_layer_name_section(parent,layer_name){var section=parent.insert("p").attr("class","inp_bottom");section.append("span").html(_tr("app_page.layer_style_popup.layer_name"));var inpt=section.append("input").attrs({id:"lyr_change_name",type:"text"}).styles({width:"200px",float:"left"});inpt.node().value=layer_name;return inpt}function createStyleBoxTypoSymbols(layer_name){function get_prev_settings(){var features=selection._groups[0];for(var i=0;i .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");popup.append("p").styles({"text-align":"center",color:"grey"}).html([_tr("app_page.layer_style_popup.rendered_field",{field:rendered_field}),_tr("app_page.layer_style_popup.reference_layer",{layer:ref_layer_name})].join(""));var new_layer_name=layer_name;var new_name_section=make_change_layer_name_section(popup,layer_name);new_name_section.on("change",(function(){new_layer_name=this.value}));popup.append("p").style("text-align","center").insert("button").attrs({id:"reset_symb_loc",class:"button_st4"}).text(_tr("app_page.layer_style_popup.reset_symbols_location")).on("click",(function(){selection.transition().attrs((function(d){var centroid=path.centroid(d.geometry),size_symbol=symbols_map.get(d.properties.symbol_field)[1]/2;return{x:centroid[0]-size_symbol,y:centroid[1]-size_symbol}}))}));popup.append("p").style("text-align","center").insert("button").attrs({id:"reset_symb_display",class:"button_st4"}).text(_tr("app_page.layer_style_popup.redraw_symbols")).on("click",(function(){selection.style("display",undefined)}));var size_section=popup.append("p");size_section.append("span").html(_tr("app_page.layer_style_popup.symbols_size"));size_section.append("input").attrs({min:0,max:200,step:"any",type:"number"}).styles({width:"60px",margin:"auto"}).property("value",32).on("change",(function(){var value=this.value;selection.transition().attrs((function(){var current_size=this.height.baseVal.value;return{width:"".concat(value,"px"),height:"".concat(value,"px"),x:this.x.baseVal.value+current_size/2-value/2,y:this.y.baseVal.value+current_size/2-value/2}}))}))}function createStyleBoxLabel(layer_name){function get_prev_settings(){var features=selection._groups[0];prev_settings=[];for(var i=0;i .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");popup.append("p").styles({"text-align":"center",color:"grey"}).html([_tr("app_page.layer_style_popup.rendered_field",{field:data_manager.current_layers[layer_name].rendered_field}),_tr("app_page.layer_style_popup.reference_layer",{layer:ref_layer_name})].join(""));var new_layer_name=layer_name;var new_name_section=make_change_layer_name_section(popup,layer_name);new_name_section.on("change",(function(){new_layer_name=this.value}));popup.append("p").style("text-align","center").insert("button").attrs({id:"reset_labels_loc",class:"button_st4"}).text(_tr("app_page.layer_style_popup.reset_labels_location")).on("click",(function(){selection.transition().attrs((function(d){var coords=path.centroid(d.geometry);return{x:coords[0],y:coords[1]}}))}));popup.append("p").style("text-align","center").insert("button").attrs({id:"reset_labels_display",class:"button_st4"}).text(_tr("app_page.layer_style_popup.redraw_labels")).on("click",(function(){selection.style("display",undefined)}));popup.insert("p").styles({"text-align":"center","font-size":"9px"}).html(_tr("app_page.layer_style_popup.overrride_warning"));var label_sizes=popup.append("p").attr("class","line_elem");label_sizes.append("span").html(_tr("app_page.layer_style_popup.labels_default_size"));label_sizes.insert("span").style("float","right").html(" px");label_sizes.insert("input").attr("type","number").styles({float:"right",width:"70px"}).property("value",+data_manager.current_layers[layer_name].default_size.replace("px","")).on("change",(function(){var size="".concat(this.value,"px");data_manager.current_layers[layer_name].default_size=size;selection.style("font-size",size)}));var default_color=popup.insert("p").attr("class","line_elem");default_color.append("span").html(_tr("app_page.layer_style_popup.labels_default_color"));default_color.insert("input").attr("type","color").style("float","right").property("value",data_manager.current_layers[layer_name].fill_color).on("change",(function(){data_manager.current_layers[layer_name].fill_color=this.value;selection.transition().style("fill",this.value)}));var font_section=popup.insert("p").attr("class","line_elem");font_section.append("span").html(_tr("app_page.layer_style_popup.labels_default_font"));var choice_font=font_section.insert("select").style("float","right").on("change",(function(){data_manager.current_layers[layer_name].default_font=this.value;selection.transition().style("font-family",this.value)}));_fonts__WEBPACK_IMPORTED_MODULE_5__["a"].forEach((function(name){choice_font.append("option").attr("value",name[1]).text(name[0])}));choice_font.node().value=data_manager.current_layers[layer_name].default_font}function createStyleBoxGraticule(layer_name){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["a"])(".styleBox");var current_params=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["c"])(data_manager.current_layers.Graticule);var selection=map.select("#L_Graticule > path");var selection_strokeW=map.select("#L_Graticule");Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["b"])("styleBox",layer_name,{top:true,widthFitContent:true,draggable:true}).then((function(confirmed){if(confirmed){return null}else{return null}}));var container=document.querySelector(".twbs > .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");var color_choice=popup.append("p").attr("class","line_elem");color_choice.append("span").html(_tr("app_page.layer_style_popup.color"));color_choice.append("input").attr("type","color").style("float","right").property("value",current_params.fill_color.single).on("change",(function(){selection.style("stroke",this.value);data_manager.current_layers.Graticule.fill_color.single=this.value}));var opacity_choice=popup.append("p").attr("class","line_elem");opacity_choice.append("span").html(_tr("app_page.layer_style_popup.opacity"));opacity_choice.append("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",current_params.opacity).on("change",(function(){selection.style("stroke-opacity",this.value);data_manager.current_layers.Graticule.opacity=+this.value;popup.select("#graticule_opacity_txt").html("".concat(+this.value*100,"%"))}));opacity_choice.append("span").attr("id","graticule_opacity_txt").style("float","right").html("".concat(current_params.opacity*100,"%"));var stroke_width_choice=popup.append("p").attr("class","line_elem");stroke_width_choice.append("span").html(_tr("app_page.layer_style_popup.width"));stroke_width_choice.append("input").attr("type","number").styles({width:"60px",float:"right"}).property("value",current_params["stroke-width-const"]).on("change",(function(){selection_strokeW.style("stroke-width",this.value);data_manager.current_layers.Graticule["stroke-width-const"]=+this.value}));var steps_choice=popup.append("p").attr("class","line_elem");steps_choice.append("span").html(_tr("app_page.layer_style_popup.graticule_steps"));steps_choice.append("input").attrs({id:"graticule_range_steps",type:"range",min:0,max:100,step:1}).styles({"vertical-align":"middle",width:"58px",display:"inline",float:"right"}).property("value",current_params.step).on("change",(function(){var next_layer=selection_strokeW.node().nextSibling;var step_val=+this.value;var dasharray_val=+document.getElementById("graticule_dasharray_txt").value;data_manager.current_layers.Graticule.step=step_val;var graticule=d3.geoGraticule().step([step_val,step_val]);if(data_manager.current_layers.Graticule.extent){graticule=graticule.extent(data_manager.current_layers.Graticule.extent)}map.select("#L_Graticule").remove();map.append("g").attrs({id:"L_Graticule",class:"layer"}).append("path").datum(graticule).attrs({class:"graticule",d:path,"clip-path":"url(#clip)"}).styles({fill:"none",stroke:data_manager.current_layers.Graticule.fill_color.single,"stroke-dasharray":dasharray_val});Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])();selection=map.select("#L_Graticule").selectAll("path");selection_strokeW=map.select("#L_Graticule");svg_map.insertBefore(selection_strokeW.node(),next_layer);popup.select("#graticule_step_txt").property("value",step_val)}));steps_choice.append("input").attrs({type:"number",min:0,max:100,step:"any",class:"without_spinner",id:"graticule_step_txt"}).styles({width:"30px","margin-left":"10px",float:"right"}).property("value",current_params.step).on("change",(function(){var grat_range=document.getElementById("graticule_range_steps");grat_range.value=+this.value;grat_range.dispatchEvent(new MouseEvent("change"))}));var dasharray_choice=popup.append("p").attr("class","line_elem");dasharray_choice.append("span").html(_tr("app_page.layer_style_popup.graticule_dasharray"));dasharray_choice.append("input").attrs({type:"range",min:0,max:50,step:.1,id:"graticule_range_dasharray"}).styles({"vertical-align":"middle",width:"58px",display:"inline",float:"right"}).property("value",current_params.dasharray).on("change",(function(){selection.style("stroke-dasharray",this.value);data_manager.current_layers.Graticule.dasharray=+this.value;popup.select("#graticule_dasharray_txt").property("value",this.value)}));dasharray_choice.append("input").attrs({type:"number",min:0,max:100,step:"any",class:"without_spinner",id:"graticule_dasharray_txt"}).styles({width:"30px","margin-left":"10px",float:"right"}).property("value",current_params.dasharray).on("change",(function(){var grat_range=document.getElementById("graticule_range_dasharray");grat_range.value=+this.value;grat_range.dispatchEvent(new MouseEvent("change"))}));if(Object.keys(data_manager.user_data).length){var clip_extent_section=popup.append("p").attr("class","line_elem");clip_extent_section.append("input").attrs({type:"checkbox",id:"clip_graticule"}).property("checked",current_params.extent?true:null).on("change",(function(){var next_layer=selection_strokeW.node().nextSibling,step_val=+document.getElementById("graticule_step_txt").value,dasharray_val=+document.getElementById("graticule_dasharray_txt").value;var graticule=d3.geoGraticule().step([step_val,step_val]);map.select("#L_Graticule").remove();if(this.checked){var bbox_layer=_target_layer_file.bbox;var extent_grat=[[Math.round((bbox_layer[0]-12)/10)*10,Math.round((bbox_layer[1]-12)/10)*10],[Math.round((bbox_layer[2]+12)/10)*10,Math.round((bbox_layer[3]+12)/10)*10]];if(extent_grat[0]<-180)extent_grat[0]=-180;if(extent_grat[1]<-90)extent_grat[1]=-90;if(extent_grat[2]>180)extent_grat[2]=180;if(extent_grat[3]>90)extent_grat[3]=90;graticule=graticule.extent(extent_grat);data_manager.current_layers.Graticule.extent=extent_grat}else{data_manager.current_layers.Graticule.extent=undefined}map.append("g").attrs({id:"L_Graticule",class:"layer"}).append("path").datum(graticule).attrs({class:"graticule",d:path,"clip-path":"url(#clip)"}).styles({fill:"none",stroke:data_manager.current_layers.Graticule.fill_color.single,"stroke-dasharray":dasharray_val});Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])();selection=map.select("#L_Graticule").selectAll("path");selection_strokeW=map.select("#L_Graticule");svg_map.insertBefore(selection_strokeW.node(),next_layer)}));clip_extent_section.append("label").attrs({for:"clip_graticule"}).html(_tr("app_page.layer_style_popup.graticule_clip"))}make_generate_labels_graticule_section(popup)}function redraw_legend(type_legend,layer_name,field){var _ref=type_legend==="choro"?[["#legend_root.lgdf_",_app.layer_to_id.get(layer_name)].join(""),_legend__WEBPACK_IMPORTED_MODULE_10__["a"]]:type_legend==="choro_horiz"?[["#legend_root_horiz.lgdf_",_app.layer_to_id.get(layer_name)].join(""),_legend__WEBPACK_IMPORTED_MODULE_10__["b"]]:type_legend==="line_class"?[["#legend_root_lines_class.lgdf_",_app.layer_to_id.get(layer_name)].join(""),_legend__WEBPACK_IMPORTED_MODULE_10__["c"]]:type_legend==="line_symbol"?[["#legend_root_lines_symbol.lgdf_",_app.layer_to_id.get(layer_name)].join(""),_legend__WEBPACK_IMPORTED_MODULE_10__["e"]]:type_legend==="waffle"?[["#legend_root_waffle.lgdf_",_app.layer_to_id.get(layer_name)].join(""),_legend__WEBPACK_IMPORTED_MODULE_10__["g"]]:type_legend==="layout"?[["#legend_root_layout.lgdf_",_app.layer_to_id.get(layer_name)].join(""),_legend__WEBPACK_IMPORTED_MODULE_10__["d"]]:undefined,_ref2=_slicedToArray(_ref,2),selector=_ref2[0],legend_func=_ref2[1];var lgd=document.querySelector(selector);if(lgd){var transform_param=lgd.getAttribute("transform"),lgd_title=lgd.querySelector("#legendtitle").innerHTML,lgd_subtitle=lgd.querySelector("#legendsubtitle").innerHTML,rounding_precision=lgd.getAttribute("rounding_precision"),note=lgd.querySelector("#legend_bottom_note").innerHTML,boxgap=lgd.getAttribute("boxgap");var rect_fill_value=lgd.getAttribute("visible_rect")==="true"?{color:lgd.querySelector("#under_rect").style.fill,opacity:lgd.querySelector("#under_rect").style.fillOpacity}:undefined;if(type_legend.indexOf("choro")>-1){var no_data_txt=lgd.querySelector("#no_data_txt");no_data_txt=no_data_txt!=null?no_data_txt.textContent:null;lgd.remove();legend_func(layer_name,field,lgd_title,lgd_subtitle,boxgap,rect_fill_value,rounding_precision,no_data_txt,note)}else if(type_legend==="waffle"){lgd.remove();legend_func(layer_name,field,lgd_title,lgd_subtitle,rect_fill_value,note)}else if(type_legend==="layout"){lgd.remove();var text_value=lgd.querySelector("g.lg.legend_0 > text").innerHTML;legend_func(layer_name,data_manager.current_layers[layer_name].type,lgd_title,lgd_subtitle,rect_fill_value,text_value,note)}else{lgd.remove();legend_func(layer_name,data_manager.current_layers[layer_name].rendered_field,lgd_title,lgd_subtitle,rect_fill_value,rounding_precision,note)}lgd=document.querySelector(selector);if(transform_param){lgd.setAttribute("transform",transform_param)}}}function createStyleBox_Line(layer_name){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["a"])(".styleBox");var renderer=data_manager.current_layers[layer_name].renderer,g_lyr_name="#".concat(_app.layer_to_id.get(layer_name)),selection=map.select(g_lyr_name).selectAll("path"),opacity=selection.style("fill-opacity");var fill_prev=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["c"])(data_manager.current_layers[layer_name].fill_color);var prev_random_colors;var prev_col_breaks;var rendering_params;if(data_manager.current_layers[layer_name].colors_breaks&&data_manager.current_layers[layer_name].colors_breaks instanceof Array){prev_col_breaks=data_manager.current_layers[layer_name].colors_breaks.concat([])}else if(fill_prev.random){prev_random_colors=[];selection.each((function(){prev_random_colors.push(this.style.stroke)}))}var border_opacity=selection.style("stroke-opacity"),stroke_width=+data_manager.current_layers[layer_name]["stroke-width-const"];var stroke_prev=selection.style("stroke");var prev_min_display,prev_size,prev_breaks;if(stroke_prev.startsWith("rgb")){stroke_prev=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["g"])(stroke_prev)}var table=[];Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll("path"),(function(d){table.push(d.__data__.properties)}));var redraw_prop_val=function redraw_prop_val(prop_values){var selec=selection._groups[0];for(var i=0,len=prop_values.length;i0;--i){colors_breaks.push([[rendering_params.breaks[i-1]," - ",rendering_params.breaks[i]].join(""),rendering_params.breaks[i-1]])}data_manager.current_layers[layer_name].colors_breaks=colors_breaks;data_manager.current_layers[layer_name].rendered_field=rendering_params.field;data_manager.current_layers[layer_name].options_disc={schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options};if(document.querySelector(".legend.legend_feature.lgdf_".concat(_app.layer_to_id.get(layer_name))).id==="legend_root"){redraw_legend("choro",layer_name,rendering_params.field)}else{redraw_legend("choro_horiz",layer_name,rendering_params.field)}}else if((renderer==="Categorical"||renderer==="PropSymbolsTypo")&&rendering_params!==undefined){data_manager.current_layers[layer_name].color_map=rendering_params.color_map;data_manager.current_layers[layer_name].fill_color={class:[].concat(rendering_params.colorsByFeature)};redraw_legend("choro",layer_name,rendering_params.field)}else if(renderer==="DiscLayer"){selection.each((function(d){d.properties.prop_val=this.style.strokeWidth}));redraw_legend("line_class",layer_name)}else if(renderer==="LinksGraduated"){selection.each((function(d,i){data_manager.current_layers[layer_name].linksbyId[i][2]=this.style.strokeWidth}));redraw_legend("line_class",layer_name)}else if(data_manager.current_layers[layer_name].layout_legend_displayed){redraw_legend("layout",layer_name)}if(renderer&&(renderer.startsWith("PropSymbols")||renderer==="LinksProportional")){selection.each((function(d){d.properties.color=this.style.stroke}));redraw_legend("line_symbol",layer_name)}if(new_layer_name!==layer_name){change_layer_name(layer_name,Object(_function__WEBPACK_IMPORTED_MODULE_6__["a"])(new_layer_name.trim()))}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])()}else{selection.style("fill-opacity",opacity).style("stroke-opacity",border_opacity);var zoom_scale=+d3.zoomTransform(map.node()).k;map.select(g_lyr_name).style("stroke-width","".concat(stroke_width/zoom_scale,"px"));data_manager.current_layers[layer_name]["stroke-width-const"]=stroke_width;var fill_meth=Object.getOwnPropertyNames(fill_prev)[0];if(data_manager.current_layers[layer_name].renderer==="LinksGraduated"&&prev_min_display!==undefined){data_manager.current_layers[layer_name].min_display=prev_min_display;data_manager.current_layers[layer_name].breaks=prev_breaks;selection.style("fill-opacity",0).style("stroke",fill_prev.single).style("display",(function(d){return+d.properties[data_manager.current_layers[layer_name].rendered_field]>prev_min_display?null:"none"})).style("stroke-opacity",border_opacity).style("stroke-width",(function(d,i){return data_manager.current_layers[layer_name].linksbyId[i][2]}))}else if(data_manager.current_layers[layer_name].renderer==="DiscLayer"&&prev_min_display!==undefined){data_manager.current_layers[layer_name].min_display=prev_min_display;data_manager.current_layers[layer_name].size=prev_size;data_manager.current_layers[layer_name].breaks=prev_breaks;var lim=prev_min_display!==0?prev_min_display*data_manager.current_layers[layer_name].n_features:-1;selection.style("fill-opacity",0).style("stroke",fill_prev.single).style("stroke-opacity",border_opacity).style("display",(function(d,i){return+i<=lim?null:"none"})).style("stroke-width",(function(d){return d.properties.prop_val}))}else{if(fill_meth==="single"){selection.style("stroke",fill_prev.single).style("stroke-opacity",border_opacity)}else if(fill_meth==="random"){selection.style("stroke-opacity",border_opacity).style("stroke",(function(d,i){return prev_random_colors[i]||_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].names[_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].random()]}))}else if(fill_meth==="class"&&renderer==="LinksGraduated"){selection.style("stroke-opacity",(function(d,i){return data_manager.current_layers[layer_name].linksbyId[i][0]})).style("stroke",stroke_prev)}}if(data_manager.current_layers[layer_name].colors_breaks){data_manager.current_layers[layer_name].colors_breaks=prev_col_breaks}data_manager.current_layers[layer_name].fill_color=fill_prev;Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])()}}));var container=document.querySelector(".twbs > .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");var new_layer_name=layer_name;var new_name_section=make_change_layer_name_section(popup,layer_name);new_name_section.on("change",(function(){new_layer_name=this.value}));if(renderer==="Categorical"||renderer==="PropSymbolsTypo"){var color_field=renderer==="Categorical"?data_manager.current_layers[layer_name].rendered_field:data_manager.current_layers[layer_name].rendered_field2;popup.insert("p").styles({margin:"auto","text-align":"center"}).append("button").attr("class","button_disc").styles({"font-size":"0.8em","text-align":"center"}).html(_tr("app_page.layer_style_popup.choose_colors")).on("click",(function(){var _prepare_categories_a=Object(_function__WEBPACK_IMPORTED_MODULE_6__["h"])(layer_name,color_field,data_manager.current_layers[layer_name].color_map),_prepare_categories_a2=_slicedToArray(_prepare_categories_a,2),cats=_prepare_categories_a2[0],_=_prepare_categories_a2[1];container.modal.hide();Object(_classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__["a"])(data_manager.result_data[layer_name],layer_name,color_field,cats).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],color_map:confirmed[1],colorsByFeature:confirmed[2],renderer:"Categorical",rendered_field:color_field,field:color_field};selection.transition().style("stroke",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}else if(renderer==="Choropleth"||renderer==="PropSymbolsChoro"){popup.append("p").styles({margin:"auto","text-align":"center"}).append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_discretization")).on("click",(function(){container.modal.hide();var _opts=rendering_params?{schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options}:data_manager.current_layers[layer_name].options_disc;Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer_name,data_manager.current_layers[layer_name].rendered_field,_opts.breaks.length-1,_opts).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],type:confirmed[1],breaks:confirmed[2],colors:confirmed[3],colorsByFeature:confirmed[4],schema:confirmed[5],no_data:confirmed[6],field:data_manager.current_layers[layer_name].rendered_field,extra_options:confirmed[7]};selection.transition().style("stroke",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}else{var c_section=popup.append("p").attr("class","line_elem");c_section.insert("span").html(_tr("app_page.layer_style_popup.color"));c_section.insert("input").attr("type","color").style("float","right").property("value",stroke_prev).on("change",(function(){selection.style("stroke",this.value);data_manager.current_layers[layer_name].fill_color={single:this.value}}))}if(renderer==="LinksGraduated"){prev_min_display=data_manager.current_layers[layer_name].min_display||0;prev_breaks=data_manager.current_layers[layer_name].breaks.slice();var fij_field=data_manager.current_layers[layer_name].rendered_field;var max_val=0;selection.each((function(d){if(+d.properties[fij_field]>max_val)max_val=+d.properties[fij_field]}));var threshold_section=popup.append("p").attr("class","line_elem");threshold_section.append("span").html(_tr("app_page.layer_style_popup.display_flow_larger"));threshold_section.insert("input").attrs({type:"range",min:0,max:max_val,step:.5}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right","margin-right":"0px"}).property("value",prev_min_display).on("change",(function(){var val=+this.value;popup.select("#larger_than").html([" ",val," "].join(""));selection.style("display",(function(d){return+d.properties[fij_field]>val?null:"none"}));data_manager.current_layers[layer_name].min_display=val}));threshold_section.insert("label").attr("id","larger_than").style("float","right").html(" ".concat(prev_min_display," "));popup.append("p").style("text-align","center").append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.modify_size_class")).on("click",(function(){container.modal.hide();Object(_classification_discrtiz_links_discont__WEBPACK_IMPORTED_MODULE_4__["a"])(layer_name,data_manager.current_layers[layer_name].rendered_field,data_manager.current_layers[layer_name].breaks.length,"user_defined").then((function(result){container.modal.show();if(result){var serie=result[0],sizes=result[1].map((function(ft){return ft[1]})),links_byId=data_manager.current_layers[layer_name].linksbyId;serie.setClassManually(result[2]);data_manager.current_layers[layer_name].breaks=result[1];selection.style("fill-opacity",0).style("stroke-width",(function(d,i){return sizes[serie.getClass(+links_byId[i][1])]}))}}))}))}else if(renderer==="DiscLayer"){prev_min_display=+data_manager.current_layers[layer_name].min_display||0;prev_size=data_manager.current_layers[layer_name].size.slice();prev_breaks=data_manager.current_layers[layer_name].breaks.slice();var disc_part=popup.append("p").attr("class","line_elem");disc_part.append("span").html(_tr("app_page.layer_style_popup.discont_threshold"));disc_part.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right","margin-right":"0px"}).property("value",prev_min_display).on("change",(function(){var val=+this.value;var lim=val!==0?val*data_manager.current_layers[layer_name].n_features:-1;popup.select("#larger_than").html([" ",val*100," % "].join(""));selection.style("display",(function(d,i){return i<=lim?null:"none"}));data_manager.current_layers[layer_name].min_display=val}));disc_part.insert("label").attr("id","larger_than").style("float","right").html([" ",prev_min_display*100," % "].join(""));popup.append("p").style("text-align","center").append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_discretization")).on("click",(function(){container.modal.hide();Object(_classification_discrtiz_links_discont__WEBPACK_IMPORTED_MODULE_4__["a"])(layer_name,"disc_value",data_manager.current_layers[layer_name].breaks.length,"user_defined").then((function(result){container.modal.show();if(result){var serie=result[0],sizes=result[1].map((function(ft){return ft[1]}));serie.setClassManually(result[2]);data_manager.current_layers[layer_name].breaks=result[1];data_manager.current_layers[layer_name].size=[sizes[0],sizes[sizes.length-1]];selection.style("fill-opacity",0).style("stroke-width",(function(d){return sizes[serie.getClass(+d.properties.disc_value)]}))}}))}))}var opacity_section=popup.append("p").attr("class","line_elem");opacity_section.insert("span").html(_tr("app_page.layer_style_popup.opacity"));opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",border_opacity).on("change",(function(){opacity_section.select("#opacity_val_txt").html(" ".concat(this.value));selection.style("stroke-opacity",this.value)}));opacity_section.append("span").attr("id","opacity_val_txt").styles({display:"inline",float:"right"}).html(" ".concat(border_opacity));if(!renderer||!renderer.startsWith("PropSymbols")&&!renderer.startsWith("Links")&&renderer!=="DiscLayer"){var width_section=popup.append("p").attr("class","line_elem");width_section.append("span").html(_tr("app_page.layer_style_popup.width"));width_section.insert("input").attrs({type:"number",min:0,step:.1}).styles({width:"60px",float:"right"}).property("value",stroke_width).on("change",(function(){var val=+this.value;var zoom_scale=+d3.zoomTransform(map.node()).k;map.select(g_lyr_name).style("stroke-width","".concat(val/zoom_scale,"px"));data_manager.current_layers[layer_name]["stroke-width-const"]=val}))}else if(renderer.startsWith("PropSymbols")||renderer==="LinksProportional"){var field_used=data_manager.current_layers[layer_name].rendered_field;var d_values=data_manager.result_data[layer_name].map((function(f){return+f[field_used]}));var prop_val_content=popup.append("p");prop_val_content.append("span").html(_tr("app_page.layer_style_popup.field_symbol_size",{field:data_manager.current_layers[layer_name].rendered_field}));prop_val_content.append("span").html(_tr("app_page.layer_style_popup.symbol_fixed_size"));prop_val_content.insert("input").styles({width:"60px",float:"right"}).attrs({type:"number",id:"max_size_range",min:.1,step:"any"}).property("value",data_manager.current_layers[layer_name].size[1]).on("change",(function(){var f_size=+this.value;var prop_values=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_8__["m"])(d_values,data_manager.current_layers[layer_name].size[0],f_size,"line");data_manager.current_layers[layer_name].size[1]=f_size;redraw_prop_val(prop_values)}));prop_val_content.append("span").style("float","right").html("(px)");var prop_val_content2=popup.append("p").attr("class","line_elem");prop_val_content2.append("span").html(_tr("app_page.layer_style_popup.on_value"));prop_val_content2.insert("input").styles({width:"100px",float:"right"}).attrs({type:"number",min:.1,step:.1}).property("value",+data_manager.current_layers[layer_name].size[0]).on("change",(function(){var f_val=+this.value;var prop_values=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_8__["m"])(d_values,f_val,data_manager.current_layers[layer_name].size[1],"line");redraw_prop_val(prop_values);data_manager.current_layers[layer_name].size[0]=f_val}))}if(data_manager.current_layers[layer_name].renderer===undefined){var generate_legend_section=popup.append("p");var generate_lgd_chkbox=generate_legend_section.insert("input").style("margin",0).property("checked",data_manager.current_layers[layer_name].layout_legend_displayed===true).attrs({type:"checkbox",id:"checkbox_layout_legend"});generate_legend_section.insert("label").attr("for","checkbox_layout_legend").html(_tr("app_page.layer_style_popup.layout_legend"));generate_lgd_chkbox.on("change",(function(){if(this.checked){Object(_legend__WEBPACK_IMPORTED_MODULE_10__["d"])(layer_name,data_manager.current_layers[layer_name].type,layer_name,"",undefined,layer_name);data_manager.current_layers[layer_name].layout_legend_displayed=true}else{document.querySelector(["#legend_root_layout.lgdf_",_app.layer_to_id.get(layer_name)].join("")).remove();data_manager.current_layers[layer_name].layout_legend_displayed=false}}))}make_generate_labels_section(popup,layer_name)}function createStyleBox(layer_name){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["a"])(".styleBox");var type=data_manager.current_layers[layer_name].type,isSphere=data_manager.current_layers[layer_name].sphere===true,renderer=data_manager.current_layers[layer_name].renderer,g_lyr_name="#".concat(_app.layer_to_id.get(layer_name)),selection=map.select(g_lyr_name).selectAll("path"),opacity=selection.style("fill-opacity");var fill_prev=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["c"])(data_manager.current_layers[layer_name].fill_color);var prev_col_breaks;var rendering_params;var prev_random_colors;if(data_manager.current_layers[layer_name].colors_breaks&&data_manager.current_layers[layer_name].colors_breaks instanceof Array){prev_col_breaks=data_manager.current_layers[layer_name].colors_breaks.concat([])}else if(fill_prev.random){prev_random_colors=[];selection.each((function(){prev_random_colors.push(this.style.fill)}))}var border_opacity=selection.style("stroke-opacity"),stroke_width=+data_manager.current_layers[layer_name]["stroke-width-const"];var table=[];var stroke_prev=selection.style("stroke");var previous_point_radius=data_manager.current_layers[layer_name].pointRadius;if(stroke_prev.startsWith("rgb")){stroke_prev=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["g"])(stroke_prev)}Array.prototype.forEach.call(svg_map.querySelector(g_lyr_name).querySelectorAll("path"),(function(d){table.push(d.__data__.properties)}));var fields_layer=!isSphere?data_manager.current_layers[layer_name].fields_type||Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["A"])(table):[];Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["b"])("styleBox",layer_name,{top:true,widthFitContent:true,draggable:true}).then((function(confirmed){if(confirmed){if(renderer!==undefined&&rendering_params!==undefined&&renderer!=="Categorical"){data_manager.current_layers[layer_name].fill_color={class:rendering_params.colorsByFeature};var colors_breaks=[];for(var i=rendering_params.breaks.length-1;i>0;--i){colors_breaks.push([[rendering_params.breaks[i-1]," - ",rendering_params.breaks[i]].join(""),rendering_params.colors[i-1]])}data_manager.current_layers[layer_name].colors_breaks=colors_breaks;data_manager.current_layers[layer_name].rendered_field=rendering_params.field;data_manager.current_layers[layer_name].options_disc={schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options}}else if(renderer==="Categorical"&&rendering_params!==undefined){data_manager.current_layers[layer_name].color_map=rendering_params.color_map;data_manager.current_layers[layer_name].fill_color={class:[].concat(rendering_params.colorsByFeature)}}if(rendering_params!==undefined&&rendering_params.field!==undefined){if(document.querySelector(".legend.legend_feature.lgdf_".concat(_app.layer_to_id.get(layer_name))).id==="legend_root"){redraw_legend("choro",layer_name,data_manager.current_layers[layer_name].rendered_field)}else{redraw_legend("choro_horiz",layer_name,data_manager.current_layers[layer_name].rendered_field)}}else if(data_manager.current_layers[layer_name].layout_legend_displayed){redraw_legend("layout",layer_name)}if(new_layer_name!==layer_name){change_layer_name(layer_name,Object(_function__WEBPACK_IMPORTED_MODULE_6__["a"])(new_layer_name.trim()))}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])()}else{selection.style("fill-opacity",opacity).style("stroke-opacity",border_opacity);var zoom_scale=+d3.zoomTransform(map.node()).k;map.select(g_lyr_name).style("stroke-width","".concat(stroke_width/zoom_scale,"px"));data_manager.current_layers[layer_name]["stroke-width-const"]=stroke_width;handleEdgeShapeRendering(selection,Math.min(stroke_width,border_opacity));var fill_meth=Object.getOwnPropertyNames(fill_prev)[0];if(type==="Point"&&data_manager.current_layers[layer_name].pointRadius){data_manager.current_layers[layer_name].pointRadius=previous_point_radius;selection.attr("d",path.pointRadius(+data_manager.current_layers[layer_name].pointRadius))}else{if(fill_meth==="single"){selection.style("fill",fill_prev.single).style("stroke",stroke_prev)}else if(fill_meth==="class"){selection.style("fill-opacity",opacity).style("fill",(function(d,i){return fill_prev["class"][i]})).style("stroke-opacity",border_opacity).style("stroke",stroke_prev)}else if(fill_meth==="random"){selection.style("fill",(function(d,i){return prev_random_colors[i]||_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].names[_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].random()]})).style("stroke",stroke_prev)}else if(fill_meth==="categorical"){fill_categorical(layer_name,fill_prev.categorical[0],"path",fill_prev.categorical[1])}}if(data_manager.current_layers[layer_name].colors_breaks){data_manager.current_layers[layer_name].colors_breaks=prev_col_breaks}data_manager.current_layers[layer_name].fill_color=fill_prev;Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])()}}));var container=document.querySelector(".twbs > .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");var new_layer_name=layer_name;if(layer_name!=="World"){var new_name_section=make_change_layer_name_section(popup,layer_name);new_name_section.on("change",(function(){new_layer_name=this.value}))}if(type==="Point"){var pt_size=popup.append("p").attr("class","line_elem");pt_size.append("span").html(_tr("app_page.layer_style_popup.point_radius"));pt_size.append("input").attrs({type:"range",min:0,max:80,id:"point_radius_size"}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right","margin-right":"0px"}).property("value",previous_point_radius).on("change",(function(){var current_pt_size=+this.value;data_manager.current_layers[layer_name].pointRadius=current_pt_size;document.getElementById("point_radius_size_txt").value=current_pt_size;selection.attr("d",path.pointRadius(current_pt_size))}));pt_size.append("input").attrs({type:"number",min:0,max:80,step:"any",class:"without_spinner",id:"point_radius_size_txt"}).styles({width:"30px","margin-left":"10px",float:"right"}).property("value",+previous_point_radius).on("change",(function(){var pt_size_range=document.getElementById("point_radius_size");var old_value=pt_size_range.value;if(this.value===""||isNaN(+this.value)){this.value=old_value}else{this.value=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_8__["n"])(+this.value,2);var current_pt_size=this.value;pt_size_range.value=current_pt_size;data_manager.current_layers[layer_name].pointRadius=current_pt_size;selection.attr("d",path.pointRadius(current_pt_size))}}))}if(data_manager.current_layers[layer_name].colors_breaks===undefined&&renderer!=="Categorical"){if(data_manager.current_layers[layer_name].targeted||data_manager.current_layers[layer_name].is_result){var fields=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["l"])("category",null,fields_layer);var fill_method_section=popup.append("p");fill_method_section.append("span").html(_tr("app_page.layer_style_popup.fill_color"));var fill_method=fill_method_section.insert("select").styles({display:"inline",float:"right",width:"100%"});[[_tr("app_page.layer_style_popup.single_color"),"single"],[_tr("app_page.layer_style_popup.categorical_color"),"categorical"],[_tr("app_page.layer_style_popup.random_color"),"random"]].forEach((function(d){fill_method.append("option").text(d[0]).attr("value",d[1])}));popup.append("p").attrs({id:"fill_color_section"}).styles({clear:"both","padding-top":"10px"});fill_method.on("change",(function(){d3.select("#fill_color_section").html("").on("click",null);if(this.value==="single"){make_single_color_menu(layer_name,fill_prev)}else if(this.value==="categorical"){make_categorical_color_menu(fields,layer_name,fill_prev)}else if(this.value==="random"){make_random_color(layer_name);document.getElementById("random_color_btn").click()}}));Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["y"])(fill_method.node(),Object.getOwnPropertyNames(fill_prev)[0])}else{popup.append("div").attrs({id:"fill_color_section"});make_single_color_menu(layer_name,fill_prev)}}else if(renderer==="Categorical"){var rendered_field=data_manager.current_layers[layer_name].rendered_field;popup.insert("p").styles({margin:"auto","text-align":"center"}).append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_colors")).on("click",(function(){container.modal.hide();var _prepare_categories_a3=Object(_function__WEBPACK_IMPORTED_MODULE_6__["h"])(layer_name,rendered_field,data_manager.current_layers[layer_name].color_map),_prepare_categories_a4=_slicedToArray(_prepare_categories_a3,1),cats=_prepare_categories_a4[0];Object(_classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__["a"])(data_manager.result_data[layer_name],layer_name,rendered_field,cats).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],color_map:confirmed[1],colorsByFeature:confirmed[2],renderer:"Categorical",rendered_field,field:rendered_field};selection.transition().style("fill",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}else if(renderer==="Choropleth"){popup.append("p").styles({margin:"auto","text-align":"center"}).append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_discretization")).on("click",(function(){container.modal.hide();var _opts=rendering_params?{schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options}:data_manager.current_layers[layer_name].options_disc;Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer_name,data_manager.current_layers[layer_name].rendered_field,_opts.breaks.length-1,_opts).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],type:confirmed[1],breaks:confirmed[2],colors:confirmed[3],colorsByFeature:confirmed[4],schema:confirmed[5],no_data:confirmed[6],field:data_manager.current_layers[layer_name].rendered_field,extra_options:confirmed[7]};selection.transition().style("fill",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}else if(renderer==="Gridded"){var field_to_discretize=data_manager.current_layers[layer_name].rendered_field;popup.append("p").style("margin","auto").style("text-align","center").append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_discretization")).on("click",(function(){container.modal.hide();var _opts=rendering_params?{schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options}:data_manager.current_layers[layer_name].options_disc;Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer_name,field_to_discretize,_opts.breaks.length-1,_opts).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],type:confirmed[1],breaks:confirmed[2],colors:confirmed[3],colorsByFeature:confirmed[4],schema:confirmed[5],no_data:confirmed[6],renderer:"Choropleth",field:field_to_discretize,extra_options:confirmed[7]};selection.transition().style("fill",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}var fill_opacity_section=popup.append("p").attr("class","line_elem");fill_opacity_section.append("span").html(_tr("app_page.layer_style_popup.fill_opacity"));fill_opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right","margin-right":"0px"}).property("value",opacity).on("change",(function(){selection.style("fill-opacity",this.value);fill_opacity_section.select("#fill_opacity_txt").html("".concat(this.value*100,"%"))}));fill_opacity_section.append("span").style("float","right").attr("id","fill_opacity_txt").html("".concat(+opacity*100,"%"));var c_section=popup.append("p").attr("class","line_elem");c_section.insert("span").html(_tr("app_page.layer_style_popup.border_color"));c_section.insert("input").attr("type","color").style("float","right").property("value",stroke_prev).on("change",(function(){selection.style("stroke",this.value)}));var opacity_section=popup.append("p").attr("class","line_elem");opacity_section.insert("span").html(_tr("app_page.layer_style_popup.border_opacity"));opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",border_opacity).on("change",(function(){opacity_section.select("#opacity_val_txt").html(" ".concat(this.value));selection.style("stroke-opacity",this.value);handleEdgeShapeRendering(selection,+this.value)}));opacity_section.append("span").attr("id","opacity_val_txt").styles({display:"inline",float:"right"}).html(" ".concat(border_opacity));var width_section=popup.append("p").attr("class","line_elem");width_section.append("span").html(_tr("app_page.layer_style_popup.border_width"));width_section.insert("input").attrs({type:"number",min:0,step:.1}).styles({width:"60px",float:"right"}).property("value",stroke_width).on("change",(function(){var val=+this.value;var zoom_scale=+d3.zoomTransform(map.node()).k;map.select(g_lyr_name).style("stroke-width","".concat(val/zoom_scale,"px"));data_manager.current_layers[layer_name]["stroke-width-const"]=val;handleEdgeShapeRendering(selection,val)}));var shadow_section=popup.append("p");var chkbx=shadow_section.insert("input").style("margin","0").property("checked",map.select(g_lyr_name).attr("filter")?true:null).attrs({type:"checkbox",id:"checkbox_shadow_layer"});shadow_section.insert("label").attr("for","checkbox_shadow_layer").html(_tr("app_page.layer_style_popup.layer_shadow"));chkbx.on("change",(function(){if(this.checked){createDropShadow(_app.layer_to_id.get(layer_name))}else{var filter_id=map.select(g_lyr_name).attr("filter");svg_map.querySelector(filter_id.substring(4).replace(")","")).remove();map.select(g_lyr_name).attr("filter",null)}}));if(data_manager.current_layers[layer_name].renderer===undefined||data_manager.current_layers[layer_name].renderer==="Carto_doug"||data_manager.current_layers[layer_name].renderer==="OlsonCarto"){var generate_legend_section=popup.append("p");var generate_lgd_chkbox=generate_legend_section.insert("input").style("margin",0).property("checked",data_manager.current_layers[layer_name].layout_legend_displayed===true).attrs({type:"checkbox",id:"checkbox_layout_legend"});generate_legend_section.insert("label").attr("for","checkbox_layout_legend").html(_tr("app_page.layer_style_popup.layout_legend"));generate_lgd_chkbox.on("change",(function(){if(this.checked){Object(_legend__WEBPACK_IMPORTED_MODULE_10__["d"])(layer_name,data_manager.current_layers[layer_name].type,layer_name,"",undefined,layer_name);data_manager.current_layers[layer_name].layout_legend_displayed=true}else{document.querySelector(["#legend_root_layout.lgdf_",_app.layer_to_id.get(layer_name)].join("")).remove();data_manager.current_layers[layer_name].layout_legend_displayed=false}}))}make_generate_labels_section(popup,layer_name)}function createStyleBoxStewart(layer_name){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["a"])(".styleBox");var g_lyr_name="#".concat(_app.layer_to_id.get(layer_name)),selection=map.select(g_lyr_name).selectAll("path"),opacity=selection.style("fill-opacity");var nb_ft=data_manager.current_layers[layer_name].n_features;var prev_palette=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["c"])(data_manager.current_layers[layer_name].color_palette);var recolor_stewart=function recolor_stewart(coloramp_name,reversed){var new_coloramp=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["d"])(nb_ft,coloramp_name).slice();if(reversed===false){new_coloramp.reverse()}for(var i=0;i .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");var new_layer_name=layer_name;var new_name_section=make_change_layer_name_section(popup,layer_name);new_name_section.on("change",(function(){new_layer_name=this.value}));var color_palette_section=popup.insert("p").attr("class","line_elem");color_palette_section.append("span").html(_tr("app_page.layer_style_popup.color_palette"));var seq_color_select=color_palette_section.insert("select").attr("id","coloramp_params").style("float","right").on("change",(function(){recolor_stewart(this.value,document.getElementById("chckbox_reverse_palette").checked)}));["Blues","BuGn","BuPu","GnBu","OrRd","PuBu","PuBuGn","PuRd","RdPu","YlGn","Greens","Greys","Oranges","Purples","Reds"].forEach((function(name){seq_color_select.append("option").text(name).attr("value",name)}));seq_color_select.node().value=prev_palette.name;var reversed_section=popup.append("div").style("margin-bottom","10px");reversed_section.append("input").property("checked",prev_palette.reversed?true:false).attrs({id:"chckbox_reverse_palette",type:"checkbox"}).style("margin","auto").on("change",(function onchangerevpal(){var pal_name=document.getElementById("coloramp_params").value;recolor_stewart(pal_name,this.checked)}));reversed_section.append("label").attr("for","chckbox_reverse_palette").html(_tr("app_page.layer_style_popup.reverse_palette"));var fill_opacity_section=popup.append("p").attr("class","line_elem");fill_opacity_section.append("span").html(_tr("app_page.layer_style_popup.fill_opacity"));fill_opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right","margin-right":"0px"}).property("value",opacity).on("change",(function(){selection.style("fill-opacity",this.value);fill_opacity_section.select("#fill_opacity_txt").html("".concat(this.value*100,"%"))}));fill_opacity_section.append("span").style("float","right").attr("id","fill_opacity_txt").html("".concat(+opacity*100,"%"));var c_section=popup.append("p").attr("class","line_elem");c_section.insert("span").html(_tr("app_page.layer_style_popup.border_color"));c_section.insert("input").attr("type","color").style("float","right").property("value",stroke_prev).on("change",(function(){selection.style("stroke",this.value)}));var opacity_section=popup.append("p").attr("class","line_elem");opacity_section.insert("span").html(_tr("app_page.layer_style_popup.border_opacity"));opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",border_opacity).on("change",(function(){opacity_section.select("#opacity_val_txt").html(" ".concat(this.value));selection.style("stroke-opacity",this.value);handleEdgeShapeRendering(selection,+this.value)}));opacity_section.append("span").attr("id","opacity_val_txt").styles({display:"inline",float:"right"}).html(" ".concat(border_opacity));var width_section=popup.append("p").attr("class","line_elem");width_section.append("span").html(_tr("app_page.layer_style_popup.border_width"));width_section.insert("input").attrs({type:"number",min:0,step:.1}).styles({width:"60px",float:"right"}).property("value",stroke_width).on("change",(function(){var val=+this.value;var zoom_scale=+d3.zoomTransform(map.node()).k;map.select(g_lyr_name).style("stroke-width","".concat(val/zoom_scale,"px"));data_manager.current_layers[layer_name]["stroke-width-const"]=val;handleEdgeShapeRendering(selection,val)}));var shadow_section=popup.append("p");var chkbx=shadow_section.insert("input").style("margin","0").property("checked",map.select(g_lyr_name).attr("filter")?true:null).attrs({type:"checkbox",id:"checkbox_shadow_layer"});shadow_section.insert("label").attr("for","checkbox_shadow_layer").html(_tr("app_page.layer_style_popup.layer_shadow"));chkbx.on("change",(function(){if(this.checked){createDropShadow(_app.layer_to_id.get(layer_name))}else{var filter_id=map.select(g_lyr_name).attr("filter");svg_map.querySelector(filter_id.substring(4).replace(")","")).remove();map.select(g_lyr_name).attr("filter",null)}}));make_generate_labels_section(popup,layer_name)}function make_generate_labels_graticule_section(parent_node){var labels_section=parent_node.append("p");labels_section.append("span").attr("id","generate_labels").styles({cursor:"pointer","margin-top":"15px"}).html(_tr("app_page.layer_style_popup.generate_labels")).on("mouseover",(function(){this.style.fontWeight="bold"})).on("mouseout",(function(){this.style.fontWeight=""})).on("click",(function(){Object(_function__WEBPACK_IMPORTED_MODULE_6__["k"])("Graticule",{color:"#000",font:"verdana",ref_font_size:12,uo_layer_name:["Labels","Graticule"].join("_")})}))}function make_generate_labels_section(parent_node,layer_name){var _fields=get_fields_name(layer_name)||[];var fields_num=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["A"])(Object(_tables__WEBPACK_IMPORTED_MODULE_12__["b"])(layer_name)).filter((function(a){return a.type==="ratio"||a.type==="stock"})).map((function(a){return a.name}));if(_fields&&_fields.length>0){var labels_section=parent_node.append("p");var input_fields={};for(var i=0;i<_fields.length;i++){input_fields[_fields[i]]=_fields[i]}labels_section.append("span").attr("id","generate_labels").styles({cursor:"pointer","margin-top":"15px"}).html(_tr("app_page.layer_style_popup.generate_labels")).on("mouseover",(function(){this.style.fontWeight="bold"})).on("mouseout",(function(){this.style.fontWeight=""})).on("click",(function(){swal({title:"",html:'\n
'.concat(_tr("app_page.layer_style_popup.field_label"),'
\n
\n').concat(_tr("app_page.common.field"),' \n \n
\n
'),type:"question",customClass:"swal2_custom",showCancelButton:true,showCloseButton:false,allowEscapeKey:false,allowOutsideClick:false,confirmButtonColor:"#DD6B55",confirmButtonText:_tr("app_page.common.confirm"),inputOptions:input_fields,onOpen:function onOpen(){var sel=d3.select("#label_box_field");_fields.forEach((function(f_name){sel.append("option").property("value",f_name).text(f_name)}));if(fields_num.length>0){var section_filter=d3.select("#label_box_filter_section");section_filter.append("input").attrs({type:"checkbox",id:"label_box_filter_chk"}).on("change",(function(){if(this.checked){subsection_filter_label.style("display",null)}else{subsection_filter_label.style("display","none")}}));section_filter.append("label").attr("for","label_box_filter_chk").html(_tr("app_page.layer_style_popup.filter_label"));var subsection_filter_label=section_filter.append("div").style("display","none");var sel2=subsection_filter_label.append("select").attr("id","label_box_filter_field");fields_num.forEach((function(f_name){sel2.append("option").property("value",f_name).text(f_name)}));var sel3=subsection_filter_label.append("select").attr("id","label_box_filter_type");sel3.append("option").property("value","sup").text(">");sel3.append("option").property("value","inf").text("<");subsection_filter_label.append("input").attrs({type:"number",id:"label_box_filter_value"})}},preConfirm:function preConfirm(){return new Promise((function(resolve,reject){setTimeout((function(){var selected_field=document.getElementById("label_box_field").value;var filter_options=undefined;if(fields_num.length>0){var to_filter=document.getElementById("label_box_filter_chk").checked;if(to_filter){var filter_value=document.getElementById("label_box_filter_value").value;if(!filter_value||isNaN(filter_value)){reject(_tr("app_page.common.incorrect_value"));return}filter_options={field:document.getElementById("label_box_filter_field").value,type_filter:document.getElementById("label_box_filter_type").value,filter_value}}}if(_fields.indexOf(selected_field)<0){reject(_tr("app_page.common.no_value"))}else{resolve();Object(_function__WEBPACK_IMPORTED_MODULE_6__["j"])(layer_name,{label_field:selected_field,filter_options,color:"#000",font:"verdana",ref_font_size:12,uo_layer_name:["Labels",selected_field,layer_name].join("_")})}}),50)}))}}).then((function(){}),(function(){}))}))}}function get_fields_name(layer_name){var elem=document.getElementById(_app.layer_to_id.get(layer_name)).childNodes[0];if(!elem.__data__||!elem.__data__.properties){return null}return Object.getOwnPropertyNames(elem.__data__.properties)}function createStyleBoxWaffle(layer_name){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["a"])(".styleBox");var round=Math.round;var floor=Math.floor;var layer_id=_app.layer_to_id.get(layer_name),g_lyr_name="#".concat(layer_id),ref_layer_name=data_manager.current_layers[layer_name].ref_layer_name,symbol=data_manager.current_layers[layer_name].symbol,fields=data_manager.current_layers[layer_name].rendered_field,selection=map.select(g_lyr_name);var previous_params={fill_opacity:selection.selectAll(symbol).style("fill-opacity"),ref_colors:[].concat(data_manager.current_layers[layer_name].fill_color),size:data_manager.current_layers[layer_name].size,nCol:data_manager.current_layers[layer_name].nCol};Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["b"])("styleBox",layer_name,{top:true,widthFitContent:true,draggable:true}).then((function(confirmed){if(confirmed){redraw_legend("waffle",layer_name,fields);if(new_layer_name!==layer_name){change_layer_name(layer_name,Object(_function__WEBPACK_IMPORTED_MODULE_6__["a"])(new_layer_name.trim()))}}else{data_manager.current_layers[layer_name].fill_color=previous_params.ref_colors;data_manager.current_layers[layer_name].size=previous_params.size;selection.selectAll(symbol).style("fill-opacity",previous_params.fill_opacity)}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])()}));var container=document.querySelector(".twbs > .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");popup.append("p").styles({"text-align":"center",color:"grey"}).html([_tr("app_page.layer_style_popup.rendered_field",{field:fields.join(" ,")}),_tr("app_page.layer_style_popup.reference_layer",{layer:ref_layer_name})].join(""));var fill_opacity_section=popup.append("p").attr("class","line_elem").attr("id","fill_color_section");fill_opacity_section.append("span").html(_tr("app_page.layer_style_popup.fill_opacity"));fill_opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",previous_params.fill_opacity).on("change",(function(){selection.selectAll(symbol).style("fill-opacity",+this.value);fill_opacity_section.select("#fill_opacity_txt").html("".concat(+this.value*100,"%"))}));fill_opacity_section.append("span").attr("id","fill_opacity_txt").style("float","right").html("".concat(+previous_params.fill_opacity*100,"%"));var ref_colors_section=popup.append("div").attr("id","ref_colors_section").style("clear","both");ref_colors_section.append("p").html(_tr("app_page.layer_style_popup.ref_colors"));var _loop=function _loop(i){var p=ref_colors_section.append("p").style("margin","15px 5px");p.append("span").html(data_manager.current_layers[layer_name].rendered_field[i]);p.insert("input").attrs({id:i,type:"color"}).style("float","right").property("value",data_manager.current_layers[layer_name].fill_color[i]).on("change",(function(){var col=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["g"])(this.value);var to_replace=data_manager.current_layers[layer_name].fill_color[i];data_manager.current_layers[layer_name].fill_color[i]=col;selection.selectAll(symbol).each((function(){if(Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["g"])(this.getAttribute("fill"))===to_replace){this.setAttribute("fill",col)}}))}))};for(var i=0;i0;--i){data_manager.current_layers[layer_name].colors_breaks.push([[rendering_params.breaks[i-1]," - ",rendering_params.breaks[i]].join(""),rendering_params.colors[i-1]])}data_manager.current_layers[layer_name].options_disc={schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options}}else if(type_method==="PropSymbolsTypo"){data_manager.current_layers[layer_name].fill_color={class:[].concat(rendering_params.colorsByFeature)};data_manager.current_layers[layer_name].color_map=rendering_params.color_map}data_manager.current_layers[layer_name].rendered_field2=rendering_params.field;if(document.querySelector(".legend.legend_feature.lgdf_".concat(_app.layer_to_id.get(layer_name))).id==="legend_root"){redraw_legend("choro",layer_name,data_manager.current_layers[layer_name].rendered_field)}else{redraw_legend("choro_horiz",layer_name,data_manager.current_layers[layer_name].rendered_field)}}if(new_layer_name!==layer_name){change_layer_name(layer_name,Object(_function__WEBPACK_IMPORTED_MODULE_6__["a"])(new_layer_name.trim()))}}else{selection.style("fill-opacity",opacity);map.select(g_lyr_name).style("stroke-width",stroke_width);data_manager.current_layers[layer_name]["stroke-width-const"]=stroke_width;var fill_meth=Object.getOwnPropertyNames(fill_prev)[0];if(fill_meth==="single"){selection.style("fill",fill_prev.single).style("stroke-opacity",border_opacity).style("stroke",stroke_prev)}else if(fill_meth==="two"){data_manager.current_layers[layer_name].break_val=prev_col_breaks;data_manager.current_layers[layer_name].fill_color={two:[fill_prev.two[0],fill_prev.two[1]]};selection.style("fill",(function(d,i){return d_values[i]>prev_col_breaks?fill_prev.two[1]:fill_prev.two[0]})).style("stroke-opacity",border_opacity).style("stroke",stroke_prev)}else if(fill_meth==="class"){selection.style("fill-opacity",opacity).style("fill",(function(d,i){return data_manager.current_layers[layer_name].fill_color["class"][i]})).style("stroke-opacity",border_opacity).style("stroke",stroke_prev);data_manager.current_layers[layer_name].colors_breaks=prev_col_breaks}else if(fill_meth==="random"){selection.style("fill",(function(_,i){return prev_random_colors[i]||_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].names[_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["a"].random()]})).style("stroke-opacity",border_opacity).style("stroke",stroke_prev)}else if(fill_meth==="categorical"){fill_categorical(layer_name,fill_prev.categorical[0],type_symbol,fill_prev.categorical[1])}data_manager.current_layers[layer_name].fill_color=fill_prev;if(data_manager.current_layers[layer_name].size[1]!==old_size[1]){var prop_values=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_8__["m"])(d_values,old_size[0],old_size[1],type_symbol);redraw_prop_val(prop_values);data_manager.current_layers[layer_name].size=[old_size[0],old_size[1]]}}Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_11__["j"])()}));var container=document.querySelector(".twbs > .styleBox");var popup=d3.select(container).select(".modal-content").style("width","300px").select(".modal-body");popup.append("p").styles({"text-align":"center",color:"grey"}).html([_tr("app_page.layer_style_popup.rendered_field",{field:data_manager.current_layers[layer_name].rendered_field}),_tr("app_page.layer_style_popup.reference_layer",{layer:ref_layer_name})].join(""));var new_layer_name=layer_name;var new_name_section=make_change_layer_name_section(popup,layer_name);new_name_section.on("change",(function(){new_layer_name=this.value}));if(type_method==="PropSymbolsChoro"){var field_color=data_manager.current_layers[layer_name].rendered_field2;popup.append("p").styles({margin:"auto","text-align":"center"}).html(_tr("app_page.layer_style_popup.field_symbol_color",{field:field_color})).append("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_discretization")).on("click",(function(){container.modal.hide();var _opts=rendering_params?{schema:rendering_params.schema,colors:rendering_params.colors,no_data:rendering_params.no_data,type:rendering_params.type,breaks:rendering_params.breaks,extra_options:rendering_params.extra_options}:data_manager.current_layers[layer_name].options_disc;Object(_classification_discretization_panel__WEBPACK_IMPORTED_MODULE_2__["a"])(layer_name,field_color,_opts.breaks.length-1,_opts).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],type:confirmed[1],breaks:confirmed[2],colors:confirmed[3],colorsByFeature:confirmed[4],schema:confirmed[5],no_data:confirmed[6],renderer:"PropSymbolsChoro",field:field_color,extra_options:confirmed[7]};selection.style("fill",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}else if(data_manager.current_layers[layer_name].break_val!==undefined){var fill_color_section=popup.append("div").attr("id","fill_color_section");fill_color_section.append("p").style("text-align","center").html(_tr("app_page.layer_style_popup.color_break"));var p2=fill_color_section.append("p").style("display","inline");var col1=p2.insert("input").attrs({id:"col1",type:"color"}).property("value",data_manager.current_layers[layer_name].fill_color.two[0]).on("change",(function(){var _this=this;var new_break_val=+b_val.node().value;data_manager.current_layers[layer_name].fill_color.two[0]=this.value;selection.transition().style("fill",(function(d,i){return d_values[i]>new_break_val?col2.node().value:_this.value}))}));var col2=p2.insert("input").attrs({id:"col2",type:"color"}).property("value",data_manager.current_layers[layer_name].fill_color.two[1]).on("change",(function(){var _this2=this;var new_break_val=+b_val.node().value;data_manager.current_layers[layer_name].fill_color.two[1]=this.value;selection.transition().style("fill",(function(d,i){return d_values[i]>new_break_val?_this2.value:col1.node().value}))}));fill_color_section.insert("span").html(_tr("app_page.layer_style_popup.break_value"));var b_val=fill_color_section.insert("input").attr("type","number").style("width","75px").property("value",data_manager.current_layers[layer_name].break_val).on("change",(function(){var new_break_val=+this.value;data_manager.current_layers[layer_name].break_val=new_break_val;selection.transition().style("fill",(function(d,i){return d_values[i]>new_break_val?col2.node().value:col1.node().value}))}))}else if(type_method==="PropSymbolsTypo"){var _field_color=data_manager.current_layers[layer_name].rendered_field2;popup.append("p").style("margin","auto").html(_tr("app_page.layer_style_popup.field_symbol_color",{field:_field_color}));popup.append("p").style("text-align","center").insert("button").attr("class","button_disc").html(_tr("app_page.layer_style_popup.choose_colors")).on("click",(function(){var _prepare_categories_a5=Object(_function__WEBPACK_IMPORTED_MODULE_6__["h"])(layer_name,_field_color,data_manager.current_layers[layer_name].color_map),_prepare_categories_a6=_slicedToArray(_prepare_categories_a5,1),cats=_prepare_categories_a6[0];container.modal.hide();Object(_classification_categorical_panel__WEBPACK_IMPORTED_MODULE_3__["a"])(data_manager.result_data[layer_name],layer_name,_field_color,cats).then((function(confirmed){container.modal.show();if(confirmed){rendering_params={nb_class:confirmed[0],color_map:confirmed[1],colorsByFeature:confirmed[2],renderer:"Categorical",rendered_field:_field_color,field:_field_color};selection.style("fill",(function(d,i){return rendering_params.colorsByFeature[i]}))}}))}))}else{var fill_method=popup.append("p").html(_tr("app_page.layer_style_popup.fill_color")).insert("select");[[_tr("app_page.layer_style_popup.single_color"),"single"],[_tr("app_page.layer_style_popup.random_color"),"random"]].forEach((function(d){fill_method.append("option").text(d[0]).attr("value",d[1])}));popup.append("div").attr("id","fill_color_section");fill_method.on("change",(function(){popup.select("#fill_color_section").html("").on("click",null);if(this.value==="single"){make_single_color_menu(layer_name,fill_prev,type_symbol);map.select(g_lyr_name).selectAll(type_symbol).transition().style("fill",fill_prev.single);data_manager.current_layers[layer_name].fill_color=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["c"])(fill_prev)}else if(this.value==="random"){make_random_color(layer_name,type_symbol);document.getElementById("random_color_btn").click()}}));Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["y"])(fill_method.node(),Object.getOwnPropertyNames(fill_prev)[0])}var fill_opct_section=popup.append("p").attr("class","line_elem");fill_opct_section.append("span").html(_tr("app_page.layer_style_popup.fill_opacity"));fill_opct_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",opacity).on("change",(function(){selection.style("fill-opacity",this.value);fill_opct_section.select("#fill_opacity_txt").html("".concat(+this.value*100,"%"))}));fill_opct_section.append("span").attr("id","fill_opacity_txt").style("float","right").html("".concat(+opacity*100,"%"));var border_color_section=popup.append("p").attr("class","line_elem");border_color_section.append("span").html(_tr("app_page.layer_style_popup.border_color"));border_color_section.insert("input").attr("type","color").style("float","right").property("value",stroke_prev).on("change",(function(){selection.transition().style("stroke",this.value)}));var border_opacity_section=popup.append("p");border_opacity_section.append("span").html(_tr("app_page.layer_style_popup.border_opacity"));border_opacity_section.insert("input").attrs({type:"range",min:0,max:1,step:.1}).styles({width:"58px","vertical-align":"middle",display:"inline",float:"right"}).property("value",border_opacity).on("change",(function(){selection.style("stroke-opacity",this.value);border_opacity_section.select("#border_opacity_txt").html("".concat(this.value))}));border_opacity_section.append("span").attr("id","border_opacity_txt").style("float","right").html(" ".concat(border_opacity));var border_width_section=popup.append("p").attr("class","line_elem");border_width_section.append("span").html(_tr("app_page.layer_style_popup.border_width"));border_width_section.insert("input").attrs({type:"number",min:0,step:.1}).styles({width:"60px",float:"right"}).property("value",stroke_width).on("change",(function(){selection.style("stroke-width","".concat(this.value,"px"));data_manager.current_layers[layer_name]["stroke-width-const"]=+this.value}));var prop_val_content=popup.append("p");prop_val_content.append("span").html(_tr("app_page.layer_style_popup.field_symbol_size",{field:field_used}));prop_val_content.append("span").html(_tr("app_page.layer_style_popup.symbol_fixed_size"));prop_val_content.insert("input").styles({width:"60px",float:"right"}).attrs({type:"number",id:"max_size_range",min:.1,step:"any"}).property("value",data_manager.current_layers[layer_name].size[1]).on("change",(function(){var f_size=+this.value;var prop_values=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_8__["m"])(d_values,data_manager.current_layers[layer_name].size[0],f_size,type_symbol);data_manager.current_layers[layer_name].size[1]=f_size;redraw_prop_val(prop_values)}));prop_val_content.append("span").style("float","right").html("(px)");var prop_val_content2=popup.append("p").attr("class","line_elem");prop_val_content2.append("span").html(_tr("app_page.layer_style_popup.on_value"));prop_val_content2.insert("input").styles({width:"100px",float:"right"}).attrs({type:"number",min:.1,step:.1}).property("value",+data_manager.current_layers[layer_name].size[0]).on("change",(function(){var f_val=+this.value;var prop_values=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_8__["m"])(d_values,f_val,data_manager.current_layers[layer_name].size[1],type_symbol);redraw_prop_val(prop_values);data_manager.current_layers[layer_name].size[0]=f_val}));var allow_move_section=popup.append("p");var chkbx=allow_move_section.insert("input").style("margin","0").property("checked",data_manager.current_layers[layer_name].draggable?true:null).attrs({type:"checkbox",id:"checkbox_move_symbol"});allow_move_section.insert("label").attr("for","checkbox_move_symbol").html(_tr("app_page.layer_style_popup.let_draggable"));chkbx.on("change",(function(){if(this.checked){data_manager.current_layers[layer_name].draggable=true}else{data_manager.current_layers[layer_name].draggable=false}}));popup.append("p").style("text-align","center").insert("button").attrs({id:"reset_symb_loc",class:"button_st4"}).text(_tr("app_page.layer_style_popup.reset_symbols_location")).on("click",(function(){selection.transition().attrs((function(d){var centroid=path.centroid(d.geometry);if(type_symbol==="circle"){return{cx:centroid[0],cy:centroid[1]}}else{return{x:centroid[0]-+d.properties.prop_value/2,y:centroid[1]-+d.properties.prop_value/2}}}))}));make_generate_labels_section(popup,layer_name)}function make_style_box_indiv_label(label_node){var current_options={size:label_node.style.fontSize,content:label_node.textContent,font:label_node.style.fontFamily,color:label_node.style.fill};if(current_options.color.startsWith("rgb")){current_options.color=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["g"])(current_options.color)}Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["a"])(".styleTextAnnotation");Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["b"])("styleTextAnnotation",_tr("app_page.func_options.label.title_box_indiv"),{widthFitContent:true,draggable:true}).then((function(confirmed){if(!confirmed){label_node.style.fontsize=current_options.size;label_node.textContent=current_options.content;label_node.style.fill=current_options.color;label_node.style.fontFamily=current_options.font}}));var box_content=d3.select(".styleTextAnnotation").select(".modal-content").style("width","300px").select(".modal-body").insert("div");var a=box_content.append("p").attr("class","line_elem");a.insert("span").html(_tr("app_page.func_options.label.font_size"));a.append("input").attrs({type:"number",id:"font_size",min:0,max:34,step:"any"}).styles({width:"70px",float:"right"}).property("value",+label_node.style.fontSize.slice(0,-2)).on("change",(function(){label_node.style.fontSize="".concat(this.value,"px")}));var b=box_content.append("p").attr("class","line_elem");b.insert("span").html(_tr("app_page.func_options.label.content"));b.append("input").attr("id","label_content").styles({width:"70px",float:"right"}).property("value",label_node.textContent).on("keyup",(function(){label_node.textContent=this.value}));var c=box_content.append("p").attr("class","line_elem");c.insert("span").html(_tr("app_page.func_options.common.color"));c.append("input").attrs({type:"color",id:"label_color"}).styles({width:"70px",float:"right"}).property("value",Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["g"])(label_node.style.fill)).on("change",(function(){label_node.style.fill=this.value}));var d=box_content.append("p").attr("class","line_elem");d.insert("span").html(_tr("app_page.func_options.label.font_type"));var selec_fonts=d.append("select").style("float","right").on("change",(function(){label_node.style.fontFamily=this.value}));_fonts__WEBPACK_IMPORTED_MODULE_5__["a"].forEach((function(name){selec_fonts.append("option").attr("value",name[1]).text(name[0])}));selec_fonts.node().value=label_node.style.fontFamily}var createDropShadow=function createDropShadow(layerId){var filt_to_use=document.createElementNS("http://www.w3.org/2000/svg","filter");filt_to_use.setAttribute("id","filt_".concat(layerId));filt_to_use.setAttribute("width","200%");filt_to_use.setAttribute("height","200%");var offset=document.createElementNS("http://www.w3.org/2000/svg","feOffset");offset.setAttributeNS(null,"result","offOut");offset.setAttributeNS(null,"in","SourceAlpha");offset.setAttributeNS(null,"dx","5");offset.setAttributeNS(null,"dy","5");var gaussian_blur=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");gaussian_blur.setAttributeNS(null,"result","blurOut");gaussian_blur.setAttributeNS(null,"in","offOut");gaussian_blur.setAttributeNS(null,"stdDeviation",10);var blend=document.createElementNS("http://www.w3.org/2000/svg","feBlend");blend.setAttributeNS(null,"in","SourceGraphic");blend.setAttributeNS(null,"in2","blurOut");blend.setAttributeNS(null,"mode","normal");filt_to_use.appendChild(offset);filt_to_use.appendChild(gaussian_blur);filt_to_use.appendChild(blend);defs.node().appendChild(filt_to_use);svg_map.querySelector("#".concat(layerId)).setAttribute("filter","url(#filt_".concat(layerId,")"))};function change_layer_name(old_name,new_name){var restart_info=false;if(document.getElementById("info_features").className==="active"){Object(_interface__WEBPACK_IMPORTED_MODULE_9__["g"])();restart_info=true}var old_id=global._app.layer_to_id.get(old_name);var new_id=encodeId(new_name);data_manager.current_layers[new_name]=Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["c"])(data_manager.current_layers[old_name]);delete data_manager.current_layers[old_name];var list_elem=document.querySelector("li.".concat(old_id));list_elem.classList.remove(old_id);list_elem.classList.add(new_id);list_elem.setAttribute("layer_name",new_name);list_elem.innerHTML=list_elem.innerHTML.replace(Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["o"])(old_name),Object(_helpers__WEBPACK_IMPORTED_MODULE_7__["o"])(new_name));var b=svg_map.querySelector("#".concat(old_id));b.id=new_id;var lgd_elems=document.querySelectorAll('g[layer_name="'.concat(old_name,'"]'));lgd_elems.forEach((function(lgd_elem){lgd_elem.setAttribute("layer_name",new_name);lgd_elem.classList.remove("lgdf_".concat(old_id));lgd_elem.classList.add("lgdf_".concat(new_id))}));if(Object.getOwnPropertyNames(data_manager.result_data).indexOf(old_name)>-1){data_manager.result_data[new_name]=[].concat(data_manager.result_data[old_name]);delete data_manager.result_data[old_name]}if(Object.getOwnPropertyNames(data_manager.user_data).indexOf(old_name)>-1){data_manager.user_data[new_name]=[].concat(data_manager.user_data[old_name]);delete data_manager.user_data[old_name]}if(data_manager.current_layers[new_name].targeted){var name_section1=document.getElementById("section1").querySelector("#input_geom");name_section1.innerHTML=name_section1.innerHTML.replace(old_name,new_name);if(window.fields_handler){window.fields_handler.unfill();window.fields_handler.fill(new_name)}}if(_app.current_functionnality&&_app.current_functionnality.name==="smooth"){var mask_layers=document.querySelectorAll("select#stewart_mask > option");for(var i=0;i option");for(var _i4=0;_i4-1){d3.select("#palette_box_error_zone").html(_tr("app_page.palette_box.error_name_existing"));document.querySelector(".swal2-confirm").disabled=true;return null}d3.select("#palette_box_error_zone").html("");document.querySelector(".swal2-confirm").disabled=false;return name}else{d3.select("#palette_box_error_zone").html(_tr("app_page.palette_box.error_name_invalid"));document.querySelector(".swal2-confirm").disabled=true;return null}};return swal({title:_tr("app_page.palette_box.title"),html:'
',showCancelButton:true,showConfirmButton:true,cancelButtonText:_tr("app_page.common.close"),animation:"slide-from-top",onOpen:function onOpen(){document.querySelector(".swal2-modal").style.width="".concat(nb_class*85,"px");var colors=d3.select("#palette_box_content");var g=colors.selectAll("p").data(ref_colors).enter().append("p");g.append("input").attr("id",(function(_,i){return i})).attr("type","color").style("width","60px").property("value",(function(d){return d})).on("change",(function(_,i){ref_colors[i]=this.value;this.nextSibling.value=this.value}));g.append("input").attr("id",(function(_,i){return i})).style("width","60px").property("value",(function(d){return d})).on("keyup",(function(_,i){if(is_hex_color.test(this.value)){ref_colors[i]=this.value;this.previousSibling.value=this.value}}));var bottom=d3.select("#palette_box_name");bottom.append("p").attr("id","palette_box_error_zone").style("background","#e3e3e3");bottom.append("span").html(_tr("app_page.palette_box.new_name"));bottom.append("input").style("width","70px").on("keyup",(function(){if(verif_palette_name(this.value)!==null)pal_name=this.value}));document.querySelector(".swal2-confirm").disabled=true}}).then((function(){return[ref_colors,pal_name]}),(function(){return null}))}var display_discretization=function display_discretization(layer_name,field_name,nb_class,options){var make_no_data_section=function make_no_data_section(){var section=d3.select("#color_div").append("div").attr("id","no_data_section").append("p").html(_tr("disc_box.withnodata",{count:+no_data}));section.append("input").attrs({type:"color",id:"no_data_color"}).style("margin","0px 10px").property("value","#ebebcd")};var make_sequ_button=function make_sequ_button(){var col_div=d3.select("#color_div");col_div.selectAll(".color_params").remove();col_div.selectAll(".color_txt").remove();col_div.selectAll(".color_txt2").remove();col_div.selectAll(".central_class").remove();col_div.selectAll(".central_color").remove();col_div.selectAll("#reverse_pal_btn").remove();document.getElementById("button_palette_box").style.display="";var sequential_color_select=col_div.insert("p").attr("class","color_txt").style("margin-left","10px").html(_tr("disc_box.color_palette")).insert("select").attr("class","color_params").styles({width:"116px","background-image":"url(static/img/palettes/Blues.png)"}).on("change",(function(){this.style.backgroundImage="url(static/img/palettes/".concat(this.value,".png)");redisplay.draw()}));["Blues","BuGn","BuPu","GnBu","OrRd","PuBu","PuBuGn","PuRd","RdPu","YlGn","Greens","Greys","Oranges","Purples","Reds"].forEach((function(name){sequential_color_select.append("option").text(name).attrs({value:name,title:name}).style("background-image","url(static/img/palettes/".concat(name,".png)"))}));if(_app.custom_palettes){var additional_colors=Array.from(_app.custom_palettes.entries());for(var ixp=0;ixp",_tr("disc_box.summary")," ",content_summary].join(""))};var redisplay={compute:function compute(){var tmp;serie=new geostats(values);breaks=[];values=serie.sorted();var deferred=Promise.pending();return new Promise((function(resolve,reject){if(values.length>7500&&type==="jenks"){var jenks_worker=new Worker("static/js/webworker_jenks.js");_app.webworker_to_cancel=jenks_worker;_app.waitingOverlay.display({zIndex:5e3});jenks_worker.postMessage([values,nb_class]);jenks_worker.onmessage=function(e){breaks=e.data;serie.setClassManually(breaks);serie.doCount();stock_class=Array.prototype.slice.call(serie.counter);_app.waitingOverlay.hide();_app.webworker_to_cancel=undefined;bins=[];for(var i=0,len=stock_class.length;imin_serie)breaks[0]=min_serie;if(breaks[nb_class]max_serie){breaks_serie[nb_class]=max_serie}serie.setClassManually(breaks_serie)}else{breaks=serie[_common__WEBPACK_IMPORTED_MODULE_6__["a"].get(type)](nb_class);serie.doCount();stock_class=Array.prototype.slice.call(serie.counter)}if(stock_class.length===0){resolve(false)}bins=[];for(var i=0,len=stock_class.length;i input").checked?document.getElementById("central_color_val").value:[];var class_right=nb_class-ctl_class_value+1,class_left=ctl_class_value-1,max_col_nb=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["c"])(class_right,class_left);var right_pal=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["d"])(max_col_nb,right_palette);var left_pal=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["d"])(max_col_nb,left_palette);right_pal=right_pal.slice(0,class_right);left_pal=left_pal.slice(0,class_left).reverse();color_array=[].concat(left_pal,ctl_class_color,right_pal)}}else{color_array=provided_colors.slice()}for(var i=0,len=bins.length;i20?20:nb_values;var serie=new geostats(values),breaks=[],stock_class=[],bins=[],user_break_list=null,std_dev_params=options.extra_options&&options.extra_options.role_mean?options.extra_options:{role_mean:"center",share:1};if(serie.variance()===0&&serie.stddev()===0){serie=new geostats(values)}var min_serie=serie.min();var max_serie=serie.max();var mean_serie=serie.mean();var stddev_serie=serie.stddev();values=serie.sorted();var available_functions=[[_tr("app_page.common.equal_interval"),"equal_interval"],[_tr("app_page.common.quantiles"),"quantiles"],[_tr("app_page.common.stddev_f"),"stddev_f"],[_tr("app_page.common.Q6"),"Q6"],[_tr("app_page.common.jenks"),"jenks"]];if(!serie._hasZeroValue()&&!serie._hasNegativeValue()){available_functions.push([_tr("app_page.common.geometric_progression"),"geometric_progression"])}var precision_axis=Object(_helpers_calc__WEBPACK_IMPORTED_MODULE_4__["g"])(min_serie,max_serie,serie.precision);var formatCount=d3.format(precision_axis);var discretization_panel=newBox.append("div").attr("id","discretization_panel");var discretization=discretization_panel.insert("p").insert("select").attr("class","params").on("change",(function(){type=this.value;if(type==="stddev_f"){input_section_stddev.style("display","");document.getElementById("nb_class_range").disabled="disabled";txt_nb_class.style("disabled","disabled");disc_nb_class.style("display","none")}else{input_section_stddev.style("display","none");document.getElementById("nb_class_range").disabled=false;txt_nb_class.style("disabled",false);disc_nb_class.style("display","inline")}if(type==="Q6"){update_nb_class(6)}redisplay.compute().then((function(v){if(v)redisplay.draw()}))}));available_functions.forEach((function(func){discretization.append("option").text(func[0]).attr("value",func[1])}));var input_section_stddev=discretization_panel.insert("p").styles({margin:"auto",display:type==="stddev_f"?"":"none"});input_section_stddev.insert("span").html(_tr("disc_box.stddev_share_txt1"));input_section_stddev.insert("input").attrs({type:"number",min:.1,max:10,step:.1,class:"without_spinner",id:"stddev_share"}).styles({width:"45px","margin-left":"10px","margin-right":"10px"}).property("value",std_dev_params.share).on("change",(function(){var val=this.value;if(val===0||val*stddev_serie>max_serie-min_serie||val*stddev_serie*21nb_class)ctl_class.value=Object(_helpers_math__WEBPACK_IMPORTED_MODULE_5__["f"])(nb_class/2)}}}))}));var ref_histo_box=newBox.append("div").attr("id","ref_histo_box");ref_histo_box.append("div").attr("id","inner_ref_histo_box");discretization.node().value=type;make_summary();var refDisplay=Object(_common__WEBPACK_IMPORTED_MODULE_6__["h"])(newBox,serie,formatCount);refDisplay("histogram");var svg_h=h/5>100?h/5:100,svg_w=window.innerWidth-40>760?760:window.innerWidth-40,margin={top:7.5,right:30,bottom:7.5,left:30},height=svg_h-margin.top-margin.bottom;d3.select(container).select(".modal-dialog").styles({width:"".concat(svg_w+margin.top+margin.bottom+90,"px"),height:"".concat(window.innerHeight-60,"px")});if(values.length<500){var current_histo="histogram";ref_histo_box.append("p").style("text-align","center").insert("button").attrs({id:"button_switch_plot",class:"i18n button_st4","data-i18n":"[text]disc_box.switch_ref_histo"}).styles({padding:"3px","font-size":"10px"}).html(_tr("disc_box.switch_ref_histo")).on("click",(function(){var str_tr;if(current_histo==="histogram"){refDisplay("box_plot");current_histo="box_plot";str_tr="_boxplot"}else if(current_histo==="box_plot"){refDisplay("beeswarm");current_histo="beeswarm";str_tr="_beeswarm"}else if(current_histo==="beeswarm"){refDisplay("histogram");current_histo="histogram";str_tr=""}document.getElementById("ref_histo_title").innerHTML="".concat(_tr("disc_box.hist_ref_title"+str_tr)," ")}))}var div_svg=newBox.append("div").append("svg").attrs({id:"svg_discretization",width:svg_w+margin.left+margin.right,height:svg_h+margin.top+margin.bottom});make_box_histo_option();var svg_histo=div_svg.append("g").attr("transform","translate(".concat(margin.left,", ").concat(margin.top,")"));var x=d3.scaleLinear().domain([min_serie,max_serie]).range([0,svg_w]);var y=d3.scaleLinear().range([svg_h,0]);var overlay_svg=div_svg.append("g").attr("transform","translate(30, 0)"),line_mean,line_std_right,line_std_left,line_median,txt_median,txt_mean,rug_plot;make_overlay_elements();svg_histo.append("g").attrs({class:"x_axis",transform:"translate(0,".concat(height,")")}).call(d3.axisBottom().scale(x).tickFormat(formatCount));newBox.append("button").attrs({class:"accordion_disc active",id:"btn_acc_disc_color"}).style("padding","0 6px").html(_tr("disc_box.title_color_scheme"));var accordion_colors=newBox.append("div").attrs({class:"panel show",id:"accordion_colors"}).style("width","98%");var color_scheme=accordion_colors.append("div").attr("id","color_div").style("text-align","center");[[_tr("disc_box.sequential"),"sequential"],[_tr("disc_box.diverging"),"diverging"]].forEach((function(el){color_scheme.insert("label").style("margin","20px").html(el[0]).insert("input").attrs({type:"radio",name:"color_scheme",id:"button_".concat(el[1])}).property("value",el[1]).on("change",(function(){if(this.value==="sequential"){make_sequ_button()}else{make_diverg_button()}redisplay.draw()}))}));var to_reverse=false;document.getElementById("button_sequential").checked=true;accordion_colors.append("span").attr("id","button_palette_box").styles({margin:"5px",float:"right",cursor:"pointer","font-style":"italic"}).html(_tr("app_page.palette_box.button")).on("click",(function(){make_box_custom_palette(nb_class).then((function(result){if(result){var _result=_slicedToArray(result,2),colors=_result[0],palette_name=_result[1];var select_palette=document.querySelector(".color_params");Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_0__["c"])(palette_name,colors);if(select_palette){d3.select(select_palette).append("option").text(palette_name).attrs({value:"user_".concat(palette_name),title:palette_name,nb_colors:colors.length});Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["y"])(select_palette,"user_".concat(palette_name))}}}))}));newBox.append("button").attrs({class:"accordion_disc",id:"btn_acc_disc_break"}).style("padding","0 6px").html(_tr("disc_box.title_break_values"));var accordion_breaks=newBox.append("div").attrs({class:"panel",id:"accordion_breaks_vals"}).style("width","98%");var user_defined_breaks=accordion_breaks.append("div").attr("id","user_breaks");user_defined_breaks.insert("textarea").attrs({id:"user_breaks_area",placeholder:_tr("app_page.common.expected_class")}).style("width","600px");user_defined_breaks.insert("button").text(_tr("app_page.common.valid")).on("click",(function(){user_break_list=document.getElementById("user_breaks_area").value;type="user_defined";redisplay.compute().then((function(v){if(v)redisplay.draw()}))}));Object(_interface__WEBPACK_IMPORTED_MODULE_3__["a"])(".accordion_disc",container);if(no_data>0){make_no_data_section();if(options.no_data){document.getElementById("no_data_color").value=options.no_data}}if(!options.schema){make_sequ_button()}else if(options.schema.length===1){make_sequ_button();document.querySelector(".color_params").value=options.schema[0];document.querySelector(".color_params").style.backgroundImage="url(static/img/palettes/".concat(options.schema[0],".png)")}else if(options.schema.length>1){make_diverg_button();document.getElementById("button_diverging").checked=true;var tmp=0;Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["y"])(document.querySelector(".color_params_left"),options.schema[0]);if(options.schema.length>2){var elem=document.getElementById("central_color_val");elem.style.display="";elem.value=options.schema[1];tmp=1;document.querySelector(".central_color").querySelector("input").checked=true}else{document.querySelector(".central_color").querySelector("input").checked=false}Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["y"])(document.querySelector(".color_params_right"),options.schema[1+tmp])}if(options.type&&options.type==="user_defined"){user_break_list=options.breaks}redisplay.compute().then((function(v){if(v)redisplay.draw(options.colors)}));return new Promise((function(resolve,reject){container.querySelector(".btn_ok").onclick=function(){breaks=breaks.map((function(i){return+i}));var colors_map=[];var no_data_color=null;if(no_data>0){no_data_color=document.getElementById("no_data_color").value}for(var j=0;j text").innerHTML;result.type_geom=data_manager.current_layers[_lyr_name].type}return result};var map_config={},layers_style=[],layers=map.selectAll("g.layer"),map_title=document.getElementById("map_title"),layout_features=document.querySelectorAll(".legend:not(.title):not(.legend_feature)"),zoom_transform=d3.zoomTransform(svg_map);map_config.projection=_app.current_proj_name;if(_app.current_proj_name==="def_proj4"){map_config.custom_projection=_app.last_projection}map_config.projection_scale=proj.scale();map_config.projection_translate=proj.translate();map_config.projection_center=proj.center();map_config.projection_rotation=proj.rotate!==undefined?proj.rotate():undefined;map_config.projection_parallels=proj.parallels!==undefined?proj.parallels():undefined;map_config.projection_parallel=proj.parallel!==undefined?proj.parallel():undefined;map_config.zoom_translate=[zoom_transform.x,zoom_transform.y];map_config.zoom_scale=zoom_transform.k;map_config.div_width=+w;map_config.div_height=+h;map_config.n_layers=layers._groups[0].length;map_config.background_color=map.style("background-color");map_config.canvas_rotation=typeof _map_ctrl__WEBPACK_IMPORTED_MODULE_9__["b"]==="string"?_map_ctrl__WEBPACK_IMPORTED_MODULE_9__["b"].match(/\d+/):undefined;map_config.custom_palettes=Array.from(_app.custom_palettes.entries());if(map_title){map_config.title={content:map_title.textContent,x:map_title.getElementsByTagName("text")[0].getAttribute("x"),y:map_title.getElementsByTagName("text")[0].getAttribute("y"),style:map_title.getElementsByTagName("text")[0].getAttribute("style")}}if(data_manager.joined_dataset.length>0&&data_manager.field_join_map.length===0){map_config.joined_dataset=data_manager.joined_dataset[0];map_config.dataset_name=data_manager.dataset_name}map_config.global_order=Array.from(svg_map.querySelectorAll(".legend,.layer")).map((function(ft){return["#",ft.id,".",ft.className.baseVal.split(" ").join(".")].join("")}));map_config.layout_features={};if(layout_features){for(var i=0;i-1;--_i2){layers_style[_i2]={};var layer_style_i=layers_style[_i2],layer_id=layers._groups[0][_i2].id,layer_name=_app.id_to_layer.get(layer_id),current_layer_prop=data_manager.current_layers[layer_name],layer_type=(current_layer_prop.sphere?"sphere":false)||(current_layer_prop.graticule?"graticule":"layer"),nb_ft=current_layer_prop.n_features;var selection=void 0;layer_style_i.layer_name=layer_name;layer_style_i.layer_type=layer_type;layer_style_i.n_features=nb_ft;layer_style_i.visible=layers._groups[0][_i2].style.visibility!=="hidden"?"":"hidden";layer_style_i.layout_legend_displayed=current_layer_prop.layout_legend_displayed;var lgd=document.getElementsByClassName("lgdf_".concat(layer_id));if(lgd.length===0){layer_style_i.legend=undefined}else if(lgd.length===1){layer_style_i.legend=[get_legend_info(lgd[0])]}else if(lgd.length===2){layer_style_i.legend=lgd[0].id==="legend_root"?[get_legend_info(lgd[0]),get_legend_info(lgd[1])]:[get_legend_info(lgd[1]),get_legend_info(lgd[0])]}if(map.select("#".concat(layer_id)).attr("filter")){layer_style_i.filter_shadow=true}if(current_layer_prop["stroke-width-const"]){layer_style_i["stroke-width-const"]=current_layer_prop["stroke-width-const"]}if(current_layer_prop.pointRadius!==undefined){layer_style_i.pointRadius=current_layer_prop.pointRadius}if(current_layer_prop.fixed_stroke!==undefined){layer_style_i.fixed_stroke=current_layer_prop.fixed_stroke}if(current_layer_prop.colors_breaks){layer_style_i.colors_breaks=current_layer_prop.colors_breaks}if(current_layer_prop.options_disc!==undefined){layer_style_i.options_disc=current_layer_prop.options_disc}if(current_layer_prop.targeted){selection=map.select("#".concat(layer_id)).selectAll("path");layer_style_i.fill_opacity=selection.style("fill-opacity");layer_style_i.targeted=true;layer_style_i.topo_geom=true;layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.fields_type=current_layer_prop.fields_type;layer_style_i.stroke_color=selection.style("stroke")}else if(layer_type==="sphere"||layer_type==="graticule"||layer_name==="World"){selection=map.select("#".concat(layer_id)).selectAll("path");layer_style_i.fill_color=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_3__["g"])(selection.style("fill"));layer_style_i.stroke_color=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_3__["g"])(selection.style("stroke"));if(layer_type==="graticule"){layer_style_i.stroke_dasharray=data_manager.current_layers.Graticule.dasharray;layer_style_i.step=data_manager.current_layers.Graticule.step;layer_style_i.extent=data_manager.current_layers.Graticule.extent}}else if(!current_layer_prop.renderer){selection=map.select("#".concat(layer_id)).selectAll("path");layer_style_i.fill_opacity=selection.style("fill-opacity");layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.topo_geom=true;layer_style_i.stroke_color=selection.style("stroke")}else if(current_layer_prop.renderer.indexOf("PropSymbols")>-1&¤t_layer_prop.type!=="Line"){var type_symbol=current_layer_prop.symbol;selection=map.select("#".concat(layer_id)).selectAll(type_symbol);var features=Array.prototype.map.call(svg_map.querySelector("#".concat(layer_id)).getElementsByTagName(type_symbol),(function(d){return d.__data__}));layer_style_i.symbol=type_symbol;layer_style_i.size_legend_symbol=current_layer_prop.size_legend_symbol;layer_style_i.rendered_field=current_layer_prop.rendered_field;if(current_layer_prop.rendered_field2){layer_style_i.rendered_field2=current_layer_prop.rendered_field2}layer_style_i.current_position=getPropSymbolCurrentPos(selection._groups[0],type_symbol);layer_style_i.renderer=current_layer_prop.renderer;layer_style_i.size=current_layer_prop.size;layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.stroke_color=selection.style("stroke");layer_style_i.ref_layer_name=current_layer_prop.ref_layer_name;layer_style_i.geo_pt={type:"FeatureCollection",features};if(current_layer_prop.renderer==="PropSymbolsTypo"){layer_style_i.color_map=_toConsumableArray(current_layer_prop.color_map)}if(current_layer_prop.break_val){layer_style_i.break_val=current_layer_prop.break_val}}else if((current_layer_prop.renderer.indexOf("PropSymbols")>-1||current_layer_prop.renderer==="LinksProportional")&¤t_layer_prop.type==="Line"){var _type_symbol=current_layer_prop.symbol;selection=map.select("#".concat(layer_id)).selectAll("path");var _features=Array.prototype.map.call(svg_map.querySelector("#".concat(layer_id)).getElementsByTagName("path"),(function(d){return d.__data__}));layer_style_i.symbol=_type_symbol;layer_style_i.rendered_field=current_layer_prop.rendered_field;if(current_layer_prop.rendered_field2){layer_style_i.rendered_field2=current_layer_prop.rendered_field2}layer_style_i.renderer=current_layer_prop.renderer;layer_style_i.size=current_layer_prop.size;layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.ref_layer_name=current_layer_prop.ref_layer_name;layer_style_i.geo_line={type:"FeatureCollection",features:_features};if(current_layer_prop.renderer==="PropSymbolsTypo"){layer_style_i.color_map=_toConsumableArray(current_layer_prop.color_map)}if(current_layer_prop.break_val){layer_style_i.break_val=current_layer_prop.break_val}}else if(["Stewart","Gridded","Choropleth","Categorical","Carto_doug","OlsonCarto"].indexOf(current_layer_prop.renderer)>-1){(function(){selection=map.select("#".concat(layer_id)).selectAll("path");layer_style_i.renderer=current_layer_prop.renderer;layer_style_i.topo_geom=true;layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.stroke_color=selection.style("stroke");layer_style_i.rendered_field=current_layer_prop.rendered_field;layer_style_i.ref_layer_name=current_layer_prop.ref_layer_name;var color_by_id=[];var params=current_layer_prop.type==="Line"?"stroke":"fill";selection.each((function(){color_by_id.push(Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_3__["g"])(this.style[params]))}));layer_style_i.color_by_id=color_by_id;if(current_layer_prop.renderer!=="Categorical"){layer_style_i.options_disc=current_layer_prop.options_disc}else{layer_style_i.color_map=_toConsumableArray(current_layer_prop.color_map)}if(current_layer_prop.renderer==="Stewart"){layer_style_i.color_palette=current_layer_prop.color_palette}else if(current_layer_prop.renderer==="OlsonCarto"){layer_style_i.scale_max=current_layer_prop.scale_max;layer_style_i.scale_byFeature=current_layer_prop.scale_byFeature}})()}else if(current_layer_prop.renderer==="LinksGraduated"||current_layer_prop.renderer==="DiscLayer"){selection=map.select("#".concat(layer_id)).selectAll("path");layer_style_i.renderer=current_layer_prop.renderer;layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.topo_geom=true;layer_style_i.rendered_field=current_layer_prop.rendered_field;layer_style_i.ref_layer_name=current_layer_prop.ref_layer_name;layer_style_i.size=current_layer_prop.size;layer_style_i.min_display=current_layer_prop.min_display;layer_style_i.breaks=current_layer_prop.breaks;if(current_layer_prop.renderer==="LinksGraduated"){layer_style_i.linksbyId=current_layer_prop.linksbyId.slice(0,nb_ft)}}else if(current_layer_prop.renderer==="TypoSymbols"){selection=map.select("#".concat(layer_id)).selectAll("image");layer_style_i.renderer=current_layer_prop.renderer;layer_style_i.symbols_map=_toConsumableArray(current_layer_prop.symbols_map);layer_style_i.rendered_field=current_layer_prop.rendered_field;layer_style_i.ref_layer_name=current_layer_prop.ref_layer_name;var state_to_save=[];var selec=selection._groups[0];for(var ix=0;ix-1;j--){var _s=_selec[j];_features2.push(_s.__data__);current_position.push([+_s.getAttribute("x"),+_s.getAttribute("y"),_s.style.display,_s.style.fontSize,_s.style.fontFamily,_s.style.fill,_s.textContent])}layer_style_i.data_labels=_features2;layer_style_i.current_position=current_position}else if(current_layer_prop.renderer==="TwoStocksWaffle"){var _type_symbol2=current_layer_prop.symbol;selection=map.select("#".concat(layer_id)).selectAll(_type_symbol2);layer_style_i.symbol=_type_symbol2;layer_style_i.rendered_field=current_layer_prop.rendered_field;layer_style_i.renderer=current_layer_prop.renderer;layer_style_i.size=current_layer_prop.size;layer_style_i.fill_color=current_layer_prop.fill_color;layer_style_i.ratio=current_layer_prop.ratio;layer_style_i.nCol=current_layer_prop.nCol;layer_style_i.ref_layer_name=current_layer_prop.ref_layer_name;layer_style_i.result_data=JSON.stringify(data_manager.result_data[layer_name]);layer_style_i.current_position=getWaffleCurrentPos(svg_map.querySelectorAll("#".concat(layer_id," > g")))}else{selection=map.select("#".concat(layer_id)).selectAll("path")}layer_style_i.stroke_opacity=selection.style("stroke-opacity");layer_style_i.fill_opacity=selection.style("fill-opacity")}return Promise.all(layers_style.map((function(obj){return obj.topo_geom?serialize_layer_to_topojson(obj.layer_name):null}))).then((function(result){for(var _i3=0;_i3-1;_i4--){_l[_i4].remove()}_l=document.querySelector("#sortable.layer_list").childNodes;_ll=_l.length;for(var _i5=_ll-1;_i5>-1;_i5--){_l[_i5].remove()}data_manager.current_layers={}};function reorder_layers(desired_order){var layers=svg_map.querySelectorAll(".layer"),parent=layers[0].parentNode,nb_layers=desired_order.length;desired_order=desired_order.map((function(el){return _app.layer_to_id.get(el)}));for(var i=0;i1){var desired_order=layers.map((function(i){return i.layer_name}));reorder_elem_list_layer(desired_order);desired_order.reverse();reorder_layers(desired_order)}}else if(p_version.minor<=4){reorder_layers_elem_legends(map_config.global_order);if(layers.length>1){var _desired_order=layers.map((function(i){return i.layer_name}));reorder_elem_list_layer(_desired_order);_desired_order.reverse();reorder_layers(_desired_order)}}else if(map_config.global_order&&map_config.global_order.length>1&&(p_version.minor>4||p_version.minor===4&&p_version.patch>1)){var order=layers.map((function(i){return i.layer_name}));reorder_elem_list_layer(order);reorder_layers_elem_legends(map_config.global_order)}if(map_config.canvas_rotation){document.getElementById("form_rotate").value=map_config.canvas_rotation;document.getElementById("canvas_rotation_value_txt").value=map_config.canvas_rotation;Object(_map_ctrl__WEBPACK_IMPORTED_MODULE_9__["g"])(map_config.canvas_rotation)}_app.waitingOverlay.hide();var targeted_layer=Object.getOwnPropertyNames(data_manager.user_data)[0];if(targeted_layer)Object(_helpers__WEBPACK_IMPORTED_MODULE_6__["k"])(targeted_layer);for(var ii=0;ii0&&custom_name[0].length>1?custom_name[0][1].name:undefined;Object(_projections__WEBPACK_IMPORTED_MODULE_10__["a"])(_app.current_proj_name,_app.last_projection,custom_name)}else{proj=d3[_projections__WEBPACK_IMPORTED_MODULE_10__["b"].get(_app.current_proj_name).name]();Object(_projections__WEBPACK_IMPORTED_MODULE_10__["a"])(_app.current_proj_name)}if(map_config.projection_parallels)proj=proj.parallels(map_config.projection_parallels);if(map_config.projection_parallel)proj=proj.parallel(map_config.projection_parallel);if(map_config.projection_clipAngle)proj=proj.clipAngle(map_config.projection_clipAngle);s=map_config.projection_scale;t=map_config.projection_translate;proj.scale(s).translate(t);if(map_config.projection_rotation)proj=proj.rotate(map_config.projection_rotation);defs=map.append("defs");path=d3.geoPath().projection(proj).pointRadius(4);map.selectAll(".layer").selectAll("path").attr("d",path);map.style("background-color",map_config.background_color);document.querySelector("input#bg_color").value=Object(_colors_helpers__WEBPACK_IMPORTED_MODULE_3__["g"])(map_config.background_color);if(map_config.joined_dataset){data_manager.field_join_map=[];data_manager.joined_dataset=[map_config.joined_dataset.slice()];data_manager.dataset_name=map_config.dataset_name;Object(_interface__WEBPACK_IMPORTED_MODULE_5__["v"])()}var _loop=function _loop(i){var _layer=layers[i];var layer_name=_layer.layer_name,layer_type=_layer.layer_type,layer_id=void 0;if(app_version===undefined||p_version.major===0&&p_version.minor<=3&&p_version.patch<3){if(layer_name==="Sphere"){layer_type="sphere"}else if(layer_name==="Graticule"){layer_type="graticule"}}var fill_opacity=_layer.fill_opacity,stroke_opacity=_layer.stroke_opacity;if(_layer.topo_geom){var tmp={skip_alert:true,choosed_name:layer_name,skip_rescale:true};if(_layer.targeted){tmp.target_layer_on_add=true}else if(_layer.renderer){tmp.func_name=func_name_corresp.get(_layer.renderer);tmp.result_layer_on_add=true}if(_layer.pointRadius!==undefined){tmp.pointRadius=_layer.pointRadius}layer_name=Object(_interface__WEBPACK_IMPORTED_MODULE_5__["k"])(_layer.topo_geom,tmp);var current_layer_prop=data_manager.current_layers[layer_name];if(_layer.renderer){current_layer_prop.renderer=_layer.renderer}if(_layer.targeted&&_layer.fields_type){current_layer_prop.fields_type=_layer.fields_type;document.getElementById("btn_type_fields").removeAttribute("disabled")}layer_id=_app.layer_to_id.get(layer_name);var layer_selec=map.select("#".concat(layer_id));var layer_selec_all=layer_selec.selectAll("path");current_layer_prop.rendered_field=_layer.rendered_field;if(_layer.layout_legend_displayed)current_layer_prop.layout_legend_displayed=_layer.layout_legend_displayed;if(_layer.ref_layer_name)current_layer_prop.ref_layer_name=_layer.ref_layer_name;if(_layer.size)current_layer_prop.size=_layer.size;if(_layer.colors_breaks)current_layer_prop.colors_breaks=_layer.colors_breaks;if(_layer.options_disc)current_layer_prop.options_disc=_layer.options_disc;if(_layer.fill_color)current_layer_prop.fill_color=_layer.fill_color;if(_layer.color_palette)current_layer_prop.color_palette=_layer.color_palette;if(_layer.renderer){if(["Choropleth","Stewart","Gridded"].indexOf(_layer.renderer)>-1){layer_selec_all.style(current_layer_prop.type==="Line"?"stroke":"fill",(function(d,j){return _layer.color_by_id[j]}))}else if(_layer.renderer==="LinksGraduated"){current_layer_prop.linksbyId=_layer.linksbyId;current_layer_prop.min_display=_layer.min_display;current_layer_prop.breaks=_layer.breaks;layer_selec_all.styles((function(d,j){return{display:+d.properties.fij>_layer.min_display?null:"none",stroke:_layer.fill_color.single,"stroke-width":current_layer_prop.linksbyId[j][2]}}))}else if(_layer.renderer==="DiscLayer"){current_layer_prop.min_display=_layer.min_display||0;current_layer_prop.breaks=_layer.breaks;var lim=current_layer_prop.min_display!==0?current_layer_prop.min_display*data_manager.current_layers[layer_name].n_features:-1;layer_selec_all.styles((function(d,j){return{fill:"none",stroke:_layer.fill_color.single,display:j<=lim?null:"none","stroke-width":d.properties.prop_val}}))}else if(_layer.renderer.startsWith("Categorical")){Object(_function__WEBPACK_IMPORTED_MODULE_4__["i"])(layer_name,{colorByFeature:_layer.color_by_id,color_map:new Map(_layer.color_map),rendered_field:_layer.rendered_field,renderer:"Categorical"})}}if(_layer.stroke_color){layer_selec_all.style("stroke",_layer.stroke_color)}if(_layer["stroke-width-const"]){current_layer_prop["stroke-width-const"]=_layer["stroke-width-const"];layer_selec.style("stroke-width",_layer["stroke-width-const"])}if(_layer.fixed_stroke){current_layer_prop.fixed_stroke=_layer.fixed_stroke}if(_layer.legend){rehandle_legend(layer_name,_layer.legend)}if(_layer.fill_color&&_layer.fill_color.single&&_layer.renderer!=="DiscLayer"){layer_selec_all.style(current_layer_prop.type!=="Line"?"fill":"stroke",_layer.fill_color.single)}else if(_layer.fill_color&&_layer.fill_color.random){layer_selec_all.style(current_layer_prop.type!=="Line"?"fill":"stroke",(function(){return _colors_helpers__WEBPACK_IMPORTED_MODULE_3__["a"].names[_colors_helpers__WEBPACK_IMPORTED_MODULE_3__["a"].random()]}))}Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_7__["b"])(layer_selec_all,Math.min(_layer["stroke-width-const"]||1,stroke_opacity||1));layer_selec_all.styles({"fill-opacity":fill_opacity,"stroke-opacity":stroke_opacity});if(_layer.visible==="hidden"){Object(_interface__WEBPACK_IMPORTED_MODULE_5__["i"])(layer_name)}if(_layer.filter_shadow){Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_7__["a"])(layer_id)}done+=1;if(done===map_config.n_layers)set_final_param()}else if(layer_name==="World"){Object(_interface__WEBPACK_IMPORTED_MODULE_5__["b"])({skip_rescale:true,fill:_layer.fill_color,stroke:_layer.stroke_color,fill_opacity,stroke_opacity,stroke_width:"".concat(_layer["stroke-width-const"],"px"),visible:_layer.visible!=="hidden",drop_shadow:_layer.filter_shadow});done+=1;if(done===map_config.n_layers)set_final_param()}else{if(layer_type==="sphere"||layer_type==="graticule"){var options={layer_name,stroke:_layer.stroke_color,fill_opacity,stroke_opacity,stroke_width:"".concat(_layer["stroke-width-const"],"px")};if(layer_type==="graticule"){options.fill="none";options.stroke_dasharray=_layer.stroke_dasharray;options.step=_layer.step;options.extent=_layer.extent}else{options.fill=_layer.fill_color}Object(_layout_features_helpers__WEBPACK_IMPORTED_MODULE_14__["a"])(layer_type,options);layer_id=_app.layer_to_id.get(layer_name)}else if(_layer.renderer&&(_layer.renderer.startsWith("PropSymbol")||_layer.renderer==="LinksProportional")){var geojson_layer=_layer.geo_line||_layer.geo_pt;var _s2=_layer.symbol==="path"?"line":_layer.symbol;var rendering_params={new_name:layer_name,field:_layer.rendered_field,ref_value:_layer.size[0],ref_size:_layer.size[1],symbol:_s2,nb_features:geojson_layer.features.length,ref_layer_name:_layer.ref_layer_name,renderer:_layer.renderer};if(_layer.renderer==="PropSymbolsChoro"||_layer.renderer==="PropSymbolsTypo"){rendering_params.fill_color=_layer.fill_color["class"]}else if(_layer.fill_color.random){rendering_params.fill_color="#fff"}else if(_layer.fill_color.single!==undefined){rendering_params.fill_color=_layer.fill_color.single}else if(_layer.fill_color.two){rendering_params.fill_color=_layer.fill_color;rendering_params.break_val=_layer.break_val}if(_layer.symbol==="line"||_layer.symbol==="path"){Object(_function__WEBPACK_IMPORTED_MODULE_4__["f"])(rendering_params,geojson_layer)}else{Object(_function__WEBPACK_IMPORTED_MODULE_4__["g"])(rendering_params,geojson_layer);if(_layer.stroke_color){map.select("#".concat(_app.layer_to_id.get(layer_name))).selectAll(_layer.symbol).style("stroke",_layer.stroke_color)}}if(_layer.renderer==="PropSymbolsTypo"){data_manager.current_layers[layer_name].color_map=new Map(_layer.color_map)}if(_layer.options_disc){data_manager.current_layers[layer_name].options_disc=_layer.options_disc}if(_layer.rendered_field2){data_manager.current_layers[layer_name].rendered_field2=_layer.rendered_field2}if(_layer.colors_breaks){data_manager.current_layers[layer_name].colors_breaks=_layer.colors_breaks}if(_layer.size_legend_symbol){data_manager.current_layers[layer_name].size_legend_symbol=_layer.size_legend_symbol}if(_layer.legend){rehandle_legend(layer_name,_layer.legend)}data_manager.current_layers[layer_name]["stroke-width-const"]=_layer["stroke-width-const"];layer_id=_app.layer_to_id.get(layer_name);var _layer_selec=map.select("#".concat(layer_id)).selectAll(_layer.symbol);_layer_selec.styles({"stroke-width":"".concat(_layer["stroke-width-const"],"px"),"fill-opacity":fill_opacity,"stroke-opacity":stroke_opacity});if(_layer.fill_color.random){_layer_selec.style("fill",(function(){return _colors_helpers__WEBPACK_IMPORTED_MODULE_3__["a"].names[_colors_helpers__WEBPACK_IMPORTED_MODULE_3__["a"].random()]}))}if(_layer.current_position){at_end.push([restorePreviousPos,layer_id,_layer.current_position,_layer.symbol])}}else if(_layer.renderer&&_layer.renderer.startsWith("Label")){var _rendering_params={uo_layer_name:layer_name,label_field:_layer.rendered_field,color:_layer.fill_color,ref_font_size:_layer.default_size,font:_layer.default_font};Object(_function__WEBPACK_IMPORTED_MODULE_4__["j"])(null,_rendering_params,{data:_layer.data_labels,current_position:_layer.current_position});layer_id=_app.layer_to_id.get(layer_name)}else if(_layer.renderer&&_layer.renderer==="TwoStocksWaffle"){Object(_function__WEBPACK_IMPORTED_MODULE_4__["l"])(undefined,{nCol:_layer.nCol,ratio:_layer.ratio,symbol_type:_layer.symbol,new_name:layer_name,size:_layer.size,ref_colors:_layer.fill_color,fields:_layer.rendered_field,result_data:_layer.result_data});layer_id=_app.layer_to_id.get(layer_name);map.select("#".concat(layer_id)).selectAll(_layer.symbol).style("fill-opacity",_layer.fill_opacity);if(_layer.legend){rehandle_legend(layer_name,_layer.legend)}if(_layer.current_position){at_end.push([restorePreviousPosWaffle,layer_id,_layer.current_position,_layer.symbol])}}else if(_layer.renderer&&_layer.renderer.startsWith("TypoSymbol")){var symbols_map=new Map(_layer.symbols_map);var new_layer_data={type:"FeatureCollection",features:_layer.current_state.map((function(d){return d.data}))};var nb_features=new_layer_data.features.length;var context_menu=new _context_menu__WEBPACK_IMPORTED_MODULE_2__["a"];var getItems=function getItems(self_parent){return[{name:_tr("app_page.common.edit_style"),action:function action(){Object(_symbols_picto__WEBPACK_IMPORTED_MODULE_11__["c"])(self_parent)}},{name:_tr("app_page.common.delete"),action:function action(){self_parent.style.display="none"}}]};layer_id=encodeId(layer_name);_app.layer_to_id.set(layer_name,layer_id);_app.id_to_layer.set(layer_id,layer_name);map.append("g").attrs({id:layer_id,class:"layer"}).selectAll("image").data(new_layer_data.features).enter().insert("image").attrs((function(d,j){var symb=symbols_map.get(d.properties.symbol_field),prop=_layer.current_state[j],coords=prop.pos;return{x:coords[0]-symb[1]/2,y:coords[1]-symb[1]/2,width:prop.size,height:prop.size,"xlink:href":symb[0]}})).style("display",(function(d,j){return _layer.current_state[j].display})).on("mouseover",(function(){this.style.cursor="pointer"})).on("mouseout",(function(){this.style.cursor="initial"})).on("contextmenu dblclick",(function(){context_menu.showMenu(d3.event,document.querySelector("body"),getItems(this))})).call(_helpers__WEBPACK_IMPORTED_MODULE_6__["h"]);Object(_helpers__WEBPACK_IMPORTED_MODULE_6__["f"])(layer_name,nb_features,["Point","symbol"],"result");data_manager.current_layers[layer_name]={n_features:nb_features,renderer:"TypoSymbols",symbols_map,rendered_field:_layer.rendered_field,is_result:true,symbol:"image",ref_layer_name:_layer.ref_layer_name};if(_layer.legend){rehandle_legend(layer_name,_layer.legend)}}else{null}if(_layer.filter_shadow){Object(_layers_style_popup__WEBPACK_IMPORTED_MODULE_7__["a"])(layer_id)}if(_layer.visible==="hidden"&&layer_name!=="World"){Object(_interface__WEBPACK_IMPORTED_MODULE_5__["i"])(layer_name)}done+=1;if(done===map_config.n_layers)set_final_param()}};for(var i=map_config.n_layers-1;i>-1;--i){_loop(i)}}var beforeUnloadWindow=function beforeUnloadWindow(event){get_map_project().then((function(jsonParams){window.localStorage.removeItem("magrit_project");if(jsonParams.length<55e5){window.localStorage.setItem("magrit_project",jsonParams)}}));event.returnValue=global._app.targeted_layer_added||Object.getOwnPropertyNames(data_manager.result_data).length>0?"Confirm exit":undefined}}).call(this,__webpack_require__(21),__webpack_require__(19))},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(Promise){__webpack_require__.d(__webpack_exports__,"b",(function(){return display_box_symbol_typo}));__webpack_require__.d(__webpack_exports__,"a",(function(){return box_choice_symbol}));__webpack_require__.d(__webpack_exports__,"c",(function(){return make_style_box_indiv_symbol}));var sortablejs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(30);var _dialogs__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4);var _helpers__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(0);var display_box_symbol_typo=function display_box_symbol_typo(layer,field,categories){var fetch_symbol_categories=function fetch_symbol_categories(){var categ=document.getElementsByClassName("typo_class");var symbol_map=new Map;for(var i=0;i7){var img=selec.style.backgroundImage.split("url(")[1].substring(1).slice(0,-2);var size=+categ[i].querySelector("#symbol_size").value;symbol_map.set(categ[i].__data__.name,[img,size,new_name,cats[i].nb_elem])}else{symbol_map.set(categ[i].__data__.name,[null,0,new_name,cats[i].nb_elem])}}return symbol_map};var nb_features=data_manager.current_layers[layer].n_features,data_layer=data_manager.user_data[layer],cats=[],res_symbols=_app.default_symbols,default_d_url='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAACMCAYAAACuwEE+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADVwAAA1cBPbpBvAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAATySURBVHic7dxNiFVlHIDxZ5z8yvKjMgOTFLI0IrQMSg2jIFpESYSbyCGICqKINu6Kdm1KihZtomgRURRI9EH0YQXWLqJFqG1KIsiKQog+MFu8M1R3mo//nXPO+75znh+czVy55/+eeZy59753LkiSJEmSpCGN5B6gQRuAbQNfOwkcAc4GPux8IhXtLuDUwPErsAP4Dbg132jzx4LcA3RgFFgMvAzcmXmW6vUhmIk1jgLPAg9lnKV6fQoG0mO2x4HHMs1Svb4FM2Ef8PQUt2kafbhgU63xPuAFYGGHs1Svz8EA3A68BiztaJbq9SGY0Rluvwl4C1jewSzV60Mws1njLuB9YHXLs1TPYP5xBfARsK7FWapnMP+1CfgYuKilWapnMJNdQIpmawuzVM9g/t+5wAfAzoZnqV4fgpnpWdJUVgDvArsbnKV6fQhmLmtcDLwCjDU0S/UMZmanAc8BDzYwS/UMZnZGgP24aWkwQfuApxq+z6r0YeFNr/F+4HnSr6re6UMwwz5Lms4dwKvAkhbuu2h9CKatNd5M2rQ8s6X7L5LBzM21pE3Lc1o8R1EMZu62kTYtz2/5PEUwmGZsJu0/bezgXFkZTHPWk6LZ0tH5sjCYZq0hbVru6PCcnepDMG08rZ7OSuAd4MaOz9uJPgSTY42nAweAPRnO3SqDac8i4EXg7kznb4XBtGsUeIa0BzUvGEz7Rki73E8yDz5eJffF7EIpa3yAebBpWcrFbFNJa9xLegdftZuWJV3MtpS2xt3AG1S6aVnaxWxDiWu8DniP9FFqVSnxYjat1DVeSdq0XJt7kIhSL2aTSl7jJaT9pwtzDzJbJV/MpnS9NRC1gRTNZbkHmY0+BFPDGs8DDgLbM88xoxou5lzVssZVpE3LG3IPMp1aLuZc1LTGZcDrwG25B5lKTRdzWLWtcRHwEumDqotT9cvUs/Qo6a8WJ6wauH2UyR9XthA4Y+BrS5j8WXjLSN/gf1vO5Afag+dcQPpj/+nOuQc4THpAXIw+BPPD+KEG1PbjWpkZjEIMRiEGoxCDUYjBKMRgFGIwCjEYhRiMQgxGIQajEINRiMEoxGAUYjAKMRiFGIxCDEYhBqMQg1GIwSjEYBRiMAoxGIUYjEIMRiEGoxCDUYjBKMRgFGIwCjEYhRiMQgxGIQajEINRiMEoxGAUYjAKMRiFGIxCDEYhBqMQg1GIwSjEYBRiMAoxGIUYjEIMRiEGoxCDUYjBKMRgFGIwCjEYhRiMQgxGIQajEINRiMEoZCT3AENaDewErgEuBtYDG4ClA//uFHAUOAIcBj4BDgI/djSnMloJ3AscAv4ixTDMcRL4FLgHWN7pCtSJZcDDwAmGj2Sq4wTwyPg5NA9sB47RfCiDxzFgR0drUkvGgD9oP5aJ43dgbycrU+N2kb6BXcUycfwJXN/B+tSgRcDXdB/LxPHN+AyqxBj5Ypk4xlpfZaVKfOHuqtwDAFfnHqBUJQazLvcAlDFDkUoM5rvcAwDf5h6gVCUG82buAShjBs3SKPA5+R7wfjY+gyqyGThO97F8D2zqYH1qweV0G81xYGsnK1Nr1gAHaD+Wt4G1Ha1JLRsBbiG9raHpUA6N33et7wvSDLYD+4GvGD6Sr4An8MW5odT8P2sjsAW4lPQg+SzSm6xWjN/+C/Az8BPwJfAF6dnX0c4nlSRJkiRJgr8BhBGnmRww0QYAAAAASUVORK5CYII=")';if(!categories){categories=new Map;for(var i=0;i".concat(_tr("app_page.box_choice_symbol.select_symbol"),""));var box_select=newbox.append("div").styles({width:"190px",height:"100px",overflow:"auto",border:"1.5px solid #1d588b"}).attr("id","symbols_select");box_select.selectAll("p").data(sample_symbols).enter().append("p").attrs((function(d){return{id:"p_".concat(d[0].replace(".png","")),title:d[0]}})).styles((function(d){return{width:"32px",height:"32px",margin:"auto",display:"inline-block","background-size":"32px 32px","background-image":'url("'.concat(d[1],'")')}})).on("click",(function(){box_select.selectAll("p").each((function(){this.style.border="";this.style.padding="0px"}));this.style.padding="-1px";this.style.border="1px dashed red";btn_ok.disabled=false;newbox.select("#current_symb").style("background-image",this.style.backgroundImage)}));newbox.append("p").attr("display","inline").html("".concat(_tr("app_page.box_choice_symbol.upload_symbol")," "));newbox.append("p").styles({margin:"auto","text-align":"center"}).append("button").html(_tr("app_page.box_choice_symbol.browse")).on("click",(function(){var input=document.createElement("input");input.setAttribute("type","file");input.setAttribute("accept",".jpeg,.jpg,.svg,.png,.gif");input.onchange=function(event){var file=event.target.files[0];var reader=new FileReader;reader.onloadend=function(){var dataUrl_res=['url("',reader.result,'")'].join("");btn_ok.disabled=false;newbox.select("#current_symb").style("background-image",dataUrl_res)};reader.readAsDataURL(file)};input.dispatchEvent(new MouseEvent("click"))}));newbox.insert("p").style("text-align","center").html(_tr("app_page.box_choice_symbol.selected_symbol"));newbox.insert("div").style("text-align","center").append("p").attrs({class:"symbol_section",id:"current_symb"}).styles({width:"32px",height:"32px",margin:"auto",display:"inline-block","border-radius":"10%","background-size":"32px 32px","vertical-align":"middle","background-image":"url('')"});return new Promise((function(resolve,reject){var fn_cb=function fn_cb(evt){helper_esc_key_twbs_cb(evt,_onclose)};var clean_up_box=function clean_up_box(){container.remove();if(parent_css_selector){Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["e"])(parent_css_selector)}else{_dialogs__WEBPACK_IMPORTED_MODULE_1__["d"].hide()}document.removeEventListener("keydown",fn_cb)};container.querySelector(".btn_ok").onclick=function(){var res_url=newbox.select("#current_symb").style("background-image");resolve(res_url);clean_up_box()};var _onclose=function _onclose(){resolve(false);clean_up_box()};container.querySelector(".btn_cancel").onclick=_onclose;container.querySelector("#xclose").onclick=_onclose;document.addEventListener("keydown",fn_cb)}))}function make_style_box_indiv_symbol(symbol_node){var parent=symbol_node.parentElement;var type_obj=parent.classList.contains("layer")?"layer":"layout";var current_options={size:+symbol_node.getAttribute("width").replace("px",""),scalable:!!(type_obj==="layout"&&parent.classList.contains("scalable-legend"))};var ref_coords={x:+symbol_node.getAttribute("x")+current_options.size/2,y:+symbol_node.getAttribute("y")+current_options.size/2};var ref_coords2=Object(_helpers__WEBPACK_IMPORTED_MODULE_2__["c"])(ref_coords);Object(_dialogs__WEBPACK_IMPORTED_MODULE_1__["b"])("styleSingleSymbol",_tr("app_page.single_symbol_edit_box.title"),{widthFitContent:true}).then((function(confirmed){if(!confirmed){symbol_node.setAttribute("width","".concat(current_options.size,"px"));symbol_node.setAttribute("height","".concat(current_options.size,"px"));symbol_node.setAttribute("x",ref_coords.x-current_options.size/2);symbol_node.setAttribute("y",ref_coords.y-current_options.size/2);if(current_options.scalable){var zoom_scale=svg_map.__zoom;parent.setAttribute("transform","translate(".concat(zoom_scale.x,",").concat(zoom_scale.y,") scale(").concat(zoom_scale.k,",").concat(zoom_scale.k,")"));if(!parent.classList.contains("scalable-legend")){parent.classList.add("scalable-legend")}}else if(!parent.classList.contains("layer")){parent.removeAttribute("transform",undefined);if(parent.classList.contains("scalable-legend")){parent.classList.remove("scalable-legend")}}}}));var box_content=d3.select(".styleSingleSymbol").select(".modal-body").style("width","295px").insert("div");var a=box_content.append("p").attr("class","line_elem");a.append("span").html(_tr("app_page.single_symbol_edit_box.image_size"));a.append("input").styles({float:"right",width:"70px"}).attrs({type:"number",id:"font_size",min:0,max:150,step:"any"}).property("value",current_options.size).on("change",(function(){var val=+this.value;symbol_node.setAttribute("width","".concat(val,"px"));symbol_node.setAttribute("height","".concat(val,"px"));symbol_node.setAttribute("x",ref_coords2.x-val/2);symbol_node.setAttribute("y",ref_coords2.y-val/2)}));if(type_obj==="layout"){var b=box_content.append("p").attr("class","line_elem");b.append("label").attrs({for:"checkbox_symbol_zoom_scale",class:"i18n","data-i18n":"[html]app_page.single_symbol_edit_box.scale_on_zoom"}).html(_tr("app_page.single_symbol_edit_box.scale_on_zoom"));b.append("input").style("float","right").attrs({type:"checkbox",id:"checkbox_symbol_zoom_scale"}).on("change",(function(){var zoom_scale=svg_map.__zoom;if(this.checked){symbol_node.setAttribute("x",(symbol_node.x.baseVal.value-zoom_scale.x)/zoom_scale.k);symbol_node.setAttribute("y",(symbol_node.y.baseVal.value-zoom_scale.y)/zoom_scale.k);parent.setAttribute("transform","translate(".concat(zoom_scale.x,",").concat(zoom_scale.y,") scale(").concat(zoom_scale.k,",").concat(zoom_scale.k,")"));parent.classList.add("scalable-legend")}else{symbol_node.setAttribute("x",symbol_node.x.baseVal.value*zoom_scale.k+zoom_scale.x);symbol_node.setAttribute("y",symbol_node.y.baseVal.value*zoom_scale.k+zoom_scale.y);parent.removeAttribute("transform");parent.classList.remove("scalable-legend")}ref_coords2.x=+symbol_node.getAttribute("x");ref_coords2.y=+symbol_node.getAttribute("y")}));document.getElementById("checkbox_symbol_zoom_scale").checked=current_options.scalable}}}).call(this,__webpack_require__(21))},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(Promise){__webpack_require__.d(__webpack_exports__,"a",(function(){return display_categorical_box}));var sortablejs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(30);var _colors_helpers__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(6);var _dialogs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(4);function fetch_categorical_colors(){var categ=document.getElementsByClassName("typo_class"),color_map=new Map;for(var i=0;i0){newbox.insert("p").attr("class","button_copy_style").styles({margin:"5px",cursor:"pointer","font-style":"italic"}).html(_tr("app_page.categorical_box.copy_style")).on("click",(function(){make_box_copy_style_categorical(existing_typo_layer).then((function(result){if(result){var ref_map=data_manager.current_layers[result].color_map;var selection=newbox.select("#sortable_typo_name").selectAll("li");selection.selectAll("input.typo_name").each((function(d){var r=ref_map.get(d.name);if(r){d.display_name=r[1];this.value=r[1]}}));selection.selectAll("p").each((function(d){var r=ref_map.get(d.name);if(r){d.color=r[0];this.style.backgroundColor=r[0];this.nextSibling.value=r[0]}}))}}))}))}new sortablejs__WEBPACK_IMPORTED_MODULE_0__["default"](document.getElementById("sortable_typo_name"));var container=document.getElementById("categorical_box");return new Promise((function(resolve,reject){var _onclose=function _onclose(){resolve(false);document.removeEventListener("keydown",helper_esc_key_twbs);container.remove();var p=Object(_dialogs__WEBPACK_IMPORTED_MODULE_2__["e"])();if(!p)_dialogs__WEBPACK_IMPORTED_MODULE_2__["d"].hide()};container.querySelector(".btn_ok").onclick=function(){var color_map=fetch_categorical_colors();var colorByFeature=data_layer.map((function(ft){return color_map.get(ft[field])[0]}));resolve([nb_class,color_map,colorByFeature]);document.removeEventListener("keydown",helper_esc_key_twbs);container.remove();var p=Object(_dialogs__WEBPACK_IMPORTED_MODULE_2__["e"])();if(!p)_dialogs__WEBPACK_IMPORTED_MODULE_2__["d"].hide()};container.querySelector(".btn_cancel").onclick=_onclose;container.querySelector("#xclose").onclick=_onclose;function helper_esc_key_twbs(evt){var _event=evt||window.event;var isEscape="key"in _event?_event.key==="Escape"||_event.key==="Esc":_event.keyCode===27;if(isEscape){_event.stopPropagation();_onclose()}}document.addEventListener("keydown",helper_esc_key_twbs);_dialogs__WEBPACK_IMPORTED_MODULE_2__["d"].display()}))}function make_box_copy_style_categorical(existing_typo_layer){var selected_layer=existing_typo_layer[0];return swal({title:_tr("app_page.categorical_box.title_copy_style_box"),html:'
',showCancelButton:true,showConfirmButton:true,cancelButtonText:_tr("app_page.common.close"),animation:"slide-from-top",onOpen:function onOpen(){document.querySelector(".swal2-modal").style.width="400px";var content=d3.select("#copy_style_box_content");var select_layer=content.append("select");existing_typo_layer.forEach((function(layer_name){select_layer.append("option").attr("value",layer_name).html(layer_name)}));select_layer.on("change",(function(){selected_layer=this.value}))}}).then((function(){return selected_layer}),(function(){return null}))}}).call(this,__webpack_require__(21))},,,,function(module,__webpack_exports__,__webpack_require__){"use strict";(function(Promise){__webpack_require__.d(__webpack_exports__,"b",(function(){return make_table}));__webpack_require__.d(__webpack_exports__,"a",(function(){return boxExplore2}));var _dialogs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(4);var _helpers__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(0);function get_fun_operator(operator){var operators=new Map([["+",function(a,b){return a+b}],["-",function(a,b){return a-b}],["/",function(a,b){if(b===0){return""}return a/b}],["*",function(a,b){return a*b}],["^",function(a,b){return Math.pow(a,b)}]]);return operators.get(operator)}function add_field_table(table,layer_name,reOpenTableBox){function check_name(){if(regexp_name.test(this.value)||this.value===""){chooses_handler.new_name=this.value}else{this.value=chooses_handler.new_name;swal({title:"".concat(_tr("Error"),"!"),text:_tr("Unauthorized character!"),type:"error",allowOutsideClick:false})}}function compute_and_add(){var options=chooses_handler,fi1=options.field1,fi2=options.field2,new_name_field=options.new_name,operation=options.operator;var opt_val=options.opt_val;if(!regexp_name.test(new_name_field)){swal({title:"",text:_tr("app_page.explore_box.add_field_box.invalid_name"),type:"error",allowOutsideClick:false});return Promise.reject("Invalid name")}if(options.type_operation==="math_compute"&&table.length>3200){var formToSend=new FormData;var var1=[],var2=fi2==="user_const_value"?+opt_val:[];for(var i=0;i=0){for(var _i5=0;_i5430?430:undefined,height:h>280?280:undefined}).then((function(valid){if(valid){document.querySelector("body").style.cursor="wait";compute_and_add(chooses_handler).then((function(){var prop_layer=data_manager.current_layers[layer_name];if(prop_layer&&prop_layer.targeted){var type_field=Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["A"])(table).find((function(el){return el.name===chooses_handler.new_name}));var existing=prop_layer.fields_type.findIndex((function(el){return el.name===type_field.name}));if(existing<0){prop_layer.fields_type.push(type_field)}else{prop_layer.fields_type[existing]=type_field}Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["k"])(layer_name);if(window.fields_handler){fields_handler.unfill();fields_handler.fill(layer_name)}}if(reOpenTableBox){boxExplore2.create(layer_name)}}),(function(error){if(error!=="Invalid name"){Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["g"])()}console.log(error);document.querySelector("body").style.cursor=""})).done((function(){document.querySelector("body").style.cursor=""}))}}));var fields_type=Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["z"])(layer_name);var regexp_name=new RegExp(/^[a-z0-9_]+$/i);var container=document.querySelector(".twbs > .addFieldBox");var box_content=d3.select(container).select(".modal-body").append("div");var div1=box_content.append("div").attr("id","field_div1");var div2=box_content.append("div").attr("id","field_div2");div1.append("p").html(_tr("app_page.explore_box.add_field_box.new_name")).insert("input").property("value",_tr("app_page.explore_box.add_field_box.new_name_placeholder")).on("keyup",check_name);var type_content=div1.append("p").html(_tr("app_page.explore_box.add_field_box.new_content")).insert("select").attr("id","type_content_select").on("change",(function(){chooses_handler.type_operation=this.value;refresh_type_content(this.value)}));[[_tr("app_page.explore_box.add_field_box.between_numerical"),"math_compute"],[_tr("app_page.explore_box.add_field_box.between_string"),"string_field"]].forEach((function(d){type_content.append("option").text(d[0]).attr("value",d[1])}));var field1=div1.append("select").on("change",(function(){chooses_handler.field1=this.value}));var operator=div1.append("select").on("change",(function(){chooses_handler.operator=this.value;refresh_subtype_content(chooses_handler.type_operation,this.value)}));var field2=div1.append("select").on("change",(function(){chooses_handler.field2=this.value}));var txt_op=div2.append("p").attr("id","txt_opt").text("");var val_opt=div2.append("input").attr("id","val_opt").style("display","none").on("change",(function(){chooses_handler.opt_val=this.value}));{var a=type_content.node();var b=false;var _f=Object.getOwnPropertyNames(fields_type);for(var i=0,n=_f.length;i",table_name," ",this.nb_features," ",_tr("app_page.common.feature",{count:this.nb_features})," - ",this.columns_names.length," ",_tr("app_page.common.field",{count:this.columns_names.length})].join("");this.box_table.append("p").attr("id","table_intro").html(txt_intro);this.box_table.node().appendChild(createTableDOM(the_table,{id:"myTable"}));var list_per_page_select=[5,10,15,20,25];if(this.nb_features>25){if(this.nb_features>100){list_per_page_select.push(100)}list_per_page_select.push(this.nb_features)}var per_page_value=list_per_page_select[list_per_page_select.length-1];if(per_page_value>1e3){per_page_value=100}var myTable=document.getElementById("myTable");this.datatable=new DataTable(myTable,{sortable:true,searchable:true,perPage:per_page_value,perPageSelect:list_per_page_select,labels:{placeholder:_tr("app_page.table.search"),perPage:_tr("app_page.table.entries_page"),noRows:_tr("app_page.table.no_rows"),info:_tr("app_page.table.info")}});var box=document.getElementById("browse_data_box");var modal_body=box.querySelector(".modal-body");modal_body.style.padding="12.5px 15px 15px 15px";modal_body.style.height="".concat(window.innerHeight-150,"px");modal_body.style.overflow="auto";box.style.height=null;setTimeout((function(){var bbox=box.querySelector("#myTable").getBoundingClientRect();var new_width=bbox.width;if(new_width>window.innerWidth*.85){new_width=window.innerWidth*.9;box.querySelector(".modal-content").style.overflow="auto";box.querySelector(".modal-dialog").style.width="".concat(new_width,"px")}else{new_width+=80;box.querySelector(".modal-dialog").style.width="".concat(new_width,"px")}box.style.left="".concat((window.innerWidth-new_width)/2,"px")}),200)},get_available_tables:function get_available_tables(){var target_layer=Object.getOwnPropertyNames(data_manager.user_data),ext_dataset=data_manager.dataset_name,result_layers=Object.getOwnPropertyNames(data_manager.result_data),available=new Map;for(var i=0,n=target_layer.length;i'.concat(_tr("app_page.join_box.button_join"),"");button.onclick=handleJoin;joinSec.appendChild(button)}else{var _extDatasetImg=document.getElementById("img_data_ext");_extDatasetImg.setAttribute("src","static/img/b/jointrue.png");_extDatasetImg.setAttribute("alt","Validated join");_extDatasetImg.style.width="28px";_extDatasetImg.style.height="28px";_extDatasetImg.onclick=null;var _prop$split$map=prop.split("/").map((function(d){return+d})),_prop$split$map2=_slicedToArray(_prop$split$map,1),v1=_prop$split$map2[0];var _joinSec=document.getElementById("join_section");_joinSec.innerHTML=[" ",prop,_tr("app_page.join_box.match",{count:v1})," "].join(" ");var _button=document.createElement("button");_button.setAttribute("id","join_button");_button.style.display="inline";_button.innerHTML=[" - ",_tr("app_page.join_box.change_field")," "].join("");_button.onclick=handleJoin;_joinSec.appendChild(_button)}}function valid_join_on(layer_name,join_values1,join_values2,field1,field2,hits){var ext_dataset=global.data_manager.joined_dataset[0];var layer_dataset=global.data_manager.user_data[layer_name];var prop=[hits,"/",join_values1.length].join("");var f_name="";var val;if(hits>=join_values1.length){swal({title:"",text:_tr("app_page.common.success"),type:"success",allowOutsideClick:true});var fields_name_to_add=Object.getOwnPropertyNames(ext_dataset[0]);for(var i=0,len=join_values1.length;i0){layer_dataset[i][f_name]=ext_dataset[val][f_name]}}}valid_join_check_display(true,prop);return Promise.resolve(true)}else if(hits>0){return swal({title:"".concat(_tr("app_page.common.confirm"),"!"),text:_tr("app_page.join_box.partial_join",{ratio:prop}),allowOutsideClick:false,allowEscapeKey:true,type:"question",showConfirmButton:true,showCancelButton:true,confirmButtonText:_tr("app_page.common.yes"),cancelButtonText:_tr("app_page.common.no")}).then((function(){var fields_name_to_add=Object.getOwnPropertyNames(ext_dataset[0]);for(var _i2=0,_len=data_manager.field_join_map.length;_i2<_len;_i2++){val=data_manager.field_join_map[_i2];for(var _j=0,_leng=fields_name_to_add.length;_j<_leng;_j++){f_name=fields_name_to_add[_j];if(f_name.length>0){layer_dataset[_i2][f_name]=val!=undefined?ext_dataset[val][f_name]:null}}}return swal({title:"".concat(_tr("app_page.common.confirm"),"!"),text:_tr("app_page.join_box.delete_not_join"),allowOutsideClick:false,allowEscapeKey:true,type:"question",showConfirmButton:true,showCancelButton:true,confirmButtonText:_tr("app_page.common.yes"),cancelButtonText:_tr("app_page.common.no")}).then((function(){var k=Object.keys(_target_layer_file.objects);var geoms=_target_layer_file.objects[k[0]].geometries;var temp1=[];var temp2=[];for(var _i3=0;_i35e3){_app.waitingOverlay.display();var jointure_worker=new Worker("static/dist/webworker_jointure.js");_app.webworker_to_cancel=jointure_worker;jointure_worker.postMessage([join_values1,join_values2]);jointure_worker.onmessage=function jointure_worker_onmessage(e){var _e$data=_slicedToArray(e.data,2),join_map=_e$data[0],_hits=_e$data[1];_app.webworker_to_cancel=undefined;hits=_hits;data_manager.field_join_map=join_map;_app.waitingOverlay.hide();valid_join_on(layer_name,join_values1,join_values2,field1,field2,hits).then((function(valid){jointure_worker.terminate();if(valid)Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["s"])(layer_name)}))}}else{if(typeof join_values1[0]==="number"&&typeof join_values2[0]==="string"){for(var _i5=0;_i5').concat(geom_layer_fields[i],"