Skip to content

Commit

Permalink
Fix graticule style edition
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed Sep 13, 2017
1 parent d4df5fd commit e5d35d0
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes
=======

0.5.2 (2017-09-13)
------------------

- Fix graticule style edition.


0.5.1 (2017-09-08)
------------------

Expand Down
2 changes: 1 addition & 1 deletion magrit_app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '0.5.1'
__version__ = '0.5.2'
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ function parseQuery(search) {
lng: lang,
fallbackLng: _app.existing_lang[0],
backend: {
loadPath: 'static/locales/{{lng}}/translation.f844169ffade.json'
loadPath: 'static/locales/{{lng}}/translation.5c4f7a9a6db2.json'
}
}, function (err, tr) {
if (err) {
Expand Down Expand Up @@ -12351,8 +12351,8 @@ function createStyleBoxLabel(layer_name) {
function createStyleBoxGraticule(layer_name) {
check_remove_existing_box('.styleBox');
var current_params = cloneObj(current_layers.Graticule);
var selection = map.select('#Graticule > path');
var selection_strokeW = map.select('#Graticule');
var selection = map.select('#L_Graticule > path');
var selection_strokeW = map.select('#L_Graticule');

make_confirm_dialog2('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true }).then(function (confirmed) {
if (confirmed) {
Expand Down Expand Up @@ -12400,11 +12400,11 @@ function createStyleBoxGraticule(layer_name) {
var step_val = +this.value;
var dasharray_val = +document.getElementById('graticule_dasharray_txt').value;
current_layers.Graticule.step = step_val;
map.select('#Graticule').remove();
map.append('g').attrs({ id: 'Graticule', class: 'layer' }).append('path').datum(d3.geoGraticule().step([step_val, step_val])).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });
map.select('#L_Graticule').remove();
map.append('g').attrs({ id: 'L_Graticule', class: 'layer' }).append('path').datum(d3.geoGraticule().step([step_val, step_val])).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });
zoom_without_redraw();
selection = map.select('#Graticule').selectAll('path');
selection_strokeW = map.select('#Graticule');
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').attr('value', step_val);
});
Expand Down Expand Up @@ -12433,7 +12433,7 @@ function createStyleBoxGraticule(layer_name) {
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('#Graticule').remove();
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]];
Expand All @@ -12447,10 +12447,10 @@ function createStyleBoxGraticule(layer_name) {
} else {
current_layers.Graticule.extent = undefined;
}
map.append('g').attrs({ id: 'Graticule', class: 'layer' }).append('path').datum(graticule).attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' }).styles({ fill: 'none', stroke: current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });
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: current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });
zoom_without_redraw();
selection = map.select('#Graticule').selectAll('path');
selection_strokeW = map.select('#Graticule');
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(i18next.t('app_page.layer_style_popup.graticule_clip'));
Expand Down
20 changes: 10 additions & 10 deletions magrit_app/static/js/layers_style_popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ function createStyleBoxLabel(layer_name) {
function createStyleBoxGraticule(layer_name) {
check_remove_existing_box('.styleBox');
const current_params = cloneObj(current_layers.Graticule);
let selection = map.select('#Graticule > path');
let selection_strokeW = map.select('#Graticule');
let selection = map.select('#L_Graticule > path');
let selection_strokeW = map.select('#L_Graticule');

make_confirm_dialog2('styleBox', layer_name, { top: true, widthFitContent: true, draggable: true })
.then((confirmed) => {
Expand Down Expand Up @@ -482,16 +482,16 @@ function createStyleBoxGraticule(layer_name) {
const step_val = +this.value;
const dasharray_val = +document.getElementById('graticule_dasharray_txt').value;
current_layers.Graticule.step = step_val;
map.select('#Graticule').remove();
map.select('#L_Graticule').remove();
map.append('g')
.attrs({ id: 'Graticule', class: 'layer' })
.attrs({ id: 'L_Graticule', class: 'layer' })
.append('path')
.datum(d3.geoGraticule().step([step_val, step_val]))
.attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' })
.styles({ fill: 'none', stroke: current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });
zoom_without_redraw();
selection = map.select('#Graticule').selectAll('path');
selection_strokeW = map.select('#Graticule');
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').attr('value', step_val);
});
Expand Down Expand Up @@ -531,7 +531,7 @@ function createStyleBoxGraticule(layer_name) {
step_val = +document.getElementById('graticule_step_txt').value,
dasharray_val = +document.getElementById('graticule_dasharray_txt').value;
let graticule = d3.geoGraticule().step([step_val, step_val]);
map.select('#Graticule').remove();
map.select('#L_Graticule').remove();
if (this.checked) {
const bbox_layer = _target_layer_file.bbox;
const extent_grat = [
Expand All @@ -549,14 +549,14 @@ function createStyleBoxGraticule(layer_name) {
current_layers.Graticule.extent = undefined;
}
map.append('g')
.attrs({ id: 'Graticule', class: 'layer' })
.attrs({ id: 'L_Graticule', class: 'layer' })
.append('path')
.datum(graticule)
.attrs({ class: 'graticule', d: path, 'clip-path': 'url(#clip)' })
.styles({ fill: 'none', stroke: current_layers.Graticule.fill_color.single, 'stroke-dasharray': dasharray_val });
zoom_without_redraw();
selection = map.select('#Graticule').selectAll('path');
selection_strokeW = map.select('#Graticule');
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')
Expand Down
4 changes: 2 additions & 2 deletions magrit_app/templates/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title> {{ app_name }} </title>
<link rel="icon" type="image/png" href="static/img/favicon.png" />
<link href="static/css/scoped-bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="static/css/style.f844169ffade.min.css" rel="stylesheet" type="text/css">
<link href="static/css/style.5c4f7a9a6db2.min.css" rel="stylesheet" type="text/css">
<link href="static/css/_vanilla-dataTables.min.css" rel="stylesheet" type="text/css">
<link href="static/css/alertify.min.css" rel="stylesheet" type="text/css">
<link href="static/css/semantic.min.css" rel="stylesheet" type="text/css">
Expand Down Expand Up @@ -51,6 +51,6 @@
</div>
</noscript>
<script src="static/js/lib/bootstrap-native3.mod.min.js"></script>
<script src="static/js/app.f844169ffade.js"></script>
<script src="static/js/app.5c4f7a9a6db2.js"></script>
</body>
</html>

0 comments on commit e5d35d0

Please sign in to comment.