All points in detail should go clockwise. This mean in some cases need reverse

curves that go anticlockwise. Old method reversing curves doesn't work
correct in all cases. I don't see now way automatically handle this. That's
why now user can choose himself need reverse points for this curve or not.

Also this mean increment in format version to 0.1.2.

--HG--
branch : feature
This commit is contained in:
dismine 2014-12-17 14:56:14 +02:00
parent fa9a1d7807
commit d6c78ca1a1
18 changed files with 431 additions and 93 deletions

View File

@ -69,6 +69,7 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
this, &DialogDetail::BiasYChanged);
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
connect(ui.checkBoxReverse, &QCheckBox::clicked, this, &DialogDetail::ClickedReverse);
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged);
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
@ -133,9 +134,10 @@ void DialogDetail::SaveData()
* @param typeNode type of node in detail
* @param mx offset respect to x
* @param my offset respect to y
* @param reverse reverse list of points
*/
void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
qreal mx, qreal my)
qreal mx, qreal my, bool reverse)
{
QString name;
switch (typeTool)
@ -171,14 +173,27 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
QListWidgetItem *item = new QListWidgetItem(name);
item->setFont(QFont("Times", 12, QFont::Bold));
VNodeDetail node(id, typeTool, typeNode, mx, my);
VNodeDetail node(id, typeTool, typeNode, mx, my, reverse);
item->setData(Qt::UserRole, QVariant::fromValue(node));
ui.listWidget->addItem(item);
ui.listWidget->setCurrentRow(ui.listWidget->count()-1);
ui.doubleSpinBoxBiasX->blockSignals(true);
ui.doubleSpinBoxBiasY->blockSignals(true);
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));
if (node.getTypeTool() == Tool::NodePoint)
{
ui.checkBoxReverse->setChecked(false);
ui.checkBoxReverse->setEnabled(false);
}
else
{
ui.checkBoxReverse->setEnabled(true);
ui.checkBoxReverse->setChecked(node.getReverse());
}
ui.doubleSpinBoxBiasX->blockSignals(false);
ui.doubleSpinBoxBiasY->blockSignals(false);
}
@ -195,7 +210,7 @@ void DialogDetail::setDetails(const VDetail &value)
for (int i = 0; i < details.CountNode(); ++i)
{
NewItem(details.at(i).getId(), details.at(i).getTypeTool(), details.at(i).getTypeNode(), details.at(i).getMx(),
details.at(i).getMy());
details.at(i).getMy(), details.at(i).getReverse());
}
ui.lineEditNameDetail->setText(details.getName());
ui.checkBoxSeams->setChecked(details.getSeamAllowance());
@ -260,6 +275,17 @@ void DialogDetail::ClickedClosed(bool checked)
closed = checked;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogDetail::ClickedReverse(bool checked)
{
qint32 row = ui.listWidget->currentRow();
QListWidgetItem *item = ui.listWidget->item( row );
SCASSERT(item != nullptr);
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setReverse(checked);
item->setData(Qt::UserRole, QVariant::fromValue(node));
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ObjectChanged changed new object (point, arc, spline or spline path) form list
@ -271,10 +297,20 @@ void DialogDetail::ObjectChanged(int row)
{
return;
}
QListWidgetItem *item = ui.listWidget->item( row );
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
const QListWidgetItem *item = ui.listWidget->item( row );
const VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));
if (node.getTypeTool() == Tool::NodePoint)
{
ui.checkBoxReverse->setChecked(false);
ui.checkBoxReverse->setEnabled(false);
}
else
{
ui.checkBoxReverse->setEnabled(true);
ui.checkBoxReverse->setChecked(node.getReverse());
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -50,6 +50,7 @@ public slots:
void BiasYChanged(qreal d);
void ClickedSeams(bool checked);
void ClickedClosed(bool checked);
void ClickedReverse(bool checked);
void ObjectChanged(int row);
void DeleteItem();
virtual void UpdateList();
@ -73,7 +74,7 @@ private:
bool closed;
void NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
qreal mx = 0, qreal my = 0);
qreal mx = 0, qreal my = 0, bool reverse = false);
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>565</width>
<height>324</height>
<height>342</height>
</rect>
</property>
<property name="windowTitle">
@ -126,6 +126,17 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="checkBoxReverse">
<property name="text">
<string>Reverse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">

