Merge with feature

--HG--
branch : develop
This commit is contained in:
dismine 2013-11-20 14:53:02 +02:00
commit c4b2db6230
291 changed files with 8815 additions and 1282 deletions

View File

@ -19,9 +19,9 @@ CONFIG += c++11 precompile_header
#DEFINES += ...
# Precompiled headers (PCH)
PRECOMPILED_HEADER = stable.h
PRECOMPILED_HEADER = src/stable.h
win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp
PRECOMPILED_SOURCE = src/stable.cpp
}
# directory for executable file
@ -39,34 +39,34 @@ RCC_DIR = rcc
# files created uic
UI_DIR = uic
include(container/container.pri)
include(dialogs/dialogs.pri)
include(exception/exception.pri)
include(geometry/geometry.pri)
include(tools/tools.pri)
include(widgets/widgets.pri)
include(xml/xml.pri)
include(src/container/container.pri)
include(src/dialogs/dialogs.pri)
include(src/exception/exception.pri)
include(src/geometry/geometry.pri)
include(src/tools/tools.pri)
include(src/widgets/widgets.pri)
include(src/xml/xml.pri)
SOURCES += main.cpp\
mainwindow.cpp \
tablewindow.cpp \
stable.cpp
SOURCES += src/main.cpp \
src/mainwindow.cpp \
src/tablewindow.cpp \
src/stable.cpp
HEADERS += mainwindow.h \
options.h \
tablewindow.h \
stable.h \
version.h
HEADERS += src/mainwindow.h \
src/options.h \
src/tablewindow.h \
src/stable.h \
src/version.h
FORMS += mainwindow.ui \
tablewindow.ui
FORMS += src/mainwindow.ui \
src/tablewindow.ui
RESOURCES += \
icon.qrc \
cursor.qrc
share/resources/icon.qrc \
share/resources/cursor.qrc
TRANSLATIONS += translations/valentina_ru.ts \
translations/valentina_uk.ts
TRANSLATIONS += share/translations/valentina_ru.ts \
share/translations/valentina_uk.ts
CONFIG(debug, debug|release){
# Debug
@ -80,7 +80,7 @@ CONFIG(debug, debug|release){
-Og -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
-Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k\
-Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k \
-Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \
-Wmissing-include-dirs -Wpacked -Wredundant-decls \
-Wswitch-default -Wswitch-enum -Wuninitialized -Wunused-parameter -Wvariadic-macros \

View File

@ -1,174 +0,0 @@
/************************************************************************
**
** @file calculator.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include "vcontainer.h"
/**
* @brief The Calculator клас калькулятора формул лекал. Виконує розрахунок формул з підставлянням
* значеннь зміних.
*/
class Calculator
{
public:
/**
* @brief Calculator конструктор класу. Використовується при розрахунку лекала.
* @param data покажчик на контейнер змінних
*/
explicit Calculator(const VContainer *data):errorMsg(0), token(QString()), tok(0), token_type(0), prog(QString()),
index(0), data(data), debugFormula(QString()){}
/**
* @brief eval виконує розрахунок формули.
* @param prog рядко в якому зберігається формула.
* @return значення формули.
*/
qreal eval(QString prog, QString *errorMsg);
private:
Q_DISABLE_COPY(Calculator)
QString *errorMsg;
/**
* @brief token теперішня лексема.
*/
QString token;
/**
* @brief tok внутрішне представлення лексеми.
*/
qint32 tok;
/**
* @brief token_type тип лексеми.
*/
qint32 token_type;
/**
* @brief prog рядок в якому зберігається формула.
*/
QString prog; /* Содержит анализируемое выражение */
/**
* @brief index номер символу в рядку формули.
*/
qint32 index; /* Индекс символа в строке*/
/**
* @brief data контейнер усіх змінних.
*/
const VContainer *data;
/**
* @brief debugFormula рядок розшифрованої формули.
*/
QString debugFormula;
/**
* @brief get_exp виконує розрахунок формули.
* @return значення формули.
*/
qreal get_exp();
/**
* @brief get_token повертає наступну лексему.
*/
void get_token();/* Получить лексему */
/**
* @brief StrChr перевіряє чи символ належить рядку.
* @param string рядок
* @param c символ.
* @return true - належить рядку, false - не належить рядку.
*/
static bool StrChr(QString string, QChar c);
/**
* @brief putback повертає зчитану лексему назад у потік.
*/
void putback();
/**
* @brief level2 метод додавання і віднімання двух термів.
* @param result результат операції.
*/
void level2(qreal *result);
/**
* @brief level3 метод множення, ділення, знаходження процентів.
* @param result результат операції.
*/
void level3(qreal *result);
/**
* @brief level4 метод знаходження степені двох чисел.
* @param result результат операції.
*/
void level4(qreal *result);
/**
* @brief level5 метод знаходження унарного плюса чи мінуса.
* @param result результат операції.
*/
void level5(qreal *result);
/**
* @brief level6 метод обробки виразу в круглих лапках.
* @param result результат операції.
*/
void level6(qreal *result);
/**
* @brief primitive метод визначення значення зміної по її імені.
* @param result результат операції.
*/
void primitive(qreal *result);
/**
* @brief arith виконання специфікованої арифметики. Результат записується в перший елемент.
* @param o знак операції.
* @param r перший елемент.
* @param h другий елемент.
*/
static void arith(QChar o, qreal *r, qreal *h);
/**
* @brief unary метод зміни знаку.
* @param o символ знаку.
* @param r елемент.
*/
static void unary(QChar o, qreal *r);
/**
* @brief find_var метод знаходить змінну за іменем.
* @param s ім'я змінної.
* @return значення зміної.
*/
qreal find_var(QString s);
void serror(qint32 error);
/**
* @brief look_up пошук відповідного внутрішнього формату для теперішньої лексеми в таблиці лексем.
* @param s ім'я лексеми.
* @return внутрішній номер лексеми.
*/
static char look_up(QString s);
/**
* @brief isdelim повертає "істино", якщо с розділювач.
* @param c символ.
* @return розділювач, або ні.
*/
static bool isdelim(QChar c);
/**
* @brief iswhite перевіряє чи с пробіл чи табуляція.
* @param c символ.
* @return так або ні.
*/
static bool iswhite(QChar c);
};
#endif // CALCULATOR_H

View File

@ -1,13 +0,0 @@
SOURCES += \
container/vpointf.cpp \
container/vincrementtablerow.cpp \
container/vcontainer.cpp \
container/calculator.cpp \
container/vstandarttablecell.cpp
HEADERS += \
container/vstandarttablecell.h \
container/vpointf.h \
container/vincrementtablerow.h \
container/vcontainer.h \
container/calculator.h

View File

@ -1,179 +0,0 @@
/************************************************************************
**
** @file vcontainer.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef VCONTAINER_H
#define VCONTAINER_H
#include "vstandarttablecell.h"
#include "vincrementtablerow.h"
#include "../geometry/varc.h"
#include "../geometry/vsplinepath.h"
#include "../geometry/vdetail.h"
#include "../widgets/vitem.h"
/**
* @brief The VContainer class
*/
class VContainer
{
Q_DECLARE_TR_FUNCTIONS(VContainer)
public:
/**
* @brief VContainer
*/
VContainer();
VContainer &operator=(const VContainer &data);
VContainer(const VContainer &data);
void setData(const VContainer &data);
/**
* @brief GetPoint
* @param id
* @return
*/
VPointF GetPoint(qint64 id) const;
VPointF GetModelingPoint(qint64 id) const;
VStandartTableCell GetStandartTableCell(const QString& name) const;
VIncrementTableRow GetIncrementTableRow(const QString& name) const;
qreal GetLine(const QString &name) const;
qreal GetLengthArc(const QString &name) const;
qreal GetLengthSpline(const QString &name) const;
qreal GetLineAngle(const QString &name) const;
VSpline GetSpline(qint64 id) const;
VSpline GetModelingSpline(qint64 id) const;
VArc GetArc(qint64 id) const;
VArc GetModelingArc(qint64 id) const;
VSplinePath GetSplinePath(qint64 id) const;
VSplinePath GetModelingSplinePath(qint64 id) const;
VDetail GetDetail(qint64 id) const;
static qint64 getId() {return _id;}
qint64 AddPoint(const VPointF& point);
qint64 AddModelingPoint(const VPointF& point);
qint64 AddDetail(const VDetail& detail);
inline void AddStandartTableCell(const QString& name, const VStandartTableCell& cell)
{standartTable[name] = cell;}
inline void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell)
{incrementTable[name] = cell;}
void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const QString &name, const qreal &value);
void AddLengthArc(const qint64 &id);
void AddLengthArc(const QString &name, const qreal &value);
void AddLineAngle(const QString &name, const qreal &value);
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId,
const Draw::Draws &mode = Draw::Calculation);
qint64 AddSpline(const VSpline& spl);
qint64 AddModelingSpline(const VSpline& spl);
qint64 AddSplinePath(const VSplinePath& splPath);
qint64 AddModelingSplinePath(const VSplinePath& splPath);
qint64 AddArc(const VArc& arc);
qint64 AddModelingArc(const VArc& arc);
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint,
const Draw::Draws &mode = Draw::Calculation) const;
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint,
const Draw::Draws &mode = Draw::Calculation) const;
void UpdatePoint(qint64 id, const VPointF& point);
void UpdateModelingPoint(qint64 id, const VPointF& point);
void UpdateDetail(qint64 id, const VDetail& detail);
void UpdateSpline(qint64 id, const VSpline& spl);
void UpdateModelingSpline(qint64 id, const VSpline& spl);
void UpdateSplinePath(qint64 id, const VSplinePath& splPath);
void UpdateModelingSplinePath(qint64 id, const VSplinePath& splPath);
void UpdateArc(qint64 id, const VArc& arc);
void UpdateModelingArc(qint64 id, const VArc& arc);
inline void UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell)
{standartTable[name] = cell;}
inline void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell)
{incrementTable[name] = cell;}
qreal GetValueStandartTableCell(const QString& name) const;
qreal GetValueIncrementTableRow(const QString& name) const;
void Clear();
void ClearObject();
inline void ClearIncrementTable() {incrementTable.clear();}
inline void ClearLengthLines() {lengthLines.clear();}
inline void ClearLengthSplines() {lengthSplines.clear();}
inline void ClearLengthArcs() {lengthArcs.clear();}
inline void ClearLineAngles() {lineAngles.clear();}
inline void SetSize(qint32 size) {base["Сг"] = size;}
inline void SetGrowth(qint32 growth) {base["Р"] = growth;}
inline qint32 size() const {return base.value("Сг");}
inline qint32 growth() const {return base.value("Р");}
qreal FindVar(const QString& name, bool *ok)const;
inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);}
static qint64 getNextId();
inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);}
inline const QHash<qint64, VPointF> *DataPoints() const {return &points;}
inline const QHash<qint64, VPointF> *DataModelingPoints() const {return &modelingPoints;}
inline const QHash<qint64, VSpline> *DataSplines() const {return &splines;}
inline const QHash<qint64, VSpline> *DataModelingSplines() const {return &modelingSplines;}
inline const QHash<qint64, VArc> *DataArcs() const {return &arcs;}
inline const QHash<qint64, VArc> *DataModelingArcs() const {return &modelingArcs;}
inline const QHash<QString, qint32> *DataBase() const {return &base;}
inline const QHash<QString, VStandartTableCell> *DataStandartTable() const {return &standartTable;}
inline const QHash<QString, VIncrementTableRow> *DataIncrementTable() const {return &incrementTable;}
inline const QHash<QString, qreal> *DataLengthLines() const {return &lengthLines;}
inline const QHash<QString, qreal> *DataLengthSplines() const {return &lengthSplines;}
inline const QHash<QString, qreal> *DataLengthArcs() const {return &lengthArcs;}
inline const QHash<QString, qreal> *DataLineAngles() const {return &lineAngles;}
inline const QHash<qint64, VSplinePath> *DataSplinePaths() const {return &splinePaths;}
inline const QHash<qint64, VSplinePath> *DataModelingSplinePaths() const {return &modelingSplinePaths;}
inline const QHash<qint64, VDetail> *DataDetails() const {return &details;}
static void UpdateId(qint64 newId);
QPainterPath ContourPath(qint64 idDetail) const;
QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) 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;
void PrepareDetails(QVector<VItem *> & list) const;
private:
static qint64 _id;
QHash<QString, qint32> base;
QHash<qint64, VPointF> points;
QHash<qint64, VPointF> modelingPoints;
QHash<QString, VStandartTableCell> standartTable;
QHash<QString, VIncrementTableRow> incrementTable;
QHash<QString, qreal> lengthLines;
QHash<QString, qreal> lineAngles;
QHash<qint64, VSpline> splines;
QHash<qint64, VSpline> modelingSplines;
QHash<QString, qreal> lengthSplines;
QHash<qint64, VArc> arcs;
QHash<qint64, VArc> modelingArcs;
QHash<QString, qreal> lengthArcs;
QHash<qint64, VSplinePath> splinePaths;
QHash<qint64, VSplinePath> modelingSplinePaths;
QHash<qint64, VDetail> details;
void CreateManTableIGroup ();
QVector<QPointF> GetReversePoint(const QVector<QPointF> &points)const;
qreal GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)const;
template <typename key, typename val> static val GetObject(const QHash<key, val> &obj, key id);
template <typename val> static void UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point);
template <typename key, typename val> static qint64 AddObject(QHash<key, val> &obj, const val& value);
};
#endif // VCONTAINER_H

