Resolved issue #807. Issue with "Intersection" passmark.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-02-04 12:35:27 +02:00
parent be8207d46b
commit 72d832c93a
12 changed files with 1313 additions and 39 deletions

View File

@ -42,6 +42,7 @@
- [#732] Tape app. Improve Database dialog.
- [#804] New feature. Import measurements from CSV file in Tape app.
- [#414] Add features from Qt Windows Extras.
- [#807] Issue with "Intersection" passmark.
# Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.

View File

@ -47,6 +47,7 @@
<file>schema/pattern/v0.7.3.xsd</file>
<file>schema/pattern/v0.7.4.xsd</file>
<file>schema/pattern/v0.7.5.xsd</file>
<file>schema/pattern/v0.7.6.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_measurements/v0.4.1.xsd</file>

File diff suppressed because it is too large Load Diff

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.5");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.5.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.6");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.6.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -221,7 +221,8 @@ QString VPatternConverter::XSDSchema(int ver) const
std::make_pair(0x000702, QStringLiteral("://schema/pattern/v0.7.2.xsd")),
std::make_pair(0x000703, QStringLiteral("://schema/pattern/v0.7.3.xsd")),
std::make_pair(0x000704, QStringLiteral("://schema/pattern/v0.7.4.xsd")),
std::make_pair(0x000705, CurrentSchema)
std::make_pair(0x000705, QStringLiteral("://schema/pattern/v0.7.5.xsd")),
std::make_pair(0x000706, CurrentSchema)
};
if (schemas.contains(ver))
@ -424,6 +425,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000705), m_convertedFileName);
V_FALLTHROUGH
case (0x000705):
ToV0_7_6();
ValidateXML(XSDSchema(0x000706), m_convertedFileName);
V_FALLTHROUGH
case (0x000706):
break;
default:
InvalidVersion(m_ver);
@ -441,7 +446,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, 7, 5),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 6),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -965,6 +970,16 @@ void VPatternConverter::ToV0_7_5()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_7_6()
{
// TODO. Delete if minimal supported version is 0.7.6
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 6),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.7.6"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

View File

@ -53,7 +53,7 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 5);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 6);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -118,6 +118,7 @@ private:
void ToV0_7_3();
void ToV0_7_4();
void ToV0_7_5();
void ToV0_7_6();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -674,6 +674,9 @@ const QString strBisector = QStringLiteral("bisector");
const QString strIntersection = QStringLiteral("intersection");
const QString strIntersectionOnlyLeft = QStringLiteral("intersectionLeft");
const QString strIntersectionOnlyRight = QStringLiteral("intersectionRight");
const QString strIntersection2 = QStringLiteral("intersection2");
const QString strIntersection2OnlyLeft = QStringLiteral("intersection2Left");
const QString strIntersection2OnlyRight = QStringLiteral("intersection2Right");
//---------------------------------------------------------------------------------------------------------------------
QString PassmarkAngleTypeToString(PassmarkAngleType type)
@ -690,6 +693,12 @@ QString PassmarkAngleTypeToString(PassmarkAngleType type)
return strIntersectionOnlyLeft;
case PassmarkAngleType::IntersectionOnlyRight:
return strIntersectionOnlyRight;
case PassmarkAngleType::Intersection2:
return strIntersection2;
case PassmarkAngleType::Intersection2OnlyLeft:
return strIntersection2OnlyLeft;
case PassmarkAngleType::Intersection2OnlyRight:
return strIntersection2OnlyRight;
default:
break;
}
@ -704,7 +713,10 @@ PassmarkAngleType StringToPassmarkAngleType(const QString &value)
<< strBisector
<< strIntersection
<< strIntersectionOnlyLeft
<< strIntersectionOnlyRight;
<< strIntersectionOnlyRight
<< strIntersection2
<< strIntersection2OnlyLeft
<< strIntersection2OnlyRight;
switch(values.indexOf(value))
{
@ -718,6 +730,12 @@ PassmarkAngleType StringToPassmarkAngleType(const QString &value)
return PassmarkAngleType::IntersectionOnlyLeft;
case 4:
return PassmarkAngleType::IntersectionOnlyRight;
case 5:
return PassmarkAngleType::Intersection2;
case 6:
return PassmarkAngleType::Intersection2OnlyLeft;
case 7:
return PassmarkAngleType::Intersection2OnlyRight;
default:
break;
}

