Resolved issue #681. Enhance feature: Dashed line options for curves, arcs, etc.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-05-16 13:07:53 +03:00
parent c8199b5e7f
commit 32a16890a7
128 changed files with 2059 additions and 555 deletions

View File

@ -1,5 +1,6 @@
# Version 0.6.0
- [#682] New feature. Export increments to Excel .csv.
- [#681] Enhance feature: Dashed line options for curves, arcs, etc.
# Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.

View File

@ -617,6 +617,22 @@ void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &pr
AddProperty(lineTypeProperty, AttrTypeLine);
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyCurvePenStyle(Tool *i, const QString &propertyName,
const QMap<QString, QIcon> &styles)
{
VPE::VLineTypeProperty *penStyleProperty = new VPE::VLineTypeProperty(propertyName);
penStyleProperty->setStyles(styles);
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->GetPenStyle());
if (index == -1)
{
qWarning()<<"Can't find pen style" << i->getLineType()<<"in list";
}
penStyleProperty->setValue(index);
AddProperty(penStyleProperty, AttrPenStyle);
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &propertyName,
@ -955,6 +971,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArc(VPE::VProperty *property)
break;
case 11: // AttrCenter (read only)
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -987,6 +1006,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArcWithLength(VPE::VProperty *pr
break;
case 11: // AttrCenter (read only)
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1544,6 +1566,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1569,6 +1594,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezier(VPE::VProperty *prop
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 55: // AttrPoint1 (read only)
case 56: // AttrPoint2 (read only)
case 57: // AttrPoint3 (read only)
@ -1598,6 +1626,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VPE::VProperty *prope
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1622,6 +1653,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VPE::VProperty *
case 27: // AttrTypeColor
i->SetLineColor(value.toString());
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -1851,6 +1885,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolEllipticalArc(VPE::VProperty *pr
case 27://AttrColor
i->SetLineColor(value.toString());
break;
case 59: // AttrPenStyle
i->SetPenStyle(value.toString());
break;
case 11: // AttrCenter (read only)
break;
default:
@ -1882,7 +1919,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolEndLine(QGraphicsItem *item)
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("Base point:"), AttrBasePoint);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
AddPropertyFormula(tr("Angle:"), i->GetFormulaAngle(), AttrAngle);
@ -1898,7 +1935,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolAlongLine(QGraphicsItem *item)
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint);
AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrSecondPoint);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
}
@ -1914,6 +1951,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
AddPropertyFormula(tr("Radius:"), i->GetFormulaRadius(), AttrRadius);
AddPropertyFormula(tr("First angle:"), i->GetFormulaF1(), AttrAngle1);
AddPropertyFormula(tr("Second angle:"), i->GetFormulaF2(), AttrAngle2);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
}
@ -1928,6 +1966,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArcWithLength(QGraphicsItem *it
AddPropertyFormula(tr("Radius:"), i->GetFormulaRadius(), AttrRadius);
AddPropertyFormula(tr("First angle:"), i->GetFormulaF1(), AttrAngle1);
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
}
@ -1942,7 +1981,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolBisector(QGraphicsItem *item)
AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrFirstPoint);
AddPropertyParentPointName(i->BasePointName(), tr("Second point:"), AttrBasePoint);
AddPropertyParentPointName(i->ThirdPointName(), tr("Third point:"), AttrThirdPoint);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
}
@ -2010,7 +2049,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolHeight(QGraphicsItem *item)
AddPropertyParentPointName(i->BasePointName(), tr("Base point:"), AttrBasePoint);
AddPropertyParentPointName(i->FirstLinePointName(), tr("First line point:"), AttrP1Line);
AddPropertyParentPointName(i->SecondLinePointName(), tr("Second line point:"), AttrP2Line);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
}
@ -2023,7 +2062,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLine(QGraphicsItem *item)
AddPropertyParentPointName(i->FirstPointName(), tr("First point:"), AttrFirstPoint);
AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrSecondPoint);
QMap<QString, QIcon> styles = VAbstractTool::LineStylesPics();
QMap<QString, QIcon> styles = LineStylesPics();
styles.remove(TypeLineNone);
AddPropertyLineType(i, tr("Line type:"), styles);
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
@ -2054,7 +2093,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item)
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint);
AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrSecondPoint);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
VPE::VDoubleProperty* itemAngle = new VPE::VDoubleProperty(tr("Additional angle degrees:"));
@ -2171,7 +2210,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *it
AddPropertyParentPointName(i->BasePointName(), tr("First point:"), AttrBasePoint);
AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrSecondPoint);
AddPropertyParentPointName(i->ShoulderPointName(), tr("Third point:"), AttrThirdPoint);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
AddPropertyFormula(tr("Length:"), i->GetFormulaLength(), AttrLength);
}
@ -2211,6 +2250,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
length2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
}
@ -2226,6 +2266,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezier(QGraphicsItem *item
AddPropertyParentPointName(i->SecondPointName(), tr("Second point:"), AttrPoint2);
AddPropertyParentPointName(i->ThirdPointName(), tr("Third point:"), AttrPoint3);
AddPropertyParentPointName(i->ForthPointName(), tr("Fourth point:"), AttrPoint4);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
}
@ -2237,6 +2278,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item)
formView->setTitle(tr("Tool for path curve"));
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
}
@ -2248,6 +2290,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezierPath(QGraphicsItem *
formView->setTitle(tr("Tool cubic bezier curve"));
AddPropertyObjectName(i, tr("Name:"), true);
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
}
@ -2276,7 +2319,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLineIntersectAxis(QGraphicsItem
AddPropertyParentPointName(i->BasePointName(), tr("Axis point:"), AttrBasePoint);
AddPropertyParentPointName(i->FirstLinePoint(), tr("First line point:"), AttrFirstPoint);
AddPropertyParentPointName(i->SecondLinePoint(), tr("Second line point:"), AttrSecondPoint);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
AddPropertyFormula(tr("Angle:"), i->GetFormulaAngle(), AttrAngle);
}
@ -2291,7 +2334,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCurveIntersectAxis(QGraphicsIte
AddPropertyObjectName(i, tr("Point label:"));
AddPropertyParentPointName(i->BasePointName(), tr("Axis point:"), AttrBasePoint);
AddPropertyParentPointName(i->CurveName(), tr("Curve:"), AttrCurve);
AddPropertyLineType(i, tr("Line type:"), VAbstractTool::LineStylesPics());
AddPropertyLineType(i, tr("Line type:"), LineStylesPics());
AddPropertyLineColor(i, tr("Line color:"), VAbstractTool::ColorsList(), AttrLineColor);
AddPropertyFormula(tr("Angle:"), i->GetFormulaAngle(), AttrAngle);
}
@ -2375,7 +2418,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine()
idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2404,7 +2447,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine()
idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2443,8 +2486,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
valueSecondAngle.setValue(i->GetFormulaF2());
idToProperty[AttrAngle2]->setValue(valueSecondAngle);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
idToProperty[AttrPenStyle]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index);
}
QVariant valueCenterPoint;
valueCenterPoint.setValue(i->CenterPointName());
@ -2468,8 +2518,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength()
valueLength.setValue(i->GetFormulaLength());
idToProperty[AttrLength]->setValue(valueLength);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
idToProperty[AttrPenStyle]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index);
}
QVariant valueCenterPoint;
valueCenterPoint.setValue(i->CenterPointName());
@ -2488,7 +2545,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector()
idToProperty[AttrLength]->setValue(valueFormula);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2595,7 +2652,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight()
idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2623,7 +2680,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLine()
VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2679,7 +2736,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal()
idToProperty[AttrAngle]->setValue( i->GetAngle());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2847,7 +2904,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -2909,6 +2966,11 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
length2.setValue(length2F);
idToProperty[AttrLength2]->setValue(length2);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
idToProperty[AttrPenStyle]->setValue(index);
}
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
}
@ -2919,6 +2981,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
auto i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem);
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name()));
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
idToProperty[AttrPenStyle]->setValue(index);
}
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
@ -2945,6 +3013,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
auto i = qgraphicsitem_cast<VToolSplinePath *>(currentItem);
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name()));
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
idToProperty[AttrPenStyle]->setValue(index);
}
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
}
@ -2955,6 +3029,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
auto i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem);
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name()));
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
idToProperty[AttrPenStyle]->setValue(index);
}
idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
}
@ -2990,7 +3070,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis()
idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -3023,7 +3103,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis()
idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index);
}
@ -3196,6 +3276,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< AttrPoint1 /* 55 */
<< AttrPoint2 /* 56 */
<< AttrPoint3 /* 57 */
<< AttrPoint4; /* 58 */
<< AttrPoint4 /* 58 */
<< AttrPenStyle; /* 59 */
return attr;
}

View File

