55 #include <qcompilerdetection.h>
56 #include <QCoreApplication>
59 #include <QMessageLogger>
61 #include <QSharedPointer>
62 #include <QSharedData>
63 #include <QSharedDataPointer>
65 #include <QStringList>
70 #include "../vmisc/def.h"
71 #include "../ifc/exception/vexceptionbadid.h"
72 #include "../ifc/ifcdef.h"
73 #include "../vgeometry/vabstractcubicbezierpath.h"
74 #include "../vgeometry/vabstractcurve.h"
75 #include "../vgeometry/vgobject.h"
76 #include "../vmisc/diagnostic.h"
86 QT_WARNING_DISABLE_GCC(
"-Weffc++")
87 QT_WARNING_DISABLE_INTEL(2021)
88 QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
100 patternUnit(patternUnit)
105 gObjects(data.gObjects),
106 variables(data.variables),
108 piecePaths(data.piecePaths),
110 patternUnit(data.patternUnit)
149 #ifdef Q_COMPILER_RVALUE_REFS
155 template <
typename T>
161 template <
typename T>
163 static quint32
getId();
165 static void UpdateId(quint32 newId);
170 void AddLine(
const quint32 &firstPointId,
const quint32 &secondPointId);
172 const quint32 &parentId =
NULL_ID);
177 template <
typename T>
179 template <
typename T>
203 static qreal *
rsize();
222 static bool IsUnique(
const QString &name);
237 QSharedDataPointer<VContainerData>
d;
244 template <
typename key,
typename val>
248 template <
typename T>
251 template <
typename key,
typename val>
254 template <
typename T>
265 template <
typename T>
275 if (
d->gObjects.contains(
id))
277 gObj =
d->gObjects.value(
id);
289 catch (
const std::bad_alloc &)
302 template <
typename T>
306 if (
d->variables.contains(name))
314 catch (
const std::bad_alloc &)
326 template <
typename T>
333 template <
typename T>
336 if (
d->variables.contains(name))
338 if (
d->variables.value(name)->GetType() == var->GetType())
354 d->variables.insert(name, var);
364 return qHash( p.data() );
395 template <
typename T>
398 Q_ASSERT_X(
id !=
NULL_ID, Q_FUNC_INFO,
"id == 0");
401 if (
d->gObjects.contains(
id))
412 d->gObjects.insert(
id, point);
QSharedPointer< QHash< quint32, VPiecePath > > piecePaths
QSharedPointer< QHash< quint32, VPiece > > pieces
VContainerData(const VContainerData &data)
VContainerData & operator=(const VContainerData &) Q_DECL_EQ_DELETE
VContainerData(const VTranslateVars *trVars, const Unit *patternUnit)
QHash< quint32, QSharedPointer< VGObject > > gObjects
gObjects graphicals objects of pattern.
QHash< QString, QSharedPointer< VInternalVariable > > variables
variables container for measurements, increments, lines lengths, lines angles, arcs lengths,...
const VTranslateVars * trVars
The VContainer class container of all variables.
const QMap< QString, QSharedPointer< VArcRadius > > arcRadiusesData() const
const QMap< QString, QSharedPointer< VLineAngle > > lineAnglesData() const
const QMap< QString, QSharedPointer< VCurveAngle > > curveAnglesData() const
void AddVariable(const QString &name, T *var)
static qreal height()
height return height
static void SetSize(qreal size)
SetSize set value of size.
static QSet< QString > uniqueNames
const VTranslateVars * GetTrVars() const
const QHash< quint32, VPiece > * DataPieces() const
static quint32 _id
_id current id. New object will have value +1. For empty class equal 0.
const QMap< QString, QSharedPointer< VCurveCLength > > controlPointLengthsData() const
void UpdateObject(const quint32 &id, const QSharedPointer< T > &point)
UpdateObject update object in container.
void AddArc(const QSharedPointer< VAbstractCurve > &arc, const quint32 &id, const quint32 &parentId=null_id)
VContainer & operator=(const VContainer &data)
operator = copy constructor
static void ClearUniqueNames()
void UpdatePiece(quint32 id, const VPiece &piece)
void RemovePiece(quint32 id)
void RemoveVariable(const QString &name)
static quint32 getNextId()
getNextId generate next unique id
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
AddLine add line to container.
static void UpdateId(quint32 newId)
UpdateId update id. If new id bigger when current save new like current.
VContainer(const VTranslateVars *trVars, const Unit *patternUnit)
VContainer create empty container.
void UpdatePiecePath(quint32 id, const VPiecePath &path)
void ClearCalculationGObjects()
static bool IsUnique(const QString &name)
void ClearVariables(const VarType &type=VarType::Unknown)
void Clear()
Clear clear data in container. Id will be 0.
void AddCurve(const QSharedPointer< VAbstractCurve > &curve, const quint32 &id, quint32 parentId=null_id)
void ClearGObjects()
ClearObject points, splines, arcs, spline paths will be cleared.
const QMap< QString, QSharedPointer< VCurveLength > > curveLengthsData() const
const QMap< QString, QSharedPointer< VLengthLine > > lineLengthsData() const
const QHash< QString, QSharedPointer< VInternalVariable > > * DataVariables() const
static qreal size()
size return size
static quint32 AddObject(QHash< key, val > &obj, val value)
AddObject add object to container.
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
quint32 AddPiece(const VPiece &piece)
const QSharedPointer< T > GeometricObject(const quint32 &id) const
const val GetObject(const QHash< key, val > &obj, key id) const
GetObject return object from container.
void AddSpline(const QSharedPointer< VAbstractBezier > &curve, quint32 id, quint32 parentId=null_id)
static QStringList AllUniqueNames()
const QMap< QString, QSharedPointer< VIncrement > > variablesData() const
VPiecePath GetPiecePath(quint32 id) const
const QHash< quint32, QSharedPointer< VGObject > > * DataGObjects() const
data container with datagObjects return container of gObjects
void AddCurveWithSegments(const QSharedPointer< VAbstractCubicBezierPath > &curve, const quint32 &id, quint32 parentId=null_id)
uint qHash(const QSharedPointer< T > &p)
QSharedPointer< T > GetVariable(QString name) const
GetVariable return varible by name.
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
QSharedDataPointer< VContainerData > d
const Unit * GetPatternUnit() const
static void SetHeight(qreal height)
SetGrowth set value of growth.
static const QSharedPointer< VGObject > GetFakeGObject(quint32 id)
void Swap(VContainer &data) Q_DECL_NOTHROW
quint32 AddPiecePath(const VPiecePath &path)
void removeCustomVariable(const QString &name)
removeCustomVariable remove increment by name from increment table
static void ClearUniqueIncrementNames()
const QMap< QString, QSharedPointer< VMeasurement > > DataMeasurements() const
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
const QMap< QString, QSharedPointer< T > > DataVar(const VarType &type) const
VPiece GetPiece(quint32 id) const
The VExceptionBadId class for exception bad id.
The VGObject class keep information graphical objects.
Q_DECLARE_TYPEINFO(VContainer, Q_MOVABLE_TYPE)