View File

@ -1,85 +0,0 @@
/************************************************************************
**
** @file dialogarc.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef DIALOGARC_H
#define DIALOGARC_H
#include "dialogtool.h"
namespace Ui
{
class DialogArc;
}
class DialogArc : public DialogTool
{
Q_OBJECT
public:
DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogArc();
inline qint64 GetCenter() const {return center;}
void SetCenter(const qint64 &value);
inline QString GetRadius() const {return radius;}
void SetRadius(const QString &value);
inline QString GetF1() const {return f1;}
void SetF1(const QString &value);
inline QString GetF2() const {return f2;}
void SetF2(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
virtual void DialogAccepted();
virtual void ValChenged(int row);
void PutRadius();
void PutF1();
void PutF2();
void LineAngles();
void RadiusChanged();
void F1Changed();
void F2Changed();
protected:
virtual void CheckState();
private:
Q_DISABLE_COPY(DialogArc)
Ui::DialogArc *ui;
bool flagRadius;
bool flagF1;
bool flagF2;
QTimer *timerRadius;
QTimer *timerF1;
QTimer *timerF2;
qint64 center;
QString radius;
QString f1;
QString f2;
void EvalRadius();
void EvalF1();
void EvalF2();
void ShowLineAngles();
};
#endif // DIALOGARC_H

View File

@ -1,62 +0,0 @@
HEADERS += \
dialogs/dialogtriangle.h \
dialogs/dialogtool.h \
dialogs/dialogsplinepath.h \
dialogs/dialogspline.h \
dialogs/dialogsinglepoint.h \
dialogs/dialogshoulderpoint.h \
dialogs/dialogs.h \
dialogs/dialogpointofintersection.h \
dialogs/dialogpointofcontact.h \
dialogs/dialognormal.h \
dialogs/dialoglineintersect.h \
dialogs/dialogline.h \
dialogs/dialogincrements.h \
dialogs/dialoghistory.h \
dialogs/dialogheight.h \
dialogs/dialogendline.h \
dialogs/dialogdetail.h \
dialogs/dialogbisector.h \
dialogs/dialogarc.h \
dialogs/dialogalongline.h
SOURCES += \
dialogs/dialogtriangle.cpp \
dialogs/dialogtool.cpp \
dialogs/dialogsplinepath.cpp \
dialogs/dialogspline.cpp \
dialogs/dialogsinglepoint.cpp \
dialogs/dialogshoulderpoint.cpp \
dialogs/dialogpointofintersection.cpp \
dialogs/dialogpointofcontact.cpp \
dialogs/dialognormal.cpp \
dialogs/dialoglineintersect.cpp \
dialogs/dialogline.cpp \
dialogs/dialogincrements.cpp \
dialogs/dialoghistory.cpp \
dialogs/dialogheight.cpp \
dialogs/dialogendline.cpp \
dialogs/dialogdetail.cpp \
dialogs/dialogbisector.cpp \
dialogs/dialogarc.cpp \
dialogs/dialogalongline.cpp
FORMS += \
dialogs/dialogtriangle.ui \
dialogs/dialogsplinepath.ui \
dialogs/dialogspline.ui \
dialogs/dialogsinglepoint.ui \
dialogs/dialogshoulderpoint.ui \
dialogs/dialogpointofintersection.ui \
dialogs/dialogpointofcontact.ui \
dialogs/dialognormal.ui \
dialogs/dialoglineintersect.ui \
dialogs/dialogline.ui \
dialogs/dialogincrements.ui \
dialogs/dialoghistory.ui \
dialogs/dialogheight.ui \
dialogs/dialogendline.ui \
dialogs/dialogdetail.ui \
dialogs/dialogbisector.ui \
dialogs/dialogarc.ui \
dialogs/dialogalongline.ui

View File

@ -1,75 +0,0 @@
/************************************************************************
**
** @file dialogspline.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef DIALOGSPLINE_H
#define DIALOGSPLINE_H
#include "dialogtool.h"
namespace Ui
{
class DialogSpline;
}
class DialogSpline : public DialogTool
{
Q_OBJECT
public:
DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogSpline();
inline qint64 getP1() const {return p1;}
void setP1(const qint64 &value);
inline qint64 getP4() const {return p4;}
void setP4(const qint64 &value);
inline qreal getAngle1() const {return angle1;}
void setAngle1(const qreal &value);
inline qreal getAngle2() const {return angle2;}
void setAngle2(const qreal &value);
inline qreal getKAsm1() const {return kAsm1;}
void setKAsm1(const qreal &value);
inline qreal getKAsm2() const {return kAsm2;}
void setKAsm2(const qreal &value);
inline qreal getKCurve() const {return kCurve;}
void setKCurve(const qreal &value);
public slots:
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogSpline)
Ui::DialogSpline *ui;
qint32 number;
qint64 p1; // перша точка
qint64 p4; // четверта точка
qreal angle1; // кут нахилу дотичної в першій точці
qreal angle2; // кут нахилу дотичної в другій точці
qreal kAsm1;
qreal kAsm2;
qreal kCurve;
};
#endif // DIALOGSPLINE_H

View File

@ -1,112 +0,0 @@
/************************************************************************
**
** @file dialogtool.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef DIALOGTOOL_H
#define DIALOGTOOL_H
#include <QDialog>
#include "../container/vcontainer.h"
class DialogTool : public QDialog
{
Q_OBJECT
public:
DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
virtual ~DialogTool() {}
inline qint64 getIdDetail() const {return idDetail;}
inline void setIdDetail(const qint64 &value) {idDetail = value;}
signals:
void DialogClosed(int result);
void ToolTip(const QString &toolTip);
public slots:
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
void NamePointChanged();
virtual void DialogAccepted();
virtual void DialogRejected();
void FormulaChanged();
void ArrowUp();
void ArrowDown();
void ArrowLeft();
void ArrowRight();
void ArrowLeftUp();
void ArrowLeftDown();
void ArrowRightUp();
void ArrowRightDown();
void EvalFormula();
void SizeGrowth();
void StandartTable();
void LengthLines();
void LengthArcs();
void LengthCurves();
void Increments();
void PutHere();
void PutVal(QListWidgetItem * item);
virtual void ValChenged(int row);
void UpdateList();
protected:
Q_DISABLE_COPY(DialogTool)
const VContainer *data;
bool isInitialized;
bool flagName;
bool flagFormula;
QTimer *timerFormula;
QPushButton *bOk;
QDoubleSpinBox *spinBoxAngle;
QLineEdit *lineEditFormula;
QListWidget *listWidget;
QLabel *labelResultCalculation;
QLabel *labelDescription;
QLabel *labelEditNamePoint;
QLabel *labelEditFormula;
QRadioButton *radioButtonSizeGrowth;
QRadioButton *radioButtonStandartTable;
QRadioButton *radioButtonIncrements;
QRadioButton *radioButtonLengthLine;
QRadioButton *radioButtonLengthArc;
QRadioButton *radioButtonLengthCurve;
qint64 idDetail;
Draw::Draws mode;
bool CheckObject(const qint64 &id);
virtual void closeEvent ( QCloseEvent * event );
virtual void showEvent( QShowEvent *event );
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
void FillComboBoxTypeLine(QComboBox *box) const;
virtual void CheckState();
QString GetTypeLine(const QComboBox *box)const;
template <class key, class val> void ShowVariable(const QHash<key, val> *var);
void SetupTypeLine(QComboBox *box, const QString &value);
void ChangeCurrentText(QComboBox *box, const QString &value);
void ChangeCurrentData(QComboBox *box, const qint64 &value) const;
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label);
void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const;
qint64 getCurrentPointId(QComboBox *box) const;
};
#endif // DIALOGTOOL_H

View File

@ -1,8 +1,10 @@
# Doxyfile 1.8.1.2
# Doxyfile 1.8.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed
# in front of the TAG it is preceding .
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
@ -70,11 +72,11 @@ CREATE_SUBDIRS = NO
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian,
# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic,
# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = Ukrainian
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
@ -126,7 +128,9 @@ FULL_PATH_NAMES = YES
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
# path to strip. Note that you specify absolute paths here, but also
# relative paths, which will be relative from the directory where doxygen is
# started.
STRIP_FROM_PATH =
@ -229,14 +233,15 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this
# tag. The format is ext=language, where ext is a file extension, and language
# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension,
# and language is one of the parsers supported by doxygen: IDL, Java,
# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
# C++. For instance to make doxygen treat .inc files as Fortran files (default
# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
# that for custom extensions you also need to set FILE_PATTERNS otherwise the
# files are not read by doxygen.
EXTENSION_MAPPING =
@ -249,6 +254,13 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by by putting a % sign in front of the word
# or globally by setting AUTOLINK_SUPPORT to NO.
AUTOLINK_SUPPORT = YES
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
@ -269,10 +281,10 @@ CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# For Microsoft's IDL there are propget and propput attributes to indicate
# getter and setter methods for a property. Setting this option to YES (the
# default) will make doxygen replace the get and set methods by a property in
# the documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
@ -301,11 +313,11 @@ SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
# unions with only public data fields will be shown inline in the documentation
# of the scope in which they are defined (i.e. file, namespace, or group
# documentation), provided this scope is documented. If set to NO (the default),
# structs, classes, and unions are shown on a separate page (for HTML and Man
# pages) or section (for LaTeX and RTF).
# unions with only public data fields or simple typedef fields will be shown
# inline in the documentation of the scope in which they are defined (i.e. file,
# namespace, or group documentation), provided this scope is documented. If set
# to NO (the default), structs, classes, and unions are shown on a separate
# page (for HTML and Man pages) or section (for LaTeX and RTF).
INLINE_SIMPLE_STRUCTS = NO
@ -319,30 +331,14 @@ INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
# causing a significant performance penalty.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will roughly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
SYMBOL_CACHE_SIZE = 0
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
# their name and scope. Since this can be an expensive process and often the
# same symbol appear multiple times in the code, doxygen keeps a cache of
# pre-resolved symbols. If the cache is too small doxygen will become slower.
# If the cache is too large, memory is wasted. The cache size is given by this
# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
# cache is used to resolve symbols given their name and scope. Since this can
# be an expensive process and often the same symbol appear multiple times in
# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too
# small doxygen will become slower. If the cache is too large, memory is wasted.
# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid
# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536
# symbols.
LOOKUP_CACHE_SIZE = 0
@ -353,7 +349,7 @@ LOOKUP_CACHE_SIZE = 0
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
@ -362,14 +358,15 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
EXTRACT_PACKAGE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
@ -533,7 +530,8 @@ GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
# documentation sections, marked by \if section-label ... \endif
# and \cond section-label ... \endcond blocks.
ENABLED_SECTIONS =
@ -591,7 +589,8 @@ LAYOUT_FILE =
# requires the bibtex tool to be installed. See also
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
# feature you need bibtex and perl available in the search path.
# feature you need bibtex and perl available in the search path. Do not use
# file names with spaces, bibtex cannot handle them.
CITE_BIB_FILES =
@ -743,8 +742,10 @@ IMAGE_PATH =
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
# If FILTER_PATTERNS is specified, this tag will be
# ignored.
# If FILTER_PATTERNS is specified, this tag will be ignored.
# Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
INPUT_FILTER =
@ -773,6 +774,13 @@ FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want reuse the introduction page also for the doxygen output.
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
@ -894,17 +902,27 @@ HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# style sheet in the HTML output directory as well, or it will be erased!
# fine-tune the look of the HTML output. If left blank doxygen will
# generate a default style sheet. Note that it is recommended to use
# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
# tag will in the future become obsolete.
HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
# user-defined cascading style sheet that is included after the standard
# style sheets created by doxygen. Using this option one can overrule
# certain style aspects. This is preferred over using HTML_STYLESHEET
# since it does not replace the standard style sheet and is therefor more
# robust against future updates. Doxygen will copy the style sheet file to
# the output directory.
HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
# that these files will be copied to the base HTML output directory. Use the
# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
# files. In the HTML_STYLESHEET file, use the file name only. Also note that
# the files will be copied as-is; there are no commands or markers available.
@ -985,9 +1003,9 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
# identify the documentation publisher. This should be a reverse domain-name
# style string, e.g. com.mycompany.MyDocSet.documentation.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
@ -1172,6 +1190,13 @@ FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
# SVG. The default value is HTML-CSS, which is slower, but has the best
# compatibility.
MATHJAX_FORMAT = HTML-CSS
# When MathJax is enabled you need to specify the location relative to the
# HTML output directory using the MATHJAX_RELPATH option. The destination
# directory should contain the MathJax.js script. For instance, if the mathjax
@ -1189,6 +1214,11 @@ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript
# pieces of code that will be used on startup of the MathJax code.
MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
@ -1200,15 +1230,55 @@ MATHJAX_EXTENSIONS =
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
# using Javascript. Doxygen will generate the search PHP script and index
# file to put on the web server. The advantage of the server
# based approach is that it scales better to large projects and allows
# full text search. The disadvantages are that it is more difficult to setup
# and does not have live searching capabilities.
# implemented using a web server instead of a web client using Javascript.
# There are two flavours of web server based search depending on the
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
# searching and an index file used by the script. When EXTERNAL_SEARCH is
# enabled the indexing and searching needs to be provided by external tools.
# See the manual for details.
SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
# which needs to be processed by an external indexer. Doxygen will invoke an
# external search engine pointed to by the SEARCHENGINE_URL option to obtain
# the search results. Doxygen ships with an example indexer (doxyindexer) and
# search engine (doxysearch.cgi) which are based on the open source search
# engine library Xapian. See the manual for configuration details.
EXTERNAL_SEARCH = NO
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
# which will returned the search results when EXTERNAL_SEARCH is enabled.
# Doxygen ships with an example search engine (doxysearch) which is based on
# the open source search engine library Xapian. See the manual for configuration
# details.
SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
# SEARCHDATA_FILE tag the name of this file can be specified.
SEARCHDATA_FILE = searchdata.xml
# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
# projects and redirect the results back to the right project.
EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
# all added to the same external search index. Each project needs to have a
# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
# of to a relative location where the documentation can be found.
# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
@ -1246,7 +1316,7 @@ COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, letter, legal and
# executive. If left blank a4wide will be used.
# executive. If left blank a4 will be used.
PAPER_TYPE = a4
@ -1269,6 +1339,13 @@ LATEX_HEADER =
LATEX_FOOTER =
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images
# or other source files which should be copied to the LaTeX output directory.
# Note that the files will be copied as-is; there are no commands or markers
# available.
LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
@ -1413,6 +1490,21 @@ XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files
# that can be used to generate PDF.
GENERATE_DOCBOOK = NO
# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
# front of it. If left blank docbook will be used as the default path.
DOCBOOK_OUTPUT = docbook
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@ -1562,6 +1654,12 @@ ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed
# in the related pages index. If set to NO, only the current project's
# pages will be listed.
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
@ -1658,7 +1756,7 @@ UML_LOOK = YES
# the class node. If there are many fields or methods and many nodes the
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
# threshold limits the number of items for each type to make the size more
# managable. Set this to 0 for no limit. Note that the threshold may be
# manageable. Set this to 0 for no limit. Note that the threshold may be
# exceeded by 50% before the limit is enforced.
UML_LIMIT_NUM_FIELDS = 10

View File

@ -1,17 +0,0 @@
HEADERS += \
exception/vexceptionwrongparameterid.h \
exception/vexceptionuniqueid.h \
exception/vexceptionobjecterror.h \
exception/vexceptionemptyparameter.h \
exception/vexceptionconversionerror.h \
exception/vexceptionbadid.h \
exception/vexception.h
SOURCES += \
exception/vexceptionwrongparameterid.cpp \
exception/vexceptionuniqueid.cpp \
exception/vexceptionobjecterror.cpp \
exception/vexceptionemptyparameter.cpp \
exception/vexceptionconversionerror.cpp \
exception/vexceptionbadid.cpp \
exception/vexception.cpp

View File

@ -1,15 +0,0 @@
HEADERS += \
geometry/vsplinepoint.h \
geometry/vsplinepath.h \
geometry/vspline.h \
geometry/vnodedetail.h \
geometry/vdetail.h \
geometry/varc.h
SOURCES += \
geometry/vsplinepoint.cpp \
geometry/vsplinepath.cpp \
geometry/vspline.cpp \
geometry/vnodedetail.cpp \
geometry/vdetail.cpp \
geometry/varc.cpp

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 454 B

View File

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 716 B

View File

Before

Width:  |  Height:  |  Size: 649 B

After

Width:  |  Height:  |  Size: 649 B

View File

Before

Width:  |  Height:  |  Size: 893 B

After

Width:  |  Height:  |  Size: 893 B

View File

Before

Width:  |  Height:  |  Size: 808 B

After

Width:  |  Height:  |  Size: 808 B

View File

Before

Width:  |  Height:  |  Size: 736 B

After

Width:  |  Height:  |  Size: 736 B

View File

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 925 B

View File

Before

Width:  |  Height:  |  Size: 864 B

After

Width:  |  Height:  |  Size: 864 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 689 B

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

View File

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 977 B

After

Width:  |  Height:  |  Size: 977 B

View File

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 652 B

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 676 B

View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

View File

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 375 B

View File

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -27,6 +27,7 @@
*************************************************************************/
#include "calculator.h"
#include <QDebug>
#define DELIMITER 1
#define VARIABLE 2
@ -43,12 +44,12 @@ qreal Calculator::eval(QString prog, QString *errorMsg)
this->errorMsg->clear();
debugFormula.clear();
this->prog = prog;
//qDebug()<<"Формула: "<<prog;
//qDebug()<<"Formula: "<<prog;
index = 0;
qreal result = get_exp();
QString str = QString(" = %1").arg(result, 0, 'f', 3);
debugFormula.append(str);
//qDebug()<<"Результат:"<<debugFormula;
//qDebug()<<"Result:"<<debugFormula;
return result;
}
@ -62,12 +63,11 @@ qreal Calculator::get_exp()
return 0;
}
level2(&result);
putback(); /* возвращает последнюю считаную
лексему обратно во входной поток */
putback();
return result;
}
/* Сложение или вычитание двух термов */
void Calculator::level2(qreal *result)
{
QChar op;
@ -82,7 +82,6 @@ void Calculator::level2(qreal *result)
}
}
/* Вычисление произведения или частного двух фвкторов */
void Calculator::level3(qreal *result)
{
QChar op;
@ -98,7 +97,6 @@ void Calculator::level3(qreal *result)
}
}
/* Обработка степени числа (целочисленной) */
void Calculator::level4(qreal *result)
{
qreal hold;
@ -112,7 +110,6 @@ void Calculator::level4(qreal *result)
}
}
/* Унарный + или - */
void Calculator::level5(qreal *result)
{
QChar op;
@ -130,7 +127,6 @@ void Calculator::level5(qreal *result)
}
}
/* Обработка выражения в круглых скобках */
void Calculator::level6(qreal *result)
{
if ((token[0] == '(') && (token_type == DELIMITER))
@ -146,7 +142,6 @@ void Calculator::level6(qreal *result)
primitive(result);
}
/* Определение значения переменной по ее имени */
void Calculator::primitive(qreal *result)
{
QString str;
@ -169,7 +164,6 @@ void Calculator::primitive(qreal *result)
}
}
/* Выполнение специфицированной арифметики */
void Calculator::arith(QChar o, qreal *r, qreal *h)
{
qreal t;//, ex;
@ -194,20 +188,12 @@ void Calculator::arith(QChar o, qreal *r, qreal *h)
break;
case '^':
*r = pow(*r, *h);
// ex =*r;
// if(*h==0) {
// *r = 1;
// break;
// }
// for(t=*h-1; t>0; --t)
// *r = (*r) * ex;
break;
default:
break;
}
}
/* Изменение знака */
void Calculator::unary(QChar o, qreal *r)
{
if (o=='-')
@ -216,7 +202,6 @@ void Calculator::unary(QChar o, qreal *r)
}
}
/* Поиск значения переменной */
qreal Calculator::find_var(QString s)
{
bool ok = false;
@ -224,13 +209,12 @@ qreal Calculator::find_var(QString s)
if (ok == false)
{
qDebug()<<s;
serror(4); /* не переменная */
serror(4); /* don't variable */
return 0;
}
return value;
}
/* выдать сообщение об ошибке */
void Calculator::serror(qint32 error)
{
QString e[]=
@ -246,29 +230,16 @@ void Calculator::serror(qint32 error)
qDebug()<<e[error];
}
/* Поиск соответствия внутреннего формата для
текущей лексемы в таблице лексем.
*/
char Calculator::look_up(QString s)
{
QString p;
/* преобразование к нижнему регистру */
p = s;
p = p.toLower();
/* просматривается, если лексема обнаружена в
таблице */
/*
*у нас більше немає команд що потрібно опрацьовувати
*/
// if(commands.contains(p)){
// return commands[p];
// }
return 0; /* нераспознанная команда */
return 0;
}
/* Возвращает "истину", если "c" разделитель */
bool Calculator::isdelim(QChar c)
{
if (StrChr(" ;,+-<>/*%^=()", c) || c=='\n' || c=='\r' || c=='\0')
@ -278,7 +249,6 @@ bool Calculator::isdelim(QChar c)
return false;
}
/* Возвращает 1, если "с" пробел или табуляция */
bool Calculator::iswhite(QChar c)
{
if (c==' ' || c=='\t')
@ -300,7 +270,7 @@ void Calculator::get_token()
temp=&token;
if (prog[index]=='\0')
{ /* Конец файла */
{ /* end of file */
token="\0";
tok=FINISHED;
token_type=DELIMITER;
@ -309,7 +279,7 @@ void Calculator::get_token()
while (iswhite(prog[index]))
{
++index; /* пропуск пробелов */
++index; /* skip spaces */
}
if (prog[index]=='\r')
@ -322,16 +292,16 @@ void Calculator::get_token()
}
if (StrChr("+-*^/%=;(),><", prog[index]))
{ /* разделитель */
{ /* delimiter */
*temp=prog[index];
index++; /* переход на следующую позицию */
index++; /* jump to the next position */
temp->append("\0");
token_type=DELIMITER;
debugFormula.append(token);
return;
}
if (prog[index]=='"')
{ /* строка в кавычках */
{ /* quoted string */
index++;
while (prog[index] != '"' && prog[index] != '\r')
{
@ -347,7 +317,7 @@ void Calculator::get_token()
return;
}
if (prog[index].isDigit())
{ /* число */
{ /* number */
while (isdelim(prog[index]) == false)
{
temp->append(prog[index]);
@ -359,7 +329,7 @@ void Calculator::get_token()
}
if (prog[index].isPrint())
{ /* переменная или команда */
{ /* variable or command */
while (isdelim(prog[index]) == false)
{
temp->append(prog[index]);
@ -369,18 +339,17 @@ void Calculator::get_token()
}
temp->append("\0");
/* Просматривается, если строка есть команда или переменная */
/* Seen if there is a command line or a variable */
if (token_type==STRING)
{
tok=look_up(token); /* преобразование во внутренний
формат */
tok=look_up(token);
if (tok == false)
{
token_type = VARIABLE;
}
else
{
token_type = COMMAND; /* это команда */
token_type = COMMAND; /* It is command */
}
}
return;
@ -391,7 +360,6 @@ bool Calculator::StrChr(QString string, QChar c)
return string.contains(c, Qt::CaseInsensitive);
}
/* Возвращает лексему обратно во входной поток */
void Calculator::putback()
{
QString t;

187
src/container/calculator.h Normal file
View File

@ -0,0 +1,187 @@
/************************************************************************
**
** @file calculator.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include "vcontainer.h"
/**
* @brief The Calculator class calculate formulas of pattern. Support operation +,-,/,* and braces.
* Can replace name of variables her value.
*/
class Calculator
{
public:
/**
* @brief Calculator class constructor.
* @param data pointer to a variable container.
*/
explicit Calculator(const VContainer *data):errorMsg(0), token(QString()), tok(0), token_type(0), prog(QString()),
index(0), data(data), debugFormula(QString()){}
/**
* @brief eval calculate formula.
* @param prog string of formula.
* @param errorMsg keep error message.
* @return value of formula.
*/
qreal eval(QString prog, QString *errorMsg);
private:
Q_DISABLE_COPY(Calculator)
/**
* @brief errorMsg keeps error message of calculation.
*/
QString *errorMsg;
/**
* @brief token теперішня лексема.
*/
QString token;
/**
* @brief tok internal representation of token.
*/
qint32 tok;
/**
* @brief token_type type of token.
*/
qint32 token_type;
/**
* @brief prog string where keeps formula.
*/
QString prog;
/**
* @brief index number character in string of formula.
*/
qint32 index;
/**
* @brief data container with data container of all variables.
*/
const VContainer *data;
/**
* @brief debugFormula decoded string of formula.
*/
QString debugFormula;
/**
* @brief get_exp calculate formula.
* @return value of formula.
*/
qreal get_exp();
/**
* @brief get_token return next token.
*/
void get_token();
/**
* @brief StrChr checks whether the character belongs to the line.
* @param string string with formula
* @param c character.
* @return true - belongs to the line, false - don't belongs to the line.
*/
static bool StrChr(QString string, QChar c);
/**
* @brief putback returns the readout token back into the flow.
*/
void putback();
/**
* @brief level2 method of addition and subtraction of two terms.
* @param result result of operation.
*/
void level2(qreal *result);
/**
* @brief level3 method of multiplication, division, finding percent.
* @param result result of operation.
*/
void level3(qreal *result);
/**
* @brief level4 method of degree two numbers.
* @param result result of operation.
*/
void level4(qreal *result);
/**
* @brief level5 method for finding unary plus or minus.
* @param result result of operation.
*/
void level5(qreal *result);
/**
* @brief level6 processing method of the expression in brackets.
* @param result result of operation.
*/
void level6(qreal *result);
/**
* @brief primitive method of determining the value of a variable by its name.
* @param result result of operation.
*/
void primitive(qreal *result);
/**
* @brief arith perform the specified arithmetic. The result is written to the first element.
* @param o sign of operation.
* @param r first element.
* @param h second element.
*/
static void arith(QChar o, qreal *r, qreal *h);
/**
* @brief unary method changes the sign.
* @param o sign of symbol.
* @param r element.
*/
static void unary(QChar o, qreal *r);
/**
* @brief find_var method is finding variable by name.
* @param s name of variable.
* @return value of variable.
*/
qreal find_var(QString s);
/**
* @brief serror report an error
* @param error error code
*/
void serror(qint32 error);
/**
* @brief look_up finding the internal format for the current token in the token table.
* @param s name of token.
* @return internal number of token.
*/
static char look_up(QString s);
/**
* @brief isdelim return true if c delimiter.
* @param c character.
* @return true - delimiter, false - do not delimiter.
*/
static bool isdelim(QChar c);
/**
* @brief isdelim return true if c delimiter.
* @param c character.
* @return true - delimiter, false - do not delimiter.
*/
static bool iswhite(QChar c);
/**
* @brief iswhite checks whether c space or tab.
* @param c character.
* @return true - space or tab, false - don't space and don't tab.
*/
};
#endif // CALCULATOR_H

View File

@ -0,0 +1,13 @@
SOURCES += \
src/container/vpointf.cpp \
src/container/vincrementtablerow.cpp \
src/container/vcontainer.cpp \
src/container/calculator.cpp \
src/container/vstandarttablerow.cpp
HEADERS += \
src/container/vpointf.h \
src/container/vincrementtablerow.h \
src/container/vcontainer.h \
src/container/calculator.h \
src/container/vstandarttablerow.h

View File

@ -33,13 +33,13 @@ qint64 VContainer::_id = 0;
VContainer::VContainer()
:base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
modelingPoints(QHash<qint64, VPointF>()),
standartTable(QHash<QString, VStandartTableCell>()), incrementTable(QHash<QString, VIncrementTableRow>()),
pointsModeling(QHash<qint64, VPointF>()),
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
modelingSplines(QHash<qint64, VSpline>()),
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), modelingArcs(QHash<qint64, VArc>()),
splinesModeling(QHash<qint64, VSpline>()),
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), arcsModeling(QHash<qint64, VArc>()),
lengthArcs(QHash<QString, qreal>()),
splinePaths(QHash<qint64, VSplinePath>()), modelingSplinePaths(QHash<qint64, VSplinePath>()),
splinePaths(QHash<qint64, VSplinePath>()), splinePathsModeling(QHash<qint64, VSplinePath>()),
details(QHash<qint64, VDetail>())
{
SetSize(500);
@ -55,13 +55,13 @@ VContainer &VContainer::operator =(const VContainer &data)
VContainer::VContainer(const VContainer &data)
:base(QHash<QString, qint32>()), points(QHash<qint64, VPointF>()),
modelingPoints(QHash<qint64, VPointF>()),
standartTable(QHash<QString, VStandartTableCell>()), incrementTable(QHash<QString, VIncrementTableRow>()),
pointsModeling(QHash<qint64, VPointF>()),
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), splines(QHash<qint64, VSpline>()),
modelingSplines(QHash<qint64, VSpline>()),
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), modelingArcs(QHash<qint64, VArc>()),
splinesModeling(QHash<qint64, VSpline>()),
lengthSplines(QHash<QString, qreal>()), arcs(QHash<qint64, VArc>()), arcsModeling(QHash<qint64, VArc>()),
lengthArcs(QHash<QString, qreal>()),
splinePaths(QHash<qint64, VSplinePath>()), modelingSplinePaths(QHash<qint64, VSplinePath>()),
splinePaths(QHash<qint64, VSplinePath>()), splinePathsModeling(QHash<qint64, VSplinePath>()),
details(QHash<qint64, VDetail>())
{
setData(data);
@ -71,19 +71,19 @@ void VContainer::setData(const VContainer &data)
{
base = *data.DataBase();
points = *data.DataPoints();
modelingPoints = *data.DataModelingPoints();
pointsModeling = *data.DataPointsModeling();
standartTable = *data.DataStandartTable();
incrementTable = *data.DataIncrementTable();
lengthLines = *data.DataLengthLines();
lineAngles = *data.DataLineAngles();
splines = *data.DataSplines();
modelingSplines = *data.DataModelingSplines();
splinesModeling = *data.DataSplinesModeling();
lengthSplines = *data.DataLengthSplines();
arcs = *data.DataArcs();
modelingArcs = *data.DataModelingArcs();
arcsModeling = *data.DataArcsModeling();
lengthArcs = *data.DataLengthArcs();
splinePaths = *data.DataSplinePaths();
modelingSplinePaths = *data.DataModelingSplinePaths();
splinePathsModeling = *data.DataSplinePathsModeling();
details = *data.DataDetails();
}
@ -92,9 +92,9 @@ VPointF VContainer::GetPoint(qint64 id) const
return GetObject(points, id);
}
VPointF VContainer::GetModelingPoint(qint64 id) const
VPointF VContainer::GetPointModeling(qint64 id) const
{
return GetObject(modelingPoints, id);
return GetObject(pointsModeling, id);
}
template <typename key, typename val>
@ -110,7 +110,7 @@ val VContainer::GetObject(const QHash<key, val> &obj, key id)
}
}
VStandartTableCell VContainer::GetStandartTableCell(const QString &name) const
VStandartTableRow VContainer::GetStandartTableCell(const QString &name) const
{
Q_ASSERT(name.isEmpty()==false);
return GetObject(standartTable, name);
@ -151,9 +151,9 @@ VSpline VContainer::GetSpline(qint64 id) const
return GetObject(splines, id);
}
VSpline VContainer::GetModelingSpline(qint64 id) const
VSpline VContainer::GetSplineModeling(qint64 id) const
{
return GetObject(modelingSplines, id);
return GetObject(splinesModeling, id);
}
VArc VContainer::GetArc(qint64 id) const
@ -161,9 +161,9 @@ VArc VContainer::GetArc(qint64 id) const
return GetObject(arcs, id);
}
VArc VContainer::GetModelingArc(qint64 id) const
VArc VContainer::GetArcModeling(qint64 id) const
{
return GetObject(modelingArcs, id);
return GetObject(arcsModeling, id);
}
VSplinePath VContainer::GetSplinePath(qint64 id) const
@ -171,9 +171,9 @@ VSplinePath VContainer::GetSplinePath(qint64 id) const
return GetObject(splinePaths, id);
}
VSplinePath VContainer::GetModelingSplinePath(qint64 id) const
VSplinePath VContainer::GetSplinePathModeling(qint64 id) const
{
return GetObject(modelingSplinePaths, id);
return GetObject(splinePathsModeling, id);
}
VDetail VContainer::GetDetail(qint64 id) const
@ -186,9 +186,9 @@ qint64 VContainer::AddPoint(const VPointF &point)
return AddObject(points, point);
}
qint64 VContainer::AddModelingPoint(const VPointF &point)
qint64 VContainer::AddPointModeling(const VPointF &point)
{
return AddObject(modelingPoints, point);
return AddObject(pointsModeling, point);
}
qint64 VContainer::AddDetail(const VDetail &detail)
@ -221,7 +221,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
{
case (Tool::NodePoint):
{
VPointF point = GetModelingPoint(detail[i].getId());
VPointF point = GetPointModeling(detail[i].getId());
points.append(point.toQPointF());
if (detail.getSupplement() == true)
{
@ -234,7 +234,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
break;
case (Tool::NodeArc):
{
VArc arc = GetModelingArc(detail[i].getId());
VArc arc = GetArcModeling(detail[i].getId());
qreal len1 = GetLengthContour(points, arc.GetPoints());
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
if (len1 <= lenReverse)
@ -257,7 +257,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
break;
case (Tool::NodeSpline):
{
VSpline spline = GetModelingSpline(detail[i].getId());
VSpline spline = GetSplineModeling(detail[i].getId());
qreal len1 = GetLengthContour(points, spline.GetPoints());
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
if (len1 <= lenReverse)
@ -281,7 +281,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
break;
case (Tool::NodeSplinePath):
{
VSplinePath splinePath = GetModelingSplinePath(detail[i].getId());
VSplinePath splinePath = GetSplinePathModeling(detail[i].getId());
qreal len1 = GetLengthContour(points, splinePath.GetPathPoints());
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
if (len1 <= lenReverse)
@ -584,7 +584,7 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value)
qreal VContainer::GetValueStandartTableCell(const QString& name) const
{
VStandartTableCell cell = GetStandartTableCell(name);
VStandartTableRow cell = GetStandartTableCell(name);
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
qreal value = cell.GetBase() + k_size*cell.GetKsize() + k_growth*cell.GetKgrowth();
@ -609,10 +609,10 @@ void VContainer::Clear()
lengthArcs.clear();
lineAngles.clear();
details.clear();
modelingArcs.clear();
modelingPoints.clear();
modelingSplinePaths.clear();
modelingSplines.clear();
arcsModeling.clear();
pointsModeling.clear();
splinePathsModeling.clear();
splinesModeling.clear();
ClearObject();
CreateManTableIGroup ();
}
@ -679,8 +679,8 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId
}
else
{
first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId);
first = GetPointModeling(firstPointId);
second = GetPointModeling(secondPointId);
}
AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
nameLine = GetNameLineAngle(firstPointId, secondPointId, mode);
@ -692,9 +692,9 @@ qint64 VContainer::AddSpline(const VSpline &spl)
return AddObject(splines, spl);
}
qint64 VContainer::AddModelingSpline(const VSpline &spl)
qint64 VContainer::AddSplineModeling(const VSpline &spl)
{
return AddObject(modelingSplines, spl);
return AddObject(splinesModeling, spl);
}
qint64 VContainer::AddSplinePath(const VSplinePath &splPath)
@ -702,9 +702,9 @@ qint64 VContainer::AddSplinePath(const VSplinePath &splPath)
return AddObject(splinePaths, splPath);
}
qint64 VContainer::AddModelingSplinePath(const VSplinePath &splPath)
qint64 VContainer::AddSplinePathModeling(const VSplinePath &splPath)
{
return AddObject(modelingSplinePaths, splPath);
return AddObject(splinePathsModeling, splPath);
}
qint64 VContainer::AddArc(const VArc &arc)
@ -712,9 +712,9 @@ qint64 VContainer::AddArc(const VArc &arc)
return AddObject(arcs, arc);
}
qint64 VContainer::AddModelingArc(const VArc &arc)
qint64 VContainer::AddArcModeling(const VArc &arc)
{
return AddObject(modelingArcs, arc);
return AddObject(arcsModeling, arc);
}
template <typename key, typename val>
@ -736,8 +736,8 @@ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPo
}
else
{
first = GetModelingPoint(firstPoint);
second = GetModelingPoint(secondPoint);
first = GetPointModeling(firstPoint);
second = GetPointModeling(secondPoint);
}
return QString("Line_%1_%2").arg(first.name(), second.name());
}
@ -753,8 +753,8 @@ QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &sec
}
else
{
first = GetModelingPoint(firstPoint);
second = GetModelingPoint(secondPoint);
first = GetPointModeling(firstPoint);
second = GetPointModeling(secondPoint);
}
return QString("AngleLine_%1_%2").arg(first.name(), second.name());
}
@ -764,9 +764,9 @@ void VContainer::UpdatePoint(qint64 id, const VPointF &point)
UpdateObject(points, id, point);
}
void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point)
void VContainer::UpdatePointModeling(qint64 id, const VPointF &point)
{
UpdateObject(modelingPoints, id, point);
UpdateObject(pointsModeling, id, point);
}
void VContainer::UpdateDetail(qint64 id, const VDetail &detail)
@ -779,9 +779,9 @@ void VContainer::UpdateSpline(qint64 id, const VSpline &spl)
UpdateObject(splines, id, spl);
}
void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl)
void VContainer::UpdateSplineModeling(qint64 id, const VSpline &spl)
{
UpdateObject(modelingSplines, id, spl);
UpdateObject(splinesModeling, id, spl);
}
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath)
@ -789,9 +789,9 @@ void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath)
UpdateObject(splinePaths, id, splPath);
}
void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath)
void VContainer::UpdateSplinePathModeling(qint64 id, const VSplinePath &splPath)
{
UpdateObject(modelingSplinePaths, id, splPath);
UpdateObject(splinePathsModeling, id, splPath);
}
void VContainer::UpdateArc(qint64 id, const VArc &arc)
@ -799,9 +799,9 @@ void VContainer::UpdateArc(qint64 id, const VArc &arc)
UpdateObject(arcs, id, arc);
}
void VContainer::UpdateModelingArc(qint64 id, const VArc &arc)
void VContainer::UpdateArcModeling(qint64 id, const VArc &arc)
{
UpdateObject(modelingArcs, id, arc);
UpdateObject(arcsModeling, id, arc);
}
void VContainer::AddLengthLine(const QString &name, const qreal &value)
@ -812,60 +812,60 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value)
void VContainer::CreateManTableIGroup ()
{
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
AddStandartTableCell("Vtos", VStandartTableCell(1450, 2, 51));
AddStandartTableCell("Vtosh", VStandartTableCell(1506, 2, 54));
AddStandartTableCell("Vpt", VStandartTableCell(1438, 3, 52));
AddStandartTableCell("Vst", VStandartTableCell(1257, -1, 49));
AddStandartTableCell("Vlt", VStandartTableCell(1102, 0, 43));
AddStandartTableCell("Vk", VStandartTableCell(503, 0, 22));
AddStandartTableCell("Vsht", VStandartTableCell(1522, 2, 54));
AddStandartTableCell("Vzy", VStandartTableCell(1328, 0, 49));
AddStandartTableCell("Vlop", VStandartTableCell(1320, 0, 49));
AddStandartTableCell("Vps", VStandartTableCell(811, -1, 36));
AddStandartTableCell("Ssh", VStandartTableCell(202, 4, 1));
AddStandartTableCell("SgI", VStandartTableCell(517, 18, 2));
AddStandartTableCell("SgII", VStandartTableCell(522, 19, 1));
AddStandartTableCell("SgIII", VStandartTableCell(500, 20, 0));
AddStandartTableCell("St", VStandartTableCell(390, 20, 0));
AddStandartTableCell("Sb", VStandartTableCell(492, 15, 5));
AddStandartTableCell("SbI", VStandartTableCell(482, 12, 6));
AddStandartTableCell("Obed", VStandartTableCell(566, 18, 6));
AddStandartTableCell("Ok", VStandartTableCell(386, 8, 8));
AddStandartTableCell("Oi", VStandartTableCell(380, 8, 6));
AddStandartTableCell("Osch", VStandartTableCell(234, 4, 4));
AddStandartTableCell("Dsb", VStandartTableCell(1120, 0, 44));
AddStandartTableCell("Dsp", VStandartTableCell(1110, 0, 43));
AddStandartTableCell("Dn", VStandartTableCell(826, -3, 37));
AddStandartTableCell("Dps", VStandartTableCell(316, 4, 7));
AddStandartTableCell("Dpob", VStandartTableCell(783, 14, 15));
AddStandartTableCell("Ds", VStandartTableCell(260, 1, 6));
AddStandartTableCell("Op", VStandartTableCell(316, 12, 0));
AddStandartTableCell("Ozap", VStandartTableCell(180, 4, 0));
AddStandartTableCell("Pkis", VStandartTableCell(250, 4, 0));
AddStandartTableCell("SHp", VStandartTableCell(160, 1, 4));
AddStandartTableCell("Dlych", VStandartTableCell(500, 2, 15));
AddStandartTableCell("Dzap", VStandartTableCell(768, 2, 24));
AddStandartTableCell("DIIIp", VStandartTableCell(970, 2, 29));
AddStandartTableCell("Vprp", VStandartTableCell(214, 3, 3));
AddStandartTableCell("Vg", VStandartTableCell(262, 8, 3));
AddStandartTableCell("Dtp", VStandartTableCell(460, 7, 9));
AddStandartTableCell("Dp", VStandartTableCell(355, 5, 5));
AddStandartTableCell("Vprz", VStandartTableCell(208, 3, 5));
AddStandartTableCell("Dts", VStandartTableCell(438, 2, 10));
AddStandartTableCell("DtsI", VStandartTableCell(469, 2, 10));
AddStandartTableCell("Dvcht", VStandartTableCell(929, 9, 19));
AddStandartTableCell("SHg", VStandartTableCell(370, 14, 4));
AddStandartTableCell("Cg", VStandartTableCell(224, 6, 0));
AddStandartTableCell("SHs", VStandartTableCell(416, 10, 2));
AddStandartTableCell("dpzr", VStandartTableCell(121, 6, 0));
AddStandartTableCell("Ogol", VStandartTableCell(576, 4, 4));
AddStandartTableCell("Ssh1", VStandartTableCell(205, 5, 0));
AddStandartTableCell("St", VStandartTableCell(410, 20, 0));
AddStandartTableCell("Drzap", VStandartTableCell(594, 3, 19));
AddStandartTableCell("DbII", VStandartTableCell(1020, 0, 44));
AddStandartTableCell("Sb", VStandartTableCell(504, 15, 4));
AddStandartTableCell("Pkor", VStandartTableRow(84, 0, 3));
AddStandartTableCell("Pkor", VStandartTableRow(84, 0, 3));
AddStandartTableCell("Vtos", VStandartTableRow(1450, 2, 51));
AddStandartTableCell("Vtosh", VStandartTableRow(1506, 2, 54));
AddStandartTableCell("Vpt", VStandartTableRow(1438, 3, 52));
AddStandartTableCell("Vst", VStandartTableRow(1257, -1, 49));
AddStandartTableCell("Vlt", VStandartTableRow(1102, 0, 43));
AddStandartTableCell("Vk", VStandartTableRow(503, 0, 22));
AddStandartTableCell("Vsht", VStandartTableRow(1522, 2, 54));
AddStandartTableCell("Vzy", VStandartTableRow(1328, 0, 49));
AddStandartTableCell("Vlop", VStandartTableRow(1320, 0, 49));
AddStandartTableCell("Vps", VStandartTableRow(811, -1, 36));
AddStandartTableCell("Ssh", VStandartTableRow(202, 4, 1));
AddStandartTableCell("SgI", VStandartTableRow(517, 18, 2));
AddStandartTableCell("SgII", VStandartTableRow(522, 19, 1));
AddStandartTableCell("SgIII", VStandartTableRow(500, 20, 0));
AddStandartTableCell("St", VStandartTableRow(390, 20, 0));
AddStandartTableCell("Sb", VStandartTableRow(492, 15, 5));
AddStandartTableCell("SbI", VStandartTableRow(482, 12, 6));
AddStandartTableCell("Obed", VStandartTableRow(566, 18, 6));
AddStandartTableCell("Ok", VStandartTableRow(386, 8, 8));
AddStandartTableCell("Oi", VStandartTableRow(380, 8, 6));
AddStandartTableCell("Osch", VStandartTableRow(234, 4, 4));
AddStandartTableCell("Dsb", VStandartTableRow(1120, 0, 44));
AddStandartTableCell("Dsp", VStandartTableRow(1110, 0, 43));
AddStandartTableCell("Dn", VStandartTableRow(826, -3, 37));
AddStandartTableCell("Dps", VStandartTableRow(316, 4, 7));
AddStandartTableCell("Dpob", VStandartTableRow(783, 14, 15));
AddStandartTableCell("Ds", VStandartTableRow(260, 1, 6));
AddStandartTableCell("Op", VStandartTableRow(316, 12, 0));
AddStandartTableCell("Ozap", VStandartTableRow(180, 4, 0));
AddStandartTableCell("Pkis", VStandartTableRow(250, 4, 0));
AddStandartTableCell("SHp", VStandartTableRow(160, 1, 4));
AddStandartTableCell("Dlych", VStandartTableRow(500, 2, 15));
AddStandartTableCell("Dzap", VStandartTableRow(768, 2, 24));
AddStandartTableCell("DIIIp", VStandartTableRow(970, 2, 29));
AddStandartTableCell("Vprp", VStandartTableRow(214, 3, 3));
AddStandartTableCell("Vg", VStandartTableRow(262, 8, 3));
AddStandartTableCell("Dtp", VStandartTableRow(460, 7, 9));
AddStandartTableCell("Dp", VStandartTableRow(355, 5, 5));
AddStandartTableCell("Vprz", VStandartTableRow(208, 3, 5));
AddStandartTableCell("Dts", VStandartTableRow(438, 2, 10));
AddStandartTableCell("DtsI", VStandartTableRow(469, 2, 10));
AddStandartTableCell("Dvcht", VStandartTableRow(929, 9, 19));
AddStandartTableCell("SHg", VStandartTableRow(370, 14, 4));
AddStandartTableCell("Cg", VStandartTableRow(224, 6, 0));
AddStandartTableCell("SHs", VStandartTableRow(416, 10, 2));
AddStandartTableCell("dpzr", VStandartTableRow(121, 6, 0));
AddStandartTableCell("Ogol", VStandartTableRow(576, 4, 4));
AddStandartTableCell("Ssh1", VStandartTableRow(205, 5, 0));
AddStandartTableCell("St", VStandartTableRow(410, 20, 0));
AddStandartTableCell("Drzap", VStandartTableRow(594, 3, 19));
AddStandartTableCell("DbII", VStandartTableRow(1020, 0, 44));
AddStandartTableCell("Sb", VStandartTableRow(504, 15, 4));
}
QVector<QPointF> VContainer::GetReversePoint(const QVector<QPointF> &points) const

