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

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