View File

@ -96,7 +96,10 @@ enum class PassmarkAngleType : unsigned char
Bisector,
Intersection,
IntersectionOnlyLeft,
IntersectionOnlyRight
IntersectionOnlyRight,
Intersection2,
Intersection2OnlyLeft,
Intersection2OnlyRight
};
QString PassmarkAngleTypeToString(PassmarkAngleType type);
@ -407,6 +410,9 @@ extern const QString strBisector;
extern const QString strIntersection;
extern const QString strIntersectionOnlyLeft;
extern const QString strIntersectionOnlyRight;
extern const QString strIntersection2;
extern const QString strIntersection2OnlyLeft;
extern const QString strIntersection2OnlyRight;
extern const QString unitMM;
extern const QString unitCM;

View File

@ -205,7 +205,10 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
if (angleType == PassmarkAngleType::Straightforward
|| angleType == PassmarkAngleType::Intersection
|| angleType == PassmarkAngleType::IntersectionOnlyLeft
|| angleType == PassmarkAngleType::IntersectionOnlyRight)
|| angleType == PassmarkAngleType::IntersectionOnlyRight
|| angleType == PassmarkAngleType::Intersection2
|| angleType == PassmarkAngleType::Intersection2OnlyLeft
|| angleType == PassmarkAngleType::Intersection2OnlyRight)
{
switch (lineType)
{
@ -1191,6 +1194,9 @@ QVector<QLineF> VPiece::CreatePassmark(const QVector<VPieceNode> &path, int prev
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::IntersectionOnlyLeft
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::IntersectionOnlyRight
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection2
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection2OnlyLeft
&& path.at(passmarkIndex).GetPassmarkAngleType() != PassmarkAngleType::Intersection2OnlyRight
&& path.at(passmarkIndex).IsShowSecondPassmark())
{
lines += BuiltInSAPassmark(path, previousSAPoint, passmarkSAPoint, nextSAPoint, data, passmarkIndex);
@ -1221,6 +1227,22 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
qreal passmarkLength = VAbstractPiece::MaxLocalSA(passmarkSAPoint, width) * passmarkFactor;
passmarkLength = qMin(passmarkLength, maxPassmarkLength);
const VPieceNode &node = path.at(passmarkIndex);
auto PassmarkIntersection = [&passmarksLines, passmarkSAPoint, node](QLineF line,
const QVector<QPointF> &seamPoints, qreal width)
{
line.setLength(line.length()*100); // Hope 100 is enough
const QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamPoints, line);
if (not intersections.isEmpty())
{
line = QLineF(intersections.last(), passmarkSAPoint);
line.setLength(qMin(width * passmarkFactor, maxPassmarkLength));
passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line);
}
};
if (node.GetPassmarkAngleType() == PassmarkAngleType::Straightforward)
{
QLineF line = QLineF(seamPassmarkSAPoint, passmarkSAPoint);
@ -1251,39 +1273,41 @@ QVector<QLineF> VPiece::SAPassmark(const QVector<VPieceNode> &path, VSAPoint &pr
|| node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyRight)
{
// first passmark
QLineF line(previousSAPoint, passmarkSAPoint);
line.setLength(line.length()*100); // Hope 100 is enough
const QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamPoints, line);
if (intersections.isEmpty())
{
return QVector<QLineF>(); // Something wrong
}
line = QLineF(intersections.first(), passmarkSAPoint);
line.setLength(qMin(passmarkSAPoint.GetSAAfter(width) * passmarkFactor, maxPassmarkLength));
passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line);
PassmarkIntersection(QLineF(previousSAPoint, passmarkSAPoint), seamPoints,
passmarkSAPoint.GetSAAfter(width));
}
if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection
|| node.GetPassmarkAngleType() == PassmarkAngleType::IntersectionOnlyLeft)
{
// second passmark
QLineF line(nextSAPoint, passmarkSAPoint);
line.setLength(line.length()*100); // Hope 100 is enough
const QVector<QPointF> intersections = VAbstractCurve::CurveIntersectLine(seamPoints, line);
if (intersections.isEmpty())
PassmarkIntersection(QLineF(nextSAPoint, passmarkSAPoint), seamPoints,
passmarkSAPoint.GetSABefore(width));
}
}
else if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyLeft
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight)
{
return QVector<QLineF>(); // Something wrong
QVector<QPointF> seamPoints;
seamAllowance.isEmpty() ? seamPoints = SeamAllowancePoints(data) : seamPoints = seamAllowance;
if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyRight)
{
// first passmark
QLineF line(passmarkSAPoint, nextSAPoint);
line.setAngle(line.angle()+90);
PassmarkIntersection(line, seamPoints, passmarkSAPoint.GetSAAfter(width));
}
line = QLineF(intersections.last(), passmarkSAPoint);
line.setLength(qMin(passmarkSAPoint.GetSABefore(width) * passmarkFactor, maxPassmarkLength));
passmarksLines += CreatePassmarkLines(node.GetPassmarkLineType(), node.GetPassmarkAngleType(), line);
if (node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2
|| node.GetPassmarkAngleType() == PassmarkAngleType::Intersection2OnlyLeft)
{
// second passmark
QLineF line(passmarkSAPoint, previousSAPoint);
line.setAngle(line.angle()-90);
PassmarkIntersection(line, seamPoints, passmarkSAPoint.GetSABefore(width));
}
}

