-
Notifications
You must be signed in to change notification settings - Fork 18
Messages
Erik Vullings edited this page Apr 14, 2016
·
18 revisions
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.
- map: is used to signal map events
// Set the map's bounding box
this.$messageBusService.publish("map", "setextent", {southWest, northEast});
// Set the map's zoom level and center point
this.$messageBusService.publish("map", "setzoom", { loc: number[lat, lon], zoom: number });
// Set the map's zoom based on the current center point
this.$messageBusService.publish('map', 'zoom', z);
// Set the background map layer
this.$messageBusService.publish("map", "setbaselayer", 'baselayername');
// Zoom to a certain bounding box
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', layer: IProjectLayer);
- 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);