Skip to content

Commit 75dbcee

Browse files
committed
basic documentation
1 parent bf5a401 commit 75dbcee

File tree

3 files changed

+58
-48
lines changed

3 files changed

+58
-48
lines changed

src/qsegment.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ bool QUnconstrained::s_show = false;
3838
bool QSegment::s_showUncertainty = false;
3939

4040
QPen & myQPen();
41+
42+
//! Initialized pen upon first call to the function
4143
QPen & myQPen()
4244
{
43-
// Initialized upon first call to the function
4445
static QPen p;
4546
return p;
4647
}

src/qsegment.h

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,50 +31,55 @@ class uPoint;
3131
}
3232

3333

34-
34+
//! Graphics: Strokes and straight line segments
3535
namespace QEntity {
3636

3737
using Uncertain::uPoint;
3838

39-
class
40-
QSegment : public QGraphicsItem
39+
//! Graphics: Base class for straight line segments
40+
class QSegment : public QGraphicsItem
4141
{
4242
public:
4343
QSegment( const uPoint & ux,
44-
const uPoint & uy);
45-
QSegment( const QSegment & other) = delete;
44+
const uPoint & uy); //!< Value constructor (two uncorrelated uncertain points)
45+
QSegment( const QSegment & other) = delete; //!< Copy constructor
4646

47-
enum {Type = UserType +164};
48-
int type() const override { return Type; }
47+
enum {Type = UserType +164}; //!< Definition graphics type (id)
48+
int type() const override { return Type; } //!< get graphics type (id)
4949

50-
void setColor( const QColor & c) { pen_.setColor(c); }
51-
void setLineWidth( const int w) { pen_.setWidth(w); }
52-
void setLineStyle( const int s) { pen_.setStyle( Qt::PenStyle(s)); }
50+
void setColor( const QColor & c) { pen_.setColor(c); } //!< Set color
51+
void setLineWidth( const int w) { pen_.setWidth(w); } //!< Set line width
52+
void setLineStyle( const int s) { pen_.setStyle( Qt::PenStyle(s)); } //!< Set line style
5353

5454
protected:
5555
QSegment();
5656
~QSegment() override = default;
5757

58-
QPainterPath shape() const override;
59-
void mousePressEvent( QGraphicsSceneMouseEvent * /* event */) override;
58+
QPainterPath shape() const override; //!< Get bounding shape
59+
void mousePressEvent( QGraphicsSceneMouseEvent * /* event */) override; //!< Handle mouse press event
6060

61-
QPen pen() const { return pen_;}
62-
void setPen( const QPen & p) { pen_ = p;}
61+
QPen pen() const { return pen_;} //!< Get pen
62+
void setPen( const QPen & p) { pen_ = p;} //!< Set pen
6363

6464
public:
6565
// QSegment & operator= ( const QSegment & other );
6666

67-
virtual void serialize( QDataStream & out ) const;
68-
bool deserialize( QDataStream &in );
67+
virtual void serialize( QDataStream & out ) const; //!< serialization
68+
bool deserialize( QDataStream &in ); //!< deserialization
6969

70+
//! Toggle visibility confidence regions
7071
static void toggleShowUncertainty() { s_showUncertainty = !s_showUncertainty; }
72+
73+
//! Get status visibility confidence regions
7174
static bool showUncertainty() { return s_showUncertainty; }
7275

7376
protected:
74-
QRectF boundingRect() const override;
77+
QRectF boundingRect() const override; //!< Get axis-aligned bounding box
78+
79+
//! Plot uncertain straight line segment (base class)
7580
void paint( QPainter *painter,
7681
const QStyleOptionGraphicsItem *option,
77-
QWidget *widget) override; //!< plot tracked positions
82+
QWidget *widget) override;
7883

7984
private:
8085
void createSelectionPolygon( qreal halfWidth );
@@ -96,30 +101,30 @@ class
96101
};
97102

98103

104+
//! Graphics: Constrained straight line segment
99105
class QConstrained : public QSegment
100106
{
101107
public:
102108
QConstrained();
103109
QConstrained( const uPoint & ux,
104-
const uPoint & uy);
110+
const uPoint & uy); //!< Value constructor
105111

106112
// using QSegment::operator=;
107113

108-
void setAltColor( const QColor &);
114+
void setAltColor( const QColor &); //!< Set color for automatic colorization (subtasks)
109115