@ -120,6 +120,9 @@ private:
template<class Tool>
void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
template<class Tool>
void AddPropertyCurvePenStyle(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
template<class Tool>
void AddPropertyLineColor(Tool *i, const QString &propertyName, const QMap<QString, QString> &colors,
const QString &id);

View File

@ -2120,8 +2120,9 @@ void VPattern::ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &
{
spline->SetDuplicate(duplicate);
}
spline->SetColor(color);
VToolSpline::Create(id, spline, color, scene, this, data, parse, Source::FromFile);
VToolSpline::Create(id, spline, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -2158,10 +2159,11 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
QString l2 = length2;//need for saving fixed formula;
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
VToolSpline *spl = VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, scene, this,
data, parse, Source::FromFile);
VToolSpline *spl = VToolSpline::Create(id, point1, point4, a1, a2, l1, l2, duplicate, color, penStyle, scene,
this, data, parse, Source::FromFile);
if (spl != nullptr)
{
@ -2212,6 +2214,7 @@ void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement
const quint32 point4 = GetParametrUInt(domElement, AttrPoint4, NULL_ID_STR);
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
auto p1 = data->GeometricObject<VPointF>(point1);
@ -2224,8 +2227,10 @@ void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement
{
spline->SetDuplicate(duplicate);
}
spline->SetColor(color);
spline->SetPenStyle(penStyle);
VToolCubicBezier::Create(id, spline, color, scene, this, data, parse, Source::FromFile);
VToolCubicBezier::Create(id, spline, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -2285,8 +2290,9 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme
{
path->SetDuplicate(duplicate);
}
path->SetColor(color);
VToolSplinePath::Create(id, path, color, scene, this, data, parse, Source::FromFile);
VToolSplinePath::Create(id, path, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -2308,6 +2314,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
ToolsCommonAttributes(domElement, id);
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
QVector<quint32> points;
@ -2343,8 +2350,8 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
l1 = length1;
l2 = length2;
VToolSplinePath *spl = VToolSplinePath::Create(id, points, a1, a2, l1, l2, color, duplicate, scene, this, data,
parse, Source::FromFile);
VToolSplinePath *spl = VToolSplinePath::Create(id, points, a1, a2, l1, l2, color, penStyle, duplicate, scene,
this, data, parse, Source::FromFile);
if (spl != nullptr)
{
@ -2400,6 +2407,7 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
ToolsCommonAttributes(domElement, id);
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, "0");
QVector<VPointF> points;
@ -2429,8 +2437,10 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
{
path->SetDuplicate(duplicate);
}
path->SetColor(color);
path->SetPenStyle(penStyle);
VToolCubicBezierPath::Create(id, path, color, scene, this, data, parse, Source::FromFile);
VToolCubicBezierPath::Create(id, path, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -2550,8 +2560,9 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
const QString f2 = GetParametrString(domElement, AttrAngle2, "270");
QString f2Fix = f2;//need for saving fixed formula;
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
VToolArc::Create(id, center, r, f1Fix, f2Fix, color, scene, this, data, parse, Source::FromFile);
VToolArc::Create(id, center, r, f1Fix, f2Fix, color, penStyle, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (r != radius || f1Fix != f1 || f2Fix != f2)
{
@ -2599,9 +2610,10 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do
const QString frotation = GetParametrString(domElement, AttrRotationAngle, "0");
QString frotationFix = frotation;//need for saving fixed formula;
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
VToolEllipticalArc::Create(id, center, r1, r2, f1Fix, f2Fix, frotationFix, color, scene, this, data, parse,
Source::FromFile);
VToolEllipticalArc::Create(id, center, r1, r2, f1Fix, f2Fix, frotationFix, color, penStyle, scene, this, data,
parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (r1 != radius1 || r2 != radius2 || f1Fix != f1 || f2Fix != f2 || frotationFix != frotation)
{
@ -2717,8 +2729,9 @@ void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &do
const QString length = GetParametrString(domElement, AttrLength, "10");
QString lengthFix = length;//need for saving fixed length;
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
VToolArcWithLength::Create(id, center, r, f1Fix, lengthFix, color, scene, this, data, parse,
VToolArcWithLength::Create(id, center, r, f1Fix, lengthFix, color, penStyle, scene, this, data, parse,
Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (r != radius || f1Fix != f1 || lengthFix != length)
@ -3227,7 +3240,7 @@ void VPattern::ParsePathElement(VMainGraphicsScene *scene, QDomElement &domEleme
path.SetType(type);
path.SetName(name);
path.SetPenType(VAbstractTool::LineStyleToPenStyle(penType));
path.SetPenType(LineStyleToPenStyle(penType));
VToolPiecePath::Create(id, path, 0, scene, this, data, parse, Source::FromFile, "", idTool);
}

View File

@ -28,10 +28,18 @@
#include "ifcdef.h"
#include <QBrush>
#include <QIcon>
#include <QMap>
#include <QPainter>
#include <QPen>
#include <QPixmap>
#include <QStaticStringData>
#include <QStringData>
#include <QStringDataPtr>
#include "../vmisc/diagnostic.h"
const QString CustomMSign = QStringLiteral("@");
const QString CustomIncrSign = QStringLiteral("#");
@ -119,6 +127,7 @@ const QString AttrCurve1 = QStringLiteral("curve1");
const QString AttrCurve2 = QStringLiteral("curve2");
const QString AttrLineColor = QStringLiteral("lineColor");
const QString AttrColor = QStringLiteral("color");
const QString AttrPenStyle = QStringLiteral("penStyle");
const QString AttrFirstArc = QStringLiteral("firstArc");
const QString AttrSecondArc = QStringLiteral("secondArc");
const QString AttrCrossPoint = QStringLiteral("crossPoint");
@ -146,6 +155,106 @@ const QString TypeLineDotLine = QStringLiteral("dotLine");
const QString TypeLineDashDotLine = QStringLiteral("dashDotLine");
const QString TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Styles return list of all line styles.
* @return list of all line styles.
*/
QStringList StylesList()
{
const QStringList styles = QStringList() << TypeLineNone << TypeLineLine << TypeLineDashLine
<< TypeLineDotLine << TypeLineDashDotLine
<< TypeLineDashDotDotLine;
return styles;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineStyle return pen style for current line style.
* @return pen style.
*/
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine)
{
const QStringList styles = StylesList();
switch (styles.indexOf(typeLine))
{
case 0: // TypeLineNone
return Qt::NoPen;
case 2: // TypeLineDashLine
return Qt::DashLine;
case 3: // TypeLineDotLine
return Qt::DotLine;
case 4: // TypeLineDashDotLine
return Qt::DashDotLine;
case 5: // TypeLineDashDotDotLine
return Qt::DashDotDotLine;
case 1: // TypeLineLine
default:
return Qt::SolidLine;
}
}
//---------------------------------------------------------------------------------------------------------------------
QString PenStyleToLineStyle(Qt::PenStyle penStyle)
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
switch (penStyle)
{
case Qt::NoPen:
return TypeLineNone;
case Qt::DashLine:
return TypeLineDashLine;
case Qt::DotLine:
return TypeLineDotLine;
case Qt::DashDotLine:
return TypeLineDashDotLine;
case Qt::DashDotDotLine:
return TypeLineDashDotDotLine;
case Qt::SolidLine:
case Qt::CustomDashLine:
default:
break;
}
QT_WARNING_POP
return TypeLineLine;
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QIcon> LineStylesPics()
{
QMap<QString, QIcon> map;
const QStringList styles = StylesList();
for (int i=0; i < styles.size(); ++i)
{
const Qt::PenStyle style = LineStyleToPenStyle(styles.at(i));
QPixmap pix(80, 14);
pix.fill(Qt::white);
QBrush brush(Qt::black);
QPen pen(brush, 2.5, style);
QPainter painter(&pix);
painter.setPen(pen);
painter.drawLine(2, 7, 78, 7);
map.insert(styles.at(i), QIcon(pix));
}
return map;
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QIcon> CurvePenStylesPics()
{
QMap<QString, QIcon> map = LineStylesPics();
map.remove(TypeLineNone);
return map;
}
const QString ColorBlack = QStringLiteral("black");
const QString ColorGreen = QStringLiteral("green");
const QString ColorBlue = QStringLiteral("blue");

View File

@ -123,6 +123,7 @@ extern const QString AttrCurve1;
extern const QString AttrCurve2;
extern const QString AttrLineColor;
extern const QString AttrColor;
extern const QString AttrPenStyle;
extern const QString AttrFirstArc;
extern const QString AttrSecondArc;
extern const QString AttrCrossPoint;
@ -149,6 +150,12 @@ extern const QString TypeLineDotLine;
extern const QString TypeLineDashDotLine;
extern const QString TypeLineDashDotDotLine;
QStringList StylesList();
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
QString PenStyleToLineStyle(Qt::PenStyle penStyle);
QMap<QString, QIcon> LineStylesPics();
QMap<QString, QIcon> CurvePenStylesPics();
extern const QString ColorBlack;
extern const QString ColorGreen;
extern const QString ColorBlue;

View File

@ -32,6 +32,7 @@
<file>schema/pattern/v0.4.6.xsd</file>
<file>schema/pattern/v0.4.7.xsd</file>
<file>schema/pattern/v0.4.8.xsd</file>
<file>schema/pattern/v0.5.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.1.xsd</file>

View File

@ -0,0 +1,928 @@
<?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="author" type="xs:string" minOccurs="0" maxOccurs="1"/>
<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="size" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="showMeasurements" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="measurements" type="xs:string"/>
<xs:element name="increments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"/>
<xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="formula" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="incrementName">
<xs:selector xpath="increment"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"/>
<xs:attribute 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: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="xs:string"/>
</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="mcp" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="cutNumber" type="xs:unsignedInt"/>
<xs:attribute name="userDef" type="xs:string"/>
<xs:attribute name="material" type="materialType"/>
<xs:attribute name="placement" type="placementType"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="letter" type="xs:string"/>
<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="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: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: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="materialType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--Fabric-->
<xs:enumeration value="1"/>
<!--Lining-->
<xs:enumeration value="2"/>
<!--Interfacing-->
<xs:enumeration value="3"/>
<!--Interlining-->
<xs:enumeration value="4"/>
<!--UserDefined-->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="placementType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="0"/>
<!--No placement-->
<xs:enumeration value="1"/>
<!--Cut on Fold-->
</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:schema>

View File

@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.8");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.8.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.5.0");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.5.0.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -209,8 +209,10 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000406):
return QStringLiteral("://schema/pattern/v0.4.6.xsd");
case (0x000407):
return QStringLiteral("://schema/pattern/v0.4.8.xsd");
return QStringLiteral("://schema/pattern/v0.4.7.xsd");
case (0x000408):
return QStringLiteral("://schema/pattern/v0.4.8.xsd");
case (0x000500):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -349,6 +351,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000408), m_convertedFileName);
V_FALLTHROUGH
case (0x000408):
ToV0_5_0();
ValidateXML(XSDSchema(0x000500), m_convertedFileName);
V_FALLTHROUGH
case (0x000500):
break;
default:
InvalidVersion(m_ver);
@ -367,7 +373,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, 4, 8),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 5, 0),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -736,6 +742,16 @@ void VPatternConverter::ToV0_4_8()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_5_0()
{
// TODO. Delete if minimal supported version is 0.5.0
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 5, 0),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.5.0"));
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, 4, 8);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 5, 0);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@ -103,6 +103,7 @@ private:
void ToV0_4_6();
void ToV0_4_7();
void ToV0_4_8();
void ToV0_5_0();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -64,6 +64,17 @@ VAbstractCubicBezierPath::~VAbstractCubicBezierPath()
{
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractCubicBezierPath::GetDirectionPath() const
{
QPainterPath painterPath;
for (qint32 i = 1; i <= CountSubSpl(); ++i)
{
painterPath.addPath(GetSpline(i).GetDirectionPath());
}
return painterPath;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetPath return QPainterPath which reprezent spline path.

View File

@ -59,6 +59,7 @@ public:
virtual VSpline GetSpline(qint32 index) const =0;
virtual QVector<VSplinePoint> GetSplinePath() const =0;
virtual QPainterPath GetDirectionPath() const;
virtual QPainterPath GetPath(PathDirection direction = PathDirection::Hide) const Q_DECL_OVERRIDE;
virtual QVector<QPointF> GetPoints() const Q_DECL_OVERRIDE;
virtual qreal GetLength() const Q_DECL_OVERRIDE;

View File

@ -92,7 +92,6 @@ QVector<QPointF> VAbstractCurve::GetSegmentPoints(const QPointF &begin, const QP
return GetSegmentPoints(GetPoints(), begin, end, reverse);
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::FromBegin(const QVector<QPointF> &points, const QPointF &begin, bool *ok)
{
@ -169,24 +168,27 @@ QVector<QPointF> VAbstractCurve::ToEnd(const QVector<QPointF> &points, const QPo
return GetReversePoints(reversed);
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractCurve::GetDirectionPath() const
{
return ShowDirection(GetPoints());
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractCurve::GetPath(PathDirection direction) const
{
QPainterPath path;
QVector<QPointF> points = GetPoints();
const QVector<QPointF> points = GetPoints();
if (points.count() >= 2)
{
for (qint32 i = 0; i < points.count()-1; ++i)
{
path.moveTo(points.at(i));
path.lineTo(points.at(i+1));
}
path.addPolygon(QPolygonF(points));
if (direction == PathDirection::Show && points.count() >= 3)
if (direction == PathDirection::Show)
{
path.addPath(ShowDirection(points));
}
path.setFillRule(Qt::WindingFill);
}
else
{
@ -292,6 +294,18 @@ void VAbstractCurve::SetColor(const QString &color)
d->color = color;
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractCurve::GetPenStyle() const
{
return d->penStyle;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCurve::SetPenStyle(const QString &penStyle)
{
d->penStyle = penStyle;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractCurve::CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line)
{

View File

@ -68,6 +68,7 @@ public:
bool reverse = false);
QVector<QPointF> GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse = false) const;
virtual QPainterPath GetDirectionPath() const;
virtual QPainterPath GetPath(PathDirection direction = PathDirection::Hide) const;
virtual qreal GetLength() const =0;
qreal GetLengthByPoint(const QPointF &point) const;
@ -86,13 +87,16 @@ public:
QString GetColor() const;
void SetColor(const QString &color);
QString GetPenStyle() const;
void SetPenStyle(const QString &penStyle);
static qreal PathLength(const QVector<QPointF> &path);
static QVector<QPointF> CurveIntersectLine(const QVector<QPointF> &points, const QLineF &line);
virtual QString NameForHistory(const QString &toolName) const=0;
protected:
QPainterPath ShowDirection(const QVector<QPointF> &points) const;
protected:
virtual void CreateName() =0;
private:
QSharedDataPointer<VAbstractCurveData> d;

View File

@ -42,11 +42,16 @@ class VAbstractCurveData : public QSharedData
public:
VAbstractCurveData ()
: duplicate(0), color(ColorBlack)
: duplicate(0),
color(ColorBlack),
penStyle(TypeLineLine)
{}
VAbstractCurveData(const VAbstractCurveData &curve)
: QSharedData(curve), duplicate(curve.duplicate), color(curve.color)
: QSharedData(curve),
duplicate(curve.duplicate),
color(curve.color),
penStyle(curve.penStyle)
{}
virtual ~VAbstractCurveData();
@ -55,6 +60,7 @@ public:
quint32 duplicate;
QString color;
QString penStyle;
private:
VAbstractCurveData &operator=(const VAbstractCurveData &) Q_DECL_EQ_DELETE;

View File

@ -127,6 +127,8 @@ VArc VArc::Rotate(const QPointF &originPoint, qreal degrees, const QString &pref
VArc arc(center, GetRadius(), QLineF(static_cast<QPointF>(center), p1).angle(),
QLineF(static_cast<QPointF>(center), p2).angle());
arc.setName(name() + prefix);
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
return arc;
}
@ -142,6 +144,8 @@ VArc VArc::Flip(const QLineF &axis, const QString &prefix) const
QLineF(static_cast<QPointF>(center), p2).angle());
arc.setName(name() + prefix);
arc.SetFlipped(true);
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
return arc;
}
@ -156,6 +160,8 @@ VArc VArc::Move(qreal length, qreal angle, const QString &prefix) const
VArc arc(center, GetRadius(), QLineF(static_cast<QPointF>(center), p1).angle(),
QLineF(static_cast<QPointF>(center), p2).angle());
arc.setName(name() + prefix);
arc.SetColor(GetColor());
arc.SetPenStyle(GetPenStyle());
return arc;
}

View File

@ -73,6 +73,8 @@ VCubicBezier VCubicBezier::Rotate(const QPointF &originPoint, qreal degrees, con
const VPointF p4 = GetP4().Rotate(originPoint, degrees);
VCubicBezier curve(p1, p2, p3, p4);
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
return curve;
}
@ -85,6 +87,8 @@ VCubicBezier VCubicBezier::Flip(const QLineF &axis, const QString &prefix) const
const VPointF p4 = GetP4().Flip(axis);
VCubicBezier curve(p1, p2, p3, p4);
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
return curve;
}
@ -97,6 +101,8 @@ VCubicBezier VCubicBezier::Move(qreal length, qreal angle, const QString &prefix
const VPointF p4 = GetP4().Move(length, angle);
VCubicBezier curve(p1, p2, p3, p4);
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
return curve;
}

View File

@ -88,6 +88,8 @@ VCubicBezierPath VCubicBezierPath::Rotate(const QPointF &originPoint, qreal degr
curve.append(points.at(i).Rotate(originPoint, degrees));
}
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
return curve;
}
@ -101,6 +103,8 @@ VCubicBezierPath VCubicBezierPath::Flip(const QLineF &axis, const QString &prefi
curve.append(points.at(i).Flip(axis));
}
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
return curve;
}
@ -114,6 +118,8 @@ VCubicBezierPath VCubicBezierPath::Move(qreal length, qreal angle, const QString
curve.append(points.at(i).Move(length, angle));
}
curve.setName(name() + prefix);
curve.SetColor(GetColor());
curve.SetPenStyle(GetPenStyle());
return curve;
}

View File

@ -133,6 +133,8 @@ VEllipticalArc VEllipticalArc::Rotate(const QPointF &originPoint, qreal degrees,
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle() - GetRotationAngle();
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
elArc.setName(name() + prefix);
elArc.SetColor(GetColor());
elArc.SetPenStyle(GetPenStyle());
return elArc;
}
@ -147,6 +149,8 @@ VEllipticalArc VEllipticalArc::Flip(const QLineF &axis, const QString &prefix) c
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
elArc.setName(name() + prefix);
elArc.SetFlipped(true);
elArc.SetColor(GetColor());
elArc.SetPenStyle(GetPenStyle());
return elArc;
}
@ -160,6 +164,8 @@ VEllipticalArc VEllipticalArc::Move(qreal length, qreal angle, const QString &pr
const qreal f2 = QLineF(static_cast<QPointF>(center), p2).angle() - GetRotationAngle();
VEllipticalArc elArc(center, GetRadius1(), GetRadius2(), f1, f2, GetRotationAngle());
elArc.setName(name() + prefix);
elArc.SetColor(GetColor());
elArc.SetPenStyle(GetPenStyle());
return elArc;
}

View File

@ -121,6 +121,8 @@ VSpline VSpline::Rotate(const QPointF &originPoint, qreal degrees, const QString
VSpline spl(p1, p2, p3, p4);
spl.setName(name() + prefix);
spl.SetColor(GetColor());
spl.SetPenStyle(GetPenStyle());
return spl;
}
@ -135,6 +137,8 @@ VSpline VSpline::Flip(const QLineF &axis, const QString &prefix) const
VSpline spl(p1, p2, p3, p4);
spl.setName(name() + prefix);
spl.SetColor(GetColor());
spl.SetPenStyle(GetPenStyle());
return spl;
}
@ -149,6 +153,8 @@ VSpline VSpline::Move(qreal length, qreal angle, const QString &prefix) const
VSpline spl(p1, p2, p3, p4);
spl.setName(name() + prefix);
spl.SetColor(GetColor());
spl.SetPenStyle(GetPenStyle());
return spl;
}

View File

@ -119,6 +119,8 @@ VSplinePath VSplinePath::Rotate(const QPointF &originPoint, qreal degrees, const
VSplinePath splPath(newPoints);
splPath.setName(name() + prefix);
splPath.SetColor(GetColor());
splPath.SetPenStyle(GetPenStyle());
return splPath;
}
@ -141,6 +143,8 @@ VSplinePath VSplinePath::Flip(const QLineF &axis, const QString &prefix) const
VSplinePath splPath(newPoints);
splPath.setName(name() + prefix);
splPath.SetColor(GetColor());
splPath.SetPenStyle(GetPenStyle());
return splPath;
}
@ -163,6 +167,8 @@ VSplinePath VSplinePath::Move(qreal length, qreal angle, const QString &prefix)
VSplinePath splPath(newPoints);
splPath.setName(name() + prefix);
splPath.SetColor(GetColor());
splPath.SetPenStyle(GetPenStyle());
return splPath;
}

