valentina_old/container/vcontainer.h

160 lines
8.4 KiB
C
Raw Normal View History

2013-07-13 12:51:31 +02:00
#ifndef VCONTAINER_H
#define VCONTAINER_H
#include <QMap>
2013-07-17 13:38:11 +02:00
#include <QTableWidget>
#include "options.h"
2013-07-13 12:51:31 +02:00
#include "vpointf.h"
2013-07-17 13:38:11 +02:00
#include "vstandarttablecell.h"
#include "vincrementtablerow.h"
#include "geometry/vspline.h"
#include "geometry/varc.h"
#include "geometry/vsplinepath.h"
#include "geometry/vdetail.h"
#include "widgets/vitem.h"
2013-07-13 12:51:31 +02:00
2013-08-05 10:37:56 +02:00
/**
* @brief The VContainer class
*/
2013-07-13 12:51:31 +02:00
class VContainer
{
public:
2013-08-05 10:37:56 +02:00
/**
* @brief VContainer
*/
2013-07-17 13:38:11 +02:00
VContainer();
VContainer &operator=(const VContainer &data);
2013-08-29 12:31:50 +02:00
VContainer(const VContainer &data);
2013-08-15 22:39:00 +02:00
void setData(const VContainer &data);
2013-08-05 10:37:56 +02:00
/**
* @brief GetPoint
* @param id
* @return
*/
2013-07-17 13:38:11 +02:00
VPointF GetPoint(qint64 id) const;
2013-08-28 10:55:11 +02:00
VPointF GetModelingPoint(qint64 id) const;
2013-07-17 13:38:11 +02:00
VStandartTableCell GetStandartTableCell(const QString& name) const;
VIncrementTableRow GetIncrementTableRow(const QString& name) const;
2013-07-25 14:00:51 +02:00
qreal GetLine(const QString &name) const;
2013-08-20 12:26:02 +02:00
qreal GetLineArc(const QString &name) const;
2013-08-05 10:37:56 +02:00
VSpline GetSpline(qint64 id) const;
2013-08-28 10:55:11 +02:00
VSpline GetModelingSpline(qint64 id) const;
2013-08-05 10:37:56 +02:00
VArc GetArc(qint64 id) const;
2013-08-28 10:55:11 +02:00
VArc GetModelingArc(qint64 id) const;
2013-08-09 08:49:34 +02:00
VSplinePath GetSplinePath(qint64 id) const;
2013-08-28 10:55:11 +02:00
VSplinePath GetModelingSplinePath(qint64 id) const;
VDetail GetDetail(qint64 id) const;
static qint64 getId();
2013-07-17 13:38:11 +02:00
qint64 AddPoint(const VPointF& point);
2013-08-28 10:55:11 +02:00
qint64 AddModelingPoint(const VPointF& point);
qint64 AddDetail(const VDetail& detail);
2013-07-17 13:38:11 +02:00
void AddStandartTableCell(const QString& name, const VStandartTableCell& cell);
void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell);
2013-08-05 10:37:56 +02:00
void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId,
Draw::Mode mode = Draw::Calculation);
2013-08-05 10:37:56 +02:00
void AddLengthSpline(const QString &name, const qreal &value);
2013-08-06 09:56:09 +02:00
void AddLengthArc(const qint64 &center, const qint64 &id);
2013-08-05 10:37:56 +02:00
void AddLengthArc(const QString &name, const qreal &value);
2013-08-21 10:03:53 +02:00
void AddLineAngle(const QString &name, const qreal &value);
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId,
Draw::Mode mode = Draw::Calculation);
2013-08-05 10:37:56 +02:00
qint64 AddSpline(const VSpline& spl);
2013-08-28 10:55:11 +02:00
qint64 AddModelingSpline(const VSpline& spl);
2013-08-09 08:49:34 +02:00
qint64 AddSplinePath(const VSplinePath& splPath);
2013-08-28 10:55:11 +02:00
qint64 AddModelingSplinePath(const VSplinePath& splPath);
2013-08-05 10:37:56 +02:00
qint64 AddArc(const VArc& arc);
2013-08-28 10:55:11 +02:00
qint64 AddModelingArc(const VArc& arc);
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode = Draw::Calculation) const;
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode = Draw::Calculation) const;
QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode = Draw::Calculation) const;
QString GetNameSplinePath(const VSplinePath &path,
Draw::Mode mode = Draw::Calculation) const;
QString GetNameArc(const qint64 &center, const qint64 &id,
Draw::Mode mode = Draw::Calculation) const;
2013-07-17 13:38:11 +02:00
void UpdatePoint(qint64 id, const VPointF& point);
2013-08-28 10:55:11 +02:00
void UpdateModelingPoint(qint64 id, const VPointF& point);
void UpdateDetail(qint64 id, const VDetail& detail);
2013-08-05 10:37:56 +02:00
void UpdateSpline(qint64 id, const VSpline& spl);
2013-08-28 10:55:11 +02:00
void UpdateModelingSpline(qint64 id, const VSpline& spl);
2013-08-09 08:49:34 +02:00
void UpdateSplinePath(qint64 id, const VSplinePath& splPath);
2013-08-28 10:55:11 +02:00
void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath);
2013-08-05 10:37:56 +02:00
void UpdateArc(qint64 id, const VArc& arc);
2013-08-28 10:55:11 +02:00
void UpdateModelingArc(qint64 id, const VArc& arc);
2013-07-17 13:38:11 +02:00
void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell);
void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell);
qreal GetValueStandartTableCell(const QString& name) const;
qreal GetValueIncrementTableRow(const QString& name) const;
void Clear();
2013-08-15 22:39:00 +02:00
void ClearObject();
2013-07-17 13:38:11 +02:00
void ClearIncrementTable();
2013-07-25 14:00:51 +02:00
void ClearLengthLines();
2013-08-05 10:37:56 +02:00
void ClearLengthSplines();
void ClearLengthArcs();
2013-08-21 10:03:53 +02:00
void ClearLineAngles();
2013-07-17 13:38:11 +02:00
void SetSize(qint32 size);
void SetGrowth(qint32 growth);
qint32 size() const;
qint32 growth() const;
qreal FindVar(const QString& name, bool *ok)const;
bool IncrementTableContains(const QString& name);
static qint64 getNextId();
2013-07-17 13:38:11 +02:00
void RemoveIncrementTableRow(const QString& name);
2013-07-25 14:00:51 +02:00
const QMap<qint64, VPointF> *DataPoints() const;
2013-08-28 10:55:11 +02:00
const QMap<qint64, VPointF> *DataModelingPoints() const;
2013-08-05 10:37:56 +02:00
const QMap<qint64, VSpline> *DataSplines() const;
2013-08-28 10:55:11 +02:00
const QMap<qint64, VSpline> *DataModelingSplines() const;
2013-08-05 10:37:56 +02:00
const QMap<qint64, VArc> *DataArcs() const;
2013-08-28 10:55:11 +02:00
const QMap<qint64, VArc> *DataModelingArcs() const;
2013-07-25 14:00:51 +02:00
const QMap<QString, qint32> *DataBase() const;
const QMap<QString, VStandartTableCell> *DataStandartTable() const;
const QMap<QString, VIncrementTableRow> *DataIncrementTable() const;
2013-08-05 10:37:56 +02:00
const QMap<QString, qreal> *DataLengthLines() const;
const QMap<QString, qreal> *DataLengthSplines() const;
const QMap<QString, qreal> *DataLengthArcs() const;
2013-08-21 10:03:53 +02:00
const QMap<QString, qreal> *DataLineAngles() const;
2013-08-09 08:49:34 +02:00
const QMap<qint64, VSplinePath> *DataSplinePaths() const;
2013-08-28 10:55:11 +02:00
const QMap<qint64, VSplinePath> *DataModelingSplinePaths() const;
const QMap<qint64, VDetail> *DataDetails() const;
static void UpdateId(qint64 newId);
void IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode = Draw::Calculation);
2013-08-29 12:31:50 +02:00
QPainterPath ContourPath(qint64 idDetail) const;
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
const qreal &width)const;
static QLineF ParallelLine(const QLineF &line, qreal width );
static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width);
QVector<QPointF> EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const;
QVector<QPointF> CheckLoops(const QVector<QPointF> &points) const;
2013-08-29 12:31:50 +02:00
void PrepareDetails(QVector<VItem*> & list)const;
2013-07-13 12:51:31 +02:00
private:
2013-08-15 22:39:00 +02:00
static qint64 _id;
2013-07-17 13:38:11 +02:00
QMap<QString, qint32> base;
2013-07-13 12:51:31 +02:00
QMap<qint64, VPointF> points;
2013-08-28 10:55:11 +02:00
QMap<qint64, VPointF> modelingPoints;
2013-07-17 13:38:11 +02:00
QMap<QString, VStandartTableCell> standartTable;
QMap<QString, VIncrementTableRow> incrementTable;
2013-07-25 14:00:51 +02:00
QMap<QString, qreal> lengthLines;
2013-08-21 10:03:53 +02:00
QMap<QString, qreal> lineAngles;
2013-08-05 10:37:56 +02:00
QMap<qint64, VSpline> splines;
2013-08-28 10:55:11 +02:00
QMap<qint64, VSpline> modelingSplines;
2013-08-05 10:37:56 +02:00
QMap<QString, qreal> lengthSplines;
QMap<qint64, VArc> arcs;
2013-08-28 10:55:11 +02:00
QMap<qint64, VArc> modelingArcs;
2013-08-05 10:37:56 +02:00
QMap<QString, qreal> lengthArcs;
2013-08-09 08:49:34 +02:00
QMap<qint64, VSplinePath> splinePaths;
2013-08-28 10:55:11 +02:00
QMap<qint64, VSplinePath> modelingSplinePaths;
QMap<qint64, VDetail> details;
template <typename key, typename val> static val GetObject(const QMap<key,val> &obj, key id);
template <typename val> static void UpdateObject(QMap<qint64, val> &obj, const qint64 &id,
const val& point);
template <typename key, typename val> static qint64 AddObject(QMap<key, val> &obj, const val& value);
void CreateManTableIGroup ();
QVector<QPointF> GetReversePoint(const QVector<QPointF> &points)const;
qreal GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)const;
2013-07-13 12:51:31 +02:00
};
#endif // VCONTAINER_H