Fixed bugs in VArc and VSpline. Bug in DataPoints.
--HG-- branch : develop
This commit is contained in:
parent
80b5fe6d5e
commit
7f3b2f76ee
|
@ -21,15 +21,16 @@
|
||||||
|
|
||||||
#include "varc.h"
|
#include "varc.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include "exception/vexception.h"
|
||||||
|
|
||||||
VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
|
VArc::VArc () : f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
|
||||||
center(0), points(0), mode(Draw::Calculation), idObject(0){
|
center(0), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){
|
||||||
}
|
}
|
||||||
|
|
||||||
VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
VArc::VArc (const QHash<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
|
||||||
qreal f1, QString formulaF1, qreal f2, QString formulaF2, Draw::Draws 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),
|
: f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius),
|
||||||
center(center), points(points), 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()),
|
VArc::VArc(const VArc &arc): f1(arc.GetF1()), formulaF1(arc.GetFormulaF1()), f2(arc.GetF2()),
|
||||||
|
@ -85,11 +86,11 @@ qint64 VArc::GetCenter() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF VArc::GetCenterPoint() const{
|
QPointF VArc::GetCenterPoint() const{
|
||||||
if(points->contains(center)){
|
if(points.contains(center)){
|
||||||
return points->value(center).toQPointF();
|
return points.value(center).toQPointF();
|
||||||
} else {
|
} else {
|
||||||
qCritical()<<"Не можу знайти id = "<<center<<" в таблиці.";
|
QString error = QString(tr("Can't find id = %1 in table.")).arg(center);
|
||||||
throw"Не можу знайти точку за id.";
|
throw VException(error);
|
||||||
}
|
}
|
||||||
return QPointF();
|
return QPointF();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +109,7 @@ QPointF VArc::GetP2 () const{
|
||||||
return centerP2.p2();
|
return centerP2.p2();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QHash<qint64, VPointF> *VArc::GetDataPoints() const{
|
const QHash<qint64, VPointF> VArc::GetDataPoints() const{
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,9 +134,11 @@ qreal VArc::AngleArc() const{
|
||||||
qint32 VArc::NumberSplOfArc() const{
|
qint32 VArc::NumberSplOfArc() const{
|
||||||
qint32 angArc = static_cast<qint32> (AngleArc ());
|
qint32 angArc = static_cast<qint32> (AngleArc ());
|
||||||
switch( angArc ){
|
switch( angArc ){
|
||||||
case 0:
|
case 0:{
|
||||||
throw "Кут дуги не може бути 0 градусів.";
|
QString error = QString(tr("Angle of arc can't be 0 degree."));
|
||||||
|
throw VException(error);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 90:
|
case 90:
|
||||||
return 1;
|
return 1;
|
||||||
case 180:
|
case 180:
|
||||||
|
@ -161,7 +164,8 @@ QVector<QPointF> VArc::GetPoints() const{
|
||||||
QVector<QPointF> VArc::SplOfArc(qint32 number) const{
|
QVector<QPointF> VArc::SplOfArc(qint32 number) const{
|
||||||
qint32 n = NumberSplOfArc ();
|
qint32 n = NumberSplOfArc ();
|
||||||
if( number > n ){
|
if( number > n ){
|
||||||
throw "Дуга не складається з такої кількості сплайнів.";
|
QString error = QString(tr("Arc have not this number of part."));
|
||||||
|
throw VException(error);
|
||||||
}
|
}
|
||||||
qreal f1 = GetF1 ();
|
qreal f1 = GetF1 ();
|
||||||
qreal f2 = GetF2 ();
|
qreal f2 = GetF2 ();
|
||||||
|
|
|
@ -23,11 +23,13 @@
|
||||||
#define VARC_H
|
#define VARC_H
|
||||||
|
|
||||||
#include "vspline.h"
|
#include "vspline.h"
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
|
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
|
||||||
*/
|
*/
|
||||||
class VArc{
|
class VArc{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(VArc)
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief VArc конструктор по замовчуванню.
|
* @brief VArc конструктор по замовчуванню.
|
||||||
|
@ -84,7 +86,7 @@ public:
|
||||||
* @return точку кінця дуги.
|
* @return точку кінця дуги.
|
||||||
*/
|
*/
|
||||||
QPointF GetP2 () const;
|
QPointF GetP2 () const;
|
||||||
const QHash<qint64, VPointF> *GetDataPoints() const;
|
const QHash<qint64, VPointF> GetDataPoints() const;
|
||||||
/**
|
/**
|
||||||
* @brief GetPath будує шлях по даній дузі.
|
* @brief GetPath будує шлях по даній дузі.
|
||||||
* @return повертає шлях.
|
* @return повертає шлях.
|
||||||
|
@ -119,7 +121,7 @@ private:
|
||||||
* @brief center центральна точка дуги.
|
* @brief center центральна точка дуги.
|
||||||
*/
|
*/
|
||||||
qint64 center;
|
qint64 center;
|
||||||
const QHash<qint64, VPointF> *points;
|
QHash<qint64, VPointF> points;
|
||||||
Draw::Draws mode;
|
Draw::Draws mode;
|
||||||
qint64 idObject;
|
qint64 idObject;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
|
VSpline::VSpline():p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
|
||||||
kCurve(1), points(0), mode(Draw::Calculation), idObject(0){
|
kCurve(1), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()),
|
VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()),
|
||||||
|
@ -34,14 +34,14 @@ VSpline::VSpline ( const VSpline & spline ):p1(spline.GetP1 ()), p2(spline.GetP2
|
||||||
|
|
||||||
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
|
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, qint64 p4, qreal angle1, qreal angle2,
|
||||||
qreal kAsm1, qreal kAsm2 , qreal kCurve, Draw::Draws 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),
|
p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve), points(*points),
|
||||||
mode(mode), idObject(idObject){
|
mode(mode), idObject(idObject){
|
||||||
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
|
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
|
VSpline::VSpline (const QHash<qint64, VPointF> *points, qint64 p1, QPointF p2, QPointF p3, qint64 p4,
|
||||||
qreal kCurve, Draw::Draws mode, qint64 idObject):p1(p1), p2(p2), p3(p3), p4(p4), angle1(0),
|
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){
|
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), mode(mode), idObject(idObject){
|
||||||
ModifiSpl ( p1, p2, p3, p4, kCurve);
|
ModifiSpl ( p1, p2, p3, p4, kCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,8 +129,8 @@ qint64 VSpline::GetP1 () const{
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF VSpline::GetPointP1() const{
|
VPointF VSpline::GetPointP1() const{
|
||||||
if(points->contains(p1)){
|
if(points.contains(p1)){
|
||||||
return points->value(p1);
|
return points.value(p1);
|
||||||
} else {
|
} else {
|
||||||
qCritical()<<"Не можу знайти id = "<<p1<<" в таблиці.";
|
qCritical()<<"Не можу знайти id = "<<p1<<" в таблиці.";
|
||||||
throw"Не можу знайти точку за id.";
|
throw"Не можу знайти точку за id.";
|
||||||
|
@ -151,8 +151,8 @@ qint64 VSpline::GetP4() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF VSpline::GetPointP4() const{
|
VPointF VSpline::GetPointP4() const{
|
||||||
if(points->contains(p4)){
|
if(points.contains(p4)){
|
||||||
return points->value(p4);
|
return points.value(p4);
|
||||||
} else {
|
} else {
|
||||||
qCritical()<<"Не можу знайти id = "<<p4<<" в таблиці.";
|
qCritical()<<"Не можу знайти id = "<<p4<<" в таблиці.";
|
||||||
throw"Не можу знайти точку за id.";
|
throw"Не можу знайти точку за id.";
|
||||||
|
@ -190,7 +190,7 @@ qreal VSpline::GetKcurve() const{
|
||||||
return kCurve;
|
return kCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QHash<qint64, VPointF> *VSpline::GetDataPoints() const{
|
const QHash<qint64, VPointF> VSpline::GetDataPoints() const{
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ public:
|
||||||
qreal GetKasm1() const;
|
qreal GetKasm1() const;
|
||||||
qreal GetKasm2() const;
|
qreal GetKasm2() const;
|
||||||
qreal GetKcurve() const;
|
qreal GetKcurve() const;
|
||||||
const QHash<qint64, VPointF> *GetDataPoints() const;
|
const QHash<qint64, VPointF> GetDataPoints() const;
|
||||||
/**
|
/**
|
||||||
* @brief CrossingSplLine перевіряє перетин сплайну з лінією.
|
* @brief CrossingSplLine перевіряє перетин сплайну з лінією.
|
||||||
* @param line лінія з якою перевіряється перетин.
|
* @param line лінія з якою перевіряється перетин.
|
||||||
|
@ -224,7 +224,7 @@ private:
|
||||||
qreal kAsm1;
|
qreal kAsm1;
|
||||||
qreal kAsm2;
|
qreal kAsm2;
|
||||||
qreal kCurve;
|
qreal kCurve;
|
||||||
const QHash<qint64, VPointF> *points;
|
QHash<qint64, VPointF> points;
|
||||||
Draw::Draws mode;
|
Draw::Draws mode;
|
||||||
qint64 idObject;
|
qint64 idObject;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,16 +22,16 @@
|
||||||
#include "vsplinepath.h"
|
#include "vsplinepath.h"
|
||||||
#include "exception/vexception.h"
|
#include "exception/vexception.h"
|
||||||
|
|
||||||
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(0),
|
VSplinePath::VSplinePath(): path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation),
|
||||||
idObject(0){
|
points(QHash<qint64, VPointF>()), idObject(0){
|
||||||
}
|
}
|
||||||
|
|
||||||
VSplinePath::VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()),
|
VSplinePath::VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve, Draw::Draws mode, qint64 idObject): path(QVector<VSplinePoint>()),
|
||||||
kCurve(kCurve), mode(mode), points(points), idObject(idObject){
|
kCurve(kCurve), mode(mode), points(*points), idObject(idObject){
|
||||||
}
|
}
|
||||||
|
|
||||||
VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
|
VSplinePath::VSplinePath(const VSplinePath &splPath): path(*splPath.GetPoint()),
|
||||||
kCurve(splPath.getKCurve()), mode(splPath.getMode()), points( splPath.GetDataPoints()),
|
kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()),
|
||||||
idObject(splPath.getIdObject()){
|
idObject(splPath.getIdObject()){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ VSpline VSplinePath::GetSpline(qint32 index) const{
|
||||||
if(index < 1 || index > Count()){
|
if(index < 1 || index > Count()){
|
||||||
throw VException(tr("This spline is not exist."));
|
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(),
|
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);
|
path[index-1].KAsm2(), path[index].KAsm1(), this->kCurve);
|
||||||
return spl;
|
return spl;
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ VSpline VSplinePath::GetSpline(qint32 index) const{
|
||||||
QPainterPath VSplinePath::GetPath() const{
|
QPainterPath VSplinePath::GetPath() const{
|
||||||
QPainterPath painterPath;
|
QPainterPath painterPath;
|
||||||
for(qint32 i = 1; i <= Count(); ++i){
|
for(qint32 i = 1; i <= Count(); ++i){
|
||||||
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
|
||||||
path[i].KAsm1(), this->kCurve);
|
path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
|
||||||
painterPath.addPath(spl.GetPath());
|
painterPath.addPath(spl.GetPath());
|
||||||
}
|
}
|
||||||
return painterPath;
|
return painterPath;
|
||||||
|
@ -84,8 +84,8 @@ QPainterPath VSplinePath::GetPath() const{
|
||||||
QVector<QPointF> VSplinePath::GetPathPoints() const{
|
QVector<QPointF> VSplinePath::GetPathPoints() const{
|
||||||
QVector<QPointF> pathPoints;
|
QVector<QPointF> pathPoints;
|
||||||
for(qint32 i = 1; i <= Count(); ++i){
|
for(qint32 i = 1; i <= Count(); ++i){
|
||||||
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(),
|
||||||
path[i].KAsm1(), this->kCurve);
|
path[i-1].KAsm2(), path[i].KAsm1(), this->kCurve);
|
||||||
QVector<QPointF> splP = spl.GetPoints();
|
QVector<QPointF> splP = spl.GetPoints();
|
||||||
for(qint32 j = 0; j < splP.size(); ++j){
|
for(qint32 j = 0; j < splP.size(); ++j){
|
||||||
pathPoints.append(splP[j]);
|
pathPoints.append(splP[j]);
|
||||||
|
@ -101,14 +101,14 @@ QVector<VSplinePoint> VSplinePath::GetSplinePath() const{
|
||||||
qreal VSplinePath::GetLength() const{
|
qreal VSplinePath::GetLength() const{
|
||||||
qreal length = 0;
|
qreal length = 0;
|
||||||
for(qint32 i = 1; i <= Count(); ++i){
|
for(qint32 i = 1; i <= Count(); ++i){
|
||||||
VSpline spl(points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
VSpline spl(&points, path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
|
||||||
path[i].KAsm1(), kCurve);
|
path[i].KAsm1(), kCurve);
|
||||||
length += spl.GetLength();
|
length += spl.GetLength();
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QHash<qint64, VPointF> *VSplinePath::GetDataPoints() const{
|
QHash<qint64, VPointF> VSplinePath::GetDataPoints() const{
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
QVector<QPointF> GetPathPoints() const;
|
QVector<QPointF> GetPathPoints() const;
|
||||||
QVector<VSplinePoint> GetSplinePath() const;
|
QVector<VSplinePoint> GetSplinePath() const;
|
||||||
qreal GetLength() const;
|
qreal GetLength() const;
|
||||||
const QHash<qint64, VPointF> *GetDataPoints() const;
|
QHash<qint64, VPointF> GetDataPoints() const;
|
||||||
void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point);
|
void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point);
|
||||||
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
|
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ protected:
|
||||||
QVector<VSplinePoint> path;
|
QVector<VSplinePoint> path;
|
||||||
qreal kCurve;
|
qreal kCurve;
|
||||||
Draw::Draws mode;
|
Draw::Draws mode;
|
||||||
const QHash<qint64, VPointF> *points;
|
QHash<qint64, VPointF> points;
|
||||||
qint64 idObject;
|
qint64 idObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -128,15 +128,17 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
|
data->AddLine(id, secondPointId);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
|
data->AddLine(id, secondPointId);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VDrawTool::AddRecord(id, Tool::AlongLineTool, doc);
|
VDrawTool::AddRecord(id, Tool::AlongLineTool, doc);
|
||||||
data->AddLine(firstPointId, id);
|
|
||||||
data->AddLine(id, secondPointId);
|
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId,
|
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId,
|
||||||
secondPointId, typeLine, typeCreation);
|
secondPointId, typeLine, typeCreation);
|
||||||
|
|
|
@ -87,13 +87,14 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddArc(arc);
|
id = data->AddArc(arc);
|
||||||
|
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
|
||||||
} else {
|
} else {
|
||||||
data->UpdateArc(id, arc);
|
data->UpdateArc(id, arc);
|
||||||
|
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
|
|
||||||
VDrawTool::AddRecord(id, Tool::ArcTool, doc);
|
VDrawTool::AddRecord(id, Tool::ArcTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
|
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
|
||||||
|
|
|
@ -93,13 +93,14 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLine(firstPointId, id);
|
|
||||||
VDrawTool::AddRecord(id, Tool::BisectorTool, doc);
|
VDrawTool::AddRecord(id, Tool::BisectorTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula,
|
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula,
|
||||||
|
|
|
@ -74,13 +74,14 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
||||||
|
data->AddLine(basePointId, id);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
data->UpdatePoint(id, VPointF(line.p2().x(), line.p2().y(), pointName, mx, my));
|
||||||
|
data->AddLine(basePointId, id);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLine(basePointId, id);
|
|
||||||
VDrawTool::AddRecord(id, Tool::EndLineTool, doc);
|
VDrawTool::AddRecord(id, Tool::EndLineTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle,
|
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle,
|
||||||
|
|
|
@ -60,12 +60,13 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->getNextId();
|
id = data->getNextId();
|
||||||
|
data->AddLine(firstPoint, secondPoint);
|
||||||
} else {
|
} else {
|
||||||
|
data->AddLine(firstPoint, secondPoint);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLine(firstPoint, secondPoint);
|
|
||||||
VDrawTool::AddRecord(id, Tool::LineTool, doc);
|
VDrawTool::AddRecord(id, Tool::LineTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
|
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
|
||||||
|
|
|
@ -72,16 +72,20 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(p1Line1Id, id);
|
||||||
|
data->AddLine(id, p2Line1Id);
|
||||||
|
data->AddLine(p1Line2Id, id);
|
||||||
|
data->AddLine(id, p2Line2Id);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(p1Line1Id, id);
|
||||||
|
data->AddLine(id, p2Line1Id);
|
||||||
|
data->AddLine(p1Line2Id, id);
|
||||||
|
data->AddLine(id, p2Line2Id);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLine(p1Line1Id, id);
|
|
||||||
data->AddLine(id, p2Line1Id);
|
|
||||||
data->AddLine(p1Line2Id, id);
|
|
||||||
data->AddLine(id, p2Line2Id);
|
|
||||||
VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc);
|
VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id,
|
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id,
|
||||||
|
|
|
@ -74,13 +74,14 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLine(firstPointId, id);
|
|
||||||
VDrawTool::AddRecord(id, Tool::NormalTool, doc);
|
VDrawTool::AddRecord(id, Tool::NormalTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,
|
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,
|
||||||
|
|
|
@ -96,8 +96,14 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
|
data->AddLine(secondPointId, id);
|
||||||
|
data->AddLine(center, id);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(firstPointId, id);
|
||||||
|
data->AddLine(secondPointId, id);
|
||||||
|
data->AddLine(center, id);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,14 +99,16 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(p1Line, id);
|
||||||
|
data->AddLine(p2Line, id);
|
||||||
} else {
|
} else {
|
||||||
data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
data->UpdatePoint(id,VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||||
|
data->AddLine(p1Line, id);
|
||||||
|
data->AddLine(p2Line, id);
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLine(p1Line, id);
|
|
||||||
data->AddLine(p2Line, id);
|
|
||||||
VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc);
|
VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula,
|
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula,
|
||||||
|
|
|
@ -94,13 +94,14 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddSpline(spline);
|
id = data->AddSpline(spline);
|
||||||
|
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
|
||||||
} else {
|
} else {
|
||||||
data->UpdateSpline(id, spline);
|
data->UpdateSpline(id, spline);
|
||||||
|
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
|
|
||||||
VDrawTool::AddRecord(id, Tool::SplineTool, doc);
|
VDrawTool::AddRecord(id, Tool::SplineTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation);
|
VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation);
|
||||||
|
|
|
@ -82,13 +82,14 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
id = data->AddSplinePath(path);
|
id = data->AddSplinePath(path);
|
||||||
|
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
|
||||||
} else {
|
} else {
|
||||||
data->UpdateSplinePath(id, path);
|
data->UpdateSplinePath(id, path);
|
||||||
|
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
|
||||||
if(parse != Document::FullParse){
|
if(parse != Document::FullParse){
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
|
|
||||||
VDrawTool::AddRecord(id, Tool::SplinePathTool, doc);
|
VDrawTool::AddRecord(id, Tool::SplinePathTool, doc);
|
||||||
if(parse == Document::FullParse){
|
if(parse == Document::FullParse){
|
||||||
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
|
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
|
||||||
|
|
|
@ -95,6 +95,16 @@ bool VApplication::notify(QObject *receiver, QEvent *event){
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
catch(const VException &e){
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(tr("Error!"));
|
||||||
|
msgBox.setText(tr("Something wrong!!"));
|
||||||
|
msgBox.setInformativeText(e.ErrorMessage());
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
|
msgBox.exec();
|
||||||
|
}
|
||||||
catch(std::exception& e) {
|
catch(std::exception& e) {
|
||||||
qCritical() << "Exception thrown:" << e.what();
|
qCritical() << "Exception thrown:" << e.what();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user