688
src/container/vcontainer.h Normal file
View File

@ -0,0 +1,688 @@
/************************************************************************
**
** @file vcontainer.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef VCONTAINER_H
#define VCONTAINER_H
#include "vstandarttablerow.h"
#include "vincrementtablerow.h"
#include "../geometry/varc.h"
#include "../geometry/vsplinepath.h"
#include "../geometry/vdetail.h"
#include "../widgets/vitem.h"
/**
* @brief The VContainer class container of all variables.
*/
class VContainer
{
Q_DECLARE_TR_FUNCTIONS(VContainer)
public:
/**
* @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);
/**
* @brief setData copy data from container
* @param data container
*/
void setData(const VContainer &data);
/**
* @brief GetPoint returns a point by id
* @param id id of point
* @return point
*/
VPointF GetPoint(qint64 id) const;
/**
* @brief GetPointModeling return a point modeling by id
* @param id id of point modeling
* @return point modeling
*/
VPointF GetPointModeling(qint64 id) const;
/**
* @brief GetStandartTableCell return standart table row by name
* @param name name of standart table row
* @return row of standart table
*/
VStandartTableRow GetStandartTableCell(const QString& name) const;
/**
* @brief GetIncrementTableRow return increment table row by name
* @param name name of increment table row
* @return row of increment table
*/
VIncrementTableRow GetIncrementTableRow(const QString& name) const;
/**
* @brief GetLine return length of line by name
* @param name name of line
* @return length of line in mm
*/
qreal GetLine(const QString &name) const;
/**
* @brief GetLengthArc return length of arc by name
* @param name name of arc
* @return length of arc in mm
*/
qreal GetLengthArc(const QString &name) const;
/**
* @brief GetLengthSpline return length of spline by name
* @param name name of spline
* @return length of spline in mm
*/
qreal GetLengthSpline(const QString &name) const;
/**
* @brief GetLineAngle return angle of line
* @param name name of line angle
* @return angle in degree
*/
qreal GetLineAngle(const QString &name) const;
/**
* @brief GetSpline return spline by id
* @param id id of spline
* @return spline
*/
VSpline GetSpline(qint64 id) const;
/**
* @brief GetSplineModeling return spline modeling by id
* @param id id of spline modeling
* @return spline modeling
*/
VSpline GetSplineModeling(qint64 id) const;
/**
* @brief GetArc return arc by id
* @param id id of arc
* @return arc
*/
VArc GetArc(qint64 id) const;
/**
* @brief GetArcModeling return arc modeling by id
* @param id id of arc modeling
* @return arc modeling
*/
VArc GetArcModeling(qint64 id) const;
/**
* @brief GetSplinePath return spline path by id
* @param id id of spline path
* @return spline path
*/
VSplinePath GetSplinePath(qint64 id) const;
/**
* @brief GetSplinePathModeling return spline path modeling by id
* @param id id of spline modeling path
* @return spline modeling path
*/
VSplinePath GetSplinePathModeling(qint64 id) const;
/**
* @brief GetDetail return detail by id
* @param id id of detail
* @return detail
*/
VDetail GetDetail(qint64 id) const;
/**
* @brief getId return current id
* @return current id
*/
static qint64 getId() {return _id;}
/**
* @brief AddPoint add new point to container
* @param point new point
* @return return id of new point in container
*/
qint64 AddPoint(const VPointF& point);
/**
* @brief AddPointModeling add new point modeling to container
* @param point new point modeling
* @return return id of new point modeling in container
*/
qint64 AddPointModeling(const VPointF& point);
/**
* @brief AddDetail add new detail to container
* @param detail new detail
* @return return id of new detail in container
*/
qint64 AddDetail(const VDetail& detail);
/**
* @brief AddStandartTableCell add new row of standart table
* @param name name of row of standart table
* @param cell row of standart table
*/
inline void AddStandartTableCell(const QString& name, const VStandartTableRow& cell)
{standartTable[name] = cell;}
/**
* @brief AddIncrementTableRow add new row of increment table
* @param name name of new row of increment table
* @param row new row of increment table
*/
inline void AddIncrementTableRow(const QString& name, const VIncrementTableRow &row)
{incrementTable[name] = row;}
/**
* @brief AddLengthLine add length of line to container
* @param name name of line
* @param value length of line
*/
void AddLengthLine(const QString &name, const qreal &value);
/**
* @brief AddLengthSpline add length of spline to container
* @param name name of spline
* @param value length of spline
*/
void AddLengthSpline(const QString &name, const qreal &value);
/**
* @brief AddLengthArc add length of arc to container
* @param id id of arc
*/
void AddLengthArc(const qint64 &id);
/**
* @brief AddLengthArc add length of arc
* @param name name of arc
* @param value length of arc
*/
void AddLengthArc(const QString &name, const qreal &value);
/**
* @brief AddLineAngle add angle of line to container
* @param name name of line angle
* @param value angle in degree
*/
void AddLineAngle(const QString &name, const qreal &value);
/**
* @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
*/
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId,
const Draw::Draws &mode = Draw::Calculation);
/**
* @brief AddSpline add spline to container
* @param spl new spline
* @return id of spline in container
*/
qint64 AddSpline(const VSpline& spl);
/**
* @brief AddSplineModeling add spline modeling to container
* @param spl new spline modeling
* @return id of spline modeling in container
*/
qint64 AddSplineModeling(const VSpline& spl);
/**
* @brief AddSplinePath add spline path to container
* @param splPath new spline path
* @return id of spline path in container
*/
qint64 AddSplinePath(const VSplinePath& splPath);
/**
* @brief AddSplinePathModeling add spline path modeling to container
* @param splPath new spline path
* @return id of spline path in container
*/
qint64 AddSplinePathModeling(const VSplinePath& splPath);
/**
* @brief AddArc add arc to container
* @param arc new arc
* @return id of arc in container in container
*/
qint64 AddArc(const VArc& arc);
/**
* @brief AddArcModeling add arc modeling to container
* @param arc new arc modeling
* @return id of new arc modeling in container
*/
qint64 AddArcModeling(const VArc& arc);
/**
* @brief GetNameLine return name of line
* @param firstPoint id of first point of line
* @param secondPoint id of second point of line
* @param mode mode of line
* @return name of line
*/
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint,
const Draw::Draws &mode = Draw::Calculation) const;
/**
* @brief GetNameLineAngle return name of line angle
* @param firstPoint id of first point of line
* @param secondPoint id of second point of line
* @param mode mode of line
* @return name of angle of line
*/
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint,
const Draw::Draws &mode = Draw::Calculation) const;
/**
* @brief UpdatePoint update point by id
* @param id id of existing point
* @param point point
*/
void UpdatePoint(qint64 id, const VPointF& point);
/**
* @brief UpdatePointModeling update point modeling by id
* @param id id of existing point modeling
* @param point point modeling
*/
void UpdatePointModeling(qint64 id, const VPointF& point);
/**
* @brief UpdateDetail update detail by id
* @param id id of existing detail
* @param detail detail
*/
void UpdateDetail(qint64 id, const VDetail& detail);
/**
* @brief UpdateSpline update spline by id
* @param id if of existing spline
* @param spl spline
*/
void UpdateSpline(qint64 id, const VSpline& spl);
/**
* @brief UpdateSplineModeling update spline modeling by id
* @param id id of existing spline modeling
* @param spl spline modeling
*/
void UpdateSplineModeling(qint64 id, const VSpline& spl);
/**
* @brief UpdateSplinePath update spline path by id
* @param id id of existing spline path
* @param splPath spline path
*/
void UpdateSplinePath(qint64 id, const VSplinePath& splPath);
/**
* @brief UpdateSplinePathModeling update spline path modeling by id
* @param id id of existing spline path modeling
* @param splPath spline path modeling
*/
void UpdateSplinePathModeling(qint64 id, const VSplinePath& splPath);
/**
* @brief UpdateArc update arc by id
* @param id id of existing arc
* @param arc arc
*/
void UpdateArc(qint64 id, const VArc& arc);
/**
* @brief UpdateArcModeling update arc modeling by id
* @param id id of existing arc modeling
* @param arc arc modeling
*/
void UpdateArcModeling(qint64 id, const VArc& arc);
/**
* @brief UpdateStandartTableCell update standart table row by name
* @param name name of row
* @param cell row of standart table
*/
inline void UpdateStandartTableCell(const QString& name, const VStandartTableRow& cell)
{standartTable[name] = cell;}
/**
* @brief UpdateIncrementTableRow update increment table row by name
* @param name name of row
* @param row row
*/
inline void UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& row)
{incrementTable[name] = row;}
/**
* @brief GetValueStandartTableCell return value of standart table row by name
* @param name name of row
* @return value in mm
*/
qreal GetValueStandartTableCell(const QString& name) const;
/**
* @brief GetValueIncrementTableRow return value of increment table row by name
* @param name name of row
* @return value of row in mm
*/
qreal GetValueIncrementTableRow(const QString& name) const;
/**
* @brief Clear clear data in container. Id will be 0.
*/
void Clear();
/**
* @brief ClearObject points, splines, arcs, spline paths will be cleared.
*/
void ClearObject();
/**
* @brief ClearIncrementTable clear increment table
*/
inline void ClearIncrementTable() {incrementTable.clear();}
/**
* @brief ClearLengthLines clear length lines
*/
inline void ClearLengthLines() {lengthLines.clear();}
/**
* @brief ClearLengthSplines clear length splines
*/
inline void ClearLengthSplines() {lengthSplines.clear();}
/**
* @brief ClearLengthArcs clear length arcs
*/
inline void ClearLengthArcs() {lengthArcs.clear();}
/**
* @brief ClearLineAngles clear angles of lines
*/
inline void ClearLineAngles() {lineAngles.clear();}
/**
* @brief SetSize set value of size
* @param size value of size in mm
*/
inline void SetSize(qint32 size) {base["Сг"] = size;}
/**
* @brief SetGrowth set value of growth
* @param growth value of growth in mm
*/
inline void SetGrowth(qint32 growth) {base["Р"] = growth;}
/**
* @brief size return size
* @return size in mm
*/
inline qint32 size() const {return base.value("Сг");}
/**
* @brief growth return growth
* @return growth in mm
*/
inline qint32 growth() const {return base.value("Р");}
/**
* @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
*/
qreal FindVar(const QString& name, bool *ok)const;
/**
* @brief IncrementTableContains check if increment table contains name
* @param name name of row
* @return true if contains
*/
inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);}
/**
* @brief getNextId generate next unique id
* @return next unique id
*/
static qint64 getNextId();
/**
* @brief RemoveIncrementTableRow remove row by name from increment table
* @param name name of existing row
*/
inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);}
/**
* @brief data container with dataPoints return container of points
* @return pointer on container of points
*/
inline const QHash<qint64, VPointF> *DataPoints() const {return &points;}
/**
* @brief data container with dataPointsModeling return container of points modeling
* @return pointer on container of points modeling
*/
inline const QHash<qint64, VPointF> *DataPointsModeling() const {return &pointsModeling;}
/**
* @brief data container with dataSplines return container of splines
* @return pointer on container of splines
*/
inline const QHash<qint64, VSpline> *DataSplines() const {return &splines;}
/**
* @brief data container with dataSplinesModeling return container of splines modeling
* @return pointer on container of splines modeling
*/
inline const QHash<qint64, VSpline> *DataSplinesModeling() const {return &splinesModeling;}
/**
* @brief data container with dataArcs return container of arcs
* @return pointer on container of arcs
*/
inline const QHash<qint64, VArc> *DataArcs() const {return &arcs;}
/**
* @brief data container with dataArcsModeling return container of arcs modeling
* @return pointer on container of arcs modeling
*/
inline const QHash<qint64, VArc> *DataArcsModeling() const {return &arcsModeling;}
/**
* @brief data container with dataBase return container of data
* @return pointer on container of base data
*/
inline const QHash<QString, qint32> *DataBase() const {return &base;}
/**
* @brief data container with dataStandartTable return container of standart table
* @return pointer on container of standart table
*/
inline const QHash<QString, VStandartTableRow> *DataStandartTable() const {return &standartTable;}
/**
* @brief data container with dataIncrementTable return container of increment table
* @return pointer on container of increment table
*/
inline const QHash<QString, VIncrementTableRow> *DataIncrementTable() const {return &incrementTable;}
/**
* @brief data container with dataLengthLines return container of lines lengths
* @return pointer on container of lines lengths
*/
inline const QHash<QString, qreal> *DataLengthLines() const {return &lengthLines;}
/**
* @brief data container with dataLengthSplines return container of splines lengths
* @return pointer on container of splines lengths
*/
inline const QHash<QString, qreal> *DataLengthSplines() const {return &lengthSplines;}
/**
* @brief data container with dataLengthArcs return container of arcs length
* @return pointer on container of arcs length
*/
inline const QHash<QString, qreal> *DataLengthArcs() const {return &lengthArcs;}
/**
* @brief data container with dataLineAngles return container of angles of line
* @return pointer on container of angles of line
*/
inline const QHash<QString, qreal> *DataLineAngles() const {return &lineAngles;}
/**
* @brief data container with dataSplinePaths return container of spline paths
* @return pointer on container of spline paths
*/
inline const QHash<qint64, VSplinePath> *DataSplinePaths() const {return &splinePaths;}
/**
* @brief data container with dataSplinePathsModeling return container of spline paths modeling
* @return pointer on container of spline paths modeling
*/
inline const QHash<qint64, VSplinePath> *DataSplinePathsModeling() const {return &splinePathsModeling;}
/**
* @brief data container with dataDetails return container of details
* @return pointer on container of details
*/
inline const QHash<qint64, VDetail> *DataDetails() const {return &details;}
/**
* @brief UpdateId update id. If new id bigger when current save new like current.
* @param newId id
*/
static void UpdateId(qint64 newId);
/**
* @brief ContourPath create painter path for detail
* @param idDetail id of detail
* @return return painter path of contour detail
*/
QPainterPath ContourPath(qint64 idDetail) const;
/**
* @brief biasPoints bias point
* @param points vector of points
* @param mx offset respect to x
* @param my offset respect to y
* @return new vector biased points
*/
QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const;
/**
* @brief Equidistant create equidistant painter path for detail
* @param points vector of points
* @param eqv type of equidistant
* @param width width of equidistant
* @return return painter path of equidistant
*/
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv, const qreal &width)const;
/**
* @brief ParallelLine create parallel line
* @param line starting line
* @param width width to parallel line
* @return parallel line
*/
static QLineF ParallelLine(const QLineF &line, qreal width );
/**
* @brief SingleParallelPoint return point of parallel line
* @param line starting line
* @param angle angle in degree
* @param width width to parallel line
* @return point of parallel line
*/
static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width);
/**
* @brief EkvPoint return vector of points of equidistant two lines. Last point of two lines must be equal.
* @param line1 first line
* @param line2 second line
* @param width width of equidistant
* @return vector of points
*/
QVector<QPointF> EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)const;
/**
* @brief CheckLoops seek and delete loops in equidistant
* @param points vector of points of equidistant
* @return vector of points of equidistant
*/
QVector<QPointF> CheckLoops(const QVector<QPointF> &points) const;
/**
* @brief PrepareDetails prepare detail for creation layout
* @param list list of details
*/
void PrepareDetails(QVector<VItem *> & list) const;
private:
/**
* @brief _id current id. New object will have value +1. For full class equal 0.
*/
static qint64 _id;
/**
* @brief base container of base data (size and growth)
*/
QHash<QString, qint32> base;
/**
* @brief points container of points
*/
QHash<qint64, VPointF> points;
/**
* @brief pointsModeling container of points modeling
*/
QHash<qint64, VPointF> pointsModeling;
/**
* @brief standartTable container of standart table rows
*/
QHash<QString, VStandartTableRow> standartTable;
/**
* @brief incrementTable
*/
QHash<QString, VIncrementTableRow> incrementTable;
/**
* @brief lengthLines container of lines lengths
*/
QHash<QString, qreal> lengthLines;
/**
* @brief lineAngles container of angles of lines
*/
QHash<QString, qreal> lineAngles;
/**
* @brief splines container of splines
*/
QHash<qint64, VSpline> splines;
/**
* @brief splinesModeling container of splines modeling
*/
QHash<qint64, VSpline> splinesModeling;
/**
* @brief lengthSplines container of splines length
*/
QHash<QString, qreal> lengthSplines;
/**
* @brief arcs container of arcs
*/
QHash<qint64, VArc> arcs;
/**
* @brief arcsModeling container of arcs modeling
*/
QHash<qint64, VArc> arcsModeling;
/**
* @brief lengthArcs container of arcs length
*/
QHash<QString, qreal> lengthArcs;
/**
* @brief splinePaths container of spline paths
*/
QHash<qint64, VSplinePath> splinePaths;
/**
* @brief splinePathsModeling container of spline paths modeling
*/
QHash<qint64, VSplinePath> splinePathsModeling;
/**
* @brief details container of details
*/
QHash<qint64, VDetail> details;
/**
* @brief CreateManTableIGroup generate man standart table of measurements
*/
void CreateManTableIGroup ();
/**
* @brief GetReversePoint return revers container of points
* @param points container with points
* @return reverced points
*/
QVector<QPointF> GetReversePoint(const QVector<QPointF> &points)const;
/**
* @brief GetLengthContour return length of contour
* @param contour container with points of contour
* @param newPoints point whos we try to add to contour
* @return length length of contour
*/
qreal GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints)const;
template <typename key, typename val>
/**
* @brief GetObject return object from container
* @param obj container
* @param id id of object
* @return Object
*/
static val GetObject(const QHash<key, val> &obj, key id);
template <typename val>
/**
* @brief UpdateObject update object in container
* @param obj container
* @param id id of existing object
* @param point object
*/
static void UpdateObject(QHash<qint64, val> &obj, const qint64 &id, const val& point);
template <typename key, typename val>
/**
* @brief AddObject add object to container
* @param obj container
* @param value object
* @return id of object in container
*/
static qint64 AddObject(QHash<key, val> &obj, const val& value);
};
#endif // VCONTAINER_H

