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

changed MigrationLayer so that "spark" motion doesn't get too fast on short routes, or zoom outs

changed ingest to support many to many buyer-seller relations
parent da74fa36
{
"data": [
{
"deal_name": "Al Yamamah I",
"years": 1985,
"deal_name": "Al Yamamah Arms Deals",
"years": "1985, 1993, 2007",
"series_name": "Al Yamamah Arms Deals",
"series_id": 1,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/the-al-yamamah-arms-deals/",
......@@ -17,56 +17,8 @@
"3 Sandown Minehunter ships (1988)",
"6 Hawker-800 VIP jets (1988)",
"250 Alarm missiles (1991)",
""
],
"deal_value": 43,
"corruption": 6,
"units": "billion",
"currency_deal": "GBP",
"currency_corruption": "GBP",
"value_details": "GBP 43 billion by 2010",
"corruption_details": "Maximum total cited \u00a36 billion. Includes over \u00a31 billion to Prince Bandar bin Sultan",
"transactions": [
{
"buyer": "SAU",
"seller": "GBR"
}
]
},
{
"deal_name": "Al Yamamah II",
"years": 1993,
"series_name": "Al Yamamah Arms Deals",
"series_id": 1,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/the-al-yamamah-arms-deals/",
"sellers_display": "UK (British Aerospace, later BAE Systems)",
"equipment": [
"48 Tornado IDS, including 6 recon version (1993)",
"20 Hawk 60s (1993)",
""
],
"deal_value": 43,
"corruption": 6,
"units": "billion",
"currency_deal": "GBP",
"currency_corruption": "GBP",
"value_details": "GBP 43 billion by 2010",
"corruption_details": "Maximum total cited \u00a36 billion. Includes over \u00a31 billion to Prince Bandar bin Sultan",
"transactions": [
{
"buyer": "SAU",
"seller": "GBR"
}
]
},
{
"deal_name": "Al Salam",
"years": 2007,
"series_name": "Al Yamamah Arms Deals",
"series_id": 1,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/the-al-yamamah-arms-deals/",
"sellers_display": "UK (British Aerospace, later BAE Systems)",
"equipment": [
"24 Typhoon block 20 (2007)",
"Modernization of 84 Tornados (2007)",
"48 Typhoon block 8 (2008)",
......@@ -275,14 +227,15 @@
]
},
{
"deal_name": "Gripen deal with the Czech Republic",
"years": "2002/2004",
"deal_name": "Gripen deals with the Czech Republic and Hungary",
"years": "2001, 2002, 2004",
"series_name": "Gripen deals with the Czech Republic and Hungary",
"series_id": 7,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/gripen-combat-aircraft-sales-to-the-czech-republic-and-hungary/",
"sellers_display": "BAE Systems (UK), Saab (Sweden)",
"equipment": [
"Czech Republic:14 JAS-Gripen combat aircraft on a 10-year lease. (The original order in 2002 to buy 24 Gripens outright was cancelled)"
"Czech Republic:14 JAS-Gripen combat aircraft on a 10-year lease. (The original order in 2002 to buy 24 Gripens outright was cancelled)",
"Hungary: 14 JAS 39-C Gripens, on a 10-year lease (2006-16), extended to 2026 in 2012."
],
"deal_value": 1674,
"corruption": 12.6,
......@@ -299,27 +252,7 @@
{
"buyer": "CZE",
"seller": "SWE"
}
]
},
{
"deal_name": "Gripen deal with Hungary",
"years": 2001,
"series_name": "Gripen deals with the Czech Republic and Hungary",
"series_id": 7,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/gripen-combat-aircraft-sales-to-the-czech-republic-and-hungary/",
"sellers_display": "BAE Systems (UK), Saab (Sweden)",
"equipment": [
"Hungary: 14 JAS 39-C Gripens, on a 10-year lease (2006-16), extended to 2026 in 2012."
],
"deal_value": 1674,
"corruption": 12.6,
"units": "million",
"currency_deal": "USD",
"currency_corruption": "EUR",
"value_details": "Czech Republic: $750 million (original cancelled order was $1.9 billion) Hungary: $924m",
"corruption_details": "\u20ac12.6 million",
"transactions": [
},
{
"buyer": "HUN",
"seller": "GBR"
......@@ -383,14 +316,15 @@
]
},
{
"deal_name": "Agosta contract",
"deal_name": "L'Affaire Karachi",
"years": 1994,
"series_name": "L'Affaire Karachi",
"series_id": 10,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/laffaire-karachi/",
"sellers_display": "France (DCN)",
"equipment": [
"3 Agosta-B Submarines"
"3 Agosta-B Submarines",
"3 La Fayette Frigates"
],
"deal_value": 4406,
"corruption": 327,
......@@ -403,27 +337,7 @@
{
"buyer": "PAK",
"seller": "FRA"
}
]
},
{
"deal_name": "Sawari II contract",
"years": 1994,
"series_name": "L'Affaire Karachi",
"series_id": 10,
"blog_link": "https://sites.tufts.edu/corruptarmsdeals/2017/05/05/laffaire-karachi/",
"sellers_display": "France (DCN)",
"equipment": [
"3 La Fayette Frigates"
],
"deal_value": 4406,
"corruption": 327,
"units": "million",
"currency_deal": "USD",
"currency_corruption": "EUR",
"value_details": "FRF (1994) 5.41 billion (Pakistan) or USD (1994) 976 million; FRF (1994) 19 billion (Saudi Arabia) or USD (1994) 3.43 billion",
"corruption_details": "\u20ac327m",
"transactions": [
},
{
"buyer": "SAU",
"seller": "FRA"
......
This diff is collapsed.
......@@ -207,14 +207,11 @@ def convert_countries(json_data):
sellers_.append(i.strip())
sellers = sellers_
transactions = []
if len(buyers) == 1:
for b in buyers:
for s in sellers:
t = {'buyer': buyers[0], 'seller': s}
transactions.append(t)
elif len(sellers) == 1:
for b in buyers:
t = {'buyer': b, 'seller': sellers[0]}
t = {'buyer': b, 'seller': s}
transactions.append(t)
row['transactions'] = transactions
del row['buyers']
del row['sellers']
......
......@@ -162,6 +162,7 @@
this.lineWidth = options.borderWidth;
this.r = 0;
this.factor = 2 / options.radius;
this.defaultFactor = 2 / options.radius;
};
P.prototype.draw = function (context) {
......@@ -229,7 +230,10 @@
this.radius = radius;
this.lineWidth = options.width || 1;
this.strokeStyle = options.color || '#fff';
this.factor = 2 / this.radius;
// TODO: set this dynamically based on distance (L)
this.defaultFactor = 0.0035; //1 / Math.pow(L, 1.5); //Math.min(2 / this.radius, 0.003);
console.log(this.defaultFactor);
this.factor = this.defaultFactor;
this.deltaAngle = (80 / Math.min(this.radius, 400)) / this.tailPointsCount;
this.trailAngle = this.startAngle;
this.arcAngle = this.startAngle;
......@@ -248,6 +252,14 @@
});
};
S.prototype.setFactor = function (multiplier) {
this.factor = this.defaultFactor * multiplier;
};
S.prototype.getFactor = function () {
return this.factor;
};
S.prototype.drawArc = function (context, strokeColor, lineWidth, startAngle, endAngle) {
context.save();
context.lineWidth = lineWidth;
......@@ -291,6 +303,7 @@
context.save();
context.translate(this.centerX, this.centerY);
this.marker.x = Math.cos(this.trailAngle) * this.radius;
this.marker.y = Math.sin(this.trailAngle) * this.radius;
this.marker.rotation = this.trailAngle + Math.PI / 2;
......@@ -348,6 +361,15 @@
// 清除绘画实例,如果没有这个方法,多次调用start,相当于存在多个动画队列同时进行
window.cancelAnimationFrame(this.requestAnimationId);
};
M.prototype.setSparkFactorMultiplier = function (multiplier) {
arrayUtils.forEach(this.store.sparks, function (element) {
element.setFactor(multiplier);
});
};
M.prototype.distance = function (from, to) {
return Math.sqrt(Math.pow((to[0] - from[0]), 2) + Math.pow((to[1] - from[1]), 2));
};
/*
* 更新数据
*/
......@@ -388,6 +410,7 @@
borderWidth: 0,
borderColor: element.color
});
var spark = new Spark({
startX: element.from[0],
startY: element.from[1],
......@@ -401,6 +424,7 @@
this.store.markers.push(marker);
this.store.sparks.push(spark);
}
var pulse = new Pulse({
x: element.to[0],
y: element.to[1],
......@@ -430,6 +454,7 @@
var shapes = that.store[p];
for (var i = 0, len = shapes.length; i < len; i++) {
shapes[i].draw(that.context);
}
}
}
......@@ -619,10 +644,13 @@
//移除事件监听
this._map.clearAllEventListeners();
this.mapHandles = [];
},
setFactor: function (mult) {
this.migration.setSparkFactorMultiplier(mult);
}
});
L.migrationLayer = function (options) {
return new L.MigrationLayer(options)
}
})(window)
\ No newline at end of file
})(window);
\ No newline at end of file
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