OpendTect  6.6
dragcontroller.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: J.C. Glas
8  Date: May 2016
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "algomod.h"
14 #include "coord.h"
15 
16 
24 {
25 public:
28 
29  void init(const Coord& mousepos,double scalefactor=1.0,
30  const Coord3& dragdir=Coord3(0.0,0.0,0.0));
31 
32  void setFastMaxDragToMouseRatio(float distanceperpixel);
34 
35  void setSlowMaxDragToMouseRatio(float distanceperpixel);
37 
38  void setFastMinDragToMouseRatio(float distanceperpixel);
40 
41  void setSlowMinDragToMouseRatio(float distanceperpixel);
43 
44  void setFastMouseSpeed(float pixelspersecond);
45  float getFastMouseSpeed() const;
46 
47  void setSlowMouseSpeed(float pixelspersecond);
48  float getSlowMouseSpeed() const;
49 
50  void setLinearBackDragFrac(float fraction);
51  float getLinearBackDragFrac() const;
56  void transform(double& dragval,const Coord& mousepos,
57  double maxdragdist=mUdf(double));
58  void transform(Coord3& dragvec,const Coord& mousepos,
59  double maxdragdist=mUdf(double));
60 
61  void dragInScreenSpace(bool fromstart,const Coord& projvec);
62 
63 protected:
64 
65  void reInit(const Coord& mousepos);
66 
67  void manageScreenDragging(double& dragval,
68  const Coord& mousepos);
69 
70  double absTransform(double dragval,const Coord& mousepos,
71  double maxdragdist=mUdf(double));
72 
80 
84 
88 
90  double prevdragval_;
91  double prevtransval_;
92  double maxdragval_;
93  int dragsign_;
94  double scalefactor_;
95 };
96 
97 
Coord3
A cartesian coordinate in 3D space.
Definition: coord.h:72
DragController::screendragprojvec_
Coord screendragprojvec_
Definition: dragcontroller.h:87
DragController::setFastMouseSpeed
void setFastMouseSpeed(float pixelspersecond)
DragController::slowmousespeed_
float slowmousespeed_
Definition: dragcontroller.h:78
DragController::prevdragtime_
int prevdragtime_
Definition: dragcontroller.h:83
DragController::getSlowMouseSpeed
float getSlowMouseSpeed() const
DragController::~DragController
~DragController()
DragController::getLinearBackDragFrac
float getLinearBackDragFrac() const
DragController::setFastMaxDragToMouseRatio
void setFastMaxDragToMouseRatio(float distanceperpixel)
DragController
Auxiliary class to control dragger speed. The idea is that slowly moving the mouse forces the dragger...
Definition: dragcontroller.h:24
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
DragController::manageScreenDragging
void manageScreenDragging(double &dragval, const Coord &mousepos)
DragController::transform
void transform(double &dragval, const Coord &mousepos, double maxdragdist=mUdf(double))
DragController::init
void init(const Coord &mousepos, double scalefactor=1.0, const Coord3 &dragdir=Coord3(0.0, 0.0, 0.0))
DragController::fastmindragtomouseratio_
float fastmindragtomouseratio_
Definition: dragcontroller.h:75
DragController::slowmaxdragtomouseratio_
float slowmaxdragtomouseratio_
Definition: dragcontroller.h:74
DragController::prevdragval_
double prevdragval_
Definition: dragcontroller.h:90
DragController::getFastMinDragToMouseRatio
float getFastMinDragToMouseRatio() const
DragController::DragController
DragController()
Coord
A cartesian coordinate in 2D space.
Definition: coord.h:25
DragController::reInit
void reInit(const Coord &mousepos)
DragController::getFastMaxDragToMouseRatio
float getFastMaxDragToMouseRatio() const
DragController::dragsign_
int dragsign_
Definition: dragcontroller.h:93
DragController::initmousepos_
Coord initmousepos_
Definition: dragcontroller.h:81
DragController::dragInScreenSpace
void dragInScreenSpace(bool fromstart, const Coord &projvec)
DragController::slowmindragtomouseratio_
float slowmindragtomouseratio_
Definition: dragcontroller.h:76
DragController::linearbackdragfrac_
float linearbackdragfrac_
Definition: dragcontroller.h:79
DragController::scalefactor_
double scalefactor_
Definition: dragcontroller.h:94
DragController::prevtransval_
double prevtransval_
Definition: dragcontroller.h:91
DragController::maxdragval_
double maxdragval_
Definition: dragcontroller.h:92
DragController::fastmousespeed_
float fastmousespeed_
Definition: dragcontroller.h:77
DragController::setFastMinDragToMouseRatio
void setFastMinDragToMouseRatio(float distanceperpixel)
DragController::setLinearBackDragFrac
void setLinearBackDragFrac(float fraction)
DragController::dragdir_
Coord3 dragdir_
Definition: dragcontroller.h:82
DragController::setSlowMouseSpeed
void setSlowMouseSpeed(float pixelspersecond)
DragController::screendragfactor_
float screendragfactor_
Definition: dragcontroller.h:86
DragController::getSlowMinDragToMouseRatio
float getSlowMinDragToMouseRatio() const
DragController::prevmousepos_
Coord prevmousepos_
Definition: dragcontroller.h:89
DragController::transform
void transform(Coord3 &dragvec, const Coord &mousepos, double maxdragdist=mUdf(double))
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
DragController::getFastMouseSpeed
float getFastMouseSpeed() const
DragController::screendragmode_
bool screendragmode_
Definition: dragcontroller.h:85
DragController::setSlowMaxDragToMouseRatio
void setSlowMaxDragToMouseRatio(float distanceperpixel)
DragController::fastmaxdragtomouseratio_
float fastmaxdragtomouseratio_
Definition: dragcontroller.h:73
DragController::getSlowMaxDragToMouseRatio
float getSlowMaxDragToMouseRatio() const
DragController::setSlowMinDragToMouseRatio
void setSlowMinDragToMouseRatio(float distanceperpixel)
DragController::absTransform
double absTransform(double dragval, const Coord &mousepos, double maxdragdist=mUdf(double))
coord.h

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021