View File

@ -29,27 +29,96 @@
#ifndef VINCREMENTTABLEROW_H
#define VINCREMENTTABLEROW_H
/**
* @brief The VIncrementTableRow class keep data row of increment table
*/
class VIncrementTableRow
{
public:
/**
* @brief VIncrementTableRow create enpty row
*/
VIncrementTableRow();
/**
* @brief VIncrementTableRow create row
* @param id id
* @param base value in base size and growth
* @param ksize increment in sizes
* @param kgrowth increment in growths
* @param description description of increment
*/
VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth,
QString description = QString());
/**
* @brief getId return id of row
* @return id
*/
inline qint64 getId() const {return id;}
/**
* @brief setId set id of row
* @param value id
*/
inline void setId(const qint64 &value) {id = value;}
/**
* @brief getBase return value in base size and growth
* @return value
*/
inline qreal getBase() const {return base;}
/**
* @brief setBase set value in base size and growth
* @param value base value
*/
inline void setBase(const qreal &value) {base = value;}
/**
* @brief getKsize return increment in sizes
* @return increment
*/
inline qreal getKsize() const {return ksize;}
/**
* @brief setKsize set increment in sizes
* @param value value of increment
*/
inline void setKsize(const qreal &value) {ksize = value;}
/**
* @brief getKgrowth return increment in growths
* @return increment
*/
inline qreal getKgrowth() const {return kgrowth;}
/**
* @brief setKgrowth set increment in growths
* @param value value of increment
*/
inline void setKgrowth(const qreal &value) {kgrowth = value;}
/**
* @brief getDescription return description
* @return description
*/
inline QString getDescription() const {return description;}
/**
* @brief setDescription set description for row
* @param value description
*/
inline void setDescription(const QString &value) {description = value;}
private:
/**
* @brief id identificator
*/
qint64 id;
/**
* @brief base value in base size and growth
*/
qreal base;
/**
* @brief ksize increment in sizes
*/
qreal ksize;
/**
* @brief kgrowth increment in growths
*/
qreal kgrowth;
/**
* @brief description description of increment
*/
QString description;
};