110-
static bool show() { return s_show; }
111-
static void toggleShow() { s_show = !s_show; }
112-
113-
static bool showColor() { return s_showColor; }
114-
static void toogleShowColor() { s_showColor = !s_showColor;}
115-
116-
static void setPenDefault( const QPen & p) { s_defaultPen = p; }
117-
static QPen defaultPen() { return s_defaultPen; }
116+
static bool show() { return s_show; } //!< Get status of visibility
117+
static void toggleShow() { s_show = !s_show; } //!< Toggle visibility
118+
static bool showColor() { return s_showColor; } //!< Get status colorization
119+
static void toogleShowColor() { s_showColor = !s_showColor;} //!< Toggle colorization / no colorization
120+
static void setPenDefault( const QPen & p) { s_defaultPen = p; } //!< Set default pen
121+
static QPen defaultPen() { return s_defaultPen; } //!< Get current default pen
118122

119123
protected:
124+
//! Plot uncertain constrained straight line segment
120125
void paint( QPainter *painter,
121126
const QStyleOptionGraphicsItem *option,
122-
QWidget *widget) override; //!< plot tracked positions
127+
QWidget *widget) override;
123128

124129
private:
125130
QColor altColor;
@@ -129,25 +134,28 @@ class QConstrained : public QSegment
129134
static QPen s_defaultPen;
130135
};
131136

137+
138+
//! Graphics: Unconstrained straight line segment
132139
class QUnconstrained : public QSegment
133140
{
134141
public:
135-
QUnconstrained();
142+
QUnconstrained(); //!< Standard Constructor
136143
QUnconstrained( const uPoint & ux,
137-
const uPoint & uy);
144+
const uPoint & uy); //!< Value constructor (two uncorrelated uncertain points)
138145

139146
// using QSegment::operator=;
140147

141-
static void toggleShow() { s_show = !s_show; }
142-
static bool show() { return s_show; }
148+
static void toggleShow() { s_show = !s_show; } //!< Toggle visibility
149+
static bool show() { return s_show; } //!< Get status visibility
143150

144-
static void setPenDefault( const QPen &p) { s_defaultPen = p; }
145-
static QPen defaultPen() { return s_defaultPen; }
151+
static void setPenDefault( const QPen &p) { s_defaultPen = p; } //!< Set default pen
152+
static QPen defaultPen() { return s_defaultPen; } //!< Get current default pen
146153
protected:
147154
// QRectF boundingRect() const override { return QSegment::boundingRect(); }
155+
//! Plot unconstrained uncertain straight line segment
148156
void paint( QPainter *painter,
149157
const QStyleOptionGraphicsItem *option,
150-
QWidget *widget) override; //!< plot tracked positions
158+
QWidget *widget) override;
151159

152160
private:
153161
static bool s_show;

src/qstroke.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,33 @@
2727

2828
namespace QEntity {
2929

30+
//! Graphics: Strokes as point sequence
3031
class QStroke : public QGraphicsPolygonItem
3132
{
3233
public:
3334
QStroke();
34-
QStroke( const QPolygonF & p);
35+
QStroke( const QPolygonF & p); //!< Copy constructor
3536
~QStroke() override = default;
3637

3738
// enum {Type = UserType +264};
3839
// int type() const override { return Type; }
3940

40-
void serialize( QDataStream & out ) const;
41-
bool deserialize( QDataStream &in );
41+
void serialize( QDataStream & out ) const; //!< serialization
42+
bool deserialize( QDataStream &in ); //!< deserialization
4243

43-
void setColor( const QColor & col) { m_pen.setColor(col); }
44-
void setLineWidth( const int w ) { m_pen.setWidth(w); }
44+
void setColor( const QColor & col) { m_pen.setColor(col); } //!< Set color
45+
void setLineWidth( const int w ) { m_pen.setWidth(w); } //!< Set line width, i.e, point size
4546

46-
static void toggleShow() { s_show = !s_show; }
47-
static bool show() { return s_show; }
48-
static void setPenDefault( const QPen & p) { s_defaultPen = p; }
49-
static QPen defaultPen() { return s_defaultPen; }
47+
static void toggleShow() { s_show = !s_show; } //!< Toggle visibility
48+
static bool show() { return s_show; } //!< Get status visibility
49+
static void setPenDefault( const QPen & p) { s_defaultPen = p; } //!< Set default pen
50+
static QPen defaultPen() { return s_defaultPen; } //!< Get current default pen
5051

5152
protected:
52-
void mousePressEvent( QGraphicsSceneMouseEvent *event) override;
53+
void mousePressEvent( QGraphicsSceneMouseEvent *event) override; //!< Handle mouse press event
5354
void paint( QPainter *painter,
5455
const QStyleOptionGraphicsItem *option,
55-
QWidget *widget) override; //!< plot tracked positions
56+
QWidget *widget) override; //!< Plot point sequence
5657
private:
5758
QPen m_pen;
5859

0 commit comments

Comments
 (0)