Skip to content

Commit

Permalink
Merge branch 'mthh-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rCarto committed Nov 26, 2020
2 parents b9d5afc + ca487f8 commit 534144c
Show file tree
Hide file tree
Showing 57 changed files with 8,306 additions and 10,105 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ env:
- GDALBUILD=$HOME/gdalbuild
before_install:
- travis_wait 30 ./misc/install_gdal.sh
- export PATH=$GDALINST/gdal-2.2.3/bin:$PATH
- export LD_LIBRARY_PATH=$GDALINST/gdal-2.2.3/lib:$LD_LIBRARY_PATH
- export PATH=$GDALINST/gdal-2.4.2/bin:$PATH
- export LD_LIBRARY_PATH=$GDALINST/gdal-2.4.2/lib:$LD_LIBRARY_PATH
install:
- npm -g install topojson
- pip install --upgrade "setuptools>=25.1" pip
- pip install -r requirements/dev.txt
- python setup.py install
- python setup.py build_ext --inplace
before_script:
- pushd /tmp && wget https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip && unzip chromedriver_linux64.zip -d ~/bin/ && popd
- mkdir -p ~/bin
- |
if [ ! -e ~/bin/chromedriver ]; then
export CHROMEDRIVER_VERSION=$(curl -q http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
wget -N http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/bin
rm ~/chromedriver_linux64.zip
chmod +x ~/bin/chromedriver
fi
script:
- magrit --help
- py.test tests/test.py -p no:flaky
Expand Down
14 changes: 12 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@ Changes
=======


0.8.12 (2019-xx-xx)
0.8.12 (2020-11-26)
-------------------

- Allow more flexibility to customize the set of sample layers to use when deploying Magrit (#45).

- Fixe some typos in documentation (#49).

- ...
- Render crisp-edges (ie. disable SVG antialiasing) if the stroke-width or the stroke-opacity of a layer is set to 0 (#61). Note that this has an impact on the quality of the rendering, which is now slightly crenellated.

- Avoid opening the overlay (dedicated to file upload and triggered by a drag event) when draging html elements (#64).

- Correctly set the "lang" HTML attribute to avoid having chrome translation poping up when it is not necessary (#65).

- Improves the retrieval of a useful error message in case of failed conversion of tabular file.

- Avoid to propose to reuse the style of an existing categorical layer when there is only one.

- Improves the experience of reordering modalities for categorical layer / harmonize style between the modal window doing this for categorical layer and for picto layer (related to #62).


0.8.11 (2019-03-20)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- We also provide many sample datasets to try out the various representations and become familiar with the application.
- It allows to **render and combine a wide variety of maps**: choropleth, proportional symbols, cartogram, discontinuity, etc.
- It supports the most popular modern desktop browsers: Chrome, Firefox and Opera (+ Edge and Safari with limitations).
- Server-side, Magrit is backed by a python 3.5+ application (particularly for some geoprocessing tasks relying on GDAL, GEOS and PROJ.4 libraries).
- Server-side, Magrit is backed by a python 3.6+ application (particularly for some geoprocessing tasks relying on GDAL, GEOS and PROJ.4 libraries).
- Client-side, Magrit is written in modern JS (ES6) and uses notably the d3.js library.


Expand All @@ -27,7 +27,7 @@ Most users should go on :


## Examples
<p><img src="https://github.com/mthh/example-magrit-projects/raw/master/nuts3_cagr2.png" height="220"/><img src="https://github.com/mthh/example-magrit-projects/raw/master/cinema_pot2.png" height="220"/><img src="https://magrit.hypotheses.org/files/2017/02/worldpop.png" height="220"/></p>
<p><img src="https://github.com/mthh/example-magrit-projects/raw/master/nuts3_cagr2.png" height="210"/><img src="https://github.com/mthh/example-magrit-projects/raw/master/cinema_pot2.png" height="210"/><img src="https://magrit.hypotheses.org/files/2017/02/worldpop.png" height="210"/></p>

More maps are available in the [gallery](http://magrit.hypotheses.org/galerie).

Expand Down
2 changes: 1 addition & 1 deletion client/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": [ "env" ],
"presets": ["@babel/preset-env"],
"plugins": ["syntax-dynamic-import"]
}
26 changes: 26 additions & 0 deletions client/css/discretization.css
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,29 @@ label_it_inline {
background-image: linear-gradient(to bottom, #edfa3c, #d6d934);
text-decoration: none;
}

/* Styles for list of elements in categorical / picto panel */
li.typo_class:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}

li.typo_class:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}

li.typo_class {
border: 1px solid #ddd;
padding: 4px;
cursor: grab;
}

li.typo_class > p.color_square {
cursor: pointer;
}

li.typo_class > p.symbol_section {
cursor: pointer;
}
/* End of styles for list of elements in categorical / picto panel */
740 changes: 0 additions & 740 deletions client/dist/app.bdd2ca.js

This file was deleted.

1 change: 1 addition & 0 deletions client/dist/app.e83ff8.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/d3-custom.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/dist/html/modules.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta content="text/html" charset="utf-8" http-equiv="content-type">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down Expand Up @@ -66,8 +66,8 @@
</div>
<script src="static/vendor/bootstrap-native3.mod.min.js"></script>
<script src="static/vendor/opentip-native.min.js"></script>
<script src="static/dist/vendor.bdd2ca.js"></script>
<script src="static/dist/vendor.e83ff8.js"></script>
<script src="static/dist/d3-custom.min.js"></script>
<script src="static/dist/app.bdd2ca.js"></script>
<script src="static/dist/app.e83ff8.js"></script>
</body>
</html>
2,359 changes: 0 additions & 2,359 deletions client/dist/vendor.bdd2ca.js

This file was deleted.

2 changes: 2 additions & 0 deletions client/dist/vendor.e83ff8.js

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions client/dist/vendor.e83ff8.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* @preserve
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Petka Antonov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/

/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/

/*!
* Tippy.js v2.5.2
* (c) 2017-2018 atomiks
* MIT
*/

/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.14.3
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/**!
* Sortable 1.10.2
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
4 changes: 3 additions & 1 deletion client/html/contact_form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html>

<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -205,6 +205,7 @@ <h1 style="font-family:Dosis;" data-i18n="[html]contact_form.contact" class="i18
var existing_lang = ["en", "es", "fr"];
let lang = docCookies.getItem('user_lang') || window.navigator.language.split('-')[0];
lang = existing_lang.indexOf(lang) > -1 ? lang : 'en';
document.querySelector('html').setAttribute('lang', lang);
i18next.use(i18nextXHRBackend)
.init({
debug: true,
Expand Down Expand Up @@ -263,6 +264,7 @@ <h1 style="font-family:Dosis;" data-i18n="[html]contact_form.contact" class="i18
docCookies.setItem("user_lang", new_lang, 31536e3, "/");
i18next.changeLanguage(new_lang, () => { localize(".i18n");});
let other_langs = new_lang == "en" ? ["es", "fr"] : new_lang == "fr" ? ["en", "es"] : ["en", "fr"];
document.querySelector('html').setAttribute('lang', new_lang);
document.getElementById("lang_current").innerHTML = new_lang;
document.getElementById("lang3").innerHTML = other_langs[0];
document.getElementById("lang2").innerHTML = other_langs[1];
Expand Down
4 changes: 3 additions & 1 deletion client/html/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html>

<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -377,6 +377,7 @@ <h2 id="title_app" style="font-family:Dosis;" class="i18n" data-i18n="index.temp
docCookies.setItem("user_lang", new_lang, 31536e3, "/");
i18next.changeLanguage(new_lang, () => { localize(".i18n"); });
var other_langs = new_lang == "en" ? ["es", "fr"] : new_lang == "fr" ? ["en", "es"] : ["en", "fr"];
document.querySelector('html').setAttribute('lang', new_lang);
document.getElementById("lang_current").innerHTML = new_lang;
document.getElementById("lang3").innerHTML = other_langs[0];
document.getElementById("lang2").innerHTML = other_langs[1];
Expand Down Expand Up @@ -433,6 +434,7 @@ <h2 id="title_app" style="font-family:Dosis;" class="i18n" data-i18n="index.temp
var existing_lang = ["en", "es", "fr"];
var lang = docCookies.getItem("user_lang") || window.navigator.language.split('-')[0];
lang = existing_lang.indexOf(lang) > -1 ? lang : 'en';
document.querySelector('html').setAttribute('lang', lang);
docCookies.setItem("user_lang", lang, 31536e3, "/");
i18next.use(i18nextXHRBackend)
.init({
Expand Down
2 changes: 1 addition & 1 deletion client/html/modules.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta content="text/html" charset="utf-8" http-equiv="content-type">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
4 changes: 3 additions & 1 deletion client/html/page404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html>

<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -139,6 +139,7 @@ <h1 data-i18n="[html]page404.message1" class="i18n" style="font-family:Dosis; te
var existing_lang = ["en", "es", "fr"];
let lang = window.navigator.language.split('-')[0];
lang = existing_lang.indexOf(lang) > -1 ? lang : 'en';
document.querySelector('html').setAttribute('lang', lang);
i18next.use(i18nextXHRBackend)
.init({
debug: true,
Expand Down Expand Up @@ -198,6 +199,7 @@ <h1 data-i18n="[html]page404.message1" class="i18n" style="font-family:Dosis; te
function change_lang(new_lang){
i18next.changeLanguage(new_lang, () => { localize(".i18n");});
let other_langs = new_lang == "en" ? ["es", "fr"] : new_lang == "fr" ? ["en", "es"] : ["en", "fr"];
document.querySelector('html').setAttribute('lang', new_lang);
document.getElementById("lang_current").innerHTML = new_lang;
document.getElementById("lang3").innerHTML = other_langs[0];
document.getElementById("lang2").innerHTML = other_langs[1];
Expand Down
28 changes: 16 additions & 12 deletions client/js/classification/categorical_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ function fetch_categorical_colors() {
return color_map;
}

// eslint-disable-next-line import/prefer-default-export
export function display_categorical_box(data_layer, layer_name, field, cats) {
const is_hex_color = new RegExp(/^#([0-9a-f]{6}|[0-9a-f]{3})$/i);
const nb_features = data_manager.current_layers[layer_name].n_features;
const nb_class = cats.length;
const existing_typo_layer = Object.keys(data_manager.current_layers)
.filter(lyr => data_manager.current_layers[lyr].renderer === 'Categorical' || data_manager.current_layers[lyr].renderer === 'PropSymbolsTypo');
.filter((lyr) => lyr !== layer_name && (
data_manager.current_layers[lyr].renderer === 'Categorical'
|| data_manager.current_layers[lyr].renderer === 'PropSymbolsTypo'
));
const modal_box = make_dialog_container(
'categorical_box',
_tr('app_page.categorical_box.title', { layer: layer_name, nb_features: nb_features }),
Expand Down Expand Up @@ -84,17 +88,17 @@ export function display_categorical_box(data_layer, layer_name, field, cats) {
input_col.dispatchEvent(new MouseEvent('click'));
});

newbox.selectAll('.typo_class')
.append('input')
.attr('class', 'color_hex')
.styles({ height: '22px', 'vertical-align': 'middle' })
.property('value', d => d.color)
.style('width', '60px')
.on('keyup', function () {
if (is_hex_color.test(this.value)) {
this.previousSibling.style.backgroundColor = this.value;
}
});
newbox.selectAll('.typo_class')
.append('input')
.attr('class', 'color_hex')
.styles({ height: '22px', 'vertical-align': 'middle' })
.property('value', d => d.color)
.style('width', '60px')
.on('keyup', function () {
if (is_hex_color.test(this.value)) {
this.previousSibling.style.backgroundColor = this.value;
}
});

newbox.selectAll('.typo_class')
.insert('span')
Expand Down
5 changes: 2 additions & 3 deletions client/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,10 @@ export function path_to_geojson2(layerName) {
}

export function display_error_during_computation(msg) {
// FIXME :
const message = message ? `<br><i>${_tr('app_page.common.details')}:</i> ${msg}` : '';
const message = msg ? `<br><i>${_tr('app_page.common.details')}:</i> ${msg}` : '';
swal({
title: `${_tr('app_page.common.error')}!`,
text: `${_tr('app_page.common.error_message')}${msg}`,
text: `${_tr('app_page.common.error_message')}${message}`,
customClass: 'swal2_custom',
type: 'error',
allowOutsideClick: false,
Expand Down
Loading

0 comments on commit 534144c

Please sign in to comment.