Saving to file works for simple point.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-09-17 19:52:18 +03:00
parent 2e8f113e3e
commit b01adfa388
54 changed files with 1478 additions and 232 deletions

View file

@ -988,18 +988,20 @@ void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my,
QString &typeLine, QString &lineColor)
bool &labelVisible, QString &typeLine, QString &lineColor)
{
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, labelVisible);
typeLine = GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = GetParametrString(domElement, AttrLineColor, ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my)
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my,
bool &labelVisible)
{
PointsCommonAttributes(domElement, id, mx, my);
name = GetParametrString(domElement, AttrName, "A");
labelVisible = GetParametrBool(domElement, AttrShowLabel, trueStr);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1259,12 +1261,14 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const qreal x = qApp->toPixel(GetParametrDouble(domElement, AttrX, "10.0"));
const qreal y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0"));
VPointF *point = new VPointF(x, y, name, mx, my);
point->SetShowLabel(showLabel);
spoint = VToolBasePoint::Create(id, nameActivPP, point, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
@ -1291,8 +1295,9 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1302,8 +1307,8 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
const QString angle = GetParametrString(domElement, AttrAngle, "0.0");
QString angleFix = angle;
VToolEndLine::Create(id, name, typeLine, lineColor, f, angleFix, basePointId, mx, my, scene, this, data,
parse, Source::FromFile);
VToolEndLine::Create(id, name, typeLine, lineColor, f, angleFix, basePointId, mx, my, showLabel, scene, this,
data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula || angleFix != angle)
{
@ -1341,14 +1346,15 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
VToolAlongLine::Create(id, name, typeLine, lineColor, f, firstPointId, secondPointId, mx, my, scene,
VToolAlongLine::Create(id, name, typeLine, lineColor, f, firstPointId, secondPointId, mx, my, showLabel, scene,
this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
@ -1386,16 +1392,17 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 p1Line = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
const quint32 p2Line = GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
const quint32 pShoulder = GetParametrUInt(domElement, AttrPShoulder, NULL_ID_STR);
VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, lineColor, name, mx, my, scene,
this, data, parse, Source::FromFile);
VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, lineColor, name, mx, my, showLabel,
scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1432,16 +1439,17 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
const qreal angle = GetParametrDouble(domElement, AttrAngle, "0.0");
VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, lineColor, name, angle, mx, my, scene,
this, data, parse, Source::FromFile);
VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, lineColor, name, angle, mx, my, showLabel,
scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1478,8 +1486,9 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
@ -1487,7 +1496,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
const quint32 thirdPointId = GetParametrUInt(domElement, AttrThirdPoint, NULL_ID_STR);
VToolBisector::Create(id, f, firstPointId, secondPointId, thirdPointId,
typeLine, lineColor, name, mx, my, scene, this, data, parse, Source::FromFile);
typeLine, lineColor, name, mx, my, showLabel, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1522,15 +1531,16 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 p1Line1Id = GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR);
const quint32 p2Line1Id = GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR);
const quint32 p1Line2Id = GetParametrUInt(domElement, AttrP1Line2, NULL_ID_STR);
const quint32 p2Line2Id = GetParametrUInt(domElement, AttrP2Line2, NULL_ID_STR);
VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name,
mx, my, scene, this, data, parse, Source::FromFile);
mx, my, showLabel, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -1552,15 +1562,16 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const QString radius = GetParametrString(domElement, AttrRadius, "0");
QString f = radius;//need for saving fixed formula;
const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
VToolPointOfContact::Create(id, f, center, firstPointId, secondPointId, name, mx, my, scene, this,
VToolPointOfContact::Create(id, f, center, firstPointId, secondPointId, name, mx, my, showLabel, scene, this,
data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != radius)
@ -1656,14 +1667,15 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
const quint32 p1LineId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
const quint32 p2LineId = GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
VToolHeight::Create(id, name, typeLine, lineColor, basePointId, p1LineId, p2LineId,
mx, my, scene, this, data, parse, Source::FromFile);
mx, my, showLabel, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -1685,14 +1697,15 @@ void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &d
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 axisP1Id = GetParametrUInt(domElement, AttrAxisP1, NULL_ID_STR);
const quint32 axisP2Id = GetParametrUInt(domElement, AttrAxisP2, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this,
VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, showLabel, scene, this,
data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
@ -1716,12 +1729,13 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data,
VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, showLabel, scene, this, data,
parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
@ -1744,13 +1758,14 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, NULL_ID_STR);
VToolCutSpline::Create(id, name, f, splineId, mx, my, scene, this, data, parse, Source::FromFile);
VToolCutSpline::Create(id, name, f, splineId, mx, my, showLabel, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1785,14 +1800,16 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath,
NULL_ID_STR);
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, scene, this, data, parse, Source::FromFile);
VToolCutSplinePath::Create(id, name, f, splinePathId, mx, my, showLabel, scene, this, data, parse,
Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1827,13 +1844,14 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
VToolCutArc::Create(id, name, f, arcId, mx, my, scene, this, data, parse, Source::FromFile);
VToolCutArc::Create(id, name, f, arcId, mx, my, showLabel, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1871,8 +1889,9 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
@ -1882,7 +1901,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
QString angleFix = angle;
VToolLineIntersectAxis::Create(id, name, typeLine, lineColor, angleFix, basePointId, firstPointId,
secondPointId, mx, my, scene, this, data, parse, Source::FromFile);
secondPointId, mx, my, showLabel, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (angleFix != angle)
{
@ -1922,8 +1941,9 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
qreal my = 0;
QString typeLine;
QString lineColor;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
const quint32 curveId = GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
@ -1931,7 +1951,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
QString angleFix = angle;
VToolCurveIntersectAxis::Create(id, name, typeLine, lineColor, angleFix, basePointId, curveId, mx, my,
scene, this, data, parse, Source::FromFile);
showLabel, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (angleFix != angle)
{
@ -1969,16 +1989,17 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 firstArcId = GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR);
const quint32 secondArcId = GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR);
const CrossCirclesPoint crossPoint = static_cast<CrossCirclesPoint>(GetParametrUInt(domElement,
AttrCrossPoint,
"1"));
VToolPointOfIntersectionArcs::Create(id, name, firstArcId, secondArcId, crossPoint, mx, my, scene, this,
data, parse, Source::FromFile);
VToolPointOfIntersectionArcs::Create(id, name, firstArcId, secondArcId, crossPoint, mx, my, showLabel, scene,
this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -2001,8 +2022,9 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 c1CenterId = GetParametrUInt(domElement, AttrC1Center, NULL_ID_STR);
const quint32 c2CenterId = GetParametrUInt(domElement, AttrC2Center, NULL_ID_STR);
const QString c1Radius = GetParametrString(domElement, AttrC1Radius);
@ -2013,7 +2035,7 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
AttrCrossPoint, "1"));
VToolPointOfIntersectionCircles::Create(id, name, c1CenterId, c2CenterId, c1R, c2R, crossPoint, mx, my,
scene, this, data, parse, Source::FromFile);
showLabel, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (c1R != c1Radius || c2R != c2Radius)
{
@ -2044,15 +2066,16 @@ void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDo
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const auto curve1Id = GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR);
const auto curve2Id = GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
const auto vCrossPoint = static_cast<VCrossCurvesPoint>(GetParametrUInt(domElement, AttrVCrossPoint, "1"));
const auto hCrossPoint = static_cast<HCrossCurvesPoint>(GetParametrUInt(domElement, AttrHCrossPoint, "1"));
VToolPointOfIntersectionCurves::Create(id, name, curve1Id, curve2Id, vCrossPoint, hCrossPoint, mx, my,
scene, this, data, parse, Source::FromFile);
showLabel, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -2075,8 +2098,9 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 cCenterId = GetParametrUInt(domElement, AttrCCenter, NULL_ID_STR);
const quint32 tangentId = GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
const QString cRadius = GetParametrString(domElement, AttrCRadius);
@ -2085,7 +2109,7 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo
AttrCrossPoint,
"1"));
VToolPointFromCircleAndTangent::Create(id, name, cCenterId, cR, tangentId, crossPoint, mx, my,
VToolPointFromCircleAndTangent::Create(id, name, cCenterId, cR, tangentId, crossPoint, mx, my, showLabel,
scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (cR != cRadius)
@ -2116,15 +2140,16 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
QString name;
qreal mx = 0;
qreal my = 0;
bool showLabel = true;
PointsCommonAttributes(domElement, id, name, mx, my);
PointsCommonAttributes(domElement, id, name, mx, my, showLabel);
const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
const quint32 tangentId = GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
const CrossCirclesPoint crossPoint = static_cast<CrossCirclesPoint>(GetParametrUInt(domElement,
AttrCrossPoint,
"1"));
VToolPointFromArcAndTangent::Create(id, name, arcId, tangentId, crossPoint, mx, my,
VToolPointFromArcAndTangent::Create(id, name, arcId, tangentId, crossPoint, mx, my, showLabel,
scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)

View file

@ -156,9 +156,9 @@ private:
void PrepareForParse(const Document &parse);
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
qreal &my, QString &typeLine, QString &lineColor);
qreal &my, bool &labelVisible, QString &typeLine, QString &lineColor);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
qreal &my);
qreal &my, bool &labelVisible);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool);

