RiverWare Feature Research
/ Phil Weinstein, 7-01-2009
TableSlot Plotting: Optional Automatic Placement of the Vertical
Distance Entity on the Vertical Axis
User Guide Document: Source: /projects/riverware/doc/plotting/TableSlotAxes/PlotAxesVertDistOverride.fm |
Revision: [7-1-2009]: Revised Axis Default Configuration dialog |
There is a request to automatically reverse the plot axis for plotted table slots when the first table slot column represents a vertical distance, such as elevation.
Table slots having two columns are plotting with these axis assignments. RiverWare doesn't currently provide a way of reversing these assignments:
When plotting a table slot with more than two columns, a dialog box is shown allowing the user to pick particular columns for the two axis:
A demo capability was tested to automatically reverse the default assignment of the axis when plotting two-column tables when column-0 meets the following criteria, and column-1 does not:
The following image illustrates
the application of this heuristic with two copies of an Elevation Volume table.
The top images show the effect of the reversal. The bottom images show the original
axis orientation as the result of the columns not matching the new reversal criteria,
being that the "Pool Elevation" column label was changed to "Pool
Height" ....
Object Type | Slot | Column 0 Label |
Column 0 Unit |
Column 1 Label |
Column 1 Unit |
Power Res | Elevation Area Table | Pool Elevation | Feet | Surface Area | Acre |
Power Res | Elevation Volume Table | Pool Elevation | Feet | Storage | Acre-Ft |
Reservoir | Max Release | Pool Elevation | Feet | Discharge | cfs |
Power Res | Regulation Spill Table | Pool Elevation | Feet | Max Regulated Spill | cfs |
Power Res | Net Head vs Generator Capacity | NO LABEL | Feet | NO LABEL | KW |
Power Res | Net Head vs Plant Efficiency | NO LABEL | Feet | NO LABEL | NONE |
Note: The original design of this feature required that the column label contain "ELEV" or "HEAD" to be regarded as a "vertical distance" entity. This definition was loosened to include also a blank column label to support the latter two example slots.
This automatic reversal of axis assignment when plotting two-column tables needs to be optional, based on a user setting.
We would like to associate this preference with the RiverWare model file rather than with the user login (which is implemented with QSettings). Unfortunately, there already exists a seemingly natural place to provide this option -- Plot Dialog / Default Axis Settings -- but those setting are associated with the user login -- not saved with the model file (see the following image). See also an excerpt of the RiverWare Online Help (two-page PDF). So, we'll have to figure this out.
Here is the C++ code which implements the draft heuristic:
bool SlotGUIUtils::slotColIsProbablyVerticalDistance (const Slot *slot, int colInx) { if (slot == NULL) return (false); //----------------------------->> const int colCnt = getNumCols (slot); if (colInx < 0) return (false); if (colInx >= colCnt) return (false); //--------------------------------->> const unit_type uType = getUnitType (slot, colInx); if (uType != LENGTH) return (false); //-------------------------------->> const RWCString colLabel = getColLabel (slot, colInx); const QString colLabelStr = QString (colLabel.data()).toUpper(); if (colLabelStr.isEmpty()) return (true); |
--- (end) ---