diff layer/LayerGeometryProvider.h @ 1537:4f8c72adbf43

Clarify naming of some view-related methods. Rename LayerGeometryProvider::getValueExtents to getVisibleExtentsForUnit, and View::getTextLabelHeight to getTextLabelYCoord. Add View::getVisibleExtentsForAnyUnit to be used to determine which unit to adopt in a new e.g. box layer.
author Chris Cannam
date Tue, 15 Oct 2019 11:40:56 +0100
parents b0eeec95ab5b
children
line wrap: on
line diff
--- a/layer/LayerGeometryProvider.h	Tue Oct 15 09:32:24 2019 +0100
+++ b/layer/LayerGeometryProvider.h	Tue Oct 15 11:40:56 2019 +0100
@@ -142,10 +142,32 @@
                                     double minFreq, double maxFreq,
                                     bool logarithmic) const = 0;
 
-    virtual int getTextLabelHeight(const Layer *layer, QPainter &) const = 0;
+    /**
+     * Return a y-coordinate at which text labels for individual items
+     * in a layer may be drawn, so as not to overlap with those of
+     * other layers. The returned coordinate will be near the top of
+     * the visible widget, but adjusted downward depending on how many
+     * other visible layers return true from their implementation of
+     * Layer::needsTextLabelHeight().
+     */
+    virtual int getTextLabelYCoord(const Layer *layer, QPainter &) const = 0;
 
-    virtual bool getValueExtents(QString unit, double &min, double &max,
-                                 bool &log) const = 0;
+    /**
+     * Return the visible vertical extents for the given unit, if any.
+     * That is:
+     * 
+     * - if at least one non-dormant layer uses the same unit and
+     *   returns some values from its getDisplayExtents() method,
+     *   return the extents from the topmost of those
+     *
+     * - otherwise, if at least one non-dormant layer uses the same
+     *   unit, return the union of the value extents of all of those
+     * 
+     * - otherwise return false
+     */
+    virtual bool getVisibleExtentsForUnit(QString unit,
+                                          double &min, double &max,
+                                          bool &log) const = 0;
 
     /**
      * Return the zoom level, i.e. the number of frames per pixel or