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)
{
// 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())
{
@ -196,6 +196,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
case VToolMove::Type:
ShowOptionsToolMove(item);
break;
case VToolEllipticalArc::Type:
ShowOptionsToolEllipticalArc(item);
break;
default:
break;
}
@ -210,7 +213,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
}
// 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())
{
@ -354,7 +357,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
}
// 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())
{
@ -2148,6 +2151,21 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolFlippingByAxis(QGraphicsItem *i
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()
{
@ -2680,6 +2698,9 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< AttrLength1 /* 36 */
<< AttrLength2 /* 37 */
<< AttrSuffix /* 38 */
<< AttrAxisType; /* 39 */
<< AttrAxisType /* 39 */
<< AttrRadius1 /* 40 */
<< AttrRadius2 /* 41 */
<< AttrRotationAngle; /* 42 */
return attr;
}

View File

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

View File

@ -29,6 +29,7 @@
#include "dialoghistory.h"
#include "ui_dialoghistory.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vsplinepath.h"
#include "../vgeometry/vcubicbezierpath.h"
@ -208,7 +209,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
QString DialogHistory::Record(const VToolRecord &tool)
{
// 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());
if (domElem.isElement() == false)
@ -378,6 +379,12 @@ QString DialogHistory::Record(const VToolRecord &tool)
.arg(PointName(AttrUInt(domElem, AttrDartP1)))
.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
//piece, we need add record about details and nodes, but don't show them.
case Tool::Detail:

View File

@ -874,6 +874,20 @@ void MainWindow::ToolArc(bool checked)
&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.
@ -1698,6 +1712,7 @@ void MainWindow::InitToolButtons()
toolButtonPointerList.append(ui->toolButtonPointerArc);
toolButtonPointerList.append(ui->toolButtonPointerDetail);
toolButtonPointerList.append(ui->toolButtonPointerOperations);
toolButtonPointerList.append(ui->toolButtonPointerEllipticalArc);
for (auto pointer : toolButtonPointerList)
{
@ -1746,6 +1761,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove);
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
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()
{
// 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.");
delete dialogTool;
@ -1922,6 +1938,9 @@ void MainWindow::CancelTool()
case Tool::Move:
ui->toolButtonMove->setChecked(false);
break;
case Tool::EllipticalArc:
ui->toolButtonEllipticalArc->setChecked(false);
break;
}
// Crash: using CRTL+Z while using line tool.
@ -2972,7 +2991,7 @@ void MainWindow::SetEnableTool(bool enable)
}
// 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
ui->toolButtonEndLine->setEnabled(drawTools);
@ -3011,6 +3030,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonFlippingByAxis->setEnabled(drawTools);
ui->toolButtonMove->setEnabled(drawTools);
ui->toolButtonMidpoint->setEnabled(drawTools);
ui->toolButtonEllipticalArc->setEnabled(drawTools);
ui->actionLast_tool->setEnabled(drawTools);
@ -3292,7 +3312,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void MainWindow::LastUsedTool()
{
// 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)
{
@ -3470,6 +3490,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonMove->setChecked(true);
ToolMove(true);
break;
case Tool::EllipticalArc:
ui->toolButtonEllipticalArc->setChecked(true);
ToolEllipticalArc(true);
break;
}
}

View File

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

View File

@ -1058,6 +1058,86 @@
</item>
</layout>
</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">
<property name="geometry">
<rect>

View File

@ -76,5 +76,7 @@
<file>cursor/flipping_axis_cursor@2x.png</file>
<file>cursor/move_cursor.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>
</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/move.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>
</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;
}
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 qint32 num = nodeList.size();
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.");
ParseOperationElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
break;
case 6: // TagElArc
qCDebug(vXML, "Tag elliptical arc.");
ParseEllipticalArcElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
break;
default:
VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
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)
{
@ -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.
@ -3442,7 +3527,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
QRectF VPattern::ActiveDrawBoundingRect() const
{
// 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;
@ -3563,6 +3648,8 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::Move:
rec = ToolBoundingRect<VToolMove>(rec, tool.getId());
break;
case Tool::EllipticalArc:
rec = ToolBoundingRect<VToolEllipticalArc>(rec, tool.getId());
//These tools are not accesseble in Draw mode, but still 'history' contains them.
case Tool::Detail:
case Tool::UnionDetails:

View File

@ -125,6 +125,8 @@ private:
const Document &parse, const QString& type);
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
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,
const Document &parse, const QString& type);
void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
@ -193,6 +195,8 @@ private:
void ParseNodeArc(const 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 ParseToolFlippingByLine(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 AttrCenter = QStringLiteral("center");
const QString AttrRadius = QStringLiteral("radius");
const QString AttrRadius1 = QStringLiteral("radius1");
const QString AttrRadius2 = QStringLiteral("radius2");
const QString AttrAngle = QStringLiteral("angle");
const QString AttrAngle1 = QStringLiteral("angle1");
const QString AttrAngle2 = QStringLiteral("angle2");
@ -136,6 +138,7 @@ const QString AttrArc = QStringLiteral("arc");
const QString AttrSuffix = QStringLiteral("suffix");
const QString AttrIdObject = QStringLiteral("idObject");
const QString AttrInLayout = QStringLiteral("inLayout");
const QString AttrRotationAngle = QStringLiteral("rotationAngle");
const QString TypeLineNone = QStringLiteral("none");
const QString TypeLineLine = QStringLiteral("hair");

View File

@ -91,9 +91,12 @@ extern const QString AttrSecondPoint;
extern const QString AttrThirdPoint;
extern const QString AttrCenter;
extern const QString AttrRadius;
extern const QString AttrRadius1;
extern const QString AttrRadius2;
extern const QString AttrAngle;
extern const QString AttrAngle1;
extern const QString AttrAngle2;
extern const QString AttrRotationAngle;
extern const QString AttrLength1;
extern const QString AttrLength2;
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.2.xsd</file>
<file>schema/individual_measurements/v0.3.3.xsd</file>
<file>schema/pattern/v0.3.9.xsd</file>
</qresource>
</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::TagSpline = QStringLiteral("spline");
const QString VAbstractPattern::TagArc = QStringLiteral("arc");
const QString VAbstractPattern::TagElArc = QStringLiteral("elArc");
const QString VAbstractPattern::TagTools = QStringLiteral("tools");
const QString VAbstractPattern::TagOperation = QStringLiteral("operation");
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.
// 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;
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.
// 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;
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.
// 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;
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.
// 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;
const QDomNodeList list = elementsByTagName(TagOperation);

View File

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

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.8");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.8.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.9");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.9.xsd");
//VPatternConverter::PatternMinVer; // <== 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,
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),
d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle))
d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle))
{
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,
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),
d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle))
d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle))
{
CreateName();
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
arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2,
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
// and it has endAngle just like endAngle of the origin arc
arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2,
arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle,
getIdObject(), getMode());
GetFormulaRotationAngle(), getIdObject(), getMode());
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.
*/
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.
*/
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.
*/
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;
}
//---------------------------------------------------------------------------------------------------------------------
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.
*/
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.
*/
qreal VEllipticalArc::GetRadius2() const
{
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 (const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1,
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 (qreal length, const QString &formulaLength, const VPointF &center, qreal radius1, qreal radius2,
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(const VEllipticalArc &arc);
@ -68,6 +69,8 @@ public:
virtual ~VEllipticalArc() Q_DECL_OVERRIDE;
QString GetFormulaRotationAngle () const;
void SetFormulaRotationAngle (const QString &formula, qreal value);
qreal GetRotationAngle() const;
QString GetFormulaRadius1 () const;

View File

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

View File

@ -115,6 +115,7 @@ enum class Tool : ToolVisHolderType
FlippingByAxis,
Move,
Midpoint,
EllipticalArc,
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,
ToolFlippingByLine,
ToolFlippingByAxis,
ToolMove
ToolMove,
ToolEllipticalArc
};
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/forbid_detail.png</file>
<file>icon/16x16/forbid_detail@2x.png</file>
<file>icon/16x16/toolsectionelarc.png</file>
<file>icon/16x16/toolsectionelarc@2x.png</file>
</qresource>
</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/vspline.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/logging.h"
#include "../vmisc/vabstractapplication.h"
#include "variables/varcradius.h"
#include "variables/vellipticalarcradius.h"
#include "variables/vcurveangle.h"
#include "variables/vcurvelength.h"
#include "variables/vcurveclength.h"
@ -388,13 +390,25 @@ void VContainer::AddArc(const QSharedPointer<VArc> &arc, const quint32 &id, cons
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)
{
const GOType curveType = curve->getType();
if (curveType != GOType::Spline && curveType != GOType::SplinePath &&
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)));
}