View File

@ -430,6 +430,9 @@ void DialogPiecePath::PassmarkChanged(int index)
ui->radioButtonIntersection->setDisabled(true);
ui->radioButtonIntersectionOnlyLeft->setDisabled(true);
ui->radioButtonIntersectionOnlyRight->setDisabled(true);
ui->radioButtonIntersection2->setDisabled(true);
ui->radioButtonIntersection2OnlyLeft->setDisabled(true);
ui->radioButtonIntersection2OnlyRight->setDisabled(true);
ui->groupBoxMarkType->blockSignals(true);
ui->groupBoxAngleType->blockSignals(true);
@ -476,6 +479,9 @@ void DialogPiecePath::PassmarkChanged(int index)
ui->radioButtonIntersection->setEnabled(true);
ui->radioButtonIntersectionOnlyLeft->setEnabled(true);
ui->radioButtonIntersectionOnlyRight->setEnabled(true);
ui->radioButtonIntersection2->setEnabled(true);
ui->radioButtonIntersection2OnlyLeft->setEnabled(true);
ui->radioButtonIntersection2OnlyRight->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
@ -494,6 +500,15 @@ void DialogPiecePath::PassmarkChanged(int index)
case PassmarkAngleType::IntersectionOnlyRight:
ui->radioButtonIntersectionOnlyRight->setChecked(true);
break;
case PassmarkAngleType::Intersection2:
ui->radioButtonIntersection2->setChecked(true);
break;
case PassmarkAngleType::Intersection2OnlyLeft:
ui->radioButtonIntersection2OnlyLeft->setChecked(true);
break;
case PassmarkAngleType::Intersection2OnlyRight:
ui->radioButtonIntersection2OnlyRight->setChecked(true);
break;
default:
break;
}
@ -597,6 +612,18 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id)
{
angleType = PassmarkAngleType::IntersectionOnlyRight;
}
else if (id == ui->buttonGroupAngleType->id(ui->radioButtonIntersection2))
{
angleType = PassmarkAngleType::Intersection2;
}
else if (id == ui->buttonGroupAngleType->id(ui->radioButtonIntersection2OnlyLeft))
{
angleType = PassmarkAngleType::Intersection2OnlyLeft;
}
else if (id == ui->buttonGroupAngleType->id(ui->radioButtonIntersection2OnlyRight))
{
angleType = PassmarkAngleType::Intersection2OnlyRight;
}
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>511</height>
<width>436</width>
<height>598</height>
</rect>
</property>
<property name="windowTitle">
@ -21,7 +21,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabPath">
<attribute name="title">
@ -984,6 +984,54 @@
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIntersection2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select if need designate the corner point as a passmark</string>
</property>
<property name="text">
<string>Intersection 2</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIntersection2OnlyLeft">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select if need designate the corner point as a passmark. Show only left passmark.</string>
</property>
<property name="text">
<string>Intersection 2 (only left)</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIntersection2OnlyRight">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select if need designate the corner point as a passmark. Show only right passmark.</string>
</property>
<property name="text">
<string>Intersection 2 (only right)</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -992,6 +992,9 @@ void DialogSeamAllowance::PassmarkChanged(int index)
uiTabPassmarks->radioButtonIntersection->setDisabled(true);
uiTabPassmarks->radioButtonIntersectionOnlyLeft->setDisabled(true);
uiTabPassmarks->radioButtonIntersectionOnlyRight->setDisabled(true);
uiTabPassmarks->radioButtonIntersection2->setDisabled(true);
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setDisabled(true);
uiTabPassmarks->radioButtonIntersection2OnlyRight->setDisabled(true);
uiTabPassmarks->checkBoxShowSecondPassmark->setDisabled(true);
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(true);
@ -1041,6 +1044,9 @@ void DialogSeamAllowance::PassmarkChanged(int index)
uiTabPassmarks->radioButtonIntersection->setEnabled(true);
uiTabPassmarks->radioButtonIntersectionOnlyLeft->setEnabled(true);
uiTabPassmarks->radioButtonIntersectionOnlyRight->setEnabled(true);
uiTabPassmarks->radioButtonIntersection2->setEnabled(true);
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setEnabled(true);
uiTabPassmarks->radioButtonIntersection2OnlyRight->setEnabled(true);
switch(node.GetPassmarkAngleType())
{
@ -1059,6 +1065,15 @@ void DialogSeamAllowance::PassmarkChanged(int index)
case PassmarkAngleType::IntersectionOnlyRight:
uiTabPassmarks->radioButtonIntersectionOnlyRight->setChecked(true);
break;
case PassmarkAngleType::Intersection2:
uiTabPassmarks->radioButtonIntersection2->setChecked(true);
break;
case PassmarkAngleType::Intersection2OnlyLeft:
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setChecked(true);
break;
case PassmarkAngleType::Intersection2OnlyRight:
uiTabPassmarks->radioButtonIntersection2OnlyRight->setChecked(true);
break;
default:
break;
}
@ -1455,6 +1470,18 @@ void DialogSeamAllowance::PassmarkAngleTypeChanged(int id)
{
angleType = PassmarkAngleType::IntersectionOnlyRight;
}
else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonIntersection2))
{
angleType = PassmarkAngleType::Intersection2;
}
else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonIntersection2OnlyLeft))
{
angleType = PassmarkAngleType::Intersection2OnlyLeft;
}
else if (id == uiTabPassmarks->buttonGroupAngleType->id(uiTabPassmarks->radioButtonIntersection2OnlyRight))
{
angleType = PassmarkAngleType::Intersection2OnlyRight;
}
rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>352</width>
<height>482</height>
<height>567</height>
</rect>
</property>
<property name="windowTitle">
@ -25,7 +25,7 @@
<x>0</x>
<y>0</y>
<width>332</width>
<height>462</height>
<height>547</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -203,6 +203,54 @@
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIntersection2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select if need designate the corner point as a passmark</string>
</property>
<property name="text">
<string>Intersection 2</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIntersection2OnlyLeft">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select if need designate the corner point as a passmark. Show only left passmark.</string>
</property>
<property name="text">
<string>Intersection 2 (only left)</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIntersection2OnlyRight">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Select if need designate the corner point as a passmark. Show only right passmark.</string>
</property>
<property name="text">
<string>Intersection 2 (only right)</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAngleType</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
@ -241,7 +289,7 @@
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupLineType"/>
<buttongroup name="buttonGroupAngleType"/>
<buttongroup name="buttonGroupLineType"/>
</buttongroups>
</ui>