Merged default with feature

This commit is contained in:
dismine 2013-10-01 21:17:32 +03:00
commit 04632b26e5
138 changed files with 2338 additions and 2249 deletions

View File

@ -6,7 +6,7 @@
# Use out-of-source builds (shadow builds)
QT += core gui widgets xml svg printsupport
QT += core gui widgets xml svg
TARGET = Valentina
TEMPLATE = app
@ -234,10 +234,10 @@ CONFIG(debug, debug|release){
# Debug
QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtWidgets" \
-isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \
-isystem "/usr/include/qt5/QtCore" -O0 -Wall -Wextra -pedantic -Weffc++ \
-isystem "$$OUT_PWD/uic" \
-Woverloaded-virtual -Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast \
-Wconversion -Wsign-conversion -Winit-self -Wunreachable-code
-isystem "/usr/include/qt5/QtCore" -isystem "$$OUT_PWD/uic" -isystem "$$OUT_PWD/moc/" \
-Og -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \
-Wunreachable-code
}else{
# Release
QMAKE_CXXFLAGS += -O1
@ -249,6 +249,17 @@ CONFIG(debug, debug|release){
lrelease.CONFIG += no_link target_predeps
}
message(Qt version: $$[QT_VERSION])
message(Qt is installed in $$[QT_INSTALL_PREFIX])
message(Qt resources can be found in the following locations:)
message(Documentation: $$[QT_INSTALL_DOCS])
message(Header files: $$[QT_INSTALL_HEADERS])
message(Libraries: $$[QT_INSTALL_LIBS])
message(Binary files (executables): $$[QT_INSTALL_BINS])
message(Plugins: $$[QT_INSTALL_PLUGINS])
message(Data files: $$[QT_INSTALL_DATA])
message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
message(Settings: $$[QT_INSTALL_SETTINGS])
message(Examples: $$[QT_INSTALL_EXAMPLES])

View File

@ -20,7 +20,6 @@
****************************************************************************/
#include "calculator.h"
#include <cmath>
#include <QDebug>
#define DELIMITER 1

View File

@ -22,11 +22,7 @@
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include <QtGlobal>
#include <QString>
#include <QMap>
#include <QLineF>
#include <QPointF>
#include "vcontainer.h"
/**
@ -40,7 +36,7 @@ public:
* @brief Calculator конструктор класу. Використовується при розрахунку лекала.
* @param data покажчик на контейнер змінних
*/
Calculator(const VContainer *data);
explicit Calculator(const VContainer *data);
/**
* @brief eval виконує розрахунок формули.
* @param prog рядко в якому зберігається формула.
@ -48,8 +44,7 @@ public:
*/
qreal eval(QString prog, QString *errorMsg);
private:
Calculator(const Calculator &calc);
const Calculator &operator=(const Calculator &calc);
Q_DISABLE_COPY(Calculator)
QString *errorMsg;
/**
* @brief token теперішня лексема.

View File

@ -165,87 +165,17 @@ void VContainer::UpdateId(qint64 newId){
}
}
void VContainer::IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode){
switch( obj ){
case(Scene::Line):
break;
case(Scene::Point):{
VPointF point;
if(mode == Draw::Calculation){
point = GetPoint(id);
} else {
point = GetModelingPoint(id);
}
point.incrementReferens();
if(mode == Draw::Calculation){
UpdatePoint(id, point);
} else {
UpdateModelingPoint(id, point);
}
}
break;
case(Scene::Arc):{
VArc arc;
if(mode == Draw::Calculation){
arc = GetArc(id);
} else {
arc = GetModelingArc(id);
}
arc.incrementReferens();
if(mode == Draw::Calculation){
UpdateArc(id, arc);
} else {
UpdateModelingArc(id, arc);
}
}
break;
case(Scene::Spline):{
VSpline spl;
if(mode == Draw::Calculation){
spl = GetSpline(id);
} else {
spl = GetModelingSpline(id);
}
spl.incrementReferens();
if(mode == Draw::Calculation){
UpdateSpline(id, spl);
} else {
UpdateModelingSpline(id, spl);
}
}
break;
case(Scene::SplinePath):{
VSplinePath splPath;
if(mode == Draw::Calculation){
splPath = GetSplinePath(id);
} else {
splPath = GetModelingSplinePath(id);
}
splPath.incrementReferens();
if(mode == Draw::Calculation){
UpdateSplinePath(id, splPath);
} else {
UpdateModelingSplinePath(id, splPath);
}
}
break;
default:
qWarning()<<"Get wrong scene type.";
break;
}
}
QPainterPath VContainer::ContourPath(qint64 idDetail) const{
VDetail detail = GetDetail(idDetail);
QVector<QPointF> points;
for(qint32 i = 0; i< detail.CountNode(); ++i){
switch(detail[i].getTypeTool()){
case(Tools::NodePoint):{
case(Tool::NodePoint):{
VPointF point = GetModelingPoint(detail[i].getId());
points.append(point.toQPointF());
}
break;
case(Tools::NodeArc):{
case(Tool::NodeArc):{
VArc arc = GetModelingArc(detail[i].getId());
qreal len1 = GetLengthContour(points, arc.GetPoints());
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
@ -256,7 +186,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
}
}
break;
case(Tools::NodeSpline):{
case(Tool::NodeSpline):{
VSpline spline = GetModelingSpline(detail[i].getId());
qreal len1 = GetLengthContour(points, spline.GetPoints());
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
@ -267,7 +197,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
}
}
break;
case(Tools::NodeSplinePath):{
case(Tool::NodeSplinePath):{
VSplinePath splinePath = GetModelingSplinePath(detail[i].getId());
qreal len1 = GetLengthContour(points, splinePath.GetPathPoints());
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
@ -701,7 +631,7 @@ const QMap<qint64, VDetail> *VContainer::DataDetails() const{
return &details;
}
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Mode mode){
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameLine(firstPointId, secondPointId, mode);
VPointF first;
VPointF second;
@ -760,7 +690,7 @@ qint64 VContainer::AddModelingArc(const VArc &arc){
return AddObject(modelingArcs, arc);
}
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Mode mode) const{
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint, Draw::Draws mode) const{
VPointF first;
VPointF second;
if(mode == Draw::Calculation){
@ -774,7 +704,7 @@ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPo
}
QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode) const{
Draw::Draws mode) const{
VPointF first;
VPointF second;
if(mode == Draw::Calculation){
@ -788,7 +718,7 @@ QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &sec
}
QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode) const{
Draw::Draws mode) const{
VPointF first;
VPointF second;
if(mode == Draw::Calculation){
@ -801,7 +731,7 @@ QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &second
return QString("Spl_%1_%2").arg(first.name(), second.name());
}
QString VContainer::GetNameSplinePath(const VSplinePath &path, Draw::Mode mode) const{
QString VContainer::GetNameSplinePath(const VSplinePath &path, Draw::Draws mode) const{
if(path.Count() == 0){
return QString();
}
@ -823,7 +753,7 @@ QString VContainer::GetNameSplinePath(const VSplinePath &path, Draw::Mode mode)
return name;
}
QString VContainer::GetNameArc(const qint64 &center, const qint64 &id, Draw::Mode mode) const{
QString VContainer::GetNameArc(const qint64 &center, const qint64 &id, Draw::Draws mode) const{
VPointF centerPoint;
if(mode == Draw::Calculation){
centerPoint = GetPoint(center);
@ -838,7 +768,7 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value){
lengthLines[name] = value;
}
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Mode mode){
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameSpline(firstPointId, secondPointId, mode);
VPointF first;
VPointF second;

View File

@ -22,13 +22,9 @@
#ifndef VCONTAINER_H
#define VCONTAINER_H
#include <QMap>
#include <QTableWidget>
#include "options.h"
#include "vpointf.h"
#include "vstandarttablecell.h"
#include "vincrementtablerow.h"
#include "geometry/vspline.h"
#include "geometry/varc.h"
#include "geometry/vsplinepath.h"
#include "geometry/vdetail.h"
@ -75,13 +71,13 @@ public:
void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell);
void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId,
Draw::Mode mode = Draw::Calculation);
Draw::Draws mode = Draw::Calculation);
void AddLengthSpline(const QString &name, const qreal &value);
void AddLengthArc(const qint64 &center, 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,
Draw::Mode mode = Draw::Calculation);
Draw::Draws mode = Draw::Calculation);
qint64 AddSpline(const VSpline& spl);
qint64 AddModelingSpline(const VSpline& spl);
qint64 AddSplinePath(const VSplinePath& splPath);
@ -89,15 +85,15 @@ public:
qint64 AddArc(const VArc& arc);
qint64 AddModelingArc(const VArc& arc);
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode = Draw::Calculation) const;
Draw::Draws mode = Draw::Calculation) const;
QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode = Draw::Calculation) const;
Draw::Draws mode = Draw::Calculation) const;
QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint,
Draw::Mode mode = Draw::Calculation) const;
Draw::Draws mode = Draw::Calculation) const;
QString GetNameSplinePath(const VSplinePath &path,
Draw::Mode mode = Draw::Calculation) const;
Draw::Draws mode = Draw::Calculation) const;
QString GetNameArc(const qint64 &center, const qint64 &id,
Draw::Mode mode = Draw::Calculation) 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);
@ -143,7 +139,6 @@ public:
const QMap<qint64, VSplinePath> *DataModelingSplinePaths() const;
const QMap<qint64, VDetail> *DataDetails() const;
static void UpdateId(qint64 newId);
void IncrementReferens(qint64 id, Scene::Type obj, Draw::Mode mode = Draw::Calculation);
QPainterPath ContourPath(qint64 idDetail) const;
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
const qreal &width)const;

View File

@ -21,106 +21,13 @@
#include "vpointf.h"
VPointF::VPointF():_name(QString()), _mx(0), _my(0), _x(0), _y(0), _referens(0), mode(Draw::Calculation),
idObject(0){
}
VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _my(point.my()),
_x(point.x()), _y(point.y()), _referens(point.referens()), mode(point.getMode()),
idObject(point.getIdObject()){
}
VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Mode mode, qint64 idObject):
_name(name), _mx(mx), _my(my), _x(x), _y(y), _referens(0), mode(mode), idObject(idObject){
}
VPointF &VPointF::operator =(const VPointF &point){
_name = point.name();
_mx = point.mx();
_my = point.my();
_x = point.x();
_y = point.y();
_referens = point.referens();
mode = point.getMode();
idObject = point.getIdObject();
return *this;
}
VPointF::~VPointF(){
}
QString VPointF::name() const{
return _name;
}
qreal VPointF::mx() const{
return _mx;
}
qreal VPointF::my() const{
return _my;
}
void VPointF::setName(const QString& name){
_name = name;
}
void VPointF::setMx(qreal mx){
_mx = mx;
}
void VPointF::setMy(qreal my){
_my = my;
}
QPointF VPointF::toQPointF()const{
return QPointF(_x, _y);
}
qreal VPointF::y() const{
return _y;
}
void VPointF::setY(const qreal &value){
_y = value;
}
qreal VPointF::x() const{
return _x;
}
void VPointF::setX(const qreal &value){
_x = value;
}
qint32 VPointF::referens() const{
return _referens;
}
void VPointF::incrementReferens(){
++_referens;
}
void VPointF::decrementReferens(){
if(_referens > 0){
--_referens;
}
}
Draw::Mode VPointF::getMode() const
{
return mode;
}
void VPointF::setMode(const Draw::Mode &value)
{
mode = value;
}
qint64 VPointF::getIdObject() const{
return idObject;
}
void VPointF::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -26,44 +26,41 @@
#include <QString>
#include "options.h"
class VPointF
{
class VPointF{
public:
VPointF();
VPointF (const VPointF &point );
VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Mode mode = Draw::Calculation,
qint64 idObject = 0);
VPointF &operator=(const VPointF &point);
~VPointF();
QString name() const;
qreal mx() const;
qreal my() const;
void setName(const QString &name);
void setMx(qreal mx);
void setMy(qreal my);
QPointF toQPointF()const;
qreal x() const;
void setX(const qreal &value);
qreal y() const;
void setY(const qreal &value);
qint32 referens() const;
void incrementReferens();
void decrementReferens();
Draw::Mode getMode() const;
void setMode(const Draw::Mode &value);
qint64 getIdObject() const;
void setIdObject(const qint64 &value);
inline VPointF ()
:_name(QString()), _mx(0), _my(0), _x(0), _y(0), mode(Draw::Calculation), idObject(0){}
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()){}
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){}
VPointF &operator=(const VPointF &point);
~VPointF(){}
inline QString name() const { return _name;}
inline qreal mx() const {return _mx;}
inline qreal my() const {return _my;}
inline void setName(const QString &name) {_name = name;}
inline void setMx(qreal mx) {_mx = mx;}
inline void setMy(qreal my) {_my = my;}
inline QPointF toQPointF()const {return QPointF(_x, _y);}
inline qreal x() const {return _x;}
inline void setX(const qreal &value){_x = value;}
inline qreal y() const {return _y;}
inline void setY(const qreal &value){_y = value;}
inline Draw::Draws getMode() const{return mode;}
inline void setMode(const Draw::Draws &value) {mode = value;}
inline qint64 getIdObject() const {return idObject;}
inline void setIdObject(const qint64 &value) {idObject = value;}
private:
QString _name;
qreal _mx;
qreal _my;
qreal _x;
qreal _y;
qint32 _referens;
Draw::Mode mode;
qint64 idObject;
QString _name;
qreal _mx;
qreal _my;
qreal _x;
qreal _y;
Draw::Draws mode;
qint64 idObject;
};
#endif // VPOINTF_H

View File

@ -22,7 +22,7 @@
#include "dialogalongline.h"
#include "ui_dialogalongline.h"
DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogAlongLine::DialogAlongLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogAlongLine), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0){
ui->setupUi(this);
@ -64,7 +64,7 @@ DialogAlongLine::~DialogAlongLine()
delete ui;
}
void DialogAlongLine::ChoosedObject(qint64 id, Scene::Type type){
void DialogAlongLine::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,8 +23,6 @@
#define DIALOGALONGLINE_H
#include "dialogtool.h"
#include "options.h"
#include "container/vcontainer.h"
#include "container/calculator.h"
namespace Ui {
@ -35,7 +33,7 @@ class DialogAlongLine : public DialogTool
{
Q_OBJECT
public:
explicit DialogAlongLine(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogAlongLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogAlongLine();
QString getPointName() const;
@ -49,9 +47,10 @@ public:
qint64 getSecondPointId() const;
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogAlongLine)
Ui::DialogAlongLine *ui;
qint32 number;
QString pointName;
@ -59,8 +58,6 @@ private:
QString formula;
qint64 firstPointId;
qint64 secondPointId;
DialogAlongLine(const DialogAlongLine &dialog);
const DialogAlongLine &operator=(const DialogAlongLine& dialog);
};
#endif // DIALOGALONGLINE_H

View File

@ -23,7 +23,7 @@
#include "ui_dialogarc.h"
#include "../container/calculator.h"
DialogArc::DialogArc(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
timerRadius(0), timerF1(0), timerF2(0), center(0), radius(QString()), f1(QString()), f2(QString()){
ui->setupUi(this);
@ -114,7 +114,7 @@ DialogArc::~DialogArc(){
delete ui;
}
void DialogArc::ChoosedObject(qint64 id, Scene::Type type){
void DialogArc::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,7 +23,6 @@
#define DIALOGARC_H
#include "dialogtool.h"
#include "container/vcontainer.h"
namespace Ui {
class DialogArc;
@ -33,7 +32,7 @@ class DialogArc : public DialogTool
{
Q_OBJECT
public:
explicit DialogArc(const VContainer *data, Draw::Mode mode = Draw::Calculation, QWidget *parent = 0);
explicit DialogArc(const VContainer *data, Draw::Draws mode = Draw::Calculation, QWidget *parent = 0);
~DialogArc();
qint64 GetCenter() const;
void SetCenter(const qint64 &value);
@ -48,7 +47,7 @@ public:
void SetF2(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
virtual void ValChenged(int row);
void PutRadius();
@ -61,6 +60,7 @@ public slots:
protected:
virtual void CheckState();
private:
Q_DISABLE_COPY(DialogArc)
Ui::DialogArc *ui;
bool flagRadius;
bool flagF1;
@ -76,8 +76,6 @@ private:
void EvalF1();
void EvalF2();
void ShowLineArcs();
DialogArc(const DialogArc &dialog);
const DialogArc &operator=(const DialogArc& dialog);
};
#endif // DIALOGARC_H

View File

@ -22,7 +22,7 @@
#include "dialogbisector.h"
#include "ui_dialogbisector.h"
DialogBisector::DialogBisector(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogBisector::DialogBisector(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogBisector), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0){
ui->setupUi(this);
@ -64,7 +64,7 @@ DialogBisector::~DialogBisector(){
delete ui;
}
void DialogBisector::ChoosedObject(qint64 id, Scene::Type type){
void DialogBisector::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,11 +23,7 @@
#define DIALOGBISECTOR_H
#include "dialogtool.h"
#include <QPushButton>
#include <QListWidgetItem>
#include <QTimer>
#include "options.h"
#include "container/vcontainer.h"
#include "container/calculator.h"
namespace Ui {
@ -39,7 +35,7 @@ class DialogBisector : public DialogTool
Q_OBJECT
public:
explicit DialogBisector(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogBisector(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogBisector();
QString getPointName() const;
@ -55,9 +51,10 @@ public:
qint64 getThirdPointId() const;
void setThirdPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogBisector)
Ui::DialogBisector *ui;
qint32 number;
QString pointName;
@ -66,8 +63,6 @@ private:
qint64 firstPointId;
qint64 secondPointId;
qint64 thirdPointId;
DialogBisector(const DialogBisector &dialog);
const DialogBisector &operator=(const DialogBisector& dialog);
};
#endif // DIALOGBISECTOR_H

View File

@ -22,7 +22,7 @@
#include "dialogdetail.h"
#include <QDebug>
DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(), details(VDetail()){
ui.setupUi(this);
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
@ -32,7 +32,7 @@ DialogDetail::DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *par
connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected);
}
void DialogDetail::ChoosedObject(qint64 id, Scene::Type type){
void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;
@ -47,16 +47,16 @@ void DialogDetail::ChoosedObject(qint64 id, Scene::Type type){
if(type != Scene::Line && type != Scene::Detail){
switch(type){
case(Scene::Arc):
NewItem(id, Tools::NodeArc, mode, NodeDetail::Contour);
NewItem(id, Tool::NodeArc, mode, NodeDetail::Contour);
break;
case(Scene::Point):
NewItem(id, Tools::NodePoint, mode, NodeDetail::Contour);
NewItem(id, Tool::NodePoint, mode, NodeDetail::Contour);
break;
case(Scene::Spline):
NewItem(id, Tools::NodeSpline, mode, NodeDetail::Contour);
NewItem(id, Tool::NodeSpline, mode, NodeDetail::Contour);
break;
case(Scene::SplinePath):
NewItem(id, Tools::NodeSplinePath, mode, NodeDetail::Contour);
NewItem(id, Tool::NodeSplinePath, mode, NodeDetail::Contour);
break;
default:
qWarning()<<"Get wrong scene object. Ignore.";
@ -76,10 +76,10 @@ void DialogDetail::DialogAccepted(){
emit DialogClosed(QDialog::Accepted);
}
void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode){
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){
QString name;
switch(typeTool){
case(Tools::NodePoint):{
case(Tool::NodePoint):{
VPointF point;
if(mode == Draw::Calculation){
point = data->GetPoint(id);
@ -89,7 +89,7 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod
name = point.name();
break;
}
case(Tools::NodeArc):{
case(Tool::NodeArc):{
VArc arc;
if(mode == Draw::Calculation){
arc = data->GetArc(id);
@ -99,7 +99,7 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod
name = data->GetNameArc(arc.GetCenter(), id, mode);
break;
}
case(Tools::NodeSpline):{
case(Tool::NodeSpline):{
VSpline spl;
if(mode == Draw::Calculation){
spl = data->GetSpline(id);
@ -109,7 +109,7 @@ void DialogDetail::NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, Nod
name = spl.GetName();
break;
}
case(Tools::NodeSplinePath):{
case(Tool::NodeSplinePath):{
VSplinePath splPath;
if(mode == Draw::Calculation){
splPath = data->GetSplinePath(id);

View File

@ -24,24 +24,22 @@
#include "ui_dialogdetail.h"
#include "dialogtool.h"
#include "container/vcontainer.h"
#include "geometry/vdetail.h"
class DialogDetail : public DialogTool
{
class DialogDetail : public DialogTool{
Q_OBJECT
public:
explicit DialogDetail(const VContainer *data, Draw::Mode mode, QWidget *parent = 0);
explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
VDetail getDetails() const;
void setDetails(const VDetail &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Ui::DialogDetail ui;
VDetail details;
void NewItem(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode);
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode);
};
#endif // DIALOGDETAIL_H

View File

@ -26,7 +26,7 @@
#include "container/vpointf.h"
#include "container/calculator.h"
DialogEndLine::DialogEndLine(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogEndLine::DialogEndLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogEndLine), pointName(QString()), typeLine(QString()),
formula(QString()), angle(0), basePointId(0){
ui->setupUi(this);
@ -79,7 +79,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, Draw::Mode mode, QWidget *p
connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged);
}
void DialogEndLine::ChoosedObject(qint64 id, Scene::Type type){
void DialogEndLine::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,11 +23,7 @@
#define DIALOGENDLINE_H
#include "dialogtool.h"
#include <QPushButton>
#include <QListWidgetItem>
#include <QTimer>
#include "options.h"
#include "container/vcontainer.h"
#include "container/calculator.h"
namespace Ui {
@ -38,7 +34,7 @@ class DialogEndLine : public DialogTool
{
Q_OBJECT
public:
explicit DialogEndLine(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogEndLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogEndLine();
QString getPointName() const;
@ -52,17 +48,16 @@ public:
qint64 getBasePointId() const;
void setBasePointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogEndLine)
Ui::DialogEndLine *ui;
QString pointName;
QString typeLine;
QString formula;
qreal angle;
qint64 basePointId;
DialogEndLine(const DialogEndLine &dialog);
const DialogEndLine &operator=(const DialogEndLine& dialog);
};
#endif // DIALOGENDLINE_H

View File

@ -144,12 +144,12 @@ QString DialogHistory::Record(const VToolRecord &tool){
qint64 center = 0;
QDomElement domElement;
switch( tool.getTypeTool() ){
case Tools::ArrowTool:
case Tool::ArrowTool:
break;
case Tools::SinglePointTool:
case Tool::SinglePointTool:
record = QString("%1 - Базова точка").arg(data->GetPoint(tool.getId()).name());
break;
case Tools::EndLineTool:
case Tool::EndLineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("basePoint", "").toLongLong();
@ -157,7 +157,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
record = QString("%1_%2 - Відрізок з точки %1 до точки %2").arg(data->GetPoint(basePointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::LineTool:
case Tool::LineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
@ -166,7 +166,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
record = QString("%1_%2 - Лінія з точки %1 до точки %2").arg(data->GetPoint(firstPointId).name(),
data->GetPoint(secondPointId).name());
break;
case Tools::AlongLineTool:
case Tool::AlongLineTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("firstPoint", "").toLongLong();
@ -176,10 +176,10 @@ QString DialogHistory::Record(const VToolRecord &tool){
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::ShoulderPointTool:
case Tool::ShoulderPointTool:
record = QString("%1 - Плечева точка").arg(data->GetPoint(tool.getId()).name());
break;
case Tools::NormalTool:
case Tool::NormalTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
basePointId = domElement.attribute("firstPoint", "").toLongLong();
@ -189,7 +189,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
data->GetPoint(secondPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::BisectorTool:
case Tool::BisectorTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
@ -201,7 +201,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
data->GetPoint(thirdPointId).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::LineIntersectTool:
case Tool::LineIntersectTool:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
@ -215,18 +215,18 @@ QString DialogHistory::Record(const VToolRecord &tool){
data->GetPoint(p2Line2).name(),
data->GetPoint(tool.getId()).name());
break;
case Tools::SplineTool:{
case Tool::SplineTool:{
VSpline spl = data->GetSpline(tool.getId());
record = QString("Сплайн %1_%2").arg(data->GetPoint(spl.GetP1()).name(),
data->GetPoint(spl.GetP4()).name());
}
break;
case Tools::ArcTool:{
case Tool::ArcTool:{
VArc arc = data->GetArc(tool.getId());
record = QString("Дуга з центром в точці %1").arg(data->GetPoint(arc.GetCenter()).name());
}
break;
case Tools::SplinePathTool:{
case Tool::SplinePathTool:{
VSplinePath splPath = data->GetSplinePath(tool.getId());
QVector<VSplinePoint> points = splPath.GetSplinePath();
if(points.size() != 0 ){
@ -238,7 +238,7 @@ QString DialogHistory::Record(const VToolRecord &tool){
}
}
break;
case Tools::PointOfContact:
case Tool::PointOfContact:
domElement = doc->elementById(QString().setNum(tool.getId()));
if(domElement.isElement()){
center = domElement.attribute("center", "").toLongLong();

View File

@ -46,6 +46,7 @@ signals:
protected:
virtual void closeEvent ( QCloseEvent * event );
private:
Q_DISABLE_COPY(DialogHistory)
Ui::DialogHistory *ui;
VDomDocument *doc;
qint32 cursorRow;
@ -54,8 +55,6 @@ private:
QString Record(const VToolRecord &tool);
void InitialTable();
void ShowPoint();
DialogHistory(const DialogHistory &dialog);
const DialogHistory &operator=(const DialogHistory& dialog);
};
#endif // DIALOGHISTORY_H

View File

@ -23,9 +23,7 @@
#define DIALOGINCREMENTS_H
#include "dialogtool.h"
#include <QPushButton>
#include "xml/vdomdocument.h"
#include "container/vcontainer.h"
namespace Ui {
class DialogIncrements;
@ -47,6 +45,7 @@ signals:
void FullUpdateTree();
void haveLiteChange();
private:
Q_DISABLE_COPY(DialogIncrements)
Ui::DialogIncrements *ui;
VContainer *data; // need because we must change data
VDomDocument *doc;
@ -62,8 +61,6 @@ private:
void FillLengthArcs();
void AddIncrementToFile(qint64 id, QString name, qint32 base, qreal ksize, qreal kgrowth,
QString description);
DialogIncrements(const DialogIncrements &dialog);
const DialogIncrements &operator=(const DialogIncrements& dialog);
};
#endif // DIALOGINCREMENTS_H

View File

@ -24,7 +24,7 @@
#include <QPushButton>
#include <QCloseEvent>
DialogLine::DialogLine(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogLine::DialogLine(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0){
ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
@ -75,7 +75,7 @@ void DialogLine::DialogAccepted(){
DialogClosed(QDialog::Accepted);
}
void DialogLine::ChoosedObject(qint64 id, Scene::Type type){
void DialogLine::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,10 +23,6 @@
#define DIALOGLINE_H
#include "dialogtool.h"
#include <QComboBox>
#include "container/vcontainer.h"
#include "options.h"
namespace Ui {
class DialogLine;
@ -36,7 +32,7 @@ class DialogLine : public DialogTool
{
Q_OBJECT
public:
explicit DialogLine(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogLine(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogLine();
qint64 getFirstPoint() const;
@ -44,15 +40,14 @@ public:
qint64 getSecondPoint() const;
void setSecondPoint(const qint64 &value);
public slots:
void ChoosedObject(qint64 id, Scene::Type type);
void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogLine)
Ui::DialogLine *ui;
qint32 number;
qint64 firstPoint;
qint64 secondPoint;
DialogLine(const DialogLine &dialog);
const DialogLine &operator=(const DialogLine& dialog);
};
#endif // DIALOGLINE_H

View File

@ -22,7 +22,7 @@
#include "dialoglineintersect.h"
#include "ui_dialoglineintersect.h"
DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogLineIntersect::DialogLineIntersect(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogLineIntersect), number(0), pointName(QString()),
p1Line1(0), p2Line1(0), p1Line2(0), p2Line2(0), flagPoint(true){
ui->setupUi(this);
@ -45,7 +45,7 @@ DialogLineIntersect::~DialogLineIntersect()
delete ui;
}
void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Type type){
void DialogLineIntersect::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -32,7 +32,7 @@ class DialogLineIntersect : public DialogTool
{
Q_OBJECT
public:
explicit DialogLineIntersect(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogLineIntersect(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogLineIntersect();
qint64 getP1Line1() const;
@ -46,13 +46,14 @@ public:
QString getPointName() const;
void setPointName(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
void P1Line1Changed( int index);
void P2Line1Changed( int index);
void P1Line2Changed( int index);
void P2Line2Changed( int index);
private:
Q_DISABLE_COPY(DialogLineIntersect)
Ui::DialogLineIntersect *ui;
qint32 number;
QString pointName;
@ -63,8 +64,6 @@ private:
bool flagPoint;
virtual void CheckState();
bool CheckIntersecion();
DialogLineIntersect(const DialogLineIntersect &dialog);
const DialogLineIntersect &operator=(const DialogLineIntersect& dialog);
};
#endif // DIALOGLINEINTERSECT_H

View File

@ -23,7 +23,7 @@
#include "ui_dialognormal.h"
#include <QMenu>
DialogNormal::DialogNormal(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogNormal::DialogNormal(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogNormal), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0){
ui->setupUi(this);
@ -82,7 +82,7 @@ DialogNormal::~DialogNormal()
delete ui;
}
void DialogNormal::ChoosedObject(qint64 id, Scene::Type type){
void DialogNormal::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,11 +23,7 @@
#define DIALOGNORMAL_H
#include "dialogtool.h"
#include <QPushButton>
#include <QListWidgetItem>
#include <QTimer>
#include "options.h"
#include "container/vcontainer.h"
#include "container/calculator.h"
namespace Ui {
@ -38,7 +34,7 @@ class DialogNormal : public DialogTool
{
Q_OBJECT
public:
explicit DialogNormal(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogNormal(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogNormal();
QString getPointName() const;
@ -54,9 +50,10 @@ public:
qint64 getSecondPointId() const;
void setSecondPointId(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogNormal)
Ui::DialogNormal *ui;
qint32 number;
QString pointName;
@ -65,8 +62,6 @@ private:
qreal angle;
qint64 firstPointId;
qint64 secondPointId;
DialogNormal(const DialogNormal &dialog);
const DialogNormal &operator=(const DialogNormal& dialog);
};
#endif // DIALOGNORMAL_H

View File

@ -21,7 +21,7 @@
#include "dialogpointofcontact.h"
DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(), number(0), pointName(QString()), radius(QString()), center(0),
firstPoint(0), secondPoint(0){
ui.setupUi(this);
@ -58,7 +58,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, Draw::Mode mo
connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged);
}
void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Type type){
void DialogPointOfContact::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -24,8 +24,6 @@
#include "ui_dialogpointofcontact.h"
#include "dialogtool.h"
#include "options.h"
#include "container/vcontainer.h"
#include "container/calculator.h"
class DialogPointOfContact : public DialogTool
@ -33,7 +31,7 @@ class DialogPointOfContact : public DialogTool
Q_OBJECT
public:
explicit DialogPointOfContact(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogPointOfContact(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
QString getPointName() const;
void setPointName(const QString &value);
@ -51,9 +49,10 @@ public:
void setSecondPoint(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogPointOfContact)
Ui::DialogPointOfContact ui;
qint32 number;
QString pointName;
@ -61,8 +60,6 @@ private:
qint64 center;
qint64 firstPoint;
qint64 secondPoint;
DialogPointOfContact(const DialogPointOfContact &dialog);
const DialogPointOfContact &operator=(const DialogPointOfContact& dialog);
};
#endif // DIALOGPOINTOFCONTACT_H

View File

@ -22,7 +22,7 @@
#include "dialogshoulderpoint.h"
#include "ui_dialogshoulderpoint.h"
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0){
ui->setupUi(this);
@ -66,7 +66,7 @@ DialogShoulderPoint::~DialogShoulderPoint()
delete ui;
}
void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Type type){
void DialogShoulderPoint::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,8 +23,6 @@
#define DIALOGSHOULDERPOINT_H
#include "dialogtool.h"
#include "options.h"
#include "container/vcontainer.h"
#include "container/calculator.h"
namespace Ui {
@ -35,7 +33,7 @@ class DialogShoulderPoint : public DialogTool
{
Q_OBJECT
public:
explicit DialogShoulderPoint(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogShoulderPoint(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogShoulderPoint();
QString getPointName() const;
@ -51,9 +49,10 @@ public:
qint64 getPShoulder() const;
void setPShoulder(const qint64 &value, const qint64 &id);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogShoulderPoint)
Ui::DialogShoulderPoint *ui;
qint32 number;
QString pointName;
@ -62,8 +61,6 @@ private:
qint64 p1Line;
qint64 p2Line;
qint64 pShoulder;
DialogShoulderPoint(const DialogShoulderPoint &dialog);
const DialogShoulderPoint &operator=(const DialogShoulderPoint& dialog);
};
#endif // DIALOGSHOULDERPOINT_H

View File

@ -23,7 +23,6 @@
#define DIALOGSINGLEPOINT_H
#include "dialogtool.h"
#include "container/vcontainer.h"
namespace Ui {
class DialogSinglePoint;
@ -42,11 +41,10 @@ public slots:
void mousePress(QPointF scenePos);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogSinglePoint)
Ui::DialogSinglePoint *ui;
QString name;
QPointF point;
DialogSinglePoint(const DialogSinglePoint &dialog);
const DialogSinglePoint &operator=(const DialogSinglePoint& dialog);
};
#endif // DIALOGSINGLEPOINT_H

View File

@ -22,7 +22,7 @@
#include "dialogspline.h"
#include "ui_dialogspline.h"
DialogSpline::DialogSpline(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogSpline::DialogSpline(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogSpline), number(0), p1(0), p4(0), angle1(0), angle2(0),
kAsm1(1), kAsm2(1), kCurve(1){
ui->setupUi(this);
@ -41,7 +41,7 @@ DialogSpline::~DialogSpline(){
delete ui;
}
void DialogSpline::ChoosedObject(qint64 id, Scene::Type type){
void DialogSpline::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,7 +23,6 @@
#define DIALOGSPLINE_H
#include "dialogtool.h"
#include "container/vcontainer.h"
namespace Ui {
class DialogSpline;
@ -33,7 +32,7 @@ class DialogSpline : public DialogTool
{
Q_OBJECT
public:
explicit DialogSpline(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogSpline(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogSpline();
qint64 getP1() const;
@ -51,9 +50,10 @@ public:
qreal getKCurve() const;
void setKCurve(const qreal &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
private:
Q_DISABLE_COPY(DialogSpline)
Ui::DialogSpline *ui;
qint32 number;
qint64 p1; // перша точка
@ -63,8 +63,6 @@ private:
qreal kAsm1;
qreal kAsm2;
qreal kCurve;
DialogSpline(const DialogSpline &dialog);
const DialogSpline &operator=(const DialogSpline& dialog);
};
#endif // DIALOGSPLINE_H

View File

@ -23,7 +23,7 @@
#include "ui_dialogsplinepath.h"
#include "geometry/vsplinepoint.h"
DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Mode mode, QWidget *parent) :
DialogSplinePath::DialogSplinePath(const VContainer *data, Draw::Draws mode, QWidget *parent) :
DialogTool(data, mode, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()){
ui->setupUi(this);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
@ -68,7 +68,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value){
}
void DialogSplinePath::ChoosedObject(qint64 id, Scene::Type type){
void DialogSplinePath::ChoosedObject(qint64 id, Scene::Scenes type){
if(idDetail == 0 && mode == Draw::Modeling){
if(type == Scene::Detail){
idDetail = id;

View File

@ -23,7 +23,6 @@
#define DIALOGSPLINEPATH_H
#include "dialogtool.h"
#include "container/vcontainer.h"
#include "geometry/vsplinepath.h"
namespace Ui {
@ -34,13 +33,13 @@ class DialogSplinePath : public DialogTool
{
Q_OBJECT
public:
explicit DialogSplinePath(const VContainer *data, Draw::Mode mode = Draw::Calculation,
explicit DialogSplinePath(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
~DialogSplinePath();
VSplinePath GetPath() const;
void SetPath(const VSplinePath &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
virtual void DialogAccepted();
void PointChenged(int row);
void currentPointChanged( int index );
@ -49,14 +48,13 @@ public slots:
void KAsm1Changed(qreal d);
void KAsm2Changed(qreal d);
private:
Q_DISABLE_COPY(DialogSplinePath)
Ui::DialogSplinePath *ui;
VSplinePath path;
void NewItem(qint64 id, qreal kAsm1, qreal angle, qreal kAsm2);
void DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2);
void EnableFields();
void SetAngle(qint32 angle);
DialogSplinePath(const DialogSplinePath &dialog);
const DialogSplinePath &operator=(const DialogSplinePath& dialog);
};
#endif // DIALOGSPLINEPATH_H

View File

@ -26,7 +26,7 @@
#include "geometry/vdetail.h"
#include <QDebug>
DialogTool::DialogTool(const VContainer *data, Draw::Mode mode, QWidget *parent):QDialog(parent), data(data),
DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent):QDialog(parent), data(data),
isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), spinBoxAngle(0),
lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0),
radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0),
@ -74,14 +74,14 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const{
}
VDetail det = data->GetDetail(idDetail);
for(qint32 i = 0; i< det.CountNode(); ++i){
if(det[i].getTypeTool() == Tools::NodePoint ||
det[i].getTypeTool() == Tools::AlongLineTool ||
det[i].getTypeTool() == Tools::BisectorTool ||
det[i].getTypeTool() == Tools::EndLineTool ||
det[i].getTypeTool() == Tools::LineIntersectTool ||
det[i].getTypeTool() == Tools::NormalTool ||
det[i].getTypeTool() == Tools::PointOfContact ||
det[i].getTypeTool() == Tools::ShoulderPointTool){
if(det[i].getTypeTool() == Tool::NodePoint ||
det[i].getTypeTool() == Tool::AlongLineTool ||
det[i].getTypeTool() == Tool::BisectorTool ||
det[i].getTypeTool() == Tool::EndLineTool ||
det[i].getTypeTool() == Tool::LineIntersectTool ||
det[i].getTypeTool() == Tool::NormalTool ||
det[i].getTypeTool() == Tool::PointOfContact ||
det[i].getTypeTool() == Tool::ShoulderPointTool){
if(det[i].getId() != id){
VPointF point = data->GetModelingPoint(det[i].getId());
box->addItem(point.name(), det[i].getId());
@ -200,7 +200,7 @@ void DialogTool::CheckState(){
}
void DialogTool::ChoosedObject(qint64 id, Scene::Type type){
void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){
Q_UNUSED(id);
Q_UNUSED(type);
}

View File

@ -32,13 +32,11 @@
#include <QRadioButton>
#include <QTimer>
#include "container/vcontainer.h"
#include "options.h"
class DialogTool : public QDialog
{
class DialogTool : public QDialog{
Q_OBJECT
public:
DialogTool(const VContainer *data, Draw::Mode mode = Draw::Calculation,
DialogTool(const VContainer *data, Draw::Draws mode = Draw::Calculation,
QWidget *parent = 0);
virtual ~DialogTool();
qint64 getIdDetail() const;
@ -46,7 +44,7 @@ public:
signals:
void DialogClosed(int result);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
void NamePointChanged();
virtual void DialogAccepted();
virtual void DialogRejected();
@ -69,6 +67,7 @@ public slots:
virtual void ValChenged(int row);
void UpdateList();
protected:
Q_DISABLE_COPY(DialogTool)
const VContainer *data;
bool isInitialized;
bool flagName;
@ -85,7 +84,7 @@ protected:
QRadioButton *radioButtonIncrements;
QRadioButton *radioButtonLengthLine;
qint64 idDetail;
Draw::Mode mode;
Draw::Draws mode;
bool CheckObject(const qint64 &id);
virtual void closeEvent ( QCloseEvent * event );
virtual void showEvent( QShowEvent *event );
@ -102,8 +101,6 @@ protected:
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;
DialogTool(const DialogTool &dialog);
DialogTool &operator=(const DialogTool &dialog);
};
#endif // DIALOGTOOL_H

View File

@ -23,7 +23,7 @@
#define VEXCEPTIONEMPTYPARAMETER_H
#include "vexception.h"
#include "QDomElement"
#include <QDomElement>
class VExceptionEmptyParameter : public VException
{

View File

@ -19,24 +19,22 @@
**
****************************************************************************/
#define _USE_MATH_DEFINES
#include <cmath>
#include "varc.h"
#include <QDebug>
VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
center(0), points(0), _referens(0), mode(Draw::Calculation), idObject(0){
center(0), points(0), mode(Draw::Calculation), idObject(0){
}
VArc::VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Mode mode, qint64 idObject)
qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws mode, qint64 idObject)
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
center(center), points(points), _referens(0), mode(mode), idObject(idObject){
center(center), points(points), mode(mode), idObject(idObject){
}
VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
formulaF2(arc.GetFormulaF2()), radius(arc.GetRadius()), formulaRadius(arc.GetFormulaRadius()),
center(arc.GetCenter()), points(arc.GetDataPoints()), _referens(0), mode(arc.getMode()),
center(arc.GetCenter()), points(arc.GetDataPoints()), mode(arc.getMode()),
idObject(arc.getIdObject()){
}
@ -50,7 +48,6 @@ VArc &VArc::operator =(const VArc &arc){
this->formulaRadius = arc.GetFormulaRadius();
this->center = arc.GetCenter();
this->mode = arc.getMode();
this->_referens = 0;
this->idObject = arc.getIdObject();
return *this;
}
@ -198,37 +195,18 @@ QVector<QPointF> VArc::SplOfArc(qint32 number) const{
return QVector<QPointF>();
}
qint32 VArc::referens() const{
return _referens;
}
void VArc::incrementReferens(){
++_referens;
}
void VArc::decrementReferens(){
if(_referens > 0){
--_referens;
}
}
Draw::Mode VArc::getMode() const
{
Draw::Draws VArc::getMode() const{
return mode;
}
void VArc::setMode(const Draw::Mode &value)
{
void VArc::setMode(const Draw::Draws &value){
mode = value;
}
qint64 VArc::getIdObject() const
{
qint64 VArc::getIdObject() const{
return idObject;
}
void VArc::setIdObject(const qint64 &value)
{
void VArc::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -22,10 +22,6 @@
#ifndef VARC_H
#define VARC_H
#include <QPainterPath>
#include <QVector>
#include <QMap>
#include "container/vpointf.h"
#include "vspline.h"
/**
@ -46,7 +42,7 @@ public:
*/
VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2 , QString formulaF2,
Draw::Mode mode = Draw::Calculation, qint64 idObject = 0);
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VArc(const VArc &arc);
VArc& operator= (const VArc &arc);
/**
@ -98,12 +94,8 @@ public:
qint32 NumberSplOfArc () const;
QVector<QPointF> GetPoints () const;
QVector<QPointF> SplOfArc( qint32 number ) const;
qint32 referens() const;
void incrementReferens();
void decrementReferens();
Draw::Mode getMode() const;
void setMode(const Draw::Mode &value);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
qint64 getIdObject() const;
void setIdObject(const qint64 &value);
@ -128,8 +120,7 @@ private:
*/
qint64 center;
const QMap<qint64, VPointF> *points;
qint32 _referens;
Draw::Mode mode;
Draw::Draws mode;
qint64 idObject;
};

View File

@ -27,22 +27,17 @@
#include <QString>
#include <QPainterPath>
namespace Detail{
enum Contour
{
OpenContour,
CloseContour
};
namespace Detail {
enum Contour { OpenContour, CloseContour };
Q_DECLARE_FLAGS(Contours, Contour)
enum Equidistant
{
OpenEquidistant,
CloseEquidistant
};
enum Equidistant { OpenEquidistant, CloseEquidistant };
Q_DECLARE_FLAGS(Equidistants, Equidistant)
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Contours)
Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants)
class VDetail
{
class VDetail{
public:
VDetail();
VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
@ -53,13 +48,10 @@ public:
VNodeDetail & operator[](int indx);
QString getName() const;
void setName(const QString &value);
qreal getMx() const;
void setMx(const qreal &value);
qreal getMy() const;
void setMy(const qreal &value);
private:
QVector<VNodeDetail> nodes;
QString name;

View File

@ -21,11 +21,11 @@
#include "vnodedetail.h"
VNodeDetail::VNodeDetail():id(0), typeTool(Tools::NodePoint), mode(Draw::Calculation),
VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Calculation),
typeNode(NodeDetail::Contour){
}
VNodeDetail::VNodeDetail(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode):id(id),
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode):id(id),
typeTool(typeTool), mode(mode), typeNode(typeNode){
}
@ -33,11 +33,11 @@ VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(nod
mode(node.getMode()), typeNode(node.getTypeNode()){
}
Tools::Enum VNodeDetail::getTypeTool() const{
Tool::Tools VNodeDetail::getTypeTool() const{
return typeTool;
}
void VNodeDetail::setTypeTool(const Tools::Enum &value){
void VNodeDetail::setTypeTool(const Tool::Tools &value){
typeTool = value;
}
@ -49,18 +49,18 @@ void VNodeDetail::setId(const qint64 &value){
id = value;
}
Draw::Mode VNodeDetail::getMode() const{
Draw::Draws VNodeDetail::getMode() const{
return mode;
}
void VNodeDetail::setMode(const Draw::Mode &value){
void VNodeDetail::setMode(const Draw::Draws &value){
mode = value;
}
NodeDetail::Type VNodeDetail::getTypeNode() const{
NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{
return typeNode;
}
void VNodeDetail::setTypeNode(const NodeDetail::Type &value){
void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){
typeNode = value;
}

View File

@ -22,38 +22,35 @@
#ifndef VNODEDETAIL_H
#define VNODEDETAIL_H
#include <QtGlobal>
#include <QMetaType>
#include "options.h"
namespace NodeDetail{
enum Type
{
Contour,
Modeling
};
namespace NodeDetail {
enum NodeDetail { Contour, Modeling };
Q_DECLARE_FLAGS(NodeDetails, NodeDetail)
}
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails)
class VNodeDetail
{
public:
VNodeDetail();
VNodeDetail(qint64 id, Tools::Enum typeTool, Draw::Mode mode, NodeDetail::Type typeNode);
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode);
VNodeDetail(const VNodeDetail &node);
qint64 getId() const;
void setId(const qint64 &value);
Tools::Enum getTypeTool() const;
void setTypeTool(const Tools::Enum &value);
Draw::Mode getMode() const;
void setMode(const Draw::Mode &value);
NodeDetail::Type getTypeNode() const;
void setTypeNode(const NodeDetail::Type &value);
Tool::Tools getTypeTool() const;
void setTypeTool(const Tool::Tools &value);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
NodeDetail::NodeDetails getTypeNode() const;
void setTypeNode(const NodeDetail::NodeDetails &value);
private:
qint64 id;
Tools::Enum typeTool;
Draw::Mode mode;
NodeDetail::Type typeNode;
Tool::Tools typeTool;
Draw::Draws mode;
NodeDetail::NodeDetails typeNode;
};
Q_DECLARE_METATYPE(VNodeDetail)

View File

@ -19,31 +19,29 @@
**
****************************************************************************/
#define _USE_MATH_DEFINES
#include <cmath>
#include "vspline.h"
#include <QDebug>
VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
kCurve(1), points(0), _referens(0), mode(Draw::Calculation), idObject(0){
kCurve(1), points(0), mode(Draw::Calculation), idObject(0){
}
VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()),
p4(spline.GetP4 ()), angle1(spline.GetAngle1 ()), angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()),
kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()), points(spline.GetDataPoints()), _referens(0),
kAsm2(spline.GetKasm2()), kCurve(spline.GetKcurve()), points(spline.GetDataPoints()),
mode(spline.getMode()), idObject(spline.getIdObject()){
}
VSpline::VSpline (const QMap<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Mode mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()),
qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(QPointF()), p3(QPointF()),
p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(points),
_referens(0), mode(mode), idObject(idObject){
mode(mode), idObject(idObject){
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
}
VSpline::VSpline (const QMap<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
qreal kCurve, Draw::Mode mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
kCurve(1), points(points), _referens(0), mode(mode), idObject(idObject){
qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0),
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(points), mode(mode), idObject(idObject){
ModifiSpl ( p1, p2, p3, p4, kCurve);
}
@ -629,20 +627,6 @@ QPainterPath VSpline::GetPath() const{
return splinePath;
}
qint32 VSpline::referens() const{
return _referens;
}
void VSpline::incrementReferens(){
++_referens;
}
void VSpline::decrementReferens(){
if(_referens > 0){
--_referens;
}
}
/* Cubic equation solution. Real coefficients case.
int Cubic(double *x,double a,double b,double c);
@ -768,11 +752,11 @@ qint32 VSpline::Cubic(qreal *x, qreal a, qreal b, qreal c){
// this->ModifiSpl(P1, P2, P3, P4);
//}
Draw::Mode VSpline::getMode() const{
Draw::Draws VSpline::getMode() const{
return mode;
}
void VSpline::setMode(const Draw::Mode &value){
void VSpline::setMode(const Draw::Draws &value){
mode = value;
}
@ -811,7 +795,6 @@ VSpline &VSpline::operator =(const VSpline &spline){
this->kAsm2 = spline.GetKasm2();
this->kCurve = spline.GetKcurve();
this->points = spline.GetDataPoints();
this->_referens = 0;
this->mode = spline.getMode();
this->idObject = spline.getIdObject();
return *this;

View File

@ -28,7 +28,6 @@
#include <QVector>
#include <QMap>
#include "container/vpointf.h"
#include "options.h"
/**
* @brief VSpline клас, що реалізує сплайн.
@ -53,7 +52,7 @@ public:
*/
VSpline (const QMap<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1,
qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
Draw::Mode mode = Draw::Calculation, qint64 idObject = 0);
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
/**
* @brief VSpline конструктор.
* @param p1 початкова точка сплайну.
@ -62,7 +61,7 @@ public:
* @param p4 кінцева точка сплайну.
*/
VSpline (const QMap<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3,
qint64 p4, qreal kCurve, Draw::Mode mode = Draw::Calculation,
qint64 p4, qreal kCurve, Draw::Draws mode = Draw::Calculation,
qint64 idObject = 0);
/**
* @brief ModifiSpl модифікує сплайн.
@ -180,11 +179,8 @@ public:
* @param Pmirror точка відносно якої відбувається вертикальне дзеркалення сплайну.
*/
// void Mirror(const QPointF Pmirror);
qint32 referens() const;
void incrementReferens();
void decrementReferens();
Draw::Mode getMode() const;
void setMode(const Draw::Mode &value);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
static QVector<QPointF> SplinePoints(QPointF p1, QPointF p4, qreal angle1,
qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve);
qint64 getIdObject() const;
@ -229,8 +225,7 @@ private:
qreal kAsm2;
qreal kCurve;
const QMap<qint64, VPointF> *points;
qint32 _referens;
Draw::Mode mode;
Draw::Draws mode;
qint64 idObject;
/**
* @brief LengthBezier повертає дожину сплайну за його чотирьма точками.

View File

@ -20,25 +20,26 @@
****************************************************************************/
#include "vsplinepath.h"
#include "exception/vexception.h"
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(0),
_referens(0), idObject(0){
idObject(0){
}
VSplinePath::VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve, Draw::Mode mode, qint64 idObject): path(QVector<VSplinePoint>()),
kCurve(kCurve), mode(mode), points(points), _referens(0), idObject(idObject){
VSplinePath::VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()),
kCurve(kCurve), mode(mode), points(points), idObject(idObject){
}
VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()), _referens(0),
kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()),
idObject(splPath.getIdObject()){
}
Draw::Mode VSplinePath::getMode() const{
Draw::Draws VSplinePath::getMode() const{
return mode;
}
void VSplinePath::setMode(const Draw::Mode &value){
void VSplinePath::setMode(const Draw::Draws &value){
mode = value;
}
@ -60,10 +61,10 @@ qint32 VSplinePath::CountPoint() const{
VSpline VSplinePath::GetSpline(qint32 index) const{
if(Count()<1){
throw "Недостатня кількість точок для створення сплайну.";
throw VException(tr("Not enough points to create the spline."));
}
if(index < 1 || index > Count()){
throw "Такого сплайну немає.";
throw VException(tr("This spline is not exist."));
}
VSpline spl(points, path[index-1].P(), path[index].P(), path[index-1].Angle2(), path[index].Angle1(),
path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve);
@ -113,7 +114,7 @@ const QMap<qint64, VPointF> *VSplinePath::GetDataPoints() const{
void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point){
if(indexSpline < 1 || indexSpline > Count()){
throw "Такого сплайну немає.";
throw VException(tr("This spline is not exist."));
}
if(pos == SplinePoint::FirstPoint){
path[indexSpline-1] = point;
@ -124,7 +125,7 @@ void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSp
VSplinePoint VSplinePath::GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const{
if(indexSpline < 1 || indexSpline > Count()){
throw "Такого сплайну немає.";
throw VException(tr("This spline is not exist."));
}
if(pos == SplinePoint::FirstPoint){
return path.at(indexSpline-1);
@ -154,7 +155,6 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path){
this->kCurve = path.getKCurve();
this->mode = path.getMode();
this->points = path.GetDataPoints();
this->_referens = 0;
this->idObject = path.getIdObject();
return *this;
}
@ -163,26 +163,10 @@ VSplinePoint & VSplinePath::operator[](int indx){
return path[indx];
}
qint32 VSplinePath::referens() const{
return _referens;
qint64 VSplinePath::getIdObject() const{
return idObject;
}
void VSplinePath::incrementReferens(){
++_referens;
}
void VSplinePath::decrementReferens(){
if(_referens > 0){
--_referens;
}
}
qint64 VSplinePath::getIdObject() const
{
return idObject;
}
void VSplinePath::setIdObject(const qint64 &value)
{
idObject = value;
void VSplinePath::setIdObject(const qint64 &value){
idObject = value;
}

View File

@ -23,22 +23,20 @@
#define VSPLINEPATH_H
#include "vsplinepoint.h"
#include <QVector>
#include "vspline.h"
#include "options.h"
#include <QCoreApplication>
namespace SplinePoint{
enum Position
{
FirstPoint,
LastPoint
};
enum Position { FirstPoint, LastPoint };
Q_DECLARE_FLAGS(Positions, Position)
}
Q_DECLARE_OPERATORS_FOR_FLAGS( SplinePoint::Positions )
/**
* @brief The VSplinePath клас, що розраховує шлях сплайнів.
*/
class VSplinePath{
Q_DECLARE_TR_FUNCTIONS(VSplinePath)
public:
/**
* @brief VSplinePath конструктор по замовчуванню.
@ -48,7 +46,7 @@ public:
* @brief VSplinePath конструктор по замовчуванню.
*/
VSplinePath(const QMap<qint64, VPointF> *points, qreal kCurve = 1,
Draw::Mode mode = Draw::Calculation, qint64 idObject = 0);
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
VSplinePath(const VSplinePath& splPath);
/**
* @brief append додає точку сплайну до шляху.
@ -74,11 +72,8 @@ public:
const QVector<VSplinePoint> *GetPoint() const;
VSplinePath& operator=(const VSplinePath &path);
VSplinePoint & operator[](int indx);
qint32 referens() const;
void incrementReferens();
void decrementReferens();
Draw::Mode getMode() const;
void setMode(const Draw::Mode &value);
Draw::Draws getMode() const;
void setMode(const Draw::Draws &value);
qint64 getIdObject() const;
void setIdObject(const qint64 &value);
@ -89,9 +84,8 @@ protected:
*/
QVector<VSplinePoint> path;
qreal kCurve;
Draw::Mode mode;
Draw::Draws mode;
const QMap<qint64, VPointF> *points;
qint32 _referens;
qint64 idObject;
};

View File

@ -22,7 +22,6 @@
#ifndef VSPLINEPOINT_H
#define VSPLINEPOINT_H
#include "QtGlobal"
#include <QMetaType>
/**

View File

@ -20,7 +20,7 @@
****************************************************************************/
#include "mainwindow.h"
#include <QApplication>
#include "widgets/vapplication.h"
#include <QTextCodec>
#include "tablewindow.h"
@ -48,7 +48,7 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
int main(int argc, char *argv[]){
qInstallMessageHandler(myMessageOutput);
QApplication app(argc, argv);
VApplication app(argc, argv);
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),

View File

@ -37,7 +37,7 @@
#include "exception/vexceptionwrongparameterid.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow), tool(Tools::ArrowTool), currentScene(0), sceneDraw(0),
QMainWindow(parent), ui(new Ui::MainWindow), tool(Tool::ArrowTool), currentScene(0), sceneDraw(0),
sceneDetails(0), mouseCoordinate(0), helpLabel(0), view(0), isInitialized(false), dialogTable(0),
dialogEndLine(QSharedPointer<DialogEndLine>()), dialogLine(QSharedPointer<DialogLine>()),
dialogAlongLine(QSharedPointer<DialogAlongLine>()),
@ -152,7 +152,7 @@ void MainWindow::ActionNewDraw(){
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id, spoint);
VDrawTool::AddRecord(id, Tools::SinglePointTool, doc);
VDrawTool::AddRecord(id, Tool::SinglePointTool, doc);
SetEnableTool(true);
SetEnableWidgets(true);
changeInFile = true;
@ -191,7 +191,7 @@ void MainWindow::OptionDraw(){
}
template <typename Dialog, typename Func>
void MainWindow::SetToolButton(bool checked, Tools::Enum t, const QString &cursor,
void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &cursor,
QSharedPointer<Dialog> &dialog, Func closeDialogSlot){
if(checked){
CanselTool();
@ -211,8 +211,8 @@ void MainWindow::SetToolButton(bool checked, Tools::Enum t, const QString &curso
}
}
template <typename Tool>
void MainWindow::AddToolToDetail(Tool *tool, const qint64 &id, Tools::Enum typeTool,
template <typename T>
void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool,
const qint64 &idDetail){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VToolDetail *det = qobject_cast<VToolDetail*>(tools->value(idDetail));
@ -221,7 +221,7 @@ void MainWindow::AddToolToDetail(Tool *tool, const qint64 &id, Tools::Enum typeT
}
void MainWindow::ToolEndLine(bool checked){
SetToolButton(checked, Tools::EndLineTool, ":/cursor/endline_cursor.png", dialogEndLine,
SetToolButton(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", dialogEndLine,
&MainWindow::ClosedDialogEndLine);
}
@ -231,14 +231,14 @@ void MainWindow::ClosedDialogEndLine(int result){
VToolEndLine::Create(dialogEndLine, currentScene, doc, data);
} else {
VModelingEndLine *endLine = VModelingEndLine::Create(dialogEndLine, doc, data);
AddToolToDetail(endLine, endLine->getId(), Tools::EndLineTool, dialogEndLine->getIdDetail());
AddToolToDetail(endLine, endLine->getId(), Tool::EndLineTool, dialogEndLine->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolLine(bool checked){
SetToolButton(checked, Tools::LineTool, ":/cursor/line_cursor.png", dialogLine,
SetToolButton(checked, Tool::LineTool, ":/cursor/line_cursor.png", dialogLine,
&MainWindow::ClosedDialogLine);
}
@ -248,14 +248,14 @@ void MainWindow::ClosedDialogLine(int result){
VToolLine::Create(dialogLine, currentScene, doc, data);
} else {
VModelingLine *line = VModelingLine::Create(dialogLine, doc, data);
AddToolToDetail(line, line->getId(), Tools::LineTool, dialogLine->getIdDetail());
AddToolToDetail(line, line->getId(), Tool::LineTool, dialogLine->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolAlongLine(bool checked){
SetToolButton(checked, Tools::AlongLineTool, ":/cursor/alongline_cursor.png", dialogAlongLine,
SetToolButton(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", dialogAlongLine,
&MainWindow::ClosedDialogAlongLine);
}
@ -265,14 +265,14 @@ void MainWindow::ClosedDialogAlongLine(int result){
VToolAlongLine::Create(dialogAlongLine, currentScene, doc, data);
} else{
VModelingAlongLine *point = VModelingAlongLine::Create(dialogAlongLine, doc, data);
AddToolToDetail(point, point->getId(), Tools::AlongLineTool, dialogAlongLine->getIdDetail());
AddToolToDetail(point, point->getId(), Tool::AlongLineTool, dialogAlongLine->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolShoulderPoint(bool checked){
SetToolButton(checked, Tools::ShoulderPointTool, ":/cursor/shoulder_cursor.png", dialogShoulderPoint,
SetToolButton(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", dialogShoulderPoint,
&MainWindow::ClosedDialogShoulderPoint);
}
@ -282,7 +282,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result){
VToolShoulderPoint::Create(dialogShoulderPoint, currentScene, doc, data);
} else {
VModelingShoulderPoint *point = VModelingShoulderPoint::Create(dialogShoulderPoint, doc, data);
AddToolToDetail(point, point->getId(), Tools::ShoulderPointTool,
AddToolToDetail(point, point->getId(), Tool::ShoulderPointTool,
dialogShoulderPoint->getIdDetail());
}
}
@ -290,7 +290,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result){
}
void MainWindow::ToolNormal(bool checked){
SetToolButton(checked, Tools::NormalTool, ":/cursor/normal_cursor.png", dialogNormal,
SetToolButton(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", dialogNormal,
&MainWindow::ClosedDialogNormal);
}
@ -300,14 +300,14 @@ void MainWindow::ClosedDialogNormal(int result){
VToolNormal::Create(dialogNormal, currentScene, doc, data);
} else {
VModelingNormal *point = VModelingNormal::Create(dialogNormal, doc, data);
AddToolToDetail(point, point->getId(), Tools::NormalTool, dialogNormal->getIdDetail());
AddToolToDetail(point, point->getId(), Tool::NormalTool, dialogNormal->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolBisector(bool checked){
SetToolButton(checked, Tools::BisectorTool, ":/cursor/bisector_cursor.png", dialogBisector,
SetToolButton(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", dialogBisector,
&MainWindow::ClosedDialogBisector);
}
@ -317,14 +317,14 @@ void MainWindow::ClosedDialogBisector(int result){
VToolBisector::Create(dialogBisector, currentScene, doc, data);
} else {
VModelingBisector *point = VModelingBisector::Create(dialogBisector, doc, data);
AddToolToDetail(point, point->getId(), Tools::BisectorTool, dialogBisector->getIdDetail());
AddToolToDetail(point, point->getId(), Tool::BisectorTool, dialogBisector->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolLineIntersect(bool checked){
SetToolButton(checked, Tools::LineIntersectTool, ":/cursor/intersect_cursor.png", dialogLineIntersect,
SetToolButton(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", dialogLineIntersect,
&MainWindow::ClosedDialogLineIntersect);
}
@ -334,7 +334,7 @@ void MainWindow::ClosedDialogLineIntersect(int result){
VToolLineIntersect::Create(dialogLineIntersect, currentScene, doc, data);
} else {
VModelingLineIntersect *point = VModelingLineIntersect::Create(dialogLineIntersect, doc, data);
AddToolToDetail(point, point->getId(), Tools::LineIntersectTool,
AddToolToDetail(point, point->getId(), Tool::LineIntersectTool,
dialogLineIntersect->getIdDetail());
}
}
@ -342,7 +342,7 @@ void MainWindow::ClosedDialogLineIntersect(int result){
}
void MainWindow::ToolSpline(bool checked){
SetToolButton(checked, Tools::SplineTool, ":/cursor/spline_cursor.png", dialogSpline,
SetToolButton(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", dialogSpline,
&MainWindow::ClosedDialogSpline);
}
@ -352,14 +352,14 @@ void MainWindow::ClosedDialogSpline(int result){
VToolSpline::Create(dialogSpline, currentScene, doc, data);
} else {
VModelingSpline *spl = VModelingSpline::Create(dialogSpline, doc, data);
AddToolToDetail(spl, spl->getId(), Tools::SplineTool, dialogSpline->getIdDetail());
AddToolToDetail(spl, spl->getId(), Tool::SplineTool, dialogSpline->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolArc(bool checked){
SetToolButton(checked, Tools::ArcTool, ":/cursor/arc_cursor.png", dialogArc,
SetToolButton(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", dialogArc,
&MainWindow::ClosedDialogArc);
}
@ -369,14 +369,14 @@ void MainWindow::ClosedDialogArc(int result){
VToolArc::Create(dialogArc, currentScene, doc, data);
} else {
VModelingArc *arc = VModelingArc::Create(dialogArc, doc, data);
AddToolToDetail(arc, arc->getId(), Tools::ArcTool, dialogArc->getIdDetail());
AddToolToDetail(arc, arc->getId(), Tool::ArcTool, dialogArc->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolSplinePath(bool checked){
SetToolButton(checked, Tools::SplinePathTool, ":/cursor/splinepath_cursor.png", dialogSplinePath,
SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", dialogSplinePath,
&MainWindow::ClosedDialogSplinePath);
}
@ -386,14 +386,14 @@ void MainWindow::ClosedDialogSplinePath(int result){
VToolSplinePath::Create(dialogSplinePath, currentScene, doc, data);
} else {
VModelingSplinePath *spl = VModelingSplinePath::Create(dialogSplinePath, doc, data);
AddToolToDetail(spl, spl->getId(), Tools::SplinePathTool, dialogSplinePath->getIdDetail());
AddToolToDetail(spl, spl->getId(), Tool::SplinePathTool, dialogSplinePath->getIdDetail());
}
}
ArrowTool();
}
void MainWindow::ToolPointOfContact(bool checked){
SetToolButton(checked, Tools::PointOfContact, ":/cursor/pointcontact_cursor.png", dialogPointOfContact,
SetToolButton(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", dialogPointOfContact,
&MainWindow::ClosedDialogPointOfContact);
}
@ -404,7 +404,7 @@ void MainWindow::ClosedDialogPointOfContact(int result){
} else {
VModelingPointOfContact *point = VModelingPointOfContact::Create(dialogPointOfContact, doc,
data);
AddToolToDetail(point, point->getId(), Tools::PointOfContact,
AddToolToDetail(point, point->getId(), Tool::PointOfContact,
dialogPointOfContact->getIdDetail());
}
}
@ -414,7 +414,7 @@ void MainWindow::ClosedDialogPointOfContact(int result){
void MainWindow::ToolDetail(bool checked){
if(checked){
CanselTool();
tool = Tools::Detail;
tool = Tool::Detail;
QPixmap pixmap("://cursor/new_detail_cursor.png");
QCursor cur(pixmap, 2, 3);
view->setCursor(cur);
@ -575,79 +575,79 @@ void MainWindow::mouseMove(QPointF scenePos){
void MainWindow::CanselTool(){
switch( tool )
{
case Tools::ArrowTool:
case Tool::ArrowTool:
ui->actionArrowTool->setChecked(false);
break;
case Tools::SinglePointTool:
case Tool::SinglePointTool:
//Nothing to do here because we can't create this tool from main window.
break;
case Tools::EndLineTool:
case Tool::EndLineTool:
dialogEndLine.clear();
ui->toolButtonEndLine->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::LineTool:
case Tool::LineTool:
dialogLine.clear();
ui->toolButtonLine->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearFocus();
break;
case Tools::AlongLineTool:
case Tool::AlongLineTool:
dialogAlongLine.clear();
ui->toolButtonAlongLine->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::ShoulderPointTool:
case Tool::ShoulderPointTool:
dialogShoulderPoint.clear();
ui->toolButtonShoulderPoint->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::NormalTool:
case Tool::NormalTool:
dialogNormal.clear();
ui->toolButtonNormal->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::BisectorTool:
case Tool::BisectorTool:
dialogBisector.clear();
ui->toolButtonBisector->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::LineIntersectTool:
case Tool::LineIntersectTool:
dialogLineIntersect.clear();
ui->toolButtonLineIntersect->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::SplineTool:
case Tool::SplineTool:
dialogSpline.clear();
ui->toolButtonSpline->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::ArcTool:
case Tool::ArcTool:
dialogArc.clear();
ui->toolButtonArc->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::SplinePathTool:
case Tool::SplinePathTool:
dialogSplinePath.clear();
ui->toolButtonSplinePath->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::PointOfContact:
case Tool::PointOfContact:
dialogPointOfContact.clear();
ui->toolButtonPointOfContact->setChecked(false);
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
case Tools::Detail:
case Tool::Detail:
dialogDetail.clear();
ui->toolButtonNewDetail->setChecked(false);
break;
@ -660,7 +660,7 @@ void MainWindow::CanselTool(){
void MainWindow::ArrowTool(){
CanselTool();
ui->actionArrowTool->setChecked(true);
tool = Tools::ArrowTool;
tool = Tool::ArrowTool;
QCursor cur(Qt::ArrowCursor);
view->setCursor(cur);
helpLabel->setText("");
@ -729,7 +729,7 @@ void MainWindow::ActionSaveAs(){
QString filters("Lekalo files (*.xml);;All files (*.*)");
QString defaultFilter("Lekalo files (*.xml)");
QString fName = QFileDialog::getSaveFileName(this, "Зберегти файл як", QDir::homePath(),
filters, &defaultFilter);
filters, &defaultFilter);
if(fName.isEmpty())
return;
if(fName.indexOf(".xml",fName.size()-4)<0){

View File

@ -35,8 +35,6 @@
#include "tools/drawTools/drawtools.h"
#include "tools/modelingTools/modelingtools.h"
#include "xml/vdomdocument.h"
#include "container/vcontainer.h"
#include "options.h"
#include "tools/vtooldetail.h"
namespace Ui {
@ -111,8 +109,9 @@ protected:
virtual void closeEvent( QCloseEvent * event );
void Clear();
private:
Q_DISABLE_COPY(MainWindow)
Ui::MainWindow *ui;
Tools::Enum tool;
Tool::Tools tool;
VMainGraphicsScene *currentScene;
VMainGraphicsScene *sceneDraw;
VMainGraphicsScene *sceneDetails;
@ -139,9 +138,7 @@ private:
QComboBox *comboBoxDraws;
QString fileName;
bool changeInFile;
Draw::Mode mode;
MainWindow(const MainWindow &window);
const MainWindow &operator=(const MainWindow &window);
Draw::Draws mode;
void ToolBarOption();
void ToolBarDraws();
void CanselTool();
@ -149,12 +146,12 @@ private:
void SetEnableWidgets(bool enable);
void SetEnableTool(bool enable);
template <typename Dialog, typename Func>
void SetToolButton(bool checked, Tools::Enum t, const QString &cursor,
void SetToolButton(bool checked, Tool::Tools t, const QString &cursor,
QSharedPointer<Dialog> &dialog,
Func closeDialogSlot);
void MinimumScrollBar();
template <typename Tool>
void AddToolToDetail(Tool *tool, const qint64 &id, Tools::Enum typeTool,
template <typename T>
void AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool,
const qint64 &idDetail);
};

View File

@ -22,7 +22,7 @@
#ifndef OPTIONS_H
#define OPTIONS_H
#include <QtGlobal>
#include <QFlags>
#define PrintDPI 96
#define PaperSize 50000
@ -31,49 +31,44 @@
#define widthMainLine toPixel(0.8)
#define widthHairLine widthMainLine/3
namespace Scene{
enum Type
{
Point,
Line,
Spline,
Arc,
SplinePath,
Detail
};
enum Scene { Point, Line, Spline, Arc, SplinePath, Detail };
Q_DECLARE_FLAGS(Scenes, Scene)
}
Q_DECLARE_OPERATORS_FOR_FLAGS( Scene::Scenes )
namespace Tools{
enum Enum
{
ArrowTool,
SinglePointTool,
EndLineTool,
LineTool,
AlongLineTool,
ShoulderPointTool,
NormalTool,
BisectorTool,
LineIntersectTool,
SplineTool,
ArcTool,
SplinePathTool,
PointOfContact,
Detail,
NodePoint,
NodeArc,
NodeSpline,
NodeSplinePath
};
}
namespace Tool{
enum Tool {ArrowTool,
SinglePointTool,
EndLineTool,
LineTool,
AlongLineTool,
ShoulderPointTool,
NormalTool,
BisectorTool,
LineIntersectTool,
SplineTool,
ArcTool,
SplinePathTool,
PointOfContact,
Detail,
NodePoint,
NodeArc,
NodeSpline,
NodeSplinePath
};
Q_DECLARE_FLAGS(Tools, Tool)
namespace Draw{
enum Mode
{
Calculation,
Modeling
};
enum Source { FromGui, FromFile };
Q_DECLARE_FLAGS(Sources, Source)
}
Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Tools )
Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Sources )
namespace Draw {
enum Draw { Calculation, Modeling };
Q_DECLARE_FLAGS(Draws, Draw)
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Draw::Draws)
#endif // OPTIONS_H

View File

@ -27,8 +27,6 @@
#include <QFileDialog>
#include "options.h"
#include <QtSvg/QtSvg>
#undef PaperSize
#include <QtPrintSupport/QPrinter>
TableWindow::TableWindow(QWidget *parent) :
QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
@ -143,7 +141,7 @@ void TableWindow::StopTable(){
}
void TableWindow::saveScene(){
QString name = QFileDialog::getSaveFileName(0, "Зберегти розкладку", "", "Images (*.png);;Svg files (*.svg);;Ps files (*.ps)");
QString name = QFileDialog::getSaveFileName(0, "Зберегти розкладку", "", "Images (*.png);;Svg files (*.svg)");
if(name.isNull()){
return;
}
@ -164,8 +162,6 @@ void TableWindow::saveScene(){
SvgFile(name);
} else if(fi.suffix() == "png"){
PngFile(name);
} else if(fi.suffix() == "ps"){
PsFile(name);
}
// if(name.indexOf(".svg",name.size()-4)<0){
// name.append(".svg");
@ -348,28 +344,3 @@ void TableWindow::PngFile(const QString &name) const{
currentScene->render(&painter);
image.save(name);
}
void TableWindow::PsFile(const QString &name) const{
QPrinter printer(QPrinter::HighResolution);
//printer.setOutputFormat(QPrinter::PostScriptFormat);
printer.setOutputFileName(name);
QRectF r = paper->rect();
qreal x=0, y=0, w=0, h=0;
r.getRect(&x,&y,&w,&h);
printer.setResolution(PrintDPI);
qDebug()<<printer.resolution();
printer.setPaperSize ( QSizeF(w/printer.resolution()*25.4, h/printer.resolution()*25.4), QPrinter::Millimeter );
QPainter painter;
if (! painter.begin( &printer )) { // failed to open file
qCritical("Не можу відкрити файл %s",qPrintable(name));
return;
}
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
currentScene->render(&painter);
painter.end();
}

View File

@ -125,6 +125,7 @@ protected:
void showEvent ( QShowEvent * event );
void keyPressEvent ( QKeyEvent * event );
private:
Q_DISABLE_COPY(TableWindow)
/**
* @brief ui Змінна для доступу до об'єктів вікна.
*/
@ -181,8 +182,6 @@ private:
* @brief sceneRect Мінімальний розмір листа паперу що буде показуватися на сцені.
*/
QRectF sceneRect;
TableWindow(const TableWindow &window);
const TableWindow &operator=(const TableWindow& window);
void SvgFile(const QString &name)const;
void PngFile(const QString &name)const;
void PsFile(const QString &name)const;

View File

@ -36,7 +36,7 @@ VDrawTool::~VDrawTool(){
void VDrawTool::setDialog(){
}
void VDrawTool::AddRecord(const qint64 id, Tools::Enum toolType, VDomDocument *doc){
void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc){
qint64 cursor = doc->getCursor();
QVector<VToolRecord> *history = doc->getHistory();
if(cursor <= 0){

View File

@ -25,14 +25,13 @@
#include "../vabstracttool.h"
#include <QMenu>
class VDrawTool : public VAbstractTool
{
class VDrawTool : public VAbstractTool{
Q_OBJECT
public:
VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
virtual ~VDrawTool();
virtual void setDialog();
static void AddRecord(const qint64 id, Tools::Enum toolType, VDomDocument *doc);
static void AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc);
void ignoreContextMenu(bool enable);
public slots:
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
@ -51,12 +50,14 @@ protected:
if(!ignoreContextMenuEvent){
QMenu menu;
QAction *actionOption = menu.addAction(tr("Options"));
QAction *actionRemove;
QAction *actionRemove = 0;
if(showRemove){
actionRemove = menu.addAction(tr("Delete"));
} else {
actionRemove = menu.addAction(tr("Delete"));
actionRemove->setEnabled(false);
if(_referens > 1){
actionRemove->setEnabled(false);
} else {
actionRemove->setEnabled(true);
}
}
QAction *selectedAction = menu.exec(event->screenPos());
if(selectedAction == actionOption){
@ -73,6 +74,8 @@ protected:
dialog->show();
}
if(selectedAction == actionRemove){
//deincrement referens
RemoveReferens();
//remove form xml file
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){

View File

@ -21,13 +21,12 @@
#include "vtoolalongline.h"
#include <QDialog>
#include <QMenu>
#include <QDebug>
#include "container/calculator.h"
VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId,
const QString &typeLine, Tool::Enum typeCreation,
const QString &typeLine, Tool::Sources typeCreation,
QGraphicsItem *parent):
VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId),
dialogAlongLine(QSharedPointer<DialogAlongLine>()){
@ -65,12 +64,7 @@ void VToolAlongLine::FullUpdateFromGui(int result){
}
void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogAlongLine, this, event, false);
} else {
ContextMenu(dialogAlongLine, this, event);
}
ContextMenu(dialogAlongLine, this, event);
}
void VToolAlongLine::AddToFile(){
@ -91,6 +85,11 @@ void VToolAlongLine::AddToFile(){
AddToCalculation(domElement);
}
void VToolAlongLine::RemoveReferens(){
doc->DecrementReferens(secondPointId);
VToolLinePoint::RemoveReferens();
}
void VToolAlongLine::setDialog(){
Q_ASSERT(!dialogAlongLine.isNull());
if(!dialogAlongLine.isNull()){
@ -117,7 +116,7 @@ void VToolAlongLine::Create(QSharedPointer<DialogAlongLine> &dialog, VMainGraphi
void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
VPointF firstPoint = data->GetPoint(firstPointId);
VPointF secondPoint = data->GetPoint(secondPointId);
QLineF line = QLineF(firstPoint.toQPointF(), secondPoint.toQPointF());
@ -132,15 +131,10 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS
} else {
data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point);
}
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tools::AlongLineTool, doc);
VDrawTool::AddRecord(id, Tool::AlongLineTool, doc);
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);
if(parse == Document::FullParse){
@ -149,9 +143,9 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS
scene->addItem(point);
connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
}
}
}

View File

@ -31,21 +31,21 @@ class VToolAlongLine : public VToolLinePoint
public:
VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine,
Tool::Enum typeCreation, QGraphicsItem * parent = 0);
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogAlongLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 secondPointId;
QSharedPointer<DialogAlongLine> dialogAlongLine;

View File

@ -20,10 +20,9 @@
****************************************************************************/
#include "vtoolarc.h"
#include <QMenu>
#include "container/calculator.h"
VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent),
dialogArc(QSharedPointer<DialogArc>()){
VArc arc = data->GetArc(id);
@ -62,7 +61,7 @@ void VToolArc::Create(QSharedPointer<DialogArc> &dialog, VMainGraphicsScene *sce
void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &radius, const QString &f1,
const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
Calculator cal(data);
@ -91,23 +90,18 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &rad
} else {
data->UpdateArc(id, arc);
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Arc);
}
doc->UpdateToolData(id, data);
}
}
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
VDrawTool::AddRecord(id, Tools::ArcTool, doc);
VDrawTool::AddRecord(id, Tool::ArcTool, doc);
if(parse == Document::FullParse){
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
scene->addItem(toolArc);
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(toolArc, &VToolArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,toolArc);
doc->AddTool(id, toolArc);
doc->IncrementReferens(center);
}
}
@ -156,12 +150,7 @@ void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
}
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VArc arc = VDrawTool::data.GetArc(id);
if(arc.referens() > 1){
ContextMenu(dialogArc, this, event, false);
} else {
ContextMenu(dialogArc, this, event);
}
ContextMenu(dialogArc, this, event);
}
void VToolArc::AddToFile(){
@ -195,6 +184,11 @@ void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolArc::RemoveReferens(){
VArc arc = VAbstractTool::data.GetArc(id);
doc->DecrementReferens(arc.GetCenter());
}
void VToolArc::RefreshGeometry(){
VArc arc = VAbstractTool::data.GetArc(id);
QPainterPath path;

View File

@ -23,24 +23,23 @@
#define VTOOLARC_H
#include "vdrawtool.h"
#include "xml/vdomdocument.h"
#include <QGraphicsPathItem>
#include "dialogs/dialogarc.h"
#include "widgets/vcontrolpointspline.h"
#include "container/vcontainer.h"
class VToolArc :public VDrawTool, public QGraphicsPathItem
{
class VToolArc :public VDrawTool, public QGraphicsPathItem{
Q_OBJECT
public:
VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogArc> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VToolArc(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogArc> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc,
VContainer *data);
static void Create(const qint64 _id, const qint64 &center, const QString &radius,
const QString &f1, const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
static void Create(const qint64 _id, const qint64 &center, const QString &radius,
const QString &f1, const QString &f2, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
@ -52,6 +51,7 @@ protected:
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens();
private:
QSharedPointer<DialogArc> dialogArc;
void RefreshGeometry();

View File

@ -20,11 +20,10 @@
****************************************************************************/
#include "vtoolbisector.h"
#include <QMenu>
VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
QGraphicsItem *parent):
VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0),
thirdPointId(0), dialogBisector(QSharedPointer<DialogBisector>()){
@ -78,7 +77,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation){
const Document::Documents &parse, Tool::Sources typeCreation){
VPointF firstPoint = data->GetPoint(firstPointId);
VPointF secondPoint = data->GetPoint(secondPointId);
VPointF thirdPoint = data->GetPoint(thirdPointId);
@ -95,16 +94,11 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
} else {
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPointId, id);
VDrawTool::AddRecord(id, Tools::BisectorTool, doc);
VDrawTool::AddRecord(id, Tool::BisectorTool, doc);
if(parse == Document::FullParse){
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula,
firstPointId, secondPointId, thirdPointId,
@ -112,8 +106,10 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
scene->addItem(point);
connect(point, &VToolBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(thirdPointId);
}
}
}
@ -147,12 +143,7 @@ void VToolBisector::FullUpdateFromGui(int result){
}
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogBisector, this, event, false);
} else {
ContextMenu(dialogBisector, this, event);
}
ContextMenu(dialogBisector, this, event);
}
void VToolBisector::AddToFile(){
@ -173,3 +164,9 @@ void VToolBisector::AddToFile(){
AddToCalculation(domElement);
}
void VToolBisector::RemoveReferens(){
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(thirdPointId);
VToolLinePoint::RemoveReferens();
}

View File

@ -22,16 +22,14 @@
#ifndef VTOOLBISECTOR_H
#define VTOOLBISECTOR_H
#include <QSharedPointer>
#include "vtoollinepoint.h"
#include "dialogs/dialogbisector.h"
class VToolBisector : public VToolLinePoint
{
class VToolBisector : public VToolLinePoint{
public:
VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const QPointF &thirdPoint, const qreal& length);
@ -41,13 +39,15 @@ public:
static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 firstPointId;
qint64 thirdPointId;

View File

@ -26,7 +26,7 @@
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Enum typeCreation, QGraphicsItem *parent):
Tool::Sources typeCreation, QGraphicsItem *parent):
VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
dialogEndLine(QSharedPointer<DialogEndLine>()){
@ -61,7 +61,7 @@ void VToolEndLine::Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsSc
void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
VPointF basePoint = data->GetPoint(basePointId);
QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y()));
@ -77,24 +77,19 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
} else {
data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
Q_CHECK_PTR(tool);
data->IncrementReferens(id, Scene::Point);
tool->VDataTool::setData(data);
doc->UpdateToolData(id, data);
}
}
data->AddLine(basePointId, id);
VDrawTool::AddRecord(id, Tools::EndLineTool, doc);
VDrawTool::AddRecord(id, Tool::EndLineTool, doc);
if(parse == Document::FullParse){
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle,
basePointId, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(basePointId);
}
}
}
@ -111,12 +106,7 @@ void VToolEndLine::FullUpdateFromFile(){
}
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogEndLine, this, event, false);
} else {
ContextMenu(dialogEndLine, this, event);
}
ContextMenu(dialogEndLine, this, event);
}
void VToolEndLine::FullUpdateFromGui(int result){

View File

@ -22,25 +22,23 @@
#ifndef VTOOLENDLINE_H
#define VTOOLENDLINE_H
#include <QSharedPointer>
#include "vtoollinepoint.h"
#include "dialogs/dialogendline.h"
class VToolEndLine : public VToolLinePoint
{
class VToolEndLine : public VToolLinePoint{
Q_OBJECT
public:
VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Enum typeCreation,
const qint64 &basePointId, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogEndLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);

View File

@ -20,11 +20,10 @@
****************************************************************************/
#include "vtoolline.h"
#include <QMenu>
#include <QDebug>
VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint,
Tool::Enum typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id),
Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
dialogLine(QSharedPointer<DialogLine>()){
//Лінія
@ -53,20 +52,16 @@ void VToolLine::Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *s
}
void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation){
Q_CHECK_PTR(scene);
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
data->AddLine(firstPoint, secondPoint);
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
VDataTool *tool = tools->value(id);
Q_CHECK_PTR(tool);
tool->VDataTool::setData(data);
doc->UpdateToolData(id, data);
}
VDrawTool::AddRecord(id, Tools::LineTool, doc);
VDrawTool::AddRecord(id, Tool::LineTool, doc);
if(parse == Document::FullParse){
qint64 id = data->getNextId();
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
@ -74,8 +69,9 @@ void VToolLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64
scene->addItem(line);
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,line);
doc->AddTool(id, line);
doc->IncrementReferens(firstPoint);
doc->IncrementReferens(secondPoint);
}
}
@ -150,3 +146,8 @@ void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolLine::RemoveReferens(){
doc->DecrementReferens(firstPoint);
doc->DecrementReferens(secondPoint);
}

View File

@ -26,18 +26,17 @@
#include "QGraphicsLineItem"
#include "dialogs/dialogline.h"
class VToolLine: public VDrawTool, public QGraphicsLineItem
{
class VToolLine: public VDrawTool, public QGraphicsLineItem{
Q_OBJECT
public:
VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem * parent = 0);
qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString newName);
@ -48,6 +47,7 @@ protected:
virtual void AddToFile();
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens();
private:
qint64 firstPoint;
qint64 secondPoint;

View File

@ -24,7 +24,7 @@
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Enum typeCreation, QGraphicsItem *parent):
const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent):
VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2),
p2Line2(p2Line2), dialogLineIntersect(QSharedPointer<DialogLineIntersect>()){
if(typeCreation == Tool::FromGui){
@ -58,7 +58,7 @@ void VToolLineIntersect::Create(QSharedPointer<DialogLineIntersect> &dialog, VMa
void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
VPointF p1Line1 = data->GetPoint(p1Line1Id);
VPointF p2Line1 = data->GetPoint(p2Line1Id);
VPointF p1Line2 = data->GetPoint(p1Line2Id);
@ -75,19 +75,14 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
} else {
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(p1Line1Id, id);
data->AddLine(id, p2Line1Id);
data->AddLine(p1Line2Id, id);
data->AddLine(id, p2Line2Id);
VDrawTool::AddRecord(id, Tools::LineIntersectTool, doc);
VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc);
if(parse == Document::FullParse){
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id,
p2Line1Id, p1Line2Id,
@ -95,8 +90,11 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
scene->addItem(point);
connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(p1Line1Id);
doc->IncrementReferens(p2Line1Id);
doc->IncrementReferens(p1Line2Id);
doc->IncrementReferens(p2Line2Id);
}
}
}
@ -128,12 +126,7 @@ void VToolLineIntersect::FullUpdateFromGui(int result){
}
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogLineIntersect, this, event, false);
} else {
ContextMenu(dialogLineIntersect, this, event);
}
ContextMenu(dialogLineIntersect, this, event);
}
void VToolLineIntersect::AddToFile(){
@ -153,3 +146,10 @@ void VToolLineIntersect::AddToFile(){
AddToCalculation(domElement);
}
void VToolLineIntersect::RemoveReferens(){
doc->DecrementReferens(p1Line1);
doc->DecrementReferens(p2Line1);
doc->DecrementReferens(p1Line2);
doc->DecrementReferens(p2Line2);
}

View File

@ -25,29 +25,32 @@
#include "vtoolpoint.h"
#include "dialogs/dialoglineintersect.h"
class VToolLineIntersect:public VToolPoint
{
class VToolLineIntersect:public VToolPoint{
Q_OBJECT
public:
VToolLineIntersect(VDomDocument *doc, VContainer *data,
const qint64 &id,
const qint64 &p1Line1,
const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogLineIntersect> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc,VContainer *data);
static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
VToolLineIntersect(VDomDocument *doc, VContainer *data,
const qint64 &id,
const qint64 &p1Line1,
const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogLineIntersect> &dialog,
VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 _id, const qint64 &p1Line1Id,
const qint64 &p2Line1Id, const qint64 &p1Line2Id,
const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 p1Line1;
qint64 p2Line1;

View File

@ -60,3 +60,7 @@ void VToolLinePoint::RefreshGeometry(){
mainLine->setVisible(true);
}
}
void VToolLinePoint::RemoveReferens(){
doc->DecrementReferens(basePointId);
}

View File

@ -24,13 +24,12 @@
#include "vtoolpoint.h"
class VToolLinePoint : public VToolPoint
{
class VToolLinePoint : public VToolPoint{
Q_OBJECT
public:
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
public slots:
virtual void ChangedActivDraw(const QString newName);
protected:
@ -40,9 +39,9 @@ protected:
qint64 basePointId;
QGraphicsLineItem *mainLine;
virtual void RefreshGeometry();
virtual void RemoveReferens();
private:
VToolLinePoint(const VToolLinePoint &tool);
const VToolLinePoint &operator=(const VToolLinePoint &tool);
Q_DISABLE_COPY(VToolLinePoint)
};
#endif // VTOOLLINEPOINT_H

View File

@ -20,12 +20,11 @@
****************************************************************************/
#include "vtoolnormal.h"
#include <QMenu>
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent):
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent):
VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
secondPointId(secondPointId), dialogNormal(QSharedPointer<DialogNormal>()){
@ -63,7 +62,7 @@ void VToolNormal::Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScen
void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine, const QString pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation){
VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
VPointF firstPoint = data->GetPoint(firstPointId);
VPointF secondPoint = data->GetPoint(secondPointId);
Calculator cal(data);
@ -78,24 +77,20 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64
} else {
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPointId, id);
VDrawTool::AddRecord(id, Tools::NormalTool, doc);
VDrawTool::AddRecord(id, Tool::NormalTool, doc);
if(parse == Document::FullParse){
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,
firstPointId, secondPointId, typeCreation);
scene->addItem(point);
connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
}
}
}
@ -138,12 +133,7 @@ void VToolNormal::FullUpdateFromGui(int result){
}
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogNormal, this, event, false);
} else {
ContextMenu(dialogNormal, this, event);
}
ContextMenu(dialogNormal, this, event);
}
void VToolNormal::AddToFile(){
@ -164,3 +154,8 @@ void VToolNormal::AddToFile(){
AddToCalculation(domElement);
}
void VToolNormal::RemoveReferens(){
doc->DecrementReferens(secondPointId);
VToolLinePoint::RemoveReferens();
}

View File

@ -22,7 +22,6 @@
#ifndef VTOOLNORMAL_H
#define VTOOLNORMAL_H
#include <QSharedPointer>
#include "vtoollinepoint.h"
#include "dialogs/dialognormal.h"
@ -33,7 +32,7 @@ public:
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Enum typeCreation,
const qint64 &secondPointId, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
@ -41,7 +40,7 @@ public:
static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine, const QString pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const qreal &length, const qreal &angle = 0);
public slots:
@ -50,6 +49,7 @@ public slots:
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 secondPointId;
QSharedPointer<DialogNormal> dialogNormal;

View File

@ -24,7 +24,6 @@
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
#include "container/vpointf.h"
VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id,

View File

@ -24,14 +24,13 @@
#include "vdrawtool.h"
#include "widgets/vgraphicssimpletextitem.h"
#include "options.h"
class VToolPoint: public VDrawTool, public QGraphicsEllipseItem
{
class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{
Q_OBJECT
public:
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
virtual ~VToolPoint();
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id,
QGraphicsItem * parent = 0);
virtual ~VToolPoint();
public slots:
void NameChangePosition(const QPointF pos);
virtual void ChangedActivDraw(const QString newName);
@ -48,8 +47,7 @@ protected:
virtual void RefreshPointGeometry(const VPointF &point);
void RefreshLine();
private:
VToolPoint(const VToolPoint &tool);
const VToolPoint &operator=(const VToolPoint &tool);
Q_DISABLE_COPY(VToolPoint)
};
#endif // VTOOLPOINT_H

View File

@ -24,7 +24,7 @@
VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &radius, const qint64 &center,
const qint64 &firstPointId, const qint64 &secondPointId,
Tool::Enum typeCreation, QGraphicsItem *parent)
Tool::Sources typeCreation, QGraphicsItem *parent)
: VToolPoint(doc, data, id, parent), radius(radius), center(center), firstPointId(firstPointId),
secondPointId(secondPointId), dialogPointOfContact(QSharedPointer<DialogPointOfContact>()){
@ -82,7 +82,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
const qint64 &firstPointId, const qint64 &secondPointId,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation){
const Document::Documents &parse, Tool::Sources typeCreation){
VPointF centerP = data->GetPoint(center);
VPointF firstP = data->GetPoint(firstPointId);
VPointF secondP = data->GetPoint(secondPointId);
@ -99,23 +99,20 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
} else {
data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point);
}
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tools::PointOfContact, doc);
VDrawTool::AddRecord(id, Tool::PointOfContact, doc);
if(parse == Document::FullParse){
VToolPointOfContact *point = new VToolPointOfContact(doc, data, id, radius, center,
firstPointId, secondPointId, typeCreation);
scene->addItem(point);
connect(point, &VToolPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(center);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
}
}
}
@ -147,12 +144,7 @@ void VToolPointOfContact::FullUpdateFromGui(int result){
}
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogPointOfContact, this, event, false);
} else {
ContextMenu(dialogPointOfContact, this, event);
}
ContextMenu(dialogPointOfContact, this, event);
}
void VToolPointOfContact::AddToFile(){
@ -172,3 +164,9 @@ void VToolPointOfContact::AddToFile(){
AddToCalculation(domElement);
}
void VToolPointOfContact::RemoveReferens(){
doc->DecrementReferens(center);
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(secondPointId);
}

View File

@ -30,7 +30,7 @@ class VToolPointOfContact : public VToolPoint
public:
VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &radius, const qint64 &center, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem * parent = 0);
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static QPointF FindPoint(const qreal &radius, const QPointF &center, const QPointF &firstPoint,
const QPointF &secondPoint);
@ -39,13 +39,14 @@ public:
static void Create(const qint64 _id, const QString &radius, const qint64 &center, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
QString radius;
qint64 center;

View File

@ -21,11 +21,10 @@
#include "vtoolshoulderpoint.h"
#include <QDebug>
#include <QMenu>
VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation,
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
QGraphicsItem * parent):
VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder),
dialogShoulderPoint(QSharedPointer<DialogShoulderPoint>()){
@ -86,7 +85,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation){
const Document::Documents &parse, Tool::Sources typeCreation){
VPointF firstPoint = data->GetPoint(p1Line);
VPointF secondPoint = data->GetPoint(p2Line);
VPointF shoulderPoint = data->GetPoint(pShoulder);
@ -103,17 +102,12 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
} else {
data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(p1Line, id);
data->AddLine(p2Line, id);
VDrawTool::AddRecord(id, Tools::ShoulderPointTool, doc);
VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc);
if(parse == Document::FullParse){
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula,
p1Line, p2Line, pShoulder,
@ -121,8 +115,10 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
scene->addItem(point);
connect(point, &VToolShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(p1Line);
doc->IncrementReferens(p2Line);
doc->IncrementReferens(pShoulder);
}
}
}
@ -156,12 +152,7 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
}
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogShoulderPoint, this, event, false);
} else {
ContextMenu(dialogShoulderPoint, this, event);
}
ContextMenu(dialogShoulderPoint, this, event);
}
void VToolShoulderPoint::AddToFile(){
@ -182,3 +173,9 @@ void VToolShoulderPoint::AddToFile(){
AddToCalculation(domElement);
}
void VToolShoulderPoint::RemoveReferens(){
doc->DecrementReferens(p2Line);
doc->DecrementReferens(pShoulder);
VToolLinePoint::RemoveReferens();
}

View File

@ -30,7 +30,7 @@ class VToolShoulderPoint : public VToolLinePoint
public:
VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation,
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
@ -40,13 +40,14 @@ public:
static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
const qint64 &pShoulder, const QString &typeLine, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 p2Line;
qint64 pShoulder;

View File

@ -24,13 +24,9 @@
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
#include <QMenu>
#include <QGraphicsSceneContextMenuEvent>
#include <cmath>
#include "options.h"
#include "container/vpointf.h"
VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem * parent ):VToolPoint(doc, data, id, parent),
dialogSinglePoint(QSharedPointer<DialogSinglePoint>()){
this->setFlag(QGraphicsItem::ItemIsMovable, true);
@ -89,6 +85,12 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change,
return QGraphicsItem::itemChange(change, value);
}
void VToolSinglePoint::decrementReferens(){
if(_referens > 1){
--_referens;
}
}
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ){
ContextMenu(dialogSinglePoint, this, event, false);
}

View File

@ -22,8 +22,6 @@
#ifndef VTOOLSINGLEPOINT_H
#define VTOOLSINGLEPOINT_H
#include "container/vcontainer.h"
#include "xml/vdomdocument.h"
#include "dialogs/dialogsinglepoint.h"
#include "vtoolpoint.h"
@ -32,7 +30,7 @@ class VToolSinglePoint : public VToolPoint
Q_OBJECT
public:
VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id,
Tool::Enum typeCreation, QGraphicsItem * parent = 0 );
Tool::Sources typeCreation, QGraphicsItem * parent = 0 );
virtual void setDialog();
public slots:
virtual void FullUpdateFromFile();
@ -44,6 +42,7 @@ protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
virtual void decrementReferens();
private:
QSharedPointer<DialogSinglePoint> dialogSinglePoint;
};

View File

@ -20,13 +20,12 @@
****************************************************************************/
#include "vtoolspline.h"
#include <QMenu>
#include <QDebug>
#include "geometry/vspline.h"
VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Enum typeCreation,
Tool::Sources typeCreation,
QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsPathItem(parent),
dialogSpline(QSharedPointer<DialogSpline>()), controlPoints(QVector<VControlPointSpline *>()){
@ -89,8 +88,8 @@ void VToolSpline::Create(QSharedPointer<DialogSpline> &dialog, VMainGraphicsScen
void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VSpline spline = VSpline(data->DataPoints(), p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve);
qint64 id = _id;
if(typeCreation == Tool::FromGui){
@ -98,23 +97,19 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
} else {
data->UpdateSpline(id, spline);
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Spline);
}
doc->UpdateToolData(id, data);
}
}
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
VDrawTool::AddRecord(id, Tools::SplineTool, doc);
VDrawTool::AddRecord(id, Tool::SplineTool, doc);
if(parse == Document::FullParse){
VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation);
scene->addItem(spl);
connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(spl, &VToolSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,spl);
doc->AddTool(id, spl);
doc->IncrementReferens(p1);
doc->IncrementReferens(p4);
}
}
@ -177,12 +172,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo
}
void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VSpline spl = VDrawTool::data.GetSpline(id);
if(spl.referens() > 1){
ContextMenu(dialogSpline, this, event, false);
} else {
ContextMenu(dialogSpline, this, event);
}
ContextMenu(dialogSpline, this, event);
}
void VToolSpline::AddToFile(){
@ -219,6 +209,12 @@ void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolSpline::RemoveReferens(){
VSpline spl = VAbstractTool::data.GetSpline(id);
doc->DecrementReferens(spl.GetP1());
doc->DecrementReferens(spl.GetP4());
}
void VToolSpline::RefreshGeometry(){
VSpline spl = VAbstractTool::data.GetSpline(id);
QPainterPath path;

View File

@ -23,11 +23,9 @@
#define VTOOLSPLINE_H
#include "vdrawtool.h"
#include "xml/vdomdocument.h"
#include <QGraphicsPathItem>
#include "dialogs/dialogspline.h"
#include "widgets/vcontrolpointspline.h"
#include "container/vcontainer.h"
#include "geometry/vsplinepath.h"
class VToolSpline:public VDrawTool, public QGraphicsPathItem
@ -35,14 +33,14 @@ class VToolSpline:public VDrawTool, public QGraphicsPathItem
Q_OBJECT
public:
VToolSpline (VDomDocument *doc, VContainer *data, qint64 id,
Tool::Enum typeCreation, QGraphicsItem * parent = 0 );
Tool::Sources typeCreation, QGraphicsItem * parent = 0 );
virtual void setDialog();
static void Create(QSharedPointer<DialogSpline> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data);
static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
signals:
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position,
const QPointF &controlPoint, const QPointF &splinePoint );
@ -61,6 +59,7 @@ protected:
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens();
private:
QSharedPointer<DialogSpline> dialogSpline;
QVector<VControlPointSpline *> controlPoints;

