QWT 7.0.1
Loading...
Searching...
No Matches
qwt_point_3d.h
Go to the documentation of this file.
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
28#ifndef QWT_POINT_3D_H
29#define QWT_POINT_3D_H
30
31#include "qwt_global.h"
32#include <qpoint.h>
33#include <qmetatype.h>
34
39class QWT_EXPORT QwtPoint3D
40{
41 public:
42 QwtPoint3D();
43 QwtPoint3D( double x, double y, double z );
44 QwtPoint3D( const QPointF& );
45
46 bool isNull() const;
47
48 double x() const;
49 double y() const;
50 double z() const;
51
52 double& rx();
53 double& ry();
54 double& rz();
55
56 void setX( double x );
57 void setY( double y );
58 void setZ( double y );
59
60 QPointF toPoint() const;
61
62 bool operator==( const QwtPoint3D& ) const;
63 bool operator!=( const QwtPoint3D& ) const;
64
65 private:
66 double m_x;
67 double m_y;
68 double m_z;
69};
70
71Q_DECLARE_TYPEINFO( QwtPoint3D, Q_MOVABLE_TYPE );
72Q_DECLARE_METATYPE( QwtPoint3D );
73
74#ifndef QT_NO_DEBUG_STREAM
75QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D& );
76#endif
77
83 : m_x( 0.0 )
84 , m_y( 0.0 )
85 , m_z( 0.0 )
86{
87}
88
90inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 )
91 : m_x( x )
92 , m_y( y )
93 , m_z( z )
94{
95}
96
101inline QwtPoint3D::QwtPoint3D( const QPointF& other )
102 : m_x( other.x() )
103 , m_y( other.y() )
104 , m_z( 0.0 )
105{
106}
107
114inline bool QwtPoint3D::isNull() const
115{
116 return m_x == 0.0 && m_y == 0.0 && m_z == 0.0;
117}
118
120inline double QwtPoint3D::x() const
121{
122 return m_x;
123}
124
126inline double QwtPoint3D::y() const
127{
128 return m_y;
129}
130
132inline double QwtPoint3D::z() const
133{
134 return m_z;
135}
136
138inline double& QwtPoint3D::rx()
139{
140 return m_x;
141}
142
144inline double& QwtPoint3D::ry()
145{
146 return m_y;
147}
148
150inline double& QwtPoint3D::rz()
151{
152 return m_z;
153}
154
156inline void QwtPoint3D::setX( double x )
157{
158 m_x = x;
159}
160
162inline void QwtPoint3D::setY( double y )
163{
164 m_y = y;
165}
166
168inline void QwtPoint3D::setZ( double z )
169{
170 m_z = z;
171}
172
176inline QPointF QwtPoint3D::toPoint() const
177{
178 return QPointF( m_x, m_y );
179}
180
182inline bool QwtPoint3D::operator==( const QwtPoint3D& other ) const
183{
184 return ( m_x == other.m_x ) && ( m_y == other.m_y ) && ( m_z == other.m_z );
185}
186
188inline bool QwtPoint3D::operator!=( const QwtPoint3D& other ) const
189{
190 return !operator==( other );
191}
192
193#endif
QwtPoint3D class defines a 3D point in double coordinates.
Definition qwt_point_3d.h:40
double z() const
Definition qwt_point_3d.h:132
bool operator==(const QwtPoint3D &) const
Definition qwt_point_3d.h:182
double y() const
Definition qwt_point_3d.h:126
bool operator!=(const QwtPoint3D &) const
Definition qwt_point_3d.h:188
void setY(double y)
Sets the y-coordinate of the point to the value specified by y.
Definition qwt_point_3d.h:162
double & rx()
Definition qwt_point_3d.h:138
double & ry()
Definition qwt_point_3d.h:144
double x() const
Definition qwt_point_3d.h:120
QwtPoint3D()
Constructs a null point.
Definition qwt_point_3d.h:82
void setZ(double y)
Sets the z-coordinate of the point to the value specified by z.
Definition qwt_point_3d.h:168
double & rz()
Definition qwt_point_3d.h:150
bool isNull() const
Definition qwt_point_3d.h:114
QPointF toPoint() const
Definition qwt_point_3d.h:176
void setX(double x)
Sets the x-coordinate of the point to the value specified by x.
Definition qwt_point_3d.h:156