Merged in ValentinaZhuravska/valentina/feature (pull request #152)

ref #315. New tool: 'Elliptic Arc'.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-12-19 13:53:17 +02:00
commit ddbc7935f3
45 changed files with 4080 additions and 419 deletions

View File

@ -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) == 48, "Not all tools was used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch.");
switch (item->type()) switch (item->type())
{ {
@ -196,6 +196,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
case VToolMove::Type: case VToolMove::Type:
ShowOptionsToolMove(item); ShowOptionsToolMove(item);
break; break;
case VToolEllipticalArc::Type:
ShowOptionsToolEllipticalArc(item);
break;
default: default:
break; break;
} }
@ -210,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) == 48, "Not all tools was used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch.");
switch (currentItem->type()) switch (currentItem->type())
{ {
@ -354,7 +357,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) == 48, "Not all tools was used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch.");
switch (currentItem->type()) switch (currentItem->type())
{ {
@ -2148,6 +2151,21 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolFlippingByAxis(QGraphicsItem *i
AddPropertyOperationSuffix(i, tr("Suffix")); AddPropertyOperationSuffix(i, tr("Suffix"));
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ShowOptionsToolEllipticalArc(QGraphicsItem *item)
{
VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(item);
i->ShowVisualization(true);
formView->setTitle(tr("Elliptical arc"));
AddPropertyFormula(tr("Radius"), i->GetFormulaRadius1(), AttrRadius1);
AddPropertyFormula(tr("Radius"), i->GetFormulaRadius2(), AttrRadius2);
AddPropertyFormula(tr("First angle"), i->GetFormulaF1(), AttrAngle1);
AddPropertyFormula(tr("Second angle"), i->GetFormulaF2(), AttrAngle2);
AddPropertyFormula(tr("Rotation angle"), i->GetFormulaRotationAngle(), AttrRotationAngle);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint() void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint()
{ {
@ -2680,6 +2698,9 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< AttrLength1 /* 36 */ << AttrLength1 /* 36 */
<< AttrLength2 /* 37 */ << AttrLength2 /* 37 */
<< AttrSuffix /* 38 */ << AttrSuffix /* 38 */
<< AttrAxisType; /* 39 */ << AttrAxisType /* 39 */
<< AttrRadius1 /* 40 */
<< AttrRadius2 /* 41 */
<< AttrRotationAngle; /* 42 */
return attr; return attr;
} }

View File

@ -195,6 +195,7 @@ private:
void ShowOptionsToolMove(QGraphicsItem *item); void ShowOptionsToolMove(QGraphicsItem *item);
void ShowOptionsToolFlippingByLine(QGraphicsItem *item); void ShowOptionsToolFlippingByLine(QGraphicsItem *item);
void ShowOptionsToolFlippingByAxis(QGraphicsItem *item); void ShowOptionsToolFlippingByAxis(QGraphicsItem *item);
void ShowOptionsToolEllipticalArc(QGraphicsItem *item);
void UpdateOptionsToolSinglePoint(); void UpdateOptionsToolSinglePoint();
void UpdateOptionsToolEndLine(); void UpdateOptionsToolEndLine();

View File

@ -29,6 +29,7 @@
#include "dialoghistory.h" #include "dialoghistory.h"
#include "ui_dialoghistory.h" #include "ui_dialoghistory.h"
#include "../vgeometry/varc.h" #include "../vgeometry/varc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vcubicbezier.h" #include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vsplinepath.h" #include "../vgeometry/vsplinepath.h"
#include "../vgeometry/vcubicbezierpath.h" #include "../vgeometry/vcubicbezierpath.h"
@ -208,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) == 48, "Not all tools was used in history."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was 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)
@ -378,6 +379,12 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(AttrUInt(domElem, AttrDartP1))) .arg(PointName(AttrUInt(domElem, AttrDartP1)))
.arg(PointName(AttrUInt(domElem, AttrDartP2))) .arg(PointName(AttrUInt(domElem, AttrDartP2)))
.arg(PointName(AttrUInt(domElem, AttrDartP2))); .arg(PointName(AttrUInt(domElem, AttrDartP2)));
case Tool::EllipticalArc:
{
const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId());
SCASSERT(elArc != nullptr);
return elArc->NameForHistory(tr("Elliptical arc"));
}
//Because "history" not only show history of pattern, but help restore current data for each pattern's //Because "history" not only show history of pattern, but help restore current data for each pattern's
//piece, we need add record about details and nodes, but don't show them. //piece, we need add record about details and nodes, but don't show them.
case Tool::Detail: case Tool::Detail:

View File

@ -874,6 +874,20 @@ void MainWindow::ToolArc(bool checked)
&MainWindow::ApplyDialog<VToolArc>); &MainWindow::ApplyDialog<VToolArc>);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolEllipticalArc handler tool arc.
* @param checked true - button checked.
*/
void MainWindow::ToolEllipticalArc(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogEllipticalArc>(checked, Tool::EllipticalArc, ":/cursor/el_arc_cursor.png",
tr("Select point of center of elliptical arc"),
&MainWindow::ClosedDialogWithApply<VToolEllipticalArc>,
&MainWindow::ApplyDialog<VToolEllipticalArc>);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ToolSplinePath handler tool splinePath. * @brief ToolSplinePath handler tool splinePath.
@ -1698,6 +1712,7 @@ void MainWindow::InitToolButtons()
toolButtonPointerList.append(ui->toolButtonPointerArc); toolButtonPointerList.append(ui->toolButtonPointerArc);
toolButtonPointerList.append(ui->toolButtonPointerDetail); toolButtonPointerList.append(ui->toolButtonPointerDetail);
toolButtonPointerList.append(ui->toolButtonPointerOperations); toolButtonPointerList.append(ui->toolButtonPointerOperations);
toolButtonPointerList.append(ui->toolButtonPointerEllipticalArc);
for (auto pointer : toolButtonPointerList) for (auto pointer : toolButtonPointerList)
{ {
@ -1746,6 +1761,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove); connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove);
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint); connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs); connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs);
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1773,7 +1789,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) == 48, "Not all tools was handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled.");
qCDebug(vMainWindow, "Canceling tool."); qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool; delete dialogTool;
@ -1922,6 +1938,9 @@ void MainWindow::CancelTool()
case Tool::Move: case Tool::Move:
ui->toolButtonMove->setChecked(false); ui->toolButtonMove->setChecked(false);
break; break;
case Tool::EllipticalArc:
ui->toolButtonEllipticalArc->setChecked(false);
break;
} }
// Crash: using CRTL+Z while using line tool. // Crash: using CRTL+Z while using line tool.
@ -2972,7 +2991,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) == 48, "Not all tools were handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools were handled.");
//Drawing Tools //Drawing Tools
ui->toolButtonEndLine->setEnabled(drawTools); ui->toolButtonEndLine->setEnabled(drawTools);
@ -3011,6 +3030,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonFlippingByAxis->setEnabled(drawTools); ui->toolButtonFlippingByAxis->setEnabled(drawTools);
ui->toolButtonMove->setEnabled(drawTools); ui->toolButtonMove->setEnabled(drawTools);
ui->toolButtonMidpoint->setEnabled(drawTools); ui->toolButtonMidpoint->setEnabled(drawTools);
ui->toolButtonEllipticalArc->setEnabled(drawTools);
ui->actionLast_tool->setEnabled(drawTools); ui->actionLast_tool->setEnabled(drawTools);
@ -3292,7 +3312,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) == 48, "Not all tools was handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled.");
if (currentTool == lastUsedTool) if (currentTool == lastUsedTool)
{ {
@ -3470,6 +3490,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonMove->setChecked(true); ui->toolButtonMove->setChecked(true);
ToolMove(true); ToolMove(true);
break; break;
case Tool::EllipticalArc:
ui->toolButtonEllipticalArc->setChecked(true);
ToolEllipticalArc(true);
break;
} }
} }

View File

@ -129,6 +129,7 @@ private slots:
void ToolCubicBezier(bool checked); void ToolCubicBezier(bool checked);
void ToolCutSpline(bool checked); void ToolCutSpline(bool checked);
void ToolArc(bool checked); void ToolArc(bool checked);
void ToolEllipticalArc(bool checked);
void ToolSplinePath(bool checked); void ToolSplinePath(bool checked);
void ToolCubicBezierPath(bool checked); void ToolCubicBezierPath(bool checked);
void ToolCutSplinePath(bool checked); void ToolCutSplinePath(bool checked);

View File

@ -1058,6 +1058,86 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>56</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Tools for creating elliptical arcs.</string>
</property>
<attribute name="icon">
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/16x16/toolsectionelarc@2x.png</normaloff>:/icon/16x16/toolsectionelarc@2x.png</iconset>
</attribute>
<attribute name="label">
<string>Elliptical Arc</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerEllipticalArc">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Tool pointer</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrow_cursor.png</normaloff>:/icon/32x32/arrow_cursor.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="toolButtonEllipticalArc">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Arc</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/el_arc.png</normaloff>:/toolicon/32x32/el_arc.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_7"> <widget class="QWidget" name="page_7">
<property name="geometry"> <property name="geometry">
<rect> <rect>

View File

@ -76,5 +76,7 @@
<file>cursor/flipping_axis_cursor@2x.png</file> <file>cursor/flipping_axis_cursor@2x.png</file>
<file>cursor/move_cursor.png</file> <file>cursor/move_cursor.png</file>
<file>cursor/move_cursor@2x.png</file> <file>cursor/move_cursor@2x.png</file>
<file>cursor/el_arc_cursor.png</file>
<file>cursor/el_arc_cursor@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

View File

@ -74,5 +74,7 @@
<file>toolicon/32x32/flipping_axis@2x.png</file> <file>toolicon/32x32/flipping_axis@2x.png</file>
<file>toolicon/32x32/move.png</file> <file>toolicon/32x32/move.png</file>
<file>toolicon/32x32/move@2x.png</file> <file>toolicon/32x32/move@2x.png</file>
<file>toolicon/32x32/el_arc.png</file>
<file>toolicon/32x32/el_arc@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -558,7 +558,8 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
{ {
scene = sceneDetail; scene = sceneDetail;
} }
const QStringList tags = QStringList() << TagPoint << TagLine << TagSpline << TagArc << TagTools << TagOperation; const QStringList tags = QStringList() << TagPoint << TagLine << TagSpline << TagArc << TagTools << TagOperation
<< TagElArc;
const QDomNodeList nodeList = node.childNodes(); const QDomNodeList nodeList = node.childNodes();
const qint32 num = nodeList.size(); const qint32 num = nodeList.size();
for (qint32 i = 0; i < num; ++i) for (qint32 i = 0; i < num; ++i)
@ -592,6 +593,10 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
qCDebug(vXML, "Tag operation."); qCDebug(vXML, "Tag operation.");
ParseOperationElement(scene, domElement, parse, domElement.attribute(AttrType, "")); ParseOperationElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
break; break;
case 6: // TagElArc
qCDebug(vXML, "Tag elliptical arc.");
ParseEllipticalArcElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
break;
default: default:
VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName())); VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
throw e; throw e;
@ -2438,6 +2443,58 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
const QString radius1 = GetParametrString(domElement, AttrRadius1, "10");
const QString radius2 = GetParametrString(domElement, AttrRadius2, "10");
QString r1 = radius1;//need for saving fixed formula;
QString r2 = radius2;//need for saving fixed formula;
const QString f1 = GetParametrString(domElement, AttrAngle1, "180");
QString f1Fix = f1;//need for saving fixed formula;
const QString f2 = GetParametrString(domElement, AttrAngle2, "270");
QString f2Fix = f2;//need for saving fixed formula;
const QString frotation = GetParametrString(domElement, AttrRotationAngle, "0");
QString frotationFix = frotation;//need for saving fixed formula;
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
VToolEllipticalArc::Create(id, center, r1, r2, f1Fix, f2Fix, frotationFix, color, scene, this, data, parse,
Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (r1 != radius1 || r2 != radius2 || f1Fix != f1 || f2Fix != f2 || frotationFix != frotation)
{
SetAttribute(domElement, AttrRadius1, r1);
SetAttribute(domElement, AttrRadius2, r2);
SetAttribute(domElement, AttrAngle1, f1Fix);
SetAttribute(domElement, AttrAngle2, f2Fix);
SetAttribute(domElement, AttrRotationAngle, frotationFix);
modified = true;
haveLiteChange();
}
}
catch (const VExceptionBadId &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple elliptical arc"), domElement);
excep.AddMoreInformation(e.ErrorMessage());
throw excep;
}
catch (qmu::QmuParserError &e)
{
VExceptionObjectError excep(tr("Error creating or updating simple elliptical arc"), domElement);
excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr()));
throw excep;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse) void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse)
{ {
@ -2865,6 +2922,34 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
} }
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ParseEllipticalArcElement parse elliptical arc tag.
* @param scene scene.
* @param domElement tag in xml tree.
* @param parse parser file mode.
* @param type type of spline.
*/
void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
const QString &type)
{
SCASSERT(scene != nullptr);
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");
QStringList arcs = QStringList() << VToolEllipticalArc::ToolType; /*0*/
switch (arcs.indexOf(type))
{
case 0: //VToolArc::ToolType
ParseToolEllipticalArc(scene, domElement, parse);
break;
default:
VException e(tr("Unknown elliptical arc type '%1'.").arg(type));
throw e;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ParseToolsElement parse tools tag. * @brief ParseToolsElement parse tools tag.
@ -3442,7 +3527,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) == 48, "Not all tools was used."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used.");
QRectF rec; QRectF rec;
@ -3563,6 +3648,8 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::Move: case Tool::Move:
rec = ToolBoundingRect<VToolMove>(rec, tool.getId()); rec = ToolBoundingRect<VToolMove>(rec, tool.getId());
break; break;
case Tool::EllipticalArc:
rec = ToolBoundingRect<VToolEllipticalArc>(rec, tool.getId());
//These tools are not accesseble in Draw mode, but still 'history' contains them. //These tools are not accesseble in Draw mode, but still 'history' contains them.
case Tool::Detail: case Tool::Detail:
case Tool::UnionDetails: case Tool::UnionDetails:

View File

@ -125,6 +125,8 @@ private:
const Document &parse, const QString& type); const Document &parse, const QString& type);
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,
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,
@ -193,6 +195,8 @@ private:
void ParseNodeArc(const QDomElement &domElement, const Document &parse); void ParseNodeArc(const QDomElement &domElement, const Document &parse);
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 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);
void ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);