View File

@ -52,13 +52,12 @@ VAbstractCurve &VAbstractCurve::operator=(const VAbstractCurve &curve)
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end,
const QVector<QPointF> &contourPoints) const
QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse) const
{
QVector<QPointF> points = GetPoints();
if (contourPoints.isEmpty() == false)
if (reverse)
{
points = CorrectAnticlockwise(points, contourPoints);
points = GetReversePoints(points);
}
points = FromBegin(points, begin);
points = ToEnd(points, end);
@ -122,23 +121,6 @@ QVector<QPointF> VAbstractCurve::ToEnd(const QVector<QPointF> &points, const QPo
return GetReversePoints(reversed);
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::CorrectAnticlockwise(const QVector<QPointF> &points,
const QVector<QPointF> &contourPoints) const
{
const int len1 = GetLengthContour(contourPoints, points);
const QVector<QPointF> reversedPoints = GetReversePoints(points);
const int lenReverse = GetLengthContour(contourPoints, reversedPoints);
if (len1 <= lenReverse)
{
return points;
}
else
{
return reversedPoints;
}
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractCurve::GetPath(PathDirection direction) const
{

View File

@ -45,8 +45,7 @@ public:
VAbstractCurve& operator= (const VAbstractCurve &curve);
virtual QVector<QPointF> GetPoints() const =0;
QVector<QPointF> GetSegmentPoints(const QPointF &begin, const QPointF &end,
const QVector<QPointF> &contourPoints = QVector<QPointF>()) const;
QVector<QPointF> GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse = false) const;
virtual QPainterPath GetPath(PathDirection direction = PathDirection::Hide) const;
virtual qreal GetLength() const =0;
@ -56,8 +55,6 @@ protected:
private:
QVector<QPointF> FromBegin(const QVector<QPointF> &points, const QPointF &begin) const;
QVector<QPointF> ToEnd(const QVector<QPointF> &points, const QPointF &end) const;
QVector<QPointF> CorrectAnticlockwise(const QVector<QPointF> &points,
const QVector<QPointF> &contourPoints) const;
};
#endif // VABSTRACTCURVE_H

View File

@ -77,7 +77,12 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail) const
const QPointF begin = StartSegment(detail, i);
const QPointF end = EndSegment(detail, i);
AddContourPoints(curve->GetSegmentPoints(begin, end, points), points, pointsEkv, detail, i);
QVector<QPointF> nodePoints = curve->GetSegmentPoints(begin, end, detail.at(i).getReverse());
points << nodePoints;
if (detail.getSeamAllowance() == true)
{
pointsEkv << biasPoints(nodePoints, detail.at(i).getMx(), detail.at(i).getMy());
}
}
break;
default:
@ -428,32 +433,3 @@ QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle
pLine.setLength( width );
return pLine.p2();
}
//---------------------------------------------------------------------------------------------------------------------
void VEquidistant::AddContourPoints(const QVector<QPointF> &nodePoints, QVector<QPointF> &points,
QVector<QPointF> &pointsEkv, const VDetail &detail, int i)
{
/*
* Even if we made correction anticlockwise in method VAbstractCurve::GetSegmentPoints i decided left this check
* also here. I think it will make code more bullet proof. If it will slowdown creation contour delete correction.
*/
int len1 = VGObject::GetLengthContour(points, nodePoints);
QVector<QPointF> reversedPoints = VGObject::GetReversePoints(nodePoints);
int lenReverse = VGObject::GetLengthContour(points, reversedPoints);
if (len1 <= lenReverse)
{
points << nodePoints;
if (detail.getSeamAllowance() == true)
{
pointsEkv << biasPoints(nodePoints, detail.at(i).getMx(), detail.at(i).getMy());
}
}
else
{
points << reversedPoints;
if (detail.getSeamAllowance() == true)
{
pointsEkv << biasPoints(reversedPoints, detail.at(i).getMx(), detail.at(i).getMy());
}
}
}

