Merge with feature. Resolved issue #315. New tool: 'Elliptic Arc'.
--HG-- branch : develop
This commit is contained in:
commit
961204a2c1
|
@ -322,6 +322,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
||||||
case VToolMove::Type:
|
case VToolMove::Type:
|
||||||
UpdateOptionsToolMove();
|
UpdateOptionsToolMove();
|
||||||
break;
|
break;
|
||||||
|
case VToolEllipticalArc::Type:
|
||||||
|
UpdateOptionsToolEllipticalArc();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -460,6 +463,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
||||||
case VToolMove::Type:
|
case VToolMove::Type:
|
||||||
ChangeDataToolMove(prop);
|
ChangeDataToolMove(prop);
|
||||||
break;
|
break;
|
||||||
|
case VToolEllipticalArc::Type:
|
||||||
|
ChangeDataToolEllipticalArc(prop);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1728,6 +1734,42 @@ void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByAxis(VProperty *proper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolOptionsPropertyBrowser::ChangeDataToolEllipticalArc(VProperty *property)
|
||||||
|
{
|
||||||
|
SCASSERT(property != nullptr)
|
||||||
|
|
||||||
|
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
|
||||||
|
const QString id = propertyToId[property];
|
||||||
|
|
||||||
|
VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem);
|
||||||
|
SCASSERT(i != nullptr);
|
||||||
|
switch (PropertiesList().indexOf(id))
|
||||||
|
{
|
||||||
|
case 40://AttrRadius1
|
||||||
|
i->SetFormulaRadius1(value.value<VFormula>());
|
||||||
|
break;
|
||||||
|
case 41://AttrRadius2
|
||||||
|
i->SetFormulaRadius2(value.value<VFormula>());
|
||||||
|
break;
|
||||||
|
case 9://AttrAngle1
|
||||||
|
i->SetFormulaF1(value.value<VFormula>());
|
||||||
|
break;
|
||||||
|
case 10://AttrAngle2
|
||||||
|
i->SetFormulaF2(value.value<VFormula>());
|
||||||
|
break;
|
||||||
|
case 42://AttrRotationAngle
|
||||||
|
i->SetFormulaRotationAngle(value.value<VFormula>());
|
||||||
|
break;
|
||||||
|
case 27://AttrColor
|
||||||
|
i->SetLineColor(value.toString());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item)
|
void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item)
|
||||||
{
|
{
|
||||||
|
@ -2656,6 +2698,35 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolFlippingByAxis()
|
||||||
idToProperty[AttrSuffix]->setValue(i->Suffix());
|
idToProperty[AttrSuffix]->setValue(i->Suffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
|
||||||
|
{
|
||||||
|
VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem);
|
||||||
|
|
||||||
|
QVariant valueFormulaRadius1;
|
||||||
|
valueFormulaRadius1.setValue(i->GetFormulaRadius1());
|
||||||
|
idToProperty[AttrRadius1]->setValue(valueFormulaRadius1);
|
||||||
|
|
||||||
|
QVariant valueFormulaRadius2;
|
||||||
|
valueFormulaRadius2.setValue(i->GetFormulaRadius2());
|
||||||
|
idToProperty[AttrRadius2]->setValue(valueFormulaRadius2);
|
||||||
|
|
||||||
|
QVariant valueFormulaF1;
|
||||||
|
valueFormulaF1.setValue(i->GetFormulaF1());
|
||||||
|
idToProperty[AttrAngle1]->setValue(valueFormulaF1);
|
||||||
|
|
||||||
|
QVariant valueFormulaF2;
|
||||||
|
valueFormulaF2.setValue(i->GetFormulaF2());
|
||||||
|
idToProperty[AttrAngle2]->setValue(valueFormulaF2);
|
||||||
|
|
||||||
|
QVariant valueFormulaRotationAngle;
|
||||||
|
valueFormulaRotationAngle.setValue(i->GetFormulaRotationAngle());
|
||||||
|
idToProperty[AttrRotationAngle]->setValue(valueFormulaRotationAngle);
|
||||||
|
|
||||||
|
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
|
||||||
|
idToProperty[AttrColor]->setValue(index);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -161,6 +161,7 @@ private:
|
||||||
void ChangeDataToolMove(VPE::VProperty *property);
|
void ChangeDataToolMove(VPE::VProperty *property);
|
||||||
void ChangeDataToolFlippingByLine(VPE::VProperty *property);
|
void ChangeDataToolFlippingByLine(VPE::VProperty *property);
|
||||||
void ChangeDataToolFlippingByAxis(VPE::VProperty *property);
|
void ChangeDataToolFlippingByAxis(VPE::VProperty *property);
|
||||||
|
void ChangeDataToolEllipticalArc(VPE::VProperty *property);
|
||||||
|
|
||||||
void ShowOptionsToolSinglePoint(QGraphicsItem *item);
|
void ShowOptionsToolSinglePoint(QGraphicsItem *item);
|
||||||
void ShowOptionsToolEndLine(QGraphicsItem *item);
|
void ShowOptionsToolEndLine(QGraphicsItem *item);
|
||||||
|
@ -230,6 +231,7 @@ private:
|
||||||
void UpdateOptionsToolMove();
|
void UpdateOptionsToolMove();
|
||||||
void UpdateOptionsToolFlippingByLine();
|
void UpdateOptionsToolFlippingByLine();
|
||||||
void UpdateOptionsToolFlippingByAxis();
|
void UpdateOptionsToolFlippingByAxis();
|
||||||
|
void UpdateOptionsToolEllipticalArc();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTOOLOPTIONSPROPERTYBROWSER_H
|
#endif // VTOOLOPTIONSPROPERTYBROWSER_H
|
||||||
|
|
|
@ -270,25 +270,25 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::Spline:
|
case Tool::Spline:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
|
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
|
||||||
SCASSERT(spl != nullptr);
|
SCASSERT(not spl.isNull());
|
||||||
return spl->NameForHistory(tr("Curve"));
|
return spl->NameForHistory(tr("Curve"));
|
||||||
}
|
}
|
||||||
case Tool::CubicBezier:
|
case Tool::CubicBezier:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId());
|
const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId());
|
||||||
SCASSERT(spl != nullptr);
|
SCASSERT(not spl.isNull());
|
||||||
return spl->NameForHistory(tr("Cubic bezier curve"));
|
return spl->NameForHistory(tr("Cubic bezier curve"));
|
||||||
}
|
}
|
||||||
case Tool::Arc:
|
case Tool::Arc:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
|
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
|
||||||
SCASSERT(arc != nullptr);
|
SCASSERT(not arc.isNull());
|
||||||
return arc->NameForHistory(tr("Arc"));
|
return arc->NameForHistory(tr("Arc"));
|
||||||
}
|
}
|
||||||
case Tool::ArcWithLength:
|
case Tool::ArcWithLength:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
|
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
|
||||||
SCASSERT(arc != nullptr);
|
SCASSERT(not arc.isNull());
|
||||||
return tr("%1 with length %2")
|
return tr("%1 with length %2")
|
||||||
.arg(arc->NameForHistory(tr("Arc")))
|
.arg(arc->NameForHistory(tr("Arc")))
|
||||||
.arg(arc->GetLength());
|
.arg(arc->GetLength());
|
||||||
|
@ -296,13 +296,13 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::SplinePath:
|
case Tool::SplinePath:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
|
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
|
||||||
SCASSERT(splPath != nullptr);
|
SCASSERT(not splPath.isNull());
|
||||||
return splPath->NameForHistory(tr("Spline path"));
|
return splPath->NameForHistory(tr("Spline path"));
|
||||||
}
|
}
|
||||||
case Tool::CubicBezierPath:
|
case Tool::CubicBezierPath:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId());
|
const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId());
|
||||||
SCASSERT(splPath != nullptr);
|
SCASSERT(not splPath.isNull());
|
||||||
return splPath->NameForHistory(tr("Cubic bezier curve path"));
|
return splPath->NameForHistory(tr("Cubic bezier curve path"));
|
||||||
}
|
}
|
||||||
case Tool::PointOfContact:
|
case Tool::PointOfContact:
|
||||||
|
@ -330,7 +330,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::CutArc:
|
case Tool::CutArc:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
|
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
|
||||||
SCASSERT(arc != nullptr);
|
SCASSERT(not arc.isNull());
|
||||||
return tr("%1 - cut %2")
|
return tr("%1 - cut %2")
|
||||||
.arg(PointName(tool.getId()))
|
.arg(PointName(tool.getId()))
|
||||||
.arg(arc->NameForHistory(tr("arc")));
|
.arg(arc->NameForHistory(tr("arc")));
|
||||||
|
@ -339,7 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
{
|
{
|
||||||
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
|
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
|
||||||
const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId);
|
const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId);
|
||||||
SCASSERT(spl != nullptr);
|
SCASSERT(not spl.isNull());
|
||||||
return tr("%1 - cut %2")
|
return tr("%1 - cut %2")
|
||||||
.arg(PointName(tool.getId()))
|
.arg(PointName(tool.getId()))
|
||||||
.arg(spl->NameForHistory(tr("curve")));
|
.arg(spl->NameForHistory(tr("curve")));
|
||||||
|
@ -349,7 +349,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
|
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
|
||||||
const QSharedPointer<VAbstractCubicBezierPath> splPath =
|
const QSharedPointer<VAbstractCubicBezierPath> splPath =
|
||||||
data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
|
data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
|
||||||
SCASSERT(splPath != nullptr);
|
SCASSERT(not splPath.isNull());
|
||||||
return tr("%1 - cut %2")
|
return tr("%1 - cut %2")
|
||||||
.arg(PointName(tool.getId()))
|
.arg(PointName(tool.getId()))
|
||||||
.arg(splPath->NameForHistory(tr("curve path")));
|
.arg(splPath->NameForHistory(tr("curve path")));
|
||||||
|
@ -382,8 +382,10 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
case Tool::EllipticalArc:
|
case Tool::EllipticalArc:
|
||||||
{
|
{
|
||||||
const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId());
|
const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId());
|
||||||
SCASSERT(elArc != nullptr);
|
SCASSERT(not elArc.isNull());
|
||||||
return elArc->NameForHistory(tr("Elliptical arc"));
|
return tr("%1 with length %2")
|
||||||
|
.arg(elArc->NameForHistory(tr("Elliptical arc")))
|
||||||
|
.arg(elArc->GetLength());
|
||||||
}
|
}
|
||||||
//Because "history" not only show history of pattern, but help restore current data for each pattern's
|
//Because "history" not only show history of pattern, but help restore current data for each pattern's
|
||||||
//piece, we need add record about details and nodes, but don't show them.
|
//piece, we need add record about details and nodes, but don't show them.
|
||||||
|
|
|
@ -427,7 +427,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>117</width>
|
<width>130</width>
|
||||||
<height>110</height>
|
<height>110</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -536,7 +536,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>117</width>
|
<width>130</width>
|
||||||
<height>248</height>
|
<height>248</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -798,7 +798,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>117</width>
|
<width>130</width>
|
||||||
<height>248</height>
|
<height>248</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1064,7 +1064,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>130</width>
|
<width>130</width>
|
||||||
<height>56</height>
|
<height>58</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1078,7 +1078,7 @@
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/16x16/toolsectionelarc@2x.png</normaloff>:/icon/16x16/toolsectionelarc@2x.png</iconset>
|
<normaloff>:/icon/16x16/toolsectionelarc.png</normaloff>:/icon/16x16/toolsectionelarc.png</iconset>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
<string>Elliptical Arc</string>
|
<string>Elliptical Arc</string>
|
||||||
|
@ -1116,7 +1116,7 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Arc</string>
|
<string>Elliptical Arc</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">...</string>
|
<string notr="true">...</string>
|
||||||
|
@ -1144,7 +1144,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>130</width>
|
<width>130</width>
|
||||||
<height>356</height>
|
<height>326</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -1321,7 +1321,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>117</width>
|
<width>130</width>
|
||||||
<height>104</height>
|
<height>104</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1431,7 +1431,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>130</width>
|
<width>130</width>
|
||||||
<height>356</height>
|
<height>326</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<file>schema/pattern/v0.3.6.xsd</file>
|
<file>schema/pattern/v0.3.6.xsd</file>
|
||||||
<file>schema/pattern/v0.3.7.xsd</file>
|
<file>schema/pattern/v0.3.7.xsd</file>
|
||||||
<file>schema/pattern/v0.3.8.xsd</file>
|
<file>schema/pattern/v0.3.8.xsd</file>
|
||||||
|
<file>schema/pattern/v0.3.9.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>
|
||||||
|
@ -32,6 +33,5 @@
|
||||||
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
<file>schema/individual_measurements/v0.3.1.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.3.2.xsd</file>
|
<file>schema/individual_measurements/v0.3.2.xsd</file>
|
||||||
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
||||||
<file>schema/pattern/v0.3.9.xsd</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -1409,8 +1409,10 @@ QStringList VAbstractPattern::ListExpressions() const
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
|
|
||||||
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
list << ListPointExpressions();
|
list << ListPointExpressions();
|
||||||
list << ListArcExpressions();
|
list << ListArcExpressions();
|
||||||
|
list << ListElArcExpressions();
|
||||||
list << ListSplineExpressions();
|
list << ListSplineExpressions();
|
||||||
list << ListIncrementExpressions();
|
list << ListIncrementExpressions();
|
||||||
list << ListOperationExpressions();
|
list << ListOperationExpressions();
|
||||||
|
@ -1422,7 +1424,8 @@ QStringList VAbstractPattern::ListExpressions() const
|
||||||
QStringList VAbstractPattern::ListPointExpressions() const
|
QStringList VAbstractPattern::ListPointExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment a number.
|
||||||
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
|
@ -1493,7 +1496,8 @@ QStringList VAbstractPattern::ListPointExpressions() const
|
||||||
QStringList VAbstractPattern::ListArcExpressions() const
|
QStringList VAbstractPattern::ListArcExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number.
|
||||||
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
|
@ -1542,6 +1546,69 @@ QStringList VAbstractPattern::ListArcExpressions() const
|
||||||
return expressions;
|
return expressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QStringList VAbstractPattern::ListElArcExpressions() const
|
||||||
|
{
|
||||||
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
|
// If no just increment number.
|
||||||
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
||||||
|
|
||||||
|
QStringList expressions;
|
||||||
|
const QDomNodeList list = elementsByTagName(TagElArc);
|
||||||
|
for (int i=0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
const QDomElement dom = list.at(i).toElement();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
expressions.append(GetParametrString(dom, AttrRadius1));
|
||||||
|
}
|
||||||
|
catch (VExceptionEmptyParameter &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
expressions.append(GetParametrString(dom, AttrRadius2));
|
||||||
|
}
|
||||||
|
catch (VExceptionEmptyParameter &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
expressions.append(GetParametrString(dom, AttrAngle1));
|
||||||
|
}
|
||||||
|
catch (VExceptionEmptyParameter &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
expressions.append(GetParametrString(dom, AttrAngle2));
|
||||||
|
}
|
||||||
|
catch (VExceptionEmptyParameter &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
expressions.append(GetParametrString(dom, AttrRotationAngle));
|
||||||
|
}
|
||||||
|
catch (VExceptionEmptyParameter &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return expressions;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::ListSplineExpressions() const
|
QStringList VAbstractPattern::ListSplineExpressions() const
|
||||||
{
|
{
|
||||||
|
@ -1554,7 +1621,8 @@ QStringList VAbstractPattern::ListSplineExpressions() const
|
||||||
QStringList VAbstractPattern::ListPathPointExpressions() const
|
QStringList VAbstractPattern::ListPathPointExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number.
|
||||||
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
|
@ -1620,7 +1688,8 @@ QStringList VAbstractPattern::ListIncrementExpressions() const
|
||||||
QStringList VAbstractPattern::ListOperationExpressions() const
|
QStringList VAbstractPattern::ListOperationExpressions() const
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number
|
// If no just increment number.
|
||||||
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
|
||||||
|
|
||||||
QStringList expressions;
|
QStringList expressions;
|
||||||
|
|
|
@ -351,6 +351,7 @@ private:
|
||||||
QStringList ListExpressions() const;
|
QStringList ListExpressions() const;
|
||||||
QStringList ListPointExpressions() const;
|
QStringList ListPointExpressions() const;
|
||||||
QStringList ListArcExpressions() const;
|
QStringList ListArcExpressions() const;
|
||||||
|
QStringList ListElArcExpressions() const;
|
||||||
QStringList ListSplineExpressions() const;
|
QStringList ListSplineExpressions() const;
|
||||||
QStringList ListPathPointExpressions() const;
|
QStringList ListPathPointExpressions() const;
|
||||||
QStringList ListIncrementExpressions() const;
|
QStringList ListIncrementExpressions() const;
|
||||||
|
|
|
@ -175,6 +175,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
||||||
case (0x000307):
|
case (0x000307):
|
||||||
return QStringLiteral("://schema/pattern/v0.3.7.xsd");
|
return QStringLiteral("://schema/pattern/v0.3.7.xsd");
|
||||||
case (0x000308):
|
case (0x000308):
|
||||||
|
return QStringLiteral("://schema/pattern/v0.3.8.xsd");
|
||||||
|
case (0x000309):
|
||||||
return CurrentSchema;
|
return CurrentSchema;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(ver);
|
InvalidVersion(ver);
|
||||||
|
@ -274,6 +276,10 @@ void VPatternConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(0x000308), fileName);
|
ValidateXML(XSDSchema(0x000308), fileName);
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000308):
|
case (0x000308):
|
||||||
|
ToV0_3_9();
|
||||||
|
ValidateXML(XSDSchema(0x000309), fileName);
|
||||||
|
V_FALLTHROUGH
|
||||||
|
case (0x000309):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -462,6 +468,13 @@ void VPatternConverter::ToV0_3_8()
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternConverter::ToV0_3_9()
|
||||||
|
{
|
||||||
|
SetVersion(QStringLiteral("0.3.9"));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPatternConverter::TagUnitToV0_2_0()
|
void VPatternConverter::TagUnitToV0_2_0()
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,10 +55,10 @@ public:
|
||||||
// GCC 4.6 doesn't allow constexpr and const together
|
// GCC 4.6 doesn't allow constexpr and const together
|
||||||
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
|
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
|
||||||
static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||||
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 8);
|
static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 9);
|
||||||
#else
|
#else
|
||||||
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 8);
|
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 9);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -97,6 +97,7 @@ private:
|
||||||
void ToV0_3_6();
|
void ToV0_3_6();
|
||||||
void ToV0_3_7();
|
void ToV0_3_7();
|
||||||
void ToV0_3_8();
|
void ToV0_3_8();
|
||||||
|
void ToV0_3_9();
|
||||||
|
|
||||||
void TagUnitToV0_2_0();
|
void TagUnitToV0_2_0();
|
||||||
void TagIncrementToV0_2_0();
|
void TagIncrementToV0_2_0();
|
||||||
|
|
|
@ -58,7 +58,31 @@ class VContainer;
|
||||||
* @param parent parent widget
|
* @param parent parent widget
|
||||||
*/
|
*/
|
||||||
DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogEllipticalArc)
|
: DialogTool(data, toolId, parent),
|
||||||
|
ui(new Ui::DialogEllipticalArc),
|
||||||
|
flagRadius1(false),
|
||||||
|
flagRadius2(false),
|
||||||
|
flagF1(false),
|
||||||
|
flagF2(false),
|
||||||
|
flagRotationAngle(false),
|
||||||
|
timerRadius1(nullptr),
|
||||||
|
timerRadius2(nullptr),
|
||||||
|
timerF1(nullptr),
|
||||||
|
timerF2(nullptr),
|
||||||
|
timerRotationAngle(nullptr),
|
||||||
|
radius1(),
|
||||||
|
radius2(),
|
||||||
|
f1(),
|
||||||
|
f2(),
|
||||||
|
rotationAngle(),
|
||||||
|
formulaBaseHeightRadius1(0),
|
||||||
|
formulaBaseHeightRadius2(0),
|
||||||
|
formulaBaseHeightF1(0),
|
||||||
|
formulaBaseHeightF2(0),
|
||||||
|
formulaBaseHeightRotationAngle(0),
|
||||||
|
angleF1(INT_MIN),
|
||||||
|
angleF2(INT_MIN),
|
||||||
|
angleRotation(INT_MIN)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -372,7 +396,7 @@ void DialogEllipticalArc::EvalAngles()
|
||||||
angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
|
angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false);
|
||||||
|
|
||||||
labelEditFormula = ui->labelEditRotationAngle;
|
labelEditFormula = ui->labelEditRotationAngle;
|
||||||
rotationAngle = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle,
|
angleRotation = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle,
|
||||||
ui->labelResultRotationAngle, degreeSymbol, false);
|
ui->labelResultRotationAngle, degreeSymbol, false);
|
||||||
|
|
||||||
CheckAngles();
|
CheckAngles();
|
||||||
|
|
|
@ -61,7 +61,7 @@ void VisToolArc::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||||
DrawPoint(arcCenter, *first, supportColor);
|
DrawPoint(arcCenter, *first, supportColor);
|
||||||
|
|
||||||
if (not qFuzzyIsNull(radius) && f1 >= 0 && f2 >= 0 && not VFuzzyComparePossibleNulls(f1, f2))
|
if (not qFuzzyIsNull(radius) && f1 >= 0 && f2 >= 0)
|
||||||
{
|
{
|
||||||
VArc arc = VArc (*first, radius, f1, f2);
|
VArc arc = VArc (*first, radius, f1, f2);
|
||||||
DrawPath(this, arc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, arc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
|
@ -58,8 +58,7 @@ void VisToolEllipticalArc::RefreshGeometry()
|
||||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(object1Id);
|
||||||
DrawPoint(arcCenter, *first, supportColor);
|
DrawPoint(arcCenter, *first, supportColor);
|
||||||
|
|
||||||
if (not qFuzzyIsNull(radius1) && not qFuzzyIsNull(radius2) && f1 >= 0 && f2 >= 0 && rotationAngle >= 0
|
if (not qFuzzyIsNull(radius1) && not qFuzzyIsNull(radius2) && f1 >= 0 && f2 >= 0 && rotationAngle >= 0)
|
||||||
&& not VFuzzyComparePossibleNulls(f1, f2))
|
|
||||||
{
|
{
|
||||||
VEllipticalArc elArc = VEllipticalArc(*first, radius1, radius2, f1, f2, rotationAngle);
|
VEllipticalArc elArc = VEllipticalArc(*first, radius1, radius2, f1, f2, rotationAngle);
|
||||||
DrawPath(this, elArc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
DrawPath(this, elArc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user