View File

@ -90,6 +90,8 @@ const QString AttrSecondPoint = QStringLiteral("secondPoint");
const QString AttrThirdPoint = QStringLiteral("thirdPoint"); const QString AttrThirdPoint = QStringLiteral("thirdPoint");
const QString AttrCenter = QStringLiteral("center"); const QString AttrCenter = QStringLiteral("center");
const QString AttrRadius = QStringLiteral("radius"); const QString AttrRadius = QStringLiteral("radius");
const QString AttrRadius1 = QStringLiteral("radius1");
const QString AttrRadius2 = QStringLiteral("radius2");
const QString AttrAngle = QStringLiteral("angle"); const QString AttrAngle = QStringLiteral("angle");
const QString AttrAngle1 = QStringLiteral("angle1"); const QString AttrAngle1 = QStringLiteral("angle1");
const QString AttrAngle2 = QStringLiteral("angle2"); const QString AttrAngle2 = QStringLiteral("angle2");
@ -136,6 +138,7 @@ const QString AttrArc = QStringLiteral("arc");
const QString AttrSuffix = QStringLiteral("suffix"); const QString AttrSuffix = QStringLiteral("suffix");
const QString AttrIdObject = QStringLiteral("idObject"); const QString AttrIdObject = QStringLiteral("idObject");
const QString AttrInLayout = QStringLiteral("inLayout"); const QString AttrInLayout = QStringLiteral("inLayout");
const QString AttrRotationAngle = QStringLiteral("rotationAngle");
const QString TypeLineNone = QStringLiteral("none"); const QString TypeLineNone = QStringLiteral("none");
const QString TypeLineLine = QStringLiteral("hair"); const QString TypeLineLine = QStringLiteral("hair");

View File

@ -91,9 +91,12 @@ extern const QString AttrSecondPoint;
extern const QString AttrThirdPoint; extern const QString AttrThirdPoint;
extern const QString AttrCenter; extern const QString AttrCenter;
extern const QString AttrRadius; extern const QString AttrRadius;
extern const QString AttrRadius1;
extern const QString AttrRadius2;
extern const QString AttrAngle; extern const QString AttrAngle;
extern const QString AttrAngle1; extern const QString AttrAngle1;
extern const QString AttrAngle2; extern const QString AttrAngle2;
extern const QString AttrRotationAngle;
extern const QString AttrLength1; extern const QString AttrLength1;
extern const QString AttrLength2; extern const QString AttrLength2;
extern const QString AttrP1Line; extern const QString AttrP1Line;

View File

@ -32,5 +32,6 @@
<file>schema/individual_measurements/v0.3.1.xsd</file> <file>schema/individual_measurements/v0.3.1.xsd</file>
<file>schema/individual_measurements/v0.3.2.xsd</file> <file>schema/individual_measurements/v0.3.2.xsd</file>
<file>schema/individual_measurements/v0.3.3.xsd</file> <file>schema/individual_measurements/v0.3.3.xsd</file>
<file>schema/pattern/v0.3.9.xsd</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -0,0 +1,655 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- XML Schema Generated from XML Document-->
<xs:element name="pattern">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="version" type="formatVersion"></xs:element>
<xs:element name="unit" type="units"></xs:element>
<xs:element name="image" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="extension" type="imageExtension"></xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="heights">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="h50" type="xs:boolean"></xs:attribute>
<xs:attribute name="h56" type="xs:boolean"></xs:attribute>
<xs:attribute name="h62" type="xs:boolean"></xs:attribute>
<xs:attribute name="h68" type="xs:boolean"></xs:attribute>
<xs:attribute name="h74" type="xs:boolean"></xs:attribute>
<xs:attribute name="h80" type="xs:boolean"></xs:attribute>
<xs:attribute name="h86" type="xs:boolean"></xs:attribute>
<xs:attribute name="h92" type="xs:boolean"></xs:attribute>
<xs:attribute name="h98" type="xs:boolean"></xs:attribute>
<xs:attribute name="h104" type="xs:boolean"></xs:attribute>
<xs:attribute name="h110" type="xs:boolean"></xs:attribute>
<xs:attribute name="h116" type="xs:boolean"></xs:attribute>
<xs:attribute name="h122" type="xs:boolean"></xs:attribute>
<xs:attribute name="h128" type="xs:boolean"></xs:attribute>
<xs:attribute name="h134" type="xs:boolean"></xs:attribute>
<xs:attribute name="h140" type="xs:boolean"></xs:attribute>
<xs:attribute name="h146" type="xs:boolean"></xs:attribute>
<xs:attribute name="h152" type="xs:boolean"></xs:attribute>
<xs:attribute name="h158" type="xs:boolean"></xs:attribute>
<xs:attribute name="h164" type="xs:boolean"></xs:attribute>
<xs:attribute name="h170" type="xs:boolean"></xs:attribute>
<xs:attribute name="h176" type="xs:boolean"></xs:attribute>
<xs:attribute name="h182" type="xs:boolean"></xs:attribute>
<xs:attribute name="h188" type="xs:boolean"></xs:attribute>
<xs:attribute name="h194" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="s22" type="xs:boolean"></xs:attribute>
<xs:attribute name="s24" type="xs:boolean"></xs:attribute>
<xs:attribute name="s26" type="xs:boolean"></xs:attribute>
<xs:attribute name="s28" type="xs:boolean"></xs:attribute>
<xs:attribute name="s30" type="xs:boolean"></xs:attribute>
<xs:attribute name="s32" type="xs:boolean"></xs:attribute>
<xs:attribute name="s34" type="xs:boolean"></xs:attribute>
<xs:attribute name="s36" type="xs:boolean"></xs:attribute>
<xs:attribute name="s38" type="xs:boolean"></xs:attribute>
<xs:attribute name="s40" type="xs:boolean"></xs:attribute>
<xs:attribute name="s42" type="xs:boolean"></xs:attribute>
<xs:attribute name="s44" type="xs:boolean"></xs:attribute>
<xs:attribute name="s46" type="xs:boolean"></xs:attribute>
<xs:attribute name="s48" type="xs:boolean"></xs:attribute>
<xs:attribute name="s50" type="xs:boolean"></xs:attribute>
<xs:attribute name="s52" type="xs:boolean"></xs:attribute>
<xs:attribute name="s54" type="xs:boolean"></xs:attribute>
<xs:attribute name="s56" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="custom" type="xs:boolean"></xs:attribute>
<xs:attribute name="defHeight" type="baseHeight"></xs:attribute>
<xs:attribute name="defSize" type="baseSize"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="showMeasurements" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="measurements" type="xs:string"></xs:element>
<xs:element name="increments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
<xs:attribute name="formula" type="xs:string" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="incrementName">
<xs:selector xpath="increment"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="x" type="xs:double"></xs:attribute>
<xs:attribute name="y" type="xs:double"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="name" type="shortName"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="elArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="crossPoint" type="crossType"></xs:attribute>
<xs:attribute name="vCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="hCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
<xs:attribute name="c2Radius" type="xs:string"></xs:attribute>
<xs:attribute name="cRadius" type="xs:string"></xs:attribute>
<xs:attribute name="tangent" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="cCenter" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="name1" type="shortName"></xs:attribute>
<xs:attribute name="mx1" type="xs:double"></xs:attribute>
<xs:attribute name="my1" type="xs:double"></xs:attribute>
<xs:attribute name="name2" type="shortName"></xs:attribute>
<xs:attribute name="mx2" type="xs:double"></xs:attribute>
<xs:attribute name="my2" type="xs:double"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP2" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="operation" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="source" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="destination" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="suffix" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="axisType" type="axisType"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="rotationAngle" type="xs:string"></xs:attribute>
<xs:attribute name="radius1" type="xs:string"></xs:attribute>
<xs:attribute name="radius2" type="xs:string"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="duplicate" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="det" minOccurs="2" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="children" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="data" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="mcp" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="cutNumber" type="xs:unsignedInt"/>
<xs:attribute name="userDef" type="xs:string"/>
<xs:attribute name="material" type="materialType"/>
<xs:attribute name="placement" type="placementType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="letter" type="xs:string"></xs:attribute>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="height" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="height" type="xs:double"></xs:attribute>
<xs:attribute name="rotation" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="grainline" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="rotation" type="xs:string"></xs:attribute>
<xs:attribute name="arrows" type="arrowType"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="supplement" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="closed" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="forbidFlipping" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="groups" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="group" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="object" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="tool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="readOnly" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\&quot;]){1,1}([^*/^+\-=\s()?%:;!.,`'\&quot;]){0,}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="measurementsTypes">
<xs:restriction base="xs:string">
<xs:enumeration value="standard"/>
<xs:enumeration value="individual"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="imageExtension">
<xs:restriction base="xs:string">
<xs:enumeration value="PNG"/>
<xs:enumeration value="JPG"/>
<xs:enumeration value="BMP"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">
<xs:restriction base="xs:string">
<xs:enumeration value="black"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
<xs:enumeration value="darkRed"/>
<xs:enumeration value="darkGreen"/>
<xs:enumeration value="darkBlue"/>
<xs:enumeration value="yellow"/>
<xs:enumeration value="lightsalmon"/>
<xs:enumeration value="goldenrod"/>
<xs:enumeration value="orange"/>
<xs:enumeration value="deeppink"/>
<xs:enumeration value="violet"/>
<xs:enumeration value="darkviolet"/>
<xs:enumeration value="mediumseagreen"/>
<xs:enumeration value="lime"/>
<xs:enumeration value="deepskyblue"/>
<xs:enumeration value="cornflowerblue"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseHeight">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="50"/>
<xs:enumeration value="56"/>
<xs:enumeration value="62"/>
<xs:enumeration value="68"/>
<xs:enumeration value="74"/>
<xs:enumeration value="80"/>
<xs:enumeration value="86"/>
<xs:enumeration value="92"/>
<xs:enumeration value="98"/>
<xs:enumeration value="104"/>
<xs:enumeration value="110"/>
<xs:enumeration value="116"/>
<xs:enumeration value="122"/>
<xs:enumeration value="128"/>
<xs:enumeration value="134"/>
<xs:enumeration value="140"/>
<xs:enumeration value="146"/>
<xs:enumeration value="152"/>
<xs:enumeration value="158"/>
<xs:enumeration value="164"/>
<xs:enumeration value="170"/>
<xs:enumeration value="176"/>
<xs:enumeration value="182"/>
<xs:enumeration value="188"/>
<xs:enumeration value="194"/>
<xs:enumeration value="500"/>
<xs:enumeration value="560"/>
<xs:enumeration value="620"/>
<xs:enumeration value="680"/>
<xs:enumeration value="740"/>
<xs:enumeration value="800"/>
<xs:enumeration value="860"/>
<xs:enumeration value="920"/>
<xs:enumeration value="980"/>
<xs:enumeration value="1040"/>
<xs:enumeration value="1100"/>
<xs:enumeration value="1160"/>
<xs:enumeration value="1220"/>
<xs:enumeration value="1280"/>
<xs:enumeration value="1340"/>
<xs:enumeration value="1400"/>
<xs:enumeration value="1460"/>
<xs:enumeration value="1520"/>
<xs:enumeration value="1580"/>
<xs:enumeration value="1640"/>
<xs:enumeration value="1700"/>
<xs:enumeration value="1760"/>
<xs:enumeration value="1820"/>
<xs:enumeration value="1880"/>
<xs:enumeration value="1940"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseSize">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="22"/>
<xs:enumeration value="24"/>
<xs:enumeration value="26"/>
<xs:enumeration value="28"/>
<xs:enumeration value="30"/>
<xs:enumeration value="32"/>
<xs:enumeration value="34"/>
<xs:enumeration value="36"/>
<xs:enumeration value="38"/>
<xs:enumeration value="40"/>
<xs:enumeration value="42"/>
<xs:enumeration value="44"/>
<xs:enumeration value="46"/>
<xs:enumeration value="48"/>
<xs:enumeration value="50"/>
<xs:enumeration value="52"/>
<xs:enumeration value="54"/>
<xs:enumeration value="56"/>
<xs:enumeration value="220"/>
<xs:enumeration value="240"/>
<xs:enumeration value="260"/>
<xs:enumeration value="280"/>
<xs:enumeration value="300"/>
<xs:enumeration value="320"/>
<xs:enumeration value="340"/>
<xs:enumeration value="360"/>
<xs:enumeration value="380"/>
<xs:enumeration value="400"/>
<xs:enumeration value="420"/>
<xs:enumeration value="440"/>
<xs:enumeration value="460"/>
<xs:enumeration value="480"/>
<xs:enumeration value="500"/>
<xs:enumeration value="520"/>
<xs:enumeration value="540"/>
<xs:enumeration value="560"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="crossType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="axisType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="materialType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--Fabric-->
<xs:enumeration value="1"/><!--Lining-->
<xs:enumeration value="2"/><!--Interfacing-->
<xs:enumeration value="3"/><!--Interlining-->
<xs:enumeration value="4"/><!--UserDefined-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="placementType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--No placement-->
<xs:enumeration value="1"/><!--Cut on Fold-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="arrowType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--Both-->
<xs:enumeration value="1"/><!--Front-->
<xs:enumeration value="2"/><!--Rear-->
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -72,6 +72,7 @@ const QString VAbstractPattern::TagPoint = QStringLiteral("point");
const QString VAbstractPattern::TagLine = QStringLiteral("line"); const QString VAbstractPattern::TagLine = QStringLiteral("line");
const QString VAbstractPattern::TagSpline = QStringLiteral("spline"); const QString VAbstractPattern::TagSpline = QStringLiteral("spline");
const QString VAbstractPattern::TagArc = QStringLiteral("arc"); const QString VAbstractPattern::TagArc = QStringLiteral("arc");
const QString VAbstractPattern::TagElArc = QStringLiteral("elArc");
const QString VAbstractPattern::TagTools = QStringLiteral("tools"); const QString VAbstractPattern::TagTools = QStringLiteral("tools");
const QString VAbstractPattern::TagOperation = QStringLiteral("operation"); const QString VAbstractPattern::TagOperation = QStringLiteral("operation");
const QString VAbstractPattern::TagGradation = QStringLiteral("gradation"); const QString VAbstractPattern::TagGradation = QStringLiteral("gradation");
@ -1422,7 +1423,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 number // If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 48); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPoint); const QDomNodeList list = elementsByTagName(TagPoint);
@ -1493,7 +1494,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
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 48); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagArc); const QDomNodeList list = elementsByTagName(TagArc);
@ -1554,7 +1555,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
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 48); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint); const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1620,7 +1621,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
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 48); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation); const QDomNodeList list = elementsByTagName(TagOperation);