View File

@ -106,9 +106,6 @@ private:
*/
static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width);
static void AddContourPoints(const QVector<QPointF> &nodePoints, QVector<QPointF> &points,
QVector<QPointF> &pointsEkv, const VDetail &detail, int i);
QPointF StartSegment(const VDetail &detail, const int &i) const;
QPointF EndSegment(const VDetail &detail, const int &i) const;
};

View File

@ -35,8 +35,8 @@ VNodeDetail::VNodeDetail()
{}
//---------------------------------------------------------------------------------------------------------------------
VNodeDetail::VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my)
:d(new VNodeDetailData(id, typeTool, typeNode, mx, my))
VNodeDetail::VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my, bool reverse)
:d(new VNodeDetailData(id, typeTool, typeNode, mx, my, reverse))
{}
//---------------------------------------------------------------------------------------------------------------------
@ -118,3 +118,29 @@ void VNodeDetail::setMy(const qreal &value)
{
d->my = value;
}
//---------------------------------------------------------------------------------------------------------------------
bool VNodeDetail::getReverse() const
{
if (getTypeTool() == Tool::NodePoint)
{
return false;
}
else
{
return d->reverse;
}
}
//---------------------------------------------------------------------------------------------------------------------
void VNodeDetail::setReverse(bool reverse)
{
if (getTypeTool() == Tool::NodePoint)
{
d->reverse = false;
}
else
{
d->reverse = reverse;
}
}

View File

@ -53,7 +53,7 @@ public:
* @param mx object bias x axis
* @param my object bias y axis
*/
VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx = 0, qreal my = 0);
VNodeDetail(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx = 0, qreal my = 0, bool reverse = false);
/**
* @brief VNodeDetail copy constructor
* @param node node
@ -116,6 +116,9 @@ public:
* @param value bias y axis.
*/
void setMy(const qreal &value);
bool getReverse() const;
void setReverse(bool reverse);
private:
QSharedDataPointer<VNodeDetailData> d;
};

View File

@ -41,15 +41,16 @@ class VNodeDetailData : public QSharedData
{
public:
VNodeDetailData()
:id(NULL_ID), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0)
:id(NULL_ID), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0), reverse(false)
{}
VNodeDetailData(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my)
:id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my)
VNodeDetailData(quint32 id, Tool typeTool, NodeDetail typeNode, qreal mx, qreal my, bool reverse)
:id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my), reverse(reverse)
{}
VNodeDetailData (const VNodeDetailData& node)
:QSharedData(node), id(node.id), typeTool(node.typeTool), typeNode(node.typeNode), mx(node.mx), my(node.my)
:QSharedData(node), id(node.id), typeTool(node.typeTool), typeNode(node.typeNode), mx(node.mx), my(node.my),
reverse(node.reverse)
{}
~VNodeDetailData() {}
@ -74,6 +75,10 @@ public:
* @brief my bias y axis.
*/
qreal my;
/**
* @brief reverse true if need reverse points list for node.
*/
bool reverse;
};
#ifdef Q_CC_GNU

View File