View File

@ -29,41 +29,147 @@
#ifndef VPOINTF_H
#define VPOINTF_H
/**
* @brief The VPointF class keep data of point.
*/
class VPointF
{
public:
/**
* @brief VPointF creat empty point
*/
inline VPointF ()
:_name(QString()), _mx(0), _my(0), _x(0), _y(0), mode(Draw::Calculation), idObject(0){}
/**
* @brief VPointF copy constructor
* @param point
*/
inline VPointF (const VPointF &point )
:_name(point.name()), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()),
mode(point.getMode()), idObject(point.getIdObject()){}
/**
* @brief VPointF create new point
* @param x x coordinate
* @param y y coordinate
* @param name name of point
* @param mx offset name respect to x
* @param my offset name respect to y
* @param mode mode of draw
* @param idObject point modeling keep here id of parent point
*/
inline VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my,
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0)
:_name(name), _mx(mx), _my(my), _x(x), _y(y), mode(mode), idObject(idObject){}
/**
* @brief operator = assignment operator
* @param point point
* @return point
*/
VPointF &operator=(const VPointF &point);
~VPointF(){}
/**
* @brief name return name of point
* @return name
*/
inline QString name() const { return _name;}
/**
* @brief mx return offset name respect to x
* @return offset
*/
inline qreal mx() const {return _mx;}
/**
* @brief my return offset name respect to y
* @return offset
*/
inline qreal my() const {return _my;}
/**
* @brief setName set name of point
* @param name name
*/
inline void setName(const QString &name) {_name = name;}
/**
* @brief setMx set offset name respect to x
* @param mx offset
*/
inline void setMx(qreal mx) {_mx = mx;}
/**
* @brief setMy set offset name respect to y
* @param my offset
*/
inline void setMy(qreal my) {_my = my;}
/**
* @brief toQPointF convert to QPointF
* @return QPointF point
*/
inline QPointF toQPointF()const {return QPointF(_x, _y);}
/**
* @brief x return x coordinate
* @return value
*/
inline qreal x() const {return _x;}
/**
* @brief setX set x coordinate
* @param value x coordinate
*/
inline void setX(const qreal &value){_x = value;}
/**
* @brief y return y coordinate
* @return value
*/
inline qreal y() const {return _y;}
/**
* @brief setY set y coordinate
* @param value y coordinate
*/
inline void setY(const qreal &value){_y = value;}
/**
* @brief getMode return mode of point
* @return mode
*/
inline Draw::Draws getMode() const{return mode;}
/**
* @brief setMode set mode for point
* @param value mode
*/
inline void setMode(const Draw::Draws &value) {mode = value;}
/**
* @brief getIdObject return id of parrent.
* @return id
*/
inline qint64 getIdObject() const {return idObject;}
/**
* @brief setIdObject set id of parent
* @param value id
*/
inline void setIdObject(const qint64 &value) {idObject = value;}
private:
/**
* @brief _name name of point
*/
QString _name;
/**
* @brief _mx offset name respect to x
*/
qreal _mx;
/**
* @brief _my offset name respect to y
*/
qreal _my;
/**
* @brief _x x coordinate
*/
qreal _x;
/**
* @brief _y y coordinate
*/
qreal _y;
/**
* @brief mode mode of point
*/
Draw::Draws mode;
/**
* @brief idObject id of parent. Only for point modeling. All another return 0.
*/
qint64 idObject;
};

