Arc, spline, spline path store their name by yourself.
--HG-- branch : develop
This commit is contained in:
parent
3c12ffacca
commit
8aea1ee3f3
|
@ -78,7 +78,7 @@ CONFIG(debug, debug|release){
|
|||
-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
|
||||
-Wunreachable-code -gdwarf-3
|
||||
}else{
|
||||
# Release
|
||||
TARGET = $$RELEASE_TARGET
|
||||
|
|
|
@ -131,7 +131,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
|
|||
{
|
||||
arc = data->GetModelingArc(id);
|
||||
}
|
||||
name = data->GetNameArc(arc.GetCenter(), id, mode);
|
||||
name = arc.name();
|
||||
break;
|
||||
}
|
||||
case (Tool::NodeSpline):
|
||||
|
@ -159,7 +159,7 @@ void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const Draw::D
|
|||
{
|
||||
splPath = data->GetModelingSplinePath(id);
|
||||
}
|
||||
name = data->GetNameSplinePath(splPath, mode);
|
||||
name = splPath.name();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -101,6 +101,7 @@ void DialogSplinePath::DialogAccepted()
|
|||
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
|
||||
}
|
||||
path.setKCurve(ui->doubleSpinBoxKcurve->value());
|
||||
path.setName(data->GetNameSplinePath(path, mode));
|
||||
emit ToolTip("");
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
|
|
@ -22,20 +22,25 @@
|
|||
#include "varc.h"
|
||||
#include "../exception/vexception.h"
|
||||
|
||||
class QRectF;
|
||||
|
||||
VArc::VArc ()
|
||||
: f1(0), formulaF1(QString()), f2(0), formulaF2(QString()), radius(0), formulaRadius(QString()),
|
||||
center(0), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){}
|
||||
center(0), points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0), _name(QString()){}
|
||||
|
||||
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)
|
||||
: 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), _name(QString())
|
||||
{
|
||||
_name = QString ("Arc_%1_%2").arg(this->GetCenterVPoint().name()).arg(radius);
|
||||
}
|
||||
|
||||
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()), mode(arc.getMode()),
|
||||
idObject(arc.getIdObject()){}
|
||||
idObject(arc.getIdObject()), _name(arc.name()){}
|
||||
|
||||
VArc &VArc::operator =(const VArc &arc)
|
||||
{
|
||||
|
@ -49,21 +54,27 @@ VArc &VArc::operator =(const VArc &arc)
|
|||
this->center = arc.GetCenter();
|
||||
this->mode = arc.getMode();
|
||||
this->idObject = arc.getIdObject();
|
||||
this->_name = arc.name();
|
||||
return *this;
|
||||
}
|
||||
|
||||
QPointF VArc::GetCenterPoint() const
|
||||
{
|
||||
return GetCenterVPoint().toQPointF();
|
||||
}
|
||||
|
||||
VPointF VArc::GetCenterVPoint() const
|
||||
{
|
||||
if (points.contains(center))
|
||||
{
|
||||
return points.value(center).toQPointF();
|
||||
return points.value(center);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString error = QString(tr("Can't find id = %1 in table.")).arg(center);
|
||||
throw VException(error);
|
||||
}
|
||||
return QPointF();
|
||||
return VPointF();
|
||||
}
|
||||
|
||||
QPointF VArc::GetP1() const
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#define VARC_H
|
||||
|
||||
#include "vspline.h"
|
||||
class QString;
|
||||
class QLineF;
|
||||
class QPainterPath;
|
||||
class QPointF;
|
||||
|
||||
/**
|
||||
* @brief VArc клас, що реалізує дугу. Дуга розраховується за годиниковою стрілкою.
|
||||
|
@ -76,6 +80,7 @@ public:
|
|||
*/
|
||||
inline qint64 GetCenter () const {return center;}
|
||||
QPointF GetCenterPoint() const;
|
||||
VPointF GetCenterVPoint() const;
|
||||
/**
|
||||
* @brief GetP1 повертає першу точку з якої починається дуга.
|
||||
* @return точку початку дуги.
|
||||
|
@ -100,6 +105,8 @@ public:
|
|||
inline void setMode(const Draw::Draws &value) {mode = value;}
|
||||
inline qint64 getIdObject() const {return idObject;}
|
||||
inline void setIdObject(const qint64 &value) {idObject = value;}
|
||||
QString name() const {return _name;}
|
||||
void setName(const QString &name) {_name = name;}
|
||||
private:
|
||||
/**
|
||||
* @brief f1 початковий кут в градусах
|
||||
|
@ -123,6 +130,7 @@ private:
|
|||
QHash<qint64, VPointF> points;
|
||||
Draw::Draws mode;
|
||||
qint64 idObject;
|
||||
QString _name;
|
||||
};
|
||||
|
||||
#endif // VARC_H
|
||||
|
|
|
@ -23,26 +23,28 @@
|
|||
|
||||
VSpline::VSpline()
|
||||
:p1(0), p2(QPointF()), p3(QPointF()), p4(0), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1),
|
||||
points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0){}
|
||||
points(QHash<qint64, VPointF>()), mode(Draw::Calculation), idObject(0), _name(QString()){}
|
||||
|
||||
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()), mode(spline.getMode()), idObject(spline.getIdObject()){}
|
||||
points(spline.GetDataPoints()), mode(spline.getMode()), idObject(spline.getIdObject()), _name(spline.name()){}
|
||||
|
||||
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()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2),
|
||||
kCurve(kCurve), points(*points), mode(mode), idObject(idObject)
|
||||
kCurve(kCurve), points(*points), mode(mode), idObject(idObject), _name(QString())
|
||||
{
|
||||
_name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name());
|
||||
ModifiSpl ( p1, p4, angle1, angle2, kAsm1, kAsm2, kCurve );
|
||||
}
|
||||
|
||||
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), angle2(0), kAsm1(1), kAsm2(1), kCurve(1), points(*points), mode(mode),
|
||||
idObject(idObject)
|
||||
idObject(idObject), _name(QString())
|
||||
{
|
||||
_name = QString("Spl_%1_%2").arg(this->GetPointP1().name(), this->GetPointP4().name());
|
||||
ModifiSpl ( p1, p2, p3, p4, kCurve);
|
||||
}
|
||||
|
||||
|
@ -778,5 +780,6 @@ VSpline &VSpline::operator =(const VSpline &spline)
|
|||
this->points = spline.GetDataPoints();
|
||||
this->mode = spline.getMode();
|
||||
this->idObject = spline.getIdObject();
|
||||
this->_name = spline.name();
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include "../container/vpointf.h"
|
||||
|
||||
class QString;
|
||||
|
||||
#define M_2PI 6.28318530717958647692528676655900576
|
||||
|
||||
/**
|
||||
|
@ -184,6 +186,8 @@ public:
|
|||
inline qint64 getIdObject() const {return idObject;}
|
||||
inline void setIdObject(const qint64 &value) {idObject = value;}
|
||||
VSpline &operator=(const VSpline &spl);
|
||||
QString name() const {return _name;}
|
||||
void setName(const QString &name) {_name = name;}
|
||||
protected:
|
||||
/**
|
||||
* @brief GetPoints повертає точки з яких складається сплайн.
|
||||
|
@ -225,6 +229,7 @@ private:
|
|||
QHash<qint64, VPointF> points;
|
||||
Draw::Draws mode;
|
||||
qint64 idObject;
|
||||
QString _name;
|
||||
/**
|
||||
* @brief LengthBezier повертає дожину сплайну за його чотирьма точками.
|
||||
* @param p1 початкова точка сплайну.
|
||||
|
|
|
@ -23,18 +23,29 @@
|
|||
#include "../exception/vexception.h"
|
||||
|
||||
VSplinePath::VSplinePath()
|
||||
: path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(QHash<qint64, VPointF>()), idObject(0){}
|
||||
: path(QVector<VSplinePoint>()), kCurve(1), mode(Draw::Calculation), points(QHash<qint64, VPointF>()), idObject(0),
|
||||
_name(QString()){}
|
||||
|
||||
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){}
|
||||
: path(QVector<VSplinePoint>()), kCurve(kCurve), mode(mode), points(*points), idObject(idObject), _name(QString())
|
||||
{}
|
||||
|
||||
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
||||
: path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()),
|
||||
idObject(splPath.getIdObject()){}
|
||||
idObject(splPath.getIdObject()), _name(splPath.name()){}
|
||||
|
||||
void VSplinePath::append(const VSplinePoint &point)
|
||||
{
|
||||
path.append(point);
|
||||
_name = QString("SplPath");
|
||||
for (qint32 i = 1; i <= this->Count(); ++i)
|
||||
{
|
||||
VSpline spl = this->GetSpline(i);
|
||||
VPointF first = spl.GetPointP1();
|
||||
VPointF second = spl.GetPointP4();
|
||||
QString splName = QString("_%1_%2").arg(first.name(), second.name());
|
||||
_name.append(splName);
|
||||
}
|
||||
}
|
||||
|
||||
qint32 VSplinePath::Count() const
|
||||
|
@ -143,6 +154,7 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path)
|
|||
this->mode = path.getMode();
|
||||
this->points = path.GetDataPoints();
|
||||
this->idObject = path.getIdObject();
|
||||
this->_name = path.name();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ public:
|
|||
|
||||
inline qint64 getIdObject() const {return idObject;}
|
||||
inline void setIdObject(const qint64 &value) {idObject = value;}
|
||||
|
||||
QString name() const {return _name;}
|
||||
void setName(const QString &name) {_name = name;}
|
||||
protected:
|
||||
/**
|
||||
* @brief path вектор з точок сплайна.
|
||||
|
@ -90,6 +91,7 @@ protected:
|
|||
Draw::Draws mode;
|
||||
QHash<qint64, VPointF> points;
|
||||
qint64 idObject;
|
||||
QString _name;
|
||||
};
|
||||
|
||||
#endif // VSPLINEPATH_H
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "ui_tablewindow.h"
|
||||
#include "widgets/vtablegraphicsview.h"
|
||||
#include "options.h"
|
||||
#include <QtSvg>
|
||||
|
||||
TableWindow::TableWindow(QWidget *parent)
|
||||
:QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
|
||||
|
@ -375,6 +376,8 @@ void TableWindow::SvgFile(const QString &name) const
|
|||
generator.setTitle(tr("SVG Generator Example Drawing"));
|
||||
generator.setDescription(tr("An SVG drawing created by the SVG Generator "
|
||||
"Example provided with Qt."));
|
||||
generator.setResolution(PrintDPI);
|
||||
qDebug()<<"resolution is" << generator.resolution();
|
||||
QPainter painter;
|
||||
painter.begin(&generator);
|
||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||
|
|
Loading…
Reference in New Issue
Block a user