View File

@ -41,7 +41,6 @@
#include <QToolButton>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/line/vistoolalongline.h"
#include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h"
@ -85,7 +84,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId,
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor);
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogAlongLine::FXLength);
@ -228,7 +227,7 @@ void DialogAlongLine::SaveData()
line->setObject1Id(GetFirstPointId());
line->setObject2Id(GetSecondPointId());
line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -320,7 +319,7 @@ void DialogAlongLine::SetFormula(const QString &value)
void DialogAlongLine::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -82,6 +82,7 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
CheckState();
@ -157,6 +158,18 @@ void DialogArc::SetF2(const QString &value)
MoveCursorToEnd(ui->plainTextEditF2);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogArc::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogArc::GetColor() const
{

View File

@ -65,6 +65,9 @@ public:
QString GetF2() const;
void SetF2(const QString &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>425</width>
<height>341</height>
<height>374</height>
</rect>
</property>
<property name="windowTitle">
@ -586,20 +586,30 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
<item>

View File

@ -77,6 +77,7 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
FillComboBoxPoints(ui->comboBoxCenter);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
CheckState();
@ -185,6 +186,18 @@ void DialogArcWithLength::SetLength(const QString &value)
MoveCursorToEnd(ui->plainTextEditLength);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArcWithLength::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogArcWithLength::GetColor() const
{

View File

@ -63,6 +63,9 @@ public:
QString GetLength() const;
void SetLength(const QString &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>339</width>
<height>341</height>
<height>374</height>
</rect>
</property>
<property name="windowTitle">
@ -183,8 +183,7 @@
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@ -364,8 +363,7 @@
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@ -545,8 +543,7 @@
</property>
<property name="icon">
<iconset theme="go-down">
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@ -582,16 +579,26 @@
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxCenter"/>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
<item>

View File

@ -39,7 +39,6 @@
#include <QSet>
#include <QToolButton>
#include "../../tools/vabstracttool.h"
#include "../../visualization/line/vistoolbisector.h"
#include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h"
@ -77,7 +76,7 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxPoints(ui->comboBoxThirdPoint);
FillComboBoxLineColors(ui->comboBoxLineColor);
@ -239,7 +238,7 @@ void DialogBisector::SetPointName(const QString &value)
void DialogBisector::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -333,7 +332,7 @@ void DialogBisector::SaveData()
line->setObject2Id(GetSecondPointId());
line->setObject3Id(GetThirdPointId());
line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -35,6 +35,7 @@
#include <QPointer>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/path/vistoolcubicbezier.h"
#include "../../visualization/visualization.h"
#include "../vgeometry/vpointf.h"
@ -57,6 +58,7 @@ DialogCubicBezier::DialogCubicBezier(const VContainer *data, const quint32 &tool
FillComboBoxPoints(ui->comboBoxP3);
FillComboBoxPoints(ui->comboBoxP4);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
DialogTool::CheckState();
@ -105,6 +107,18 @@ void DialogCubicBezier::SetSpline(const VCubicBezier &spline)
path->setObject4Id(spl.GetP4().id());
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezier::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezier::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezier::GetColor() const
{

View File

@ -58,6 +58,9 @@ public:
VCubicBezier GetSpline() const;
void SetSpline(const VCubicBezier &spline);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>285</width>
<height>245</height>
<height>278</height>
</rect>
</property>
<property name="windowTitle">
@ -23,14 +23,14 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -40,14 +40,14 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLineEdit" name="lineEditSplineName">
<property name="readOnly">
<bool>true</bool>
@ -94,6 +94,16 @@
<item row="3" column="1">
<widget class="QComboBox" name="comboBoxP4"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Pen Style:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
<item>

View File

@ -44,6 +44,7 @@
#include <Qt>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/path/vistoolcubicbezierpath.h"
#include "../../visualization/visualization.h"
#include "../ifc/ifcdef.h"
@ -70,6 +71,7 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, const quint
FillComboBoxPoints(ui->comboBoxPoint);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCubicBezierPath::PointChanged);
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -114,6 +116,18 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
}
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezierPath::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogCubicBezierPath::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogCubicBezierPath::GetColor() const
{

View File

@ -57,6 +57,9 @@ public:
VCubicBezierPath GetPath() const;
void SetPath(const VCubicBezierPath &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:

View File

@ -52,30 +52,40 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditSplPathName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
<item>

View File

@ -45,7 +45,6 @@
#include "../vpatterndb/vtranslatevars.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../../tools/vabstracttool.h"
#include "../../visualization/line/vistoolcurveintersectaxis.h"
#include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h"
@ -80,7 +79,7 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
FillComboBoxPoints(ui->comboBoxAxisPoint);
FillComboBoxCurves(ui->comboBoxCurve);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor);
connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::FXAngle);
@ -115,7 +114,7 @@ QString DialogCurveIntersectAxis::GetTypeLine() const
void DialogCurveIntersectAxis::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -322,7 +321,7 @@ void DialogCurveIntersectAxis::SaveData()
line->setObject1Id(getCurveId());
line->setAxisPointId(GetBasePointId());
line->SetAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -38,6 +38,7 @@
#include <QToolButton>
#include <Qt>
#include "../../tools/vabstracttool.h"
#include "../ifc/xml/vdomdocument.h"
#include "../vpatterndb/vtranslatevars.h"
#include "../../visualization/path/vistoolellipticalarc.h"
@ -113,6 +114,7 @@ DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, const quint32 &
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
CheckState();
@ -326,6 +328,18 @@ void DialogEllipticalArc::SetRotationAngle(const QString &value)
MoveCursorToEnd(ui->plainTextEditRotationAngle);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogEllipticalArc::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEllipticalArc::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetColor return color of elliptical arc

View File

@ -68,6 +68,9 @@ public:
QString GetRotationAngle() const;
void SetRotationAngle(const QString &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);

View File

@ -23,7 +23,7 @@
<x>10</x>
<y>10</y>
<width>401</width>
<height>501</height>
<height>512</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -984,20 +984,30 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
</layout>

View File

@ -90,7 +90,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid
DialogTool::CheckState();
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor);
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogEndLine::FXLength);
@ -217,7 +217,7 @@ void DialogEndLine::SetPointName(const QString &value)
void DialogEndLine::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -360,7 +360,7 @@ void DialogEndLine::SaveData()
line->setObject1Id(GetBasePointId());
line->setLength(formulaLength);
line->SetAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -40,7 +40,6 @@
#include <QSharedPointer>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/line/vistoolheight.h"
#include "../../visualization/visualization.h"
#include "../../visualization/line/visline.h"
@ -75,7 +74,7 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
FillComboBoxPoints(ui->comboBoxBasePoint);
FillComboBoxPoints(ui->comboBoxP1Line);
FillComboBoxPoints(ui->comboBoxP2Line);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
@ -114,7 +113,7 @@ void DialogHeight::SetPointName(const QString &value)
void DialogHeight::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -243,7 +242,7 @@ void DialogHeight::SaveData()
line->setObject1Id(GetBasePointId());
line->setLineP1Id(GetP1LineId());
line->setLineP2Id(GetP2LineId());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -36,7 +36,6 @@
#include <QPointer>
#include <QVariant>
#include "../../tools/vabstracttool.h"
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolline.h"
#include "../ifc/ifcdef.h"
@ -59,7 +58,7 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxLineColors(ui->comboBoxLineColor);
QMap<QString, QIcon> stylesPics = VAbstractTool::LineStylesPics();
QMap<QString, QIcon> stylesPics = LineStylesPics();
stylesPics.remove(TypeLineNone);// Prevent hiding line
FillComboBoxTypeLine(ui->comboBoxLineType, stylesPics);
@ -101,7 +100,7 @@ void DialogLine::SetSecondPoint(const quint32 &value)
void DialogLine::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -163,7 +162,7 @@ void DialogLine::SaveData()
line->setObject1Id(GetFirstPoint());
line->setPoint2Id(GetSecondPoint());
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -85,7 +85,7 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
FillComboBoxPoints(ui->comboBoxAxisPoint);
FillComboBoxPoints(ui->comboBoxFirstLinePoint);
FillComboBoxPoints(ui->comboBoxSecondLinePoint);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor);
connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::FXAngle);
@ -128,7 +128,7 @@ QString DialogLineIntersectAxis::GetTypeLine() const
void DialogLineIntersectAxis::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------
@ -391,7 +391,7 @@ void DialogLineIntersectAxis::SaveData()
line->setPoint2Id(GetSecondPointId());
line->setAxisPointId(GetBasePointId());
line->SetAngle(formulaAngle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}

