Merge with develop.
--HG-- branch : feature
This commit is contained in:
commit
0882313f1e
|
@ -77,7 +77,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
|
||||||
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
|
||||||
|
|
||||||
switch (item->type())
|
switch (item->type())
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
|
||||||
|
|
||||||
switch (currentItem->type())
|
switch (currentItem->type())
|
||||||
{
|
{
|
||||||
|
@ -360,7 +360,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch.");
|
||||||
|
|
||||||
switch (currentItem->type())
|
switch (currentItem->type())
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,7 +209,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
QString DialogHistory::Record(const VToolRecord &tool)
|
QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools was used in history.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in history.");
|
||||||
|
|
||||||
const QDomElement domElem = doc->elementById(tool.getId());
|
const QDomElement domElem = doc->elementById(tool.getId());
|
||||||
if (domElem.isElement() == false)
|
if (domElem.isElement() == false)
|
||||||
|
@ -393,6 +393,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::Piece:
|
case Tool::Piece:
|
||||||
case Tool::UnionDetails:
|
case Tool::UnionDetails:
|
||||||
case Tool::NodeArc:
|
case Tool::NodeArc:
|
||||||
|
case Tool::NodeElArc:
|
||||||
case Tool::NodePoint:
|
case Tool::NodePoint:
|
||||||
case Tool::NodeSpline:
|
case Tool::NodeSpline:
|
||||||
case Tool::NodeSplinePath:
|
case Tool::NodeSplinePath:
|
||||||
|
|
|
@ -1769,7 +1769,7 @@ void MainWindow::InitToolButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools
|
// This check helps to find missed tools
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Check if all tools were connected.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Check if all tools were connected.");
|
||||||
|
|
||||||
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
|
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
|
||||||
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
|
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
|
||||||
|
@ -1842,7 +1842,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
void MainWindow::CancelTool()
|
void MainWindow::CancelTool()
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Canceling tool.");
|
qCDebug(vMainWindow, "Canceling tool.");
|
||||||
delete dialogTool;
|
delete dialogTool;
|
||||||
|
@ -1875,6 +1875,7 @@ void MainWindow::CancelTool()
|
||||||
case Tool::LAST_ONE_DO_NOT_USE:
|
case Tool::LAST_ONE_DO_NOT_USE:
|
||||||
case Tool::NodePoint:
|
case Tool::NodePoint:
|
||||||
case Tool::NodeArc:
|
case Tool::NodeArc:
|
||||||
|
case Tool::NodeElArc:
|
||||||
case Tool::NodeSpline:
|
case Tool::NodeSpline:
|
||||||
case Tool::NodeSplinePath:
|
case Tool::NodeSplinePath:
|
||||||
Q_UNREACHABLE(); //-V501
|
Q_UNREACHABLE(); //-V501
|
||||||
|
@ -3052,7 +3053,7 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check helps to find missed tools
|
// This check helps to find missed tools
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
|
||||||
|
|
||||||
//Drawing Tools
|
//Drawing Tools
|
||||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||||
|
@ -3374,7 +3375,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
void MainWindow::LastUsedTool()
|
void MainWindow::LastUsedTool()
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled.");
|
||||||
|
|
||||||
if (currentTool == lastUsedTool)
|
if (currentTool == lastUsedTool)
|
||||||
{
|
{
|
||||||
|
@ -3399,6 +3400,7 @@ void MainWindow::LastUsedTool()
|
||||||
case Tool::LAST_ONE_DO_NOT_USE:
|
case Tool::LAST_ONE_DO_NOT_USE:
|
||||||
case Tool::NodePoint:
|
case Tool::NodePoint:
|
||||||
case Tool::NodeArc:
|
case Tool::NodeArc:
|
||||||
|
case Tool::NodeElArc:
|
||||||
case Tool::NodeSpline:
|
case Tool::NodeSpline:
|
||||||
case Tool::NodeSplinePath:
|
case Tool::NodeSplinePath:
|
||||||
Q_UNREACHABLE(); //-V501
|
Q_UNREACHABLE(); //-V501
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
#include "../vgeometry/vsplinepath.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
#include "../vgeometry/vcubicbezierpath.h"
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
|
@ -535,7 +536,8 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
|
||||||
QStringList types = QStringList() << VAbstractPattern::NodePoint
|
QStringList types = QStringList() << VAbstractPattern::NodePoint
|
||||||
<< VAbstractPattern::NodeArc
|
<< VAbstractPattern::NodeArc
|
||||||
<< VAbstractPattern::NodeSpline
|
<< VAbstractPattern::NodeSpline
|
||||||
<< VAbstractPattern::NodeSplinePath;
|
<< VAbstractPattern::NodeSplinePath
|
||||||
|
<< VAbstractPattern::NodeElArc;
|
||||||
switch (types.indexOf(t))
|
switch (types.indexOf(t))
|
||||||
{
|
{
|
||||||
case 0: // NodePoint
|
case 0: // NodePoint
|
||||||
|
@ -550,6 +552,9 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
|
||||||
case 3: // NodeSplinePath
|
case 3: // NodeSplinePath
|
||||||
tool = Tool::NodeSplinePath;
|
tool = Tool::NodeSplinePath;
|
||||||
break;
|
break;
|
||||||
|
case 4: // NodeElArc
|
||||||
|
tool = Tool::NodeElArc;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
VException e(tr("Wrong tag name '%1'.").arg(t));
|
VException e(tr("Wrong tag name '%1'.").arg(t));
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -2694,6 +2699,41 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPattern::ParseNodeEllipticalArc(const QDomElement &domElement, const Document &parse)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
quint32 id = 0;
|
||||||
|
|
||||||
|
ToolsCommonAttributes(domElement, id);
|
||||||
|
const quint32 idObject = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
||||||
|
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
|
||||||
|
VEllipticalArc *arc = nullptr;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
arc = new VEllipticalArc(*data->GeometricObject<VEllipticalArc>(idObject));
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||||
|
Q_UNUSED(e);
|
||||||
|
return;// Just ignore
|
||||||
|
}
|
||||||
|
arc->setIdObject(idObject);
|
||||||
|
arc->setMode(Draw::Modeling);
|
||||||
|
data->UpdateGObject(id, arc);
|
||||||
|
VNodeEllipticalArc::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool);
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
VExceptionObjectError excep(tr("Error creating or updating modeling elliptical arc"), domElement);
|
||||||
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
|
throw excep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse)
|
void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse)
|
||||||
{
|
{
|
||||||
|
@ -3136,13 +3176,17 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty");
|
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty");
|
||||||
|
|
||||||
QStringList arcs = QStringList() << VToolEllipticalArc::ToolType; /*0*/
|
const QStringList arcs = QStringList() << VToolEllipticalArc::ToolType /*0*/
|
||||||
|
<< VNodeEllipticalArc::ToolType; /*1*/
|
||||||
|
|
||||||
switch (arcs.indexOf(type))
|
switch (arcs.indexOf(type))
|
||||||
{
|
{
|
||||||
case 0: //VToolArc::ToolType
|
case 0: //VToolArc::ToolType
|
||||||
ParseToolEllipticalArc(scene, domElement, parse);
|
ParseToolEllipticalArc(scene, domElement, parse);
|
||||||
break;
|
break;
|
||||||
|
case 1: //VNodeEllipticalArc::ToolType
|
||||||
|
ParseNodeEllipticalArc(domElement, parse);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
VException e(tr("Unknown elliptical arc type '%1'.").arg(type));
|
VException e(tr("Unknown elliptical arc type '%1'.").arg(type));
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -3776,7 +3820,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
QRectF VPattern::ActiveDrawBoundingRect() const
|
QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used.");
|
||||||
|
|
||||||
QRectF rec;
|
QRectF rec;
|
||||||
|
|
||||||
|
@ -3905,6 +3949,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
case Tool::Piece:
|
case Tool::Piece:
|
||||||
case Tool::UnionDetails:
|
case Tool::UnionDetails:
|
||||||
case Tool::NodeArc:
|
case Tool::NodeArc:
|
||||||
|
case Tool::NodeElArc:
|
||||||
case Tool::NodePoint:
|
case Tool::NodePoint:
|
||||||
case Tool::NodeSpline:
|
case Tool::NodeSpline:
|
||||||
case Tool::NodeSplinePath:
|
case Tool::NodeSplinePath:
|
||||||
|
|
|
@ -135,7 +135,7 @@ private:
|
||||||
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
const Document &parse, const QString& type);
|
const Document &parse, const QString& type);
|
||||||
void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
const QString &type);
|
const QString &type);
|
||||||
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
||||||
const Document &parse, const QString& type);
|
const Document &parse, const QString& type);
|
||||||
void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
|
@ -209,6 +209,7 @@ private:
|
||||||
void ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
|
|
||||||
void ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
|
void ParseNodeEllipticalArc(const QDomElement &domElement, const Document &parse);
|
||||||
|
|
||||||
void ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
void ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
|
|
|
@ -166,6 +166,7 @@ const QString VAbstractPattern::IncrementFormula = QStringLiteral("formula")
|
||||||
const QString VAbstractPattern::IncrementDescription = QStringLiteral("description");
|
const QString VAbstractPattern::IncrementDescription = QStringLiteral("description");
|
||||||
|
|
||||||
const QString VAbstractPattern::NodeArc = QStringLiteral("NodeArc");
|
const QString VAbstractPattern::NodeArc = QStringLiteral("NodeArc");
|
||||||
|
const QString VAbstractPattern::NodeElArc = QStringLiteral("NodeElArc");
|
||||||
const QString VAbstractPattern::NodePoint = QStringLiteral("NodePoint");
|
const QString VAbstractPattern::NodePoint = QStringLiteral("NodePoint");
|
||||||
const QString VAbstractPattern::NodeSpline = QStringLiteral("NodeSpline");
|
const QString VAbstractPattern::NodeSpline = QStringLiteral("NodeSpline");
|
||||||
const QString VAbstractPattern::NodeSplinePath = QStringLiteral("NodeSplinePath");
|
const QString VAbstractPattern::NodeSplinePath = QStringLiteral("NodeSplinePath");
|
||||||
|
@ -656,6 +657,7 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
|
||||||
case Tool::Detail:
|
case Tool::Detail:
|
||||||
case Tool::UnionDetails:
|
case Tool::UnionDetails:
|
||||||
case Tool::NodeArc:
|
case Tool::NodeArc:
|
||||||
|
case Tool::NodeElArc:
|
||||||
case Tool::NodePoint:
|
case Tool::NodePoint:
|
||||||
case Tool::NodeSpline:
|
case Tool::NodeSpline:
|
||||||
case Tool::NodeSplinePath:
|
case Tool::NodeSplinePath:
|
||||||
|
@ -1444,7 +1446,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment a number.
|
// If no just increment a number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagPoint);
|
const QDomNodeList list = elementsByTagName(TagPoint);
|
||||||
|
@ -1516,7 +1518,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagArc);
|
const QDomNodeList list = elementsByTagName(TagArc);
|
||||||
|
@ -1570,7 +1572,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagElArc);
|
const QDomNodeList list = elementsByTagName(TagElArc);
|
||||||
|
@ -1641,7 +1643,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
const QDomNodeList list = elementsByTagName(AttrPathPoint);
|
||||||
|
@ -1708,7 +1710,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagOperation);
|
const QDomNodeList list = elementsByTagName(TagOperation);
|
||||||
|
|
|
@ -269,6 +269,7 @@ public:
|
||||||
static const QString IncrementDescription;
|
static const QString IncrementDescription;
|
||||||
|
|
||||||
static const QString NodeArc;
|
static const QString NodeArc;
|
||||||
|
static const QString NodeElArc;
|
||||||
static const QString NodePoint;
|
static const QString NodePoint;
|
||||||
static const QString NodeSpline;
|
static const QString NodeSpline;
|
||||||
static const QString NodeSplinePath;
|
static const QString NodeSplinePath;
|
||||||
|
|
|
@ -57,7 +57,8 @@ public:
|
||||||
VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle);
|
VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle);
|
||||||
VEllipticalArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2,
|
VEllipticalArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2,
|
||||||
const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1,
|
const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1,
|
||||||
qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation);
|
qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0,
|
||||||
|
Draw mode = Draw::Calculation);
|
||||||
VEllipticalArc (qreal length, const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle);
|
VEllipticalArc (qreal length, const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle);
|
||||||
|
|
||||||
VEllipticalArc(const VEllipticalArc &arc);
|
VEllipticalArc(const VEllipticalArc &arc);
|
||||||
|
|
|
@ -57,7 +57,7 @@ class VTranslateMeasurements;
|
||||||
#define DefPointRadius 1.5//mm
|
#define DefPointRadius 1.5//mm
|
||||||
|
|
||||||
enum class NodeDetail : char { Contour, Modeling };
|
enum class NodeDetail : char { Contour, Modeling };
|
||||||
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
|
enum class SceneObject : char { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
|
||||||
enum class MeasurementsType : char { Standard, Individual , Unknown};
|
enum class MeasurementsType : char { Standard, Individual , Unknown};
|
||||||
enum class Unit : char { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE};
|
enum class Unit : char { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE};
|
||||||
enum class Source : char { FromGui, FromFile, FromTool };
|
enum class Source : char { FromGui, FromFile, FromTool };
|
||||||
|
@ -114,6 +114,7 @@ enum class Tool : ToolVisHolderType
|
||||||
PiecePath,
|
PiecePath,
|
||||||
NodePoint,
|
NodePoint,
|
||||||
NodeArc,
|
NodeArc,
|
||||||
|
NodeElArc,
|
||||||
NodeSpline,
|
NodeSpline,
|
||||||
NodeSplinePath,
|
NodeSplinePath,
|
||||||
Height,
|
Height,
|
||||||
|
|
|
@ -404,6 +404,7 @@ QVector<QPointF> VDetail::ContourPoints(const VContainer *data) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
|
case (Tool::NodeElArc):
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
|
@ -448,6 +449,7 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
|
case (Tool::NodeElArc):
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
|
|
|
@ -229,7 +229,10 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
switch (number)
|
switch (number)
|
||||||
{
|
{
|
||||||
case (0):
|
case (0):
|
||||||
if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::SplinePath)
|
if (type == SceneObject::Spline
|
||||||
|
|| type == SceneObject::Arc
|
||||||
|
|| type == SceneObject::ElArc
|
||||||
|
|| type == SceneObject::SplinePath)
|
||||||
{
|
{
|
||||||
if (SetObject(id, ui->comboBoxCurve, tr("Select axis point")))
|
if (SetObject(id, ui->comboBoxCurve, tr("Select axis point")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,6 +193,9 @@ void DialogDetail::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
case (SceneObject::Arc):
|
case (SceneObject::Arc):
|
||||||
NewItem(id, Tool::NodeArc, NodeDetail::Contour);
|
NewItem(id, Tool::NodeArc, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
|
case (SceneObject::ElArc):
|
||||||
|
NewItem(id, Tool::NodeElArc, NodeDetail::Contour);
|
||||||
|
break;
|
||||||
case (SceneObject::Point):
|
case (SceneObject::Point):
|
||||||
NewItem(id, Tool::NodePoint, NodeDetail::Contour);
|
NewItem(id, Tool::NodePoint, NodeDetail::Contour);
|
||||||
break;
|
break;
|
||||||
|
@ -394,6 +397,7 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
|
case (Tool::NodeElArc):
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,10 +166,12 @@ void DialogFlippingByAxis::ShowDialog(bool click)
|
||||||
operation->VisualMode();
|
operation->VisualMode();
|
||||||
|
|
||||||
scene->ToggleArcSelection(false);
|
scene->ToggleArcSelection(false);
|
||||||
|
scene->ToggleElArcSelection(false);
|
||||||
scene->ToggleSplineSelection(false);
|
scene->ToggleSplineSelection(false);
|
||||||
scene->ToggleSplinePathSelection(false);
|
scene->ToggleSplinePathSelection(false);
|
||||||
|
|
||||||
scene->ToggleArcHover(false);
|
scene->ToggleArcHover(false);
|
||||||
|
scene->ToggleElArcHover(false);
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
|
|
|
@ -165,10 +165,12 @@ void DialogFlippingByLine::ShowDialog(bool click)
|
||||||
operation->VisualMode();
|
operation->VisualMode();
|
||||||
|
|
||||||
scene->ToggleArcSelection(false);
|
scene->ToggleArcSelection(false);
|
||||||
|
scene->ToggleElArcSelection(false);
|
||||||
scene->ToggleSplineSelection(false);
|
scene->ToggleSplineSelection(false);
|
||||||
scene->ToggleSplinePathSelection(false);
|
scene->ToggleSplinePathSelection(false);
|
||||||
|
|
||||||
scene->ToggleArcHover(false);
|
scene->ToggleArcHover(false);
|
||||||
|
scene->ToggleElArcHover(false);
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
|
|
|
@ -213,10 +213,12 @@ void DialogMove::ShowDialog(bool click)
|
||||||
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
|
||||||
|
|
||||||
scene->ToggleArcSelection(false);
|
scene->ToggleArcSelection(false);
|
||||||
|
scene->ToggleElArcSelection(false);
|
||||||
scene->ToggleSplineSelection(false);
|
scene->ToggleSplineSelection(false);
|
||||||
scene->ToggleSplinePathSelection(false);
|
scene->ToggleSplinePathSelection(false);
|
||||||
|
|
||||||
scene->ToggleArcHover(false);
|
scene->ToggleArcHover(false);
|
||||||
|
scene->ToggleElArcHover(false);
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,10 @@ void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject
|
||||||
{
|
{
|
||||||
if (prepare == false)// After first choose we ignore all objects
|
if (prepare == false)// After first choose we ignore all objects
|
||||||
{
|
{
|
||||||
if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::SplinePath)
|
if (type == SceneObject::Spline
|
||||||
|
|| type == SceneObject::Arc
|
||||||
|
|| type == SceneObject::ElArc
|
||||||
|
|| type == SceneObject::SplinePath)
|
||||||
{
|
{
|
||||||
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
||||||
SCASSERT(point != nullptr);
|
SCASSERT(point != nullptr);
|
||||||
|
|
|
@ -190,10 +190,12 @@ void DialogRotation::ShowDialog(bool click)
|
||||||
operation->VisualMode();
|
operation->VisualMode();
|
||||||
|
|
||||||
scene->ToggleArcSelection(false);
|
scene->ToggleArcSelection(false);
|
||||||
|
scene->ToggleElArcSelection(false);
|
||||||
scene->ToggleSplineSelection(false);
|
scene->ToggleSplineSelection(false);
|
||||||
scene->ToggleSplinePathSelection(false);
|
scene->ToggleSplinePathSelection(false);
|
||||||
|
|
||||||
scene->ToggleArcHover(false);
|
scene->ToggleArcHover(false);
|
||||||
|
scene->ToggleElArcHover(false);
|
||||||
scene->ToggleSplineHover(false);
|
scene->ToggleSplineHover(false);
|
||||||
scene->ToggleSplinePathHover(false);
|
scene->ToggleSplinePathHover(false);
|
||||||
|
|
||||||
|
|
|
@ -585,7 +585,6 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GOType::Arc:
|
case GOType::Arc:
|
||||||
case GOType::EllipticalArc:
|
|
||||||
{
|
{
|
||||||
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
||||||
connect(curve, &VSimpleCurve::Choosed, [this](quint32 id)
|
connect(curve, &VSimpleCurve::Choosed, [this](quint32 id)
|
||||||
|
@ -594,6 +593,15 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GOType::EllipticalArc:
|
||||||
|
{
|
||||||
|
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
||||||
|
connect(curve, &VSimpleCurve::Choosed, [this](quint32 id)
|
||||||
|
{
|
||||||
|
emit ChoosedTool(id, SceneObject::ElArc);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GOType::Spline:
|
case GOType::Spline:
|
||||||
case GOType::CubicBezier:
|
case GOType::CubicBezier:
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,7 +74,7 @@ VToolEllipticalArc::VToolEllipticalArc(VAbstractPattern *doc, VContainer *data,
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VAbstractSpline(doc, data, id, parent)
|
:VAbstractSpline(doc, data, id, parent)
|
||||||
{
|
{
|
||||||
sceneType = SceneObject::Arc;
|
sceneType = SceneObject::ElArc;
|
||||||
|
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define NODEDETAILS_H
|
#define NODEDETAILS_H
|
||||||
|
|
||||||
#include "vnodearc.h"
|
#include "vnodearc.h"
|
||||||
|
#include "vnodeellipticalarc.h"
|
||||||
#include "vnodepoint.h"
|
#include "vnodepoint.h"
|
||||||
#include "vnodespline.h"
|
#include "vnodespline.h"
|
||||||
#include "vnodesplinepath.h"
|
#include "vnodesplinepath.h"
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
#include "../vdatatool.h"
|
#include "../vdatatool.h"
|
||||||
#include "vabstractnode.h"
|
#include "vabstractnode.h"
|
||||||
|
|
||||||
class VContainer;
|
|
||||||
|
|
||||||
const QString VNodeArc::ToolType = QStringLiteral("modeling");
|
const QString VNodeArc::ToolType = QStringLiteral("modeling");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
131
src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.cpp
Normal file
131
src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.cpp
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 20 12, 2016
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2016 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "vnodeellipticalarc.h"
|
||||||
|
|
||||||
|
#include <QDomElement>
|
||||||
|
#include <QStaticStringData>
|
||||||
|
#include <QStringData>
|
||||||
|
#include <QStringDataPtr>
|
||||||
|
|
||||||
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
|
#include "../ifc/ifcdef.h"
|
||||||
|
#include "../vabstracttool.h"
|
||||||
|
#include "../vdatatool.h"
|
||||||
|
#include "vabstractnode.h"
|
||||||
|
|
||||||
|
const QString VNodeEllipticalArc::ToolType = QStringLiteral("modeling");
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VNodeEllipticalArc::Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc,
|
||||||
|
const Document &parse, const Source &typeCreation, const QString &drawName,
|
||||||
|
const quint32 &idTool)
|
||||||
|
{
|
||||||
|
VAbstractTool::AddRecord(id, Tool::NodeElArc, doc);
|
||||||
|
if (parse == Document::FullParse)
|
||||||
|
{
|
||||||
|
VNodeEllipticalArc *arc = new VNodeEllipticalArc(doc, data, id, idArc, typeCreation, drawName, idTool, doc);
|
||||||
|
|
||||||
|
doc->AddTool(id, arc);
|
||||||
|
if (idTool != NULL_ID)
|
||||||
|
{
|
||||||
|
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||||
|
VDataTool *tool = doc->getTool(idTool);
|
||||||
|
SCASSERT(tool != nullptr);
|
||||||
|
arc->setParent(tool);// Adopted by a tool
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Help to delete the node before each FullParse
|
||||||
|
doc->AddToolOnRemove(arc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
doc->UpdateToolData(id, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VNodeEllipticalArc::getTagName() const
|
||||||
|
{
|
||||||
|
return VAbstractPattern::TagElArc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VNodeEllipticalArc::AllowHover(bool enabled)
|
||||||
|
{
|
||||||
|
Q_UNUSED(enabled)
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VNodeEllipticalArc::AllowSelecting(bool enabled)
|
||||||
|
{
|
||||||
|
Q_UNUSED(enabled)
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VNodeEllipticalArc::AddToFile()
|
||||||
|
{
|
||||||
|
QDomElement domElement = doc->createElement(getTagName());
|
||||||
|
|
||||||
|
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||||
|
doc->SetAttribute(domElement, AttrType, ToolType);
|
||||||
|
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
|
if (idTool != NULL_ID)
|
||||||
|
{
|
||||||
|
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddToModeling(domElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VNodeEllipticalArc::RefreshDataInFile()
|
||||||
|
{
|
||||||
|
QDomElement domElement = doc->elementById(id);
|
||||||
|
if (domElement.isElement())
|
||||||
|
{
|
||||||
|
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||||
|
if (idTool != NULL_ID)
|
||||||
|
{
|
||||||
|
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VNodeEllipticalArc::VNodeEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc,
|
||||||
|
const Source &typeCreation, const QString &drawName, const quint32 &idTool,
|
||||||
|
QObject *qoParent)
|
||||||
|
:VAbstractNode(doc, data, id, idArc, drawName, idTool, qoParent)
|
||||||
|
{
|
||||||
|
ToolCreation(typeCreation);
|
||||||
|
}
|
71
src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.h
Normal file
71
src/libs/vtools/tools/nodeDetails/vnodeellipticalarc.h
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 20 12, 2016
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2016 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VNODEELLIPTICALARC_H
|
||||||
|
#define VNODEELLIPTICALARC_H
|
||||||
|
|
||||||
|
#include <qcompilerdetection.h>
|
||||||
|
#include <QGraphicsPathItem>
|
||||||
|
#include <QMetaObject>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
#include "vabstractnode.h"
|
||||||
|
|
||||||
|
class VContainer;
|
||||||
|
|
||||||
|
class VNodeEllipticalArc :public VAbstractNode
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse,
|
||||||
|
const Source &typeCreation, const QString &drawName = QString(),
|
||||||
|
const quint32 &idTool = NULL_ID);
|
||||||
|
|
||||||
|
static const QString ToolType;
|
||||||
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
|
public slots:
|
||||||
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE {}
|
||||||
|
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||||
|
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||||
|
protected:
|
||||||
|
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||||
|
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||||
|
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||||
|
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VNodeEllipticalArc)
|
||||||
|
|
||||||
|
VNodeEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
||||||
|
const QString &drawName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VNODEELLIPTICALARC_H
|
|
@ -59,6 +59,7 @@ HEADERS += \
|
||||||
$$PWD/drawTools/operation/flipping/vabstractflipping.h \
|
$$PWD/drawTools/operation/flipping/vabstractflipping.h \
|
||||||
$$PWD/drawTools/operation/vtoolmove.h \
|
$$PWD/drawTools/operation/vtoolmove.h \
|
||||||
$$PWD/drawTools/toolcurve/vtoolellipticalarc.h \
|
$$PWD/drawTools/toolcurve/vtoolellipticalarc.h \
|
||||||
|
$$PWD/nodeDetails/vnodeellipticalarc.h \
|
||||||
$$PWD/vtoolseamallowance.h \
|
$$PWD/vtoolseamallowance.h \
|
||||||
$$PWD/nodeDetails/vtoolpiecepath.h
|
$$PWD/nodeDetails/vtoolpiecepath.h
|
||||||
|
|
||||||
|
@ -117,5 +118,6 @@ SOURCES += \
|
||||||
$$PWD/drawTools/operation/flipping/vabstractflipping.cpp \
|
$$PWD/drawTools/operation/flipping/vabstractflipping.cpp \
|
||||||
$$PWD/drawTools/operation/vtoolmove.cpp \
|
$$PWD/drawTools/operation/vtoolmove.cpp \
|
||||||
$$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp \
|
$$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp \
|
||||||
|
$$PWD/nodeDetails/vnodeellipticalarc.cpp \
|
||||||
$$PWD/vtoolseamallowance.cpp \
|
$$PWD/vtoolseamallowance.cpp \
|
||||||
$$PWD/nodeDetails/vtoolpiecepath.cpp
|
$$PWD/nodeDetails/vtoolpiecepath.cpp
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
#include "../undocommands/savedetailoptions.h"
|
#include "../undocommands/savedetailoptions.h"
|
||||||
#include "../undocommands/togglepieceinlayout.h"
|
#include "../undocommands/togglepieceinlayout.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
#include "../vgeometry/vcubicbezierpath.h"
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
#include "../vgeometry/vgeometrydef.h"
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
@ -99,6 +100,7 @@
|
||||||
#include "vabstracttool.h"
|
#include "vabstracttool.h"
|
||||||
#include "nodeDetails/vabstractnode.h"
|
#include "nodeDetails/vabstractnode.h"
|
||||||
#include "nodeDetails/vnodearc.h"
|
#include "nodeDetails/vnodearc.h"
|
||||||
|
#include "nodeDetails/vnodeellipticalarc.h"
|
||||||
#include "nodeDetails/vnodepoint.h"
|
#include "nodeDetails/vnodepoint.h"
|
||||||
#include "nodeDetails/vnodespline.h"
|
#include "nodeDetails/vnodespline.h"
|
||||||
#include "nodeDetails/vnodesplinepath.h"
|
#include "nodeDetails/vnodesplinepath.h"
|
||||||
|
@ -130,6 +132,7 @@ const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour");
|
||||||
const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling");
|
const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling");
|
||||||
|
|
||||||
const QString VToolDetail::NodeArc = QStringLiteral("NodeArc");
|
const QString VToolDetail::NodeArc = QStringLiteral("NodeArc");
|
||||||
|
const QString VToolDetail::NodeElArc = QStringLiteral("NodeElArc");
|
||||||
const QString VToolDetail::NodePoint = QStringLiteral("NodePoint");
|
const QString VToolDetail::NodePoint = QStringLiteral("NodePoint");
|
||||||
const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline");
|
const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline");
|
||||||
const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath");
|
const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath");
|
||||||
|
@ -162,11 +165,8 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
doc->IncrementReferens(detail.at(i).getId());
|
case (Tool::NodeElArc):
|
||||||
break;
|
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
doc->IncrementReferens(detail.at(i).getId());
|
|
||||||
break;
|
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
doc->IncrementReferens(detail.at(i).getId());
|
doc->IncrementReferens(detail.at(i).getId());
|
||||||
break;
|
break;
|
||||||
|
@ -275,6 +275,12 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac
|
||||||
VNodeArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
VNodeArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case (Tool::NodeElArc):
|
||||||
|
{
|
||||||
|
id = CreateNode<VEllipticalArc>(data, nodeD.getId());
|
||||||
|
VNodeEllipticalArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
const auto obj = data->GetGObject(nodeD.getId());
|
const auto obj = data->GetGObject(nodeD.getId());
|
||||||
|
@ -1155,6 +1161,9 @@ void VToolDetail::AddNode(VAbstractPattern *doc, QDomElement &domElement, const
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
doc->SetAttribute(nod, AttrType, NodeArc);
|
doc->SetAttribute(nod, AttrType, NodeArc);
|
||||||
break;
|
break;
|
||||||
|
case (Tool::NodeElArc):
|
||||||
|
doc->SetAttribute(nod, AttrType, NodeElArc);
|
||||||
|
break;
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
doc->SetAttribute(nod, AttrType, NodePoint);
|
doc->SetAttribute(nod, AttrType, NodePoint);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
static const QString NodeTypeContour;
|
static const QString NodeTypeContour;
|
||||||
static const QString NodeTypeModeling;
|
static const QString NodeTypeModeling;
|
||||||
static const QString NodeArc;
|
static const QString NodeArc;
|
||||||
|
static const QString NodeElArc;
|
||||||
static const QString NodePoint;
|
static const QString NodePoint;
|
||||||
static const QString NodeSpline;
|
static const QString NodeSpline;
|
||||||
static const QString NodeSplinePath;
|
static const QString NodeSplinePath;
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../ifc/xml/vpatternconverter.h"
|
#include "../ifc/xml/vpatternconverter.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
#include "../vgeometry/vsplinepath.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
#include "../vgeometry/vabstractcubicbezier.h"
|
#include "../vgeometry/vabstractcubicbezier.h"
|
||||||
#include "../vgeometry/vabstractcubicbezierpath.h"
|
#include "../vgeometry/vabstractcubicbezierpath.h"
|
||||||
|
@ -59,6 +60,7 @@
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../dialogs/tools/dialogtool.h"
|
#include "../dialogs/tools/dialogtool.h"
|
||||||
#include "nodeDetails/vnodearc.h"
|
#include "nodeDetails/vnodearc.h"
|
||||||
|
#include "nodeDetails/vnodeellipticalarc.h"
|
||||||
#include "nodeDetails/vnodepoint.h"
|
#include "nodeDetails/vnodepoint.h"
|
||||||
#include "nodeDetails/vnodespline.h"
|
#include "nodeDetails/vnodespline.h"
|
||||||
#include "nodeDetails/vnodesplinepath.h"
|
#include "nodeDetails/vnodesplinepath.h"
|
||||||
|
@ -188,24 +190,60 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
|
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeElArc):
|
||||||
{
|
{
|
||||||
const QSharedPointer<VAbstractCubicBezier> spline =
|
const QSharedPointer<VEllipticalArc> arc = data->GeometricObject<VEllipticalArc>(det.at(i).getId());
|
||||||
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
|
VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0);
|
||||||
|
VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0);
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *center = new VPointF(arc->GetCenter());
|
||||||
VPointF p2 = VPointF(spline->GetP2());
|
|
||||||
VPointF p3 = VPointF(spline->GetP3());
|
|
||||||
VPointF *p4 = new VPointF(spline->GetP4());
|
|
||||||
|
|
||||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||||
{
|
{
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
|
|
||||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
BiasRotatePoint(&p1, dx, dy, p, angle);
|
||||||
|
BiasRotatePoint(&p2, dx, dy, p, angle);
|
||||||
|
BiasRotatePoint(center, dx, dy, p, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF l1(*center, p1);
|
||||||
|
QLineF l2(*center, p2);
|
||||||
|
center->setMode(Draw::Modeling);
|
||||||
|
quint32 idCenter = data->AddGObject(center);
|
||||||
|
Q_UNUSED(idCenter);
|
||||||
|
VEllipticalArc *arc1 = new VEllipticalArc (*center, arc->GetRadius1(), arc->GetRadius2(),
|
||||||
|
arc->GetFormulaRadius1(), arc->GetFormulaRadius2(),
|
||||||
|
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
|
||||||
|
QString().setNum(l2.angle()), 0, "0");
|
||||||
|
arc1->setMode(Draw::Modeling);
|
||||||
|
idObject = data->AddGObject(arc1);
|
||||||
|
children.append(idObject);
|
||||||
|
|
||||||
|
VEllipticalArc *arc2 = new VEllipticalArc(*arc1);
|
||||||
|
arc2->setMode(Draw::Modeling);
|
||||||
|
id = data->AddGObject(arc2);
|
||||||
|
|
||||||
|
VNodeEllipticalArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case (Tool::NodeSpline):
|
||||||
|
{
|
||||||
|
const QSharedPointer<VAbstractCubicBezier> spline =
|
||||||
|
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
|
||||||
|
|
||||||
|
QScopedPointer<VPointF> p1(new VPointF(spline->GetP1()));
|
||||||
|
VPointF p2 = VPointF(spline->GetP2());
|
||||||
|
VPointF p3 = VPointF(spline->GetP3());
|
||||||
|
QScopedPointer<VPointF> p4(new VPointF(spline->GetP4()));
|
||||||
|
|
||||||
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||||
|
{
|
||||||
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
|
|
||||||
|
BiasRotatePoint(p1.data(), dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p2, dx, dy, p, angle);
|
BiasRotatePoint(&p2, dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p3, dx, dy, p, angle);
|
BiasRotatePoint(&p3, dx, dy, p, angle);
|
||||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
BiasRotatePoint(p4.data(), dx, dy, p, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
|
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
|
||||||
|
@ -216,9 +254,6 @@ void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPatte
|
||||||
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, drawName, idTool);
|
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool);
|
||||||
|
|
||||||
delete p4;
|
|
||||||
delete p1;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
|
@ -323,7 +358,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
||||||
VPointF p1 = VPointF(arc->GetP1());
|
VPointF p1 = VPointF(arc->GetP1());
|
||||||
VPointF p2 = VPointF(arc->GetP2());
|
VPointF p2 = VPointF(arc->GetP2());
|
||||||
VPointF *center = new VPointF(arc->GetCenter());
|
QScopedPointer<VPointF> center(new VPointF(arc->GetCenter()));
|
||||||
|
|
||||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||||
{
|
{
|
||||||
|
@ -331,7 +366,7 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
|
|
||||||
BiasRotatePoint(&p1, dx, dy, p, angle);
|
BiasRotatePoint(&p1, dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p2, dx, dy, p, angle);
|
BiasRotatePoint(&p2, dx, dy, p, angle);
|
||||||
BiasRotatePoint(center, dx, dy, p, angle);
|
BiasRotatePoint(center.data(), dx, dy, p, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineF l1(*center, p1);
|
QLineF l1(*center, p1);
|
||||||
|
@ -341,7 +376,33 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
||||||
arc1->setMode(Draw::Modeling);
|
arc1->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(TakeNextId(children), arc1);
|
data->UpdateGObject(TakeNextId(children), arc1);
|
||||||
delete center;
|
}
|
||||||
|
break;
|
||||||
|
case (Tool::NodeElArc):
|
||||||
|
{
|
||||||
|
const QSharedPointer<VEllipticalArc> arc = data->GeometricObject<VEllipticalArc>(det.at(i).getId());
|
||||||
|
VPointF p1 = VPointF(arc->GetP1());
|
||||||
|
VPointF p2 = VPointF(arc->GetP2());
|
||||||
|
QScopedPointer<VPointF> center(new VPointF(arc->GetCenter()));
|
||||||
|
|
||||||
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||||
|
{
|
||||||
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
|
|
||||||
|
BiasRotatePoint(&p1, dx, dy, p, angle);
|
||||||
|
BiasRotatePoint(&p2, dx, dy, p, angle);
|
||||||
|
BiasRotatePoint(center.data(), dx, dy, p, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF l1(*center, p1);
|
||||||
|
QLineF l2(*center, p2);
|
||||||
|
|
||||||
|
VEllipticalArc *arc1 = new VEllipticalArc (*center, arc->GetRadius1(), arc->GetRadius2(),
|
||||||
|
arc->GetFormulaRadius1(), arc->GetFormulaRadius2(),
|
||||||
|
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
|
||||||
|
QString().setNum(l2.angle()), 0, "0");
|
||||||
|
arc1->setMode(Draw::Modeling);
|
||||||
|
data->UpdateGObject(TakeNextId(children), arc1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
|
@ -349,25 +410,23 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
const QSharedPointer<VAbstractCubicBezier> spline =
|
const QSharedPointer<VAbstractCubicBezier> spline =
|
||||||
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
|
data->GeometricObject<VAbstractCubicBezier>(det.at(i).getId());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
QScopedPointer<VPointF> p1(new VPointF(spline->GetP1()));
|
||||||
VPointF p2 = VPointF(spline->GetP2());
|
VPointF p2 = VPointF(spline->GetP2());
|
||||||
VPointF p3 = VPointF(spline->GetP3());
|
VPointF p3 = VPointF(spline->GetP3());
|
||||||
VPointF *p4 = new VPointF(spline->GetP4());
|
QScopedPointer<VPointF> p4(new VPointF(spline->GetP4()));
|
||||||
|
|
||||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||||
{
|
{
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
|
|
||||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
BiasRotatePoint(p1.data(), dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p2, dx, dy, p, angle);
|
BiasRotatePoint(&p2, dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p3, dx, dy, p, angle);
|
BiasRotatePoint(&p3, dx, dy, p, angle);
|
||||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
BiasRotatePoint(p4.data(), dx, dy, p, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
|
VSpline *spl = new VSpline(*p1, p2, p3, *p4, 0, Draw::Modeling);
|
||||||
data->UpdateGObject(TakeNextId(children), spl);
|
data->UpdateGObject(TakeNextId(children), spl);
|
||||||
delete p1;
|
|
||||||
delete p4;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
|
@ -381,19 +440,19 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
{
|
{
|
||||||
const VSpline spline = splinePath->GetSpline(i);
|
const VSpline spline = splinePath->GetSpline(i);
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
QScopedPointer<VPointF> p1(new VPointF(spline.GetP1()));
|
||||||
VPointF p2 = VPointF(spline.GetP2());
|
VPointF p2 = VPointF(spline.GetP2());
|
||||||
VPointF p3 = VPointF(spline.GetP3());
|
VPointF p3 = VPointF(spline.GetP3());
|
||||||
VPointF *p4 = new VPointF(spline.GetP4());
|
QScopedPointer<VPointF> p4(new VPointF(spline.GetP4()));
|
||||||
|
|
||||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||||
{
|
{
|
||||||
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
const QPointF p = *data->GeometricObject<VPointF>(pRotate);
|
||||||
|
|
||||||
BiasRotatePoint(p1, dx, dy, p, angle);
|
BiasRotatePoint(p1.data(), dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p2, dx, dy, p, angle);
|
BiasRotatePoint(&p2, dx, dy, p, angle);
|
||||||
BiasRotatePoint(&p3, dx, dy, p, angle);
|
BiasRotatePoint(&p3, dx, dy, p, angle);
|
||||||
BiasRotatePoint(p4, dx, dy, p, angle);
|
BiasRotatePoint(p4.data(), dx, dy, p, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
VSpline spl = VSpline(*p1, p2, p3, *p4);
|
VSpline spl = VSpline(*p1, p2, p3, *p4);
|
||||||
|
@ -420,9 +479,6 @@ void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const
|
||||||
|
|
||||||
path->append(VSplinePoint(*p4, spl.GetEndAngle(), spl.GetEndAngleFormula(), angle2, angle2F,
|
path->append(VSplinePoint(*p4, spl.GetEndAngle(), spl.GetEndAngleFormula(), angle2, angle2F,
|
||||||
spline.GetC2Length(), spline.GetC2LengthFormula(), pL2, pL2F));
|
spline.GetC2Length(), spline.GetC2LengthFormula(), pL2, pL2F));
|
||||||
|
|
||||||
delete p1;
|
|
||||||
delete p4;
|
|
||||||
}
|
}
|
||||||
data->UpdateGObject(TakeNextId(children), path);
|
data->UpdateGObject(TakeNextId(children), path);
|
||||||
}
|
}
|
||||||
|
@ -798,19 +854,23 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VAbstractPattern *doc, con
|
||||||
Tool tool = Tool::NodePoint;
|
Tool tool = Tool::NodePoint;
|
||||||
NodeDetail nodeType = NodeDetail::Contour;
|
NodeDetail nodeType = NodeDetail::Contour;
|
||||||
QString t = doc->GetParametrString(element, "type", "NodePoint");
|
QString t = doc->GetParametrString(element, "type", "NodePoint");
|
||||||
if (t == "NodePoint")
|
if (t == QLatin1String("NodePoint"))
|
||||||
{
|
{
|
||||||
tool = Tool::NodePoint;
|
tool = Tool::NodePoint;
|
||||||
}
|
}
|
||||||
else if (t == "NodeArc")
|
else if (t == QLatin1String("NodeArc"))
|
||||||
{
|
{
|
||||||
tool = Tool::NodeArc;
|
tool = Tool::NodeArc;
|
||||||
}
|
}
|
||||||
else if (t == "NodeSpline")
|
else if (t == QLatin1String("NodeElArc"))
|
||||||
|
{
|
||||||
|
tool = Tool::NodeElArc;
|
||||||
|
}
|
||||||
|
else if (t == QLatin1String("NodeSpline"))
|
||||||
{
|
{
|
||||||
tool = Tool::NodeSpline;
|
tool = Tool::NodeSpline;
|
||||||
}
|
}
|
||||||
else if (t == "NodeSplinePath")
|
else if (t == QLatin1String("NodeSplinePath"))
|
||||||
{
|
{
|
||||||
tool = Tool::NodeSplinePath;
|
tool = Tool::NodeSplinePath;
|
||||||
}
|
}
|
||||||
|
@ -957,6 +1017,7 @@ void VToolUnionDetails::IncrementReferences(const VDetail &d) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
|
case (Tool::NodeElArc):
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
doc->IncrementReferens(d.at(i).getId());
|
doc->IncrementReferens(d.at(i).getId());
|
||||||
|
@ -982,6 +1043,7 @@ void VToolUnionDetails::DecrementReferences(const VDetail &d) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
|
case (Tool::NodeElArc):
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
doc->DecrementReferens(d.at(i).getId());
|
doc->DecrementReferens(d.at(i).getId());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user