View File

@ -23,7 +23,7 @@
#include <QMenu>
VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Enum typeCreation,
Tool::Sources typeCreation,
QGraphicsItem *parent):VDrawTool(doc, data, id),
QGraphicsPathItem(parent), dialogSplinePath(QSharedPointer<DialogSplinePath>()),
controlPoints(QVector<VControlPointSpline *>()){
@ -70,35 +70,32 @@ void VToolSplinePath::setDialog(){
void VToolSplinePath::Create(QSharedPointer<DialogSplinePath> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data){
VSplinePath path = dialog->GetPath();
for(qint32 i = 0; i < path.CountPoint(); ++i){
doc->IncrementReferens(path[i].P());
}
Create(0, path, scene, doc, data, Document::FullParse, Tool::FromGui);
}
void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->AddSplinePath(path);
} else {
data->UpdateSplinePath(id, path);
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::SplinePath);
}
doc->UpdateToolData(id, data);
}
}
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
VDrawTool::AddRecord(id, Tools::SplinePathTool, doc);
VDrawTool::AddRecord(id, Tool::SplinePathTool, doc);
if(parse == Document::FullParse){
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
scene->addItem(spl);
connect(spl, &VToolSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(spl, &VToolSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,spl);
doc->AddTool(id, spl);
}
}
@ -216,12 +213,7 @@ void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
}
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VSplinePath path = VDrawTool::data.GetSplinePath(id);
if(path.referens() > 1){
ContextMenu(dialogSplinePath, this, event, false);
} else {
ContextMenu(dialogSplinePath, this, event);
}
ContextMenu(dialogSplinePath, this, event);
}
void VToolSplinePath::AddToFile(){
@ -267,6 +259,13 @@ void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
this->setPen(QPen(currentColor, widthHairLine));
}
void VToolSplinePath::RemoveReferens(){
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
for(qint32 i = 0; i < splPath.Count(); ++i){
doc->DecrementReferens(splPath[i].P());
}
}
void VToolSplinePath::RefreshGeometry(){
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
QPainterPath path;

View File

@ -23,24 +23,22 @@
#define VTOOLSPLINEPATH_H
#include "vdrawtool.h"
#include "xml/vdomdocument.h"
#include <QGraphicsPathItem>
#include "dialogs/dialogsplinepath.h"
#include "widgets/vcontrolpointspline.h"
#include "container/vcontainer.h"
class VToolSplinePath:public VDrawTool, public QGraphicsPathItem
{
class VToolSplinePath:public VDrawTool, public QGraphicsPathItem{
Q_OBJECT
public:
VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Enum typeCreation,
Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static void Create(QSharedPointer<DialogSplinePath> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data);
static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, Document::Enum parse, Tool::Enum typeCreation);
virtual void setDialog();
static void Create(QSharedPointer<DialogSplinePath> &dialog,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
static void Create(const qint64 _id, const VSplinePath &path,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
signals:
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos,
const QPointF &controlPoint, const QPointF &splinePoint);
@ -59,6 +57,7 @@ protected:
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens();
private:
QSharedPointer<DialogSplinePath> dialogSplinePath;
QVector<VControlPointSpline *> controlPoints;

View File

@ -21,14 +21,13 @@
#include "vmodelingalongline.h"
#include <QDialog>
#include <QMenu>
#include <QDebug>
#include "container/calculator.h"
VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &typeLine,
Tool::Enum typeCreation, QGraphicsItem *parent):
Tool::Sources typeCreation, QGraphicsItem *parent):
VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent),
secondPointId(secondPointId), dialogAlongLine(QSharedPointer<DialogAlongLine>()){
@ -86,6 +85,11 @@ void VModelingAlongLine::AddToFile(){
AddToModeling(domElement);
}
void VModelingAlongLine::RemoveReferens(){
doc->DecrementReferens(secondPointId);
VModelingLinePoint::RemoveReferens();
}
void VModelingAlongLine::setDialog(){
Q_ASSERT(!dialogAlongLine.isNull());
if(!dialogAlongLine.isNull()){
@ -113,8 +117,8 @@ VModelingAlongLine *VModelingAlongLine::Create(const qint64 _id, const QString &
const QString &typeLine, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId,
const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingAlongLine *point = 0;
VPointF firstPoint = data->GetModelingPoint(firstPointId);
VPointF secondPoint = data->GetModelingPoint(secondPointId);
@ -130,24 +134,18 @@ VModelingAlongLine *VModelingAlongLine::Create(const qint64 _id, const QString &
} else {
data->UpdateModelingPoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point, Draw::Modeling);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);
data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling);
data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling);
if(parse == Document::FullParse){
point = new VModelingAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine,
typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
}
}
return point;

