NAME
BQMapevents - BRTT Qt graphics extension for drawing seismic events on a map
SYNOPSIS
$(QTNATIVELIBS) -lbqplot_native -lbanner -lbrttutil -lbumapdata $(DBLIBS) $(TRLIBS)
#include "BQ.h"
DESCRIPTION
BQMapevents objects are used to display seismic events on geographic base maps.
This class makes use of
BQMap(3) classes to make the base maps, as well
as
BQGlyphs(3) and
BQGlyphsGraphicsContext(3) objects for displaying
the seismic events, arrivals and detections, BQPloyline(3) objects
for displaying great circle paths and error ellipses, and
BQTextPopup(3)
objects for showing event, arrival and detection information.
This class inherits the BQConfigure class which is itself a subclass of the BUConfigure class
with extensions to process Qt colors and fonts. The configure methods are implemented
in the BUConfigure parent (see BUConfigure(3)).
INHERITS FROM
BQViewportItem,
BQConfigure
CONSTRUCTOR
BQMapevents(BQViewport *events_vp, BQViewport *origin_vp, BQViewport *origins_vp,
int make_navigator, int make_grids);
There are three main display windows that are created by a single BQMapevents object; a window showing
all events on a map, called the "events" window, a window showing a single origin with all of the arrivals and detections
for that origin on a map, called the "origin" window, and a window showing all of the origins for a single event
along with their error ellipses on a map, called the "origins" window. Each of the windows are contained within
normal BQViewport(3) viewport items. The viewports are then managed independently by the application
program. In the constructor events_vp is the viewport that contains the "events" window, origin_vp is
the viewport that contains the "origin" window and origins_vp is the viewport that contains the "origins" window.
The three display windows are automatically synchronized within a single BQMapevents object. Because of this
automatic synchronization, it is important that all three windows be assigned to different and non-NULL viewports
even if some of the windows will not be shown in the final application, which should be accomplished by hiding the
viewports that are not to be shown, or by giving the viewports 0 size. In this way the internal synchronization
will still work properly. The make_navigator flag controls whether or not a navigator object is automatically
created for only the "events" window underlying BQMap(3) object. The make_grids flag controls whether or not
latitude and longitude grids are shown in the displays.
METHODS INHERITED FROM BQConfigure
-
void configure (Pf *params);
An Antelope parameter file object pointer that contains the BQMapevents object
parameters. The parameters are described below.
-
void configure (...);
A variable argument list composed entirely of character string key-value pairs with
a single NULL terminating argument. This is an alternate method for specifying
the BQMapevents object parameters. The parameters are described below.
METHODS INHERITED FROM BQViewportItem
-
void setLayer (QString name);
This will cause the BQMapevents object to be put into the BQLayer object buffer with name name (see BQLayer(3)).
The BQLayer object will automatically be created if an object with name name does not exist.
-
void showItem();
-
void hideItem();
These will cause all three windows associated with the mapevents object to be shown (displayed) or
hidden (not displayed).
BQMapevents METHODS
-
void setDefaults(int nort=0);
When a BQMapevents object is created, the various map and taskbar
parameters and configurations are not defined. The application programmer
can customize
the object by calling the various configuration options described below.
Alternatively this method can be called to set up a default object configuration.
If nort is set, then no real-time database event refreshing will be done.
This mode should be used when the application program will be monitoring
the event database to determine when database refreshing is necessary, in
conjunction with the refreshEventView method described below.
-
void setEventView(BUEventView *ev);
This will set ev to the database event view for the event processing.
See BUEventView(3).
-
void refreshEventView();
This will cause the event view to be refreshed and should be called
whenever the underlying database has changed. See BUEventView(3).
-
void showEvid(long evid);
This will cause the origins with evid evid to be
displayed and the object show mode to be switched
int BQ_MAPEVENTS_SHOW_MODE_ORIGINS.
-
BQMap *getMap();
This returns the BQMap(3) object associated with this object.
-
BQMap *getTaskbar();
This returns the BQTaskbar(3) object associated with this object.
-
void linkBQEVEventsTableview (BQEVEventsTableview *evtableview);
This will cause a BQEVEventsTableview(3) object, evtableview, to be linked to the mapevents object.
When the two objects are linked, then they are internally and automatically synchronized, in both directions,
with no need for application program callbacks or any other application program intervention.
Synchronization means that when an event or origin is selected in the evtableview and its
associated BQEVOriginsTableview(3) spreadsheets, it will be shown in the various mapevent object displays
and when an event or origin is selected within the mapevents object by clicking on the appropriate
glyphs, that event or origin is automatically selected in the linked BQEVEventsTableview and BQEVOriginsTableview
objects.
-
void setGlyphCallback (std::function<BQ_glyphMapeventsCallback> glyphCallback, BQ_ClientData client_data);
This will register a callback procedure with the BQMapevents object that
will be called
for each BGGlyph for which the mouse enters the glyph, leaves the glyph, moves
within the glyph, has one of its buttons pressed or released within the glyph.
A pointer to the callback procedure is given by glyphCallback
which will be called with the following syntax:
typedef void (BQ_glyphMapeventsCallback) (BQGlyph *glyph, BQEvent *event, int glyph_type, int show_mode, BQ_ClientData client_data);
-
Where glyph is the BQGlyph object, event contains the mouse
event parameters (see BQEvent(3)), glyph_type is
one of BQ_GLYPH_TYPE_EVENT, meaning the glyph's clientData is
a BUEVEvent pointer,
BQ_GLYPHS_TYPE_ORIGIN, meaning the glyph's clientData is
a BUEVOrigin pointer,
BQ_GLYPHS_TYPE_ASSOCIATION, meaning the glyph's clientData is
a BUEVAssociation pointer,
or BQ_GLYPHS_TYPE_DETECTION, meaning the glyph's clientData is
a BUEVDETECTION pointer, show_mode is one
of BQ_MAPEVENTS_SHOW_MODE_EVENTS, meaning the main display
is showing all events,
or Q_MAPEVENTS_SHOW_MODE_ORIGINS, meaning the main display
is showing all origins for a selected event,
and client_data is
returned as set by the call to setGlyphCallback.
The use of the std::function declaration
allows either function pointers or lambda expressions to be used.
OBJECT CONFIGURATION PARAMETERS
-
mapeventstaskbar_buttons_definitions taksbarButtonsDefinitionsString
This item configuration option is used to define the optional taskbar buttons.
The BQMapevents class uses a BQTaskbar object which offers a very simple internal
taskbar in which buttons and associated actions can be defined. The taskbar buttons are
implemented as BQText objects. This is completely optional.
The parameter file must contain an associate array named mapevents_buttons_definitions.
The mapevents_buttons_definitions array defines the various taskbar buttons that can be displayed.
This parameter file string is passed to
the BQTaskbar::configure method with
the "taskbar_buttons_definitions" option name with the
string "buttons_definitions" substituted for the string "mapevents_buttons_definitions".
The definitions of the individual taskbar parameters are in BQTaskbar(3).
-
mapeventstaskbar_buttons taksbarButtonsString
The parameter file must contain a table named mapevents_buttons.
This parameter file string is passed to
the BQTaskbar::configure method with
the "taskbar_buttons" option name with the
string "buttons" substituted for the string "mapevents_buttons".
The definitions of the individual taskbar parameters are in BQTaskbar(3).
-
auto_center autocenterBoolean
This is a boolean that determines if the map should be automatically panned
to center the selected event.
This default to "no".
-
update_interval updateInterval
This is an interval in seconds that is used to poll the event view
to see if it needs to be refreshed. If this is "0.0", then there
is no real-time polling and the event view can only be refreshed
by a direct call to BQMapevents::refreshEventView.
EXAMPLE
Following is a simple example program that uses
BPQMapEvents.
/I>
#include "BQ.h"
int
main (int argc, char **argv)
{
int ret;
QApplication app (argc, argv);
if (argc != 2) {
fprintf (stderr, "usage: %s dbname\n", argv[0]);
exit (1);
}
BUEventView *ev = new BUEventView();
if (ev->configure ( "dbname", argv[1], NULL ) < 0) {
die (0, (char *) "Cannot open database." );
}
QFrame *frame = new QFrame();
BQMapevents *mapevents = new BQMapevents(frame);
mapevents->setDefaults();
mapevents->getMap()->configure (
"latr", "40",
"lonr", "-100",
"range", "90",
NULL );
mapevents->setEventView(ev);
double t0 = now();
frame->setGeometry (0, 0, 1500, 1000);
frame->show();
frame->setWindowTitle ("bqplot_test_mapevents");
printf ("view setup %f\n", now()-t0);
ret = app.exec();
return ret;
}
/I>
SEE ALSO
bqplot(3), BQViewport(3), BQLayer(3), BQConfigure(3), BQMapLayer(3), BQNavigator(3), BQTaskbar(3)
AUTHOR
Danny Harvey, BRTT