View File

@ -26,10 +26,10 @@
**
*************************************************************************/
#include "vstandarttablecell.h"
#include "vstandarttablerow.h"
VStandartTableCell::VStandartTableCell()
VStandartTableRow::VStandartTableRow()
:base(0), ksize(0), kgrowth(0), description(QString()){}
VStandartTableCell::VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description)
VStandartTableRow::VStandartTableRow(qint32 base, qreal ksize, qreal kgrowth, QString description)
:base(base), ksize(ksize), kgrowth(kgrowth), description(description){}

View File

@ -26,23 +26,64 @@
**
*************************************************************************/
#ifndef VSTANDARTTABLECELL_H
#define VSTANDARTTABLECELL_H
#ifndef VSTANDARTTABLEROW_H
#define VSTANDARTTABLEROW_H
class VStandartTableCell
/**
* @brief The VStandartTableRow class keep data row of standart table
*/
class VStandartTableRow
{
public:
VStandartTableCell();
VStandartTableCell(qint32 base, qreal ksize, qreal kgrowth, QString description = QString());
/**
* @brief VStandartTableRow create empty row
*/
VStandartTableRow();
/**
* @brief VStandartTableRow create row
* @param base value in base size and growth
* @param ksize increment in sizes
* @param kgrowth increment in growths
* @param description description of increment
*/
VStandartTableRow(qint32 base, qreal ksize, qreal kgrowth, QString description = QString());
/**
* @brief GetBase return value in base size and growth
* @return value
*/
inline qint32 GetBase() const {return base;}
/**
* @brief GetKsize return increment in sizes
* @return increment
*/
inline qreal GetKsize() const {return ksize;}
/**
* @brief GetKgrowth return increment in growths
* @return increment
*/
inline qreal GetKgrowth() const {return kgrowth;}
/**
* @brief GetDescription return description
* @return description
*/
inline QString GetDescription() const {return description;}
private:
/**
* @brief base value in base size and growth
*/
qint32 base;
/**
* @brief ksize increment in sizes
*/
qreal ksize;
/**
* @brief kgrowth increment in growths
*/
qreal kgrowth;
/**
* @brief description description measurement
*/
QString description;
};
#endif // VSTANDARTTABLECELL_H
#endif // VSTANDARTTABLEROW_H

