2013-11-15 13:41:26 +01:00
|
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
|
** @file vcontainer.h
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** @brief
|
|
|
|
|
** @copyright
|
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
|
** Copyright (C) 2013 Valentina project
|
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
** (at your option) any later version.
|
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
|
**
|
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
|
#ifndef VCONTAINER_H
|
|
|
|
|
#define VCONTAINER_H
|
|
|
|
|
|
2014-01-15 00:55:41 +01:00
|
|
|
|
#include "vstandardtablerow.h"
|
2013-07-17 13:38:11 +02:00
|
|
|
|
#include "vincrementtablerow.h"
|
2013-11-06 18:06:00 +01:00
|
|
|
|
#include "../geometry/varc.h"
|
|
|
|
|
#include "../geometry/vsplinepath.h"
|
|
|
|
|
#include "../geometry/vdetail.h"
|
|
|
|
|
#include "../widgets/vitem.h"
|
2013-12-29 17:48:57 +01:00
|
|
|
|
#include "../geometry/vgobject.h"
|
2013-12-30 12:28:33 +01:00
|
|
|
|
#include "../exception/vexceptionbadid.h"
|
2013-07-13 12:51:31 +02:00
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
/**
|
2013-10-07 17:34:14 +02:00
|
|
|
|
* @brief The VContainer class container of all variables.
|
2013-08-05 10:37:56 +02:00
|
|
|
|
*/
|
2013-11-04 21:35:15 +01:00
|
|
|
|
class VContainer
|
|
|
|
|
{
|
2013-09-23 14:08:06 +02:00
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(VContainer)
|
2013-07-13 12:51:31 +02:00
|
|
|
|
public:
|
2013-11-18 12:21:59 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief VContainer create empty container
|
|
|
|
|
*/
|
|
|
|
|
VContainer();
|
|
|
|
|
/**
|
|
|
|
|
* @brief operator = copy constructor
|
|
|
|
|
* @param data container
|
|
|
|
|
* @return copy container
|
|
|
|
|
*/
|
|
|
|
|
VContainer &operator=(const VContainer &data);
|
|
|
|
|
/**
|
|
|
|
|
* @brief VContainer create container from another container
|
|
|
|
|
* @param data container
|
|
|
|
|
*/
|
|
|
|
|
VContainer(const VContainer &data);
|
2013-12-30 19:59:33 +01:00
|
|
|
|
~VContainer();
|
2013-12-31 09:08:14 +01:00
|
|
|
|
template <typename T>
|
|
|
|
|
void CopyGObject(const VContainer &data, const qint64 &id)
|
|
|
|
|
{
|
|
|
|
|
T *obj = new T(*data.GeometricObject<const T *>(id));
|
2014-01-30 14:47:41 +01:00
|
|
|
|
Q_CHECK_PTR(obj);
|
2013-12-31 09:08:14 +01:00
|
|
|
|
UpdateGObject(id, obj);
|
|
|
|
|
}
|
2013-10-07 17:34:14 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief setData copy data from container
|
|
|
|
|
* @param data container
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
void setData(const VContainer &data);
|
2013-12-29 17:48:57 +01:00
|
|
|
|
template <typename T>
|
|
|
|
|
const T GeometricObject(qint64 id) const
|
|
|
|
|
{
|
2013-12-30 12:28:33 +01:00
|
|
|
|
VGObject *gObj = 0;
|
|
|
|
|
if (gObjects.contains(id))
|
|
|
|
|
{
|
|
|
|
|
gObj = gObjects.value(id);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw VExceptionBadId(tr("Can't find object"), id);
|
|
|
|
|
}
|
2013-12-30 20:33:30 +01:00
|
|
|
|
T obj = dynamic_cast<T>(gObj);
|
2014-01-30 14:47:41 +01:00
|
|
|
|
Q_CHECK_PTR(obj);
|
2013-12-29 17:48:57 +01:00
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
/**
|
2013-12-29 17:48:57 +01:00
|
|
|
|
* @brief GetGObject returns a point by id
|
2013-10-07 17:34:14 +02:00
|
|
|
|
* @param id id of point
|
|
|
|
|
* @return point
|
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
const VGObject *GetGObject(qint64 id) const;
|
2013-10-07 17:34:14 +02:00
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief GetStandardTableCell return standard table row by name
|
|
|
|
|
* @param name name of standard table row
|
|
|
|
|
* @return row of standard table
|
2013-08-05 10:37:56 +02:00
|
|
|
|
*/
|
2014-01-15 00:55:41 +01:00
|
|
|
|
const VStandardTableRow GetStandardTableCell(const QString& name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetIncrementTableRow return increment table row by name
|
|
|
|
|
* @param name name of increment table row
|
|
|
|
|
* @return row of increment table
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
const VIncrementTableRow GetIncrementTableRow(const QString& name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetLine return length of line by name
|
|
|
|
|
* @param name name of line
|
|
|
|
|
* @return length of line in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
qreal GetLine(const QString &name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetLengthArc return length of arc by name
|
|
|
|
|
* @param name name of arc
|
|
|
|
|
* @return length of arc in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
qreal GetLengthArc(const QString &name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetLengthSpline return length of spline by name
|
|
|
|
|
* @param name name of spline
|
|
|
|
|
* @return length of spline in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
qreal GetLengthSpline(const QString &name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetLineAngle return angle of line
|
|
|
|
|
* @param name name of line angle
|
|
|
|
|
* @return angle in degree
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
qreal GetLineAngle(const QString &name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetDetail return detail by id
|
|
|
|
|
* @param id id of detail
|
|
|
|
|
* @return detail
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
const VDetail GetDetail(qint64 id) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief getId return current id
|
|
|
|
|
* @return current id
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
static qint64 getId() {return _id;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddPoint add new point to container
|
|
|
|
|
* @param point new point
|
|
|
|
|
* @return return id of new point in container
|
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
qint64 AddGObject(VGObject *obj);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddDetail add new detail to container
|
|
|
|
|
* @param detail new detail
|
|
|
|
|
* @return return id of new detail in container
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
qint64 AddDetail(VDetail detail);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief AddStandardTableCell add new row of standard table
|
|
|
|
|
* @param name name of row of standard table
|
|
|
|
|
* @param cell row of standard table
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2014-01-15 00:55:41 +01:00
|
|
|
|
inline void AddStandardTableCell(const QString& name, const VStandardTableRow &cell)
|
|
|
|
|
{standardTable[name] = cell;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddIncrementTableRow add new row of increment table
|
|
|
|
|
* @param name name of new row of increment table
|
|
|
|
|
* @param row new row of increment table
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
void AddIncrementTableRow(const QString& name, VIncrementTableRow row);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddLengthLine add length of line to container
|
|
|
|
|
* @param name name of line
|
|
|
|
|
* @param value length of line
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
void AddLengthLine(const QString &name, const qreal &value);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddLengthSpline add length of spline to container
|
|
|
|
|
* @param name name of spline
|
|
|
|
|
* @param value length of spline
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
void AddLengthSpline(const QString &name, const qreal &value);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddLengthArc add length of arc to container
|
|
|
|
|
* @param id id of arc
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
void AddLengthArc(const qint64 &id);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddLineAngle add angle of line to container
|
|
|
|
|
* @param name name of line angle
|
|
|
|
|
* @param value angle in degree
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
void AddLineAngle(const QString &name, const qreal &value);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief AddLine add line to container
|
|
|
|
|
* @param firstPointId id of first point of line
|
|
|
|
|
* @param secondPointId id of second point of line
|
|
|
|
|
* @param mode mode of line
|
|
|
|
|
*/
|
2013-12-21 12:36:51 +01:00
|
|
|
|
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetNameLine return name of line
|
|
|
|
|
* @param firstPoint id of first point of line
|
|
|
|
|
* @param secondPoint id of second point of line
|
|
|
|
|
* @return name of line
|
|
|
|
|
*/
|
2014-01-27 16:48:11 +01:00
|
|
|
|
// cppcheck-suppress functionStatic
|
2013-12-21 12:36:51 +01:00
|
|
|
|
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetNameLineAngle return name of line angle
|
|
|
|
|
* @param firstPoint id of first point of line
|
|
|
|
|
* @param secondPoint id of second point of line
|
|
|
|
|
* @return name of angle of line
|
|
|
|
|
*/
|
2014-01-27 16:48:11 +01:00
|
|
|
|
// cppcheck-suppress functionStatic
|
2013-12-21 12:36:51 +01:00
|
|
|
|
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief UpdatePoint update point by id
|
|
|
|
|
* @param id id of existing point
|
|
|
|
|
* @param point point
|
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
void UpdateGObject(qint64 id, VGObject* obj);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief UpdateDetail update detail by id
|
|
|
|
|
* @param id id of existing detail
|
|
|
|
|
* @param detail detail
|
|
|
|
|
*/
|
2014-01-12 20:53:15 +01:00
|
|
|
|
void UpdateDetail(qint64 id, const VDetail &detail);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief UpdateStandardTableCell update standard table row by name
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @param name name of row
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @param cell row of standard table
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2014-01-15 00:55:41 +01:00
|
|
|
|
inline void UpdateStandardTableCell(const QString& name, VStandardTableRow cell)
|
|
|
|
|
{standardTable[name] = cell;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief UpdateIncrementTableRow update increment table row by name
|
|
|
|
|
* @param name name of row
|
|
|
|
|
* @param row row
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
inline void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row)
|
2013-11-18 17:37:17 +01:00
|
|
|
|
{incrementTable[name] = row;}
|
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief GetValueStandardTableCell return value of standard table row by name
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @param name name of row
|
|
|
|
|
* @return value in mm
|
|
|
|
|
*/
|
2014-01-15 00:55:41 +01:00
|
|
|
|
qreal GetValueStandardTableCell(const QString& name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief GetValueIncrementTableRow return value of increment table row by name
|
|
|
|
|
* @param name name of row
|
|
|
|
|
* @return value of row in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
qreal GetValueIncrementTableRow(const QString& name) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief Clear clear data in container. Id will be 0.
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
void Clear();
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClearObject points, splines, arcs, spline paths will be cleared.
|
|
|
|
|
*/
|
2014-01-02 16:50:01 +01:00
|
|
|
|
void ClearGObjects();
|
|
|
|
|
void ClearCalculationGObjects();
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClearIncrementTable clear increment table
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void ClearIncrementTable() {incrementTable.clear();}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClearLengthLines clear length lines
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void ClearLengthLines() {lengthLines.clear();}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClearLengthSplines clear length splines
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void ClearLengthSplines() {lengthSplines.clear();}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClearLengthArcs clear length arcs
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void ClearLengthArcs() {lengthArcs.clear();}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief ClearLineAngles clear angles of lines
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void ClearLineAngles() {lineAngles.clear();}
|
2014-01-13 01:48:31 +01:00
|
|
|
|
inline void ClearDetails() {details.clear();}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief SetSize set value of size
|
|
|
|
|
* @param size value of size in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void SetSize(qint32 size) {base["Сг"] = size;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief SetGrowth set value of growth
|
|
|
|
|
* @param growth value of growth in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void SetGrowth(qint32 growth) {base["Р"] = growth;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief size return size
|
|
|
|
|
* @return size in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline qint32 size() const {return base.value("Сг");}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief growth return growth
|
|
|
|
|
* @return growth in mm
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline qint32 growth() const {return base.value("Р");}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief FindVar return value of variable by name
|
|
|
|
|
* @param name name of variable
|
|
|
|
|
* @param ok false if can't find variable
|
|
|
|
|
* @return value of variable
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
qreal FindVar(const QString& name, bool *ok)const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief IncrementTableContains check if increment table contains name
|
|
|
|
|
* @param name name of row
|
|
|
|
|
* @return true if contains
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief getNextId generate next unique id
|
|
|
|
|
* @return next unique id
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
static qint64 getNextId();
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief RemoveIncrementTableRow remove row by name from increment table
|
|
|
|
|
* @param name name of existing row
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-12-29 17:48:57 +01:00
|
|
|
|
* @brief data container with datagObjects return container of gObjects
|
|
|
|
|
* @return pointer on container of gObjects
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
inline const QHash<qint64, VGObject*> *DataGObjects() const {return &gObjects;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataBase return container of data
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of base data
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
inline const QHash<QString, qint32> *DataBase() const {return &base;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief data container with dataStandardTable return container of standard table
|
|
|
|
|
* @return pointer on container of standard table
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2014-01-15 00:55:41 +01:00
|
|
|
|
inline const QHash<QString, VStandardTableRow> *DataStandardTable() const {return &standardTable;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataIncrementTable return container of increment table
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of increment table
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
inline const QHash<QString, VIncrementTableRow> *DataIncrementTable() const {return &incrementTable;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataLengthLines return container of lines lengths
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of lines lengths
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
inline const QHash<QString, qreal> *DataLengthLines() const {return &lengthLines;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataLengthSplines return container of splines lengths
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of splines lengths
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
inline const QHash<QString, qreal> *DataLengthSplines() const {return &lengthSplines;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataLengthArcs return container of arcs length
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of arcs length
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
inline const QHash<QString, qreal> *DataLengthArcs() const {return &lengthArcs;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataLineAngles return container of angles of line
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of angles of line
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
inline const QHash<QString, qreal> *DataLineAngles() const {return &lineAngles;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-11-19 21:56:49 +01:00
|
|
|
|
* @brief data container with dataDetails return container of details
|
2013-11-18 17:37:17 +01:00
|
|
|
|
* @return pointer on container of details
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
inline const QHash<qint64, VDetail> *DataDetails() const {return &details;}
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief UpdateId update id. If new id bigger when current save new like current.
|
|
|
|
|
* @param newId id
|
|
|
|
|
*/
|
2013-11-18 12:21:59 +01:00
|
|
|
|
static void UpdateId(qint64 newId);
|
2013-12-30 19:59:33 +01:00
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief CreateManTableIGroup generate man standard table of measurements
|
2013-12-30 19:59:33 +01:00
|
|
|
|
*/
|
|
|
|
|
void CreateManTableIGroup ();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
private:
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2014-01-07 11:46:23 +01:00
|
|
|
|
* @brief _id current id. New object will have value +1. For empty class equal 0.
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
static qint64 _id;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief base container of base data (size and growth)
|
|
|
|
|
*/
|
2013-10-04 13:32:42 +02:00
|
|
|
|
QHash<QString, qint32> base;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2013-12-29 17:48:57 +01:00
|
|
|
|
* @brief gObjects graphicals objects of pattern.
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2013-12-29 17:48:57 +01:00
|
|
|
|
QHash<qint64, VGObject*> gObjects;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
2014-01-15 00:55:41 +01:00
|
|
|
|
* @brief standardTable container of standard table rows
|
2013-11-18 17:37:17 +01:00
|
|
|
|
*/
|
2014-01-15 00:55:41 +01:00
|
|
|
|
QHash<QString, VStandardTableRow> standardTable;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief incrementTable
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
QHash<QString, VIncrementTableRow> incrementTable;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief lengthLines container of lines lengths
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
QHash<QString, qreal> lengthLines;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief lineAngles container of angles of lines
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
QHash<QString, qreal> lineAngles;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief lengthSplines container of splines length
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
QHash<QString, qreal> lengthSplines;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief lengthArcs container of arcs length
|
|
|
|
|
*/
|
2013-10-27 11:22:44 +01:00
|
|
|
|
QHash<QString, qreal> lengthArcs;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
/**
|
|
|
|
|
* @brief details container of details
|
|
|
|
|
*/
|
2013-12-30 19:59:33 +01:00
|
|
|
|
QHash<qint64, VDetail> details;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
template <typename key, typename val>
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetObject return object from container
|
|
|
|
|
* @param obj container
|
|
|
|
|
* @param id id of object
|
|
|
|
|
* @return Object
|
|
|
|
|
*/
|
2014-01-27 16:48:11 +01:00
|
|
|
|
// cppcheck-suppress functionStatic
|
2013-12-30 12:28:33 +01:00
|
|
|
|
const val GetObject(const QHash<key, val> &obj, key id) const;
|
2013-12-29 17:48:57 +01:00
|
|
|
|
template <typename key, typename val>
|
|
|
|
|
/**
|
|
|
|
|
* @brief GetObject return object from container
|
|
|
|
|
* @param obj container
|
|
|
|
|
* @param id id of object
|
|
|
|
|
* @return Object
|
|
|
|
|
*/
|
2014-01-27 16:48:11 +01:00
|
|
|
|
// cppcheck-suppress functionStatic
|
2013-12-29 17:48:57 +01:00
|
|
|
|
val GetVariable(const QHash<key, val> &obj, key id) const;
|
2013-11-18 17:37:17 +01:00
|
|
|
|
template <typename val>
|
|
|
|
|
/**
|
|
|
|
|
* @brief UpdateObject update object in container
|
|
|
|
|
* @param obj container
|
|
|
|
|
* @param id id of existing object
|
|
|
|
|
* @param point object
|
|
|
|
|
*/
|
2013-12-30 12:28:33 +01:00
|
|
|
|
void UpdateObject(QHash<qint64, val > &obj, const qint64 &id, val point);
|
2013-11-18 17:37:17 +01:00
|
|
|
|
template <typename key, typename val>
|
|
|
|
|
/**
|
|
|
|
|
* @brief AddObject add object to container
|
|
|
|
|
* @param obj container
|
|
|
|
|
* @param value object
|
|
|
|
|
* @return id of object in container
|
|
|
|
|
*/
|
2013-12-30 12:28:33 +01:00
|
|
|
|
static qint64 AddObject(QHash<key, val> &obj, val value);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // VCONTAINER_H
|