View File

@ -25,30 +25,30 @@
#include "vmodelinglinepoint.h"
#include "dialogs/dialogalongline.h"
class VModelingAlongLine : public VModelingLinePoint
{
class VModelingAlongLine : public VModelingLinePoint{
Q_OBJECT
public:
VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine,
Tool::Enum typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingAlongLine* Create(QSharedPointer<DialogAlongLine> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qreal &mx, const qreal &my,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &typeLine,
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingAlongLine* Create(QSharedPointer<DialogAlongLine> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qreal &mx, const qreal &my,
VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 secondPointId;
qint64 secondPointId;
QSharedPointer<DialogAlongLine> dialogAlongLine;
};

View File

@ -23,7 +23,7 @@
#include <QMenu>
#include "container/calculator.h"
VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),
dialogArc(QSharedPointer<DialogArc>()){
VArc arc = data->GetModelingArc(id);
@ -61,7 +61,7 @@ VModelingArc* VModelingArc::Create(QSharedPointer<DialogArc> &dialog, VDomDocume
VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 &center, const QString &radius,
const QString &f1, const QString &f2, VDomDocument *doc,
VContainer *data, Document::Enum parse, Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
VModelingArc *toolArc = 0;
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
@ -91,20 +91,14 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 &center, const
} else {
data->UpdateModelingArc(id, arc);
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Arc, Draw::Modeling);
}
doc->UpdateToolData(id, data);
}
}
data->AddLengthArc(data->GetNameArc(center,id, Draw::Modeling), arc.GetLength());
data->IncrementReferens(center, Scene::Point, Draw::Modeling);
if(parse == Document::FullParse){
toolArc = new VModelingArc(doc, data, id, typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,toolArc);
doc->AddTool(id, toolArc);
doc->IncrementReferens(center);
}
return toolArc;
}
@ -162,6 +156,11 @@ void VModelingArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
this->setPen(QPen(currentColor, widthHairLine));
}
void VModelingArc::RemoveReferens(){
VArc arc = VAbstractTool::data.GetModelingArc(id);
doc->DecrementReferens(arc.GetCenter());
}
void VModelingArc::RefreshGeometry(){
VArc arc = VAbstractTool::data.GetModelingArc(id);
QPainterPath path;

View File

@ -23,23 +23,20 @@
#define VMODELINGARC_H
#include "vmodelingtool.h"
#include "xml/vdomdocument.h"
#include <QGraphicsPathItem>
#include "dialogs/dialogarc.h"
#include "widgets/vcontrolpointspline.h"
#include "container/vcontainer.h"
class VModelingArc :public VModelingTool, public QGraphicsPathItem
{
class VModelingArc :public VModelingTool, public QGraphicsPathItem{
Q_OBJECT
public:
VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingArc* Create(QSharedPointer<DialogArc> &dialog, VDomDocument *doc, VContainer *data);
static VModelingArc* Create(const qint64 _id, const qint64 &center, const QString &radius,
const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation);
VModelingArc(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingArc* Create(QSharedPointer<DialogArc> &dialog, VDomDocument *doc, VContainer *data);
static VModelingArc* Create(const qint64 _id, const qint64 &center, const QString &radius,
const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
@ -49,6 +46,7 @@ protected:
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens();
private:
QSharedPointer<DialogArc> dialogArc;
void RefreshGeometry();

View File

@ -24,7 +24,7 @@
VModelingBisector::VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Sources typeCreation,
QGraphicsItem *parent):
VModelingLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0),
thirdPointId(0), dialogBisector(QSharedPointer<DialogBisector>()){
@ -78,8 +78,8 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo
const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingBisector *point = 0;
VPointF firstPoint = data->GetModelingPoint(firstPointId);
VPointF secondPoint = data->GetModelingPoint(secondPointId);
@ -97,23 +97,17 @@ VModelingBisector *VModelingBisector::Create(const qint64 _id, const QString &fo
} else {
data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point, Draw::Modeling);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPointId, id, Draw::Modeling);
data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling);
data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling);
data->IncrementReferens(thirdPointId, Scene::Point, Draw::Modeling);
if(parse == Document::FullParse){
point = new VModelingBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId,
thirdPointId, typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(thirdPointId);
}
}
return point;
@ -169,3 +163,9 @@ void VModelingBisector::AddToFile(){
AddToModeling(domElement);
}
void VModelingBisector::RemoveReferens(){
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(thirdPointId);
VModelingLinePoint::RemoveReferens();
}

