New placelabel shape Circle.
--HG-- branch : develop
This commit is contained in:
parent
08bdeeedfe
commit
57d6d79a53
|
@ -14,6 +14,7 @@
|
||||||
- Extend Label language to support Czech alphabet.
|
- Extend Label language to support Czech alphabet.
|
||||||
- [#916] Improve layout generation.
|
- [#916] Improve layout generation.
|
||||||
- [#965] Control passmark length with formula.
|
- [#965] Control passmark length with formula.
|
||||||
|
- New placelabel shape Circle.
|
||||||
|
|
||||||
# Version 0.6.2 (unreleased)
|
# Version 0.6.2 (unreleased)
|
||||||
- [#903] Bug in tool Cut Spline path.
|
- [#903] Bug in tool Cut Spline path.
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
<file>schema/pattern/v0.8.1.xsd</file>
|
<file>schema/pattern/v0.8.1.xsd</file>
|
||||||
<file>schema/pattern/v0.8.2.xsd</file>
|
<file>schema/pattern/v0.8.2.xsd</file>
|
||||||
<file>schema/pattern/v0.8.3.xsd</file>
|
<file>schema/pattern/v0.8.3.xsd</file>
|
||||||
|
<file>schema/pattern/v0.8.4.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.3.0.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.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||||
|
|
1167
src/libs/ifc/schema/pattern/v0.8.4.xsd
Normal file
1167
src/libs/ifc/schema/pattern/v0.8.4.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -59,8 +59,8 @@ class QDomElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
||||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.3");
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.4");
|
||||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.3.xsd");
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.4.xsd");
|
||||||
|
|
||||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
@ -233,7 +233,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 0), QStringLiteral("://schema/pattern/v0.8.0.xsd")),
|
std::make_pair(FORMAT_VERSION(0, 8, 0), QStringLiteral("://schema/pattern/v0.8.0.xsd")),
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 1), QStringLiteral("://schema/pattern/v0.8.1.xsd")),
|
std::make_pair(FORMAT_VERSION(0, 8, 1), QStringLiteral("://schema/pattern/v0.8.1.xsd")),
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 2), QStringLiteral("://schema/pattern/v0.8.2.xsd")),
|
std::make_pair(FORMAT_VERSION(0, 8, 2), QStringLiteral("://schema/pattern/v0.8.2.xsd")),
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 3), CurrentSchema)
|
std::make_pair(FORMAT_VERSION(0, 8, 3), QStringLiteral("://schema/pattern/v0.8.3.xsd")),
|
||||||
|
std::make_pair(FORMAT_VERSION(0, 8, 4), CurrentSchema)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (schemas.contains(ver))
|
if (schemas.contains(ver))
|
||||||
|
@ -466,6 +467,10 @@ void VPatternConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 3)), m_convertedFileName);
|
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 3)), m_convertedFileName);
|
||||||
Q_FALLTHROUGH();
|
Q_FALLTHROUGH();
|
||||||
case (FORMAT_VERSION(0, 8, 3)):
|
case (FORMAT_VERSION(0, 8, 3)):
|
||||||
|
ToV0_8_4();
|
||||||
|
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 4)), m_convertedFileName);
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
case (FORMAT_VERSION(0, 8, 4)):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
|
@ -483,7 +488,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
||||||
bool VPatternConverter::IsReadOnly() const
|
bool VPatternConverter::IsReadOnly() const
|
||||||
{
|
{
|
||||||
// Check if attribute readOnly was not changed in file format
|
// Check if attribute readOnly was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 3),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 4),
|
||||||
"Check attribute readOnly.");
|
"Check attribute readOnly.");
|
||||||
|
|
||||||
// Possibly in future attribute readOnly will change position etc.
|
// Possibly in future attribute readOnly will change position etc.
|
||||||
|
@ -1083,6 +1088,16 @@ void VPatternConverter::ToV0_8_3()
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternConverter::ToV0_8_4()
|
||||||
|
{
|
||||||
|
// TODO. Delete if minimal supported version is 0.8.4
|
||||||
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 4),
|
||||||
|
"Time to refactor the code.");
|
||||||
|
SetVersion(QStringLiteral("0.8.4"));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPatternConverter::TagUnitToV0_2_0()
|
void VPatternConverter::TagUnitToV0_2_0()
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
static const QString PatternMaxVerStr;
|
static const QString PatternMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
||||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 3);
|
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 4);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int MinVer() const override;
|
virtual int MinVer() const override;
|
||||||
|
@ -126,6 +126,7 @@ private:
|
||||||
void ToV0_8_1();
|
void ToV0_8_1();
|
||||||
void ToV0_8_2();
|
void ToV0_8_2();
|
||||||
void ToV0_8_3();
|
void ToV0_8_3();
|
||||||
|
void ToV0_8_4();
|
||||||
|
|
||||||
void TagUnitToV0_2_0();
|
void TagUnitToV0_2_0();
|
||||||
void TagIncrementToV0_2_0();
|
void TagIncrementToV0_2_0();
|
||||||
|
|
|
@ -700,7 +700,8 @@ void VDxfEngine::ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
||||||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||||
for(auto &label : labels)
|
for(auto &label : labels)
|
||||||
{
|
{
|
||||||
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button)
|
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button
|
||||||
|
&& label.type != PlaceLabelType::Circle)
|
||||||
{
|
{
|
||||||
for(auto &p : qAsConst(label.shape))
|
for(auto &p : qAsConst(label.shape))
|
||||||
{
|
{
|
||||||
|
@ -793,7 +794,8 @@ void VDxfEngine::ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
||||||
|
|
||||||
for(auto &label : labels)
|
for(auto &label : labels)
|
||||||
{
|
{
|
||||||
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button)
|
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button
|
||||||
|
|| label.type == PlaceLabelType::Circle)
|
||||||
{
|
{
|
||||||
DRW_Point *point = new DRW_Point();
|
DRW_Point *point = new DRW_Point();
|
||||||
point->basePoint = DRW_Coord(FromPixel(label.center.x(), varInsunits),
|
point->basePoint = DRW_Coord(FromPixel(label.center.x(), varInsunits),
|
||||||
|
|
|
@ -57,7 +57,8 @@ enum class PlaceLabelType : unsigned char
|
||||||
Corner = 5,
|
Corner = 5,
|
||||||
Triangle = 6,
|
Triangle = 6,
|
||||||
Hshaped = 7,
|
Hshaped = 7,
|
||||||
Button = 8
|
Button = 8,
|
||||||
|
Circle = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QVector<QPolygonF> PlaceLabelImg;
|
typedef QVector<QPolygonF> PlaceLabelImg;
|
||||||
|
|
|
@ -341,6 +341,20 @@ PlaceLabelImg VPlaceLabelItem::LabelShape() const
|
||||||
return PlaceLabelImg({t.map(shape1), t.map(shape2), t.map(shape3)});
|
return PlaceLabelImg({t.map(shape1), t.map(shape2), t.map(shape3)});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto CircleShape = [t, this]()
|
||||||
|
{
|
||||||
|
const qreal radius = qMin(d->wValue/2.0, d->hValue/2.0);
|
||||||
|
VArc arc(*this, radius, 0, 360);
|
||||||
|
arc.SetApproximationScale(10);
|
||||||
|
QPolygonF circle(arc.GetPoints());
|
||||||
|
if (not circle.isClosed() && not circle.isEmpty())
|
||||||
|
{
|
||||||
|
circle << circle.first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return PlaceLabelImg({t.map(circle)});
|
||||||
|
};
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
switch(d->type)
|
switch(d->type)
|
||||||
|
@ -363,6 +377,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
return HshapedShape();
|
return HshapedShape();
|
||||||
case PlaceLabelType::Button:
|
case PlaceLabelType::Button:
|
||||||
return ButtonShape();
|
return ButtonShape();
|
||||||
|
case PlaceLabelType::Circle:
|
||||||
|
return CircleShape();
|
||||||
}
|
}
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
|
|
|
@ -499,6 +499,7 @@ void DialogPlaceLabel::FillPlaceLabelTypes()
|
||||||
ui->comboBoxLabelType->addItem(tr("Triangle"), static_cast<int>(PlaceLabelType::Triangle));
|
ui->comboBoxLabelType->addItem(tr("Triangle"), static_cast<int>(PlaceLabelType::Triangle));
|
||||||
ui->comboBoxLabelType->addItem(tr("H-shaped"), static_cast<int>(PlaceLabelType::Hshaped));
|
ui->comboBoxLabelType->addItem(tr("H-shaped"), static_cast<int>(PlaceLabelType::Hshaped));
|
||||||
ui->comboBoxLabelType->addItem(tr("Button"), static_cast<int>(PlaceLabelType::Button));
|
ui->comboBoxLabelType->addItem(tr("Button"), static_cast<int>(PlaceLabelType::Button));
|
||||||
|
ui->comboBoxLabelType->addItem(tr("Circle"), static_cast<int>(PlaceLabelType::Circle));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -856,6 +856,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
QAction *actionTriangle = InitAction(tr("Triangle"), PlaceLabelType::Triangle);
|
QAction *actionTriangle = InitAction(tr("Triangle"), PlaceLabelType::Triangle);
|
||||||
QAction *actionHshaped = InitAction(tr("H-shaped"), PlaceLabelType::Hshaped);
|
QAction *actionHshaped = InitAction(tr("H-shaped"), PlaceLabelType::Hshaped);
|
||||||
QAction *actionButton = InitAction(tr("Button"), PlaceLabelType::Button);
|
QAction *actionButton = InitAction(tr("Button"), PlaceLabelType::Button);
|
||||||
|
QAction *actionCircle = InitAction(tr("Circle"), PlaceLabelType::Circle);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete"));
|
QAction *actionDelete = menu->addAction(QIcon::fromTheme(editDeleteIcon), tr("Delete"));
|
||||||
|
|
||||||
|
@ -917,6 +918,10 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
SaveType(PlaceLabelType::Button);
|
SaveType(PlaceLabelType::Button);
|
||||||
}
|
}
|
||||||
|
else if (selectedAction == actionCircle)
|
||||||
|
{
|
||||||
|
SaveType(PlaceLabelType::Circle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user