comparison layer/Layer.h @ 904:e0f08e108064 cxx11

Move to using double rather than float for floating-point calculations (float only for storage); more build fixes
author Chris Cannam
date Mon, 09 Mar 2015 12:02:10 +0000
parents 4c8ca536b54f
children b66fb15de477
comparison
equal deleted inserted replaced
903:1757933ce5a7 904:e0f08e108064
178 * Return true if a suitable feature was found and frame adjusted 178 * Return true if a suitable feature was found and frame adjusted
179 * accordingly. Return false if no suitable feature was available 179 * accordingly. Return false if no suitable feature was available
180 * (and leave frame unmodified). If returning true, also return 180 * (and leave frame unmodified). If returning true, also return
181 * the resolution of the model in this layer in sample frames. 181 * the resolution of the model in this layer in sample frames.
182 */ 182 */
183 virtual bool snapToFeatureFrame(View * /* v */, 183 virtual bool snapToFeatureFrame(View * /* v */,
184 int & /* frame */, 184 sv_frame_t & /* frame */,
185 int &resolution, 185 int &resolution,
186 SnapType /* snap */) const { 186 SnapType /* snap */) const {
187 resolution = 1; 187 resolution = 1;
188 return false; 188 return false;
189 } 189 }
202 * Return true if a suitable feature was found and frame adjusted 202 * Return true if a suitable feature was found and frame adjusted
203 * accordingly. Return false if no suitable feature was available 203 * accordingly. Return false if no suitable feature was available
204 * (and leave frame unmodified). If returning true, also return 204 * (and leave frame unmodified). If returning true, also return
205 * the resolution of the model in this layer in sample frames. 205 * the resolution of the model in this layer in sample frames.
206 */ 206 */
207 virtual bool snapToSimilarFeature(View * /* v */, 207 virtual bool snapToSimilarFeature(View * /* v */,
208 int & /* source frame */, 208 sv_frame_t & /* source frame */,
209 int &resolution, 209 int &resolution,
210 SnapType /* snap */) const { 210 SnapType /* snap */) const {
211 resolution = 1; 211 resolution = 1;
212 return false; 212 return false;
213 } 213 }
267 * return false if the user cancelled the paste operation. This 267 * return false if the user cancelled the paste operation. This
268 * function should return true if a paste actually occurred. 268 * function should return true if a paste actually occurred.
269 */ 269 */
270 virtual bool paste(View *, 270 virtual bool paste(View *,
271 const Clipboard & /* from */, 271 const Clipboard & /* from */,
272 int /* frameOffset */, 272 sv_frame_t /* frameOffset */,
273 bool /* interactive */) { return false; } 273 bool /* interactive */) { return false; }
274 274
275 // Text mode: 275 // Text mode:
276 // 276 //
277 // Label nearest feature. We need to get the feature coordinates 277 // Label nearest feature. We need to get the feature coordinates
421 * these values if known. 421 * these values if known.
422 * 422 *
423 * This function returns the "normal" extents for the layer, not 423 * This function returns the "normal" extents for the layer, not
424 * necessarily the extents actually in use in the display. 424 * necessarily the extents actually in use in the display.
425 */ 425 */
426 virtual bool getValueExtents(float &min, float &max, 426 virtual bool getValueExtents(double &min, double &max,
427 bool &logarithmic, QString &unit) const = 0; 427 bool &logarithmic, QString &unit) const = 0;
428 428
429 /** 429 /**
430 * Return the minimum and maximum values within the displayed 430 * Return the minimum and maximum values within the displayed
431 * range for the y axis, if only a subset of the whole range of 431 * range for the y axis, if only a subset of the whole range of
432 * the model (returned by getValueExtents) is being displayed. 432 * the model (returned by getValueExtents) is being displayed.
433 * Return false if the layer is not imposing a particular display 433 * Return false if the layer is not imposing a particular display
434 * extent (using the normal layer extents or deferring to whatever 434 * extent (using the normal layer extents or deferring to whatever
435 * is in use for the same units elsewhere in the view). 435 * is in use for the same units elsewhere in the view).
436 */ 436 */
437 virtual bool getDisplayExtents(float & /* min */, 437 virtual bool getDisplayExtents(double & /* min */,
438 float & /* max */) const { 438 double & /* max */) const {
439 return false; 439 return false;
440 } 440 }
441 441
442 /** 442 /**
443 * Set the displayed minimum and maximum values for the y axis to 443 * Set the displayed minimum and maximum values for the y axis to
444 * the given range, if supported. Return false if not supported 444 * the given range, if supported. Return false if not supported
445 * on this layer (and set nothing). In most cases, layers that 445 * on this layer (and set nothing). In most cases, layers that
446 * return false for getDisplayExtents should also return false for 446 * return false for getDisplayExtents should also return false for
447 * this function. 447 * this function.
448 */ 448 */
449 virtual bool setDisplayExtents(float /* min */, 449 virtual bool setDisplayExtents(double /* min */,
450 float /* max */) { 450 double /* max */) {
451 return false; 451 return false;
452 } 452 }
453 453
454 /** 454 /**
455 * Return the value and unit at the given x coordinate in the 455 * Return the value and unit at the given x coordinate in the
456 * given view. This is for descriptive purposes using the 456 * given view. This is for descriptive purposes using the
457 * measurement tool. The default implementation works correctly 457 * measurement tool. The default implementation works correctly
458 * if the layer hasTimeXAxis(). 458 * if the layer hasTimeXAxis().
459 */ 459 */
460 virtual bool getXScaleValue(const View *v, int x, 460 virtual bool getXScaleValue(const View *v, int x,
461 float &value, QString &unit) const; 461 double &value, QString &unit) const;
462 462
463 /** 463 /**
464 * Return the value and unit at the given y coordinate in the 464 * Return the value and unit at the given y coordinate in the
465 * given view. 465 * given view.
466 */ 466 */
467 virtual bool getYScaleValue(const View *, int /* y */, 467 virtual bool getYScaleValue(const View *, int /* y */,
468 float &/* value */, QString &/* unit */) const { 468 double &/* value */, QString &/* unit */) const {
469 return false; 469 return false;
470 } 470 }
471 471
472 /** 472 /**
473 * Return the difference between the values at the given y 473 * Return the difference between the values at the given y
474 * coordinates in the given view, and the unit of the difference. 474 * coordinates in the given view, and the unit of the difference.
475 * The default implementation just calls getYScaleValue twice and 475 * The default implementation just calls getYScaleValue twice and
476 * returns the difference, with the same unit. 476 * returns the difference, with the same unit.
477 */ 477 */
478 virtual bool getYScaleDifference(const View *v, int y0, int y1, 478 virtual bool getYScaleDifference(const View *v, int y0, int y1,
479 float &diff, QString &unit) const; 479 double &diff, QString &unit) const;
480 480
481 /** 481 /**
482 * Get the number of vertical zoom steps available for this layer. 482 * Get the number of vertical zoom steps available for this layer.
483 * If vertical zooming is not available, return 0. The meaning of 483 * If vertical zooming is not available, return 0. The meaning of
484 * "zooming" is entirely up to the layer -- changing the zoom 484 * "zooming" is entirely up to the layer -- changing the zoom
536 void verticalZoomChanged(); 536 void verticalZoomChanged();
537 537
538 protected: 538 protected:
539 void connectSignals(const Model *); 539 void connectSignals(const Model *);
540 540
541 virtual int alignToReference(View *v, int frame) const; 541 virtual sv_frame_t alignToReference(View *v, sv_frame_t frame) const;
542 virtual int alignFromReference(View *v, int frame) const; 542 virtual sv_frame_t alignFromReference(View *v, sv_frame_t frame) const;
543 bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const; 543 bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const;
544 544
545 struct MeasureRect { 545 struct MeasureRect {
546 546
547 mutable QRect pixrect; 547 mutable QRect pixrect;