// Generated by CoffeeScript 1.10.0 (function() { var Query; window.Query = observable(Query = (function() { function Query(conf) { this.init({ events: ['change', 'change_country'] }); this.airports_db = conf.airports_db; } Query.prototype.get_years = function() { return d3.range(2000, new Date().getFullYear() + 1); }; Query.prototype.get_year = function() { return this.selected_year; }; Query.prototype.set_year = function(year) { this.selected_year = year; return this.trigger('change'); }; Query.prototype.get_countries = function() { return this.airports_db.countries.map(function(d) { return d.key; }); }; Query.prototype.set_country = function(name) { this.selected_country = name; this.trigger('change_country'); return this.set_airport(this.airports_db.by_country[this.selected_country][0].icao); }; Query.prototype.set_airport = function(icao) { this.selected_airport = this.airports_db.index[icao]; return this.trigger('change'); }; Query.prototype.get_all = function() { return this.airports_db.by_country[this.selected_country]; }; Query.prototype.get_airport = function() { return this.selected_airport; }; Query.prototype.get_country = function() { return this.selected_country; }; Query.prototype.set = function(conf) { this.selected_year = conf.year; this.selected_country = conf.country; this.selected_airport = this.airports_db.index[conf.icao]; this.trigger('change_country'); return this.trigger('change'); }; return Query; })()); }).call(this);