View File

@ -177,6 +177,7 @@ public:
static const QString TagLine; static const QString TagLine;
static const QString TagSpline; static const QString TagSpline;
static const QString TagArc; static const QString TagArc;
static const QString TagElArc;
static const QString TagTools; static const QString TagTools;
static const QString TagOperation; static const QString TagOperation;
static const QString TagGradation; static const QString TagGradation;

View File

@ -58,8 +58,8 @@ class QDomElement;
*/ */
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.8"); const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.9");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.8.xsd"); const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.9.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!

View File

@ -58,9 +58,10 @@ VEllipticalArc::VEllipticalArc()
*/ */
VEllipticalArc::VEllipticalArc (const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1, VEllipticalArc::VEllipticalArc (const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1,
const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2, const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2,
const QString &formulaF2, qreal rotationAngle, quint32 idObject, Draw mode) const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle,
quint32 idObject, Draw mode)
: VAbstractArc(GOType::EllipticalArc, center, f1, formulaF1, f2, formulaF2, idObject, mode), : VAbstractArc(GOType::EllipticalArc, center, f1, formulaF1, f2, formulaF2, idObject, mode),
d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle)) d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle))
{ {
CreateName(); CreateName();
} }
@ -77,9 +78,10 @@ VEllipticalArc::VEllipticalArc(const VPointF &center, qreal radius1, qreal radiu
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VEllipticalArc::VEllipticalArc(qreal length, const QString &formulaLength, const VPointF &center, qreal radius1, VEllipticalArc::VEllipticalArc(qreal length, const QString &formulaLength, const VPointF &center, qreal radius1,
qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1,
const QString &formulaF1, qreal rotationAngle, quint32 idObject, Draw mode) const QString &formulaF1, qreal rotationAngle, const QString &formulaRotationAngle,
quint32 idObject, Draw mode)
: VAbstractArc(GOType::EllipticalArc, formulaLength, center, f1, formulaF1, idObject, mode), : VAbstractArc(GOType::EllipticalArc, formulaLength, center, f1, formulaF1, idObject, mode),
d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle)) d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle))
{ {
CreateName(); CreateName();
FindF2(length); FindF2(length);
@ -445,12 +447,12 @@ QPointF VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VEllip
// the first arc has given length and startAngle just like in the origin arc // the first arc has given length and startAngle just like in the origin arc
arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2,
d->formulaRadius1, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle, d->formulaRadius1, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle,
getIdObject(), getMode()); GetFormulaRotationAngle(), getIdObject(), getMode());
// the second arc has startAngle just like endAngle of the first arc // the second arc has startAngle just like endAngle of the first arc
// and it has endAngle just like endAngle of the origin arc // and it has endAngle just like endAngle of the origin arc
arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2,
arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle, arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
getIdObject(), getMode()); GetFormulaRotationAngle(), getIdObject(), getMode());
return arc1.GetP1(); return arc1.GetP1();
} }
@ -540,7 +542,7 @@ qreal VEllipticalArc::MaxLength() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetRadius return arc major radius. * @brief GetFormulaRadius1 return formula for major radius.
* @return radius. * @return radius.
*/ */
QString VEllipticalArc::GetFormulaRadius1() const QString VEllipticalArc::GetFormulaRadius1() const
@ -550,7 +552,7 @@ QString VEllipticalArc::GetFormulaRadius1() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetRadius return arc minor radius. * @brief GetFormulaRadius2 return formula for minor radius.
* @return radius. * @return radius.
*/ */
QString VEllipticalArc::GetFormulaRadius2() const QString VEllipticalArc::GetFormulaRadius2() const
@ -560,12 +562,12 @@ QString VEllipticalArc::GetFormulaRadius2() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetRotationAngle return rotation angle. * @brief GetFormulaRotationAngle return formula for rotation angle.
* @return rotationAngle. * @return rotationAngle.
*/ */
qreal VEllipticalArc::GetRotationAngle() const QString VEllipticalArc::GetFormulaRotationAngle() const
{ {
return d->rotationAngle; return d->formulaRotationAngle;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -582,9 +584,16 @@ void VEllipticalArc::SetFormulaRadius2(const QString &formula, qreal value)
d->radius2 = value; d->radius2 = value;
} }
//---------------------------------------------------------------------------------------------------------------------
void VEllipticalArc::SetFormulaRotationAngle(const QString &formula, qreal value)
{
d->formulaRotationAngle = formula;
d->rotationAngle = value;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetRadius return formula for major radius. * @brief GetRadius1 return elliptical arc major radius.
* @return string with formula. * @return string with formula.
*/ */
qreal VEllipticalArc::GetRadius1() const qreal VEllipticalArc::GetRadius1() const
@ -594,10 +603,20 @@ qreal VEllipticalArc::GetRadius1() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief GetRadius return formula for minor radius. * @brief GetRadius2 return elliptical arc minor radius.
* @return string with formula. * @return string with formula.
*/ */
qreal VEllipticalArc::GetRadius2() const qreal VEllipticalArc::GetRadius2() const
{ {
return d->radius2; return d->radius2;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetRotationAngle return rotation angle.
* @return rotationAngle.
*/
qreal VEllipticalArc::GetRotationAngle() const
{
return d->rotationAngle;
}

View File

@ -52,11 +52,12 @@ public:
VEllipticalArc(); VEllipticalArc();
VEllipticalArc (const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1, VEllipticalArc (const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1,
const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2, const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2,
const QString &formulaF2, qreal rotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle,
quint32 idObject = 0, Draw mode = Draw::Calculation);
VEllipticalArc (const VPointF &center, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle); VEllipticalArc (const VPointF &center, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle);
VEllipticalArc (qreal length, const QString &formulaLength, const VPointF &center, qreal radius1, qreal radius2, VEllipticalArc (qreal length, const QString &formulaLength, const VPointF &center, 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, quint32 idObject = 0, Draw mode = Draw::Calculation); qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation);
VEllipticalArc (qreal length, const VPointF &center, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle); VEllipticalArc (qreal length, const VPointF &center, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle);
VEllipticalArc(const VEllipticalArc &arc); VEllipticalArc(const VEllipticalArc &arc);
@ -68,7 +69,9 @@ public:
virtual ~VEllipticalArc() Q_DECL_OVERRIDE; virtual ~VEllipticalArc() Q_DECL_OVERRIDE;
qreal GetRotationAngle() const; QString GetFormulaRotationAngle () const;
void SetFormulaRotationAngle (const QString &formula, qreal value);
qreal GetRotationAngle() const;
QString GetFormulaRadius1 () const; QString GetFormulaRadius1 () const;
void SetFormulaRadius1 (const QString &formula, qreal value); void SetFormulaRadius1 (const QString &formula, qreal value);

View File

@ -14,7 +14,7 @@ class VEllipticalArcData : public QSharedData
public: public:
VEllipticalArcData (); VEllipticalArcData ();
VEllipticalArcData (qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, VEllipticalArcData (qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2,
qreal rotationAngle); qreal rotationAngle, const QString &formulaRotationAngle);
VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle); VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle);
VEllipticalArcData(const VEllipticalArcData &arc); VEllipticalArcData(const VEllipticalArcData &arc);
@ -30,6 +30,8 @@ public:
QString formulaRadius2; QString formulaRadius2;
/** @brief rotationAngle in degree. */ /** @brief rotationAngle in degree. */
qreal rotationAngle; qreal rotationAngle;
/** @brief formulaRotationAngle formula for rotationAngle. */
QString formulaRotationAngle;
private: private:
VEllipticalArcData &operator=(const VEllipticalArcData &) Q_DECL_EQ_DELETE; VEllipticalArcData &operator=(const VEllipticalArcData &) Q_DECL_EQ_DELETE;
@ -41,17 +43,20 @@ VEllipticalArcData::VEllipticalArcData()
radius2(0), radius2(0),
formulaRadius1(), formulaRadius1(),
formulaRadius2(), formulaRadius2(),
rotationAngle(0) rotationAngle(0),
formulaRotationAngle()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1, VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1,
const QString &formulaRadius2, qreal rotationAngle) const QString &formulaRadius2, qreal rotationAngle,
const QString &formulaRotationAngle)
: radius1(radius1), : radius1(radius1),
radius2(radius2), radius2(radius2),
formulaRadius1(formulaRadius1), formulaRadius1(formulaRadius1),
formulaRadius2(formulaRadius2), formulaRadius2(formulaRadius2),
rotationAngle(rotationAngle) rotationAngle(rotationAngle),
formulaRotationAngle(formulaRotationAngle)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -60,7 +65,8 @@ VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotat
radius2(radius2), radius2(radius2),
formulaRadius1(QString().number(qApp->fromPixel(radius1))), formulaRadius1(QString().number(qApp->fromPixel(radius1))),
formulaRadius2(QString().number(qApp->fromPixel(radius2))), formulaRadius2(QString().number(qApp->fromPixel(radius2))),
rotationAngle(rotationAngle) rotationAngle(rotationAngle),
formulaRotationAngle(QString().number(qApp->fromPixel(rotationAngle)))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -70,7 +76,8 @@ VEllipticalArcData::VEllipticalArcData(const VEllipticalArcData &arc)
radius2(arc.radius2), radius2(arc.radius2),
formulaRadius1(arc.formulaRadius1), formulaRadius1(arc.formulaRadius1),
formulaRadius2(arc.formulaRadius2), formulaRadius2(arc.formulaRadius2),
rotationAngle(arc.rotationAngle) rotationAngle(arc.rotationAngle),
formulaRotationAngle(arc.formulaRotationAngle)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -115,6 +115,7 @@ enum class Tool : ToolVisHolderType
FlippingByAxis, FlippingByAxis,
Move, Move,
Midpoint, Midpoint,
EllipticalArc,
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
}; };
@ -158,7 +159,8 @@ enum class Vis : ToolVisHolderType
ToolRotation, ToolRotation,
ToolFlippingByLine, ToolFlippingByLine,
ToolFlippingByAxis, ToolFlippingByAxis,
ToolMove ToolMove,
ToolEllipticalArc
}; };
enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle,

View File

@ -64,5 +64,7 @@
<file>icon/16x16/allow_detail@2x.png</file> <file>icon/16x16/allow_detail@2x.png</file>
<file>icon/16x16/forbid_detail.png</file> <file>icon/16x16/forbid_detail.png</file>
<file>icon/16x16/forbid_detail@2x.png</file> <file>icon/16x16/forbid_detail@2x.png</file>
<file>icon/16x16/toolsectionelarc.png</file>
<file>icon/16x16/toolsectionelarc@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

View File