View file

@ -122,6 +122,7 @@ const QString AttrIdObject = QStringLiteral("idObject");
const QString AttrInLayout = QStringLiteral("inLayout");
const QString AttrRotationAngle = QStringLiteral("rotationAngle");
const QString AttrClosed = QStringLiteral("closed");
const QString AttrShowLabel = QStringLiteral("showLabel");
const QString TypeLineNone = QStringLiteral("none");
const QString TypeLineLine = QStringLiteral("hair");

View file

@ -141,6 +141,7 @@ extern const QString AttrSuffix;
extern const QString AttrIdObject;
extern const QString AttrInLayout;
extern const QString AttrClosed;
extern const QString AttrShowLabel;
extern const QString TypeLineNone;
extern const QString TypeLineLine;

View file

@ -37,6 +37,7 @@
<file>schema/pattern/v0.6.0.xsd</file>
<file>schema/pattern/v0.6.1.xsd</file>
<file>schema/pattern/v0.6.2.xsd</file>
<file>schema/pattern/v0.6.3.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,969 @@
<?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="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: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: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: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: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: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="9"/>
</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.2");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.2.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.3");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.3.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -246,6 +246,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000601):
return QStringLiteral("://schema/pattern/v0.6.1.xsd");
case (0x000602):
return QStringLiteral("://schema/pattern/v0.6.2.xsd");
case (0x000603):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -404,6 +406,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000602), m_convertedFileName);
V_FALLTHROUGH
case (0x000602):
ToV0_6_3();
ValidateXML(XSDSchema(0x000603), m_convertedFileName);
V_FALLTHROUGH
case (0x000603):
break;
default:
InvalidVersion(m_ver);
@ -422,7 +428,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, 2),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 3),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -846,6 +852,16 @@ void VPatternConverter::ToV0_6_2()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_6_3()
{
// TODO. Delete if minimal supported version is 0.6.3
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 3),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.6.3"));
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, 2);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 3);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -108,6 +108,7 @@ private:
void ToV0_6_0();
void ToV0_6_1();
void ToV0_6_2();
void ToV0_6_3();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View file

