-
Notifications
You must be signed in to change notification settings - Fork 1
/
Distance_Line.hh
94 lines (77 loc) · 3.04 KB
/
Distance_Line.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* Distance_Line
HiROC CVS ID: $Id: Distance_Line.hh,v 2.1 2013/10/14 18:31:42 stephens Exp $
Copyright (C) 2011 Arizona Board of Regents on behalf of the
Planetary Image Research Laboratory, Lunar and Planetary Laboratory at
the University of Arizona.
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License, version 2.1,
as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*******************************************************************************/
#ifndef HiView_Distance_Line_hh
#define HiView_Distance_Line_hh
#include <QWidget>
#include <QPoint>
#include <QString>
#include <QPen>
namespace UA
{
namespace HiRISE
{
/*
The Distance Line allows a line to be painted on top of a parent
widget. It will hold 2 QPoints, which will represent a straight
line, as well as a String field which will be displayed adjacent
to the line. It is suggested that the string field be used to report
the distance of the line. The functions are named in accordance with
the QLine function names.
*/
class Distance_Line : public QWidget
{
Q_OBJECT
public:
/***************************************************
* Constructors *
***************************************************/
Distance_Line(QWidget *parent);
/***************************************************
* Setters *
***************************************************/
void setP1(const QPoint & p);
void setP2(const QPoint & p);
void setText(QString str);
void setColor(const QColor & color);
/***************************************************
* Accessors *
***************************************************/
QPoint p1();
QPoint p2();
int dx();
int dy();
/***************************************************
* Overloaded Protected Functions *
***************************************************/
protected:
virtual void paintEvent(QPaintEvent *);
/***************************************************
* Helpers *
***************************************************/
private:
void update_rect();
/***************************************************
* Data *
***************************************************/
QString Line_Text;
QPoint P1, P2;
int Dx, Dy, BottomRight_X, BottomRight_Y;
QPen Line_Style;
};
}
}
#endif