13#include <codeanalysis\warnings.h>
17VSWARNING(ALL_CODE_ANALYSIS_WARNINGS)
21CLANGWARNING(
"-Wlanguage-extension-token")
22CLANGWARNING(
"-Wmicrosoft-enum-value")
36#if QT_VERSION > 0x050000
43Q_DECLARE_METATYPE(
string)
46Q_DECLARE_METATYPE(IVect2)
47Q_DECLARE_METATYPE(FVect2)
48Q_DECLARE_METATYPE(DVect2)
49Q_DECLARE_METATYPE(UVect2)
50Q_DECLARE_METATYPE(DAVect2)
51Q_DECLARE_METATYPE(FAVect2)
52Q_DECLARE_METATYPE(IAVect2)
53Q_DECLARE_METATYPE(UAVect2)
54Q_DECLARE_METATYPE(IVect3)
55Q_DECLARE_METATYPE(FVect3)
56Q_DECLARE_METATYPE(DVect3)
57Q_DECLARE_METATYPE(UVect3)
58Q_DECLARE_METATYPE(DAVect3)
59Q_DECLARE_METATYPE(FAVect3)
60Q_DECLARE_METATYPE(IAVect3)
61Q_DECLARE_METATYPE(UAVect3)
66Q_DECLARE_METATYPE(
Quat2)
67Q_DECLARE_METATYPE(
Quat3)
76class ItascaTextStream :
public QTextStream {
82 BASE_EXPORT ItascaTextStream(
const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly) : QTextStream(array,openMode) {
86 BASE_EXPORT ItascaTextStream(QByteArray *array, QIODevice::OpenMode openMode = QIODevice::ReadWrite) : QTextStream(array,openMode) {
90 BASE_EXPORT ItascaTextStream(QString *
string, QIODevice::OpenMode openMode = QIODevice::ReadWrite) : QTextStream(
string,openMode) {
94 BASE_EXPORT ItascaTextStream(FILE *fileHandle, QIODevice::OpenMode openMode = QIODevice::ReadWrite) : QTextStream(fileHandle,openMode) {
98 BASE_EXPORT ItascaTextStream(QIODevice *device) : QTextStream(device) {
115 ds << v.
x() << v.
y();
120 ds >> v.
rx() >> v.
ry();
125 ds << v.
x() << v.
y() << v.
z();
130 ds >> v.
rx() >> v.
ry() >> v.
rz();
146 ds << av.
x() << av.
y() << av.
z();
151 ds >> av.
rx() >> av.
ry() >> av.
rz();
158 ds << v.
x1() << v.
x2() << v.
y1() << v.
y2();
168 ds << v.
x1() << v.
x2() << v.
y1() << v.
y2() << v.
z1() << v.
z2();
210 int w = ds.fieldWidth();
213 ds << qSetFieldWidth(0) <<
"(" << qSetFieldWidth(w) << v.
x();
214 ds << qSetFieldWidth(0) <<
"," << qSetFieldWidth(w) << v.
y();
215 ds << qSetFieldWidth(0) <<
")";
221 int w = ds.fieldWidth();
224 ds << qSetFieldWidth(0) <<
"(" << qSetFieldWidth(w) << v.
x();
225 ds << qSetFieldWidth(0) <<
"," << qSetFieldWidth(w) << v.
y();
226 ds << qSetFieldWidth(0) <<
"," << qSetFieldWidth(w) << v.
z();
227 ds << qSetFieldWidth(0) <<
")";
268inline I64Vect2 toI64Vect2(
const QPoint &p) {
302 int type1 =
static_cast<int>(v1.type());
303 int type2 =
static_cast<int>(v2.type());
304 if (type1==QVariant::UserType)
306 type1 = v1.userType();
307 if (type2==QVariant::UserType)
308 type2 = v2.userType();
312 return type1 == type2;
319QVariant
toQVariant(
const T &t) { QVariant v; v.setValue(t);
return v; }
372struct fmt::formatter<QVariant> :
public fmt::formatter<string> {
373 template <
typename ParseContext>
374 constexpr auto parse(ParseContext &ctx) {
375 return fmt::formatter<string>::parse(ctx);
378 template <
typename FormatContext>
379 auto format(QVariant
const &val, FormatContext &ctx) {
381 switch (val.type()) {
382 case QVariant::Bool: out = base::ts(val.toBool());
break;
383 case QVariant::Int: out = base::ts(val.toInt());
break;
384 case QVariant::UInt: out = base::ts(val.toUInt());
break;
385 case QVariant::LongLong: out = base::ts(val.toLongLong());
break;
386 case QVariant::ULongLong: out = base::ts(val.toULongLong());
break;
387 case QVariant::Double: out = base::ts(val.toDouble());
break;
388 case QVariant::String: out = base::ts(val.toString());
break;
389 case QVariant::List: {
391 auto list = val.toList();
392 for (
int i=0;i<list.size();++i) {
394 out += base::ts(list[i].toDouble());
399 case QVariant::UserType: {
400 auto v = val.userType();
401 if (v==qMetaTypeId<IVect2 >()) out = base::ts(val.value<IVect2 >());
402 else if (v==qMetaTypeId<DVect2 >()) out = base::ts(val.value<DVect2 >());
403 else if (v==qMetaTypeId<IVect3 >()) out = base::ts(val.value<IVect3 >());
404 else if (v==qMetaTypeId<DVect3 >()) out = base::ts(val.value<DVect3 >());
405 else if (v==qMetaTypeId<DAVect2>()) out = base::ts(val.value<DAVect2>());
406 else if (v==qMetaTypeId<DAVect3>()) out = base::ts(val.value<DAVect3>());
410 throw Exception(
"Unable to format QVariant type {}.", val.typeName());
412 return fmt::formatter<string>::format(out, ctx);
One stop include for all objects defined as part of base interface.
2D Angular vector class.
Definition avect.h:43
T & rz()
Returns a reference to the z component, cannot reference access x or y.
Definition avect.h:81
const T & z() const
Member access - returns the z component of the 2D angular vector.
Definition avect.h:70
3D Angular vector class.
Definition avect.h:176
Class for specifying a particular 2D cartesian axes system, and converting to and from it.
Definition axes.h:21
Class for specifying a particular 3D cartesian axes system, and converting to and from it.
Definition axes.h:121
Class for specifying a particular 2D cartesian axes system, and converting to and from it.
Definition caxes.h:25
Class for specifying a particular 3D cartesian axes system, and converting to and from it.
Definition caxes.h:103
Base exception class for all Itasca code.
Definition baseexception.h:10
2D cartesian region in space.
Definition extent2.h:12
T & ry1()
Access reference to the minimum y extent.
Definition extent2.h:129
T & ry2()
Access reference to the maximum y extent.
Definition extent2.h:131
T & rx1()
Access reference to the minimum x extent.
Definition extent2.h:125
const T & y1() const
Returns the lower y-bound.
Definition extent2.h:37
const T & y2() const
Returns the upper y-bound.
Definition extent2.h:39
const T & x2() const
Returns the upper x-bound.
Definition extent2.h:35
T & rx2()
Access reference to the maximum x extent.
Definition extent2.h:127
const T & x1() const
Returns the lower x-bound.
Definition extent2.h:33
A Class representing a cartesian extent in 3D.
Definition extent3.h:16
const T & z1() const
Returns the lower bound of the extent in the y-direction.
Definition extent3.h:50
const T & x1() const
Returns the lower bound of the extent in the x-direction.
Definition extent3.h:42
const T & y2() const
Returns the upper bound of the extent in the y-direction.
Definition extent3.h:48
T & rz1()
Reference access to the minimum z extent.
Definition extent3.h:174
T & ry1()
Reference access to the minimum y extent.
Definition extent3.h:172
T & ry2()
Reference access to the maximum y extent.
Definition extent3.h:173
T & rx2()
Reference access to the maximum x extent.
Definition extent3.h:171
T & rz2()
Definition extent3.h:175
T & rx1()
Reference access to the minimum x extent.
Definition extent3.h:170
const T & z2() const
Returns the upper bound of the extent in the y-direction.
Definition extent3.h:52
const T & y1() const
Returns the lower bound of the extent in the y-direction.
Definition extent3.h:46
const T & x2() const
Returns the upper bound of the extent in the x-direction.
Definition extent3.h:44
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition orientation.h:50
Class for storing an "orientation", or a direction in 2D or 3D space.
Definition orientation.h:99
2D quaternion-like utility class. In this case only the angle (in radians) is stored as opposed to th...
Definition quat.h:20
3D quaternion utility class.
Definition quat.h:109
A symmetric 2nd order tensor.
Definition symtensor.h:22
A simpler (and slightly faster) version of a QVariant, added for interfaces that do not use Qt.
Definition variant.h:32
2D vector utility class.
Definition vect.h:34
constexpr const T & x() const
X component access.
Definition vect.h:58
T & rx()
Reference access to x-component.
Definition vect.h:64
constexpr const T & y() const
Y component access.
Definition vect.h:60
T & ry()
Reference access to y-component.
Definition vect.h:66
3D vector utility class.
Definition vect.h:163
constexpr const T & y() const
The y-component of the vector.
Definition vect.h:186
T & rx()
Reference access to the x-component of the vector.
Definition vect.h:192
T & ry()
Reference access to the y-component of the vector.
Definition vect.h:194
constexpr const T & x() const
The x-component of the vector.
Definition vect.h:184
constexpr const T & z() const
The z-component of the vector.
Definition vect.h:188
T & rz()
Reference access to the z-component of the vector.
Definition vect.h:196
QPointF toQPointF(const Vector2< T > &v)
Convert a Vector2 to a QPointF.
Definition basetoqt.h:243
bool isDirectoryProtected(const QDir &dir, const QString ®istryString)
Definition basetoqt.cpp:453
QString getInstallDirectory(const QString ®istryString)
Definition basetoqt.cpp:491
QPoint toQPoint(const Vector2< T > &v)
Convert a Vector2 to a QPoint.
Definition basetoqt.h:238
QVariant toQVariant(const T &t)
Definition basetoqt.h:319
IVect2 toIVect2(const QPoint &p)
Convert a QPoint to an IVect2.
Definition basetoqt.h:263
UVect2 toUVect2(const QPoint &p)
Convert a QPoint to a UVect2.
Definition basetoqt.h:274
Variant toVariant(const QVariant &v)
Definition basetoqt.cpp:368
QString convertFilePath(const QString &filePath, const QDir &oldDir, const QDir &newDir)
Definition basetoqt.cpp:502
FVect2 toFVect2(const QPoint &p)
Convert a QPoint to an FVect2.
Definition basetoqt.h:258
bool setCurrentDirectory(const QString &dir)
Definition basetoqt.cpp:534
#define BASE_EXPORT
Definition basedef.h:24
QString getCurrentDirectory()
Definition basetoqt.cpp:539
constexpr D to(const T &t)
This template function serves as an alternative to static_cast<T>().
Definition to.h:28
PUSHWARNING void initializeQtToBase()
Definition basetoqt.cpp:11
QDir getCurrentDirectoryObject()
Definition basetoqt.cpp:544
POPWARNING QDataStream & operator<<(QDataStream &ds, const Orientation2 &o)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition basetoqt.cpp:107
QDataStream & operator>>(QDataStream &ds, Orientation2 &o)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition basetoqt.cpp:112
bool checkQVariantTypes(const QVariant &v1, const QVariant &v2)
returns true if Variants have the same type
Definition basetoqt.h:300
DVect2 toDVect2(const QPoint &p)
Convert a QPoint to a DVect2.
Definition basetoqt.h:248
constexpr Vector2< T > max(const Vector2< T > &v1, const Vector2< T > &v2)
Template specialization for max, min.
Definition vect.h:433