View File

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

View File

@ -21,7 +21,8 @@ SOURCES += \
$$PWD/vpatternpiecedata.cpp \
$$PWD/vpatterninfogeometry.cpp \
$$PWD/vgrainlinegeometry.cpp \
$$PWD/variables/vcurveclength.cpp
$$PWD/variables/vcurveclength.cpp \
$$PWD/variables/vellipticalarcradius.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp
@ -57,4 +58,5 @@ HEADERS += \
$$PWD/vpatternpiecedata.h \
$$PWD/vpatterninfogeometry.h \
$$PWD/vgrainlinegeometry.h \
$$PWD/variables/vcurveclength.h
$$PWD/variables/vcurveclength.h \
$$PWD/variables/vellipticalarcradius.h

View File

@ -41,7 +41,8 @@ HEADERS += \
$$PWD/tools/dialogrotation.h \
$$PWD/tools/dialogflippingbyline.h \
$$PWD/tools/dialogflippingbyaxis.h \
$$PWD/tools/dialogmove.h
$$PWD/tools/dialogmove.h \
$$PWD/tools/dialogellipticalarc.h
SOURCES += \
@ -83,7 +84,8 @@ SOURCES += \
$$PWD/tools/dialogrotation.cpp \
$$PWD/tools/dialogflippingbyline.cpp \
$$PWD/tools/dialogflippingbyaxis.cpp \
$$PWD/tools/dialogmove.cpp
$$PWD/tools/dialogmove.cpp \
$$PWD/tools/dialogellipticalarc.cpp
FORMS += \
$$PWD/tools/dialogalongline.ui \
@ -123,4 +125,5 @@ FORMS += \
$$PWD/tools/dialogrotation.ui \
$$PWD/tools/dialogflippingbyline.ui \
$$PWD/tools/dialogflippingbyaxis.ui \
$$PWD/tools/dialogmove.ui
$$PWD/tools/dialogmove.ui \
$$PWD/tools/dialogellipticalarc.ui