View File

@ -105,7 +105,7 @@ void DialogAlongLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
}
else
{
point = data->GetModelingPoint(id);
point = data->GetPointModeling(id);
}
if (number == 0)
{

View File

@ -36,34 +36,114 @@ namespace Ui
class DialogAlongLine;
}
/**
* @brief The DialogAlongLine class dialog for ToolAlongLine. Help create point and edit option.
*/
class DialogAlongLine : public DialogTool
{
Q_OBJECT
public:
/**
* @brief DialogAlongLine create dialog
* @param data container with data
* @param mode mode of creation tool
* @param parent parent widget
*/
DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogAlongLine();
/**
* @brief getPointName return name of point
* @return name
*/
inline QString getPointName() const {return pointName;}
/**
* @brief setPointName set name of point
* @param value name
*/
void setPointName(const QString &value);
/**
* @brief getTypeLine return type of line
* @return type
*/
inline QString getTypeLine() const {return typeLine;}
/**
* @brief setTypeLine set type of line
* @param value type
*/
void setTypeLine(const QString &value);
/**
* @brief getFormula return string of formula
* @return formula
*/
inline QString getFormula() const {return formula;}
/**
* @brief setFormula set string of formula
* @param value formula
*/
void setFormula(const QString &value);
/**
* @brief getFirstPointId return id first point of line
* @return id
*/
inline qint64 getFirstPointId() const {return firstPointId;}
/**
* @brief setFirstPointId set id first point of line
* @param value id
* @param id id of current point
*/
void setFirstPointId(const qint64 &value, const qint64 &id);
/**
* @brief getSecondPointId return id second point of line
* @return id
*/
inline qint64 getSecondPointId() const {return secondPointId;}
/**
* @brief setSecondPointId set id second point of line
* @param value id
* @param id id of current point
*/
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of point or detail
* @param type type of object
*/
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogAlongLine)
/**
* @brief ui keeps information about user interface
*/
Ui::DialogAlongLine *ui;
/**
* @brief number number of handled objects
*/
qint32 number;
/**
* @brief pointName name of point
*/
QString pointName;
/**
* @brief typeLine type of line
*/
QString typeLine;
/**
* @brief formula formula
*/
QString formula;
/**
* @brief firstPointId id first point of line
*/
qint64 firstPointId;
/**
* @brief secondPointId id second point of line
*/
qint64 secondPointId;
};

View File

@ -140,7 +140,7 @@ void DialogArc::ChoosedObject(qint64 id, const Scene::Scenes &type)
}
else
{
point = data->GetModelingPoint(id);
point = data->GetPointModeling(id);
}
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
emit ToolTip("");

207
src/dialogs/dialogarc.h Normal file
View File

@ -0,0 +1,207 @@
/************************************************************************
**
** @file dialogarc.h
** @author Roman Telezhinsky <dismine@gmail.com>
** @date November 15, 2013
**
** @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.
**
** Valentina is free software: you can redistribute it and/or modify
** 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.
**
** Valentina is distributed in the hope that it will be useful,
** 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/>.
**
*************************************************************************/
#ifndef DIALOGARC_H
#define DIALOGARC_H
#include "dialogtool.h"
namespace Ui
{
class DialogArc;
}
/**
* @brief The DialogArc class dialog for ToolArc. Help create arc and edit option.
*/
class DialogArc : public DialogTool
{
Q_OBJECT
public:
/**
* @brief DialogArc create dialog
* @param data container with data
* @param mode mode of creation tool
* @param parent parent widget
*/
DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogArc();
/**
* @brief GetCenter return id of center point
* @return id id
*/
inline qint64 GetCenter() const {return center;}
/**
* @brief SetCenter set id of center point
* @param value id
*/
void SetCenter(const qint64 &value);
/**
* @brief GetRadius return formula of radius
* @return formula
*/
inline QString GetRadius() const {return radius;}
/**
* @brief SetRadius set formula of radius
* @param value formula
*/
void SetRadius(const QString &value);
/**
* @brief GetF1 return formula first angle of arc
* @return formula
*/
inline QString GetF1() const {return f1;}
/**
* @brief SetF1 set formula first angle of arc
* @param value formula
*/
void SetF1(const QString &value);
/**
* @brief GetF2 return formula second angle of arc
* @return formula
*/
inline QString GetF2() const {return f2;}
/**
* @brief SetF2 set formula second angle of arc
* @param value formula
*/
void SetF2(const QString &value);
public slots:
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of point or detail
* @param type type of object
*/
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/**
* @brief ValChenged show description angles of lines
* @param row number of row
*/
virtual void ValChenged(int row);
/**
* @brief PutRadius put variable into formula of radius
*/
void PutRadius();
/**
* @brief PutF1 put variable into formula of first angle
*/
void PutF1();
/**
* @brief PutF2 put variable into formula of second angle
*/
void PutF2();
/**
* @brief LineAngles show variable angles of lines
*/
void LineAngles();
/**
* @brief RadiusChanged after change formula of radius calculate value and show result
*/
void RadiusChanged();
/**
* @brief F1Changed after change formula of first angle calculate value and show result
*/
void F1Changed();
/**
* @brief F2Changed after change formula of second angle calculate value and show result
*/
void F2Changed();
protected:
/**
* @brief CheckState if all is right enable button ok
*/
virtual void CheckState();
private:
Q_DISABLE_COPY(DialogArc)
/**
* @brief ui keeps information about user interface
*/
Ui::DialogArc *ui;
/**
* @brief flagRadius true if value of radius is correct
*/
bool flagRadius;
/**
* @brief flagF1 true if value of first angle is correct
*/
bool flagF1;
/**
* @brief flagF2 true if value of second angle is correct
*/
bool flagF2;
/**
* @brief timerRadius timer of check formula of radius
*/
QTimer *timerRadius;
/**
* @brief timerF1 timer of check formula of first angle
*/
QTimer *timerF1;
/**
* @brief timerF2 timer of check formula of second angle
*/
QTimer *timerF2;
/**
* @brief center id of center point
*/
qint64 center;
/**
* @brief radius formula of radius
*/
QString radius;
/**
* @brief f1 formula of first angle
*/
QString f1;
/**
* @brief f2 formula of second angle
*/
QString f2;
/**
* @brief EvalRadius calculate value of radius
*/
void EvalRadius();
/**
* @brief EvalF1 calculate value of first angle
*/
void EvalF1();
/**
* @brief EvalF2 calculate value of second angle
*/
void EvalF2();
/**
* @brief ShowLineAngles show varibles angles of lines
*/
void ShowLineAngles();
};
#endif // DIALOGARC_H

