Commit da74fa36 authored by Christopher Barnett's avatar Christopher Barnett
Browse files

changed MigrationLayer so that migrations with same beginning and ending point only show a "pulse"

fixed a bug where internal deal countries were not highlighted.
parent 791625ef
.idea/
node_modules/
/data/npm-debug.log
/ingest/old_wpf_arms_deals.csv
This diff is collapsed.
......@@ -359,27 +359,48 @@
this.data = data;
if (this.data && this.data.length > 0) {
arrayUtils.forEach(this.data, function (element) {
var arc = new Arc({
startX: element.from[0],
startY: element.from[1],
endX: element.to[0],
endY: element.to[1],
labels: element.labels,
label: this.style.arc.label,
font: this.style.arc.font,
width: this.style.arc.width,
color: element.color
});
var marker = new Marker({
x: element.to[0],
y: element.to[1],
rotation: arc.endAngle + Math.PI / 2,
style: 'arrow',
color: element.color,
size: 4,
borderWidth: 0,
borderColor: element.color
});
// In the case that the starting and ending point are the same, just show the pulse
var singlePoint = false;
if (element.from[0] === element.to[0] && element.from[1] === element.to[1]) {
singlePoint = true;
}
if (!singlePoint) {
var arc = new Arc({
startX: element.from[0],
startY: element.from[1],
endX: element.to[0],
endY: element.to[1],
labels: element.labels,
label: this.style.arc.label,
font: this.style.arc.font,
width: this.style.arc.width,
color: element.color
});
var marker = new Marker({
x: element.to[0],
y: element.to[1],
rotation: arc.endAngle + Math.PI / 2,
style: 'arrow',
color: element.color,
size: 4,
borderWidth: 0,
borderColor: element.color
});
var spark = new Spark({
startX: element.from[0],
startY: element.from[1],
endX: element.to[0],
endY: element.to[1],
width: 15,
color: element.color
});
this.store.arcs.push(arc);
this.store.markers.push(marker);
this.store.sparks.push(spark);
}
var pulse = new Pulse({
x: element.to[0],
y: element.to[1],
......@@ -387,19 +408,10 @@
color: element.color,
borderWidth: this.style.pulse.borderWidth
});
var spark = new Spark({
startX: element.from[0],
startY: element.from[1],
endX: element.to[0],
endY: element.to[1],
width: 15,
color: element.color
});
this.store.arcs.push(arc);
this.store.markers.push(marker);
this.store.pulses.push(pulse);
this.store.sparks.push(spark);
}, this);
}
};
......
......@@ -4,7 +4,7 @@ require('bootstrap');
var L = require('leaflet');
var _ = require('underscore');
require('leaflet-legend');
require('./leaflet.migrationLayer-master/dist/leaflet.migrationLayer.js');
require('./leaflet.migrationLayer-master/src/src.js');
require('leaflet-easybutton');
require('leaflet.pattern');
......@@ -65,11 +65,14 @@ ConnectionMap = function () {
// add the WPF logo
L.Control.Watermark = L.Control.extend({
onAdd: function (map) {
var img = L.DomUtil.create('img', 'wpf-logo');
var anchor = L.DomUtil.create('a');
anchor.href = "http://fletcher.tufts.edu/World-Peace-Foundation";
anchor.target = "_blank";
var img = L.DomUtil.create('img', 'wpf-logo', anchor);
img.src = 'images/wpf-logo-fletcher.png';
return img;
return anchor;
}
});
......@@ -139,7 +142,7 @@ ConnectionMap = function () {
both: {
weight: 1,
color: "#01665e",
fillOpacity: 0.4,
fillOpacity: 0.3,
opacity: 0.8
}
},
......@@ -847,6 +850,7 @@ ConnectionMap = function () {
}
if (addHighlight) {
if (a.feature.id === self.selectionVal) {
//console.log("adding source highlight: " + self.selectionVal);
a.setStyle(self.styles.focus);
}
}
......@@ -858,6 +862,19 @@ ConnectionMap = function () {
}
if (addHighlight) {
if (a.feature.id === self.selectionVal) {
//console.log("adding target highlight: " + self.selectionVal);
a.setStyle(self.styles.focus);
}
}
});
self.mixedCountries.eachLayer(function (a) {
if (_.contains(self.currentTargets, a.feature.id)) {
a.setStyle(self.styles.highlight);
}
if (addHighlight) {
if (a.feature.id === self.selectionVal) {
//console.log("adding target highlight: " + self.selectionVal);
a.setStyle(self.styles.focus);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment