comparison OrthancStone/Sources/Scene2DViewport/CreateAngleMeasureTracker.cpp @ 1972:9c0adcc8feec

refactoring to simplify OneGesturePointerTracker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Oct 2022 16:21:28 +0200
parents 7053b8a0aaec
children 07964689cb0b
comparison
equal deleted inserted replaced
1971:e5b31d55206d 1972:9c0adcc8feec
45 45
46 CreateAngleMeasureTracker::~CreateAngleMeasureTracker() 46 CreateAngleMeasureTracker::~CreateAngleMeasureTracker()
47 { 47 {
48 } 48 }
49 49
50 void CreateAngleMeasureTracker::PointerMove(const PointerEvent& event) 50 void CreateAngleMeasureTracker::PointerMove(const PointerEvent& event,
51 const Scene2D& scene)
51 { 52 {
52 if (!alive_) 53 if (!alive_)
53 { 54 {
54 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, 55 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,
55 "Internal error: wrong state in CreateAngleMeasureTracker::" 56 "Internal error: wrong state in CreateAngleMeasureTracker::"
81 // "scenePos.GetY() = " << scenePos.GetY(); 82 // "scenePos.GetY() = " << scenePos.GetY();
82 lock->Invalidate(); 83 lock->Invalidate();
83 } 84 }
84 } 85 }
85 86
86 void CreateAngleMeasureTracker::PointerUp(const PointerEvent& e) 87 void CreateAngleMeasureTracker::PointerUp(const PointerEvent& e,
88 const Scene2D& scene)
87 { 89 {
88 // TODO: the current app does not prevent multiple PointerDown AND 90 // TODO: the current app does not prevent multiple PointerDown AND
89 // PointerUp to be sent to the tracker. 91 // PointerUp to be sent to the tracker.
90 // Unless we augment the PointerEvent structure with the button index, 92 // Unless we augment the PointerEvent structure with the button index,
91 // we cannot really tell if this pointer up event matches the initial 93 // we cannot really tell if this pointer up event matches the initial
106 "Wrong state in CreateAngleMeasureTracker::" 108 "Wrong state in CreateAngleMeasureTracker::"
107 "PointerMove: state_ invalid"); 109 "PointerMove: state_ invalid");
108 } 110 }
109 } 111 }
110 112
111 void CreateAngleMeasureTracker::PointerDown(const PointerEvent& e) 113 void CreateAngleMeasureTracker::PointerDown(const PointerEvent& e,
114 const Scene2D& scene)
112 { 115 {
113 switch (state_) 116 switch (state_)
114 { 117 {
115 case CreatingSide1: 118 case CreatingSide1:
116 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, 119 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError,