Resolved issue #768. New feature. Custom curve approximation scale.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-10-11 13:51:06 +03:00
parent 38815727bb
commit baa2f4fd92
64 changed files with 1765 additions and 216 deletions

View File

@ -26,6 +26,7 @@
- Two new shortcut sequences: Ctrl+PgDown and Ctrl+PgUp to switch to next and previous pattern piece.
- [#765] New feature. Free curve mode.
- [#657] Improve feature: Allow more paper formats for printing tiled PDF
- [#768] New feature. Custom curve approximation scale.
# Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.

View File

@ -37,6 +37,8 @@
#include "../vpropertyexplorer/vproperties.h"
#include "vformulaproperty.h"
#include "../vpatterndb/vformula.h"
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vcubicbezierpath.h"
#include <QDockWidget>
#include <QHBoxLayout>
@ -649,6 +651,20 @@ void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &p
AddProperty(lineColorProperty, id);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &propertyName, qreal aScale)
{
QMap<QString, QVariant> settings;
settings.insert(QString("Min"), 0);
settings.insert(QString("Max"), maxCurveApproximationScale);
settings.insert(QString("Step"), 0.1);
settings.insert(QString("Precision"), 1);
VPE::VDoubleProperty *aScaleProperty = new VPE::VDoubleProperty(propertyName, settings);
aScaleProperty->setValue(aScale);
AddProperty(aScaleProperty, AttrAScale);
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetPointName(const QString &name)
@ -976,6 +992,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArc(VPE::VProperty *property)
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 60: // AttrAScale
i->SetApproximationScale(value.toDouble());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1011,6 +1030,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArcWithLength(VPE::VProperty *pr
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 60: // AttrAScale
i->SetApproximationScale(value.toDouble());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1571,6 +1593,10 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 60: // AttrAScale
spl.SetApproximationScale(value.toDouble());
i->setSpline(spl);
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1599,6 +1625,13 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezier(VPE::VProperty *prop
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 60: // AttrAScale
{
VCubicBezier spl = i->getSpline();
spl.SetApproximationScale(value.toDouble());
i->setSpline(spl);
break;
}
case 55: // AttrPoint1 (read only)
case 56: // AttrPoint2 (read only)
case 57: // AttrPoint3 (read only)
@ -1631,6 +1664,13 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VPE::VProperty *prope
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 60: // AttrAScale
{
VSplinePath spl = i->getSplinePath();
spl.SetApproximationScale(value.toDouble());
i->setSplinePath(spl);
break;
}
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1658,6 +1698,13 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VPE::VProperty *
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 60: // AttrAScale
{
VCubicBezierPath spl = i->getSplinePath();
spl.SetApproximationScale(value.toDouble());
i->setSplinePath(spl);
break;
}
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1955,6 +2002,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
AddPropertyFormula(tr("Second angle:"), i->GetFormulaF2(), AttrAngle2);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), i->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -1970,6 +2018,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArcWithLength(QGraphicsItem *it
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), i->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -2254,6 +2303,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), spl.GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -2270,6 +2320,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezier(QGraphicsItem *item
AddPropertyParentPointName(i->ForthPointName(), tr("Fourth point:"), AttrPoint4);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), i->getSpline().GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -2282,6 +2333,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item)
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), i->getSplinePath().GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -2294,6 +2346,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezierPath(QGraphicsItem *
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), i->getSplinePath().GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -2501,6 +2554,10 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
QVariant valueCenterPoint;
valueCenterPoint.setValue(i->CenterPointName());
idToProperty[AttrCenter]->setValue(valueCenterPoint);
QVariant valueApproximationScale;
valueApproximationScale.setValue(i->GetApproximationScale());
idToProperty[AttrAScale]->setValue(valueApproximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -2533,6 +2590,10 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength()
QVariant valueCenterPoint;
valueCenterPoint.setValue(i->CenterPointName());
idToProperty[AttrCenter]->setValue(valueCenterPoint);
QVariant valueApproximationScale;
valueApproximationScale.setValue(i->GetApproximationScale());
idToProperty[AttrAScale]->setValue(valueApproximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -2975,6 +3036,10 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
QVariant valueApproximationScale;
valueApproximationScale.setValue(spl.GetApproximationScale());
idToProperty[AttrAScale]->setValue(valueApproximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -3007,6 +3072,10 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
QVariant valueForthPoint;
valueForthPoint.setValue(i->ForthPointName());
idToProperty[AttrPoint4]->setValue(valueForthPoint);
QVariant valueApproximationScale;
valueApproximationScale.setValue(i->getSpline().GetApproximationScale());
idToProperty[AttrAScale]->setValue(valueApproximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -3023,6 +3092,10 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
QVariant valueApproximationScale;
valueApproximationScale.setValue(i->getSplinePath().GetApproximationScale());
idToProperty[AttrAScale]->setValue(valueApproximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -3039,6 +3112,10 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
QVariant valueApproximationScale;
valueApproximationScale.setValue(i->getSplinePath().GetApproximationScale());
idToProperty[AttrAScale]->setValue(valueApproximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -3279,6 +3356,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< AttrPoint2 /* 56 */
<< AttrPoint3 /* 57 */
<< AttrPoint4 /* 58 */
<< AttrPenStyle; /* 59 */
<< AttrPenStyle /* 59 */
<< AttrAScale; /* 60 */
return attr;
}

View File

@ -127,6 +127,7 @@ private:
void AddPropertyLineColor(Tool *i, const QString &propertyName, const QMap<QString, QString> &colors,
const QString &id);
void AddPropertyApproximationScale(const QString &propertyName, qreal aScale);
void AddPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName);
void AddPropertyParentPointName(const QString &pointName, const QString &propertyName,
const QString &propertyAttribure);

View File

@ -32,6 +32,7 @@
#include "../ifc/xml/vabstractpattern.h"
#include "../dialogdatetimeformats.h"
#include "../dialogknownmaterials.h"
#include "../vmisc/def.h"
#include <QMessageBox>
#include <QDate>
@ -64,6 +65,9 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
VSettings *settings = qApp->ValentinaSettings();
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
ui->doubleSpinBoxCurveApproximation->setValue(settings->GetCurveApproximationScale());
ui->doubleSpinBoxCurveApproximation->setMinimum(minCurveApproximationScale);
ui->doubleSpinBoxCurveApproximation->setMaximum(maxCurveApproximationScale);
ui->undoCount->setValue(settings->GetUndoCount());
InitDefaultSeamAllowance();
@ -93,6 +97,7 @@ void PreferencesPatternPage::Apply()
// Scene antialiasing
settings->SetGraphicalOutput(ui->graphOutputCheck->isChecked());
settings->SetCurveApproximationScale(ui->doubleSpinBoxCurveApproximation->value());
qApp->getSceneView()->setRenderHint(QPainter::Antialiasing, ui->graphOutputCheck->isChecked());
qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform, ui->graphOutputCheck->isChecked());

View File

@ -27,6 +27,55 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Curve approximation:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurveApproximation">
<property name="toolTip">
<string>Set default curve approximation scale</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -4512,6 +4512,7 @@ void MainWindow::Preferences()
&VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::RefreshDetailsLabel);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [](){VPattern::RefreshCurves();});
QGuiApplication::restoreOverrideCursor();
if (guard->exec() == QDialog::Accepted)

View File

@ -517,6 +517,20 @@ void VPattern::LiteParseIncrements()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::RefreshCurves()
{
QHash<quint32, VDataTool*>::const_iterator i = tools.constBegin();
while (i != tools.constEnd())
{
if (VAbstractSpline *vTool = qobject_cast<VAbstractSpline *>(i.value()))
{
vTool->FullUpdateFromFile();
}
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief LiteParseTree lite parse file.
@ -2304,6 +2318,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
initData.duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
initData.approximationScale = GetParametrDouble(domElement, AttrAScale, "0");
VToolSpline *spl = VToolSpline::Create(initData);
@ -2364,6 +2379,7 @@ void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
const qreal approximationScale = GetParametrDouble(domElement, AttrAScale, "0");
auto p1 = data->GeometricObject<VPointF>(point1);
auto p2 = data->GeometricObject<VPointF>(point2);
@ -2377,6 +2393,8 @@ void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement
}
initData.spline->SetColor(color);
initData.spline->SetPenStyle(penStyle);
initData.spline->SetPenStyle(penStyle);
initData.spline->SetApproximationScale(approximationScale);
VToolCubicBezier::Create(initData);
}
@ -2407,6 +2425,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme
const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0");
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
const qreal approximationScale = GetParametrDouble(domElement, AttrAScale, "0");
QVector<VFSplinePoint> points;
@ -2444,6 +2463,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme
path->SetDuplicate(duplicate);
}
path->SetColor(color);
path->SetApproximationScale(approximationScale);
VToolSplinePath::Create(initData, path);
}
@ -2474,6 +2494,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
initData.duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
initData.approximationScale = GetParametrDouble(domElement, AttrAScale, "0");
const QDomNodeList nodeList = domElement.childNodes();
const qint32 num = nodeList.size();
@ -2565,6 +2586,7 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
const qreal approximationScale = GetParametrDouble(domElement, AttrAScale, "0");
QVector<VPointF> points;
@ -2595,6 +2617,7 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
}
initData.path->SetColor(color);
initData.path->SetPenStyle(penStyle);
initData.path->SetApproximationScale(approximationScale);
VToolCubicBezierPath::Create(initData);
}
@ -2727,6 +2750,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
const QString f2Fix = initData.f2;//need for saving fixed formula;
initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
initData.approximationScale = GetParametrDouble(domElement, AttrAScale, "0");
VToolArc::Create(initData);
//Rewrite attribute formula. Need for situation when we have wrong formula.

View File

@ -107,6 +107,8 @@ public:
void LiteParseIncrements();
static void RefreshCurves();
static const QString AttrReadOnly;
public slots:

View File

@ -93,6 +93,7 @@ const QString AttrKAsm1 = QStringLiteral("kAsm1");
const QString AttrKAsm2 = QStringLiteral("kAsm2");
const QString AttrKCurve = QStringLiteral("kCurve");
const QString AttrDuplicate = QStringLiteral("duplicate");
const QString AttrAScale = QStringLiteral("aScale");
const QString AttrPathPoint = QStringLiteral("pathPoint");
const QString AttrPSpline = QStringLiteral("pSpline");
const QString AttrAxisP1 = QStringLiteral("axisP1");

View File

@ -113,6 +113,7 @@ extern const QString AttrKAsm1;// TODO. Delete if minimal supported version is 0
extern const QString AttrKAsm2;// TODO. Delete if minimal supported version is 0.2.7
extern const QString AttrKCurve;// TODO. Delete if minimal supported version is 0.2.7
extern const QString AttrDuplicate;
extern const QString AttrAScale;
extern const QString AttrPathPoint;
extern const QString AttrPSpline;
extern const QString AttrAxisP1;

View File

@ -40,6 +40,7 @@
<file>schema/pattern/v0.6.3.xsd</file>
<file>schema/pattern/v0.6.4.xsd</file>
<file>schema/pattern/v0.6.5.xsd</file>
<file>schema/pattern/v0.6.6.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_measurements/v0.4.1.xsd</file>

View File

@ -0,0 +1,995 @@
<?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 name="unit" type="units"/>
<xs:element name="image" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="extension" type="imageExtension"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
<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 name="h50" type="xs:boolean"/>
<xs:attribute name="h56" type="xs:boolean"/>
<xs:attribute name="h62" type="xs:boolean"/>
<xs:attribute name="h68" type="xs:boolean"/>
<xs:attribute name="h74" type="xs:boolean"/>
<xs:attribute name="h80" type="xs:boolean"/>
<xs:attribute name="h86" type="xs:boolean"/>
<xs:attribute name="h92" type="xs:boolean"/>
<xs:attribute name="h98" type="xs:boolean"/>
<xs:attribute name="h104" type="xs:boolean"/>
<xs:attribute name="h110" type="xs:boolean"/>
<xs:attribute name="h116" type="xs:boolean"/>
<xs:attribute name="h122" type="xs:boolean"/>
<xs:attribute name="h128" type="xs:boolean"/>
<xs:attribute name="h134" type="xs:boolean"/>
<xs:attribute name="h140" type="xs:boolean"/>
<xs:attribute name="h146" type="xs:boolean"/>
<xs:attribute name="h152" type="xs:boolean"/>
<xs:attribute name="h158" type="xs:boolean"/>
<xs:attribute name="h164" type="xs:boolean"/>
<xs:attribute name="h170" type="xs:boolean"/>
<xs:attribute name="h176" type="xs:boolean"/>
<xs:attribute name="h182" type="xs:boolean"/>
<xs:attribute name="h188" type="xs:boolean"/>
<xs:attribute name="h194" type="xs:boolean"/>
<xs:attribute name="h200" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"/>
<xs:attribute name="s22" type="xs:boolean"/>
<xs:attribute name="s24" type="xs:boolean"/>
<xs:attribute name="s26" type="xs:boolean"/>
<xs:attribute name="s28" type="xs:boolean"/>
<xs:attribute name="s30" type="xs:boolean"/>
<xs:attribute name="s32" type="xs:boolean"/>
<xs:attribute name="s34" type="xs:boolean"/>
<xs:attribute name="s36" type="xs:boolean"/>
<xs:attribute name="s38" type="xs:boolean"/>
<xs:attribute name="s40" type="xs:boolean"/>
<xs:attribute name="s42" type="xs:boolean"/>
<xs:attribute name="s44" type="xs:boolean"/>
<xs:attribute name="s46" type="xs:boolean"/>
<xs:attribute name="s48" type="xs:boolean"/>
<xs:attribute name="s50" type="xs:boolean"/>
<xs:attribute name="s52" type="xs:boolean"/>
<xs:attribute name="s54" type="xs:boolean"/>
<xs:attribute name="s56" type="xs:boolean"/>
<xs:attribute name="s58" type="xs:boolean"/>
<xs:attribute name="s60" type="xs:boolean"/>
<xs:attribute name="s62" type="xs:boolean"/>
<xs:attribute name="s64" type="xs:boolean"/>
<xs:attribute name="s66" type="xs:boolean"/>
<xs:attribute name="s68" type="xs:boolean"/>
<xs:attribute name="s70" type="xs:boolean"/>
<xs:attribute name="s72" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="custom" type="xs:boolean"/>
<xs:attribute name="defHeight" type="baseHeight"/>
<xs:attribute name="defSize" type="baseSize"/>
</xs:complexType>
</xs:element>
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="patternLabel" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="text" type="xs:string" use="required"/>
<xs:attribute name="bold" type="xs:boolean"/>
<xs:attribute name="italic" type="xs:boolean"/>
<xs:attribute name="alignment" type="alignmentType"/>
<xs:attribute name="sfIncrement" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="dateFormat" type="xs:string"/>
<xs:attribute name="timeFormat" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="patternMaterials" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="material" minOccurs="0" maxOccurs="9">
<xs:complexType>
<xs:attribute name="number" type="userMaterialType" use="required"/>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="finalMeasurements" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="finalMeasurment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="measurements" type="xs:string"/>
<xs:element name="increments">
<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 name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="previewCalculations">
<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 name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</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 name="x" type="xs:double"/>
<xs:attribute name="y" type="xs:double"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="name" type="shortName"/>
<xs:attribute name="firstPoint" type="xs:unsignedInt"/>
<xs:attribute name="secondPoint" type="xs:unsignedInt"/>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"/>
<xs:attribute name="basePoint" type="xs:unsignedInt"/>
<xs:attribute name="pShoulder" type="xs:unsignedInt"/>
<xs:attribute name="p1Line" type="xs:unsignedInt"/>
<xs:attribute name="p2Line" type="xs:unsignedInt"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="angle" type="xs:string"/>
<xs:attribute name="typeLine" type="linePenStyle"/>
<xs:attribute name="splinePath" type="xs:unsignedInt"/>
<xs:attribute name="spline" type="xs:unsignedInt"/>
<xs:attribute name="p1Line1" type="xs:unsignedInt"/>
<xs:attribute name="p1Line2" type="xs:unsignedInt"/>
<xs:attribute name="p2Line1" type="xs:unsignedInt"/>
<xs:attribute name="p2Line2" type="xs:unsignedInt"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="radius" type="xs:string"/>
<xs:attribute name="axisP1" type="xs:unsignedInt"/>
<xs:attribute name="axisP2" type="xs:unsignedInt"/>
<xs:attribute name="arc" type="xs:unsignedInt"/>
<xs:attribute name="elArc" type="xs:unsignedInt"/>
<xs:attribute name="curve" type="xs:unsignedInt"/>
<xs:attribute name="curve1" type="xs:unsignedInt"/>
<xs:attribute name="curve2" type="xs:unsignedInt"/>
<xs:attribute name="lineColor" type="colors"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="firstArc" type="xs:unsignedInt"/>
<xs:attribute name="secondArc" type="xs:unsignedInt"/>
<xs:attribute name="crossPoint" type="crossType"/>
<xs:attribute name="vCrossPoint" type="crossType"/>
<xs:attribute name="hCrossPoint" type="crossType"/>
<xs:attribute name="c1Center" type="xs:unsignedInt"/>
<xs:attribute name="c2Center" type="xs:unsignedInt"/>
<xs:attribute name="c1Radius" type="xs:string"/>
<xs:attribute name="c2Radius" type="xs:string"/>
<xs:attribute name="cRadius" type="xs:string"/>
<xs:attribute name="tangent" type="xs:unsignedInt"/>
<xs:attribute name="cCenter" type="xs:unsignedInt"/>
<xs:attribute name="name1" type="shortName"/>
<xs:attribute name="mx1" type="xs:double"/>
<xs:attribute name="my1" type="xs:double"/>
<xs:attribute name="name2" type="shortName"/>
<xs:attribute name="mx2" type="xs:double"/>
<xs:attribute name="my2" type="xs:double"/>
<xs:attribute name="point1" type="xs:unsignedInt"/>
<xs:attribute name="point2" type="xs:unsignedInt"/>
<xs:attribute name="dartP1" type="xs:unsignedInt"/>
<xs:attribute name="dartP2" type="xs:unsignedInt"/>
<xs:attribute name="dartP3" type="xs:unsignedInt"/>
<xs:attribute name="baseLineP1" type="xs:unsignedInt"/>
<xs:attribute name="baseLineP2" type="xs:unsignedInt"/>
<xs:attribute name="showLabel" type="xs:boolean"/>
<xs:attribute name="showLabel1" type="xs:boolean"/>
<xs:attribute name="showLabel2" type="xs:boolean"/>
</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 name="firstPoint" type="xs:unsignedInt"/>
<xs:attribute name="secondPoint" type="xs:unsignedInt"/>
<xs:attribute name="typeLine" type="linePenStyle"/>
<xs:attribute name="lineColor" type="colors"/>
</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: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 name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="showLabel" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="angle" type="xs:string"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="suffix" type="xs:string"/>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="p1Line" type="xs:unsignedInt"/>
<xs:attribute name="p2Line" type="xs:unsignedInt"/>
<xs:attribute name="axisType" type="axisType"/>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="radius" type="xs:string"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="penStyle" type="curvePenStyle"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="aScale" type="ApproximationScaleType"/>
</xs:complexType>
</xs:element>
<xs:element name="elArc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="rotationAngle" type="xs:string"/>
<xs:attribute name="radius1" type="xs:string"/>
<xs:attribute name="radius2" type="xs:string"/>
<xs:attribute name="center" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="penStyle" type="curvePenStyle"/>
<xs:attribute name="length" type="xs:string"/>
</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 name="pSpline" type="xs:unsignedInt"/>
<xs:attribute name="angle" type="xs:string"/>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="length1" type="xs:string"/>
<xs:attribute name="length2" type="xs:string"/>
<xs:attribute name="kAsm1" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="kCurve" type="xs:double"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="kAsm1" type="xs:double"/>
<xs:attribute name="kAsm2" type="xs:double"/>
<xs:attribute name="angle1" type="xs:string"/>
<xs:attribute name="angle2" type="xs:string"/>
<xs:attribute name="length1" type="xs:string"/>
<xs:attribute name="length2" type="xs:string"/>
<xs:attribute name="point1" type="xs:unsignedInt"/>
<xs:attribute name="point2" type="xs:unsignedInt"/>
<xs:attribute name="point3" type="xs:unsignedInt"/>
<xs:attribute name="point4" type="xs:unsignedInt"/>
<xs:attribute name="color" type="colors"/>
<xs:attribute name="penStyle" type="curvePenStyle"/>
<xs:attribute name="duplicate" type="xs:unsignedInt"/>
<xs:attribute name="aScale" type="ApproximationScaleType"/>
</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 name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</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 name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</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 name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</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 name="idObject" type="xs:unsignedInt"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="path" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="reverse" type="xs:unsignedInt"/>
<xs:attribute name="excluded" type="xs:boolean"/>
<xs:attribute name="before" type="xs:double"/>
<xs:attribute name="after" type="xs:double"/>
<xs:attribute name="angle" type="nodeAngle"/>
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="type" type="piecePathType"/>
<xs:attribute name="idTool" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="typeLine" type="curvePenStyle"/>
<xs:attribute name="cut" type="xs:boolean"/>
</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="nodes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="reverse" type="xs:unsignedInt"/>
<xs:attribute name="excluded" type="xs:boolean"/>
<xs:attribute name="before" type="xs:string"/>
<xs:attribute name="after" type="xs:string"/>
<xs:attribute name="angle" type="nodeAngle"/>
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="csa" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="start" type="xs:unsignedInt"/>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
<xs:attribute name="end" type="xs:unsignedInt"/>
<xs:attribute name="reverse" type="xs:boolean"/>
<xs:attribute name="includeAs" type="piecePathIncludeType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pins" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="children" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="nodes" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="csa" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pins" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="indexD1" type="xs:unsignedInt"/>
<xs:attribute name="indexD2" type="xs:unsignedInt"/>
<xs:attribute name="inUse" type="xs:boolean"/>
</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="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="text" type="xs:string" use="required"/>
<xs:attribute name="bold" type="xs:boolean"/>
<xs:attribute name="italic" type="xs:boolean"/>
<xs:attribute name="alignment" type="alignmentType"/>
<xs:attribute name="sfIncrement" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="letter" type="xs:string"/>
<xs:attribute name="annotation" type="xs:string"/>
<xs:attribute name="orientation" type="xs:string"/>
<xs:attribute name="rotationWay" type="xs:string"/>
<xs:attribute name="tilt" type="xs:string"/>
<xs:attribute name="foldPosition" type="xs:string"/>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="onFold" type="xs:boolean"/>
<xs:attribute name="fontSize" type="xs:unsignedInt"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="centerPin" type="xs:unsignedInt"/>
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
<xs:attribute name="quantity" type="xs:unsignedInt"/>
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="fontSize" type="xs:unsignedInt"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="centerPin" type="xs:unsignedInt"/>
<xs:attribute name="topLeftPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomRightPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="grainline" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="visible" type="xs:boolean"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="length" type="xs:string"/>
<xs:attribute name="rotation" type="xs:string"/>
<xs:attribute name="arrows" type="arrowType"/>
<xs:attribute name="centerPin" type="xs:unsignedInt"/>
<xs:attribute name="topPin" type="xs:unsignedInt"/>
<xs:attribute name="bottomPin" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
<xs:element name="nodes" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="node" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="reverse" type="xs:unsignedInt"/>
<xs:attribute name="excluded" type="xs:boolean"/>
<xs:attribute name="before" type="xs:string"/>
<xs:attribute name="after" type="xs:string"/>
<xs:attribute name="angle" type="nodeAngle"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="passmark" type="xs:boolean"/>
<xs:attribute name="passmarkLine" type="passmarkLineType"/>
<xs:attribute name="passmarkAngle" type="passmarkAngleType"/>
<xs:attribute name="showSecondPassmark" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="csa" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="start" type="xs:unsignedInt"/>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
<xs:attribute name="end" type="xs:unsignedInt"/>
<xs:attribute name="reverse" type="xs:boolean"/>
<xs:attribute name="includeAs" type="piecePathIncludeType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="iPaths" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="path" type="xs:unsignedInt" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pins" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="record" type="xs:unsignedInt" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="version" type="pieceVersion"/>
<xs:attribute name="mx" type="xs:double"/>
<xs:attribute name="my" type="xs:double"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="inLayout" type="xs:boolean"/>
<xs:attribute name="forbidFlipping" type="xs:boolean"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="seamAllowance" type="xs:boolean"/>
<xs:attribute name="seamAllowanceBuiltIn" type="xs:boolean"/>
<xs:attribute name="united" type="xs:boolean"/>
<xs:attribute name="closed" type="xs:unsignedInt"/>
<xs:attribute name="hideMainPath" type="xs:boolean"/>
</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 name="tool" type="xs:unsignedInt"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="visible" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="readOnly" type="xs:boolean"/>
</xs:complexType>
<xs:unique name="incrementName">
<xs:selector xpath=".//increment"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&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="linePenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="none"/>
<xs:enumeration value="hair"/>
<xs:enumeration value="dashLine"/>
<xs:enumeration value="dotLine"/>
<xs:enumeration value="dashDotLine"/>
<xs:enumeration value="dashDotDotLine"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="curvePenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="hair"/>
<xs:enumeration value="dashLine"/>
<xs:enumeration value="dotLine"/>
<xs:enumeration value="dashDotLine"/>
<xs:enumeration value="dashDotDotLine"/>
</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="200"/>
<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:enumeration value="2000"/>
</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="58"/>
<xs:enumeration value="60"/>
<xs:enumeration value="62"/>
<xs:enumeration value="64"/>
<xs:enumeration value="66"/>
<xs:enumeration value="68"/>
<xs:enumeration value="70"/>
<xs:enumeration value="72"/>
<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:enumeration value="580"/>
<xs:enumeration value="600"/>
<xs:enumeration value="620"/>
<xs:enumeration value="640"/>
<xs:enumeration value="660"/>
<xs:enumeration value="680"/>
<xs:enumeration value="700"/>
<xs:enumeration value="720"/>
</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="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:simpleType name="pieceVersion">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<!--Old version-->
<xs:enumeration value="2"/>
<!--New version-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nodeAngle">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--by length-->
<xs:enumeration value="1"/>
<!--by points intersections-->
<xs:enumeration value="2"/>
<!--by second edge symmetry-->
<xs:enumeration value="3"/>
<!--by first edge symmetry-->
<xs:enumeration value="4"/>
<!--by first edge right angle-->
<xs:enumeration value="5"/>
<!--by first edge right angle-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="piecePathType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<!--custom seam allowance-->
<xs:enumeration value="2"/>
<!--internal path-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="piecePathIncludeType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--as main path-->
<xs:enumeration value="1"/>
<!--as custom seam allowance-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="passmarkLineType">
<xs:restriction base="xs:string">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
<xs:enumeration value="three"/>
<xs:enumeration value="tMark"/>
<xs:enumeration value="vMark"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="passmarkAngleType">
<xs:restriction base="xs:string">
<xs:enumeration value="straightforward"/>
<xs:enumeration value="bisector"/>
<xs:enumeration value="intersection"/>
<xs:enumeration value="intersectionLeft"/>
<xs:enumeration value="intersectionRight"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="alignmentType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/><!--default (no aligns)-->
<xs:enumeration value="1"/><!--aligns with the left edge-->
<xs:enumeration value="2"/><!--aligns with the right edge-->
<xs:enumeration value="4"/><!--Centers horizontally in the available space-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="userMaterialType">
<xs:restriction base="xs:unsignedInt">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="20"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ApproximationScaleType">
<xs:restriction base="xs:double">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.5");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.5.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.6");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.6.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -254,6 +254,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000604):
return QStringLiteral("://schema/pattern/v0.6.4.xsd");
case (0x000605):
return QStringLiteral("://schema/pattern/v0.6.5.xsd");
case (0x000606):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -424,6 +426,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000605), m_convertedFileName);
V_FALLTHROUGH
case (0x000605):
ToV0_6_6();
ValidateXML(XSDSchema(0x000606), m_convertedFileName);
V_FALLTHROUGH
case (0x000606):
break;
default:
InvalidVersion(m_ver);
@ -442,7 +448,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
bool VPatternConverter::IsReadOnly() const
{
// Check if attribute readOnly was not changed in file format
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 5),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 6),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -896,6 +902,16 @@ void VPatternConverter::ToV0_6_5()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_6_6()
{
// TODO. Delete if minimal supported version is 0.6.6
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 6),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.6.6"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

View File

@ -53,7 +53,7 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 5);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 6);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -111,6 +111,7 @@ private:
void ToV0_6_3();
void ToV0_6_4();
void ToV0_6_5();
void ToV0_6_6();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -36,6 +36,7 @@
#include "../vmisc/def.h"
#include "../vmisc/vmath.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/vabstractapplication.h"
//---------------------------------------------------------------------------------------------------------------------
VAbstractCubicBezier::VAbstractCubicBezier(const GOType &type, const quint32 &idObject, const Draw &mode)
@ -211,9 +212,10 @@ qreal VAbstractCubicBezier::CalcSqDistance(qreal x1, qreal y1, qreal x2, qreal y
* @param level level of recursion. In the begin 0.
* @param px list х coordinat spline points.
* @param py list у coordinat spline points.
* @param approximationScale curve approximation scale.
*/
void VAbstractCubicBezier::PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4,
qint16 level, QVector<qreal> &px, QVector<qreal> &py)
qint16 level, QVector<qreal> &px, QVector<qreal> &py, qreal approximationScale)
{
if (px.size() >= 2)
{
@ -231,7 +233,13 @@ void VAbstractCubicBezier::PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2,
const double m_angle_tolerance = 0.0;
enum curve_recursion_limit_e { curve_recursion_limit = 32 };
const double m_cusp_limit = 0.0;
double m_approximation_scale = 10.0;
double m_approximation_scale = approximationScale;
if(m_approximation_scale < minCurveApproximationScale || m_approximation_scale > maxCurveApproximationScale)
{
m_approximation_scale = qApp->Settings()->GetCurveApproximationScale();
}
double m_distance_tolerance_square;
m_distance_tolerance_square = 0.5 / m_approximation_scale;
@ -495,8 +503,10 @@ void VAbstractCubicBezier::PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2,
// Continue subdivision
//----------------------
PointBezier_r(x1, y1, x12, y12, x123, y123, x1234, y1234, static_cast<qint16>(level + 1), px, py);
PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast<qint16>(level + 1), px, py);
PointBezier_r(x1, y1, x12, y12, x123, y123, x1234, y1234, static_cast<qint16>(level + 1), px, py,
approximationScale);
PointBezier_r(x1234, y1234, x234, y234, x34, y34, x4, y4, static_cast<qint16>(level + 1), px, py,
approximationScale);
}
//---------------------------------------------------------------------------------------------------------------------
@ -506,10 +516,11 @@ void VAbstractCubicBezier::PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2,
* @param p2 first control point.
* @param p3 second control point.
* @param p4 last spline point.
* @param approximationScale curve approximation scale.
* @return list of points.
*/
QVector<QPointF> VAbstractCubicBezier::GetCubicBezierPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3,
const QPointF &p4)
const QPointF &p4, qreal approximationScale)
{
QVector<QPointF> pvector;
QVector<qreal> x;
@ -519,7 +530,7 @@ QVector<QPointF> VAbstractCubicBezier::GetCubicBezierPoints(const QPointF &p1, c
x.append ( p1.x () );
y.append ( p1.y () );
PointBezier_r ( p1.x (), p1.y (), p2.x (), p2.y (),
p3.x (), p3.y (), p4.x (), p4.y (), 0, wx, wy );
p3.x (), p3.y (), p4.x (), p4.y (), 0, wx, wy, approximationScale );
x.append ( p4.x () );
y.append ( p4.y () );
for ( qint32 i = 0; i < x.count(); ++i )
@ -536,11 +547,13 @@ QVector<QPointF> VAbstractCubicBezier::GetCubicBezierPoints(const QPointF &p1, c
* @param p2 first control point.
* @param p3 second control point.
* @param p4 last spline point.
* @param approximationScale curve approximation scale.
* @return length.
*/
qreal VAbstractCubicBezier::LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
qreal VAbstractCubicBezier::LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4,
qreal approximationScale)
{
return PathLength(GetCubicBezierPoints(p1, p2, p3, p4));
return PathLength(GetCubicBezierPoints(p1, p2, p3, p4, approximationScale));
}
//---------------------------------------------------------------------------------------------------------------------
@ -575,5 +588,5 @@ qreal VAbstractCubicBezier::LengthT(qreal t) const
seg123_234.setLength(seg123_234.length () * t);
const QPointF p1234 = seg123_234.p2();
return LengthBezier ( static_cast<QPointF>(GetP1()), p12, p123, p1234);
return LengthBezier ( static_cast<QPointF>(GetP1()), p12, p123, p1234, GetApproximationScale());
}

View File

@ -66,10 +66,12 @@ protected:
static qreal CalcSqDistance(qreal x1, qreal y1, qreal x2, qreal y2);
static void PointBezier_r(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4,
qreal y4, qint16 level, QVector<qreal> &px, QVector<qreal> &py);
qreal y4, qint16 level, QVector<qreal> &px, QVector<qreal> &py,
qreal approximationScale);
static QVector<QPointF> GetCubicBezierPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3,
const QPointF &p4);
static qreal LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4);
const QPointF &p4, qreal approximationScale);
static qreal LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4,
qreal approximationScale);
virtual QPointF GetControlPoint1() const =0;
virtual QPointF GetControlPoint2() const =0;

View File

@ -300,6 +300,18 @@ void VAbstractCurve::SetPenStyle(const QString &penStyle)
d->penStyle = penStyle;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VAbstractCurve::GetApproximationScale() const
{
return d->approximationScale;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCurve::SetApproximationScale(qreal value)
{
d->approximationScale = value;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line)
{

View File

@ -89,6 +89,9 @@ public:
QString GetPenStyle() const;
void SetPenStyle(const QString &penStyle);
qreal GetApproximationScale() const;
void SetApproximationScale(qreal value);
static qreal PathLength(const QVector<QPointF> &path);
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);

View File

@ -45,14 +45,16 @@ public:
VAbstractCurveData ()
: duplicate(0),
color(ColorBlack),
penStyle(TypeLineLine)
penStyle(TypeLineLine),
approximationScale(defCurveApproximationScale)
{}
VAbstractCurveData(const VAbstractCurveData &curve)
: QSharedData(curve),
duplicate(curve.duplicate),
color(curve.color),
penStyle(curve.penStyle)
penStyle(curve.penStyle),
approximationScale(curve.approximationScale)
{}
virtual ~VAbstractCurveData();
@ -63,6 +65,8 @@ public:
QString color;
QString penStyle;
qreal approximationScale;
private:
VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE;
};

View File

@ -132,6 +132,7 @@ VArc VArc::Rotate(const QPointF &originPoint, qreal degrees, const QString &pref
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
arc.SetFlipped(IsFlipped());
arc.SetApproximationScale(GetApproximationScale());
return arc;
}
@ -151,6 +152,7 @@ VArc VArc::Flip(const QLineF &axis, const QString &prefix) const
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
arc.SetFlipped(not IsFlipped());
arc.SetApproximationScale(GetApproximationScale());
return arc;
}
@ -170,6 +172,7 @@ VArc VArc::Move(qreal length, qreal angle, const QString &prefix) const
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
arc.SetFlipped(IsFlipped());
arc.SetApproximationScale(GetApproximationScale());
return arc;
}
@ -280,6 +283,7 @@ QVector<QPointF> VArc::GetPoints() const
lineP4P3.setLength(lDistance);
VSpline spl(VPointF(pStart), lineP1P2.p2(), lineP4P3.p2(), VPointF(lineP4P3.p1()), 1.0);
spl.SetApproximationScale(GetApproximationScale());
QVector<QPointF> splPoints = spl.GetPoints();
if (not splPoints.isEmpty() && i != sectionAngle.size() - 1)
{
@ -336,9 +340,11 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
arc1 = VArc (GetCenter(), d->radius, d->formulaRadius, GetStartAngle(), GetFormulaF1(), line.angle(),
QString().setNum(line.angle()), getIdObject(), getMode());
arc1.SetApproximationScale(GetApproximationScale());
arc2 = VArc (GetCenter(), d->radius, d->formulaRadius, line.angle(), QString().setNum(line.angle()), GetEndAngle(),
GetFormulaF2(), getIdObject(), getMode());
arc2.SetApproximationScale(GetApproximationScale());
return line.p2();
}

View File

@ -75,6 +75,7 @@ VCubicBezier VCubicBezier::Rotate(const QPointF &originPoint, qreal degrees, con
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
curve.SetApproximationScale(GetApproximationScale());
return curve;
}
@ -89,6 +90,7 @@ VCubicBezier VCubicBezier::Flip(const QLineF &axis, const QString &prefix) const
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
curve.SetApproximationScale(GetApproximationScale());
return curve;
}
@ -103,6 +105,7 @@ VCubicBezier VCubicBezier::Move(qreal length, qreal angle, const QString &prefix
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
curve.SetApproximationScale(GetApproximationScale());
return curve;
}
@ -179,7 +182,7 @@ qreal VCubicBezier::GetEndAngle() const
qreal VCubicBezier::GetLength() const
{
return LengthBezier (static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()));
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -190,7 +193,7 @@ qreal VCubicBezier::GetLength() const
QVector<QPointF> VCubicBezier::GetPoints() const
{
return GetCubicBezierPoints(static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()));
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -90,6 +90,7 @@ VCubicBezierPath VCubicBezierPath::Rotate(const QPointF &originPoint, qreal degr
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
curve.SetApproximationScale(GetApproximationScale());
return curve;
}
@ -105,6 +106,7 @@ VCubicBezierPath VCubicBezierPath::Flip(const QLineF &axis, const QString &prefi
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
curve.SetApproximationScale(GetApproximationScale());
return curve;
}
@ -120,6 +122,7 @@ VCubicBezierPath VCubicBezierPath::Move(qreal length, qreal angle, const QString
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
curve.SetApproximationScale(GetApproximationScale());
return curve;
}
@ -199,6 +202,7 @@ VSpline VCubicBezierPath::GetSpline(qint32 index) const
}
VSpline spl(d->path.at(base), p2, static_cast<QPointF>(d->path.at(base + 2)), d->path.at(base + 3));
spl.SetApproximationScale(GetApproximationScale());
return spl;
}

View File

@ -123,6 +123,7 @@ VSpline VSpline::Rotate(const QPointF &originPoint, qreal degrees, const QString
spl.setName(name() + prefix);
spl.SetColor(GetColor());
spl.SetPenStyle(GetPenStyle());
spl.SetApproximationScale(GetApproximationScale());
return spl;
}
@ -139,6 +140,7 @@ VSpline VSpline::Flip(const QLineF &axis, const QString &prefix) const
spl.setName(name() + prefix);
spl.SetColor(GetColor());
spl.SetPenStyle(GetPenStyle());
spl.SetApproximationScale(GetApproximationScale());
return spl;
}
@ -155,6 +157,7 @@ VSpline VSpline::Move(qreal length, qreal angle, const QString &prefix) const
spl.setName(name() + prefix);
spl.SetColor(GetColor());
spl.SetPenStyle(GetPenStyle());
spl.SetApproximationScale(GetApproximationScale());
return spl;
}
@ -170,7 +173,7 @@ VSpline::~VSpline()
qreal VSpline::GetLength () const
{
return LengthBezier ( static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()), static_cast<QPointF>(GetP3()),
static_cast<QPointF>(GetP4()));
static_cast<QPointF>(GetP4()), GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -183,7 +186,10 @@ QPointF VSpline::CutSpline(qreal length, VSpline &spl1, VSpline &spl2) const
const QPointF cutPoint = CutSpline (length, spl1p2, spl1p3, spl2p2, spl2p3 );
spl1 = VSpline(GetP1(), spl1p2, spl1p3, VPointF(cutPoint));
spl1.SetApproximationScale(GetApproximationScale());
spl2 = VSpline(VPointF(cutPoint), spl2p2, spl2p3, GetP4());
spl2.SetApproximationScale(GetApproximationScale());
return cutPoint;
}
@ -195,7 +201,7 @@ QPointF VSpline::CutSpline(qreal length, VSpline &spl1, VSpline &spl2) const
QVector<QPointF> VSpline::GetPoints () const
{
return GetCubicBezierPoints(static_cast<QPointF>(GetP1()), static_cast<QPointF>(GetP2()),
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()));
static_cast<QPointF>(GetP3()), static_cast<QPointF>(GetP4()), GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -212,7 +218,7 @@ QVector<QPointF> VSpline::GetPoints () const
*/
// cppcheck-suppress unusedFunction
QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve)
qreal kAsm2, qreal kCurve, qreal approximationScale)
{
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());
p1pX.setAngle( angle1 );
@ -225,7 +231,7 @@ QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qre
p4p3.setAngle(angle2);
QPointF p2 = p1p2.p2();
QPointF p3 = p4p3.p2();
return GetCubicBezierPoints(p1, p2, p3, p4);
return GetCubicBezierPoints(p1, p2, p3, p4, approximationScale);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -111,7 +111,7 @@ public:
virtual QVector<QPointF> GetPoints () const Q_DECL_OVERRIDE;
// cppcheck-suppress unusedFunction
static QVector<QPointF> SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve);
qreal kAsm2, qreal kCurve, qreal approximationScale);
qreal ParamT(const QPointF &pBt) const;
protected:

View File

@ -121,6 +121,7 @@ VSplinePath VSplinePath::Rotate(const QPointF &originPoint, qreal degrees, const
splPath.setName(name() + prefix);
splPath.SetColor(GetColor());
splPath.SetPenStyle(GetPenStyle());
splPath.SetApproximationScale(GetApproximationScale());
return splPath;
}
@ -145,6 +146,7 @@ VSplinePath VSplinePath::Flip(const QLineF &axis, const QString &prefix) const
splPath.setName(name() + prefix);
splPath.SetColor(GetColor());
splPath.SetPenStyle(GetPenStyle());
splPath.SetApproximationScale(GetApproximationScale());
return splPath;
}
@ -169,6 +171,7 @@ VSplinePath VSplinePath::Move(qreal length, qreal angle, const QString &prefix)
splPath.setName(name() + prefix);
splPath.SetColor(GetColor());
splPath.SetPenStyle(GetPenStyle());
splPath.SetApproximationScale(GetApproximationScale());
return splPath;
}
@ -231,6 +234,7 @@ VSpline VSplinePath::GetSpline(qint32 index) const
const VSplinePoint &p2 = d->path.at(index);
VSpline spl(p1.P(), p2.P(), p1.Angle2(), p1.Angle2Formula(), p2.Angle1(), p2.Angle1Formula(), p1.Length2(),
p1.Length2Formula(), p2.Length1(), p2.Length1Formula(), 1);
spl.SetApproximationScale(GetApproximationScale());
return spl;
}

View File

@ -56,6 +56,10 @@
#include "vabstractapplication.h"
const qreal defCurveApproximationScale = 0.5;
const qreal minCurveApproximationScale = 0.1;
const qreal maxCurveApproximationScale = 10.0;
//functions
const QString degTorad_F = QStringLiteral("degTorad");
const QString radTodeg_F = QStringLiteral("radTodeg");

View File

@ -53,7 +53,10 @@ class QMarginsF;
class VTranslateMeasurements;
class QGraphicsItem;
#define SceneSize 50000
#define SceneSize 50000
extern const qreal defCurveApproximationScale;
extern const qreal minCurveApproximationScale;
extern const qreal maxCurveApproximationScale;
enum class NodeDetail : char { Contour, Modeling };
enum class SceneObject : char { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };

View File

@ -69,6 +69,7 @@ const QString settingPatternHideMainPath = QStringLiteral("pattern/hi
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance");
const QString settingPatternLabelFont = QStringLiteral("pattern/labelFont");
const QString settingPatternCurveApproximationScale = QStringLiteral("pattern/curveApproximationScale");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
@ -961,3 +962,27 @@ void VCommonSettings::SetUserDefinedTimeFormats(const QStringList &formats)
{
setValue(settingLabelUserTimeFormats, ClearFormats(VCommonSettings::PredefinedTimeFormats(), formats));
}
//---------------------------------------------------------------------------------------------------------------------
qreal VCommonSettings::GetCurveApproximationScale() const
{
bool ok = false;
const qreal scale = value(settingPatternCurveApproximationScale, defCurveApproximationScale).toDouble(&ok);
if (ok && scale >= minCurveApproximationScale && scale <= maxCurveApproximationScale)
{
return scale;
}
else
{
return defCurveApproximationScale;
}
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetCurveApproximationScale(qreal value)
{
if (value >= minCurveApproximationScale && value <= maxCurveApproximationScale)
{
setValue(settingPatternCurveApproximationScale, value);
}
}

View File

@ -186,6 +186,9 @@ public:
QStringList GetUserDefinedTimeFormats() const;
void SetUserDefinedTimeFormats(const QStringList &formats);
qreal GetCurveApproximationScale() const;
void SetCurveApproximationScale(qreal value);
private:
Q_DISABLE_COPY(VCommonSettings)
};

View File

@ -60,6 +60,8 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
{
ui->setupUi(this);
ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale);
plainTextEditFormula = ui->plainTextEditFormula;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
@ -182,6 +184,22 @@ void DialogArc::SetColor(const QString &value)
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
qreal DialogArc::GetApproximationScale() const
{
return ui->doubleSpinBoxApproximationScale->value();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetApproximationScale(qreal value)
{
ui->doubleSpinBoxApproximationScale->setValue(value);
VisToolArc *path = qobject_cast<VisToolArc *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetF1 set formula first angle of arc
@ -272,6 +290,7 @@ void DialogArc::SaveData()
path->setRadius(radius);
path->setF1(f1);
path->setF2(f2);
path->setApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->RefreshGeometry();
}

View File

@ -70,6 +70,9 @@ public:
QString GetColor() const;
void SetColor(const QString &value);
qreal GetApproximationScale() const;
void SetApproximationScale(qreal value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>425</width>
<height>374</height>
<height>395</height>
</rect>
</property>
<property name="windowTitle">
@ -586,10 +586,32 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="toolTip">
<string/>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
@ -600,15 +622,35 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Pen style:</string>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Approximation scale:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxApproximationScale">
<property name="toolTip">
<string>Set approximation scale for this curve, 0 - use global value</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -79,6 +79,8 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale);
CheckState();
connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, &DialogArcWithLength::FXRadius);
@ -210,6 +212,22 @@ void DialogArcWithLength::SetColor(const QString &value)
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
qreal DialogArcWithLength::GetApproximationScale() const
{
return ui->doubleSpinBoxApproximationScale->value();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::SetApproximationScale(qreal value)
{
ui->doubleSpinBoxApproximationScale->setValue(value);
VisToolArcWithLength *path = qobject_cast<VisToolArcWithLength *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(value);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::ChosenObject(quint32 id, const SceneObject &type)
{
@ -351,6 +369,7 @@ void DialogArcWithLength::SaveData()
path->setRadius(radius);
path->setF1(f1);
path->setLength(length);
path->setApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->RefreshGeometry();
}

View File

@ -69,6 +69,8 @@ public:
QString GetColor() const;
void SetColor(const QString &value);
qreal GetApproximationScale() const;
void SetApproximationScale(qreal value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
/**

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>339</width>
<height>374</height>
<height>395</height>
</rect>
</property>
<property name="windowTitle">
@ -597,7 +597,49 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Approximation scale:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxApproximationScale">
<property name="toolTip">
<string>Set approximation scale for this curve, 0 - use global value</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -60,6 +60,8 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale);
DialogTool::CheckState();
connect(ui->comboBoxP1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
@ -96,41 +98,21 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline)
setCurrentPointId(ui->comboBoxP3, spl.GetP3().id());
setCurrentPointId(ui->comboBoxP4, spl.GetP4().id());
ChangeCurrentData(ui->comboBoxPenStyle, spl.GetPenStyle());
ChangeCurrentData(ui->comboBoxColor, spl.GetColor());
ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
ui->doubleSpinBoxApproximationScale->setValue(spl.GetApproximationScale());
auto path = qobject_cast<VisToolCubicBezier *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(spl.GetApproximationScale());
path->setObject1Id(spl.GetP1().id());
path->setObject2Id(spl.GetP2().id());
path->setObject3Id(spl.GetP3().id());
path->setObject4Id(spl.GetP4().id());
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezier::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezier::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezier::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezier::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezier::ChosenObject(quint32 id, const SceneObject &type)
{
@ -246,13 +228,16 @@ void DialogCubicBezier::SaveData()
const auto p4 = GetP4();
spl = VCubicBezier(*p1, *p2, *p3, *p4);
spl.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
spl.SetPenStyle(GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine));
spl.SetColor(GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack));
const quint32 d = spl.GetDuplicate();//Save previous value
newDuplicate <= -1 ? spl.SetDuplicate(d) : spl.SetDuplicate(static_cast<quint32>(newDuplicate));
auto path = qobject_cast<VisToolCubicBezier *>(vis);
SCASSERT(path != nullptr)
path->setApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path->setObject1Id(p1->id());
path->setObject2Id(p2->id());
path->setObject3Id(p3->id());

View File

@ -57,12 +57,6 @@ public:
VCubicBezier GetSpline() const;
void SetSpline(const VCubicBezier &spline);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
virtual void PointNameChanged() Q_DECL_OVERRIDE;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>285</width>
<height>278</height>
<width>387</width>
<height>294</height>
</rect>
</property>
<property name="windowTitle">
@ -40,14 +40,14 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QLineEdit" name="lineEditSplineName">
<property name="readOnly">
<bool>true</bool>
@ -102,7 +102,49 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Approximation Scale:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxApproximationScale">
<property name="toolTip">
<string>Set approximation scale for this curve, 0 - use global value</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -73,6 +73,8 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCubicBezierPath::PointChanged);
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogCubicBezierPath::currentPointChanged);
@ -104,6 +106,10 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
}
ui->listWidget->setFocus(Qt::OtherFocusReason);
ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
ui->doubleSpinBoxApproximationScale->setValue(path.GetApproximationScale());
ChangeCurrentData(ui->comboBoxPenStyle, path.GetPenStyle());
ChangeCurrentData(ui->comboBoxColor, path.GetColor());
auto visPath = qobject_cast<VisToolCubicBezierPath *>(vis);
SCASSERT(visPath != nullptr)
@ -116,30 +122,6 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
}
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezierPath::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezierPath::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezierPath::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezierPath::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezierPath::ChosenObject(quint32 id, const SceneObject &type)
{
@ -209,6 +191,10 @@ void DialogCubicBezierPath::SaveData()
SavePath();
newDuplicate <= -1 ? path.SetDuplicate(d) : path.SetDuplicate(static_cast<quint32>(newDuplicate));
path.SetPenStyle(GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine));
path.SetColor(GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack));
path.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
auto visPath = qobject_cast<VisToolCubicBezierPath *>(vis);
SCASSERT(visPath != nullptr)
visPath->setPath(path);

View File

@ -56,12 +56,6 @@ public:
VCubicBezierPath GetPath() const;
void SetPath(const VCubicBezierPath &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;

View File

@ -62,14 +62,14 @@
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditSplPathName">
<property name="readOnly">
<bool>true</bool>
@ -84,7 +84,49 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Approximation scale:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxApproximationScale">
<property name="toolTip">
<string>Set approximation scale for this curve, 0 - use global value</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -107,6 +107,8 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale);
CheckState();
connect(ui->comboBoxP1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
@ -209,6 +211,7 @@ void DialogSpline::SaveData()
path->SetKAsm1(spl.GetKasm1());
path->SetKAsm2(spl.GetKasm2());
path->SetKCurve(spl.GetKcurve());
path->setApproximationScale(spl.GetApproximationScale());
path->SetMode(Mode::Show);
path->RefreshGeometry();
}
@ -467,6 +470,9 @@ VSpline DialogSpline::CurrentSpline() const
length2F = qApp->TrVars()->TryFormulaFromUser(length2F, separator);
VSpline spline(*GetP1(), *GetP4(), angle1, angle1F, angle2, angle2F, length1, length1F, length2, length2F);
spline.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
spline.SetPenStyle(GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine));
spline.SetColor(GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack));
return spline;
}
@ -578,6 +584,10 @@ void DialogSpline::SetSpline(const VSpline &spline)
{
spl = spline;
ui->doubleSpinBoxApproximationScale->setValue(spl.GetApproximationScale());
ChangeCurrentData(ui->comboBoxColor, spl.GetColor());
ChangeCurrentData(ui->comboBoxPenStyle, spl.GetPenStyle());
setCurrentPointId(ui->comboBoxP1, spl.GetP1().id());
setCurrentPointId(ui->comboBoxP4, spl.GetP4().id());
@ -608,28 +618,5 @@ void DialogSpline::SetSpline(const VSpline &spline)
path->SetKAsm1(spl.GetKasm1());
path->SetKAsm2(spl.GetKasm2());
path->SetKCurve(spl.GetKcurve());
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSpline::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSpline::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
path->setApproximationScale(spl.GetApproximationScale());
}

View File

@ -60,11 +60,6 @@ public:
VSpline GetSpline() const;
void SetSpline(const VSpline &spline);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
virtual void PointNameChanged() Q_DECL_OVERRIDE;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>524</width>
<height>342</height>
<height>403</height>
</rect>
</property>
<property name="windowTitle">
@ -849,14 +849,14 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditSplineName">
<property name="readOnly">
<bool>true</bool>
@ -871,7 +871,49 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Approximation scale:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxApproximationScale">
<property name="toolTip">
<string>Set approximation scale for this curve, 0 - use global value</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -105,6 +105,8 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
ui->doubleSpinBoxApproximationScale->setMaximum(maxCurveApproximationScale);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged);
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogSplinePath::currentPointChanged);
@ -161,6 +163,10 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
}
ui->listWidget->setFocus(Qt::OtherFocusReason);
ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
ui->doubleSpinBoxApproximationScale->setValue(path.GetApproximationScale());
ChangeCurrentData(ui->comboBoxPenStyle, path.GetPenStyle());
ChangeCurrentData(ui->comboBoxColor, path.GetColor());
auto visPath = qobject_cast<VisToolSplinePath *>(vis);
SCASSERT(visPath != nullptr)
@ -168,30 +174,6 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
ui->listWidget->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSplinePath::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSplinePath::GetColor() const
{
return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::SetColor(const QString &value)
{
ChangeCurrentData(ui->comboBoxColor, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
@ -888,6 +870,9 @@ void DialogSplinePath::SavePath()
{
path.Clear();
path = ExtractPath();
path.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
path.SetPenStyle(GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine));
path.SetColor(GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -58,12 +58,6 @@ public:
VSplinePath GetPath() const;
void SetPath(const VSplinePath &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>456</width>
<height>532</height>
<height>599</height>
</rect>
</property>
<property name="windowTitle">
@ -811,14 +811,14 @@
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditSplPathName">
<property name="readOnly">
<bool>true</bool>
@ -833,7 +833,49 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Approximation scale:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxApproximationScale">
<property name="toolTip">
<string>Set approximation scale for this curve, 0 - use global value</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -310,6 +310,7 @@ void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
const QSharedPointer<VAbstractCurve> curve = qSharedPointerCast<VAbstractCurve>(obj);
doc->SetAttribute(tag, AttrColor, curve->GetColor());
doc->SetAttribute(tag, AttrPenStyle, curve->GetPenStyle());
doc->SetAttribute(tag, AttrAScale, curve->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -59,11 +59,13 @@ struct VAbstractSplineInitData : VAbstractToolInitData
VAbstractSplineInitData()
: VAbstractToolInitData(),
color(ColorBlack),
penStyle(TypeLineLine)
penStyle(TypeLineLine),
approximationScale(defCurveApproximationScale)
{}
QString color;
QString penStyle;
qreal approximationScale;
};
class VAbstractSpline:public VDrawTool, public QGraphicsPathItem

View File

@ -89,6 +89,7 @@ void VToolArc::setDialog()
dialogTool->SetRadius(arc->GetFormulaRadius());
dialogTool->SetColor(arc->GetColor());
dialogTool->SetPenStyle(arc->GetPenStyle());
dialogTool->SetApproximationScale(arc->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -118,6 +119,7 @@ VToolArc* VToolArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene
initData.data = data;
initData.parse = Document::FullParse;
initData.typeCreation = Source::FromGui;
initData.approximationScale = dialogTool->GetApproximationScale();
VToolArc* point = Create(initData);
if (point != nullptr)
@ -145,6 +147,7 @@ VToolArc* VToolArc::Create(VToolArcInitData &initData)
VArc *arc = new VArc(c, calcRadius, initData.radius, calcF1, initData.f1, calcF2, initData.f2 );
arc->SetColor(initData.color);
arc->SetPenStyle(initData.penStyle);
arc->SetApproximationScale(initData.approximationScale);
if (initData.typeCreation == Source::FromGui)
{
@ -294,6 +297,24 @@ void VToolArc::SetFormulaF2(const VFormula &value)
}
}
//---------------------------------------------------------------------------------------------------------------------
qreal VToolArc::GetApproximationScale() const
{
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
SCASSERT(arc.isNull() == false)
return arc->GetApproximationScale();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::SetApproximationScale(qreal value)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
arc->SetApproximationScale(value);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArc::ShowVisualization(bool show)
{
@ -340,6 +361,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, dialogTool->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -372,6 +394,7 @@ void VToolArc::SetVisualization()
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), qApp->Settings()->GetOsSeparator()));
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2(), qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->setApproximationScale(arc->GetApproximationScale());
visual->RefreshGeometry();
}
}

View File

@ -90,6 +90,9 @@ public:
VFormula GetFormulaF2() const;
void SetFormulaF2(const VFormula &value);
qreal GetApproximationScale() const;
void SetApproximationScale(qreal value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;

View File

@ -82,6 +82,7 @@ void VToolArcWithLength::setDialog()
dialogTool->SetRadius(arc->GetFormulaRadius());
dialogTool->SetColor(arc->GetColor());
dialogTool->SetPenStyle(arc->GetPenStyle());
dialogTool->SetApproximationScale(arc->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -99,6 +100,7 @@ VToolArcWithLength *VToolArcWithLength::Create(QSharedPointer<DialogTool> dialog
initData.length = dialogTool->GetLength();
initData.color = dialogTool->GetColor();
initData.penStyle = dialogTool->GetPenStyle();
initData.approximationScale = dialogTool->GetApproximationScale();
initData.scene = scene;
initData.doc = doc;
initData.data = data;
@ -272,6 +274,24 @@ void VToolArcWithLength::SetFormulaLength(const VFormula &value)
}
}
//---------------------------------------------------------------------------------------------------------------------
qreal VToolArcWithLength::GetApproximationScale() const
{
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(m_id);
SCASSERT(arc.isNull() == false)
return arc->GetApproximationScale();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::SetApproximationScale(qreal value)
{
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(m_id);
QSharedPointer<VArc> arc = qSharedPointerDynamicCast<VArc>(obj);
arc->SetApproximationScale(value);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::ShowVisualization(bool show)
{
@ -312,6 +332,7 @@ void VToolArcWithLength::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrLength, dialogTool->GetLength());
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, dialogTool->GetApproximationScale());
}
//---------------------------------------------------------------------------------------------------------------------
@ -344,6 +365,7 @@ void VToolArcWithLength::SetVisualization()
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), qApp->Settings()->GetOsSeparator()));
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength(), qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->setApproximationScale(arc->GetApproximationScale());
visual->RefreshGeometry();
}
}

View File

@ -87,6 +87,9 @@ public:
VFormula GetFormulaLength() const;
void SetFormulaLength(const VFormula &value);
qreal GetApproximationScale() const;
void SetApproximationScale(qreal value);
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;

View File

@ -75,8 +75,6 @@ void VToolCubicBezier::setDialog()
SCASSERT(dialogTool != nullptr)
const auto spl = VAbstractTool::data.GeometricObject<VCubicBezier>(m_id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(spl->GetColor());
dialogTool->SetPenStyle(spl->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -94,8 +92,6 @@ VToolCubicBezier *VToolCubicBezier::Create(QSharedPointer<DialogTool> dialog, VM
initData.parse = Document::FullParse;
initData.typeCreation = Source::FromGui;
initData.spline = new VCubicBezier(dialogTool->GetSpline());
initData.spline->SetColor(dialogTool->GetColor());
initData.spline->SetPenStyle(dialogTool->GetPenStyle());
auto spl = Create(initData);
@ -225,8 +221,6 @@ void VToolCubicBezier::SaveDialog(QDomElement &domElement)
const VCubicBezier spl = dialogTool->GetSpline();
SetSplineAttributes(domElement, spl);
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -253,6 +247,7 @@ void VToolCubicBezier::SetVisualization()
visual->setObject3Id(spl->GetP3().id());
visual->setObject4Id(spl->GetP4().id());
visual->setLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->setApproximationScale(spl->GetApproximationScale());
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}
@ -272,11 +267,14 @@ void VToolCubicBezier::SetSplineAttributes(QDomElement &domElement, const VCubic
{
SCASSERT(doc != nullptr)
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrPoint1, spl.GetP1().id());
doc->SetAttribute(domElement, AttrPoint2, spl.GetP2().id());
doc->SetAttribute(domElement, AttrPoint3, spl.GetP3().id());
doc->SetAttribute(domElement, AttrPoint4, spl.GetP4().id());
doc->SetAttribute(domElement, AttrType, ToolType);
doc->SetAttribute(domElement, AttrPoint1, spl.GetP1().id());
doc->SetAttribute(domElement, AttrPoint2, spl.GetP2().id());
doc->SetAttribute(domElement, AttrPoint3, spl.GetP3().id());
doc->SetAttribute(domElement, AttrPoint4, spl.GetP4().id());
doc->SetAttribute(domElement, AttrColor, spl.GetColor());
doc->SetAttribute(domElement, AttrPenStyle, spl.GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, spl.GetApproximationScale());
if (spl.GetDuplicate() > 0)
{

View File

@ -77,8 +77,6 @@ void VToolCubicBezierPath::setDialog()
SCASSERT(dialogTool != nullptr)
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(m_id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(splPath->GetColor());
dialogTool->SetPenStyle(splPath->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -97,14 +95,10 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(QSharedPointer<DialogTool> di
initData.typeCreation = Source::FromGui;
initData.path = new VCubicBezierPath(dialogTool->GetPath());
const QString color = dialogTool->GetColor();
const QString penStyle = dialogTool->GetPenStyle();
for (qint32 i = 0; i < initData.path->CountPoints(); ++i)
{
doc->IncrementReferens((*initData.path)[i].getIdTool());
}
initData.path->SetColor(color);
initData.path->SetPenStyle(penStyle);
VToolCubicBezierPath* spl = Create(initData);
if (spl != nullptr)
@ -210,8 +204,6 @@ void VToolCubicBezierPath::SaveDialog(QDomElement &domElement)
const auto dialogTool = qobject_cast<DialogCubicBezierPath*>(m_dialog);
SCASSERT(dialogTool != nullptr)
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
SetSplinePathAttributes(domElement, dialogTool->GetPath());
}
@ -277,5 +269,9 @@ void VToolCubicBezierPath::SetSplinePathAttributes(QDomElement &domElement, cons
}
}
doc->SetAttribute(domElement, AttrColor, path.GetColor());
doc->SetAttribute(domElement, AttrPenStyle, path.GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, path.GetApproximationScale());
UpdatePathPoints(doc, domElement, path);
}

View File

@ -134,8 +134,6 @@ void VToolSpline::setDialog()
SCASSERT(not dialogTool.isNull())
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(m_id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(spl->GetColor());
dialogTool->SetPenStyle(spl->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -161,11 +159,7 @@ VToolSpline* VToolSpline::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
initData.parse = Document::FullParse;
initData.typeCreation = Source::FromGui;
VSpline *spline = new VSpline(dialogTool->GetSpline());
spline->SetColor(dialogTool->GetColor());
spline->SetPenStyle(dialogTool->GetPenStyle());
auto spl = Create(initData, spline);
auto spl = Create(initData, new VSpline(dialogTool->GetSpline()));
if (spl != nullptr)
{
@ -233,6 +227,7 @@ VToolSpline *VToolSpline::Create(VToolSplineInitData &initData)
spline->SetColor(initData.color);
spline->SetPenStyle(initData.penStyle);
spline->SetApproximationScale(initData.approximationScale);
return VToolSpline::Create(initData, spline);
}
@ -336,8 +331,6 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
controlPoints[1]->blockSignals(false);
SetSplineAttributes(domElement, spl);
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -527,6 +520,7 @@ void VToolSpline::SetVisualization()
visual->SetKAsm2(spl->GetKasm2());
visual->SetKCurve(spl->GetKcurve());
visual->setLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->setApproximationScale(spl->GetApproximationScale());
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}
@ -627,6 +621,9 @@ void VToolSpline::SetSplineAttributes(QDomElement &domElement, const VSpline &sp
doc->SetAttribute(domElement, AttrAngle2, spl.GetEndAngleFormula());
doc->SetAttribute(domElement, AttrLength1, spl.GetC1LengthFormula());
doc->SetAttribute(domElement, AttrLength2, spl.GetC2LengthFormula());
doc->SetAttribute(domElement, AttrColor, spl.GetColor());
doc->SetAttribute(domElement, AttrPenStyle, spl.GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, spl.GetApproximationScale());
if (spl.GetDuplicate() > 0)
{

View File

@ -142,8 +142,6 @@ void VToolSplinePath::setDialog()
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(m_id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(splPath->GetColor());
dialogTool->SetPenStyle(splPath->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -174,9 +172,6 @@ VToolSplinePath* VToolSplinePath::Create(QSharedPointer<DialogTool> dialog, VMai
doc->IncrementReferens((*path)[i].P().getIdTool());
}
path->SetColor(dialogTool->GetColor());
path->SetPenStyle(dialogTool->GetPenStyle());
VToolSplinePath* spl = Create(initData, path);
if (spl != nullptr)
{
@ -248,6 +243,7 @@ VToolSplinePath *VToolSplinePath::Create(VToolSplinePathInitData &initData)
path->SetColor(initData.color);
path->SetPenStyle(initData.penStyle);
path->SetApproximationScale(initData.approximationScale);
return VToolSplinePath::Create(initData, path);
}
@ -356,6 +352,10 @@ void VToolSplinePath::SetSplinePathAttributes(QDomElement &domElement, const VSp
domElement.removeAttribute(AttrKCurve);
}
doc->SetAttribute(domElement, AttrColor, path.GetColor());
doc->SetAttribute(domElement, AttrPenStyle, path.GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, path.GetApproximationScale());
UpdatePathPoints(doc, domElement, path);
}
@ -479,8 +479,6 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
controlPoints[j-1]->blockSignals(false);
}
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
SetSplinePathAttributes(domElement, splPath);
}

View File

@ -202,8 +202,12 @@ VPointF *VToolCutSplinePath::CutSplinePath(qreal length, const QSharedPointer<VA
const VSplinePoint splP1 = points.at(p1);
const VSplinePoint splP2 = points.at(p2);
const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p);
const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P());
VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p);
spl1.SetApproximationScale(splPath->GetApproximationScale());
VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P());
spl2.SetApproximationScale(splPath->GetApproximationScale());
*splPath1 = new VSplinePath();
*splPath2 = new VSplinePath();

View File

@ -39,7 +39,8 @@
//---------------------------------------------------------------------------------------------------------------------
VisPath::VisPath(const VContainer *data, QGraphicsItem *parent)
: Visualization(data),
VCurvePathItem(parent)
VCurvePathItem(parent),
m_approximationScale(0)
{
this->setZValue(1);// Show on top real tool
InitPen();
@ -80,3 +81,9 @@ VSimplePoint *VisPath::GetPoint(QVector<VSimplePoint *> &points, quint32 i, cons
}
return nullptr;
}
//---------------------------------------------------------------------------------------------------------------------
void VisPath::setApproximationScale(qreal approximationScale)
{
m_approximationScale = approximationScale;
}

View File

@ -49,9 +49,13 @@ public:
explicit VisPath(const VContainer *data, QGraphicsItem *parent = nullptr);
virtual ~VisPath() = default;
void setApproximationScale(qreal approximationScale);
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::Path)};
protected:
qreal m_approximationScale;
virtual void InitPen() Q_DECL_OVERRIDE;
virtual void AddOnScene() Q_DECL_OVERRIDE;

View File

@ -61,6 +61,7 @@ void VisToolArc::RefreshGeometry()
if (not qFuzzyIsNull(radius) && f1 >= 0 && f2 >= 0)
{
VArc arc = VArc (*first, radius, f1, f2);
arc.SetApproximationScale(m_approximationScale);
DrawPath(this, arc.GetPath(), arc.DirectionArrows(), mainColor, lineStyle, Qt::RoundCap);
}
}

View File

@ -60,6 +60,7 @@ void VisToolArcWithLength::RefreshGeometry()
if (not qFuzzyIsNull(radius) && f1 >= 0 && not qFuzzyIsNull(length))
{
VArc arc = VArc (length, *first, radius, f1);
arc.SetApproximationScale(m_approximationScale);
DrawPath(this, arc.GetPath(), arc.DirectionArrows(), mainColor, lineStyle, Qt::RoundCap);
}
}

View File

@ -90,6 +90,7 @@ void VisToolCubicBezier::RefreshGeometry()
{
VCubicBezier spline(*first, *second, VPointF(Visualization::scenePos),
VPointF(Visualization::scenePos));
spline.SetApproximationScale(m_approximationScale);
DrawPath(this, spline.GetPath(), mainColor, lineStyle, Qt::RoundCap);
}
else
@ -100,6 +101,7 @@ void VisToolCubicBezier::RefreshGeometry()
if (object4Id <= NULL_ID)
{
VCubicBezier spline(*first, *second, *third, VPointF(Visualization::scenePos));
spline.SetApproximationScale(m_approximationScale);
DrawPath(this, spline.GetPath(), mainColor, lineStyle, Qt::RoundCap);
DrawLine(helpLine2, QLineF(static_cast<QPointF>(*third), Visualization::scenePos), mainColor,
Qt::DashLine);
@ -112,6 +114,7 @@ void VisToolCubicBezier::RefreshGeometry()
Qt::DashLine);
VCubicBezier spline(*first, *second, *third, *fourth);
spline.SetApproximationScale(m_approximationScale);
DrawPath(this, spline.GetPath(), spline.DirectionArrows(), mainColor, lineStyle, Qt::RoundCap);
}
}

View File

@ -122,6 +122,7 @@ void VisToolSpline::RefreshGeometry()
if (object4Id <= NULL_ID)
{
VSpline spline(*first, p2, Visualization::scenePos, VPointF(Visualization::scenePos));
spline.SetApproximationScale(m_approximationScale);
DrawPath(this, spline.GetPath(), mainColor, lineStyle, Qt::RoundCap);
}
else
@ -160,11 +161,13 @@ void VisToolSpline::RefreshGeometry()
if (VFuzzyComparePossibleNulls(angle1, EMPTY_ANGLE) || VFuzzyComparePossibleNulls(angle2, EMPTY_ANGLE))
{
VSpline spline(*first, p2, p3, *second);
spline.SetApproximationScale(m_approximationScale);
DrawPath(this, spline.GetPath(), mainColor, lineStyle, Qt::RoundCap);
}
else
{
VSpline spline(*first, *second, angle1, angle2, kAsm1, kAsm2, kCurve);
spline.SetApproximationScale(m_approximationScale);
DrawPath(this, spline.GetPath(), spline.DirectionArrows(), mainColor, lineStyle, Qt::RoundCap);
Visualization::toolTip = tr("Use <b>Shift</b> for sticking angle!");
emit ToolTip(Visualization::toolTip);