View File

@ -77,7 +77,7 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor);
InitArrow(ui);
@ -210,7 +210,7 @@ void DialogNormal::SaveData()
line->setObject2Id(GetSecondPointId());
line->setLength(formula);
line->SetAngle(angle);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -306,7 +306,7 @@ void DialogNormal::SetFormula(const QString &value)
void DialogNormal::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -703,7 +703,7 @@ void DialogPiecePath::InitPathTab()
ui->lineEditName->setClearButtonEnabled(true);
#endif
FillComboBoxTypeLine(ui->comboBoxPenType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxPenType, LineStylesPics());
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogPiecePath::NameChanged);
@ -930,13 +930,13 @@ void DialogPiecePath::SetType(PiecePathType type)
//---------------------------------------------------------------------------------------------------------------------
Qt::PenStyle DialogPiecePath::GetPenType() const
{
return VAbstractTool::LineStyleToPenStyle(GetComboBoxCurrentData(ui->comboBoxPenType, TypeLineLine));
return LineStyleToPenStyle(GetComboBoxCurrentData(ui->comboBoxPenType, TypeLineLine));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SetPenType(const Qt::PenStyle &type)
{
ChangeCurrentData(ui->comboBoxPenType, VAbstractTool::PenStyleToLineStyle(type));
ChangeCurrentData(ui->comboBoxPenType, PenStyleToLineStyle(type));
vis->setLineStyle(type);
}

View File

@ -76,7 +76,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &
flagFormula = false;
DialogTool::CheckState();
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxTypeLine(ui->comboBoxLineType, LineStylesPics());
FillComboBoxPoints(ui->comboBoxP1Line);
FillComboBoxPoints(ui->comboBoxP2Line);
FillComboBoxPoints(ui->comboBoxP3);
@ -235,7 +235,7 @@ void DialogShoulderPoint::SaveData()
line->setLineP1Id(GetP1Line());
line->setLineP2Id(GetP2Line());
line->setLength(formula);
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
line->setLineStyle(LineStyleToPenStyle(GetTypeLine()));
line->RefreshGeometry();
}
@ -329,7 +329,7 @@ void DialogShoulderPoint::SetFormula(const QString &value)
void DialogShoulderPoint::SetTypeLine(const QString &value)
{
ChangeCurrentData(ui->comboBoxLineType, value);
vis->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
vis->setLineStyle(LineStyleToPenStyle(value));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -43,6 +43,7 @@
#include <Qt>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/visualization.h"
#include "../../visualization/path/vistoolspline.h"
#include "../ifc/xml/vdomdocument.h"
@ -104,6 +105,7 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
FillComboBoxPoints(ui->comboBoxP1);
FillComboBoxPoints(ui->comboBoxP4);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
CheckState();
@ -608,6 +610,18 @@ void DialogSpline::SetSpline(const VSpline &spline)
path->SetKCurve(spl.GetKcurve());
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSpline::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSpline::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSpline::GetColor() const
{

View File

@ -60,6 +60,9 @@ public:
VSpline GetSpline() const;
void SetSpline(const VSpline &spline);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:

View File

@ -832,14 +832,14 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -849,20 +849,30 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditSplineName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
<item>

View File

@ -47,6 +47,7 @@
#include <Qt>
#include <new>
#include "../../tools/vabstracttool.h"
#include "../../visualization/visualization.h"
#include "../../visualization/path/vistoolsplinepath.h"
#include "../ifc/xml/vdomdocument.h"
@ -102,6 +103,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
FillComboBoxPoints(ui->comboBoxPoint);
FillComboBoxLineColors(ui->comboBoxColor);
FillComboBoxTypeLine(ui->comboBoxPenStyle, CurvePenStylesPics());
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged);
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -166,6 +168,18 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
ui->listWidget->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSplinePath::GetPenStyle() const
{
return GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSplinePath::SetPenStyle(const QString &value)
{
ChangeCurrentData(ui->comboBoxPenStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSplinePath::GetColor() const
{

View File

@ -59,6 +59,9 @@ public:
VSplinePath GetPath() const;
void SetPath(const VSplinePath &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString GetColor() const;
void SetColor(const QString &value);
public slots:

View File

@ -801,30 +801,40 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="labelName">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditSplPathName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxPenStyle"/>
</item>
</layout>
</item>
<item>

View File

@ -299,7 +299,11 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon>
++i;
}
box->setCurrentIndex(4);
const int index = box->findData(QVariant(TypeLineLine));
if (index != -1)
{
box->setCurrentIndex(index);
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -498,7 +498,8 @@ void VAbstractOperation::SaveSourceDestination(QDomElement &tag)
//---------------------------------------------------------------------------------------------------------------------
VSimpleCurve *VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType curveType)
{
VSimpleCurve *curve = new VSimpleCurve(id, QColor(baseColor), *data->GetPatternUnit(), &factor);
const QSharedPointer<VAbstractCurve> initCurve = data->GeometricObject<VAbstractCurve>(id);
VSimpleCurve *curve = new VSimpleCurve(id, initCurve, *data->GetPatternUnit(), &factor);
curve->setParentItem(this);
curve->SetType(curveType);
connect(curve, &VSimpleCurve::Selected, this, &VAbstractOperation::ObjectSelected);

View File

@ -59,9 +59,77 @@ VAbstractSpline::VAbstractSpline(VAbstractPattern *doc, VContainer *data, quint3
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>()),
sceneType(SceneObject::Unknown), isHovered(false), detailsMode(false)
{
InitDefShape();
setAcceptHoverEvents(true);
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractSpline::shape() const
{
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
const QVector<QPointF> points = curve->GetPoints();
QPainterPath path;
for (qint32 i = 0; i < points.count()-1; ++i)
{
path.moveTo(points.at(i));
path.lineTo(points.at(i+1));
}
if (isHovered || detailsMode)
{
path.addPath(curve->GetDirectionPath());
}
path.setFillRule(Qt::WindingFill);
// We unfortunately need this hack as QPainterPathStroker will set a width of 1.0
// if we pass a value of 0.0 to QPainterPathStroker::setWidth()
const qreal penWidthZero = qreal(0.00000001);
if (path == QPainterPath() || pen() == Qt::NoPen)
{
return path;
}
QPainterPathStroker ps;
ps.setCapStyle(pen().capStyle());
if (pen().widthF() <= 0.0)
{
ps.setWidth(penWidthZero);
}
else
{
ps.setWidth(pen().widthF());
}
ps.setJoinStyle(pen().joinStyle());
ps.setMiterLimit(pen().miterLimit());
QPainterPath p = ps.createStroke(path);
p.addPath(path);
return p;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
if (isHovered || detailsMode)
{
painter->save();
QPen arrowPen(pen());
arrowPen.setStyle(Qt::SolidLine);
painter->setPen(arrowPen);
painter->setBrush(brush());
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
painter->drawPath(curve->GetDirectionPath());
painter->restore();
}
QGraphicsPathItem::paint(painter, option, widget);
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::getTagName() const
{
@ -85,8 +153,8 @@ void VAbstractSpline::Disable(bool disable, const QString &namePP)
this->setEnabled(enabled);
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine,
Qt::RoundCap));
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
emit setEnabledPoint(enabled);
}
@ -132,6 +200,13 @@ void VAbstractSpline::SetFactor(qreal factor)
RefreshGeometry();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::RefreshGeometry()
{
InitDefShape();
SetVisualization();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief hoverEnterEvent handle hover enter events.
@ -143,9 +218,9 @@ void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event)
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor, Qt::SolidLine,
Qt::RoundCap));
this->setPath(ToolPath(PathDirection::Show));
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
this->setPath(curve->GetPath());
isHovered = true;
QGraphicsPathItem::hoverEnterEvent(event);
}
@ -161,15 +236,9 @@ void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event)
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
if (detailsMode)
{
this->setPath(ToolPath(PathDirection::Show));
}
else
{
this->setPath(ToolPath());
}
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(curve->GetPenStyle()), Qt::RoundCap));
this->setPath(curve->GetPath());
isHovered = false;
QGraphicsPathItem::hoverLeaveEvent(event);
}
@ -246,16 +315,6 @@ void VAbstractSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
QGraphicsPathItem::mouseReleaseEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const
{
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
QPainterPath path;
path.addPath(curve->GetPath(direction));
path.setFillRule( Qt::WindingFill );
return path;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
{
@ -269,6 +328,7 @@ void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
const QSharedPointer<VAbstractCurve> curve = qSharedPointerCast<VAbstractCurve>(obj);
doc->SetAttribute(tag, AttrColor, curve->GetColor());
doc->SetAttribute(tag, AttrPenStyle, curve->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -339,6 +399,16 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
return spl;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::InitDefShape()
{
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
this->setPen(QPen(CorrectColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(curve->GetPenStyle())));
this->setPath(curve->GetPath());
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::ShowHandles(bool show)
{
@ -352,16 +422,19 @@ void VAbstractSpline::ShowHandles(bool show)
void VAbstractSpline::setEnabled(bool enabled)
{
QGraphicsPathItem::setEnabled(enabled);
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
if (enabled)
{
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
setPen(QPen(QColor(curve->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(curve->GetPenStyle())));
}
else
{
setPen(QPen(Qt::gray,
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(curve->GetPenStyle())));
}
}
@ -381,6 +454,22 @@ void VAbstractSpline::SetLineColor(const QString &value)
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::GetPenStyle() const
{
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
return curve->GetPenStyle();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::SetPenStyle(const QString &value)
{
QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
curve->SetPenStyle(value);
QSharedPointer<VGObject> obj = qSharedPointerCast<VGObject>(curve);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::name() const
{

View File

@ -61,6 +61,8 @@ public:
VAbstractSpline(VAbstractPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr);
virtual ~VAbstractSpline() Q_DECL_EQ_DEFAULT;
virtual QPainterPath shape() const Q_DECL_OVERRIDE;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::AbstractSpline)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
@ -71,6 +73,9 @@ public:
QString GetLineColor() const;
void SetLineColor(const QString &value);
QString GetPenStyle() const;
void SetPenStyle(const QString &value);
QString name() const;
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
@ -98,7 +103,7 @@ protected:
/**
* @brief RefreshGeometry refresh item on scene.
*/
virtual void RefreshGeometry ()=0;
virtual void RefreshGeometry();
virtual void ShowTool(quint32 id, bool enable) Q_DECL_OVERRIDE;
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
@ -106,12 +111,13 @@ protected:
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const;
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
VSpline CorrectedSpline(const VSpline &spline, const SplinePointPosition &position, const QPointF &pos) const;
void InitDefShape();
template <typename T>
void ShowToolVisualization(bool show);

View File

@ -73,8 +73,6 @@ VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const So
{
sceneType = SceneObject::Arc;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
ToolCreation(typeCreation);
@ -95,6 +93,7 @@ void VToolArc::setDialog()
dialogTool->SetF2(arc->GetFormulaF2());
dialogTool->SetRadius(arc->GetFormulaRadius());
dialogTool->SetColor(arc->GetColor());
dialogTool->SetPenStyle(arc->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -116,7 +115,8 @@ VToolArc* VToolArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene
QString f1 = dialogTool->GetF1();
QString f2 = dialogTool->GetF2();
const QString color = dialogTool->GetColor();
VToolArc* point = Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse,
const QString penStyle = dialogTool->GetPenStyle();
VToolArc* point = Create(0, center, radius, f1, f2, color, penStyle, scene, doc, data, Document::FullParse,
Source::FromGui);
if (point != nullptr)
{
@ -140,8 +140,8 @@ VToolArc* VToolArc::Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene
* @param typeCreation way we create this tool.
*/
VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
const QString &color, const QString &penStyle, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
{
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
@ -153,6 +153,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
const VPointF c = *data->GeometricObject<VPointF>(center);
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
arc->SetColor(color);
arc->SetPenStyle(penStyle);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
@ -350,6 +351,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -381,20 +383,7 @@ void VToolArc::SetVisualization()
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), qApp->Settings()->GetOsSeparator()));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), qApp->Settings()->GetOsSeparator()));
visual->setF2(trVars->FormulaToUser(arc->GetFormulaF2(), qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->RefreshGeometry();
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolArc::RefreshGeometry()
{
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
this->setPen(QPen(CorrectColor(arc->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());
SetVisualization();
}

View File

@ -54,8 +54,8 @@ public:
static VToolArc* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolArc* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
const QString &color, const QString &penStyle, 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;}
@ -88,8 +88,6 @@ private:
VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
};
#endif // VTOOLARC_H

View File

@ -65,8 +65,6 @@ VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data,
{
sceneType = SceneObject::Arc;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
ToolCreation(typeCreation);
@ -84,6 +82,7 @@ void VToolArcWithLength::setDialog()
dialogTool->SetLength(arc->GetFormulaLength());
dialogTool->SetRadius(arc->GetFormulaRadius());
dialogTool->SetColor(arc->GetColor());
dialogTool->SetPenStyle(arc->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -98,8 +97,9 @@ VToolArcWithLength *VToolArcWithLength::Create(QSharedPointer<DialogTool> dialog
QString f1 = dialogTool->GetF1();
QString length = dialogTool->GetLength();
const QString color = dialogTool->GetColor();
VToolArcWithLength* point = Create(0, center, radius, f1, length, color, scene, doc, data, Document::FullParse,
Source::FromGui);
const QString penStyle = dialogTool->GetPenStyle();
VToolArcWithLength* point = Create(0, center, radius, f1, length, color, penStyle, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -109,9 +109,9 @@ VToolArcWithLength *VToolArcWithLength::Create(QSharedPointer<DialogTool> dialog
//---------------------------------------------------------------------------------------------------------------------
VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1,
QString &length, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
QString &length, const QString &color, const QString &penStyle,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
qreal calcRadius = 0, calcF1 = 0, calcLength = 0;
@ -122,6 +122,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
const VPointF c = *data->GeometricObject<VPointF>(center);
VArc *arc = new VArc(calcLength, length, c, calcRadius, radius, calcF1, f1);
arc->SetColor(color);
arc->SetPenStyle(penStyle);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
@ -306,6 +307,7 @@ void VToolArcWithLength::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
doc->SetAttribute(domElement, AttrLength, dialogTool->GetLength());
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -337,17 +339,7 @@ void VToolArcWithLength::SetVisualization()
visual->setRadius(trVars->FormulaToUser(arc->GetFormulaRadius(), qApp->Settings()->GetOsSeparator()));
visual->setF1(trVars->FormulaToUser(arc->GetFormulaF1(), qApp->Settings()->GetOsSeparator()));
visual->setLength(trVars->FormulaToUser(arc->GetFormulaLength(), qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(arc->GetPenStyle()));
visual->RefreshGeometry();
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::RefreshGeometry()
{
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
this->setPen(QPen(CorrectColor(arc->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());
SetVisualization();
}

View File

@ -51,9 +51,9 @@ public:
static VToolArcWithLength* Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolArcWithLength* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1,
QString &length, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
QString &length, const QString &color, const QString &penStyle,
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;}
@ -86,9 +86,6 @@ private:
VToolArcWithLength(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
};
#endif // VTOOLARCWITHLENGTH_H

View File

@ -63,8 +63,6 @@ VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quin
{
sceneType = SceneObject::Spline;
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
ToolCreation(typeCreation);
@ -79,6 +77,7 @@ void VToolCubicBezier::setDialog()
const auto spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(spl->GetColor());
dialogTool->SetPenStyle(spl->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -89,8 +88,11 @@ VToolCubicBezier *VToolCubicBezier::Create(QSharedPointer<DialogTool> dialog, VM
QSharedPointer<DialogCubicBezier> dialogTool = dialog.objectCast<DialogCubicBezier>();
SCASSERT(not dialogTool.isNull())
auto spl = Create(0, new VCubicBezier(dialogTool->GetSpline()), dialogTool->GetColor(), scene, doc, data,
Document::FullParse, Source::FromGui);
VCubicBezier *spline = new VCubicBezier(dialogTool->GetSpline());
spline->SetColor(dialogTool->GetColor());
spline->SetPenStyle(dialogTool->GetPenStyle());
auto spl = Create(0, spline, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
@ -100,12 +102,11 @@ VToolCubicBezier *VToolCubicBezier::Create(QSharedPointer<DialogTool> dialog, VM
}
//---------------------------------------------------------------------------------------------------------------------
VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spline, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spline, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
quint32 id = _id;
spline->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(spline);
@ -222,6 +223,7 @@ void VToolCubicBezier::SaveDialog(QDomElement &domElement)
SetSplineAttributes(domElement, spl);
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -247,6 +249,7 @@ void VToolCubicBezier::SetVisualization()
visual->setObject2Id(spl->GetP2().id());
visual->setObject3Id(spl->GetP3().id());
visual->setObject4Id(spl->GetP4().id());
visual->setLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}
@ -257,15 +260,9 @@ void VToolCubicBezier::RefreshGeometry()
{
const QSharedPointer<VCubicBezier> spl = VAbstractTool::data.GeometricObject<VCubicBezier>(id);
this->setPen(QPen(CorrectColor(spl->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
if (isHovered || detailsMode)
{
this->setPath(ToolPath(PathDirection::Show));
}
else
{
this->setPath(ToolPath());
}
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(spl->GetPenStyle())));
this->setPath(spl->GetPath());
SetVisualization();
}

View File

@ -51,9 +51,9 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCubicBezier *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCubicBezier *Create(const quint32 _id, VCubicBezier *spline, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static VToolCubicBezier *Create(const quint32 _id, VCubicBezier *spline, 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::CubicBezier)};
@ -73,13 +73,13 @@ protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolCubicBezier)
VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
void SetSplineAttributes(QDomElement &domElement, const VCubicBezier &spl);
};

View File

@ -65,8 +65,6 @@ VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *da
{
sceneType = SceneObject::SplinePath;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
ToolCreation(typeCreation);
@ -81,6 +79,7 @@ void VToolCubicBezierPath::setDialog()
const QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(splPath->GetColor());
dialogTool->SetPenStyle(splPath->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -92,11 +91,15 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(QSharedPointer<DialogTool> di
SCASSERT(not dialogTool.isNull())
auto path = new VCubicBezierPath(dialogTool->GetPath());
const QString color = dialogTool->GetColor();
const QString penStyle = dialogTool->GetPenStyle();
for (qint32 i = 0; i < path->CountPoints(); ++i)
{
doc->IncrementReferens((*path)[i].getIdTool());
}
VToolCubicBezierPath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
path->SetColor(color);
path->SetPenStyle(penStyle);
VToolCubicBezierPath* spl = Create(0, path, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->m_dialog = dialogTool;
@ -105,12 +108,11 @@ VToolCubicBezierPath *VToolCubicBezierPath::Create(QSharedPointer<DialogTool> di
}
//---------------------------------------------------------------------------------------------------------------------
VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezierPath *path, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
VToolCubicBezierPath *VToolCubicBezierPath::Create(const quint32 _id, VCubicBezierPath *path, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
quint32 id = _id;
path->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(path);
@ -202,6 +204,7 @@ void VToolCubicBezierPath::SaveDialog(QDomElement &domElement)
SCASSERT(dialogTool != nullptr)
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
SetSplinePathAttributes(domElement, dialogTool->GetPath());
}
@ -226,6 +229,7 @@ void VToolCubicBezierPath::SetVisualization()
QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
visual->setPath(*splPath.data());
visual->setLineStyle(LineStyleToPenStyle(splPath->GetPenStyle()));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}
@ -234,11 +238,12 @@ void VToolCubicBezierPath::SetVisualization()
//---------------------------------------------------------------------------------------------------------------------
void VToolCubicBezierPath::RefreshGeometry()
{
isHovered || detailsMode ? setPath(ToolPath(PathDirection::Show)) : setPath(ToolPath());
QSharedPointer<VCubicBezierPath> splPath = VAbstractTool::data.GeometricObject<VCubicBezierPath>(id);
setPath(splPath->GetPath());
this->setPen(QPen(CorrectColor(splPath->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(splPath->GetPenStyle())));
SetVisualization();
}

View File

@ -51,9 +51,9 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolCubicBezierPath *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolCubicBezierPath *Create(const quint32 _id, VCubicBezierPath *path, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static VToolCubicBezierPath *Create(const quint32 _id, VCubicBezierPath *path, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
static void UpdatePathPoints(VAbstractPattern *doc, QDomElement &element, const VCubicBezierPath &path);
@ -70,13 +70,13 @@ protected:
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolCubicBezierPath)
VToolCubicBezierPath(VAbstractPattern *doc, VContainer *data, quint32 id,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
static void AddPathPoint(VAbstractPattern *doc, QDomElement &domElement, const VPointF &splPoint);
void SetSplinePathAttributes(QDomElement &domElement, const VCubicBezierPath &path);
};

View File

@ -73,8 +73,6 @@ VToolEllipticalArc::VToolEllipticalArc(VAbstractPattern *doc, VContainer *data,
{
sceneType = SceneObject::ElArc;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
ToolCreation(typeCreation);
@ -97,9 +95,9 @@ void VToolEllipticalArc::setDialog()
dialogTool->SetRadius2(elArc->GetFormulaRadius2());
dialogTool->SetRotationAngle(elArc->GetFormulaRotationAngle());
dialogTool->SetColor(elArc->GetColor());
dialogTool->SetPenStyle(elArc->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Create help create tool
@ -122,8 +120,9 @@ VToolEllipticalArc* VToolEllipticalArc::Create(QSharedPointer<DialogTool> dialog
QString f2 = dialogTool->GetF2();
QString rotationAngle = dialogTool->GetRotationAngle();
const QString color = dialogTool->GetColor();
VToolEllipticalArc* point = Create(0, center, radius1, radius2, f1, f2, rotationAngle, color, scene, doc, data,
Document::FullParse, Source::FromGui);
const QString penStyle = dialogTool->GetPenStyle();
VToolEllipticalArc* point = Create(0, center, radius1, radius2, f1, f2, rotationAngle, color, penStyle, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->m_dialog = dialogTool;
@ -150,8 +149,9 @@ VToolEllipticalArc* VToolEllipticalArc::Create(QSharedPointer<DialogTool> dialog
*/
VToolEllipticalArc* VToolEllipticalArc::Create(const quint32 _id, const quint32 &center, QString &radius1,
QString &radius2, QString &f1, QString &f2, QString &rotationAngle,
const QString &color, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
const QString &color, const QString &penStyle, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
qreal calcRadius1 = 0, calcRadius2 = 0, calcF1 = 0, calcF2 = 0, calcRotationAngle = 0;
@ -166,6 +166,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(const quint32 _id, const quint32
VEllipticalArc *elArc = new VEllipticalArc(c, calcRadius1, calcRadius2, radius1, radius2, calcF1, f1, calcF2, f2,
calcRotationAngle, rotationAngle);
elArc->SetColor(color);
elArc->SetPenStyle(penStyle);
quint32 id = _id;
if (typeCreation == Source::FromGui)
{
@ -418,6 +419,7 @@ void VToolEllipticalArc::SaveDialog(QDomElement &domElement)
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
doc->SetAttribute(domElement, AttrRotationAngle, dialogTool->GetRotationAngle());
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -454,20 +456,7 @@ void VToolEllipticalArc::SetVisualization()
visual->setF2(trVars->FormulaToUser(elArc->GetFormulaF2(), qApp->Settings()->GetOsSeparator()));
visual->setRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(),
qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(LineStyleToPenStyle(elArc->GetPenStyle()));
visual->RefreshGeometry();
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief RefreshGeometry refresh item on scene.
*/
void VToolEllipticalArc::RefreshGeometry()
{
const QSharedPointer<VEllipticalArc> elArc = VAbstractTool::data.GeometricObject<VEllipticalArc>(id);
this->setPen(QPen(CorrectColor(elArc->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setPath(ToolPath());
SetVisualization();
}

View File

@ -55,7 +55,8 @@ public:
VAbstractPattern *doc, VContainer *data);
static VToolEllipticalArc* Create(const quint32 _id, const quint32 &center, QString &radius1, QString &radius2,
QString &f1, QString &f2, QString &rotationAngle, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const QString &penStyle, 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;}
@ -95,8 +96,6 @@ private:
Q_DISABLE_COPY(VToolEllipticalArc)
VToolEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
};
#endif // VTOOLELLIPTICALARC_H

View File

@ -87,10 +87,8 @@ VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, co
{
sceneType = SceneObject::Spline;
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsMovable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
this->setPath(ToolPath());
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
@ -144,6 +142,7 @@ void VToolSpline::setDialog()
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
dialogTool->SetSpline(*spl);
dialogTool->SetColor(spl->GetColor());
dialogTool->SetPenStyle(spl->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -163,8 +162,10 @@ VToolSpline* VToolSpline::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
SCASSERT(not dialogTool.isNull())
VSpline *spline = new VSpline(dialogTool->GetSpline());
spline->SetColor(dialogTool->GetColor());
spline->SetPenStyle(dialogTool->GetPenStyle());
auto spl = Create(0, spline, dialogTool->GetColor(), scene, doc, data, Document::FullParse, Source::FromGui);
auto spl = Create(0, spline, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
@ -185,12 +186,11 @@ VToolSpline* VToolSpline::Create(QSharedPointer<DialogTool> dialog, VMainGraphic
* @param typeCreation way we create this tool.
* @return the created tool
*/
VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
quint32 id = _id;
spline->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(spline);
@ -223,8 +223,8 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri
//---------------------------------------------------------------------------------------------------------------------
VToolSpline *VToolSpline::Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2,
QString &l1, QString &l2, quint32 duplicate, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
const QString &penStyle, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
{
const qreal calcAngle1 = CheckFormula(_id, a1, data);
const qreal calcAngle2 = CheckFormula(_id, a2, data);
@ -241,7 +241,10 @@ VToolSpline *VToolSpline::Create(const quint32 _id, quint32 point1, quint32 poin
spline->SetDuplicate(duplicate);
}
return VToolSpline::Create(_id, spline, color, scene, doc, data, parse, typeCreation);
spline->SetColor(color);
spline->SetPenStyle(penStyle);
return VToolSpline::Create(_id, spline, scene, doc, data, parse, typeCreation);
}
//---------------------------------------------------------------------------------------------------------------------
@ -343,6 +346,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
SetSplineAttributes(domElement, spl);
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -512,6 +516,7 @@ void VToolSpline::SetVisualization()
visual->SetKAsm1(spl->GetKasm1());
visual->SetKAsm2(spl->GetKasm2());
visual->SetKCurve(spl->GetKcurve());
visual->setLineStyle(LineStyleToPenStyle(spl->GetPenStyle()));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}
@ -543,15 +548,9 @@ void VToolSpline::RefreshGeometry()
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
this->setPen(QPen(CorrectColor(spl->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
if (isHovered || detailsMode)
{
this->setPath(ToolPath(PathDirection::Show));
}
else
{
this->setPath(ToolPath());
}
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(spl->GetPenStyle())));
this->setPath(spl->GetPath());
controlPoints[0]->blockSignals(true);
controlPoints[1]->blockSignals(true);

View File

@ -55,11 +55,11 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolSpline *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data);
static VToolSpline *Create(const quint32 _id, VSpline *spline, const QString &color, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static VToolSpline *Create(const quint32 _id, VSpline *spline,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static VToolSpline *Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2, QString &l1,
QString &l2, quint32 duplicate, const QString &color,
QString &l2, quint32 duplicate, const QString &color, const QString &penStyle,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
@ -86,6 +86,7 @@ protected:
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VToolSpline)
QPointF oldPosition;
@ -94,7 +95,6 @@ private:
QGraphicsItem * parent = nullptr );
bool IsMovable() const;
virtual void RefreshGeometry() Q_DECL_OVERRIDE;
void SetSplineAttributes(QDomElement &domElement, const VSpline &spl);
};

View File

@ -94,8 +94,6 @@ VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint3
{
sceneType = SceneObject::SplinePath;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
this->setFlag(QGraphicsItem::ItemIsMovable, true);
this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
@ -154,6 +152,7 @@ void VToolSplinePath::setDialog()
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
dialogTool->SetPath(*splPath);
dialogTool->SetColor(splPath->GetColor());
dialogTool->SetPenStyle(splPath->GetPenStyle());
}
//---------------------------------------------------------------------------------------------------------------------
@ -175,8 +174,11 @@ VToolSplinePath* VToolSplinePath::Create(QSharedPointer<DialogTool> dialog, VMai
{
doc->IncrementReferens((*path)[i].P().getIdTool());
}
VToolSplinePath* spl = Create(0, path, dialogTool->GetColor(), scene, doc, data, Document::FullParse,
Source::FromGui);
path->SetColor(dialogTool->GetColor());
path->SetPenStyle(dialogTool->GetPenStyle());
VToolSplinePath* spl = Create(0, path, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->m_dialog = dialogTool;
@ -195,12 +197,12 @@ VToolSplinePath* VToolSplinePath::Create(QSharedPointer<DialogTool> dialog, VMai
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, const QString &color,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
quint32 id = _id;
path->SetColor(color);
if (typeCreation == Source::FromGui)
{
id = data->AddGObject(path);
@ -231,9 +233,9 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, c
//---------------------------------------------------------------------------------------------------------------------
VToolSplinePath *VToolSplinePath::Create(const quint32 _id, const QVector<quint32> &points, QVector<QString> &a1,
QVector<QString> &a2, QVector<QString> &l1, QVector<QString> &l2,
const QString &color, quint32 duplicate, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
const QString &color, const QString &penStyle, quint32 duplicate,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
auto path = new VSplinePath();
@ -256,7 +258,10 @@ VToolSplinePath *VToolSplinePath::Create(const quint32 _id, const QVector<quint3
l2.at(i)));
}
return VToolSplinePath::Create(_id, path, color, scene, doc, data, parse, typeCreation);
path->SetColor(color);
path->SetPenStyle(penStyle);
return VToolSplinePath::Create(_id, path, scene, doc, data, parse, typeCreation);
}
//---------------------------------------------------------------------------------------------------------------------
@ -461,6 +466,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
}
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
SetSplinePathAttributes(domElement, splPath);
}
@ -632,6 +638,7 @@ void VToolSplinePath::SetVisualization()
QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
visual->setPath(*splPath.data());
visual->setLineStyle(LineStyleToPenStyle(splPath->GetPenStyle()));
visual->SetMode(Mode::Show);
visual->RefreshGeometry();
}
@ -666,18 +673,12 @@ void VToolSplinePath::RefreshGeometry()
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
}
if (isHovered || detailsMode)
{
this->setPath(ToolPath(PathDirection::Show));
}
else
{
this->setPath(ToolPath());
}
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
this->setPath(splPath->GetPath());
this->setPen(QPen(CorrectColor(splPath->GetColor()),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(splPath->GetPenStyle())));
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)
{

View File

@ -57,14 +57,14 @@ public:
virtual void setDialog() Q_DECL_OVERRIDE;
static VToolSplinePath *Create(QSharedPointer<DialogTool> dialog, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data);
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static VToolSplinePath *Create(const quint32 _id, const QVector<quint32> &points, QVector<QString> &a1,
QVector<QString> &a2, QVector<QString> &l1, QVector<QString> &l2,
const QString &color, quint32 duplicate, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
const QString &color, const QString &penStyle, quint32 duplicate,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
static const QString OldToolType;
static void UpdatePathPoints(VAbstractPattern *doc, QDomElement &element, const VSplinePath &path);

View File

@ -246,6 +246,10 @@ void VToolCutArc::SetVisualization()
visual->setObject1Id(curveCutId);
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(curveCutId);
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->RefreshGeometry();
}
}

View File

@ -246,6 +246,10 @@ void VToolCutSpline::SetVisualization()
visual->setObject1Id(curveCutId);
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(curveCutId);
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->RefreshGeometry();
}
}

View File

@ -333,6 +333,10 @@ void VToolCutSplinePath::SetVisualization()
visual->setObject1Id(curveCutId);
visual->setLength(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator()));
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(curveCutId);
visual->setLineStyle(LineStyleToPenStyle(curve->GetPenStyle()));
visual->RefreshGeometry();
}
}

View File

@ -152,7 +152,7 @@ void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
//---------------------------------------------------------------------------------------------------------------------
void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
@ -169,7 +169,7 @@ void VToolAlongLine::SetVisualization()
visual->setObject1Id(basePointId);
visual->setObject2Id(secondPointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength, qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}
@ -208,7 +208,7 @@ void VToolAlongLine::setDialog()
QSharedPointer<DialogAlongLine> dialogTool = m_dialog.objectCast<DialogAlongLine>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetFormula(formulaLength);
dialogTool->SetFirstPointId(basePointId);

View File

@ -125,7 +125,7 @@ void VToolBisector::setDialog()
QSharedPointer<DialogBisector> dialogTool = m_dialog.objectCast<DialogBisector>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetFormula(formulaLength);
dialogTool->SetFirstPointId(firstPointId);
@ -317,7 +317,7 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolBisector::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
@ -337,7 +337,7 @@ void VToolBisector::SetVisualization()
visual->setObject2Id(basePointId);
visual->setObject3Id(thirdPointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength, qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -89,7 +89,7 @@ void VToolCurveIntersectAxis::setDialog()
QSharedPointer<DialogCurveIntersectAxis> dialogTool = m_dialog.objectCast<DialogCurveIntersectAxis>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetAngle(formulaAngle);
dialogTool->SetBasePointId(basePointId);
@ -303,7 +303,7 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObj
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
curveId = doc->GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
@ -321,7 +321,7 @@ void VToolCurveIntersectAxis::SetVisualization()
visual->setObject1Id(curveId);
visual->setAxisPointId(basePointId);
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle, qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -89,7 +89,7 @@ void VToolEndLine::setDialog()
QSharedPointer<DialogEndLine> dialogTool = m_dialog.objectCast<DialogEndLine>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetFormula(formulaLength);
dialogTool->SetAngle(formulaAngle);
@ -238,7 +238,7 @@ void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolEndLine::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
@ -256,7 +256,7 @@ void VToolEndLine::SetVisualization()
visual->setObject1Id(basePointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength, qApp->Settings()->GetOsSeparator()));
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle, qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -84,7 +84,7 @@ void VToolHeight::setDialog()
QSharedPointer<DialogHeight> dialogTool = m_dialog.objectCast<DialogHeight>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetBasePointId(basePointId);
dialogTool->SetP1LineId(p1LineId);
@ -262,7 +262,7 @@ void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolHeight::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
p1LineId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
@ -280,7 +280,7 @@ void VToolHeight::SetVisualization()
visual->setObject1Id(basePointId);
visual->setLineP1Id(p1LineId);
visual->setLineP2Id(p2LineId);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -75,7 +75,7 @@ void VToolLineIntersectAxis::setDialog()
QSharedPointer<DialogLineIntersectAxis> dialogTool = m_dialog.objectCast<DialogLineIntersectAxis>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetAngle(formulaAngle);
dialogTool->SetBasePointId(basePointId);
@ -307,7 +307,7 @@ void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObje
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
firstPointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
@ -327,7 +327,7 @@ void VToolLineIntersectAxis::SetVisualization()
visual->setPoint2Id(secondPointId);
visual->setAxisPointId(basePointId);
visual->SetAngle(qApp->TrVars()->FormulaToUser(formulaAngle, qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -70,7 +70,7 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
mainLine(nullptr), lineColor(lineColor)
{
this->typeLine = typeLine;
this->m_lineType = typeLine;
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
QPointF point1 = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
QPointF point2 = static_cast<QPointF>(*data->GeometricObject<VPointF>(id));
@ -95,7 +95,7 @@ void VToolLinePoint::RefreshGeometry()
{
mainLine->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
LineStyleToPenStyle(m_lineType)));
VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
QPointF point = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(id));
QPointF basePoint = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(basePointId));
@ -117,7 +117,7 @@ void VToolLinePoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
{
VToolSinglePoint::SaveOptions(tag, obj);
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrTypeLine, m_lineType);
doc->SetAttribute(tag, AttrLineColor, lineColor);
}
@ -138,7 +138,7 @@ void VToolLinePoint::Disable(bool disable, const QString &namePP)
VToolSinglePoint::Disable(disable, namePP);
mainLine->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
LineStyleToPenStyle(m_lineType)));
mainLine->setEnabled(enabled);
}

View File

@ -91,7 +91,7 @@ void VToolNormal::setDialog()
QSharedPointer<DialogNormal> dialogTool = m_dialog.objectCast<DialogNormal>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetFormula(formulaLength);
dialogTool->SetAngle(angle);
dialogTool->SetFirstPointId(basePointId);
@ -290,7 +290,7 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
//---------------------------------------------------------------------------------------------------------------------
void VToolNormal::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
@ -310,7 +310,7 @@ void VToolNormal::SetVisualization()
visual->setObject2Id(secondPointId);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength, qApp->Settings()->GetOsSeparator()));
visual->SetAngle(angle);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -93,7 +93,7 @@ void VToolShoulderPoint::setDialog()
QSharedPointer<DialogShoulderPoint> dialogTool = m_dialog.objectCast<DialogShoulderPoint>();
SCASSERT(not dialogTool.isNull())
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
dialogTool->SetFormula(formulaLength);
dialogTool->SetP1Line(basePointId);
@ -335,7 +335,7 @@ void VToolShoulderPoint::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
//---------------------------------------------------------------------------------------------------------------------
void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement)
{
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
basePointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
@ -355,7 +355,7 @@ void VToolShoulderPoint::SetVisualization()
visual->setLineP1Id(basePointId);
visual->setLineP2Id(p2Line);
visual->setLength(qApp->TrVars()->FormulaToUser(formulaLength, qApp->Settings()->GetOsSeparator()));
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}

View File

@ -61,7 +61,7 @@ qreal VDrawTool::factor = 1;
VDrawTool::VDrawTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent)
: VInteractiveTool(doc, data, id, parent),
nameActivDraw(doc->GetNameActivPP()),
typeLine(TypeLineLine),
m_lineType(TypeLineLine),
enabled(true)
{
connect(this->doc, &VAbstractPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
@ -263,13 +263,13 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement)
//---------------------------------------------------------------------------------------------------------------------
QString VDrawTool::getLineType() const
{
return typeLine;
return m_lineType;
}
//---------------------------------------------------------------------------------------------------------------------
void VDrawTool::SetTypeLine(const QString &value)
{
typeLine = value;
m_lineType = value;
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
SaveOption(obj);

View File

@ -89,7 +89,7 @@ protected:
QString nameActivDraw;
/** @brief typeLine line type. */
QString typeLine;
QString m_lineType;
bool enabled;

View File

@ -72,7 +72,7 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
lineColor(lineColor)
{
this->typeLine = typeLine;
this->m_lineType = typeLine;
//Line
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
@ -98,7 +98,7 @@ void VToolLine::setDialog()
SCASSERT(not dialogTool.isNull())
dialogTool->SetFirstPoint(firstPoint);
dialogTool->SetSecondPoint(secondPoint);
dialogTool->SetTypeLine(typeLine);
dialogTool->SetTypeLine(m_lineType);
dialogTool->SetLineColor(lineColor);
}
@ -245,7 +245,7 @@ void VToolLine::Disable(bool disable, const QString &namePP)
this->setEnabled(enabled);
this->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
LineStyleToPenStyle(m_lineType)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -318,7 +318,7 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event)
this->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
LineStyleToPenStyle(m_lineType)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -333,7 +333,7 @@ void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
this->setPen(QPen(CorrectColor(lineColor),
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor,
LineStyleToPenStyle(typeLine)));
LineStyleToPenStyle(m_lineType)));
}
}
@ -415,7 +415,7 @@ void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
doc->SetAttribute(tag, AttrFirstPoint, firstPoint);
doc->SetAttribute(tag, AttrSecondPoint, secondPoint);
doc->SetAttribute(tag, AttrTypeLine, typeLine);
doc->SetAttribute(tag, AttrTypeLine, m_lineType);
doc->SetAttribute(tag, AttrLineColor, lineColor);
}
@ -424,7 +424,7 @@ void VToolLine::ReadToolAttributes(const QDomElement &domElement)
{
firstPoint = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
secondPoint = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
}
@ -438,7 +438,7 @@ void VToolLine::SetVisualization()
visual->setObject1Id(firstPoint);
visual->setPoint2Id(secondPoint);
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
visual->setLineStyle(LineStyleToPenStyle(m_lineType));
visual->RefreshGeometry();
}
}
@ -489,7 +489,7 @@ void VToolLine::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SetTypeLine(const QString &value)
{
typeLine = value;
m_lineType = value;
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
SaveOption(obj);
@ -544,5 +544,5 @@ void VToolLine::RefreshGeometry()
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
this->setLine(QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)));
this->setPen(QPen(CorrectColor(lineColor), pen().widthF(), LineStyleToPenStyle(typeLine)));
this->setPen(QPen(CorrectColor(lineColor), pen().widthF(), LineStyleToPenStyle(m_lineType)));
}

View File

@ -290,85 +290,6 @@ int VAbstractTool::ConfirmDeletion()
return dialogResult == QDialog::Accepted ? QMessageBox::Yes : QMessageBox::No;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineStyle return pen style for current line style.
* @return pen style.
*/
Qt::PenStyle VAbstractTool::LineStyleToPenStyle(const QString &typeLine)
{
const QStringList styles = StylesList();
switch (styles.indexOf(typeLine))
{
case 0: // TypeLineNone
return Qt::NoPen;
case 2: // TypeLineDashLine
return Qt::DashLine;
case 3: // TypeLineDotLine
return Qt::DotLine;
case 4: // TypeLineDashDotLine
return Qt::DashDotLine;
case 5: // TypeLineDashDotDotLine
return Qt::DashDotDotLine;
case 1: // TypeLineLine
default:
return Qt::SolidLine;
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractTool::PenStyleToLineStyle(Qt::PenStyle penStyle)
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default")
switch (penStyle)
{
case Qt::NoPen:
return TypeLineNone;
case Qt::DashLine:
return TypeLineDashLine;
case Qt::DotLine:
return TypeLineDotLine;
case Qt::DashDotLine:
return TypeLineDashDotLine;
case Qt::DashDotDotLine:
return TypeLineDashDotDotLine;
case Qt::SolidLine:
case Qt::CustomDashLine:
default:
break;
}
QT_WARNING_POP
return TypeLineLine;
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QIcon> VAbstractTool::LineStylesPics()
{
QMap<QString, QIcon> map;
const QStringList styles = StylesList();
for (int i=0; i < styles.size(); ++i)
{
const Qt::PenStyle style = LineStyleToPenStyle(styles.at(i));
QPixmap pix(80, 14);
pix.fill(Qt::white);
QBrush brush(Qt::black);
QPen pen(brush, 2.5, style);
QPainter painter(&pix);
painter.setPen(pen);
painter.drawLine(2, 7, 78, 7);
map.insert(styles.at(i), QIcon(pix));
}
return map;
}
//---------------------------------------------------------------------------------------------------------------------
const QStringList VAbstractTool::Colors()
{
@ -492,19 +413,6 @@ void VAbstractTool::ToolCreation(const Source &typeCreation)
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Styles return list of all line styles.
* @return list of all line styles.
*/
const QStringList VAbstractTool::StylesList()
{
const QStringList styles = QStringList() << TypeLineNone << TypeLineLine << TypeLineDashLine
<< TypeLineDotLine << TypeLineDashDotLine
<< TypeLineDashDotDotLine;
return styles;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddRecord add record about tool in history.

View File

@ -64,11 +64,6 @@ public:
static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data);
static const QStringList StylesList();
static Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
static QString PenStyleToLineStyle(Qt::PenStyle penStyle);
static QMap<QString, QIcon> LineStylesPics();
static const QStringList Colors();
static QMap<QString, QString> ColorsList();

View File

@ -46,7 +46,6 @@ VisOperation::VisOperation(const VContainer *data, QGraphicsItem *parent)
points(),
curves()
{
}
//---------------------------------------------------------------------------------------------------------------------
@ -82,7 +81,7 @@ QGraphicsEllipseItem *VisOperation::GetPoint(quint32 i, const QColor &color)
}
//---------------------------------------------------------------------------------------------------------------------
QGraphicsPathItem *VisOperation::GetCurve(quint32 i, const QColor &color)
VCurvePathItem *VisOperation::GetCurve(quint32 i, const QColor &color)
{
if (not curves.isEmpty() && static_cast<quint32>(curves.size() - 1) >= i)
{
@ -90,7 +89,7 @@ QGraphicsPathItem *VisOperation::GetCurve(quint32 i, const QColor &color)
}
else
{
auto curve = InitItem<QGraphicsPathItem>(color, this);
auto curve = InitItem<VCurvePathItem>(color, this);
curves.append(curve);
return curve;
}

View File

@ -51,10 +51,10 @@ protected:
QColor supportColor2;
QVector<QGraphicsEllipseItem *> points;
QVector<QGraphicsPathItem *> curves;
QVector<VCurvePathItem *> curves;
QGraphicsEllipseItem * GetPoint(quint32 i, const QColor &color);
QGraphicsPathItem * GetCurve(quint32 i, const QColor &color);
VCurvePathItem * GetCurve(quint32 i, const QColor &color);
template <class Item>
int AddFlippedCurve(const QPointF &firstPoint, const QPointF &secondPoint, quint32 id, int i);
@ -71,7 +71,7 @@ int VisOperation::AddFlippedCurve(const QPointF &firstPoint, const QPointF &seco
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
++i;
QGraphicsPathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
DrawPath(path, curve->GetPath(PathDirection::Show), supportColor2, Qt::SolidLine, Qt::RoundCap);
++i;

View File

@ -165,7 +165,7 @@ QGraphicsPathItem *VisToolMove::AddOriginCurve(quint32 id, int &i)
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
++i;
QGraphicsPathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
DrawPath(path, curve->GetPath(PathDirection::Show), supportColor2, Qt::SolidLine, Qt::RoundCap);
return path;
@ -178,7 +178,7 @@ int VisToolMove::AddMovedCurve(qreal angle, qreal length, quint32 id, int i)
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
++i;
QGraphicsPathItem *path = GetCurve(static_cast<quint32>(i), supportColor);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor);
const Item moved = curve->Move(length, angle);
DrawPath(path, moved.GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);

View File

@ -64,7 +64,7 @@ VisToolRotation::VisToolRotation(const VContainer *data, QGraphicsItem *parent)
xAxis(nullptr)
{
point = InitPoint(supportColor2, this);
angleArc = InitItem<QGraphicsPathItem>(supportColor2, this);
angleArc = InitItem<VCurvePathItem>(supportColor2, this);
xAxis = InitItem<QGraphicsLineItem>(supportColor2, this);
}
@ -216,7 +216,7 @@ int VisToolRotation::AddCurve(qreal angle, const QPointF &origin, quint32 id, in
const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
++i;
QGraphicsPathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor2);
DrawPath(path, curve->GetPath(PathDirection::Show), supportColor2, Qt::SolidLine, Qt::RoundCap);
++i;

View File

@ -63,7 +63,7 @@ private:
Q_DISABLE_COPY(VisToolRotation)
qreal angle;
QGraphicsEllipseItem *point;
QGraphicsPathItem *angleArc;
VCurvePathItem *angleArc;
QGraphicsLineItem *xAxis;
template <class Item>

View File

@ -53,7 +53,7 @@ VisToolCurveIntersectAxis::VisToolCurveIntersectAxis(const VContainer *data, QGr
{
this->mainColor = Qt::red;
visCurve = InitItem<QGraphicsPathItem>(Qt::darkGreen, this);
visCurve = InitItem<VCurvePathItem>(Qt::darkGreen, this);
basePoint = InitPoint(supportColor, this);
baseLine = InitItem<QGraphicsLineItem>(supportColor, this);
axisLine = InitItem<QGraphicsLineItem>(supportColor, this); //-V656

View File

@ -62,7 +62,7 @@ private:
QGraphicsEllipseItem *basePoint;
QGraphicsLineItem *baseLine;
QGraphicsLineItem *axisLine;
QGraphicsPathItem *visCurve;
VCurvePathItem *visCurve;
};
#endif // VISTOOLCURVEINTERSECTAXIS_H

View File

@ -51,7 +51,7 @@ VisToolPointFromArcAndTangent::VisToolPointFromArcAndTangent(const VContainer *d
: VisLine(data, parent), arcId(NULL_ID), crossPoint(CrossCirclesPoint::FirstPoint),
point(nullptr), tangent(nullptr), arcPath(nullptr), tangentLine2(nullptr)
{
arcPath = InitItem<QGraphicsPathItem>(Qt::darkGreen, this);
arcPath = InitItem<VCurvePathItem>(Qt::darkGreen, this);
point = InitPoint(mainColor, this);
tangent = InitPoint(supportColor, this);
tangentLine2 = InitItem<QGraphicsLineItem>(supportColor, this);

View File

@ -61,7 +61,7 @@ private:
CrossCirclesPoint crossPoint;
QGraphicsEllipseItem *point;
QGraphicsEllipseItem *tangent;
QGraphicsPathItem *arcPath;
VCurvePathItem *arcPath;
QGraphicsLineItem *tangentLine2;
void FindRays(const QPointF &p, const VArc *arc);

View File

@ -55,9 +55,9 @@ VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer
{
this->setPen(QPen(Qt::NoPen)); // don't use parent this time
arc1Path = InitItem<QGraphicsPathItem>(Qt::darkGreen, this);
arc1Path = InitItem<VCurvePathItem>(Qt::darkGreen, this);
arc1Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
arc2Path = InitItem<QGraphicsPathItem>(Qt::darkRed, this);
arc2Path = InitItem<VCurvePathItem>(Qt::darkRed, this);
arc2Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
point = InitPoint(mainColor, this);

View File

@ -62,8 +62,8 @@ private:
quint32 arc2Id;
CrossCirclesPoint crossPoint;
QGraphicsEllipseItem *point;
QGraphicsPathItem *arc1Path;
QGraphicsPathItem *arc2Path;
VCurvePathItem *arc1Path;
VCurvePathItem *arc2Path;
};
#endif // VISTOOLPOINTOFINTERSECTIONARCS_H

View File

@ -38,7 +38,8 @@
//---------------------------------------------------------------------------------------------------------------------
VisPath::VisPath(const VContainer *data, QGraphicsItem *parent)
:Visualization(data), QGraphicsPathItem(parent)
: Visualization(data),
VCurvePathItem(parent)
{
this->setZValue(1);// Show on top real tool
InitPen();

View File

@ -31,7 +31,6 @@
#include <qcompilerdetection.h>
#include <QGraphicsItem>
#include <QGraphicsPathItem>
#include <QMetaObject>
#include <QObject>
#include <QString>
@ -39,10 +38,11 @@
#include "../visualization.h"
#include "../vmisc/def.h"
#include "../vwidgets/vcurvepathitem.h"
class VSimplePoint;
class VisPath : public Visualization, public QGraphicsPathItem
class VisPath : public Visualization, public VCurvePathItem
{
Q_OBJECT
public:

Some files were not shown because too many files have changed in this diff Show More