@ -52,6 +52,7 @@ const QString VToolDetail::AttrClosed = QStringLiteral("closed");
const QString VToolDetail::AttrWidth = QStringLiteral("width");
const QString VToolDetail::AttrIdObject = QStringLiteral("idObject");
const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType");
const QString VToolDetail::AttrReverse = QStringLiteral("reverse");
const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour");
const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling");
@ -181,7 +182,8 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
}
VNodeDetail node(id, detail.at(i).getTypeTool(), NodeDetail::Contour);
VNodeDetail node(id, detail.at(i).getTypeTool(), NodeDetail::Contour, detail.at(i).getMx(),
detail.at(i).getMy(), detail.at(i).getReverse());
det.append(node);
}
det.setName(detail.getName());
@ -455,6 +457,12 @@ void VToolDetail::AddNode(VPattern *doc, QDomElement &domElement, const VNodeDet
doc->SetAttribute(nod, AttrIdObject, node.getId());
doc->SetAttribute(nod, AttrMx, qApp->fromPixel(node.getMx()));
doc->SetAttribute(nod, AttrMy, qApp->fromPixel(node.getMy()));
if (node.getTypeTool() != Tool::NodePoint)
{
doc->SetAttribute(nod, AttrReverse, static_cast<quint8>(node.getReverse()));
}
if (node.getTypeNode() == NodeDetail::Contour)
{
doc->SetAttribute(nod, AttrNodeType, NodeTypeContour);

View File

@ -74,6 +74,7 @@ public:
static const QString AttrWidth;
static const QString AttrIdObject;
static const QString AttrNodeType;
static const QString AttrReverse;
static const QString NodeTypeContour;
static const QString NodeTypeModeling;
static const QString NodeArc;

View File

@ -257,7 +257,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
break;
}
newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour));
newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour, 0, 0, det.at(i).getReverse()));
}
//---------------------------------------------------------------------------------------------------------------------
@ -694,6 +694,7 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE
quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, NULL_ID_STR);
qreal mx = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0"));
qreal my = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0"));
const bool reversed = doc->GetParametrUInt(element, VToolDetail::AttrReverse, "0");
Tool tool = Tool::NodePoint;
NodeDetail nodeType = NodeDetail::Contour;
QString t = doc->GetParametrString(element, "type", "NodePoint");
@ -713,7 +714,7 @@ QVector<VDetail> VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE
{
tool = Tool::NodeSplinePath;
}
d.append(VNodeDetail(id, tool, nodeType, mx, my));
d.append(VNodeDetail(id, tool, nodeType, mx, my, reversed));
}
}
}

View File

@ -980,6 +980,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, NULL_ID_STR);
const qreal mx = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0"));
const qreal my = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0"));
const bool reverse = GetParametrUInt(element, VToolDetail::AttrReverse, "0");
const NodeDetail nodeType = NodeDetail::Contour;
const QString t = GetParametrString(element, AttrType, "NodePoint");
@ -1004,7 +1005,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
continue;
break;
}
detail.append(VNodeDetail(id, tool, nodeType, mx, my));
detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
}
}
}

View File

@ -3,5 +3,6 @@
<file>schema/individual_measurements.xsd</file>
<file>schema/standard_measurements.xsd</file>
<file>schema/pattern/v0.1.1.xsd</file>
<file>schema/pattern/v0.1.2.xsd</file>
</qresource>
</RCC>

