|
From: <cn...@us...> - 2020-10-25 23:56:05
|
Revision: 1072
http://sourceforge.net/p/seq/svn/1072
Author: cn187
Date: 2020-10-25 23:56:03 +0000 (Sun, 25 Oct 2020)
Log Message:
-----------
Replace QMemArray with QVector
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/pointarray.h
Modified: showeq/branches/pre_6_0_beta/src/pointarray.h
===================================================================
--- showeq/branches/pre_6_0_beta/src/pointarray.h 2020-10-25 23:55:53 UTC (rev 1071)
+++ showeq/branches/pre_6_0_beta/src/pointarray.h 2020-10-25 23:56:03 UTC (rev 1072)
@@ -39,18 +39,18 @@
#else
#include <cstdint>
#endif
-#include <Q3MemArray>
+#include <QVector>
#include <QPoint>
#include <Q3PointArray>
// Point3DArray
template <class _T>
-class Point3DArray : public Q3MemArray<Point3D<_T> >
+class Point3DArray : public QVector<Point3D<_T> >
{
public:
Point3DArray() {};
- Point3DArray(int size) : Q3MemArray<Point3D<_T> > (size) {}
- Point3DArray(const Point3DArray<_T>& array) : Q3MemArray<Point3D<_T> > (array) {}
+ Point3DArray(int size) : QVector<Point3D<_T> > (size) {}
+ Point3DArray(const Point3DArray<_T>& array) : QVector<Point3D<_T> > (array) {}
Point3DArray(uint32_t nPoints, const _T* points);
~Point3DArray() {};
@@ -81,10 +81,10 @@
template <class _T> inline
QRect Point3DArray<_T>::boundingRect() const
{
- if (Q3MemArray<Point3D<_T> >::isEmpty())
+ if (QVector<Point3D<_T> >::isEmpty())
return QRect(0, 0, 0, 0);
- Point3D<_T>* d = Q3MemArray<Point3D<_T> >::data();
+ const Point3D<_T>* d = QVector<Point3D<_T> >::constData();
_T minX, maxX, minY, maxY;
minX = maxX = d->x();
@@ -92,7 +92,7 @@
uint32_t i;
for (++d, i = 1;
- i < Q3MemArray<Point3D<_T> >::size();
+ i < QVector<Point3D<_T> >::size();
i++, d++)
{
if (d->x() < minX)
@@ -111,7 +111,7 @@
template <class _T> inline
void Point3DArray<_T>::point(uint32_t index, _T* x, _T* y, _T* z) const
{
- Point3D<_T> p = Q3MemArray<Point3D<_T> >::at(index);
+ Point3D<_T> p = QVector<Point3D<_T> >::at(index);
*x = p.x();
*y = p. y();
*z = p. z();
@@ -120,25 +120,25 @@
template <class _T> inline
const Point3D<_T>& Point3DArray<_T>::point(uint32_t index) const
{
- return Q3MemArray<Point3D<_T> >::at(index);
+ return QVector<Point3D<_T> >::at(index);
}
template <class _T> inline
void Point3DArray<_T>::setPoint(uint32_t index, _T x, _T y, _T z)
{
- Q3MemArray<Point3D<_T> >::at(index) = Point3D<_T>(x, y, z);
+ QVector<Point3D<_T> >::operator[](index) = Point3D<_T>(x, y, z);
}
template <class _T> inline
void Point3DArray<_T>::setPoint(uint32_t index, const Point3D<_T>& p)
{
- Q3MemArray<Point3D<_T> >::at(index) = p;
+ QVector<Point3D<_T> >::operator[](index) = p;
}
template <class _T> inline
bool Point3DArray<_T>::setPoints(uint32_t nPoints, const _T* points)
{
- if (!Q3MemArray<Point3D<_T> >::resize(nPoints))
+ if (!QVector<Point3D<_T> >::resize(nPoints))
return false;
for (uint32_t i = 0;
@@ -153,7 +153,7 @@
bool Point3DArray<_T>::setPoints(uint32_t nPoints,
_T firstx, _T firsty, _T firstz, ...)
{
- if (!Q3MemArray<Point3D<_T> >::resize(nPoints))
+ if (!QVector<Point3D<_T> >::resize(nPoints))
return false;
setPoint( 0, firstx, firsty, firstz);
@@ -183,8 +183,8 @@
template <class _T> inline
bool Point3DArray<_T>::putPoints(uint32_t index, uint32_t nPoints, const _T* points)
{
- if ((index + nPoints) > Q3MemArray<Point3D<_T> >::size())
- if (!Q3MemArray<Point3D<_T> >::resize(index + nPoints))
+ if ((index + nPoints) > QVector<Point3D<_T> >::size())
+ if (!QVector<Point3D<_T> >::resize(index + nPoints))
return false;
for (uint32_t i = index;
@@ -199,8 +199,8 @@
bool Point3DArray<_T>::putPoints(uint32_t index, uint32_t nPoints,
_T firstx, _T firsty, _T firstz, ...)
{
- if ((index + nPoints) > Q3MemArray<Point3D<_T> >::size())
- if (!Q3MemArray<Point3D<_T> >::resize(index + nPoints))
+ if ((index + nPoints) > QVector<Point3D<_T> >::size())
+ if (!QVector<Point3D<_T> >::resize(index + nPoints))
return false;
setPoint( 0, firstx, firsty, firstz);
@@ -231,10 +231,10 @@
Q3PointArray Point3DArray<_T>::getQPointArray()
{
// create a temporary QPointArray of the same size as this array
- Q3PointArray tmp(Q3MemArray<Point3D<_T> >::size());
+ Q3PointArray tmp(QVector<Point3D<_T> >::size());
// copy each Point3D<_T> as a QPoint into the temporary QPointArray
- for (uint32_t i = 0; i < Q3MemArray<Point3D<_T> >::size(); i++)
+ for (uint32_t i = 0; i < QVector<Point3D<_T> >::size(); i++)
tmp.setPoint(i, point(i).qpoint());
// return the temporary QPointArray
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|