@ -0,0 +1,80 @@
/************************************************************************
**
** @file vellipticalarcradius.cpp
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 16 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 "vellipticalarcradius.h"
#include <QMessageLogger>
#include <QString>
#include "../ifc/ifcdef.h"
#include "../vgeometry/vellipticalarc.h"
#include "vcurvevariable.h"
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRadius::VEllipticalArcRadius()
:VCurveVariable()
{
SetType(VarType::ArcRadius);
}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRadius::VEllipticalArcRadius(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc,
const int numberRadius, Unit patternUnit) : VCurveVariable(id, parentId)
{
SCASSERT(elArc != nullptr);
SetType(VarType::ArcRadius);
SetName(QString(radius_V+"%1"+"%2").arg(numberRadius).arg(elArc->name()));
if (numberRadius == 1)
{
SetValue(FromPixel(elArc->GetRadius1(), patternUnit));
}
else
{
SetValue(FromPixel(elArc->GetRadius2(), patternUnit));
}
}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRadius::VEllipticalArcRadius(const VEllipticalArcRadius &var)
:VCurveVariable(var)
{}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRadius &VEllipticalArcRadius::operator=(const VEllipticalArcRadius &var)
{
if ( &var == this )
{
return *this;
}
VCurveVariable::operator=(var);
return *this;
}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcRadius::~VEllipticalArcRadius()
{}

View File

@ -0,0 +1,51 @@
/************************************************************************
**
** @file vellipticalarcradius.h
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 16 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 VELLIPTICALARCRADIUS_H
#define VELLIPTICALARCRADIUS_H
#include <qcompilerdetection.h>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "../ifc/ifcdef.h"
#include "vcurvevariable.h"
class VEllipticalArc;
class VEllipticalArcRadius :public VCurveVariable
{
public:
VEllipticalArcRadius();
VEllipticalArcRadius(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc,
const int numberRadius, Unit patternUnit);
VEllipticalArcRadius(const VEllipticalArcRadius &var);
VEllipticalArcRadius &operator=(const VEllipticalArcRadius &var);
virtual ~VEllipticalArcRadius() Q_DECL_OVERRIDE;
};
#endif // VELLIPTICALARCRADIUS_H

View File

@ -40,10 +40,12 @@
#include "../vgeometry/vpointf.h" #include "../vgeometry/vpointf.h"
#include "../vgeometry/vspline.h" #include "../vgeometry/vspline.h"
#include "../vgeometry/varc.h" #include "../vgeometry/varc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#include "../vmisc/logging.h" #include "../vmisc/logging.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "variables/varcradius.h" #include "variables/varcradius.h"
#include "variables/vellipticalarcradius.h"
#include "variables/vcurveangle.h" #include "variables/vcurveangle.h"
#include "variables/vcurvelength.h" #include "variables/vcurvelength.h"
#include "variables/vcurveclength.h" #include "variables/vcurveclength.h"
@ -388,13 +390,25 @@ void VContainer::AddArc(const QSharedPointer<VArc> &arc, const quint32 &id, cons
AddVariable(radius->GetName(), radius); AddVariable(radius->GetName(), radius);
} }
//---------------------------------------------------------------------------------------------------------------------
void VContainer::AddEllipticalArc(const QSharedPointer<VEllipticalArc> &arc, const quint32 &id, const quint32 &parentId)
{
AddCurve(arc, id, parentId);
VEllipticalArcRadius *radius1 = new VEllipticalArcRadius(id, parentId, arc.data(), 1, *GetPatternUnit());
AddVariable(radius1->GetName(), radius1);
VEllipticalArcRadius *radius2 = new VEllipticalArcRadius(id, parentId, arc.data(), 2, *GetPatternUnit());
AddVariable(radius2->GetName(), radius2);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VContainer::AddCurve(const QSharedPointer<VAbstractCurve> &curve, const quint32 &id, quint32 parentId) void VContainer::AddCurve(const QSharedPointer<VAbstractCurve> &curve, const quint32 &id, quint32 parentId)
{ {
const GOType curveType = curve->getType(); const GOType curveType = curve->getType();
if (curveType != GOType::Spline && curveType != GOType::SplinePath && if (curveType != GOType::Spline && curveType != GOType::SplinePath &&
curveType != GOType::CubicBezier && curveType != GOType::CubicBezierPath && curveType != GOType::CubicBezier && curveType != GOType::CubicBezierPath &&
curveType != GOType::Arc) curveType != GOType::Arc && curveType != GOType::EllipticalArc)
{ {
throw VException(tr("Can't create a curve with type '%1'").arg(static_cast<int>(curveType))); throw VException(tr("Can't create a curve with type '%1'").arg(static_cast<int>(curveType)));
} }

View File

@ -59,6 +59,7 @@
class VAbstractCubicBezierPath; class VAbstractCubicBezierPath;
class VAbstractCurve; class VAbstractCurve;
class VArc; class VArc;
class VEllipticalArc;
class VArcRadius; class VArcRadius;
class VCurveAngle; class VCurveAngle;
class VCurveLength; class VCurveLength;
@ -146,6 +147,8 @@ public:
quint32 AddDetail(const VDetail &detail); quint32 AddDetail(const VDetail &detail);
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
void AddArc(const QSharedPointer<VArc> &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID); void AddArc(const QSharedPointer<VArc> &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID);
void AddEllipticalArc(const QSharedPointer<VEllipticalArc> &arc, const quint32 &arcId,
const quint32 &parentId = NULL_ID);
void AddSpline(const QSharedPointer<VAbstractBezier> &curve, quint32 id, quint32 parentId = NULL_ID); void AddSpline(const QSharedPointer<VAbstractBezier> &curve, quint32 id, quint32 parentId = NULL_ID);
void AddCurveWithSegments(const QSharedPointer<VAbstractCubicBezierPath> &curve, const quint32 &id, void AddCurveWithSegments(const QSharedPointer<VAbstractCubicBezierPath> &curve, const quint32 &id,
quint32 parentId = NULL_ID); quint32 parentId = NULL_ID);

View File

@ -1,60 +1,62 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!! # ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro # This need for corect working file translations.pro
SOURCES += \ SOURCES += \
$$PWD/vcontainer.cpp \ $$PWD/vcontainer.cpp \
$$PWD/calculator.cpp \ $$PWD/calculator.cpp \
$$PWD/vdetail.cpp \ $$PWD/vdetail.cpp \
$$PWD/vnodedetail.cpp \ $$PWD/vnodedetail.cpp \
$$PWD/vtranslatevars.cpp \ $$PWD/vtranslatevars.cpp \
$$PWD/variables/varcradius.cpp \ $$PWD/variables/varcradius.cpp \
$$PWD/variables/vcurveangle.cpp \ $$PWD/variables/vcurveangle.cpp \
$$PWD/variables/vcurvelength.cpp \ $$PWD/variables/vcurvelength.cpp \
$$PWD/variables/vcurvevariable.cpp \ $$PWD/variables/vcurvevariable.cpp \
$$PWD/variables/vincrement.cpp \ $$PWD/variables/vincrement.cpp \
$$PWD/variables/vinternalvariable.cpp \ $$PWD/variables/vinternalvariable.cpp \
$$PWD/variables/vlineangle.cpp \ $$PWD/variables/vlineangle.cpp \
$$PWD/variables/vlinelength.cpp \ $$PWD/variables/vlinelength.cpp \
$$PWD/variables/vmeasurement.cpp \ $$PWD/variables/vmeasurement.cpp \
$$PWD/variables/vvariable.cpp \ $$PWD/variables/vvariable.cpp \
$$PWD/vformula.cpp \ $$PWD/vformula.cpp \
$$PWD/vpatternpiecedata.cpp \ $$PWD/vpatternpiecedata.cpp \
$$PWD/vpatterninfogeometry.cpp \ $$PWD/vpatterninfogeometry.cpp \
$$PWD/vgrainlinegeometry.cpp \ $$PWD/vgrainlinegeometry.cpp \
$$PWD/variables/vcurveclength.cpp $$PWD/variables/vcurveclength.cpp \
$$PWD/variables/vellipticalarcradius.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
HEADERS += \
$$PWD/vcontainer.h \ HEADERS += \
$$PWD/stable.h \ $$PWD/vcontainer.h \
$$PWD/calculator.h \ $$PWD/stable.h \
$$PWD/variables.h \ $$PWD/calculator.h \
$$PWD/vdetail.h \ $$PWD/variables.h \
$$PWD/vdetail_p.h \ $$PWD/vdetail.h \
$$PWD/vnodedetail.h \ $$PWD/vdetail_p.h \
$$PWD/vnodedetail_p.h \ $$PWD/vnodedetail.h \
$$PWD/vtranslatevars.h \ $$PWD/vnodedetail_p.h \
$$PWD/variables/varcradius.h \ $$PWD/vtranslatevars.h \
$$PWD/variables/varcradius_p.h \ $$PWD/variables/varcradius.h \
$$PWD/variables/vcurveangle.h \ $$PWD/variables/varcradius_p.h \
$$PWD/variables/vcurvelength.h \ $$PWD/variables/vcurveangle.h \
$$PWD/variables/vcurvevariable.h \ $$PWD/variables/vcurvelength.h \
$$PWD/variables/vcurvevariable_p.h \ $$PWD/variables/vcurvevariable.h \
$$PWD/variables/vincrement.h \ $$PWD/variables/vcurvevariable_p.h \
$$PWD/variables/vincrement_p.h \ $$PWD/variables/vincrement.h \
$$PWD/variables/vinternalvariable.h \ $$PWD/variables/vincrement_p.h \
$$PWD/variables/vinternalvariable_p.h \ $$PWD/variables/vinternalvariable.h \
$$PWD/variables/vlineangle.h \ $$PWD/variables/vinternalvariable_p.h \
$$PWD/variables/vlineangle_p.h \ $$PWD/variables/vlineangle.h \
$$PWD/variables/vlinelength.h \ $$PWD/variables/vlineangle_p.h \
$$PWD/variables/vlinelength_p.h \ $$PWD/variables/vlinelength.h \
$$PWD/variables/vmeasurement.h \ $$PWD/variables/vlinelength_p.h \
$$PWD/variables/vmeasurement_p.h \ $$PWD/variables/vmeasurement.h \
$$PWD/variables/vvariable.h \ $$PWD/variables/vmeasurement_p.h \
$$PWD/variables/vvariable_p.h \ $$PWD/variables/vvariable.h \
$$PWD/vformula.h \ $$PWD/variables/vvariable_p.h \
$$PWD/vpatternpiecedata.h \ $$PWD/vformula.h \
$$PWD/vpatterninfogeometry.h \ $$PWD/vpatternpiecedata.h \
$$PWD/vgrainlinegeometry.h \ $$PWD/vpatterninfogeometry.h \
$$PWD/variables/vcurveclength.h $$PWD/vgrainlinegeometry.h \
$$PWD/variables/vcurveclength.h \
$$PWD/variables/vellipticalarcradius.h

View File

@ -1,126 +1,129 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!! # ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro # This need for corect working file translations.pro
HEADERS += \ HEADERS += \
$$PWD/tooldialogs.h \ $$PWD/tooldialogs.h \
$$PWD/tools/dialogalongline.h \ $$PWD/tools/dialogalongline.h \
$$PWD/tools/dialogarc.h \ $$PWD/tools/dialogarc.h \
$$PWD/tools/dialogarcwithlength.h \ $$PWD/tools/dialogarcwithlength.h \
$$PWD/tools/dialogbisector.h \ $$PWD/tools/dialogbisector.h \
$$PWD/tools/dialogcurveintersectaxis.h \ $$PWD/tools/dialogcurveintersectaxis.h \
$$PWD/tools/dialogcutarc.h \ $$PWD/tools/dialogcutarc.h \
$$PWD/tools/dialogcutspline.h \ $$PWD/tools/dialogcutspline.h \
$$PWD/tools/dialogcutsplinepath.h \ $$PWD/tools/dialogcutsplinepath.h \
$$PWD/tools/dialogdetail.h \ $$PWD/tools/dialogdetail.h \
$$PWD/tools/dialogendline.h \ $$PWD/tools/dialogendline.h \
$$PWD/tools/dialogheight.h \ $$PWD/tools/dialogheight.h \
$$PWD/tools/dialogline.h \ $$PWD/tools/dialogline.h \
$$PWD/tools/dialoglineintersect.h \ $$PWD/tools/dialoglineintersect.h \
$$PWD/tools/dialoglineintersectaxis.h \ $$PWD/tools/dialoglineintersectaxis.h \
$$PWD/tools/dialognormal.h \ $$PWD/tools/dialognormal.h \
$$PWD/tools/dialogpointfromarcandtangent.h \ $$PWD/tools/dialogpointfromarcandtangent.h \
$$PWD/tools/dialogpointfromcircleandtangent.h \ $$PWD/tools/dialogpointfromcircleandtangent.h \
$$PWD/tools/dialogpointofcontact.h \ $$PWD/tools/dialogpointofcontact.h \
$$PWD/tools/dialogpointofintersection.h \ $$PWD/tools/dialogpointofintersection.h \
$$PWD/tools/dialogpointofintersectionarcs.h \ $$PWD/tools/dialogpointofintersectionarcs.h \
$$PWD/tools/dialogpointofintersectioncircles.h \ $$PWD/tools/dialogpointofintersectioncircles.h \
$$PWD/tools/dialogshoulderpoint.h \ $$PWD/tools/dialogshoulderpoint.h \
$$PWD/tools/dialogsinglepoint.h \ $$PWD/tools/dialogsinglepoint.h \
$$PWD/tools/dialogspline.h \ $$PWD/tools/dialogspline.h \
$$PWD/tools/dialogsplinepath.h \ $$PWD/tools/dialogsplinepath.h \
$$PWD/tools/dialogtool.h \ $$PWD/tools/dialogtool.h \
$$PWD/tools/dialogtriangle.h \ $$PWD/tools/dialogtriangle.h \
$$PWD/tools/dialoguniondetails.h \ $$PWD/tools/dialoguniondetails.h \
$$PWD/support/dialogeditwrongformula.h \ $$PWD/support/dialogeditwrongformula.h \
$$PWD/support/dialogundo.h \ $$PWD/support/dialogundo.h \
$$PWD/tools/dialogtruedarts.h \ $$PWD/tools/dialogtruedarts.h \
$$PWD/tools/dialogpointofintersectioncurves.h \ $$PWD/tools/dialogpointofintersectioncurves.h \
$$PWD/tools/dialogcubicbezier.h \ $$PWD/tools/dialogcubicbezier.h \
$$PWD/tools/dialogcubicbezierpath.h \ $$PWD/tools/dialogcubicbezierpath.h \
$$PWD/tools/dialoggroup.h \ $$PWD/tools/dialoggroup.h \
$$PWD/tools/dialogrotation.h \ $$PWD/tools/dialogrotation.h \
$$PWD/tools/dialogflippingbyline.h \ $$PWD/tools/dialogflippingbyline.h \
$$PWD/tools/dialogflippingbyaxis.h \ $$PWD/tools/dialogflippingbyaxis.h \
$$PWD/tools/dialogmove.h $$PWD/tools/dialogmove.h \
$$PWD/tools/dialogellipticalarc.h
SOURCES += \
$$PWD/tools/dialogalongline.cpp \ SOURCES += \
$$PWD/tools/dialogarc.cpp \ $$PWD/tools/dialogalongline.cpp \
$$PWD/tools/dialogarcwithlength.cpp \ $$PWD/tools/dialogarc.cpp \
$$PWD/tools/dialogbisector.cpp \ $$PWD/tools/dialogarcwithlength.cpp \
$$PWD/tools/dialogcurveintersectaxis.cpp \ $$PWD/tools/dialogbisector.cpp \
$$PWD/tools/dialogcutarc.cpp \ $$PWD/tools/dialogcurveintersectaxis.cpp \
$$PWD/tools/dialogcutspline.cpp \ $$PWD/tools/dialogcutarc.cpp \
$$PWD/tools/dialogcutsplinepath.cpp \ $$PWD/tools/dialogcutspline.cpp \
$$PWD/tools/dialogdetail.cpp \ $$PWD/tools/dialogcutsplinepath.cpp \
$$PWD/tools/dialogendline.cpp \ $$PWD/tools/dialogdetail.cpp \
$$PWD/tools/dialogheight.cpp \ $$PWD/tools/dialogendline.cpp \
$$PWD/tools/dialogline.cpp \ $$PWD/tools/dialogheight.cpp \
$$PWD/tools/dialoglineintersect.cpp \ $$PWD/tools/dialogline.cpp \
$$PWD/tools/dialoglineintersectaxis.cpp \ $$PWD/tools/dialoglineintersect.cpp \
$$PWD/tools/dialognormal.cpp \ $$PWD/tools/dialoglineintersectaxis.cpp \
$$PWD/tools/dialogpointfromarcandtangent.cpp \ $$PWD/tools/dialognormal.cpp \
$$PWD/tools/dialogpointfromcircleandtangent.cpp \ $$PWD/tools/dialogpointfromarcandtangent.cpp \
$$PWD/tools/dialogpointofcontact.cpp \ $$PWD/tools/dialogpointfromcircleandtangent.cpp \
$$PWD/tools/dialogpointofintersection.cpp \ $$PWD/tools/dialogpointofcontact.cpp \
$$PWD/tools/dialogpointofintersectionarcs.cpp \ $$PWD/tools/dialogpointofintersection.cpp \
$$PWD/tools/dialogpointofintersectioncircles.cpp \ $$PWD/tools/dialogpointofintersectionarcs.cpp \
$$PWD/tools/dialogshoulderpoint.cpp \ $$PWD/tools/dialogpointofintersectioncircles.cpp \
$$PWD/tools/dialogsinglepoint.cpp \ $$PWD/tools/dialogshoulderpoint.cpp \
$$PWD/tools/dialogspline.cpp \ $$PWD/tools/dialogsinglepoint.cpp \
$$PWD/tools/dialogsplinepath.cpp \ $$PWD/tools/dialogspline.cpp \
$$PWD/tools/dialogtool.cpp \ $$PWD/tools/dialogsplinepath.cpp \
$$PWD/tools/dialogtriangle.cpp \ $$PWD/tools/dialogtool.cpp \
$$PWD/tools/dialoguniondetails.cpp \ $$PWD/tools/dialogtriangle.cpp \
$$PWD/support/dialogeditwrongformula.cpp \ $$PWD/tools/dialoguniondetails.cpp \
$$PWD/support/dialogundo.cpp \ $$PWD/support/dialogeditwrongformula.cpp \
$$PWD/tools/dialogtruedarts.cpp \ $$PWD/support/dialogundo.cpp \
$$PWD/tools/dialogpointofintersectioncurves.cpp \ $$PWD/tools/dialogtruedarts.cpp \
$$PWD/tools/dialogcubicbezier.cpp \ $$PWD/tools/dialogpointofintersectioncurves.cpp \
$$PWD/tools/dialogcubicbezierpath.cpp \ $$PWD/tools/dialogcubicbezier.cpp \
$$PWD/tools/dialoggroup.cpp \ $$PWD/tools/dialogcubicbezierpath.cpp \
$$PWD/tools/dialogrotation.cpp \ $$PWD/tools/dialoggroup.cpp \
$$PWD/tools/dialogflippingbyline.cpp \ $$PWD/tools/dialogrotation.cpp \
$$PWD/tools/dialogflippingbyaxis.cpp \ $$PWD/tools/dialogflippingbyline.cpp \
$$PWD/tools/dialogmove.cpp $$PWD/tools/dialogflippingbyaxis.cpp \
$$PWD/tools/dialogmove.cpp \
FORMS += \ $$PWD/tools/dialogellipticalarc.cpp
$$PWD/tools/dialogalongline.ui \
$$PWD/tools/dialogarc.ui \ FORMS += \
$$PWD/tools/dialogarcwithlength.ui \ $$PWD/tools/dialogalongline.ui \
$$PWD/tools/dialogbisector.ui \ $$PWD/tools/dialogarc.ui \
$$PWD/tools/dialogcurveintersectaxis.ui \ $$PWD/tools/dialogarcwithlength.ui \
$$PWD/tools/dialogcutarc.ui \ $$PWD/tools/dialogbisector.ui \
$$PWD/tools/dialogcutspline.ui \ $$PWD/tools/dialogcurveintersectaxis.ui \
$$PWD/tools/dialogcutsplinepath.ui \ $$PWD/tools/dialogcutarc.ui \
$$PWD/tools/dialogdetail.ui \ $$PWD/tools/dialogcutspline.ui \
$$PWD/tools/dialogendline.ui \ $$PWD/tools/dialogcutsplinepath.ui \
$$PWD/tools/dialogheight.ui \ $$PWD/tools/dialogdetail.ui \
$$PWD/tools/dialogline.ui \ $$PWD/tools/dialogendline.ui \
$$PWD/tools/dialoglineintersect.ui \ $$PWD/tools/dialogheight.ui \
$$PWD/tools/dialoglineintersectaxis.ui \ $$PWD/tools/dialogline.ui \
$$PWD/tools/dialognormal.ui \ $$PWD/tools/dialoglineintersect.ui \
$$PWD/tools/dialogpointfromarcandtangent.ui \ $$PWD/tools/dialoglineintersectaxis.ui \
$$PWD/tools/dialogpointfromcircleandtangent.ui \ $$PWD/tools/dialognormal.ui \
$$PWD/tools/dialogpointofcontact.ui \ $$PWD/tools/dialogpointfromarcandtangent.ui \
$$PWD/tools/dialogpointofintersection.ui \ $$PWD/tools/dialogpointfromcircleandtangent.ui \
$$PWD/tools/dialogpointofintersectionarcs.ui \ $$PWD/tools/dialogpointofcontact.ui \
$$PWD/tools/dialogpointofintersectioncircles.ui \ $$PWD/tools/dialogpointofintersection.ui \
$$PWD/tools/dialogshoulderpoint.ui \ $$PWD/tools/dialogpointofintersectionarcs.ui \
$$PWD/tools/dialogsinglepoint.ui \ $$PWD/tools/dialogpointofintersectioncircles.ui \
$$PWD/tools/dialogspline.ui \ $$PWD/tools/dialogshoulderpoint.ui \
$$PWD/tools/dialogsplinepath.ui \ $$PWD/tools/dialogsinglepoint.ui \
$$PWD/tools/dialogtriangle.ui \ $$PWD/tools/dialogspline.ui \
$$PWD/tools/dialoguniondetails.ui \ $$PWD/tools/dialogsplinepath.ui \
$$PWD/support/dialogeditwrongformula.ui \ $$PWD/tools/dialogtriangle.ui \
$$PWD/support/dialogundo.ui \ $$PWD/tools/dialoguniondetails.ui \
$$PWD/tools/dialogtruedarts.ui \ $$PWD/support/dialogeditwrongformula.ui \
$$PWD/tools/dialogpointofintersectioncurves.ui \ $$PWD/support/dialogundo.ui \
$$PWD/tools/dialogcubicbezier.ui \ $$PWD/tools/dialogtruedarts.ui \
$$PWD/tools/dialogcubicbezierpath.ui \ $$PWD/tools/dialogpointofintersectioncurves.ui \
$$PWD/tools/dialoggroup.ui \ $$PWD/tools/dialogcubicbezier.ui \
$$PWD/tools/dialogrotation.ui \ $$PWD/tools/dialogcubicbezierpath.ui \
$$PWD/tools/dialogflippingbyline.ui \ $$PWD/tools/dialoggroup.ui \
$$PWD/tools/dialogflippingbyaxis.ui \ $$PWD/tools/dialogrotation.ui \
$$PWD/tools/dialogmove.ui $$PWD/tools/dialogflippingbyline.ui \
$$PWD/tools/dialogflippingbyaxis.ui \
$$PWD/tools/dialogmove.ui \
$$PWD/tools/dialogellipticalarc.ui

View File

@ -65,6 +65,7 @@
#include "tools/dialogflippingbyline.h" #include "tools/dialogflippingbyline.h"
#include "tools/dialogflippingbyaxis.h" #include "tools/dialogflippingbyaxis.h"
#include "tools/dialogmove.h" #include "tools/dialogmove.h"
#include "tools/dialogellipticalarc.h"
#include "support/dialogeditwrongformula.h" #include "support/dialogeditwrongformula.h"
#include "support/dialogundo.h" #include "support/dialogundo.h"

View File

@ -0,0 +1,638 @@
/************************************************************************
**
** @file dialogellipticalarc.cpp
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 15 9, 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 "dialogellipticalarc.h"
#include <limits.h>
#include <QDialog>
#include <QLabel>
#include <QPlainTextEdit>
#include <QPointer>
#include <QPushButton>
#include <QTimer>
#include <QToolButton>
#include <Qt>
#include "../ifc/xml/vdomdocument.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../../visualization/path/vistoolellipticalarc.h"
#include "../../visualization/visualization.h"
#include "../support/dialogeditwrongformula.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vcommonsettings.h"
#include "ui_dialogellipticalarc.h"
class QCloseEvent;
class QWidget;
class VContainer;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogEllipticalArc create dialog
* @param data container with data
* @param parent parent widget
*/
DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogEllipticalArc)
{
ui->setupUi(this);
this->formulaBaseHeightRadius1 = ui->plainTextEditRadius1->height();
this->formulaBaseHeightRadius2 = ui->plainTextEditRadius2->height();
this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
this->formulaBaseHeightF2 = ui->plainTextEditF2->height();
this->formulaBaseHeightRotationAngle = ui->plainTextEditRotationAngle->height();
ui->plainTextEditRadius1->installEventFilter(this);
ui->plainTextEditRadius2->installEventFilter(this);
ui->plainTextEditF1->installEventFilter(this);
ui->plainTextEditF2->installEventFilter(this);
ui->plainTextEditRotationAngle->installEventFilter(this);
timerRadius1 = new QTimer(this);
connect(timerRadius1, &QTimer::timeout, this, &DialogEllipticalArc::EvalRadiuses);
timerRadius2 = new QTimer(this);
connect(timerRadius2, &QTimer::timeout, this, &DialogEllipticalArc::EvalRadiuses);
timerF1 = new QTimer(this);
connect(timerF1, &QTimer::timeout, this, &DialogEllipticalArc::EvalAngles);
timerF2 = new QTimer(this);
connect(timerF2, &QTimer::timeout, this, &DialogEllipticalArc::EvalAngles);
timerRotationAngle = new QTimer(this);
connect(timerRotationAngle, &QTimer::timeout, this, &DialogEllipticalArc::EvalAngles);
InitOkCancelApply(ui);
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxLineColors(ui->comboBoxColor);
CheckState();
connect(ui->toolButtonExprRadius1, &QPushButton::clicked, this, &DialogEllipticalArc::FXRadius1);
connect(ui->toolButtonExprRadius2, &QPushButton::clicked, this, &DialogEllipticalArc::FXRadius2);
connect(ui->toolButtonExprF1, &QPushButton::clicked, this, &DialogEllipticalArc::FXF1);
connect(ui->toolButtonExprF2, &QPushButton::clicked, this, &DialogEllipticalArc::FXF2);
connect(ui->toolButtonExprRotationAngle, &QPushButton::clicked, this, &DialogEllipticalArc::FXRotationAngle);
connect(ui->plainTextEditRadius1, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::Radius1Changed);
connect(ui->plainTextEditRadius2, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::Radius2Changed);
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::F1Changed);
connect(ui->plainTextEditF2, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::F2Changed);
connect(ui->plainTextEditRotationAngle, &QPlainTextEdit::textChanged,
this, &DialogEllipticalArc::RotationAngleChanged);
connect(ui->pushButtonGrowLengthRadius1, &QPushButton::clicked, this, &DialogEllipticalArc::DeployRadius1TextEdit);
connect(ui->pushButtonGrowLengthRadius2, &QPushButton::clicked, this, &DialogEllipticalArc::DeployRadius2TextEdit);
connect(ui->pushButtonGrowLengthF1, &QPushButton::clicked, this, &DialogEllipticalArc::DeployF1TextEdit);
connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogEllipticalArc::DeployF2TextEdit);
connect(ui->pushButtonGrowLengthRotationAngle, &QPushButton::clicked,
this, &DialogEllipticalArc::DeployRotationAngleTextEdit);
vis = new VisToolEllipticalArc(data);
}
//---------------------------------------------------------------------------------------------------------------------
DialogEllipticalArc::~DialogEllipticalArc()
{
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetCenter return id of center point
* @return id id
*/
quint32 DialogEllipticalArc::GetCenter() const
{
return getCurrentObjectId(ui->comboBoxBasePoint);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetCenter set id of center point
* @param value id
*/
void DialogEllipticalArc::SetCenter(const quint32 &value)
{
ChangeCurrentData(ui->comboBoxBasePoint, value);
vis->setObject1Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetRadius1 return formula of radius1
* @return formula
*/
QString DialogEllipticalArc::GetRadius1() const
{
return qApp->TrVars()->TryFormulaFromUser(radius1, qApp->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetRadius1 set formula of radius1
* @param value formula
*/
void DialogEllipticalArc::SetRadius1(const QString &value)
{
radius1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (radius1.length() > 80)
{
this->DeployRadius1TextEdit();
}
ui->plainTextEditRadius1->setPlainText(radius1);
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr);
path->setRadius1(radius1);
MoveCursorToEnd(ui->plainTextEditRadius1);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetRadius2 return formula of radius2
* @return formula
*/
QString DialogEllipticalArc::GetRadius2() const
{
return qApp->TrVars()->TryFormulaFromUser(radius2, qApp->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetRadius2 set formula of radius2
* @param value formula
*/
void DialogEllipticalArc::SetRadius2(const QString &value)
{
radius2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (radius2.length() > 80)
{
this->DeployRadius2TextEdit();
}
ui->plainTextEditRadius2->setPlainText(radius2);
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr);
path->setRadius2(radius2);
MoveCursorToEnd(ui->plainTextEditRadius2);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetF1 return formula first angle of elliptical arc
* @return formula
*/
QString DialogEllipticalArc::GetF1() const
{
return qApp->TrVars()->TryFormulaFromUser(f1, qApp->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetF1 set formula first angle of elliptical arc
* @param value formula
*/
void DialogEllipticalArc::SetF1(const QString &value)
{
f1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (f1.length() > 80)
{
this->DeployF1TextEdit();
}
ui->plainTextEditF1->setPlainText(f1);
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr);
path->setF1(f1);
MoveCursorToEnd(ui->plainTextEditF1);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetF2 return formula second angle of elliptical arc
* @return formula
*/
QString DialogEllipticalArc::GetF2() const
{
return qApp->TrVars()->TryFormulaFromUser(f2, qApp->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetF2 set formula second angle of elliptical arc
* @param value formula
*/
void DialogEllipticalArc::SetF2(const QString &value)
{
f2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (f2.length() > 80)
{
this->DeployF2TextEdit();
}
ui->plainTextEditF2->setPlainText(f2);
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr);
path->setF2(f2);
MoveCursorToEnd(ui->plainTextEditF2);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetRotationAngle return formula rotation angle of elliptical arc
* @return formula
*/
QString DialogEllipticalArc::GetRotationAngle() const
{
return qApp->TrVars()->TryFormulaFromUser(rotationAngle, qApp->Settings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetRotationAngle set formula rotation angle of elliptical arc
* @param value formula
*/
void DialogEllipticalArc::SetRotationAngle(const QString &value)
{
rotationAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
// increase height if needed.
if (rotationAngle.length() > 80)
{
this->DeployRotationAngleTextEdit();
}
ui->plainTextEditRotationAngle->setPlainText(rotationAngle);
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr);
path->setRotationAngle(rotationAngle);
MoveCursorToEnd(ui->plainTextEditRotationAngle);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetColor return color of elliptical arc
* @return formula
*/
QString DialogEllipticalArc::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetColor set color of elliptical arc
* @param value formula
*/
void DialogEllipticalArc::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief EvalRadiuses calculate value of radiuses
*/
void DialogEllipticalArc::EvalRadiuses()
{
labelEditFormula = ui->labelEditRadius1;
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
const qreal radius_1 = Eval(ui->plainTextEditRadius1->toPlainText(), flagRadius1, ui->labelResultRadius1, postfix);
if (radius_1 < 0)
{
flagRadius1 = false;
ChangeColor(labelEditFormula, Qt::red);
ui->labelResultRadius1->setText(tr("Error"));
ui->labelResultRadius1->setToolTip(tr("Radius can't be negative"));
DialogEllipticalArc::CheckState();
}
labelEditFormula = ui->labelEditRadius2;
const qreal radius_2 = Eval(ui->plainTextEditRadius2->toPlainText(), flagRadius2, ui->labelResultRadius2, postfix);
if (radius_2 < 0)
{
flagRadius2 = false;
ChangeColor(labelEditFormula, Qt::red);
ui->labelResultRadius2->setText(tr("Error"));
ui->labelResultRadius2->setToolTip(tr("Radius can't be negative"));
DialogEllipticalArc::CheckState();
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief EvalAngles calculate value of angles
*/
void DialogEllipticalArc::EvalAngles()
{
labelEditFormula = ui->labelEditF1;
angleF1 = Eval(ui->plainTextEditF1->toPlainText(), flagF1, ui->labelResultF1, degreeSymbol, false);
labelEditFormula = ui->labelEditF2;
angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
labelEditFormula = ui->labelEditRotationAngle;
rotationAngle = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle,
ui->labelResultRotationAngle, degreeSymbol, false);
CheckAngles();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::CheckAngles()
{
if (static_cast<int>(angleF1) == INT_MIN || static_cast<int>(angleF2) == INT_MIN)
{
return;
}
if (VFuzzyComparePossibleNulls(angleF1, angleF2))
{
flagF1 = false;
ChangeColor(ui->labelEditF1, Qt::red);
ui->labelResultF1->setText(tr("Error"));
ui->labelResultF1->setToolTip(tr("Angles equal"));
flagF2 = false;
ChangeColor(ui->labelEditF2, Qt::red);
ui->labelResultF2->setText(tr("Error"));
ui->labelResultF2->setToolTip(tr("Angles equal"));
}
DialogEllipticalArc::CheckState();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FXRadius1()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius1"));
dialog->SetFormula(GetRadius1());
dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius1(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FXRadius2()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius2"));
dialog->SetFormula(GetRadius2());
dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
if (dialog->exec() == QDialog::Accepted)
{
SetRadius2(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FXF1()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first angle"));
dialog->SetFormula(GetF1());
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
SetF1(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FXF2()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second angle"));
dialog->SetFormula(GetF2());
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
SetF2(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::FXRotationAngle()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit rotation angle"));
dialog->SetFormula(GetRotationAngle());
dialog->setPostfix(degreeSymbol);
if (dialog->exec() == QDialog::Accepted)
{
SetRotationAngle(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Radius1Changed after change formula of radius1 calculate value and show result
*/
void DialogEllipticalArc::Radius1Changed()
{
labelEditFormula = ui->labelEditRadius1;
labelResultCalculation = ui->labelResultRadius1;
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
ValFormulaChanged(flagRadius1, ui->plainTextEditRadius1, timerRadius1, postfix);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Radius2Changed after change formula of radius2 calculate value and show result
*/
void DialogEllipticalArc::Radius2Changed()
{
labelEditFormula = ui->labelEditRadius2;
labelResultCalculation = ui->labelResultRadius2;
const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
ValFormulaChanged(flagRadius2, ui->plainTextEditRadius2, timerRadius2, postfix);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief F1Changed after change formula of first angle calculate value and show result
*/
void DialogEllipticalArc::F1Changed()
{
labelEditFormula = ui->labelEditF1;
labelResultCalculation = ui->labelResultF1;
ValFormulaChanged(flagF1, ui->plainTextEditF1, timerF1, degreeSymbol);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief F2Changed after change formula of second angle calculate value and show result
*/
void DialogEllipticalArc::F2Changed()
{
labelEditFormula = ui->labelEditF2;
labelResultCalculation = ui->labelResultF2;
ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2, degreeSymbol);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RotationAngleChanged after change formula of rotation angle calculate value and show result
*/
void DialogEllipticalArc::RotationAngleChanged()
{
labelEditFormula = ui->labelEditRotationAngle;
labelResultCalculation = ui->labelResultF2;
ValFormulaChanged(flagRotationAngle, ui->plainTextEditRotationAngle, timerRotationAngle, degreeSymbol);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::DeployRadius1TextEdit()
{
DeployFormula(ui->plainTextEditRadius1, ui->pushButtonGrowLengthRadius1, formulaBaseHeightRadius1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::DeployRadius2TextEdit()
{
DeployFormula(ui->plainTextEditRadius2, ui->pushButtonGrowLengthRadius2, formulaBaseHeightRadius2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::DeployF1TextEdit()
{
DeployFormula(ui->plainTextEditF1, ui->pushButtonGrowLengthF1, formulaBaseHeightF1);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::DeployF2TextEdit()
{
DeployFormula(ui->plainTextEditF2, ui->pushButtonGrowLengthF2, formulaBaseHeightF2);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::DeployRotationAngleTextEdit()
{
DeployFormula(ui->plainTextEditRotationAngle, ui->pushButtonGrowLengthRotationAngle,formulaBaseHeightRotationAngle);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
* @param id id of point or detail
* @param type type of object
*/
void DialogEllipticalArc::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
{
if (type == SceneObject::Point)
{
if (SetObject(id, ui->comboBoxBasePoint, ""))
{
vis->VisualMode(id);
prepare = true;
this->setModal(true);
this->show();
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief CheckState if all is right enable button ok
*/
void DialogEllipticalArc::CheckState()
{
SCASSERT(bOk != nullptr);
bOk->setEnabled(flagRadius1 && flagRadius2 && flagF1 && flagF2 && flagRotationAngle);
SCASSERT(bApply != nullptr);
bApply->setEnabled(flagRadius1 && flagRadius2 && flagF1 && flagF2 && flagRotationAngle);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::ShowVisualization()
{
AddVisualization<VisToolEllipticalArc>();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::SaveData()
{
radius1 = ui->plainTextEditRadius1->toPlainText();
radius1.replace("\n", " ");
radius2 = ui->plainTextEditRadius2->toPlainText();
radius2.replace("\n", " ");
f1 = ui->plainTextEditF1->toPlainText();
f1.replace("\n", " ");
f2 = ui->plainTextEditF2->toPlainText();
f2.replace("\n", " ");
rotationAngle = ui->plainTextEditRotationAngle->toPlainText();
rotationAngle.replace("\n", " ");
VisToolEllipticalArc *path = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(path != nullptr);
path->setObject1Id(GetCenter());
path->setRadius1(radius1);
path->setRadius2(radius2);
path->setF1(f1);
path->setF2(f2);
path->setRotationAngle(rotationAngle);
path->RefreshGeometry();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::closeEvent(QCloseEvent *event)
{
ui->plainTextEditRadius1->blockSignals(true);
ui->plainTextEditRadius2->blockSignals(true);
ui->plainTextEditF1->blockSignals(true);
ui->plainTextEditF2->blockSignals(true);
ui->plainTextEditRotationAngle->blockSignals(true);
DialogTool::closeEvent(event);
}

View File

@ -0,0 +1,178 @@
/************************************************************************
**
** @file dialogellipticalarc.h
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 15 9, 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 DIALOGELLIPTICALARC_H
#define DIALOGELLIPTICALARC_H
#include <qcompilerdetection.h>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "dialogtool.h"
class QCloseEvent;
class QTimer;
class QWidget;
class VContainer;
namespace Ui
{
class DialogEllipticalArc;
}
class DialogEllipticalArc : public DialogTool
{
Q_OBJECT
public:
DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
virtual ~DialogEllipticalArc() Q_DECL_OVERRIDE;
quint32 GetCenter() const;
void SetCenter(const quint32 &value);
QString GetRadius1() const;
void SetRadius1(const QString &value);
QString GetRadius2() const;
void SetRadius2(const QString &value);
QString GetF1() const;
void SetF1(const QString &value);
QString GetF2() const;
void SetF2(const QString &value);
QString GetRotationAngle() const;
void SetRotationAngle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
/**
* @brief DeployFormulaTextEdit grow or shrink formula input
*/
void DeployRadius1TextEdit();
void DeployRadius2TextEdit();
void DeployF1TextEdit();
void DeployF2TextEdit();
void DeployRotationAngleTextEdit();
void Radius1Changed();
void Radius2Changed();
void F1Changed();
void F2Changed();
void RotationAngleChanged();
void FXRadius1();
void FXRadius2();
void FXF1();
void FXF2();
void FXRotationAngle();
protected:
virtual void CheckState() Q_DECL_OVERRIDE;
virtual void ShowVisualization() Q_DECL_OVERRIDE;
/**
* @brief SaveData Put dialog data in local variables
*/
virtual void SaveData() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogEllipticalArc)
/** @brief ui keeps information about user interface */
Ui::DialogEllipticalArc *ui;
/** @brief flagRadius1 true if value of radius1 is correct */
bool flagRadius1;
/** @brief flagRadius2 true if value of radius2 is correct */
bool flagRadius2;
/** @brief flagF1 true if value of first angle is correct */
bool flagF1;
/** @brief flagF2 true if value of second angle is correct */
bool flagF2;
/** @brief flagRotationAngle true if value of rotation angle is correct */
bool flagRotationAngle;
/** @brief timerRadius1 timer of check formula of radius1 */
QTimer *timerRadius1;
/** @brief timerRadius2 timer of check formula of radius2 */
QTimer *timerRadius2;
/** @brief timerF1 timer of check formula of first angle */
QTimer *timerF1;
/** @brief timerF2 timer of check formula of second angle */
QTimer *timerF2;
/** @brief timerRotationAngle timer of check formula of rotation angle */
QTimer *timerRotationAngle;
/** @brief radius1 formula of radius1 */
QString radius1;
/** @brief radius2 formula of radius2 */
QString radius2;
/** @brief f1 formula of first angle */
QString f1;
/** @brief f2 formula of second angle */
QString f2;
/** @brief rotationAngle formula of rotation angle */
QString rotationAngle;
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeightRadius1;
int formulaBaseHeightRadius2;
int formulaBaseHeightF1;
int formulaBaseHeightF2;
int formulaBaseHeightRotationAngle;
qreal angleF1;
qreal angleF2;
qreal angleRotation;
void EvalRadiuses();
void EvalAngles();
void CheckAngles();
};
#endif // DIALOGELLIPTICALARC_H

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,7 @@
#include "toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h" #include "toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
#include "toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h" #include "toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
#include "toolcurve/vtoolarc.h" #include "toolcurve/vtoolarc.h"
#include "toolcurve/vtoolellipticalarc.h"
#include "toolcurve/vtoolarcwithlength.h" #include "toolcurve/vtoolarcwithlength.h"
#include "toolcurve/vtoolspline.h" #include "toolcurve/vtoolspline.h"
#include "toolcurve/vtoolcubicbezier.h" #include "toolcurve/vtoolcubicbezier.h"

View File

@ -0,0 +1,470 @@
/************************************************************************
**
** @file vtoolellipticalarc.cpp
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 20 10, 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 "vtoolellipticalarc.h"
#include <QPen>
#include <QSharedPointer>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include <Qt>
#include <new>
#include "../../../dialogs/tools/dialogtool.h"
#include "../../../dialogs/tools/dialogellipticalarc.h"
#include "../../../visualization/path/vistoolellipticalarc.h"
#include "../../../visualization/visualization.h"
#include "../ifc/exception/vexception.h"
#include "../ifc/xml/vdomdocument.h"
#include "../ifc/ifcdef.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vgobject.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vcommonsettings.h"
#include "../vpatterndb/vcontainer.h"
#include "../vpatterndb/vformula.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../../vabstracttool.h"
#include "../vdrawtool.h"
#include "vabstractspline.h"
class QDomElement;
class QGraphicsSceneContextMenuEvent;
const QString VToolEllipticalArc::ToolType = QStringLiteral("simple");
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VToolEllipticalArc constuctor.
* @param doc dom document container
* @param data container with variables
* @param id object id in container
* @param typeCreation way we create this tool.
* @param parent parent object
*/
VToolEllipticalArc::VToolEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::Arc;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
ToolCreation(typeCreation);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setDialog set dialog when user want change tool option.
*/
void VToolEllipticalArc::setDialog()
{
SCASSERT(dialog != nullptr);
DialogEllipticalArc *dialogTool = qobject_cast<DialogEllipticalArc*>(dialog);
SCASSERT(dialogTool != nullptr);
const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
dialogTool->SetCenter(elArc->GetCenter().id());
dialogTool->SetF1(elArc->GetFormulaF1());
dialogTool->SetF2(elArc->GetFormulaF2());
dialogTool->SetRadius1(elArc->GetFormulaRadius1());
dialogTool->SetRadius2(elArc->GetFormulaRadius2());
dialogTool->SetRotationAngle(elArc->GetFormulaRotationAngle());
dialogTool->SetColor(elArc->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool
* @param dialog dialog options.
* @param scene pointer to scene.
* @param doc dom document container
* @param data container with variables
*/
VToolEllipticalArc* VToolEllipticalArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data)
{
SCASSERT(dialog != nullptr);
DialogEllipticalArc *dialogTool = qobject_cast<DialogEllipticalArc*>(dialog);
SCASSERT(dialogTool != nullptr);
const quint32 center = dialogTool->GetCenter();
QString radius1 = dialogTool->GetRadius1();
QString radius2 = dialogTool->GetRadius2();
QString f1 = dialogTool->GetF1();
QString f2 = dialogTool->GetF2();
QString rotationAngle = dialogTool->GetRotationAngle();
const QString color = dialogTool->GetColor();
VToolEllipticalArc* point = Create(0, center, radius1, radius2, f1, f2, rotationAngle, color, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
}
return point;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool form GUI.
* @param _id tool id, 0 if tool doesn't exist yet.
* @param center id elliptical arc center point.
* @param radius1 elliptical arc radius1.
* @param radius2 elliptical arc radius2.
* @param f1 start angle of elliptical arc.
* @param f2 end angle of elliptical arc.
* @param rotationAngle rotation angle of elliptical arc.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolEllipticalArc* VToolEllipticalArc::Create(const quint32 _id, const quint32 &center, QString &radius1,
QString &radius2, QString &f1, QString &f2, QString &rotationAngle,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
qreal calcRadius1 = 0, calcRadius2 = 0, calcF1 = 0, calcF2 = 0, calcRotationAngle = 0;
calcRadius1 = qApp->toPixel(CheckFormula(_id, radius1, data));
calcRadius2 = qApp->toPixel(CheckFormula(_id, radius2, data));
calcF1 = CheckFormula(_id, f1, data);
calcF2 = CheckFormula(_id, f2, data);
calcRotationAngle = CheckFormula(_id, rotationAngle, data);
const VPointF c = *data->GeometricObject<VPointF>(center);
VEllipticalArc *elArc = new VEllipticalArc(c, calcRadius1, calcRadius2, radius1, radius2, calcF1, f1, calcF2, f2,
calcRotationAngle, rotationAngle);
elArc->SetColor(color);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(elArc);
data->AddEllipticalArc(data->GeometricObject<VEllipticalArc>(id), id);
}
else
{
data->UpdateGObject(id, elArc);
data->AddEllipticalArc(data->GeometricObject<VEllipticalArc>(id), id);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);
}
}
VDrawTool::AddRecord(id, Tool::EllipticalArc, doc);
if (parse == Document::FullParse)
{
VToolEllipticalArc *toolEllipticalArc = new VToolEllipticalArc(doc, data, id, typeCreation);
scene->addItem(toolEllipticalArc);
InitArcToolConnections(scene, toolEllipticalArc);
doc->AddTool(id, toolEllipticalArc);
doc->IncrementReferens(c.getIdTool());
return toolEllipticalArc;
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VToolEllipticalArc::getTagName() const
{
return VAbstractPattern::TagElArc;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VToolEllipticalArc::getCenter() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
SCASSERT(elArc.isNull() == false);
return elArc->GetCenter().id();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::setCenter(const quint32 &value)
{
if (value != NULL_ID)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(value);
elArc->SetCenter(*point.data());
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolEllipticalArc::GetFormulaRadius1() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
SCASSERT(elArc.isNull() == false);
VFormula radius1(elArc->GetFormulaRadius1(), getData());
radius1.setCheckZero(true);
radius1.setToolId(id);
radius1.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
return radius1;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value)
{
if (value.error() == false)
{
if (value.getDoubleValue() > 0)// Formula don't check this, but radius1 can't be 0 or negative
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
elArc->SetFormulaRadius1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolEllipticalArc::GetFormulaRadius2() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
SCASSERT(elArc.isNull() == false);
VFormula radius2(elArc->GetFormulaRadius2(), getData());
radius2.setCheckZero(true);
radius2.setToolId(id);
radius2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
return radius2;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value)
{
if (value.error() == false)
{
if (value.getDoubleValue() > 0)// Formula don't check this, but radius2 can't be 0 or negative
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
elArc->SetFormulaRadius2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolEllipticalArc::GetFormulaF1() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
SCASSERT(elArc.isNull() == false);
VFormula f1(elArc->GetFormulaF1(), getData());
f1.setCheckZero(false);
f1.setToolId(id);
f1.setPostfix(degreeSymbol);
return f1;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SetFormulaF1(const VFormula &value)
{
if (value.error() == false)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), elArc->GetEndAngle()))// Angles can't be equal
{
elArc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolEllipticalArc::GetFormulaF2() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
SCASSERT(elArc.isNull() == false);
VFormula f2(elArc->GetFormulaF2(), getData());
f2.setCheckZero(false);
f2.setToolId(id);
f2.setPostfix(degreeSymbol);
return f2;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SetFormulaF2(const VFormula &value)
{
if (value.error() == false)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), elArc->GetStartAngle()))// Angles can't be equal
{
elArc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VFormula VToolEllipticalArc::GetFormulaRotationAngle() const
{
QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
SCASSERT(elArc.isNull() == false);
VFormula rotationAngle(elArc->GetFormulaRotationAngle(), getData());
rotationAngle.setCheckZero(false);
rotationAngle.setToolId(id);
rotationAngle.setPostfix(degreeSymbol);
return rotationAngle;
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SetFormulaRotationAngle(const VFormula &value)
{
if (value.error() == false)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
elArc->SetFormulaRotationAngle(value.GetFormula(FormulaType::FromUser), value.getDoubleValue());
SaveOption(obj);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::ShowVisualization(bool show)
{
ShowToolVisualization<VisToolEllipticalArc>(show);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief contextMenuEvent handle context menu events.
* @param event context menu event.
*/
void VToolEllipticalArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogEllipticalArc>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RemoveReferens decrement value of reference.
*/
void VToolEllipticalArc::RemoveReferens()
{
const auto elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
doc->DecrementReferens(elArc->GetCenter().getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SaveDialog save options into file after change in dialog.
*/
void VToolEllipticalArc::SaveDialog(QDomElement &domElement)
{
SCASSERT(dialog != nullptr);
DialogEllipticalArc *dialogTool = qobject_cast<DialogEllipticalArc*>(dialog);
SCASSERT(dialogTool != nullptr);
doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter()));
doc->SetAttribute(domElement, AttrRadius1, dialogTool->GetRadius1());
doc->SetAttribute(domElement, AttrRadius2, dialogTool->GetRadius2());
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
doc->SetAttribute(domElement, AttrRotationAngle, dialogTool->GetRotationAngle());
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
{
VAbstractSpline::SaveOptions(tag, obj);
QSharedPointer<VEllipticalArc> elArc = qSharedPointerDynamicCast<VEllipticalArc>(obj);
SCASSERT(elArc.isNull() == false);
doc->SetAttribute(tag, AttrType, ToolType);
doc->SetAttribute(tag, AttrCenter, elArc->GetCenter().id());
doc->SetAttribute(tag, AttrRadius1, elArc->GetFormulaRadius1());
doc->SetAttribute(tag, AttrRadius2, elArc->GetFormulaRadius2());
doc->SetAttribute(tag, AttrAngle1, elArc->GetFormulaF1());
doc->SetAttribute(tag, AttrAngle2, elArc->GetFormulaF2());
doc->SetAttribute(tag, AttrRotationAngle, elArc->GetFormulaRotationAngle());
}
//---------------------------------------------------------------------------------------------------------------------
void VToolEllipticalArc::SetVisualization()
{
if (not vis.isNull())
{
const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
VisToolEllipticalArc *visual = qobject_cast<VisToolEllipticalArc *>(vis);
SCASSERT(visual != nullptr);
const VTranslateVars *trVars = qApp->TrVars();
visual->setObject1Id(elArc->GetCenter().id());
visual->setRadius1(trVars->FormulaToUser(elArc->GetFormulaRadius1(), qApp->Settings()->GetOsSeparator()));
visual->setRadius2(trVars->FormulaToUser(elArc->GetFormulaRadius2(), qApp->Settings()->GetOsSeparator()));
visual->setF1(trVars->FormulaToUser(elArc->GetFormulaF1(), qApp->Settings()->GetOsSeparator()));
visual->setF2(trVars->FormulaToUser(elArc->GetFormulaF2(), qApp->Settings()->GetOsSeparator()));
visual->setRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(),
qApp->Settings()->GetOsSeparator()));
visual->RefreshGeometry();
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolEllipticalArc::RefreshGeometry()
{
const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
this->setPen(QPen(CorrectColor(elArc->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());
SetVisualization();
}

View File

@ -0,0 +1,105 @@
/************************************************************************
**
** @file vtoolellipticalarc.h
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 20 10, 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 VTOOLELLIPTICALARC_H
#define VTOOLELLIPTICALARC_H
#include <qcompilerdetection.h>
#include <QGraphicsItem>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/def.h"
#include "vabstractspline.h"
class DialogTool;
class QDomElement;
class QGraphicsSceneContextMenuEvent;
class VContainer;
class VFormula;
class VGObject;
class VMainGraphicsScene;
template <class T> class QSharedPointer;
/**
* @brief The VToolEllipticalArc class tool for creation elliptical arc.
*/
class VToolEllipticalArc : public VAbstractSpline
{
Q_OBJECT
public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolEllipticalArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolEllipticalArc* Create(const quint32 _id, const quint32 &center, QString &radius1, QString &radius2, QString &f1, QString &f2, QString &rotationAngle,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::EllipticalArc)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
quint32 getCenter() const;
void setCenter(const quint32 &value);
VFormula GetFormulaRadius1() const;
void SetFormulaRadius1(const VFormula &value);
VFormula GetFormulaRadius2() const;
void SetFormulaRadius2(const VFormula &value);
VFormula GetFormulaF1() const;
void SetFormulaF1(const VFormula &value);
VFormula GetFormulaF2() const;
void SetFormulaF2(const VFormula &value);
VFormula GetFormulaRotationAngle() const;
void SetFormulaRotationAngle(const VFormula &value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
virtual void RemoveReferens() Q_DECL_OVERRIDE;
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolEllipticalArc)
VToolEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
};
#endif // VTOOLELLIPTICALARC_H

View File

@ -1,115 +1,117 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!! # ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro # This need for corect working file translations.pro
HEADERS += \ HEADERS += \
$$PWD/vtooldetail.h \ $$PWD/vtooldetail.h \
$$PWD/vdatatool.h \ $$PWD/vdatatool.h \
$$PWD/vabstracttool.h \ $$PWD/vabstracttool.h \
$$PWD/tools.h \ $$PWD/tools.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h \
$$PWD/drawTools/toolcurve/vtoolsplinepath.h \ $$PWD/drawTools/toolcurve/vtoolsplinepath.h \
$$PWD/drawTools/toolcurve/vtoolspline.h \ $$PWD/drawTools/toolcurve/vtoolspline.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h \
$$PWD/drawTools/vtoolline.h \ $$PWD/drawTools/vtoolline.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h \
$$PWD/drawTools/toolcurve/vtoolarc.h \ $$PWD/drawTools/toolcurve/vtoolarc.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h \
$$PWD/drawTools/vdrawtool.h \ $$PWD/drawTools/vdrawtool.h \
$$PWD/drawTools/drawtools.h \ $$PWD/drawTools/drawtools.h \
$$PWD/nodeDetails/vnodesplinepath.h \ $$PWD/nodeDetails/vnodesplinepath.h \
$$PWD/nodeDetails/vnodespline.h \ $$PWD/nodeDetails/vnodespline.h \
$$PWD/nodeDetails/vnodepoint.h \ $$PWD/nodeDetails/vnodepoint.h \
$$PWD/nodeDetails/vnodearc.h \ $$PWD/nodeDetails/vnodearc.h \
$$PWD/nodeDetails/vabstractnode.h \ $$PWD/nodeDetails/vabstractnode.h \
$$PWD/nodeDetails/nodedetails.h \ $$PWD/nodeDetails/nodedetails.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h \
$$PWD/vtooluniondetails.h \ $$PWD/vtooluniondetails.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h \
$$PWD/drawTools/toolcurve/vabstractspline.h \ $$PWD/drawTools/toolcurve/vabstractspline.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h \
$$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \
$$PWD/drawTools/toolpoint/vabstractpoint.h \ $$PWD/drawTools/toolpoint/vabstractpoint.h \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h \
$$PWD/drawTools/toolcurve/vtoolcubicbezier.h \ $$PWD/drawTools/toolcurve/vtoolcubicbezier.h \
$$PWD/drawTools/toolcurve/vtoolcubicbezierpath.h \ $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.h \
$$PWD/drawTools/operation/vtoolrotation.h \ $$PWD/drawTools/operation/vtoolrotation.h \
$$PWD/vtextgraphicsitem.h \ $$PWD/vtextgraphicsitem.h \
$$PWD/vgrainlineitem.h \ $$PWD/vgrainlineitem.h \
$$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \ $$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \
$$PWD/drawTools/operation/vabstractoperation.h \ $$PWD/drawTools/operation/vabstractoperation.h \
$$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \ $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \
$$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
SOURCES += \
$$PWD/vtooldetail.cpp \ SOURCES += \
$$PWD/vdatatool.cpp \ $$PWD/vtooldetail.cpp \
$$PWD/vabstracttool.cpp \ $$PWD/vdatatool.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ $$PWD/vabstracttool.cpp \
$$PWD/drawTools/toolcurve/vtoolsplinepath.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \
$$PWD/drawTools/toolcurve/vtoolspline.cpp \ $$PWD/drawTools/toolcurve/vtoolsplinepath.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp \ $$PWD/drawTools/toolcurve/vtoolspline.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp \
$$PWD/drawTools/vtoolline.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp \ $$PWD/drawTools/vtoolline.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp \
$$PWD/drawTools/toolcurve/vtoolarc.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp \ $$PWD/drawTools/toolcurve/vtoolarc.cpp \
$$PWD/drawTools/vdrawtool.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp \
$$PWD/nodeDetails/vnodesplinepath.cpp \ $$PWD/drawTools/vdrawtool.cpp \
$$PWD/nodeDetails/vnodespline.cpp \ $$PWD/nodeDetails/vnodesplinepath.cpp \
$$PWD/nodeDetails/vnodepoint.cpp \ $$PWD/nodeDetails/vnodespline.cpp \
$$PWD/nodeDetails/vnodearc.cpp \ $$PWD/nodeDetails/vnodepoint.cpp \
$$PWD/nodeDetails/vabstractnode.cpp \ $$PWD/nodeDetails/vnodearc.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp \ $$PWD/nodeDetails/vabstractnode.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp \
$$PWD/vtooluniondetails.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp \ $$PWD/vtooluniondetails.cpp \
$$PWD/drawTools/toolcurve/vabstractspline.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp \ $$PWD/drawTools/toolcurve/vabstractspline.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp \
$$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp \
$$PWD/drawTools/toolpoint/vabstractpoint.cpp \ $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ $$PWD/drawTools/toolpoint/vabstractpoint.cpp \
$$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp \ $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \
$$PWD/drawTools/toolcurve/vtoolcubicbezier.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp \
$$PWD/drawTools/toolcurve/vtoolcubicbezierpath.cpp \ $$PWD/drawTools/toolcurve/vtoolcubicbezier.cpp \
$$PWD/drawTools/operation/vtoolrotation.cpp \ $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.cpp \
$$PWD/vtextgraphicsitem.cpp \ $$PWD/drawTools/operation/vtoolrotation.cpp \
$$PWD/vgrainlineitem.cpp \ $$PWD/vtextgraphicsitem.cpp \
$$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \ $$PWD/vgrainlineitem.cpp \
$$PWD/drawTools/operation/vabstractoperation.cpp \ $$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \
$$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \ $$PWD/drawTools/operation/vabstractoperation.cpp \
$$PWD/drawTools/operation/flipping/vabstractflipping.cpp \ $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \
$$PWD/drawTools/operation/vtoolmove.cpp $$PWD/drawTools/operation/flipping/vabstractflipping.cpp \
$$PWD/drawTools/operation/vtoolmove.cpp \
$$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp

View File

@ -0,0 +1,98 @@
/************************************************************************
**
** @file vistoolellipticalarc.cpp
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 24 10, 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 "vistoolellipticalarc.h"
#include <QPainterPath>
#include <QPointF>
#include <QSharedPointer>
#include <Qt>
#include <new>
#include "../ifc/ifcdef.h"
#include "../vgeometry/vabstractcurve.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "../visualization.h"
#include "vispath.h"
VisToolEllipticalArc::VisToolEllipticalArc(const VContainer *data, QGraphicsItem *parent)
:VisPath(data, parent), arcCenter(nullptr), radius1(0), radius2(0), f1(0), f2(0), rotationAngle(0)
{
arcCenter = InitPoint(mainColor, this);
}
//---------------------------------------------------------------------------------------------------------------------
VisToolEllipticalArc::~VisToolEllipticalArc()
{}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEllipticalArc::RefreshGeometry()
{
if (object1Id > NULL_ID)
{
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
DrawPoint(arcCenter, *first, supportColor);
if (not qFuzzyIsNull(radius1) && not qFuzzyIsNull(radius2) && f1 >= 0 && f2 >= 0 && rotationAngle >= 0
&& not VFuzzyComparePossibleNulls(f1, f2))
{
VEllipticalArc elArc = VEllipticalArc(*first, radius1, radius2, f1, f2, rotationAngle);
DrawPath(this, elArc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEllipticalArc::setRadius1(const QString &expression)
{
radius1 = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEllipticalArc::setRadius2(const QString &expression)
{
radius2 = FindLength(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEllipticalArc::setF1(const QString &expression)
{
f1 = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEllipticalArc::setF2(const QString &expression)
{
f2 = FindVal(expression, Visualization::data->PlainVariables());
}
//---------------------------------------------------------------------------------------------------------------------
void VisToolEllipticalArc::setRotationAngle(const QString &expression)
{
rotationAngle = FindVal(expression, Visualization::data->PlainVariables());
}

View File

@ -0,0 +1,69 @@
/************************************************************************
**
** @file vistoolellipticalarc.h
** @author Valentina Zhuravska <zhuravska19(at)gmail.com>
** @date 24 10, 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 VISTOOLELLIPTICALARC_H
#define VISTOOLELLIPTICALARC_H
#include <qcompilerdetection.h>
#include <QGraphicsItem>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../vmisc/def.h"
#include "vispath.h"
class VContainer;
class VisToolEllipticalArc : public VisPath
{
Q_OBJECT
public:
explicit VisToolEllipticalArc(const VContainer *data, QGraphicsItem *parent = 0);
virtual ~VisToolEllipticalArc() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
void setRadius1(const QString &expression);
void setRadius2(const QString &expression);
void setF1(const QString &expression);
void setF2(const QString &expression);
void setRotationAngle(const QString &expression);
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolEllipticalArc)};
private:
Q_DISABLE_COPY(VisToolEllipticalArc)
QGraphicsEllipseItem *arcCenter;
qreal radius1;
qreal radius2;
qreal f1;
qreal f2;
qreal rotationAngle;
};
#endif // VISTOOLELLIPTICALARC_H

View File

@ -1,78 +1,80 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!! # ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro # This need for corect working file translations.pro
HEADERS += \ HEADERS += \
$$PWD/visualization.h \ $$PWD/visualization.h \
$$PWD/line/visline.h \ $$PWD/line/visline.h \
$$PWD/line/vistoolline.h \ $$PWD/line/vistoolline.h \
$$PWD/line/vistoolendline.h \ $$PWD/line/vistoolendline.h \
$$PWD/line/vistoolalongline.h \ $$PWD/line/vistoolalongline.h \
$$PWD/line/vistoolbisector.h \ $$PWD/line/vistoolbisector.h \
$$PWD/line/vistoolshoulderpoint.h \ $$PWD/line/vistoolshoulderpoint.h \
$$PWD/line/vistoolnormal.h \ $$PWD/line/vistoolnormal.h \
$$PWD/line/vistoolheight.h \ $$PWD/line/vistoolheight.h \
$$PWD/line/vistoolpointofintersection.h \ $$PWD/line/vistoolpointofintersection.h \
$$PWD/line/vistooltriangle.h \ $$PWD/line/vistooltriangle.h \
$$PWD/line/vistoolpointofcontact.h \ $$PWD/line/vistoolpointofcontact.h \
$$PWD/line/vistoollineintersect.h \ $$PWD/line/vistoollineintersect.h \
$$PWD/line/vistoollineintersectaxis.h \ $$PWD/line/vistoollineintersectaxis.h \
$$PWD/line/vistooltruedarts.h \ $$PWD/line/vistooltruedarts.h \
$$PWD/line/vistoolcurveintersectaxis.h \ $$PWD/line/vistoolcurveintersectaxis.h \
$$PWD/line/vistoolpointofintersectionarcs.h \ $$PWD/line/vistoolpointofintersectionarcs.h \
$$PWD/line/vistoolpointofintersectioncircles.h \ $$PWD/line/vistoolpointofintersectioncircles.h \
$$PWD/line/vistoolpointfromcircleandtangent.h \ $$PWD/line/vistoolpointfromcircleandtangent.h \
$$PWD/line/vistoolpointfromarcandtangent.h \ $$PWD/line/vistoolpointfromarcandtangent.h \
$$PWD/line/operation/vistoolrotation.h \ $$PWD/line/operation/vistoolrotation.h \
$$PWD/line/operation/vistoolflippingbyline.h \ $$PWD/line/operation/vistoolflippingbyline.h \
$$PWD/path/vispath.h \ $$PWD/path/vispath.h \
$$PWD/path/vistoolarc.h \ $$PWD/path/vistoolarc.h \
$$PWD/path/vistoolcutarc.h \ $$PWD/path/vistoolcutarc.h \
$$PWD/path/vistoolspline.h \ $$PWD/path/vistoolspline.h \
$$PWD/path/vistoolcutspline.h \ $$PWD/path/vistoolcutspline.h \
$$PWD/path/vistoolsplinepath.h \ $$PWD/path/vistoolsplinepath.h \
$$PWD/path/vistoolcutsplinepath.h \ $$PWD/path/vistoolcutsplinepath.h \
$$PWD/path/vistoolarcwithlength.h \ $$PWD/path/vistoolarcwithlength.h \
$$PWD/path/vistoolpointofintersectioncurves.h \ $$PWD/path/vistoolpointofintersectioncurves.h \
$$PWD/path/vistoolcubicbezier.h \ $$PWD/path/vistoolcubicbezier.h \
$$PWD/path/vistoolcubicbezierpath.h \ $$PWD/path/vistoolcubicbezierpath.h \
$$PWD/line/operation/visoperation.h \ $$PWD/line/operation/visoperation.h \
$$PWD/line/operation/vistoolflippingbyaxis.h \ $$PWD/line/operation/vistoolflippingbyaxis.h \
$$PWD/line/operation/vistoolmove.h $$PWD/line/operation/vistoolmove.h \
$$PWD/path/vistoolellipticalarc.h
SOURCES += \
$$PWD/visualization.cpp \ SOURCES += \
$$PWD/line/visline.cpp \ $$PWD/visualization.cpp \
$$PWD/line/vistoolline.cpp \ $$PWD/line/visline.cpp \
$$PWD/line/vistoolendline.cpp \ $$PWD/line/vistoolline.cpp \
$$PWD/line/vistoolalongline.cpp \ $$PWD/line/vistoolendline.cpp \
$$PWD/line/vistoolbisector.cpp \ $$PWD/line/vistoolalongline.cpp \
$$PWD/line/vistoolshoulderpoint.cpp \ $$PWD/line/vistoolbisector.cpp \
$$PWD/line/vistoolnormal.cpp \ $$PWD/line/vistoolshoulderpoint.cpp \
$$PWD/line/vistoolheight.cpp \ $$PWD/line/vistoolnormal.cpp \
$$PWD/line/vistoolpointofintersection.cpp \ $$PWD/line/vistoolheight.cpp \
$$PWD/line/vistooltriangle.cpp \ $$PWD/line/vistoolpointofintersection.cpp \
$$PWD/line/vistoolpointofcontact.cpp \ $$PWD/line/vistooltriangle.cpp \
$$PWD/line/vistoollineintersect.cpp \ $$PWD/line/vistoolpointofcontact.cpp \
$$PWD/line/vistoollineintersectaxis.cpp \ $$PWD/line/vistoollineintersect.cpp \
$$PWD/line/vistooltruedarts.cpp \ $$PWD/line/vistoollineintersectaxis.cpp \
$$PWD/line/vistoolcurveintersectaxis.cpp \ $$PWD/line/vistooltruedarts.cpp \
$$PWD/line/vistoolpointofintersectionarcs.cpp \ $$PWD/line/vistoolcurveintersectaxis.cpp \
$$PWD/line/vistoolpointofintersectioncircles.cpp \ $$PWD/line/vistoolpointofintersectionarcs.cpp \
$$PWD/line/vistoolpointfromcircleandtangent.cpp \ $$PWD/line/vistoolpointofintersectioncircles.cpp \
$$PWD/line/vistoolpointfromarcandtangent.cpp \ $$PWD/line/vistoolpointfromcircleandtangent.cpp \
$$PWD/line/operation/vistoolrotation.cpp \ $$PWD/line/vistoolpointfromarcandtangent.cpp \
$$PWD/line/operation/vistoolflippingbyline.cpp \ $$PWD/line/operation/vistoolrotation.cpp \
$$PWD/path/vispath.cpp \ $$PWD/line/operation/vistoolflippingbyline.cpp \
$$PWD/path/vistoolarc.cpp \ $$PWD/path/vispath.cpp \
$$PWD/path/vistoolcutarc.cpp \ $$PWD/path/vistoolarc.cpp \
$$PWD/path/vistoolspline.cpp \ $$PWD/path/vistoolcutarc.cpp \
$$PWD/path/vistoolcutspline.cpp \ $$PWD/path/vistoolspline.cpp \
$$PWD/path/vistoolsplinepath.cpp \ $$PWD/path/vistoolcutspline.cpp \
$$PWD/path/vistoolcutsplinepath.cpp \ $$PWD/path/vistoolsplinepath.cpp \
$$PWD/path/vistoolarcwithlength.cpp \ $$PWD/path/vistoolcutsplinepath.cpp \
$$PWD/path/vistoolpointofintersectioncurves.cpp \ $$PWD/path/vistoolarcwithlength.cpp \
$$PWD/path/vistoolcubicbezier.cpp \ $$PWD/path/vistoolpointofintersectioncurves.cpp \
$$PWD/path/vistoolcubicbezierpath.cpp \ $$PWD/path/vistoolcubicbezier.cpp \
$$PWD/line/operation/visoperation.cpp \ $$PWD/path/vistoolcubicbezierpath.cpp \
$$PWD/line/operation/vistoolflippingbyaxis.cpp \ $$PWD/line/operation/visoperation.cpp \
$$PWD/line/operation/vistoolmove.cpp $$PWD/line/operation/vistoolflippingbyaxis.cpp \
$$PWD/line/operation/vistoolmove.cpp \
$$PWD/path/vistoolellipticalarc.cpp