View File

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- XML Schema Generated from XML Document-->
<xs:element name="pattern">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="version" type="formatVersion"></xs:element>
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="heights">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="h92" type="xs:boolean"></xs:attribute>
<xs:attribute name="h98" type="xs:boolean"></xs:attribute>
<xs:attribute name="h104" type="xs:boolean"></xs:attribute>
<xs:attribute name="h110" type="xs:boolean"></xs:attribute>
<xs:attribute name="h116" type="xs:boolean"></xs:attribute>
<xs:attribute name="h122" type="xs:boolean"></xs:attribute>
<xs:attribute name="h128" type="xs:boolean"></xs:attribute>
<xs:attribute name="h134" type="xs:boolean"></xs:attribute>
<xs:attribute name="h140" type="xs:boolean"></xs:attribute>
<xs:attribute name="h146" type="xs:boolean"></xs:attribute>
<xs:attribute name="h152" type="xs:boolean"></xs:attribute>
<xs:attribute name="h158" type="xs:boolean"></xs:attribute>
<xs:attribute name="h164" type="xs:boolean"></xs:attribute>
<xs:attribute name="h170" type="xs:boolean"></xs:attribute>
<xs:attribute name="h176" type="xs:boolean"></xs:attribute>
<xs:attribute name="h182" type="xs:boolean"></xs:attribute>
<xs:attribute name="h188" type="xs:boolean"></xs:attribute>
<xs:attribute name="h194" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="s22" type="xs:boolean"></xs:attribute>
<xs:attribute name="s24" type="xs:boolean"></xs:attribute>
<xs:attribute name="s26" type="xs:boolean"></xs:attribute>
<xs:attribute name="s28" type="xs:boolean"></xs:attribute>
<xs:attribute name="s30" type="xs:boolean"></xs:attribute>
<xs:attribute name="s32" type="xs:boolean"></xs:attribute>
<xs:attribute name="s34" type="xs:boolean"></xs:attribute>
<xs:attribute name="s36" type="xs:boolean"></xs:attribute>
<xs:attribute name="s38" type="xs:boolean"></xs:attribute>
<xs:attribute name="s40" type="xs:boolean"></xs:attribute>
<xs:attribute name="s42" type="xs:boolean"></xs:attribute>
<xs:attribute name="s44" type="xs:boolean"></xs:attribute>
<xs:attribute name="s46" type="xs:boolean"></xs:attribute>
<xs:attribute name="s48" type="xs:boolean"></xs:attribute>
<xs:attribute name="s50" type="xs:boolean"></xs:attribute>
<xs:attribute name="s52" type="xs:boolean"></xs:attribute>
<xs:attribute name="s54" type="xs:boolean"></xs:attribute>
<xs:attribute name="s56" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="measurements" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" type="measurementsTypes" use="required"></xs:attribute>
<xs:attribute name="path" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="unit" type="units" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="increments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="ksize" type="xs:double" use="required"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="kgrowth" type="xs:double" use="required"></xs:attribute>
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
<xs:attribute name="base" type="xs:double" use="required"></xs:attribute>
</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>
<xs:attribute name="x" type="xs:double"></xs:attribute>
<xs:attribute name="y" type="xs:double"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="name" type="shortName"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
<xs:attribute name="angle1" type="xs:double"></xs:attribute>
<xs:attribute name="angle2" type="xs:double"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="det" minOccurs="2" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
</xs: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="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="supplement" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="closed" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^0-9-*/^+=\s\(\)%:;!.,`'\&quot;]){1,1}([^-*/^+=\s\(\)%:;!.,`'\&quot;]){0,}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="measurementsTypes">
<xs:restriction base="xs:string">
<xs:enumeration value="standard"/>
<xs:enumeration value="individual"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -40,8 +40,8 @@
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.1");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.1.1");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.1.1.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.1.2");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.1.2.xsd");
//---------------------------------------------------------------------------------------------------------------------
VPatternConverter::VPatternConverter(const QString &fileName)
@ -87,8 +87,8 @@ QString VPatternConverter::XSDSchema(int ver) const
switch(ver)
{
case (0x000101):
// return QStringLiteral("://schema/pattern/v0.1.2.xsd");
// case (0x000102):
return QStringLiteral("://schema/pattern/v0.1.1.xsd");
case (0x000102):
return CurrentSchema;
default:
{
@ -107,13 +107,13 @@ void VPatternConverter::ApplyPatches()
switch(ver)
{
case (0x000101):
// {
// ToV0_1_2();
// const QString schema = XSDSchema(0x000102);
// ValidateXML(schema, fileName);
// break;
// }
// case (0x000102):
{
ToV0_1_2();
const QString schema = XSDSchema(0x000102);
ValidateXML(schema, fileName);
break;
}
case (0x000102):
break;
default:
break;
@ -139,8 +139,8 @@ void VPatternConverter::ApplyPatches()
}
//---------------------------------------------------------------------------------------------------------------------
//void VPatternConverter::ToV0_1_2()
//{
// SetVersion("0.1.2");
// Save();
//}
void VPatternConverter::ToV0_1_2()
{
SetVersion("0.1.2");
Save();
}

View File

@ -54,7 +54,7 @@ private:
Q_DISABLE_COPY(VPatternConverter)
static const QString PatternMinVerStr;
// void ToV0_1_2();
void ToV0_1_2();
};
#endif // VPATTERNCONVERTER_H