Skip to content
Erik Vullings edited this page Apr 6, 2016 · 18 revisions

Messaging

csWeb has a simple publish/subscribe messaging bus, which is available as an Angular service. Besides providing functionality to publish a message to a topic, including optional title and data object, it also offers access to the (pnotify) publication service.

Overview of current messages

  • map: is used to signal map events
this.$messageBusService.publish("map", "setextent", {southWest, northEast});
this.$messageBusService.publish("map", "setbaselayer", 'baselayername');
this.$messageBusService.publish('map', 'zoom', z);
this.$messageBusService.publish('mapbbox', 'update', b.toBBoxString());
  • project: is used to indicate when a project is loaded. (TODO implement unloaded event)
$messageBusService.publish('project', 'loaded');
  • layer: is used to indicate when a layer is (de-)activated.
$messageBusService.publish('layer', 'loading|activated|deactivating|deactivate');
  • feature: is used to indicate when a feature is (de-)selected.
$messageBusService.publish('feature', 'onFeatureSelect|onFeatureDeselect', feature);
$messageBusService.publish('feature', 'onRelationsUpdated', feature);
  • sidebar: is used to indicate whether the right sidebar needs to be shown or not.
$messageBusService.publish('sidebar', 'show|hide|toggle|showEdit|hideEdit');
$messageBusService.publish("rightpanel", "activate", rpt);
  • dashboard: or tabs
this.$messageBusService.publish('dashboard', 'onDashboardSelected', this.$layerService.project.activeDashboard);
  • FeatureTab: is used to indicate which FeatureProps tab is opened, e.g.
$messageBusService.publish('FeatureTab', 'activated', { sectionTitle: sectionTitle, section: section });
  • timeline: is used to signal timeline events (currently only the timeline publishes these events)
this.$messageBusService.publish('timeline', 'updateTimerange', { start: s, end: e });
this.$messageBusService.publish("timeline", "focusChange", this.focusDate);  // to listen for changes
this.$messageBusService.publish("timeline", "setFocus", this.focusDate); // to set the focus (focusDate: Date).
this.$messageBusService.publish("timeline", "timeSpanUpdated", ""); // trigger a debounced timespan updated message   
this.$messageBusService.publish('timeline', 'isEnabled', true);
this.$messageBusService.publish('timeline', 'loadProjectTimeRange');
  • expertMode: is used to signal a change in expert level (show more or less)
this.$messageBusService.publish('expertMode', 'newExpertise', project.expertMode);
  • menu: is used to show or hide the left menu
this.$messageBusService.publish('menu', 'show', true|false);