Now we can add image to file.val
--HG-- branch : feature
This commit is contained in:
parent
ab78ee2550
commit
821bafbdee
|
@ -28,7 +28,9 @@
|
|||
|
||||
#include "dialogpatternproperties.h"
|
||||
#include "ui_dialogpatternproperties.h"
|
||||
#include <QBuffer>
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include "../xml/vpattern.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../core/vapplication.h"
|
||||
|
@ -62,6 +64,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
ui->plainTextEditTechNotes->setPlainText(doc->GetNotes());
|
||||
connect(ui->plainTextEditTechNotes, &QPlainTextEdit::textChanged, this, &DialogPatternProperties::DescEdited);
|
||||
|
||||
InitImage();
|
||||
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &DialogPatternProperties::Ok);
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this,
|
||||
&DialogPatternProperties::Apply);
|
||||
|
@ -603,3 +607,47 @@ void DialogPatternProperties::InitComboBox(QComboBox *box, const QMap<GVal, bool
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::InitImage()
|
||||
{
|
||||
// we set an image from file.val
|
||||
QImage image;
|
||||
QByteArray byteArray;
|
||||
byteArray.append(doc->GetImage().toUtf8());
|
||||
QByteArray ba = QByteArray::fromBase64(byteArray);
|
||||
QBuffer buffer(&ba);
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
image.load(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
connect(ui->changeImageButton, &QPushButton::clicked, this, &DialogPatternProperties::SetNewImage);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPatternProperties::SetNewImage()
|
||||
{
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), tr("Images (*.png)"));
|
||||
QImage image;
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!image.load(fileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
image.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer
|
||||
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
|
||||
|
||||
// save our image to file.val
|
||||
doc->SetImage(iconBase64);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public slots:
|
|||
void CheckStateHeight(int state);
|
||||
void CheckStateSize(int state);
|
||||
void DescEdited();
|
||||
void SetNewImage();
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||
private slots:
|
||||
|
@ -99,6 +100,7 @@ private:
|
|||
|
||||
void UpdateDefHeight();
|
||||
void UpdateDefSize();
|
||||
void InitImage();
|
||||
};
|
||||
|
||||
#endif // DIALOGPATTERNPROPERTIES_H
|
||||
|
|
|
@ -43,20 +43,70 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pattern description</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pattern description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditDescription">
|
||||
<property name="documentTitle">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditDescription">
|
||||
<property name="documentTitle">
|
||||
<string/>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="imageLabel">
|
||||
<property name="text">
|
||||
<string>No image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="changeImageButton">
|
||||
<property name="text">
|
||||
<string>change image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
|
@ -86,6 +86,7 @@ void VPattern::CreateEmptyFile()
|
|||
patternElement.appendChild(createElement(TagAuthor));
|
||||
patternElement.appendChild(createElement(TagDescription));
|
||||
patternElement.appendChild(createElement(TagNotes));
|
||||
patternElement.appendChild(createElement(TagImage));
|
||||
|
||||
patternElement.appendChild(createElement(TagMeasurements));
|
||||
patternElement.appendChild(createElement(TagIncrements));
|
||||
|
@ -127,7 +128,7 @@ void VPattern::Parse(const Document &parse)
|
|||
SCASSERT(sceneDraw != nullptr);
|
||||
SCASSERT(sceneDetail != nullptr);
|
||||
QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
|
||||
<< TagMeasurements << TagVersion << TagGradation << TagUnit;
|
||||
<< TagImage << TagMeasurements << TagVersion << TagGradation << TagUnit;
|
||||
PrepareForParse(parse);
|
||||
QDomNode domNode = documentElement().firstChild();
|
||||
while (domNode.isNull() == false)
|
||||
|
@ -172,16 +173,19 @@ void VPattern::Parse(const Document &parse)
|
|||
case 4: // TagNotes
|
||||
qCDebug(vXML, "Tag notes.");
|
||||
break;
|
||||
case 5: // TagMeasurements
|
||||
case 5: // TagImage
|
||||
qCDebug(vXML, "Tag image.");
|
||||
break;
|
||||
case 6: // TagMeasurements
|
||||
qCDebug(vXML, "Tag measurements.");
|
||||
break;
|
||||
case 6: // TagVersion
|
||||
case 7: // TagVersion
|
||||
qCDebug(vXML, "Tag version.");
|
||||
break;
|
||||
case 7: // TagGradation
|
||||
case 8: // TagGradation
|
||||
qCDebug(vXML, "Tag gradation.");
|
||||
break;
|
||||
case 8: // TagUnit
|
||||
case 9: // TagUnit
|
||||
qCDebug(vXML, "Tag unit.");
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -22,5 +22,6 @@
|
|||
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
||||
<file>schema/individual_measurements/v0.3.2.xsd</file>
|
||||
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
||||
<file>schema/pattern/v0.2.8.xsd</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
442
src/libs/ifc/schema/pattern/v0.2.8.xsd
Normal file
442
src/libs/ifc/schema/pattern/v0.2.8.xsd
Normal file
|
@ -0,0 +1,442 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<!-- XML Schema Generated from XML Document-->
|
||||
<xs:element name="pattern">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element name="version" type="formatVersion"></xs:element>
|
||||
<xs:element name="unit" type="units"></xs:element>
|
||||
<xs:element name="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="image" type="xs:string" />
|
||||
<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:attribute name="custom" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="defHeight" type="baseHeight"></xs:attribute>
|
||||
<xs:attribute name="defSize" type="baseSize"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="measurements" type="xs:string"></xs:element>
|
||||
<xs:element name="increments" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
|
||||
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
|
||||
<xs:attribute name="formula" type="xs:string" use="required"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:unique name="incrementName">
|
||||
<xs:selector xpath="increment"/>
|
||||
<xs:field xpath="@name"/>
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="x" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="y" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="name" type="shortName"></xs:attribute>
|
||||
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="length" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="angle" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="curve1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="curve2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="lineColor" type="colors"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></xs:attribute>
|
||||
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="crossPoint" type="crossType"></xs:attribute>
|
||||
<xs:attribute name="vCrossPoint" type="crossType"></xs:attribute>
|
||||
<xs:attribute name="hCrossPoint" type="crossType"></xs:attribute>
|
||||
<xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="c2Radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="cRadius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="tangent" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="cCenter" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="name1" type="shortName"></xs:attribute>
|
||||
<xs:attribute name="mx1" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my1" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="name2" type="shortName"></xs:attribute>
|
||||
<xs:attribute name="mx2" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my2" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="dartP1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="dartP2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="dartP3" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="baseLineP1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="baseLineP2" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="lineColor" type="colors"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></xs:attribute>
|
||||
<xs:attribute name="length" type="xs:string"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="angle" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="length1" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="length2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="length1" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="length2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></xs:attribute>
|
||||
<xs:attribute name="duplicate" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="det" minOccurs="2" maxOccurs="2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="node" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="children" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"></xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="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:attribute name="readOnly" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\"]){1,1}([^*/^+\-=\s()?%:;!.,`'\"]){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="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:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="baseHeight">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<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="920"/>
|
||||
<xs:enumeration value="980"/>
|
||||
<xs:enumeration value="1040"/>
|
||||
<xs:enumeration value="1100"/>
|
||||
<xs:enumeration value="1160"/>
|
||||
<xs:enumeration value="1220"/>
|
||||
<xs:enumeration value="1280"/>
|
||||
<xs:enumeration value="1340"/>
|
||||
<xs:enumeration value="1400"/>
|
||||
<xs:enumeration value="1460"/>
|
||||
<xs:enumeration value="1520"/>
|
||||
<xs:enumeration value="1580"/>
|
||||
<xs:enumeration value="1640"/>
|
||||
<xs:enumeration value="1700"/>
|
||||
<xs:enumeration value="1760"/>
|
||||
<xs:enumeration value="1820"/>
|
||||
<xs:enumeration value="1880"/>
|
||||
<xs:enumeration value="1940"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="baseSize">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="22"/>
|
||||
<xs:enumeration value="24"/>
|
||||
<xs:enumeration value="26"/>
|
||||
<xs:enumeration value="28"/>
|
||||
<xs:enumeration value="30"/>
|
||||
<xs:enumeration value="32"/>
|
||||
<xs:enumeration value="34"/>
|
||||
<xs:enumeration value="36"/>
|
||||
<xs:enumeration value="38"/>
|
||||
<xs:enumeration value="40"/>
|
||||
<xs:enumeration value="42"/>
|
||||
<xs:enumeration value="44"/>
|
||||
<xs:enumeration value="46"/>
|
||||
<xs:enumeration value="48"/>
|
||||
<xs:enumeration value="50"/>
|
||||
<xs:enumeration value="52"/>
|
||||
<xs:enumeration value="54"/>
|
||||
<xs:enumeration value="56"/>
|
||||
<xs:enumeration value="220"/>
|
||||
<xs:enumeration value="240"/>
|
||||
<xs:enumeration value="260"/>
|
||||
<xs:enumeration value="280"/>
|
||||
<xs:enumeration value="300"/>
|
||||
<xs:enumeration value="320"/>
|
||||
<xs:enumeration value="340"/>
|
||||
<xs:enumeration value="360"/>
|
||||
<xs:enumeration value="380"/>
|
||||
<xs:enumeration value="400"/>
|
||||
<xs:enumeration value="420"/>
|
||||
<xs:enumeration value="440"/>
|
||||
<xs:enumeration value="460"/>
|
||||
<xs:enumeration value="480"/>
|
||||
<xs:enumeration value="500"/>
|
||||
<xs:enumeration value="520"/>
|
||||
<xs:enumeration value="540"/>
|
||||
<xs:enumeration value="560"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="crossType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="1"/>
|
||||
<xs:enumeration value="2"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
|
@ -39,6 +39,7 @@ const QString VAbstractPattern::TagDetails = QStringLiteral("details");
|
|||
const QString VAbstractPattern::TagAuthor = QStringLiteral("author");
|
||||
const QString VAbstractPattern::TagDescription = QStringLiteral("description");
|
||||
const QString VAbstractPattern::TagNotes = QStringLiteral("notes");
|
||||
const QString VAbstractPattern::TagImage = QStringLiteral("image");
|
||||
const QString VAbstractPattern::TagMeasurements = QStringLiteral("measurements");
|
||||
const QString VAbstractPattern::TagIncrements = QStringLiteral("increments");
|
||||
const QString VAbstractPattern::TagIncrement = QStringLiteral("increment");
|
||||
|
@ -916,6 +917,21 @@ void VAbstractPattern::SetNotes(const QString &text)
|
|||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetImage() const
|
||||
{
|
||||
return UniqueTagText(TagImage);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetImage(const QString &text)
|
||||
{
|
||||
CheckTagExists(TagImage);
|
||||
setTagText(TagImage, text);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetVersion() const
|
||||
{
|
||||
|
@ -988,7 +1004,8 @@ void VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
QDomNodeList list = elementsByTagName(tag);
|
||||
if (list.size() == 0)
|
||||
{
|
||||
QStringList tags = QStringList() << TagVersion << TagAuthor << TagDescription << TagNotes << TagGradation;
|
||||
QStringList tags = QStringList() << TagVersion << TagAuthor << TagDescription << TagNotes << TagImage
|
||||
<< TagGradation;
|
||||
QDomElement pattern = documentElement();
|
||||
switch (tags.indexOf(tag))
|
||||
{
|
||||
|
@ -1026,7 +1043,13 @@ void VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
SetVersion();
|
||||
break;
|
||||
}
|
||||
case 4: //TagGradation
|
||||
case 4: //TagImage
|
||||
{
|
||||
pattern.insertAfter(createElement(TagImage), elementsByTagName(TagVersion).at(0));
|
||||
SetVersion();
|
||||
break;
|
||||
}
|
||||
case 5: //TagGradation
|
||||
{
|
||||
QDomElement gradation = createElement(TagGradation);
|
||||
|
||||
|
|
|
@ -106,6 +106,9 @@ public:
|
|||
QString GetNotes() const;
|
||||
void SetNotes(const QString &text);
|
||||
|
||||
QString GetImage() const;
|
||||
void SetImage(const QString &text);
|
||||
|
||||
QString GetVersion() const;
|
||||
void SetVersion();
|
||||
|
||||
|
@ -120,6 +123,7 @@ public:
|
|||
static const QString TagDetails;
|
||||
static const QString TagAuthor;
|
||||
static const QString TagDescription;
|
||||
static const QString TagImage;
|
||||
static const QString TagNotes;
|
||||
static const QString TagMeasurements;
|
||||
static const QString TagIncrements;
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.7");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.7.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.8");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.8.xsd");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternConverter::VPatternConverter(const QString &fileName)
|
||||
|
@ -111,6 +111,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
case (0x000206):
|
||||
return QStringLiteral("://schema/pattern/v0.2.6.xsd");
|
||||
case (0x000207):
|
||||
return QStringLiteral("://schema/pattern/v0.2.7.xsd");
|
||||
case (0x000208):
|
||||
return CurrentSchema;
|
||||
default:
|
||||
InvalidVersion(ver);
|
||||
|
@ -210,6 +212,13 @@ void VPatternConverter::ApplyPatches()
|
|||
V_FALLTHROUGH
|
||||
}
|
||||
case (0x000207):
|
||||
{
|
||||
ToV0_2_8();
|
||||
const QString schema = XSDSchema(0x000208);
|
||||
ValidateXML(schema, fileName);
|
||||
V_FALLTHROUGH
|
||||
}
|
||||
case (0x000208):
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -331,6 +340,15 @@ void VPatternConverter::ToV0_2_7()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_2_8()
|
||||
{
|
||||
SetVersion(QStringLiteral("0.2.8"));
|
||||
QDomElement pattern = documentElement();
|
||||
pattern.insertAfter(createElement("image"), pattern.firstChildElement("notes"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
|
|
@ -68,6 +68,7 @@ private:
|
|||
void ToV0_2_5();
|
||||
void ToV0_2_6();
|
||||
void ToV0_2_7();
|
||||
void ToV0_2_8();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
|
Loading…
Reference in New Issue
Block a user