CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkTransferFunctionControlPointsItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkTransferFunctionControlPointsItem_h
22 #define __ctkTransferFunctionControlPointsItem_h
23 
25 #include <QGraphicsObject>
26 
28 #include "ctkWidgetsExport.h"
29 #include "ctkPimpl.h"
31 
32 class ctkTransferFunctionControlPointsItemPrivate;
33 
34 //-----------------------------------------------------------------------------
37 {
38  Q_OBJECT
39 public:
40 
41  enum MOVE_TYPE{
42  STOP_MOVE = 0,
45  FUSION_MOVE
46  };
47 
48  explicit ctkTransferFunctionControlPointsItem(QGraphicsItem* parent = 0);
50  QGraphicsItem* parent = 0);
52 
53  virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
54 
55 protected:
56  virtual void mousePressEvent(QGraphicsSceneMouseEvent* e);
57  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* e);
58  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* e);
59  virtual void keyPressEvent (QKeyEvent * keyEvent);
60 protected:
61  QScopedPointer<ctkTransferFunctionControlPointsItemPrivate> d_ptr;
62 
63 private:
64  Q_DECLARE_PRIVATE(ctkTransferFunctionControlPointsItem);
66 
67  /*
68  * \brief Update the position of a point when a move mouse event occurs
69  */
70  void updatePointPosition( QPointF iPoint );
71  /*
72  * \brief Stop "moving point" if its position reaches another point
73  */
74  void stopPoints( QPointF iPointF );
75  /*
76  * \brief Switch "moving point" and "reached point" when "moving point" reaches a point.
77  * Position of "reached point" - IS NOT - lost.
78  */
79  void switchPoints( QPointF iPointF );
80  /*
81  * \brief Switch "moving point" and "reached point" when "moving point" reaches a point.
82  * Position of "reached point" - IS - lost.
83  */
84  void drawPoints( QPointF iPointF );
85  /*
86  * \brief The moving (or reached point?) is deleted
87  */
88  void fusionPoints( QPointF iPointF );
89 };
90 
91 #endif
ctkTransferFunctionControlPointsItem(QGraphicsItem *parent=0)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *e)
virtual void mousePressEvent(QGraphicsSceneMouseEvent *e)
virtual void keyPressEvent(QKeyEvent *keyEvent)
ctkTransferFunctionControlPointsItem(ctkTransferFunction *transferFunction, QGraphicsItem *parent=0)
QScopedPointer< ctkTransferFunctionControlPointsItemPrivate > d_ptr
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)