View File

@ -22,37 +22,37 @@
#ifndef VMODELINGBISECTOR_H
#define VMODELINGBISECTOR_H
#include <QSharedPointer>
#include "vmodelinglinepoint.h"
#include "dialogs/dialogbisector.h"
class VModelingBisector : public VModelingLinePoint
{
class VModelingBisector : public VModelingLinePoint{
Q_OBJECT
public:
VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const QPointF &thirdPoint, const qreal& length);
virtual void setDialog();
static VModelingBisector* Create(QSharedPointer<DialogBisector> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId,
const QString &typeLine, const QString &pointName, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation);
VModelingBisector(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &thirdPointId, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const QPointF &thirdPoint, const qreal& length);
virtual void setDialog();
static VModelingBisector* Create(QSharedPointer<DialogBisector> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId,
const QString &typeLine, const QString &pointName, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 firstPointId;
qint64 thirdPointId;
qint64 firstPointId;
qint64 thirdPointId;
QSharedPointer<DialogBisector> dialogBisector;
};

View File

@ -26,7 +26,7 @@
VModelingEndLine::VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
Tool::Enum typeCreation, QGraphicsItem *parent):
Tool::Sources typeCreation, QGraphicsItem *parent):
VModelingLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent),
dialogEndLine(QSharedPointer<DialogEndLine>()){
@ -62,7 +62,7 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin
const QString &typeLine, const QString &formula,
const qreal &angle, const qint64 &basePointId, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation){
const Document::Documents &parse, Tool::Sources typeCreation){
VModelingEndLine *point = 0;
VPointF basePoint = data->GetModelingPoint(basePointId);
QLineF line = QLineF(basePoint.toQPointF(), QPointF(basePoint.x()+100, basePoint.y()));
@ -78,20 +78,14 @@ VModelingEndLine *VModelingEndLine::Create(const qint64 _id, const QString &poin
} else {
data->UpdateModelingPoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point, Draw::Modeling);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(basePointId, id, Draw::Modeling);
data->IncrementReferens(basePointId, Scene::Point, Draw::Modeling);
if(parse == Document::FullParse){
point = new VModelingEndLine(doc, data, id, typeLine, formula, angle, basePointId, typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(basePointId);
}
}
return point;

View File

@ -22,31 +22,30 @@
#ifndef VMODELINGENDLINE_H
#define VMODELINGENDLINE_H
#include <QSharedPointer>
#include "vmodelinglinepoint.h"
#include "dialogs/dialogendline.h"
class VModelingEndLine : public VModelingLinePoint
{
class VModelingEndLine : public VModelingLinePoint{
Q_OBJECT
public:
VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const qreal &angle,
const qint64 &basePointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
Document::Enum parse, Tool::Enum typeCreation);
VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qreal &angle, const qint64 &basePointId,
Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &basePointId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
private:
QSharedPointer<DialogEndLine> dialogEndLine;
};

View File

@ -20,11 +20,10 @@
****************************************************************************/
#include "vmodelingline.h"
#include <QMenu>
#include <QDebug>
VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem *parent):
qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent):
VModelingTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint),
secondPoint(secondPoint), dialogLine(QSharedPointer<DialogLine>()){
//Лінія
@ -53,26 +52,21 @@ VModelingLine *VModelingLine::Create(QSharedPointer<DialogLine> &dialog, VDomDoc
}
VModelingLine *VModelingLine::Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingLine *line = 0;
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
data->AddLine(firstPoint, secondPoint, Draw::Modeling);
data->IncrementReferens(firstPoint, Scene::Point, Draw::Modeling);
data->IncrementReferens(secondPoint, Scene::Point, Draw::Modeling);
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
VDataTool *tool = tools->value(id);
Q_CHECK_PTR(tool);
tool->VDataTool::setData(data);
doc->UpdateToolData(id, data);
}
if(parse == Document::FullParse){
qint64 id = data->getNextId();
line = new VModelingLine(doc, data, id, firstPoint, secondPoint, typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,line);
doc->AddTool(id, line);
doc->IncrementReferens(firstPoint);
doc->IncrementReferens(secondPoint);
}
return line;
}
@ -122,3 +116,8 @@ void VModelingLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(currentColor, widthHairLine));
}
void VModelingLine::RemoveReferens(){
doc->DecrementReferens(firstPoint);
doc->DecrementReferens(secondPoint);
}

