Fixed tool uniondetails.
--HG-- branch : feature
This commit is contained in:
parent
e50f9462a6
commit
9704e8177b
|
@ -30,12 +30,13 @@
|
||||||
#include "../exception/vexception.h"
|
#include "../exception/vexception.h"
|
||||||
|
|
||||||
VSplinePath::VSplinePath(qreal kCurve, qint64 idObject, Draw::Draws mode)
|
VSplinePath::VSplinePath(qreal kCurve, qint64 idObject, Draw::Draws mode)
|
||||||
: VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve)
|
: VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve), maxCountPoints(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
||||||
: VGObject(splPath), path(*splPath.GetPoint()), kCurve(splPath.getKCurve())
|
: VGObject(splPath), path(*splPath.GetPoint()), kCurve(splPath.getKCurve()),
|
||||||
|
maxCountPoints(splPath.getMaxCountPoints())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,3 +206,13 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
|
||||||
}
|
}
|
||||||
return QPointF();
|
return QPointF();
|
||||||
}
|
}
|
||||||
|
qint32 VSplinePath::getMaxCountPoints() const
|
||||||
|
{
|
||||||
|
return maxCountPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VSplinePath::setMaxCountPoints(const qint32 &value)
|
||||||
|
{
|
||||||
|
maxCountPoints = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,9 @@ public:
|
||||||
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
|
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
|
||||||
QPointF &spl2p3) const;
|
QPointF &spl2p3) const;
|
||||||
virtual QString name() const{return _name;}
|
virtual QString name() const{return _name;}
|
||||||
|
qint32 getMaxCountPoints() const;
|
||||||
|
void setMaxCountPoints(const qint32 &value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief path вектор з точок сплайна.
|
* @brief path вектор з точок сплайна.
|
||||||
|
@ -170,6 +173,7 @@ protected:
|
||||||
* @brief kCurve
|
* @brief kCurve
|
||||||
*/
|
*/
|
||||||
qreal kCurve;
|
qreal kCurve;
|
||||||
|
qint32 maxCountPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VSPLINEPATH_H
|
#endif // VSPLINEPATH_H
|
||||||
|
|
|
@ -252,6 +252,11 @@ void VToolCutSpline::RefreshGeometry()
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::RemoveReferens()
|
||||||
|
{
|
||||||
|
doc->DecrementReferens(splineId);
|
||||||
|
}
|
||||||
|
|
||||||
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)
|
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)
|
||||||
{
|
{
|
||||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid);
|
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid);
|
||||||
|
|
|
@ -127,6 +127,7 @@ protected:
|
||||||
* @brief RefreshGeometry
|
* @brief RefreshGeometry
|
||||||
*/
|
*/
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
|
virtual void RemoveReferens();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSpline)
|
Q_DISABLE_COPY(VToolCutSpline)
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -147,6 +147,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splPath1->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
splPath2->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
|
||||||
splPath1id = data->AddGObject(splPath1);
|
splPath1id = data->AddGObject(splPath1);
|
||||||
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
||||||
|
|
||||||
|
@ -198,6 +201,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splPath1->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
splPath2->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
|
||||||
data->UpdateGObject(splPath1id, splPath1);
|
data->UpdateGObject(splPath1id, splPath1);
|
||||||
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
||||||
|
|
||||||
|
@ -323,6 +329,11 @@ void VToolCutSplinePath::RefreshGeometry()
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::RemoveReferens()
|
||||||
|
{
|
||||||
|
doc->DecrementReferens(splinePathId);
|
||||||
|
}
|
||||||
|
|
||||||
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)
|
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)
|
||||||
{
|
{
|
||||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid);
|
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid);
|
||||||
|
|
|
@ -117,6 +117,7 @@ protected:
|
||||||
* @brief RefreshGeometry
|
* @brief RefreshGeometry
|
||||||
*/
|
*/
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
|
virtual void RemoveReferens();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -174,6 +174,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
Q_ASSERT(path != 0);
|
Q_ASSERT(path != 0);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
||||||
|
@ -185,6 +186,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
qint64 idP1 = data->AddGObject(p1);
|
qint64 idP1 = data->AddGObject(p1);
|
||||||
|
--k;
|
||||||
|
|
||||||
VPointF p2 = VPointF(spline.GetP2());
|
VPointF p2 = VPointF(spline.GetP2());
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
|
@ -199,6 +201,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
qint64 idP4 = data->AddGObject(p4);
|
qint64 idP4 = data->AddGObject(p4);
|
||||||
|
--k;
|
||||||
|
|
||||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
||||||
if (i==1)
|
if (i==1)
|
||||||
|
@ -209,6 +212,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
|
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
|
||||||
splinePath->at(i).KAsm1()));
|
splinePath->at(i).KAsm1()));
|
||||||
}
|
}
|
||||||
|
while(k>=0)
|
||||||
|
{
|
||||||
|
data->getNextId();
|
||||||
|
--k;
|
||||||
|
}
|
||||||
idObject = data->AddGObject(path);
|
idObject = data->AddGObject(path);
|
||||||
|
|
||||||
VSplinePath *path1 = new VSplinePath(*path);
|
VSplinePath *path1 = new VSplinePath(*path);
|
||||||
|
@ -319,9 +327,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
Q_ASSERT(splinePath != 0);
|
Q_ASSERT(splinePath != 0);
|
||||||
qDebug()<<splinePath->Count();
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
qDebug()<<det.at(i).getId();
|
|
||||||
qDebug()<<"Початок циклу.";
|
|
||||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
||||||
|
@ -334,7 +340,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p1);
|
data->UpdateGObject(idDetail+idCount, p1);
|
||||||
qDebug()<<idDetail+idCount;
|
--k;
|
||||||
|
|
||||||
VPointF p2 = VPointF(spline.GetP2());
|
VPointF p2 = VPointF(spline.GetP2());
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
|
@ -350,7 +356,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p4);
|
data->UpdateGObject(idDetail+idCount, p4);
|
||||||
qDebug()<<idDetail+idCount;
|
--k;
|
||||||
|
|
||||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
||||||
if (i==1)
|
if (i==1)
|
||||||
|
@ -362,9 +368,15 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
splinePath->at(i).KAsm1()));
|
splinePath->at(i).KAsm1()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(k>=0)
|
||||||
|
{
|
||||||
|
data->getNextId();
|
||||||
|
--k;
|
||||||
|
++idCount;
|
||||||
|
}
|
||||||
|
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, path);
|
data->UpdateGObject(idDetail+idCount, path);
|
||||||
qDebug()<<idDetail+idCount;
|
|
||||||
|
|
||||||
++idCount;
|
++idCount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user