@ -106,7 +106,7 @@ VToolCutArc* VToolCutArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 arcId = dialogTool->getArcId();
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse,
VToolCutArc* point = Create(0, pointName, formula, arcId, 5, 10, true, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
@ -130,8 +130,8 @@ VToolCutArc* VToolCutArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, quint32 arcId,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(arcId);
@ -143,7 +143,10 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
auto a1 = QSharedPointer<VArc>(new VArc(arc1));
auto a2 = QSharedPointer<VArc>(new VArc(arc2));
if (typeCreation == Source::FromGui)

View file

@ -53,8 +53,8 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCutArc* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, quint32 arcId,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;

View file

@ -109,7 +109,7 @@ VToolCutSpline* VToolCutSpline::Create(QSharedPointer<DialogTool> dialog, VMainG
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 splineId = dialogTool->getSplineId();
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse,
VToolCutSpline* point = Create(0, pointName, formula, splineId, 5, 10, true, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
@ -134,7 +134,7 @@ VToolCutSpline* VToolCutSpline::Create(QSharedPointer<DialogTool> dialog, VMainG
* @param typeCreation way we create this tool.
*/
VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my,
quint32 splineId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -146,7 +146,10 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
auto spline1 = QSharedPointer<VAbstractBezier>(new VSpline(spl->GetP1(), spl1p2, spl1p3, *p));
auto spline2 = QSharedPointer<VAbstractBezier>(new VSpline(*p, spl2p2, spl2p3, spl->GetP4()));

View file

@ -54,7 +54,7 @@ public:
static VToolCutSpline *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splineId, const qreal &mx, const qreal &my,
quint32 splineId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);

View file

@ -113,7 +113,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(QSharedPointer<DialogTool> dialog
const QString pointName = dialogTool->getPointName();
QString formula = dialogTool->GetFormula();
const quint32 splinePathId = dialogTool->getSplinePathId();
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data,
VToolCutSplinePath* point = Create(0, pointName, formula, splinePathId, 5, 10, true, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -138,7 +138,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(QSharedPointer<DialogTool> dialog
* @param typeCreation way we create this tool.
*/
VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
quint32 splinePathId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
@ -151,6 +151,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
VSplinePath *splPath1 = nullptr;
VSplinePath *splPath2 = nullptr;
VPointF *p = VToolCutSplinePath::CutSplinePath(qApp->toPixel(result), splPath, pointName, &splPath1, &splPath2);
p->SetShowLabel(showLabel);
SCASSERT(splPath1 != nullptr)
SCASSERT(splPath2 != nullptr)

View file

@ -56,7 +56,7 @@ public:
static VToolCutSplinePath *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
const quint32 &splinePathId, const qreal &mx, const qreal &my,
quint32 splinePathId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;

View file

@ -251,7 +251,7 @@ VToolAlongLine* VToolAlongLine::Create(QSharedPointer<DialogTool> dialog, VMainG
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolAlongLine *point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId,
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
5, 10, true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -270,6 +270,7 @@ VToolAlongLine* VToolAlongLine::Create(QSharedPointer<DialogTool> dialog, VMainG
* @param secondPointId id second point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param showLabel show/hide label.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
@ -278,7 +279,7 @@ VToolAlongLine* VToolAlongLine::Create(QSharedPointer<DialogTool> dialog, VMainG
*/
VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
quint32 secondPointId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -295,15 +296,19 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
quint32 id = _id;
VPointF *p = new VPointF(line.p2(), pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject( new VPointF(line.p2(), pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);
}
else
{
data->UpdateGObject(id, new VPointF(line.p2(), pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);
if (parse != Document::FullParse)

View file

@ -55,7 +55,7 @@ public:
VAbstractPattern *doc, VContainer *data);
static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
quint32 secondPointId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);

View file

@ -156,7 +156,7 @@ VToolBisector* VToolBisector::Create(QSharedPointer<DialogTool> dialog, VMainGra
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolBisector *point = Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor,
pointName, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
pointName, 5, 10, true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -176,17 +176,17 @@ VToolBisector* VToolBisector::Create(QSharedPointer<DialogTool> dialog, VMainGra
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param showLabel show/hide label.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &lineColor, const QString &pointName, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data,
VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, quint32 firstPointId, quint32 secondPointId,
quint32 thirdPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
@ -198,14 +198,18 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
QPointF fPoint = VToolBisector::FindPoint(static_cast<QPointF>(*firstPoint), static_cast<QPointF>(*secondPoint),
static_cast<QPointF>(*thirdPoint), qApp->toPixel(result));
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(fPoint, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(secondPointId, id);
}
else
{
data->UpdateGObject(id, new VPointF(fPoint, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(secondPointId, id);
if (parse != Document::FullParse)
{

View file

@ -57,12 +57,11 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolBisector* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &lineColor, const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);
static VToolBisector* Create(const quint32 _id, QString &formula, quint32 firstPointId, quint32 secondPointId,
quint32 thirdPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Bisector)};

View file

@ -113,7 +113,8 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(QSharedPointer<DialogTo
const quint32 curveId = dialogTool->getCurveId();
VToolCurveIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId,
curveId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
curveId, 5, 10, true, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -124,11 +125,11 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(QSharedPointer<DialogTo
//---------------------------------------------------------------------------------------------------------------------
VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, const QString &pointName,
const QString &typeLine, const QString &lineColor,
QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const qreal &mx, const qreal &my,
QString &formulaAngle, quint32 basePointId,
quint32 curveId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data,
const Document &parse, const Source &typeCreation)
VContainer *data, const Document &parse,
const Source &typeCreation)
{
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
const qreal angle = CheckFormula(_id, formulaAngle, data);
@ -137,7 +138,10 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
const QPointF fPoint = FindPoint(static_cast<QPointF>(*basePoint), angle, curve);
const qreal segLength = curve->GetLengthByPoint(fPoint);
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(p);

View file

@ -56,8 +56,8 @@ public:
static VToolCurveIntersectAxis *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCurveIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const qreal &mx, const qreal &my,
const QString &lineColor, QString &formulaAngle, quint32 basePointId,
quint32 curveId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);

View file

@ -120,7 +120,7 @@ VToolEndLine* VToolEndLine::Create(QSharedPointer<DialogTool> dialog, VMainGraph
const quint32 basePointId = dialogTool->GetBasePointId();
VToolEndLine *point = Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle,
basePointId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
basePointId, 5, 10, true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -140,6 +140,7 @@ VToolEndLine* VToolEndLine::Create(QSharedPointer<DialogTool> dialog, VMainGraph
* @param basePointId id first point of line.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param showLabel show/hide label
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
@ -149,10 +150,9 @@ VToolEndLine* VToolEndLine::Create(QSharedPointer<DialogTool> dialog, VMainGraph
*/
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaLength, QString &formulaAngle,
const quint32 &basePointId, const qreal &mx, const qreal &my,
quint32 basePointId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
QLineF line = QLineF(static_cast<QPointF>(*basePoint), QPointF(basePoint->x()+100, basePoint->y()));
@ -160,14 +160,18 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
line.setAngle(CheckFormula(_id, formulaAngle, data)); //First set angle.
line.setLength(qApp->toPixel(CheckFormula(_id, formulaLength, data)));
quint32 id = _id;
VPointF *p = new VPointF(line.p2(), pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(line.p2(), pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(basePointId, id);
}
else
{
data->UpdateGObject(id, new VPointF(line.p2(), pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(basePointId, id);
if (parse != Document::FullParse)
{

View file

@ -57,7 +57,7 @@ public:
VContainer *data);
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaLength, QString &formulaAngle,
const quint32 &basePointId, const qreal &mx, const qreal &my,
quint32 basePointId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);

View file

@ -114,8 +114,8 @@ VToolHeight* VToolHeight::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
const quint32 p1LineId = dialogTool->GetP1LineId();
const quint32 p2LineId = dialogTool->GetP2LineId();
VToolHeight *point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
VToolHeight *point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, true, scene,
doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -142,8 +142,8 @@ VToolHeight* VToolHeight::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
* @return the created tool
*/
VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
const QString &lineColor, quint32 basePointId, quint32 p1LineId,
quint32 p2LineId, qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
@ -154,16 +154,20 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
QPointF pHeight = FindPoint(QLineF(static_cast<QPointF>(*p1Line), static_cast<QPointF>(*p2Line)),
static_cast<QPointF>(*basePoint));
quint32 id = _id;
VPointF *p = new VPointF(pHeight, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(pHeight, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(basePointId, id);
data->AddLine(p1LineId, id);
data->AddLine(p2LineId, id);
}
else
{
data->UpdateGObject(id, new VPointF(pHeight, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(basePointId, id);
data->AddLine(p1LineId, id);
data->AddLine(p2LineId, id);

View file

@ -56,8 +56,8 @@ public:
static VToolHeight *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolHeight *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
const QString &lineColor, quint32 basePointId, quint32 p1LineId,
quint32 p2LineId, qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const QLineF &line, const QPointF &point);

View file

@ -100,7 +100,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(QSharedPointer<DialogTool
const quint32 secondPointId = dialogTool->GetSecondPointId();
VToolLineIntersectAxis *point = Create(0, pointName, typeLine, lineColor, formulaAngle,
basePointId, firstPointId, secondPointId, 5, 10,
basePointId, firstPointId, secondPointId, 5, 10, true,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -112,9 +112,9 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(QSharedPointer<DialogTool
//---------------------------------------------------------------------------------------------------------------------
VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const QString &pointName,
const QString &typeLine, const QString &lineColor,
QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
QString &formulaAngle, quint32 basePointId,
quint32 firstPointId, quint32 secondPointId,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
@ -128,16 +128,20 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
QPointF fPoint = FindPoint(axis, line);
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(fPoint, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(basePointId, id);
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);
}
else
{
data->UpdateGObject(id, new VPointF(fPoint, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(basePointId, id);
data->AddLine(firstPointId, id);
data->AddLine(id, secondPointId);

View file

@ -56,9 +56,9 @@ public:
static VToolLineIntersectAxis *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolLineIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
const QString &lineColor, QString &formulaAngle, quint32 basePointId,
quint32 firstPointId, quint32 secondPointId,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);

View file

@ -121,7 +121,7 @@ VToolNormal* VToolNormal::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
const QString pointName = dialogTool->getPointName();
const qreal angle = dialogTool->GetAngle();
VToolNormal *point = Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10,
scene, doc, data, Document::FullParse, Source::FromGui);
true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -141,18 +141,18 @@ VToolNormal* VToolNormal::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
* @param angle additional angle.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param showLabel show/hide label.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal angle, const qreal &mx, const qreal &my,
VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, quint32 firstPointId, quint32 secondPointId,
const QString &typeLine, const QString &lineColor,
const QString &pointName, qreal angle, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
@ -162,14 +162,18 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
QPointF fPoint = VToolNormal::FindPoint(static_cast<QPointF>(*firstPoint), static_cast<QPointF>(*secondPoint),
qApp->toPixel(result), angle);
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(fPoint, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(firstPointId, id);
}
else
{
data->UpdateGObject(id, new VPointF(fPoint, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(firstPointId, id);
if (parse != Document::FullParse)
{

View file

@ -54,12 +54,11 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolNormal* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolNormal* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal angle, const qreal &mx, const qreal &my,
static VToolNormal* Create(const quint32 _id, QString &formula, quint32 firstPointId,
quint32 secondPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal angle, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);
const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle = 0);
static const QString ToolType;

View file

@ -170,7 +170,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(QSharedPointer<DialogTool> dialog
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolShoulderPoint * point = Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5,
10, scene, doc, data, Document::FullParse, Source::FromGui);
10, true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -190,6 +190,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(QSharedPointer<DialogTool> dialog
* @param pointName point name.
* @param mx label bias x axis.
* @param my label bias y axis.
* @param showLabel show/hide label.
* @param scene pointer to scene.
* @param doc dom document container.
* @param data container with variables.
@ -197,11 +198,11 @@ VToolShoulderPoint* VToolShoulderPoint::Create(QSharedPointer<DialogTool> dialog
* @param typeCreation way we create this tool.
* @return the created tool
*/
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
const QString &lineColor, const QString &pointName, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, quint32 p1Line, quint32 p2Line,
quint32 pShoulder, const QString &typeLine, const QString &lineColor,
const QString &pointName, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(p1Line);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(p2Line);
@ -213,15 +214,19 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
static_cast<QPointF>(*secondPoint),
static_cast<QPointF>(*shoulderPoint), qApp->toPixel(result));
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(fPoint, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(p1Line, id);
data->AddLine(p2Line, id);
}
else
{
data->UpdateGObject(id, new VPointF(fPoint, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(p1Line, id);
data->AddLine(p2Line, id);
if (parse != Document::FullParse)

View file

@ -57,9 +57,9 @@ public:
const qreal &length);
static VToolShoulderPoint* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolShoulderPoint* Create(const quint32 _id, QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal &mx, const qreal &my,
static VToolShoulderPoint* Create(const quint32 _id, QString &formula, quint32 p1Line, quint32 p2Line,
quint32 pShoulder, const QString &typeLine, const QString &lineColor,
const QString &pointName, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);

View file

@ -115,8 +115,8 @@ VToolLineIntersect* VToolLineIntersect::Create(QSharedPointer<DialogTool> dialog
const quint32 p1Line2Id = dialogTool->GetP1Line2();
const quint32 p2Line2Id = dialogTool->GetP2Line2();
const QString pointName = dialogTool->getPointName();
VToolLineIntersect* point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
VToolLineIntersect* point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, true, scene,
doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -142,11 +142,11 @@ VToolLineIntersect* VToolLineIntersect::Create(QSharedPointer<DialogTool> dialog
* @param typeCreation way we create this tool.
* @return the created tool
*/
VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id,
const quint32 &p1Line2Id, const quint32 &p2Line2Id,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, quint32 p1Line1Id, quint32 p2Line1Id,
quint32 p1Line2Id, quint32 p2Line2Id, const QString &pointName,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
const QSharedPointer<VPointF> p1Line1 = data->GeometricObject<VPointF>(p1Line1Id);
const QSharedPointer<VPointF> p2Line1 = data->GeometricObject<VPointF>(p2Line1Id);
@ -160,9 +160,13 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
{
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(fPoint, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(p1Line1Id, id);
data->AddLine(id, p2Line1Id);
data->AddLine(p1Line2Id, id);
@ -170,7 +174,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
}
else
{
data->UpdateGObject(id, new VPointF(fPoint, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(p1Line1Id, id);
data->AddLine(id, p2Line1Id);
data->AddLine(p1Line2Id, id);

View file

@ -53,9 +53,9 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolLineIntersect *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolLineIntersect *Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id,
const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
static VToolLineIntersect *Create(const quint32 _id, quint32 p1Line1Id, quint32 p2Line1Id,
quint32 p1Line2Id, quint32 p2Line2Id, const QString &pointName,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType;

View file

@ -89,7 +89,7 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(QSharedPointer<
const quint32 tangentPointId = dialogTool->GetTangentPointId();
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
const QString pointName = dialogTool->getPointName();
VToolPointFromArcAndTangent *point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, scene, doc,
VToolPointFromArcAndTangent *point = Create(0, pointName, arcId, tangentPointId, pType, 5, 10, true, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -101,8 +101,8 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(QSharedPointer<
//---------------------------------------------------------------------------------------------------------------------
VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _id, const QString &pointName,
quint32 arcId, quint32 tangentPointId,
CrossCirclesPoint crossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene,
CrossCirclesPoint crossPoint, qreal mx,
qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -111,13 +111,17 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _
const QPointF point = VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(tPoint), &arc, crossPoint);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -52,9 +52,10 @@ public:
static VToolPointFromArcAndTangent *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointFromArcAndTangent *Create(const quint32 _id, const QString &pointName, quint32 arcId,
quint32 tangentPointId, CrossCirclesPoint crossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
quint32 tangentPointId, CrossCirclesPoint crossPoint, qreal mx,
qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const QPointF &p, const VArc *arc, const CrossCirclesPoint pType);
static const QString ToolType;
virtual int type() const Q_DECL_OVERRIDE {return Type;}

View file

@ -95,7 +95,7 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(QSharedPo
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
const QString pointName = dialogTool->getPointName();
VToolPointFromCircleAndTangent *point = Create(0, pointName, circleCenterId, circleRadius, tangentPointId, pType,
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
5, 10, true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -107,8 +107,9 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(QSharedPo
VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const quint32 _id, const QString &pointName,
quint32 circleCenterId, QString &circleRadius,
quint32 tangentPointId,
CrossCirclesPoint crossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene,
CrossCirclesPoint crossPoint, qreal mx,
qreal my, bool showLabel,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
@ -120,13 +121,17 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const qui
const QPointF point = VToolPointFromCircleAndTangent::FindPoint(static_cast<QPointF>(tPoint),
static_cast<QPointF>(cPoint), radius, crossPoint);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -54,7 +54,7 @@ public:
VAbstractPattern *doc, VContainer *data);
static VToolPointFromCircleAndTangent *Create(const quint32 _id, const QString &pointName,
quint32 circleCenterId, QString &circleRadius, quint32 tangentPointId,
CrossCirclesPoint crossPoint, const qreal &mx, const qreal &my,
CrossCirclesPoint crossPoint, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QPointF &p, const QPointF &center, qreal radius, const CrossCirclesPoint crossPoint);

View file

@ -175,8 +175,8 @@ VToolPointOfContact* VToolPointOfContact::Create(QSharedPointer<DialogTool> dial
const quint32 firstPointId = dialogTool->GetFirstPoint();
const quint32 secondPointId = dialogTool->GetSecondPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfContact *point = Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
VToolPointOfContact *point = Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, true, scene,
doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -201,9 +201,9 @@ VToolPointOfContact* VToolPointOfContact::Create(QSharedPointer<DialogTool> dial
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId,
const QString &pointName, const qreal &mx, const qreal &my,
VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &radius, quint32 center,
quint32 firstPointId, quint32 secondPointId,
const QString &pointName, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -216,16 +216,20 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), static_cast<QPointF>(*centerP),
static_cast<QPointF>(*firstP), static_cast<QPointF>(*secondP));
quint32 id = _id;
VPointF *p = new VPointF(fPoint, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(fPoint, pointName, mx, my));
id = data->AddGObject(p);
data->AddLine(firstPointId, id);
data->AddLine(secondPointId, id);
data->AddLine(center, id);
}
else
{
data->UpdateGObject(id, new VPointF(fPoint, pointName, mx, my));
data->UpdateGObject(id, p);
data->AddLine(firstPointId, id);
data->AddLine(secondPointId, id);
data->AddLine(center, id);

View file

@ -57,10 +57,10 @@ public:
const QPointF &secondPoint);
static VToolPointOfContact* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfContact* Create(const quint32 _id, QString &radius, const quint32 &center,
const quint32 &firstPointId, const quint32 &secondPointId,
static VToolPointOfContact* Create(const quint32 _id, QString &radius, quint32 center,
quint32 firstPointId, quint32 secondPointId,
const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
static const QString ToolType;

View file

@ -105,7 +105,7 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(QSharedPointer<Dialog
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersection *point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc,
VToolPointOfIntersection *point = Create(0, pointName, firstPointId, secondPointId, 5, 10, true, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -131,24 +131,27 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(QSharedPointer<Dialog
* @return the created tool
*/
VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName,
const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
quint32 firstPointId, quint32 secondPointId, qreal mx,
qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
QPointF point(firstPoint->x(), secondPoint->y());
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -53,8 +53,8 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersection *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersection *Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
static VToolPointOfIntersection *Create(const quint32 _id, const QString &pointName, quint32 firstPointId,
quint32 secondPointId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;

View file

@ -89,7 +89,7 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(QSharedPointe
const quint32 secondArcId = dialogTool->GetSecondArcId();
const CrossCirclesPoint pType = dialogTool->GetCrossArcPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersectionArcs *point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc,
VToolPointOfIntersectionArcs *point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, true, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -100,25 +100,28 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(QSharedPointe
//---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32 _id, const QString &pointName,
const quint32 &firstArcId,
const quint32 &secondArcId, CrossCirclesPoint pType,
const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse,
const Source &typeCreation)
quint32 firstArcId, quint32 secondArcId,
CrossCirclesPoint pType, qreal mx, qreal my,
bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VArc> firstArc = data->GeometricObject<VArc>(firstArcId);
const QSharedPointer<VArc> secondArc = data->GeometricObject<VArc>(secondArcId);
const QPointF point = FindPoint(firstArc.data(), secondArc.data(), pType);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -52,9 +52,9 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolPointOfIntersectionArcs *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolPointOfIntersectionArcs *Create(const quint32 _id, const QString &pointName, const quint32 &firstArcId,
const quint32 &secondArcId, CrossCirclesPoint pType,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
static VToolPointOfIntersectionArcs *Create(const quint32 _id, const QString &pointName, quint32 firstArcId,
quint32 secondArcId, CrossCirclesPoint pType,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const VArc *arc1, const VArc *arc2, const CrossCirclesPoint pType);

View file

@ -103,8 +103,8 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(QShared
const CrossCirclesPoint pType = dialogTool->GetCrossCirclesPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersectionCircles *point = Create(0, pointName, firstCircleCenterId, secondCircleCenterId,
firstCircleRadius, secondCircleRadius, pType, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
firstCircleRadius, secondCircleRadius, pType, 5, 10, true, scene,
doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -118,8 +118,9 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const q
quint32 secondCircleCenterId,
QString &firstCircleRadius,
QString &secondCircleRadius,
CrossCirclesPoint crossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene,
CrossCirclesPoint crossPoint, qreal mx,
qreal my, bool showLabel,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
@ -133,13 +134,17 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const q
const QPointF point = FindPoint(static_cast<QPointF>(c1Point), static_cast<QPointF>(c2Point), calcC1Radius,
calcC2Radius, crossPoint);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -56,7 +56,7 @@ public:
quint32 firstCircleCenterId, quint32 secondCircleCenterId,
QString &firstCircleRadius, QString &secondCircleRadius,
CrossCirclesPoint crossPoint,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const QPointF &c1Point, const QPointF &c2Point, qreal c1Radius, qreal c2Radius,

View file

@ -97,7 +97,7 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(QSharedPo
const HCrossCurvesPoint hCrossPoint = dialogTool->GetHCrossPoint();
const QString pointName = dialogTool->getPointName();
VToolPointOfIntersectionCurves *point = Create(0, pointName, firstCurveId, secondCurveId, vCrossPoint, hCrossPoint,
5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
5, 10, true, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -109,8 +109,9 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(QSharedPo
VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const quint32 _id, const QString &pointName,
quint32 firstCurveId, quint32 secondCurveId,
VCrossCurvesPoint vCrossPoint,
HCrossCurvesPoint hCrossPoint, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene,
HCrossCurvesPoint hCrossPoint,qreal mx,
qreal my, bool showLabel,
VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation)
@ -121,13 +122,17 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const qui
const QPointF point = VToolPointOfIntersectionCurves::FindPoint(curve1->GetPoints(), curve2->GetPoints(),
vCrossPoint, hCrossPoint);
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -55,7 +55,7 @@ public:
static VToolPointOfIntersectionCurves *Create(const quint32 _id, const QString &pointName,
quint32 firstCurveId, quint32 secondCurveId,
VCrossCurvesPoint vCrossPoint, HCrossCurvesPoint hCrossPoint,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const QVector<QPointF> &curve1Points, const QVector<QPointF> &curve2Points,

View file

@ -44,6 +44,7 @@
#include <new>
#include "../../../../undocommands/label/movelabel.h"
#include "../../../../undocommands/label/showlabel.h"
#include "../ifc/exception/vexception.h"
#include "../ifc/exception/vexceptionbadid.h"
#include "../ifc/ifcdef.h"
@ -310,6 +311,16 @@ void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &o
doc->SetAttribute(tag, AttrName, point->name());
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
doc->SetAttribute(tag, AttrShowLabel, point->IsShowLabel());
}
//---------------------------------------------------------------------------------------------------------------------
void VToolSinglePoint::ChangeLabelVisibility(quint32 id, bool visible)
{
if (id == m_id)
{
qApp->getUndoStack()->push(new ShowLabel(doc, id, visible));
}
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -88,6 +88,7 @@ protected:
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void ChangeLabelVisibility(quint32 id, bool visible);
private:
Q_DISABLE_COPY(VToolSinglePoint)
};

View file

@ -114,7 +114,7 @@ VToolTriangle* VToolTriangle::Create(QSharedPointer<DialogTool> dialog, VMainGra
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString pointName = dialogTool->getPointName();
VToolTriangle* point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10,
VToolTriangle* point = Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, true,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -141,9 +141,9 @@ VToolTriangle* VToolTriangle::Create(QSharedPointer<DialogTool> dialog, VMainGra
* @param typeCreation way we create this tool.
* @return the created tool
*/
VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName, quint32 axisP1Id, quint32 axisP2Id,
quint32 firstPointId, quint32 secondPointId, qreal mx, qreal my, bool showLabel,
VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> axisP1 = data->GeometricObject<VPointF>(axisP1Id);
@ -154,13 +154,17 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
QPointF point = FindPoint(static_cast<QPointF>(*axisP1), static_cast<QPointF>(*axisP2),
static_cast<QPointF>(*firstPoint), static_cast<QPointF>(*secondPoint));
quint32 id = _id;
VPointF *p = new VPointF(point, pointName, mx, my);
p->SetShowLabel(showLabel);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p);
}
else
{
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);

View file

@ -55,9 +55,9 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolTriangle *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolTriangle *Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id,
const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VAbstractPattern *doc,
static VToolTriangle *Create(const quint32 _id, const QString &pointName, quint32 axisP1Id,
quint32 axisP2Id, quint32 firstPointId, quint32 secondPointId,
qreal mx, qreal my, bool showLabel, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint,
const QPointF &secondPoint);

View file

@ -82,7 +82,6 @@ public slots:
virtual void DetailsMode(bool mode);
protected slots:
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID)=0;
virtual void ChangeLabelVisibility(quint32 id, bool visible);
protected:
enum class RemoveOption : bool {Disable = false, Enable = true};
@ -108,6 +107,7 @@ protected:
void ReadAttributes();
virtual void ReadToolAttributes(const QDomElement &domElement)=0;
virtual void ChangeLabelVisibility(quint32 id, bool visible);
template <typename Dialog>
void ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemId,
@ -151,16 +151,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
QAction *actionShowLabel = menu.addAction(tr("Show label"));
actionShowLabel->setCheckable(true);
try
{
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(itemId);
actionShowLabel->setChecked(point->IsShowLabel());
}
catch(const VExceptionBadId &)
{
actionShowLabel->setVisible(false);
}
actionShowLabel->setChecked(IsLabelVisible(itemId));
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
if (showRemove == RemoveOption::Enable)
@ -213,7 +204,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
}
else if (selectedAction == actionShowLabel)
{
SetLabelVisible(itemId, selectedAction->isChecked());
ChangeLabelVisibility(itemId, selectedAction->isChecked());
}
}

View file

@ -0,0 +1,95 @@
/************************************************************************
**
** @file
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 17 9, 2017
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2017 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "showlabel.h"
#include <QDomElement>
#include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/logging.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "../vmisc/vabstractapplication.h"
#include "../vtools/tools/drawTools/vdrawtool.h"
//---------------------------------------------------------------------------------------------------------------------
ShowLabel::ShowLabel(VAbstractPattern *doc, quint32 id, bool visible, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent),
m_visible(visible),
m_oldVisible(true),
m_scene(qApp->getCurrentScene())
{
setText(tr("toggle label"));
nodeId = id;
QDomElement domElement = doc->elementById(nodeId, VAbstractPattern::TagPoint);
if (domElement.isElement())
{
m_oldVisible = doc->GetParametrBool(domElement, AttrShowLabel, trueStr);
}
else
{
qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
}
}
//---------------------------------------------------------------------------------------------------------------------
void ShowLabel::undo()
{
qCDebug(vUndo, "Undo.");
Do(m_oldVisible);
}
//---------------------------------------------------------------------------------------------------------------------
void ShowLabel::redo()
{
qCDebug(vUndo, "Redo.");
Do(m_visible);
}
//---------------------------------------------------------------------------------------------------------------------
void ShowLabel::Do(bool visible)
{
QDomElement domElement = doc->elementById(nodeId, VAbstractPattern::TagPoint);
if (domElement.isElement())
{
doc->SetAttribute(domElement, AttrShowLabel, QString().setNum(visible));
VMainGraphicsView::NewSceneRect(m_scene, qApp->getSceneView());
if (VDrawTool *tool = qobject_cast<VDrawTool *>(VAbstractPattern::getTool(nodeId)))
{
tool->SetLabelVisible(nodeId, visible);
}
}
else
{
qCDebug(vUndo, "Can't find point with id = %u.", nodeId);
}
}

View file

@ -0,0 +1,55 @@
/************************************************************************
**
** @file
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 17 9, 2017
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2017 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef SHOWLABEL_H
#define SHOWLABEL_H
#include "../vundocommand.h"
class QGraphicsScene;
class ShowLabel : public VUndoCommand
{
public:
ShowLabel(VAbstractPattern *doc, quint32 id, bool visible,
QUndoCommand *parent = nullptr);
virtual ~ShowLabel()=default;
virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(ShowLabel)
bool m_visible;
bool m_oldVisible;
//Need for resizing scene rect
QGraphicsScene *m_scene;
void Do(bool visible);
};
#endif // SHOWLABEL_H

View file

@ -24,7 +24,8 @@ HEADERS += \
$$PWD/movepiece.h \
$$PWD/savepieceoptions.h \
$$PWD/togglepieceinlayout.h \
$$PWD/savepiecepathoptions.h
$$PWD/savepiecepathoptions.h \
$$PWD/label/showlabel.h
SOURCES += \
$$PWD/addtocalc.cpp \
@ -49,4 +50,5 @@ SOURCES += \
$$PWD/movepiece.cpp \
$$PWD/savepieceoptions.cpp \
$$PWD/togglepieceinlayout.cpp \
$$PWD/savepiecepathoptions.cpp
$$PWD/savepiecepathoptions.cpp \
$$PWD/label/showlabel.cpp