View File

@ -26,28 +26,29 @@
#include "QGraphicsLineItem"
#include "dialogs/dialogline.h"
class VModelingLine: public VModelingTool, public QGraphicsLineItem
{
class VModelingLine: public VModelingTool, public QGraphicsLineItem{
Q_OBJECT
public:
VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Enum typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingLine* Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data);
static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingLine* Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data);
static VModelingLine* Create(const qint64 &id, const qint64 &firstPoint, const qint64 &secondPoint,
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens();
private:
qint64 firstPoint;
qint64 secondPoint;
qint64 firstPoint;
qint64 secondPoint;
QSharedPointer<DialogLine> dialogLine;
};

View File

@ -20,11 +20,10 @@
****************************************************************************/
#include "vmodelinglineintersect.h"
#include <QMenu>
VModelingLineIntersect::VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Enum typeCreation, QGraphicsItem *parent):
const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent):
VModelingPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2),
p2Line2(p2Line2), dialogLineIntersect(QSharedPointer<DialogLineIntersect>()){
if(typeCreation == Tool::FromGui){
@ -59,8 +58,8 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q
const qint64 &p2Line1Id, const qint64 &p1Line2Id,
const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingLineIntersect *point = 0;
VPointF p1Line1 = data->GetModelingPoint(p1Line1Id);
VPointF p2Line1 = data->GetModelingPoint(p2Line1Id);
@ -78,12 +77,7 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q
} else {
data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point, Draw::Modeling);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(p1Line1Id, id, Draw::Modeling);
@ -93,8 +87,11 @@ VModelingLineIntersect *VModelingLineIntersect::Create(const qint64 _id, const q
if(parse == Document::FullParse){
point = new VModelingLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id,
typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(p1Line1Id);
doc->IncrementReferens(p2Line1Id);
doc->IncrementReferens(p1Line2Id);
doc->IncrementReferens(p2Line2Id);
}
}
return point;
@ -147,3 +144,10 @@ void VModelingLineIntersect::AddToFile(){
AddToModeling(domElement);
}
void VModelingLineIntersect::RemoveReferens(){
doc->DecrementReferens(p1Line1);
doc->DecrementReferens(p2Line1);
doc->DecrementReferens(p1Line2);
doc->DecrementReferens(p2Line2);
}

View File

@ -25,30 +25,31 @@
#include "vmodelingpoint.h"
#include "dialogs/dialoglineintersect.h"
class VModelingLineIntersect:public VModelingPoint
{
class VModelingLineIntersect:public VModelingPoint{
Q_OBJECT
public:
VModelingLineIntersect(VDomDocument *doc, VContainer *data,
const qint64 &id,
const qint64 &p1Line1,
const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingLineIntersect* Create(QSharedPointer<DialogLineIntersect> &dialog,
VDomDocument *doc,VContainer *data);
static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
const qint64 &p1Line2Id, const qint64 &p2Line2Id,
const QString &pointName, const qreal &mx, const qreal &my,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
VModelingLineIntersect(VDomDocument *doc, VContainer *data,
const qint64 &id, const qint64 &p1Line1,
const qint64 &p2Line1, const qint64 &p1Line2,
const qint64 &p2Line2,
Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingLineIntersect* Create(QSharedPointer<DialogLineIntersect> &dialog,
VDomDocument *doc,VContainer *data);
static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id,
const qint64 &p2Line1Id, const qint64 &p1Line2Id,
const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 p1Line1;
qint64 p2Line1;

View File

@ -50,3 +50,7 @@ void VModelingLinePoint::RefreshGeometry(){
mainLine->setVisible(true);
}
}
void VModelingLinePoint::RemoveReferens(){
doc->DecrementReferens(basePointId);
}

View File

@ -24,13 +24,13 @@
#include "vmodelingpoint.h"
class VModelingLinePoint : public VModelingPoint
{
class VModelingLinePoint : public VModelingPoint{
Q_OBJECT
public:
VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qint64 &basePointId, const qreal &angle,
QGraphicsItem * parent = 0);
protected:
QString typeLine;
QString formula;
@ -38,9 +38,9 @@ protected:
qint64 basePointId;
QGraphicsLineItem *mainLine;
virtual void RefreshGeometry();
virtual void RemoveReferens();
private:
VModelingLinePoint(const VModelingLinePoint &tool);
const VModelingLinePoint &operator=(const VModelingLinePoint &tool);
Q_DISABLE_COPY(VModelingLinePoint)
};
#endif // VMODELINGLINEPOINT_H

View File

@ -20,12 +20,11 @@
****************************************************************************/
#include "vmodelingnormal.h"
#include <QMenu>
VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent):
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent):
VModelingLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
secondPointId(secondPointId), dialogNormal(QSharedPointer<DialogNormal>()){
@ -64,8 +63,8 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul
const qint64 &firstPointId, const qint64 &secondPointId,
const QString typeLine, const QString pointName,
const qreal angle, const qreal &mx, const qreal &my,
VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation){
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingNormal *point = 0;
VPointF firstPoint = data->GetModelingPoint(firstPointId);
VPointF secondPoint = data->GetModelingPoint(secondPointId);
@ -81,22 +80,16 @@ VModelingNormal *VModelingNormal::Create(const qint64 _id, const QString &formul
} else {
data->UpdateModelingPoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id);
if(tool != 0){
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point, Draw::Modeling);
}
doc->UpdateToolData(id, data);
}
}
data->AddLine(firstPointId, id, Draw::Modeling);
data->IncrementReferens(firstPointId, Scene::Point, Draw::Modeling);
data->IncrementReferens(secondPointId, Scene::Point, Draw::Modeling);
if(parse == Document::FullParse){
point = new VModelingNormal(doc, data, id, typeLine, formula, angle, firstPointId, secondPointId,
typeCreation);
QMap<qint64, VDataTool*>* tools = doc->getTools();
tools->insert(id,point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
}
}
return point;
@ -161,3 +154,8 @@ void VModelingNormal::AddToFile(){
AddToModeling(domElement);
}
void VModelingNormal::RemoveReferens(){
doc->DecrementReferens(secondPointId);
VModelingLinePoint::RemoveReferens();
}

View File

@ -22,26 +22,25 @@
#ifndef VMODELINGNORMAL_H
#define VMODELINGNORMAL_H
#include <QSharedPointer>
#include "vmodelinglinepoint.h"
#include "dialogs/dialognormal.h"
class VModelingNormal : public VModelingLinePoint
{
class VModelingNormal : public VModelingLinePoint{
Q_OBJECT
public:
VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula,
const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingNormal* Create(QSharedPointer<DialogNormal> &dialog, VDomDocument *doc, VContainer *data);
static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine,
const QString pointName, const qreal angle, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data, Document::Enum parse,
Tool::Enum typeCreation);
const QString &typeLine, const QString &formula,
const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingNormal* Create(QSharedPointer<DialogNormal> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine,
const QString pointName, const qreal angle, const qreal &mx,
const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
const qreal &length, const qreal &angle = 0);
public slots:
@ -50,6 +49,7 @@ public slots:
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void RemoveReferens();
private:
qint64 secondPointId;
QSharedPointer<DialogNormal> dialogNormal;

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