View File

@ -65,6 +65,7 @@
#include "tools/dialogflippingbyline.h"
#include "tools/dialogflippingbyaxis.h"
#include "tools/dialogmove.h"
#include "tools/dialogellipticalarc.h"
#include "support/dialogeditwrongformula.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/vtoolcurveintersectaxis.h"
#include "toolcurve/vtoolarc.h"
#include "toolcurve/vtoolellipticalarc.h"
#include "toolcurve/vtoolarcwithlength.h"
#include "toolcurve/vtoolspline.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

@ -57,7 +57,8 @@ HEADERS += \
$$PWD/drawTools/operation/vabstractoperation.h \
$$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.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 \
@ -112,4 +113,5 @@ SOURCES += \
$$PWD/drawTools/operation/vabstractoperation.cpp \
$$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \
$$PWD/drawTools/operation/flipping/vabstractflipping.cpp \
$$PWD/drawTools/operation/vtoolmove.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

@ -37,7 +37,8 @@ HEADERS += \
$$PWD/path/vistoolcubicbezierpath.h \
$$PWD/line/operation/visoperation.h \
$$PWD/line/operation/vistoolflippingbyaxis.h \
$$PWD/line/operation/vistoolmove.h
$$PWD/line/operation/vistoolmove.h \
$$PWD/path/vistoolellipticalarc.h
SOURCES += \
$$PWD/visualization.cpp \
@ -75,4 +76,5 @@ SOURCES += \
$$PWD/path/vistoolcubicbezierpath.cpp \
$$PWD/line/operation/visoperation.cpp \
$$PWD/line/operation/vistoolflippingbyaxis.cpp \
$$PWD/line/operation/vistoolmove.cpp
$$PWD/line/operation/vistoolmove.cpp \
$$PWD/path/vistoolellipticalarc.cpp