From 24970440b756642b10bfe8aaae96723ff81ce667 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 19 Dec 2016 14:56:39 +0200 Subject: [PATCH] Elliptic arc bring new formulas that we should also cover. --HG-- branch : feature --- src/libs/ifc/xml/vabstractpattern.cpp | 77 +++++++++++++++++++++++++-- src/libs/ifc/xml/vabstractpattern.h | 1 + 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 20a153bc0..65882a7cd 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1409,8 +1409,10 @@ QStringList VAbstractPattern::ListExpressions() const { QStringList list; + // If new tool bring absolutely new type and has formula(s) create new method to cover it. list << ListPointExpressions(); list << ListArcExpressions(); + list << ListElArcExpressions(); list << ListSplineExpressions(); list << ListIncrementExpressions(); list << ListOperationExpressions(); @@ -1422,7 +1424,8 @@ QStringList VAbstractPattern::ListExpressions() const QStringList VAbstractPattern::ListPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. - // If no just increment number + // If no just increment a number. + // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; @@ -1493,7 +1496,8 @@ QStringList VAbstractPattern::ListPointExpressions() const QStringList VAbstractPattern::ListArcExpressions() const { // Check if new tool doesn't bring new attribute with a formula. - // If no just increment number + // If no just increment number. + // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; @@ -1542,6 +1546,69 @@ QStringList VAbstractPattern::ListArcExpressions() const return expressions; } +//--------------------------------------------------------------------------------------------------------------------- +QStringList VAbstractPattern::ListElArcExpressions() const +{ + // Check if new tool doesn't bring new attribute with a formula. + // If no just increment number. + // If new tool bring absolutely new type and has formula(s) create new method to cover it. + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); + + QStringList expressions; + const QDomNodeList list = elementsByTagName(TagElArc); + for (int i=0; i < list.size(); ++i) + { + const QDomElement dom = list.at(i).toElement(); + + try + { + expressions.append(GetParametrString(dom, AttrRadius1)); + } + catch (VExceptionEmptyParameter &e) + { + Q_UNUSED(e) + } + + try + { + expressions.append(GetParametrString(dom, AttrRadius2)); + } + catch (VExceptionEmptyParameter &e) + { + Q_UNUSED(e) + } + + try + { + expressions.append(GetParametrString(dom, AttrAngle1)); + } + catch (VExceptionEmptyParameter &e) + { + Q_UNUSED(e) + } + + try + { + expressions.append(GetParametrString(dom, AttrAngle2)); + } + catch (VExceptionEmptyParameter &e) + { + Q_UNUSED(e) + } + + try + { + expressions.append(GetParametrString(dom, AttrRotationAngle)); + } + catch (VExceptionEmptyParameter &e) + { + Q_UNUSED(e) + } + } + + return expressions; +} + //--------------------------------------------------------------------------------------------------------------------- QStringList VAbstractPattern::ListSplineExpressions() const { @@ -1554,7 +1621,8 @@ QStringList VAbstractPattern::ListSplineExpressions() const QStringList VAbstractPattern::ListPathPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. - // If no just increment number + // If no just increment number. + // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; @@ -1620,7 +1688,8 @@ QStringList VAbstractPattern::ListIncrementExpressions() const QStringList VAbstractPattern::ListOperationExpressions() const { // Check if new tool doesn't bring new attribute with a formula. - // If no just increment number + // If no just increment number. + // If new tool bring absolutely new type and has formula(s) create new method to cover it. Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 086ed7445..213479757 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -351,6 +351,7 @@ private: QStringList ListExpressions() const; QStringList ListPointExpressions() const; QStringList ListArcExpressions() const; + QStringList ListElArcExpressions() const; QStringList ListSplineExpressions() const; QStringList ListPathPointExpressions() const; QStringList ListIncrementExpressions() const;