View File

@ -105,7 +105,7 @@ void DialogBisector::ChoosedObject(qint64 id, const Scene::Scenes &type)
}
else
{
point = data->GetModelingPoint(id);
point = data->GetPointModeling(id);
}
if (number == 0)
{

View File

@ -36,37 +36,129 @@ namespace Ui
class DialogBisector;
}
/**
* @brief The DialogBisector class dialog for ToolBisector. Help create point and edit option.
*/
class DialogBisector : public DialogTool
{
Q_OBJECT
public:
explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
/**
* @brief DialogBisector create dialog
* @param data container with data
* @param mode mode of creation tool
* @param parent parent widget
*/
DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogBisector();
/**
* @brief getPointName return name of point
* @return name
*/
QString getPointName() const {return pointName;}
/**
* @brief setPointName set name of point
* @param value name
*/
void setPointName(const QString &value);
/**
* @brief getTypeLine return type of line
* @return type
*/
inline QString getTypeLine() const {return typeLine;}
/**
* @brief setTypeLine set type of line
* @param value type
*/
void setTypeLine(const QString &value);
/**
* @brief getFormula return string of formula
* @return formula
*/
inline QString getFormula() const {return formula;}
/**
* @brief setFormula set string of formula
* @param value formula
*/
void setFormula(const QString &value);
/**
* @brief getFirstPointId return id of first point
* @return id
*/
inline qint64 getFirstPointId() const {return firstPointId;}
/**
* @brief setFirstPointId set id of first point
* @param value id
* @param id don't show this id in list
*/
void setFirstPointId(const qint64 &value, const qint64 &id);
/**
* @brief getSecondPointId return id of second point
* @return id
*/
inline qint64 getSecondPointId() const {return secondPointId;}
/**
* @brief setSecondPointId set id of second point
* @param value id
* @param id don't show this id in list
*/
void setSecondPointId(const qint64 &value, const qint64 &id);
/**
* @brief getThirdPointId return id of third point
* @return id
*/
inline qint64 getThirdPointId() const {return thirdPointId;}
/**
* @brief setThirdPointId set id of third point
* @param value id
* @param id don't show this id in list
*/
void setThirdPointId(const qint64 &value, const qint64 &id);
public slots:
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of point or detail
* @param type type of object
*/
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogBisector)
/**
* @brief ui keeps information about user interface
*/
Ui::DialogBisector *ui;
/**
* @brief number number of handled objects
*/
qint32 number;
/**
* @brief pointName name of point
*/
QString pointName;
/**
* @brief typeLine type of line
*/
QString typeLine;
/**
* @brief formula formula
*/
QString formula;
/**
* @brief firstPointId id of first point
*/
qint64 firstPointId;
/**
* @brief secondPointId id of second point
*/
qint64 secondPointId;
/**
* @brief thirdPointId id of third point
*/
qint64 thirdPointId;
};

View File

@ -122,7 +122,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
}
else
{
point = data->GetModelingPoint(id);
point = data->GetPointModeling(id);
}
name = point.name();
break;
@ -136,7 +136,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
}
else
{
arc = data->GetModelingArc(id);
arc = data->GetArcModeling(id);
}
name = arc.name();
break;
@ -150,7 +150,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
}
else
{
spl = data->GetModelingSpline(id);
spl = data->GetSplineModeling(id);
}
name = spl.GetName();
break;
@ -164,7 +164,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
}
else
{
splPath = data->GetModelingSplinePath(id);
splPath = data->GetSplinePathModeling(id);
}
name = splPath.name();
break;

View File

@ -32,26 +32,92 @@
#include "ui_dialogdetail.h"
#include "dialogtool.h"
/**
* @brief The DialogDetail class dialog for ToolDetai. Help create detail and edit option.
*/
class DialogDetail : public DialogTool
{
Q_OBJECT
public:
/**
* @brief DialogDetail create dialog
* @param data container with data
* @param mode mode of creation tool
* @param parent parent widget
*/
DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
/**
* @brief getDetails return detail
* @return detail
*/
inline VDetail getDetails() const {return details;}
/**
* @brief setDetails set detail
* @param value detail
*/
void setDetails(const VDetail &value);
public slots:
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of objects (points, arcs, splines, spline paths)
* @param type type of object
*/
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/**
* @brief BiasXChanged changed value of offset for object respect to x
* @param d value in mm
*/
void BiasXChanged(qreal d);
/**
* @brief BiasYChanged changed value of offset for object respect to y
* @param d value in mm
*/
void BiasYChanged(qreal d);
/**
* @brief ClickedSeams save supplement of seams for detail
* @param checked 1 - need supplement, 0 - don't need supplement
*/
void ClickedSeams(bool checked);
/**
* @brief ClickedClosed save closed equdistant or not
* @param checked 1 - closed, 0 - don't closed
*/
void ClickedClosed(bool checked);
/**
* @brief ObjectChanged changed new object (point, arc, spline or spline path) form list
* @param row number of row
*/
void ObjectChanged(int row);
private:
/**
* @brief ui keeps information about user interface
*/
Ui::DialogDetail ui;
/**
* @brief details detail
*/
VDetail details;
/**
* @brief supplement keep option supplement of seams
*/
bool supplement;
/**
* @brief closed keep option about equdistant (closed or not)
*/
bool closed;
/**
* @brief NewItem add new object (point, arc, spline or spline path) to list
* @param id id of object
* @param typeTool type of tool
* @param mode mode
* @param typeNode type of node in detail
* @param mx offset respect to x
* @param my offset respect to y
*/
void NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::Draws &mode,
const NodeDetail::NodeDetails &typeNode, qreal mx = 0, qreal my = 0);
};

View File

@ -115,7 +115,7 @@ void DialogEndLine::ChoosedObject(qint64 id, const Scene::Scenes &type)
}
else
{
point = data->GetModelingPoint(id);
point = data->GetPointModeling(id);
}
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
emit ToolTip("");

View File

@ -36,32 +36,108 @@ namespace Ui
class DialogEndLine;
}
/**
* @brief The DialogEndLine class dialog for ToolEndLine. Help create point and edit option.
*/
class DialogEndLine : public DialogTool
{
Q_OBJECT
public:
/**
* @brief DialogEndLine create dialog
* @param data container with data
* @param mode mode of creation tool
* @param parent parent widget
*/
DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogEndLine();
/**
* @brief getPointName return name of point
* @return name
*/
inline QString getPointName() const {return pointName;}
/**
* @brief setPointName set name of point
* @param value name
*/
void setPointName(const QString &value);
/**
* @brief getTypeLine return type of line
* @return type
*/
inline QString getTypeLine() const {return typeLine;}
/**
* @brief setTypeLine set type of line
* @param value type
*/
void setTypeLine(const QString &value);
/**
* @brief getFormula return string of formula
* @return formula
*/
inline QString getFormula() const {return formula;}
/**
* @brief setFormula set string of formula
* @param value formula
*/
void setFormula(const QString &value);
/**
* @brief getAngle return angle of line
* @return angle in degree
*/
inline qreal getAngle() const {return angle;}
/**
* @brief setAngle set angle of line
* @param value angle in degree
*/
void setAngle(const qreal &value);
/**
* @brief getBasePointId return id base point of line
* @return id
*/
inline qint64 getBasePointId() const {return basePointId;}
/**
* @brief setBasePointId set id base point of line
* @param value id
* @param id don't show this id in list
*/
void setBasePointId(const qint64 &value, const qint64 &id);
public slots:
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of point or detail
* @param type type of object
*/
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogEndLine)
/**
* @brief ui keeps information about user interface
*/
Ui::DialogEndLine *ui;
/**
* @brief pointName name of point
*/
QString pointName;
/**
* @brief typeLine type of line
*/
QString typeLine;
/**
* @brief formula formula
*/
QString formula;
/**
* @brief angle angle of line
*/
qreal angle;
/**
* @brief basePointId id base point of line
*/
qint64 basePointId;
};

View File

@ -109,7 +109,7 @@ void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type)
}
else
{
point = data->GetModelingPoint(id);
point = data->GetPointModeling(id);
}
switch (number)
{

View File

@ -36,34 +36,115 @@ namespace Ui
class DialogHeight;
}
/**
* @brief The DialogHeight class dialog for ToolHeight. Help create point and edit option.
*/
class DialogHeight : public DialogTool
{
Q_OBJECT
public:
/**
* @brief DialogHeight create dialog
* @param data container with data
* @param mode mode of creation tool
* @param parent parent widget
*/
DialogHeight(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogHeight();
/**
* @brief getPointName return name of point
* @return name
*/
inline QString getPointName() const {return pointName;}
/**
* @brief setPointName set name of point
* @param value name
*/
void setPointName(const QString &value);
/**
* @brief getTypeLine return type of line
* @return type
*/
inline QString getTypeLine() const {return typeLine;}
/**
* @brief setTypeLine set type of line
* @param value type
*/
void setTypeLine(const QString &value);
/**
* @brief getBasePointId return id base point of height
* @return id
*/
inline qint64 getBasePointId() const {return basePointId;}
/**
* @brief setBasePointId set id base point of height
* @param value id
* @param id don't show this id in list
*/
void setBasePointId(const qint64 &value, const qint64 &id);
/**
* @brief getP1LineId return id first point of line
* @return id id
*/
inline qint64 getP1LineId() const {return p1LineId;}
/**
* @brief setP1LineId set id first point of line
* @param value id
* @param id don't show this id in list
*/
void setP1LineId(const qint64 &value, const qint64 &id);
/**
* @brief getP2LineId return id second point of line
* @return id
*/
inline qint64 getP2LineId() const{return p2LineId;}
/**
* @brief setP2LineId set id second point of line
* @param value id
* @param id don't show this id in list
*/
void setP2LineId(const qint64 &value, const qint64 &id);
public slots:
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of point or detail
* @param type type of object
*/
virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogHeight)
/**
* @brief ui keeps information about user interface
*/
Ui::DialogHeight *ui;
/**
* @brief number number of handled objects
*/
qint32 number;
/**
* @brief pointName name of point
*/
QString pointName;
/**
* @brief typeLine type of line
*/
QString typeLine;
/**
* @brief basePointId id base point of height
*/
qint64 basePointId;
/**
* @brief p1LineId id first point of line
*/
qint64 p1LineId;
/**
* @brief p2LineId id second point of line
*/
qint64 p2LineId;
};

View File

@ -37,30 +37,90 @@ namespace Ui
class DialogHistory;
}
/**
* @brief The DialogHistory class show dialog history.
*/
class DialogHistory : public DialogTool
{
Q_OBJECT
public:
/**
* @brief DialogHistory create dialog
* @param data container with data
* @param doc dom document container
* @param parent parent widget
*/
DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0);
virtual ~DialogHistory();
public slots:
/**
* @brief DialogAccepted save data and emit signal about closed dialog.
*/
virtual void DialogAccepted();
/**
* @brief cellClicked changed history record
* @param row number row in table
* @param column number column in table
*/
void cellClicked(int row, int column);
/**
* @brief ChangedCursor changed cursor of input. Cursor show after what record we will insert new object
* @param id id of object
*/
void ChangedCursor(qint64 id);
/**
* @brief UpdateHistory update history table
*/
void UpdateHistory();
signals:
/**
* @brief ShowHistoryTool signal change color of selected in records tool
* @param id id of tool
* @param color new color of tool
* @param enable true enable selection, false disable selection
*/
void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
protected:
/**
* @brief closeEvent handle when windows is closing
* @param event event
*/
virtual void closeEvent ( QCloseEvent * event );
private:
Q_DISABLE_COPY(DialogHistory)
/**
* @brief ui keeps information about user interface
*/
Ui::DialogHistory *ui;
/**
* @brief doc dom document container
*/
VDomDocument *doc;
/**
* @brief cursorRow save number of row where is cursor
*/
qint32 cursorRow;
/**
* @brief cursorToolRecordRow save number of row selected record
*/
qint32 cursorToolRecordRow;
/**
* @brief FillTable fill table
*/
void FillTable();
/**
* @brief Record return description for record
* @param tool record data
* @return description
*/
QString Record(const VToolRecord &tool);
/**
* @brief InitialTable set initial option of table
*/
void InitialTable();
/**
* @brief ShowPoint show selected point
*/
void ShowPoint();
};

View File

@ -67,14 +67,14 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
void DialogIncrements::FillStandartTable()
{
const QHash<QString, VStandartTableCell> *standartTable = data->DataStandartTable();
const QHash<QString, VStandartTableRow> *standartTable = data->DataStandartTable();
qint32 currentRow = -1;
QHashIterator<QString, VStandartTableCell> i(*standartTable);
QHashIterator<QString, VStandartTableRow> i(*standartTable);
ui->tableWidgetStandart->setRowCount ( standartTable->size() );
while (i.hasNext())
{
i.next();
VStandartTableCell cell = i.value();
VStandartTableRow cell = i.value();
currentRow++;
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));

Some files were not shown because too many files have changed in this diff Show More