Skip to content

Instantly share code, notes, and snippets.

@lukecampbell
Created March 10, 2015 14:58
Show Gist options
  • Save lukecampbell/b5b012909a8a1da42e6e to your computer and use it in GitHub Desktop.
Save lukecampbell/b5b012909a8a1da42e6e to your computer and use it in GitHub Desktop.
Notes about GLOS HABS Data Portal

Map Page

TOCView

  • Collection of Categories

TOCCategoryItem

  • Represents a Category (collection of stations)

TOCStationItem

  • Represents a single station

onItemSelect (model):

  • Change station color

  • Draw Popup

  • toggle class "selected" for the TOCItem where model is the model parameter

  • TOCView -> Listens for station collection reset

  • TOCItem -> listens for station model change

  • MapView -> listens for station collection reset

app.collections.stations = new StationCollection(); // this maintains a list of all stations (no matter what) should be immutable
app.collections.activeStations = new StationCollection(); // this maintains a filtered list of stations depending on selections

// Dispatcher
this.listenTo(this.collecitons.activeStations, "reset", funciton(collection) {
    self.views.mapView.redrawStations(); --> Cause the map to get 
    self.views.tocView.render();
});

this.listenTo(this, "onStationSelect", function(model) {
  self.views.tocView.selectItem(model); // toggles the class for its items where the model is equivalent
  self.views.mapView.selectStation(model); // Changes color for the station selected
});

this.listenTo(this, "onCategorySelect", function(model) { 
  var models = self.collections.stations.where(category.id == model.category_id);
  self.collections.activeStations.reset(models);
});

this.listenTo(this.collections.stations, "reset", function(collection) {
  self.collections.activeStations.reset(collection.models);
});

this.colletions.stations.fetch({reset:true});

Plot Page

  • /plots/?station_id=tollsps
  • /plots/ -> select the first available station and variable

PlotTOCView

  • station collection

PlotTOCStationItem

  • Represents a single station

PlotTOCVariableItem

  • Represnts a variable of an item

SVGView (from OOI)

  • accepts a URL to get the SVG Plot
  • Accepts some dimensions (div width/height)

DataTableView

Events:

  • onVariableAdd (click the add button)

    svgview.clear() // doesn't exist yet svgview.fetch({url: $.param({variables: [vars] + newVar})});

  • onStationSelect

  • onRemoveVariable (click minus or remove button on the legend)

Station Page

TOCView (same as map)

StationMetadatView

  • Visualization of the station's metadata

MapView

  • collection of just the one station
this.views.tocView = new TOCView({
    collections: this.collections.activeStations;
    categories: this.collections.categories;
});

this.listenTo(this.collections.stations, "reset", function(collection) {
  self.collections.activeStations.reset(collection.models);
});

this.colletions.stations.fetch({reset:true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment