Merged develop into feature
--HG-- branch : feature
This commit is contained in:
commit
d5a3289ef7
|
@ -1363,7 +1363,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
|
||||||
return;// Just ignore
|
return;// Just ignore
|
||||||
}
|
}
|
||||||
data->UpdateGObject(id, new VPointF(*point, point->name(), mx, my, idObject, Draw::Modeling));
|
data->UpdateGObject(id, new VPointF(*point, point->name(), mx, my, idObject, Draw::Modeling));
|
||||||
VNodePoint::Create(this, data, sceneDetail, id, idObject, parse, Source::FromFile, idTool);
|
VNodePoint::Create(this, data, sceneDetail, id, idObject, parse, Source::FromFile, "", idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
@ -2283,7 +2283,7 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
|
||||||
return;// Just ignore
|
return;// Just ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
VNodeSpline::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
VNodeSpline::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
@ -2328,7 +2328,7 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document
|
||||||
Q_UNUSED(e);
|
Q_UNUSED(e);
|
||||||
return;// Just ignore
|
return;// Just ignore
|
||||||
}
|
}
|
||||||
VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
@ -2408,7 +2408,7 @@ void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse
|
||||||
arc->setIdObject(idObject);
|
arc->setIdObject(idObject);
|
||||||
arc->setMode(Draw::Modeling);
|
arc->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
VNodeArc::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
VNodeArc::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,8 @@ public:
|
||||||
virtual ~VAbstractCubicBezier();
|
virtual ~VAbstractCubicBezier();
|
||||||
|
|
||||||
virtual VPointF GetP1 () const =0;
|
virtual VPointF GetP1 () const =0;
|
||||||
|
virtual VPointF GetP2 () const =0;
|
||||||
|
virtual VPointF GetP3 () const =0;
|
||||||
virtual VPointF GetP4 () const =0;
|
virtual VPointF GetP4 () const =0;
|
||||||
|
|
||||||
QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const;
|
QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const;
|
||||||
|
|
|
@ -48,10 +48,10 @@ public:
|
||||||
virtual VPointF GetP1() const Q_DECL_OVERRIDE;
|
virtual VPointF GetP1() const Q_DECL_OVERRIDE;
|
||||||
void SetP1(const VPointF &p);
|
void SetP1(const VPointF &p);
|
||||||
|
|
||||||
VPointF GetP2() const;
|
virtual VPointF GetP2() const Q_DECL_OVERRIDE;
|
||||||
void SetP2(const VPointF &p);
|
void SetP2(const VPointF &p);
|
||||||
|
|
||||||
VPointF GetP3() const;
|
virtual VPointF GetP3() const Q_DECL_OVERRIDE;
|
||||||
void SetP3(const VPointF &p);
|
void SetP3(const VPointF &p);
|
||||||
|
|
||||||
virtual VPointF GetP4() const Q_DECL_OVERRIDE;
|
virtual VPointF GetP4() const Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -222,11 +222,11 @@ void VSpline::SetP1(const VPointF &p)
|
||||||
* @brief GetP2 return first control point.
|
* @brief GetP2 return first control point.
|
||||||
* @return first control point.
|
* @return first control point.
|
||||||
*/
|
*/
|
||||||
QPointF VSpline::GetP2() const
|
VPointF VSpline::GetP2() const
|
||||||
{
|
{
|
||||||
QLineF p1p2(d->p1.x(), d->p1.y(), d->p1.x() + d->c1Length, d->p1.y());
|
QLineF p1p2(d->p1.x(), d->p1.y(), d->p1.x() + d->c1Length, d->p1.y());
|
||||||
p1p2.setAngle(d->angle1);
|
p1p2.setAngle(d->angle1);
|
||||||
return p1p2.p2();
|
return VPointF(p1p2.p2());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -234,11 +234,11 @@ QPointF VSpline::GetP2() const
|
||||||
* @brief GetP3 return second control point.
|
* @brief GetP3 return second control point.
|
||||||
* @return second control point.
|
* @return second control point.
|
||||||
*/
|
*/
|
||||||
QPointF VSpline::GetP3() const
|
VPointF VSpline::GetP3() const
|
||||||
{
|
{
|
||||||
QLineF p4p3(d->p4.x(), d->p4.y(), d->p4.x() + d->c2Length, d->p4.y());
|
QLineF p4p3(d->p4.x(), d->p4.y(), d->p4.x() + d->c2Length, d->p4.y());
|
||||||
p4p3.setAngle(d->angle2);
|
p4p3.setAngle(d->angle2);
|
||||||
return p4p3.p2();
|
return VPointF(p4p3.p2());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -59,8 +59,8 @@ public:
|
||||||
virtual VPointF GetP1 () const Q_DECL_OVERRIDE;
|
virtual VPointF GetP1 () const Q_DECL_OVERRIDE;
|
||||||
void SetP1 (const VPointF &p);
|
void SetP1 (const VPointF &p);
|
||||||
|
|
||||||
QPointF GetP2 () const;
|
virtual VPointF GetP2 () const Q_DECL_OVERRIDE;
|
||||||
QPointF GetP3 () const;
|
virtual VPointF GetP3 () const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual VPointF GetP4 () const Q_DECL_OVERRIDE;
|
virtual VPointF GetP4 () const Q_DECL_OVERRIDE;
|
||||||
void SetP4 (const VPointF &p);
|
void SetP4 (const VPointF &p);
|
||||||
|
|
|
@ -44,9 +44,9 @@ const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool");
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
||||||
const quint32 &idTool, QObject *parent)
|
const QString &drawName, const quint32 &idTool, QObject *parent)
|
||||||
: VAbstractTool(doc, data, id, parent), parentType(ParentType::Item), idNode(idNode), idTool(idTool),
|
: VAbstractTool(doc, data, id, parent), parentType(ParentType::Item), idNode(idNode), idTool(idTool),
|
||||||
currentColor(Qt::black)
|
currentColor(Qt::black), m_drawName(drawName)
|
||||||
{
|
{
|
||||||
_referens = 0;
|
_referens = 0;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,6 @@ void VAbstractNode::GroupVisibility(quint32 object, bool visible)
|
||||||
*/
|
*/
|
||||||
void VAbstractNode::AddToModeling(const QDomElement &domElement)
|
void VAbstractNode::AddToModeling(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
AddDetNode *addNode = new AddDetNode(domElement, doc);
|
AddDetNode *addNode = new AddDetNode(domElement, doc, m_drawName);
|
||||||
qApp->getUndoStack()->push(addNode);
|
qApp->getUndoStack()->push(addNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class VAbstractNode : public VAbstractTool
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode,
|
||||||
const quint32 &idTool, QObject *parent = nullptr);
|
const QString &drawName = QString(), const quint32 &idTool = 0, QObject *parent = nullptr);
|
||||||
virtual ~VAbstractNode() Q_DECL_OVERRIDE {}
|
virtual ~VAbstractNode() Q_DECL_OVERRIDE {}
|
||||||
static const QString AttrIdTool;
|
static const QString AttrIdTool;
|
||||||
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
||||||
|
@ -67,6 +67,8 @@ protected:
|
||||||
/** @brief currentColor current tool color. */
|
/** @brief currentColor current tool color. */
|
||||||
QColor currentColor;
|
QColor currentColor;
|
||||||
|
|
||||||
|
QString m_drawName;
|
||||||
|
|
||||||
void AddToModeling(const QDomElement &domElement);
|
void AddToModeling(const QDomElement &domElement);
|
||||||
virtual void SetVisualization() Q_DECL_OVERRIDE {}
|
virtual void SetVisualization() Q_DECL_OVERRIDE {}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ const QString VNodeArc::ToolType = QStringLiteral("modeling");
|
||||||
* @param qoParent QObject parent
|
* @param qoParent QObject parent
|
||||||
*/
|
*/
|
||||||
VNodeArc::VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
VNodeArc::VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
||||||
const quint32 &idTool, QObject *qoParent)
|
const QString &drawName, const quint32 &idTool, QObject *qoParent)
|
||||||
:VAbstractNode(doc, data, id, idArc, idTool, qoParent)
|
:VAbstractNode(doc, data, id, idArc, drawName, idTool, qoParent)
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -63,12 +63,12 @@ VNodeArc::VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32
|
||||||
* @param idTool tool id.
|
* @param idTool tool id.
|
||||||
*/
|
*/
|
||||||
void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc,
|
void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc,
|
||||||
const Document &parse, const Source &typeCreation, const quint32 &idTool)
|
const Document &parse, const Source &typeCreation, const QString &drawName, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodeArc, doc);
|
VAbstractTool::AddRecord(id, Tool::NodeArc, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, doc);
|
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc);
|
||||||
|
|
||||||
doc->AddTool(id, arc);
|
doc->AddTool(id, arc);
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
|
|
|
@ -40,7 +40,7 @@ class VNodeArc :public VAbstractNode
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse,
|
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0);
|
const Source &typeCreation, const QString &drawName = QString(), const quint32 &idTool = 0);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
@ -57,7 +57,7 @@ private:
|
||||||
Q_DISABLE_COPY(VNodeArc)
|
Q_DISABLE_COPY(VNodeArc)
|
||||||
|
|
||||||
VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
const QString &drawName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODEARC_H4
|
#endif // VNODEARC_H4
|
||||||
|
|
|
@ -48,8 +48,8 @@ const QString VNodePoint::ToolType = QStringLiteral("modeling");
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VNodePoint::VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
|
VNodePoint::VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
|
||||||
const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
|
const QString &drawName, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
|
||||||
:VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(0),
|
:VAbstractNode(doc, data, id, idPoint, drawName, idTool, qoParent), QGraphicsEllipseItem(parent), radius(0),
|
||||||
namePoint(nullptr), lineName(nullptr)
|
namePoint(nullptr), lineName(nullptr)
|
||||||
{
|
{
|
||||||
radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm);
|
radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm);
|
||||||
|
@ -82,14 +82,14 @@ VNodePoint::VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quin
|
||||||
*/
|
*/
|
||||||
void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
||||||
quint32 id, quint32 idPoint, const Document &parse,
|
quint32 id, quint32 idPoint, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool)
|
const Source &typeCreation, const QString &drawName, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
|
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
||||||
//Better check garbage before each saving file. Check only modeling tags.
|
//Better check garbage before each saving file. Check only modeling tags.
|
||||||
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, doc);
|
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, drawName, idTool, doc);
|
||||||
|
|
||||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VNodePoint::EnableToolMove);
|
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VNodePoint::EnableToolMove);
|
||||||
connect(scene, &VMainGraphicsScene::EnablePointItemHover, point, &VNodePoint::AllowHover);
|
connect(scene, &VMainGraphicsScene::EnablePointItemHover, point, &VNodePoint::AllowHover);
|
||||||
|
|
|
@ -46,7 +46,7 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
||||||
quint32 id, quint32 idPoint, const Document &parse,
|
quint32 id, quint32 idPoint, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0);
|
const Source &typeCreation, const QString &drawName = QString(), const quint32 &idTool = 0);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
@ -94,7 +94,8 @@ private:
|
||||||
Q_DISABLE_COPY(VNodePoint)
|
Q_DISABLE_COPY(VNodePoint)
|
||||||
|
|
||||||
VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
|
VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr );
|
const QString &drawName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr,
|
||||||
|
QGraphicsItem * parent = nullptr );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODEPOINT_H
|
#endif // VNODEPOINT_H
|
||||||
|
|
|
@ -45,8 +45,8 @@ const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
|
||||||
* @param qoParent QObject parent.
|
* @param qoParent QObject parent.
|
||||||
*/
|
*/
|
||||||
VNodeSpline::VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
VNodeSpline::VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *qoParent)
|
const Source &typeCreation, const QString &drawName, const quint32 &idTool, QObject *qoParent)
|
||||||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent)
|
:VAbstractNode(doc, data, id, idSpline, drawName, idTool, qoParent)
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,13 @@ VNodeSpline::VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, qu
|
||||||
*/
|
*/
|
||||||
VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool)
|
const Source &typeCreation, const QString &drawName, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodeSpline, doc);
|
VAbstractTool::AddRecord(id, Tool::NodeSpline, doc);
|
||||||
VNodeSpline *spl = nullptr;
|
VNodeSpline *spl = nullptr;
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, doc);
|
spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, drawName, idTool, doc);
|
||||||
|
|
||||||
doc->AddTool(id, spl);
|
doc->AddTool(id, spl);
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
|
|
|
@ -41,7 +41,8 @@ class VNodeSpline:public VAbstractNode
|
||||||
public:
|
public:
|
||||||
static VNodeSpline *Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
static VNodeSpline *Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0);
|
const Source &typeCreation, const QString &drawName = QString(),
|
||||||
|
const quint32 &idTool = 0);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
@ -58,7 +59,7 @@ private:
|
||||||
Q_DISABLE_COPY(VNodeSpline)
|
Q_DISABLE_COPY(VNodeSpline)
|
||||||
|
|
||||||
VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
const QString &drawName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODESPLINE_H
|
#endif // VNODESPLINE_H
|
||||||
|
|
|
@ -46,8 +46,9 @@ const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
|
||||||
* @param qoParent QObject parent.
|
* @param qoParent QObject parent.
|
||||||
*/
|
*/
|
||||||
VNodeSplinePath::VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
VNodeSplinePath::VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *qoParent)
|
const Source &typeCreation, const QString &drawName, const quint32 &idTool,
|
||||||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent)
|
QObject *qoParent)
|
||||||
|
:VAbstractNode(doc, data, id, idSpline, drawName, idTool, qoParent)
|
||||||
{
|
{
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -64,12 +65,13 @@ VNodeSplinePath::VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint3
|
||||||
* @param idTool tool id.
|
* @param idTool tool id.
|
||||||
*/
|
*/
|
||||||
void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse, const Source &typeCreation, const quint32 &idTool)
|
quint32 idSpline, const Document &parse, const Source &typeCreation,
|
||||||
|
const QString &drawName, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc);
|
VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, doc);
|
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, drawName, idTool, doc);
|
||||||
|
|
||||||
doc->AddTool(id, splPath);
|
doc->AddTool(id, splPath);
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
|
|
|
@ -41,7 +41,7 @@ class VNodeSplinePath : public VAbstractNode
|
||||||
public:
|
public:
|
||||||
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0);
|
const Source &typeCreation, const QString &drawName = QString(), const quint32 &idTool = 0);
|
||||||
|
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
@ -58,7 +58,7 @@ private:
|
||||||
Q_DISABLE_COPY(VNodeSplinePath)
|
Q_DISABLE_COPY(VNodeSplinePath)
|
||||||
|
|
||||||
VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
const QString &drawName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODESPLINEPATH_H
|
#endif // VNODESPLINEPATH_H
|
||||||
|
|
|
@ -95,6 +95,8 @@ VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, co
|
||||||
* @param det detail what we union.
|
* @param det detail what we union.
|
||||||
* @param i index node in detail.
|
* @param i index node in detail.
|
||||||
* @param idTool id tool union details.
|
* @param idTool id tool union details.
|
||||||
|
* @param children
|
||||||
|
* @param drawName
|
||||||
* @param dx bias node x axis.
|
* @param dx bias node x axis.
|
||||||
* @param dy bias node y axis.
|
* @param dy bias node y axis.
|
||||||
* @param pRotate point rotation.
|
* @param pRotate point rotation.
|
||||||
|
@ -102,8 +104,8 @@ VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, co
|
||||||
*/
|
*/
|
||||||
void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc,
|
void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data, VDetail &newDetail, const VDetail &det, const int &i,
|
VContainer *data, VDetail &newDetail, const VDetail &det, const int &i,
|
||||||
const quint32 &idTool, QVector<quint32> &children, const qreal &dx,
|
const quint32 &idTool, QVector<quint32> &children, const QString &drawName,
|
||||||
const qreal &dy, const quint32 &pRotate, const qreal &angle)
|
const qreal &dx, const qreal &dy, const quint32 &pRotate, const qreal &angle)
|
||||||
{
|
{
|
||||||
quint32 id = 0, idObject = 0;
|
quint32 id = 0, idObject = 0;
|
||||||
switch (det.at(i).getTypeTool())
|
switch (det.at(i).getTypeTool())
|
||||||
|
@ -124,7 +126,8 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
VPointF *point1 = new VPointF(*point);
|
VPointF *point1 = new VPointF(*point);
|
||||||
point1->setMode(Draw::Modeling);
|
point1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(point1);
|
id = data->AddGObject(point1);
|
||||||
VNodePoint::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
VNodePoint::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, drawName,
|
||||||
|
idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -161,7 +164,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
arc2->setMode(Draw::Modeling);
|
arc2->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(arc2);
|
id = data->AddGObject(arc2);
|
||||||
|
|
||||||
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -173,7 +176,8 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
const QSharedPointer<VAbstractCubicBezier> spline =
|
||||||
|
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
|
||||||
|
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *p1 = new VPointF(spline->GetP1());
|
||||||
|
@ -195,7 +199,7 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
VSpline *spl1 = new VSpline(*spl);
|
VSpline *spl1 = new VSpline(*spl);
|
||||||
spl1->setMode(Draw::Modeling);
|
spl1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(spl1);
|
id = data->AddGObject(spl1);
|
||||||
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
|
||||||
|
|
||||||
delete p4;
|
delete p4;
|
||||||
delete p1;
|
delete p1;
|
||||||
|
@ -212,14 +216,11 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const QSharedPointer<VSplinePath> splinePath = data->GeometricObject<VSplinePath>(det.at(i).getId());
|
const QSharedPointer<VAbstractCubicBezierPath> splinePath =
|
||||||
|
data->GeometricObject<VAbstractCubicBezierPath>(det.at(i).getId());
|
||||||
for (qint32 i = 1; i <= splinePath->CountSubSpl(); ++i)
|
for (qint32 i = 1; i <= splinePath->CountSubSpl(); ++i)
|
||||||
{
|
{
|
||||||
const VSplinePoint &point1 = splinePath->at(i-1);
|
const VSpline spline = splinePath->GetSpline(i);
|
||||||
const VSplinePoint &point2 = splinePath->at(i);
|
|
||||||
VSpline spline(point1.P(), point2.P(), point1.Angle2(), point1.Angle2Formula(), point2.Angle1(),
|
|
||||||
point2.Angle1Formula(), point1.Length2(), point1.Length2Formula(), point2.Length1(),
|
|
||||||
point2.Length1Formula());
|
|
||||||
|
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
VPointF *p1 = new VPointF(spline.GetP1());
|
||||||
|
@ -241,16 +242,22 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
const QString angle1F = QString().number(angle1);
|
const QString angle1F = QString().number(angle1);
|
||||||
|
|
||||||
path->append(VSplinePoint(*p1, angle1, angle1F, spl.GetStartAngle(), spl.GetStartAngleFormula(),
|
path->append(VSplinePoint(*p1, angle1, angle1F, spl.GetStartAngle(), spl.GetStartAngleFormula(),
|
||||||
point1.Length1(), point1.Length1Formula(), point1.Length2(),
|
0, "0", spline.GetC1Length(), spline.GetC1LengthFormula()));
|
||||||
point1.Length2Formula()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal angle2 = spl.GetEndAngle()+180;
|
const qreal angle2 = spl.GetEndAngle()+180;
|
||||||
const QString angle2F = QString().number(angle2);
|
const QString angle2F = QString().number(angle2);
|
||||||
|
qreal pL2 = 0;
|
||||||
|
QString pL2F("0");
|
||||||
|
if (i+1 <= splinePath->CountSubSpl())
|
||||||
|
{
|
||||||
|
const VSpline nextSpline = splinePath->GetSpline(i+1);
|
||||||
|
pL2 = nextSpline.GetC1Length();
|
||||||
|
pL2F = nextSpline.GetC1LengthFormula();
|
||||||
|
}
|
||||||
|
|
||||||
path->append(VSplinePoint(*p4, spl.GetEndAngle(), spl.GetEndAngleFormula(), angle2, angle2F,
|
path->append(VSplinePoint(*p4, spl.GetEndAngle(), spl.GetEndAngleFormula(), angle2, angle2F,
|
||||||
point2.Length1(), point2.Length1Formula(), point2.Length2(),
|
spline.GetC2Length(), spline.GetC2LengthFormula(), pL2, pL2F));
|
||||||
point2.Length2Formula()));
|
|
||||||
|
|
||||||
delete p4;
|
delete p4;
|
||||||
delete p1;
|
delete p1;
|
||||||
|
@ -261,7 +268,8 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
VSplinePath *path1 = new VSplinePath(*path);
|
VSplinePath *path1 = new VSplinePath(*path);
|
||||||
path1->setMode(Draw::Modeling);
|
path1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(path1);
|
id = data->AddGObject(path1);
|
||||||
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName,
|
||||||
|
idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -332,7 +340,8 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
{
|
{
|
||||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != 0)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
const QSharedPointer<VAbstractCubicBezier> spline =
|
||||||
|
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
|
||||||
|
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *p1 = new VPointF(spline->GetP1());
|
||||||
|
@ -360,16 +369,12 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const QSharedPointer<VSplinePath> splinePath = data->GeometricObject<VSplinePath>(det.at(i).getId());
|
const QSharedPointer<VAbstractCubicBezierPath> splinePath =
|
||||||
|
data->GeometricObject<VAbstractCubicBezierPath>(det.at(i).getId());
|
||||||
SCASSERT(splinePath != nullptr);
|
SCASSERT(splinePath != nullptr);
|
||||||
for (qint32 i = 1; i <= splinePath->CountSubSpl(); ++i)
|
for (qint32 i = 1; i <= splinePath->CountSubSpl(); ++i)
|
||||||
{
|
{
|
||||||
const VSplinePoint &point1 = splinePath->at(i-1);
|
const VSpline spline = splinePath->GetSpline(i);
|
||||||
const VSplinePoint &point2 = splinePath->at(i);
|
|
||||||
|
|
||||||
VSpline spline(point1.P(), point2.P(), point1.Angle2(), point1.Angle2Formula(), point2.Angle1(),
|
|
||||||
point2.Angle1Formula(), point1.Length2(), point1.Length2Formula(), point2.Length1(),
|
|
||||||
point2.Length1Formula());
|
|
||||||
|
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
VPointF *p1 = new VPointF(spline.GetP1());
|
||||||
|
@ -391,16 +396,23 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
const QString angle1F = QString().number(angle1);
|
const QString angle1F = QString().number(angle1);
|
||||||
|
|
||||||
path->append(VSplinePoint(*p1, angle1, angle1F, spl.GetStartAngle(), spl.GetStartAngleFormula(),
|
path->append(VSplinePoint(*p1, angle1, angle1F, spl.GetStartAngle(), spl.GetStartAngleFormula(),
|
||||||
point1.Length1(), point1.Length1Formula(), point1.Length2(),
|
0, "0", spline.GetC1Length(), spline.GetC1LengthFormula()));
|
||||||
point1.Length2Formula()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal angle2 = spl.GetEndAngle()+180;
|
const qreal angle2 = spl.GetEndAngle()+180;
|
||||||
const QString angle2F = QString().number(angle2);
|
const QString angle2F = QString().number(angle2);
|
||||||
|
|
||||||
|
qreal pL2 = 0;
|
||||||
|
QString pL2F("0");
|
||||||
|
if (i+1 <= splinePath->CountSubSpl())
|
||||||
|
{
|
||||||
|
const VSpline nextSpline = splinePath->GetSpline(i+1);
|
||||||
|
pL2 = nextSpline.GetC1Length();
|
||||||
|
pL2F = nextSpline.GetC1LengthFormula();
|
||||||
|
}
|
||||||
|
|
||||||
path->append(VSplinePoint(*p4, spl.GetEndAngle(), spl.GetEndAngleFormula(), angle2, angle2F,
|
path->append(VSplinePoint(*p4, spl.GetEndAngle(), spl.GetEndAngleFormula(), angle2, angle2F,
|
||||||
point2.Length1(), point2.Length1Formula(), point2.Length2(),
|
spline.GetC2Length(), spline.GetC2LengthFormula(), pL2, pL2F));
|
||||||
point2.Length2Formula()));
|
|
||||||
|
|
||||||
delete p1;
|
delete p1;
|
||||||
delete p4;
|
delete p4;
|
||||||
|
@ -508,7 +520,7 @@ VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsSc
|
||||||
VDetail d2 = data->GetDetail(dialogTool->getD2());
|
VDetail d2 = data->GetDetail(dialogTool->getD2());
|
||||||
quint32 indexD1 = static_cast<quint32>(dialogTool->getIndexD1());
|
quint32 indexD1 = static_cast<quint32>(dialogTool->getIndexD1());
|
||||||
quint32 indexD2 = static_cast<quint32>(dialogTool->getIndexD2());
|
quint32 indexD2 = static_cast<quint32>(dialogTool->getIndexD2());
|
||||||
qApp->getUndoStack()->beginMacro("union details");
|
qApp->getUndoStack()->beginMacro(tr("union details"));
|
||||||
VToolUnionDetails* tool = Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene,
|
VToolUnionDetails* tool = Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene,
|
||||||
doc, data, Document::FullParse, Source::FromGui);
|
doc, data, Document::FullParse, Source::FromGui);
|
||||||
qApp->getUndoStack()->endMacro();
|
qApp->getUndoStack()->endMacro();
|
||||||
|
@ -601,7 +613,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
QVector<quint32> children;
|
QVector<quint32> children;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
AddToNewDetail(scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id, children);
|
AddToNewDetail(scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id, children, drawName);
|
||||||
++i;
|
++i;
|
||||||
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1)
|
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1)
|
||||||
{
|
{
|
||||||
|
@ -613,7 +625,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
{
|
{
|
||||||
j=0;
|
j=0;
|
||||||
}
|
}
|
||||||
AddToNewDetail(scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, children,
|
AddToNewDetail(scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, children, drawName,
|
||||||
dx, dy, det1p1.getId(), angle);
|
dx, dy, det1p1.getId(), angle);
|
||||||
++pointsD2;
|
++pointsD2;
|
||||||
++j;
|
++j;
|
||||||
|
@ -621,7 +633,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
}
|
}
|
||||||
} while (i < countNodeD1);
|
} while (i < countNodeD1);
|
||||||
|
|
||||||
newDetail.setName("Detail");
|
newDetail.setName(tr("United detail"));
|
||||||
newDetail.setWidth(d1.getWidth());
|
newDetail.setWidth(d1.getWidth());
|
||||||
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool, drawName);
|
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool, drawName);
|
||||||
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
QHash<quint32, VDataTool*>* tools = doc->getTools();
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
static const QString NodeTypeModeling;
|
static const QString NodeTypeModeling;
|
||||||
static void AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
static void AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||||
VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool,
|
VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool,
|
||||||
QVector<quint32> &children, const qreal &dx = 0,
|
QVector<quint32> &children, const QString &drawName, const qreal &dx = 0,
|
||||||
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
|
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
|
||||||
static void UpdatePoints(VContainer *data, const VDetail &det, const int &i,
|
static void UpdatePoints(VContainer *data, const VDetail &det, const int &i,
|
||||||
QVector<quint32> &children, const qreal &dx = 0, const qreal &dy = 0,
|
QVector<quint32> &children, const qreal &dx = 0, const qreal &dy = 0,
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include "adddetnode.h"
|
#include "adddetnode.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
AddDetNode::AddDetNode(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent)
|
AddDetNode::AddDetNode(const QDomElement &xml, VAbstractPattern *doc, const QString &drawName, QUndoCommand *parent)
|
||||||
: VUndoCommand(xml, doc, parent)
|
: VUndoCommand(xml, doc, parent), m_drawName(drawName)
|
||||||
{
|
{
|
||||||
setText(QObject::tr("add node"));
|
setText(QObject::tr("add node"));
|
||||||
nodeId = doc->GetParametrId(xml);
|
nodeId = doc->GetParametrId(xml);
|
||||||
|
@ -45,13 +45,13 @@ void AddDetNode::undo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo, "Undo.");
|
qCDebug(vUndo, "Undo.");
|
||||||
|
|
||||||
QDomElement modelingElement;
|
QDomElement modeling = GetModelingSection();
|
||||||
if (doc->GetActivNodeElement(VAbstractPattern::TagModeling, modelingElement))
|
if (not modeling.isNull())
|
||||||
{
|
{
|
||||||
QDomElement domElement = doc->elementById(nodeId);
|
QDomElement domElement = doc->elementById(nodeId);
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
if (modelingElement.removeChild(domElement).isNull())
|
if (modeling.removeChild(domElement).isNull())
|
||||||
{
|
{
|
||||||
qCDebug(vUndo, "Can't delete node.");
|
qCDebug(vUndo, "Can't delete node.");
|
||||||
return;
|
return;
|
||||||
|
@ -75,10 +75,10 @@ void AddDetNode::redo()
|
||||||
{
|
{
|
||||||
qCDebug(vUndo, "Redo.");
|
qCDebug(vUndo, "Redo.");
|
||||||
|
|
||||||
QDomElement modelingElement;
|
QDomElement modeling = GetModelingSection();
|
||||||
if (doc->GetActivNodeElement(VAbstractPattern::TagModeling, modelingElement))
|
if (not modeling.isNull())
|
||||||
{
|
{
|
||||||
modelingElement.appendChild(xml);
|
modeling.appendChild(xml);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -86,3 +86,18 @@ void AddDetNode::redo()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QDomElement AddDetNode::GetModelingSection() const
|
||||||
|
{
|
||||||
|
QDomElement modeling;
|
||||||
|
if (m_drawName.isEmpty())
|
||||||
|
{
|
||||||
|
doc->GetActivNodeElement(VAbstractPattern::TagModeling, modeling);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modeling = doc->GetDraw(m_drawName).firstChildElement(VAbstractPattern::TagModeling);
|
||||||
|
}
|
||||||
|
return modeling;
|
||||||
|
}
|
||||||
|
|
|
@ -35,12 +35,16 @@ class AddDetNode : public VUndoCommand
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AddDetNode(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = 0);
|
AddDetNode(const QDomElement &xml, VAbstractPattern *doc, const QString &drawName, QUndoCommand *parent = 0);
|
||||||
virtual ~AddDetNode() Q_DECL_OVERRIDE;
|
virtual ~AddDetNode() Q_DECL_OVERRIDE;
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(AddDetNode)
|
Q_DISABLE_COPY(AddDetNode)
|
||||||
|
|
||||||
|
QString m_drawName;
|
||||||
|
|
||||||
|
QDomElement GetModelingSection() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ADDDETNODE_H
|
#endif // ADDDETNODE_H
|
||||||
|
|
|
@ -392,8 +392,8 @@ void TST_VSpline::TestLengthByPoint()
|
||||||
void TST_VSpline::CompareSplines(const VSpline &spl1, const VSpline &spl2) const
|
void TST_VSpline::CompareSplines(const VSpline &spl1, const VSpline &spl2) const
|
||||||
{
|
{
|
||||||
QCOMPARE(spl1.GetP1().toQPointF().toPoint(), spl2.GetP1().toQPointF().toPoint());
|
QCOMPARE(spl1.GetP1().toQPointF().toPoint(), spl2.GetP1().toQPointF().toPoint());
|
||||||
QCOMPARE(spl1.GetP2().toPoint(), spl2.GetP2().toPoint());
|
QCOMPARE(spl1.GetP2().toQPointF().toPoint(), spl2.GetP2().toQPointF().toPoint());
|
||||||
QCOMPARE(spl1.GetP3().toPoint(), spl2.GetP3().toPoint());
|
QCOMPARE(spl1.GetP3().toQPointF().toPoint(), spl2.GetP3().toQPointF().toPoint());
|
||||||
QCOMPARE(spl1.GetP4().toQPointF().toPoint(), spl2.GetP4().toQPointF().toPoint());
|
QCOMPARE(spl1.GetP4().toQPointF().toPoint(), spl2.GetP4().toQPointF().toPoint());
|
||||||
|
|
||||||
QCOMPARE(spl1.GetStartAngle(), spl2.GetStartAngle());
|
QCOMPARE(spl1.GetStartAngle(), spl2.GetStartAngle());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user