From 00ab0a225e787e60b1296b9c8a7658b8eef8c943 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:01:40 +0200 Subject: [PATCH 1/9] Added VToolEllipticalArc. --HG-- branch : feature --- src/libs/vmisc/def.h | 4 +- src/libs/vtools/tools/drawTools/drawtools.h | 1 + .../toolcurve/vtoolellipticalarc.cpp | 470 ++++++++++++++++++ .../drawTools/toolcurve/vtoolellipticalarc.h | 105 ++++ src/libs/vtools/tools/tools.pri | 232 ++++----- 5 files changed, 696 insertions(+), 116 deletions(-) create mode 100644 src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp create mode 100644 src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index e2f3a8ae1..cf56c8716 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -115,6 +115,7 @@ enum class Tool : ToolVisHolderType FlippingByAxis, Move, Midpoint, + EllipticalArc, LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used }; @@ -158,7 +159,8 @@ enum class Vis : ToolVisHolderType ToolRotation, ToolFlippingByLine, ToolFlippingByAxis, - ToolMove + ToolMove, + ToolEllipticalArc }; enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, diff --git a/src/libs/vtools/tools/drawTools/drawtools.h b/src/libs/vtools/tools/drawTools/drawtools.h index 01c9cce94..377f375bf 100644 --- a/src/libs/vtools/tools/drawTools/drawtools.h +++ b/src/libs/vtools/tools/drawTools/drawtools.h @@ -38,6 +38,7 @@ #include "toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h" #include "toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h" #include "toolcurve/vtoolarc.h" +#include "toolcurve/vtoolellipticalarc.h" #include "toolcurve/vtoolarcwithlength.h" #include "toolcurve/vtoolspline.h" #include "toolcurve/vtoolcubicbezier.h" diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp new file mode 100644 index 000000000..3014fe639 --- /dev/null +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -0,0 +1,470 @@ +/************************************************************************ + ** + ** @file vtoolellipticalarc.cpp + ** @author Valentina Zhuravska + ** @date 20 10, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vtoolellipticalarc.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "../../../dialogs/tools/dialogtool.h" +#include "../../../dialogs/tools/dialogellipticalarc.h" +#include "../../../visualization/path/vistoolellipticalarc.h" +#include "../../../visualization/visualization.h" +#include "../ifc/exception/vexception.h" +#include "../ifc/xml/vdomdocument.h" +#include "../ifc/ifcdef.h" +#include "../vgeometry/vellipticalarc.h" +#include "../vgeometry/vgobject.h" +#include "../vgeometry/vpointf.h" +#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vcommonsettings.h" +#include "../vpatterndb/vcontainer.h" +#include "../vpatterndb/vformula.h" +#include "../vpatterndb/vtranslatevars.h" +#include "../vwidgets/vmaingraphicsscene.h" +#include "../../vabstracttool.h" +#include "../vdrawtool.h" +#include "vabstractspline.h" + +class QDomElement; +class QGraphicsSceneContextMenuEvent; + +const QString VToolEllipticalArc::ToolType = QStringLiteral("simple"); + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VToolEllipticalArc constuctor. + * @param doc dom document container + * @param data container with variables + * @param id object id in container + * @param typeCreation way we create this tool. + * @param parent parent object + */ +VToolEllipticalArc::VToolEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + QGraphicsItem *parent) + :VAbstractSpline(doc, data, id, parent) +{ + 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); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief setDialog set dialog when user want change tool option. + */ +void VToolEllipticalArc::setDialog() +{ + SCASSERT(dialog != nullptr); + DialogEllipticalArc *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + const QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + dialogTool->SetCenter(elArc->GetCenter().id()); + dialogTool->SetF1(elArc->GetFormulaF1()); + dialogTool->SetF2(elArc->GetFormulaF2()); + dialogTool->SetRadius1(elArc->GetFormulaRadius1()); + dialogTool->SetRadius2(elArc->GetFormulaRadius2()); + dialogTool->SetRotationAngle(elArc->GetFormulaRotationAngle()); + dialogTool->SetColor(elArc->GetColor()); +} + + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Create help create tool + * @param dialog dialog options. + * @param scene pointer to scene. + * @param doc dom document container + * @param data container with variables + */ +VToolEllipticalArc* VToolEllipticalArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data) +{ + SCASSERT(dialog != nullptr); + DialogEllipticalArc *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + + const quint32 center = dialogTool->GetCenter(); + QString radius1 = dialogTool->GetRadius1(); + QString radius2 = dialogTool->GetRadius2(); + QString f1 = dialogTool->GetF1(); + 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); + if (point != nullptr) + { + point->dialog=dialogTool; + } + return point; +} + + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Create help create tool form GUI. + * @param _id tool id, 0 if tool doesn't exist yet. + * @param center id elliptical arc center point. + * @param radius1 elliptical arc radius1. + * @param radius2 elliptical arc radius2. + * @param f1 start angle of elliptical arc. + * @param f2 end angle of elliptical arc. + * @param rotationAngle rotation angle of elliptical arc. + * @param scene pointer to scene. + * @param doc dom document container. + * @param data container with variables. + * @param parse parser file mode. + * @param typeCreation way we create this tool. + */ +VToolEllipticalArc* VToolEllipticalArc::Create(const quint32 _id, const quint32 ¢er, 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) +{ + qreal calcRadius1 = 0, calcRadius2 = 0, calcF1 = 0, calcF2 = 0, calcRotationAngle = 0; + + calcRadius1 = qApp->toPixel(CheckFormula(_id, radius1, data)); + calcRadius2 = qApp->toPixel(CheckFormula(_id, radius2, data)); + + calcF1 = CheckFormula(_id, f1, data); + calcF2 = CheckFormula(_id, f2, data); + calcRotationAngle = CheckFormula(_id, rotationAngle, data); + + const VPointF c = *data->GeometricObject(center); + VEllipticalArc *elArc = new VEllipticalArc(c, calcRadius1, calcRadius2, radius1, radius2, calcF1, f1, calcF2, f2, + calcRotationAngle, rotationAngle); + elArc->SetColor(color); + quint32 id = _id; + if (typeCreation == Source::FromGui) + { + id = data->AddGObject(elArc); + data->AddEllipticalArc(data->GeometricObject(id), id); + } + else + { + data->UpdateGObject(id, elArc); + data->AddEllipticalArc(data->GeometricObject(id), id); + if (parse != Document::FullParse) + { + doc->UpdateToolData(id, data); + } + } + VDrawTool::AddRecord(id, Tool::EllipticalArc, doc); + if (parse == Document::FullParse) + { + VToolEllipticalArc *toolEllipticalArc = new VToolEllipticalArc(doc, data, id, typeCreation); + scene->addItem(toolEllipticalArc); + InitArcToolConnections(scene, toolEllipticalArc); + doc->AddTool(id, toolEllipticalArc); + doc->IncrementReferens(c.getIdTool()); + return toolEllipticalArc; + } + return nullptr; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VToolEllipticalArc::getTagName() const +{ + return VAbstractPattern::TagElArc; +} + + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolEllipticalArc::getCenter() const +{ + QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + SCASSERT(elArc.isNull() == false); + + return elArc->GetCenter().id(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::setCenter(const quint32 &value) +{ + if (value != NULL_ID) + { + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + + QSharedPointer point = VAbstractTool::data.GeometricObject(value); + elArc->SetCenter(*point.data()); + SaveOption(obj); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolEllipticalArc::GetFormulaRadius1() const +{ + QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + SCASSERT(elArc.isNull() == false); + + VFormula radius1(elArc->GetFormulaRadius1(), getData()); + radius1.setCheckZero(true); + radius1.setToolId(id); + radius1.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + return radius1; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SetFormulaRadius1(const VFormula &value) +{ + if (value.error() == false) + { + if (value.getDoubleValue() > 0)// Formula don't check this, but radius1 can't be 0 or negative + { + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + elArc->SetFormulaRadius1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolEllipticalArc::GetFormulaRadius2() const +{ + QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + SCASSERT(elArc.isNull() == false); + + VFormula radius2(elArc->GetFormulaRadius2(), getData()); + radius2.setCheckZero(true); + radius2.setToolId(id); + radius2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + return radius2; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SetFormulaRadius2(const VFormula &value) +{ + if (value.error() == false) + { + if (value.getDoubleValue() > 0)// Formula don't check this, but radius2 can't be 0 or negative + { + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + elArc->SetFormulaRadius2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolEllipticalArc::GetFormulaF1() const +{ + QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + SCASSERT(elArc.isNull() == false); + + VFormula f1(elArc->GetFormulaF1(), getData()); + f1.setCheckZero(false); + f1.setToolId(id); + f1.setPostfix(degreeSymbol); + return f1; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SetFormulaF1(const VFormula &value) +{ + if (value.error() == false) + { + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + + if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), elArc->GetEndAngle()))// Angles can't be equal + { + elArc->SetFormulaF1(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolEllipticalArc::GetFormulaF2() const +{ + QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + SCASSERT(elArc.isNull() == false); + + VFormula f2(elArc->GetFormulaF2(), getData()); + f2.setCheckZero(false); + f2.setToolId(id); + f2.setPostfix(degreeSymbol); + return f2; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SetFormulaF2(const VFormula &value) +{ + if (value.error() == false) + { + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + if (not VFuzzyComparePossibleNulls(value.getDoubleValue(), elArc->GetStartAngle()))// Angles can't be equal + { + elArc->SetFormulaF2(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VFormula VToolEllipticalArc::GetFormulaRotationAngle() const +{ + QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + SCASSERT(elArc.isNull() == false); + + VFormula rotationAngle(elArc->GetFormulaRotationAngle(), getData()); + rotationAngle.setCheckZero(false); + rotationAngle.setToolId(id); + rotationAngle.setPostfix(degreeSymbol); + return rotationAngle; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SetFormulaRotationAngle(const VFormula &value) +{ + if (value.error() == false) + { + QSharedPointer obj = VAbstractTool::data.GetGObject(id); + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + elArc->SetFormulaRotationAngle(value.GetFormula(FormulaType::FromUser), value.getDoubleValue()); + SaveOption(obj); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::ShowVisualization(bool show) +{ + ShowToolVisualization(show); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief contextMenuEvent handle context menu events. + * @param event context menu event. + */ +void VToolEllipticalArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + try + { + ContextMenu(this, event); + } + catch(const VExceptionToolWasDeleted &e) + { + Q_UNUSED(e); + return;//Leave this method immediately!!! + } +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief RemoveReferens decrement value of reference. + */ +void VToolEllipticalArc::RemoveReferens() +{ + const auto elArc = VAbstractTool::data.GeometricObject(id); + doc->DecrementReferens(elArc->GetCenter().getIdTool()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SaveDialog save options into file after change in dialog. + */ +void VToolEllipticalArc::SaveDialog(QDomElement &domElement) +{ + SCASSERT(dialog != nullptr); + DialogEllipticalArc *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter())); + doc->SetAttribute(domElement, AttrRadius1, dialogTool->GetRadius1()); + doc->SetAttribute(domElement, AttrRadius2, dialogTool->GetRadius2()); + doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1()); + doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2()); + doc->SetAttribute(domElement, AttrRotationAngle, dialogTool->GetRotationAngle()); + doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SaveOptions(QDomElement &tag, QSharedPointer &obj) +{ + VAbstractSpline::SaveOptions(tag, obj); + + QSharedPointer elArc = qSharedPointerDynamicCast(obj); + SCASSERT(elArc.isNull() == false); + + doc->SetAttribute(tag, AttrType, ToolType); + doc->SetAttribute(tag, AttrCenter, elArc->GetCenter().id()); + doc->SetAttribute(tag, AttrRadius1, elArc->GetFormulaRadius1()); + doc->SetAttribute(tag, AttrRadius2, elArc->GetFormulaRadius2()); + doc->SetAttribute(tag, AttrAngle1, elArc->GetFormulaF1()); + doc->SetAttribute(tag, AttrAngle2, elArc->GetFormulaF2()); + doc->SetAttribute(tag, AttrRotationAngle, elArc->GetFormulaRotationAngle()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolEllipticalArc::SetVisualization() +{ + if (not vis.isNull()) + { + const QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + VisToolEllipticalArc *visual = qobject_cast(vis); + SCASSERT(visual != nullptr); + + const VTranslateVars *trVars = qApp->TrVars(); + visual->setObject1Id(elArc->GetCenter().id()); + visual->setRadius1(trVars->FormulaToUser(elArc->GetFormulaRadius1(), qApp->Settings()->GetOsSeparator())); + visual->setRadius2(trVars->FormulaToUser(elArc->GetFormulaRadius2(), qApp->Settings()->GetOsSeparator())); + visual->setF1(trVars->FormulaToUser(elArc->GetFormulaF1(), qApp->Settings()->GetOsSeparator())); + visual->setF2(trVars->FormulaToUser(elArc->GetFormulaF2(), qApp->Settings()->GetOsSeparator())); + visual->setRotationAngle(trVars->FormulaToUser(elArc->GetFormulaRotationAngle(), + qApp->Settings()->GetOsSeparator())); + visual->RefreshGeometry(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief RefreshGeometry refresh item on scene. + */ +void VToolEllipticalArc::RefreshGeometry() +{ + const QSharedPointer elArc = VAbstractTool::data.GeometricObject(id); + this->setPen(QPen(CorrectColor(elArc->GetColor()), + qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); + this->setPath(ToolPath()); + + SetVisualization(); +} diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h new file mode 100644 index 000000000..99ecadda9 --- /dev/null +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h @@ -0,0 +1,105 @@ +/************************************************************************ + ** + ** @file vtoolellipticalarc.h + ** @author Valentina Zhuravska + ** @date 20 10, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VTOOLELLIPTICALARC_H +#define VTOOLELLIPTICALARC_H + +#include +#include +#include +#include +#include +#include + +#include "../ifc/xml/vabstractpattern.h" +#include "../vmisc/def.h" +#include "vabstractspline.h" + +class DialogTool; +class QDomElement; +class QGraphicsSceneContextMenuEvent; +class VContainer; +class VFormula; +class VGObject; +class VMainGraphicsScene; +template class QSharedPointer; + +/** + * @brief The VToolEllipticalArc class tool for creation elliptical arc. + */ +class VToolEllipticalArc : public VAbstractSpline +{ + Q_OBJECT +public: + virtual void setDialog() Q_DECL_OVERRIDE; + static VToolEllipticalArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data); + static VToolEllipticalArc* Create(const quint32 _id, const quint32 ¢er, 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); + static const QString ToolType; + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Tool::EllipticalArc)}; + virtual QString getTagName() const Q_DECL_OVERRIDE; + + quint32 getCenter() const; + void setCenter(const quint32 &value); + + VFormula GetFormulaRadius1() const; + void SetFormulaRadius1(const VFormula &value); + + VFormula GetFormulaRadius2() const; + void SetFormulaRadius2(const VFormula &value); + + VFormula GetFormulaF1() const; + void SetFormulaF1(const VFormula &value); + + VFormula GetFormulaF2() const; + void SetFormulaF2(const VFormula &value); + + VFormula GetFormulaRotationAngle() const; + void SetFormulaRotationAngle(const VFormula &value); + + virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; + +protected: + virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE; + virtual void RemoveReferens() Q_DECL_OVERRIDE; + virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE; + virtual void SaveOptions(QDomElement &tag, QSharedPointer &obj) Q_DECL_OVERRIDE; + virtual void SetVisualization() Q_DECL_OVERRIDE; + +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 diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index 4f4536aae..819713744 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -1,115 +1,117 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -HEADERS += \ - $$PWD/vtooldetail.h \ - $$PWD/vdatatool.h \ - $$PWD/vabstracttool.h \ - $$PWD/tools.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h \ - $$PWD/drawTools/toolcurve/vtoolsplinepath.h \ - $$PWD/drawTools/toolcurve/vtoolspline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h \ - $$PWD/drawTools/vtoolline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h \ - $$PWD/drawTools/toolcurve/vtoolarc.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h \ - $$PWD/drawTools/vdrawtool.h \ - $$PWD/drawTools/drawtools.h \ - $$PWD/nodeDetails/vnodesplinepath.h \ - $$PWD/nodeDetails/vnodespline.h \ - $$PWD/nodeDetails/vnodepoint.h \ - $$PWD/nodeDetails/vnodearc.h \ - $$PWD/nodeDetails/vabstractnode.h \ - $$PWD/nodeDetails/nodedetails.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h \ - $$PWD/vtooluniondetails.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h \ - $$PWD/drawTools/toolcurve/vabstractspline.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h \ - $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ - $$PWD/drawTools/toolpoint/vabstractpoint.h \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h \ - $$PWD/drawTools/toolcurve/vtoolcubicbezier.h \ - $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.h \ - $$PWD/drawTools/operation/vtoolrotation.h \ - $$PWD/vtextgraphicsitem.h \ - $$PWD/vgrainlineitem.h \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \ - $$PWD/drawTools/operation/vabstractoperation.h \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \ - $$PWD/drawTools/operation/flipping/vabstractflipping.h \ - $$PWD/drawTools/operation/vtoolmove.h - -SOURCES += \ - $$PWD/vtooldetail.cpp \ - $$PWD/vdatatool.cpp \ - $$PWD/vabstracttool.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ - $$PWD/drawTools/toolcurve/vtoolsplinepath.cpp \ - $$PWD/drawTools/toolcurve/vtoolspline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp \ - $$PWD/drawTools/vtoolline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp \ - $$PWD/drawTools/toolcurve/vtoolarc.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp \ - $$PWD/drawTools/vdrawtool.cpp \ - $$PWD/nodeDetails/vnodesplinepath.cpp \ - $$PWD/nodeDetails/vnodespline.cpp \ - $$PWD/nodeDetails/vnodepoint.cpp \ - $$PWD/nodeDetails/vnodearc.cpp \ - $$PWD/nodeDetails/vabstractnode.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp \ - $$PWD/vtooluniondetails.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp \ - $$PWD/drawTools/toolcurve/vabstractspline.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp \ - $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ - $$PWD/drawTools/toolpoint/vabstractpoint.cpp \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ - $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \ - $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp \ - $$PWD/drawTools/toolcurve/vtoolcubicbezier.cpp \ - $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.cpp \ - $$PWD/drawTools/operation/vtoolrotation.cpp \ - $$PWD/vtextgraphicsitem.cpp \ - $$PWD/vgrainlineitem.cpp \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \ - $$PWD/drawTools/operation/vabstractoperation.cpp \ - $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \ - $$PWD/drawTools/operation/flipping/vabstractflipping.cpp \ - $$PWD/drawTools/operation/vtoolmove.cpp +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +HEADERS += \ + $$PWD/vtooldetail.h \ + $$PWD/vdatatool.h \ + $$PWD/vabstracttool.h \ + $$PWD/tools.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h \ + $$PWD/drawTools/toolcurve/vtoolsplinepath.h \ + $$PWD/drawTools/toolcurve/vtoolspline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h \ + $$PWD/drawTools/vtoolline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h \ + $$PWD/drawTools/toolcurve/vtoolarc.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h \ + $$PWD/drawTools/vdrawtool.h \ + $$PWD/drawTools/drawtools.h \ + $$PWD/nodeDetails/vnodesplinepath.h \ + $$PWD/nodeDetails/vnodespline.h \ + $$PWD/nodeDetails/vnodepoint.h \ + $$PWD/nodeDetails/vnodearc.h \ + $$PWD/nodeDetails/vabstractnode.h \ + $$PWD/nodeDetails/nodedetails.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h \ + $$PWD/vtooluniondetails.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h \ + $$PWD/drawTools/toolcurve/vabstractspline.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h \ + $$PWD/drawTools/toolcurve/vtoolarcwithlength.h \ + $$PWD/drawTools/toolpoint/vabstractpoint.h \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.h \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h \ + $$PWD/drawTools/toolcurve/vtoolcubicbezier.h \ + $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.h \ + $$PWD/drawTools/operation/vtoolrotation.h \ + $$PWD/vtextgraphicsitem.h \ + $$PWD/vgrainlineitem.h \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyline.h \ + $$PWD/drawTools/operation/vabstractoperation.h \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.h \ + $$PWD/drawTools/operation/flipping/vabstractflipping.h \ + $$PWD/drawTools/operation/vtoolmove.h \ + $$PWD/drawTools/toolcurve/vtoolellipticalarc.h + +SOURCES += \ + $$PWD/vtooldetail.cpp \ + $$PWD/vdatatool.cpp \ + $$PWD/vabstracttool.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ + $$PWD/drawTools/toolcurve/vtoolsplinepath.cpp \ + $$PWD/drawTools/toolcurve/vtoolspline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp \ + $$PWD/drawTools/vtoolline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp \ + $$PWD/drawTools/toolcurve/vtoolarc.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp \ + $$PWD/drawTools/vdrawtool.cpp \ + $$PWD/nodeDetails/vnodesplinepath.cpp \ + $$PWD/nodeDetails/vnodespline.cpp \ + $$PWD/nodeDetails/vnodepoint.cpp \ + $$PWD/nodeDetails/vnodearc.cpp \ + $$PWD/nodeDetails/vabstractnode.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp \ + $$PWD/vtooluniondetails.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp \ + $$PWD/drawTools/toolcurve/vabstractspline.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp \ + $$PWD/drawTools/toolcurve/vtoolarcwithlength.cpp \ + $$PWD/drawTools/toolpoint/vabstractpoint.cpp \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooldoublepoint.cpp \ + $$PWD/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp \ + $$PWD/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp \ + $$PWD/drawTools/toolcurve/vtoolcubicbezier.cpp \ + $$PWD/drawTools/toolcurve/vtoolcubicbezierpath.cpp \ + $$PWD/drawTools/operation/vtoolrotation.cpp \ + $$PWD/vtextgraphicsitem.cpp \ + $$PWD/vgrainlineitem.cpp \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyline.cpp \ + $$PWD/drawTools/operation/vabstractoperation.cpp \ + $$PWD/drawTools/operation/flipping/vtoolflippingbyaxis.cpp \ + $$PWD/drawTools/operation/flipping/vabstractflipping.cpp \ + $$PWD/drawTools/operation/vtoolmove.cpp \ + $$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp From 33a42e3b9b05c114a67654ff4cdb8e647e8a34c7 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:06:20 +0200 Subject: [PATCH 2/9] Added VisToolEllipticalArc. --HG-- branch : feature --- .../path/vistoolellipticalarc.cpp | 98 +++++++++++ .../visualization/path/vistoolellipticalarc.h | 69 ++++++++ .../vtools/visualization/visualization.pri | 158 +++++++++--------- 3 files changed, 247 insertions(+), 78 deletions(-) create mode 100644 src/libs/vtools/visualization/path/vistoolellipticalarc.cpp create mode 100644 src/libs/vtools/visualization/path/vistoolellipticalarc.h diff --git a/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp b/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp new file mode 100644 index 000000000..5e636367e --- /dev/null +++ b/src/libs/vtools/visualization/path/vistoolellipticalarc.cpp @@ -0,0 +1,98 @@ +/************************************************************************ + ** + ** @file vistoolellipticalarc.cpp + ** @author Valentina Zhuravska + ** @date 24 10, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#include "vistoolellipticalarc.h" +#include +#include +#include +#include +#include + +#include "../ifc/ifcdef.h" +#include "../vgeometry/vabstractcurve.h" +#include "../vgeometry/vellipticalarc.h" +#include "../vgeometry/vpointf.h" +#include "../vpatterndb/vcontainer.h" +#include "../visualization.h" +#include "vispath.h" + +VisToolEllipticalArc::VisToolEllipticalArc(const VContainer *data, QGraphicsItem *parent) + :VisPath(data, parent), arcCenter(nullptr), radius1(0), radius2(0), f1(0), f2(0), rotationAngle(0) +{ + arcCenter = InitPoint(mainColor, this); +} + +//--------------------------------------------------------------------------------------------------------------------- +VisToolEllipticalArc::~VisToolEllipticalArc() +{} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolEllipticalArc::RefreshGeometry() +{ + if (object1Id > NULL_ID) + { + const QSharedPointer first = Visualization::data->GeometricObject(object1Id); + DrawPoint(arcCenter, *first, supportColor); + + if (not qFuzzyIsNull(radius1) && not qFuzzyIsNull(radius2) && f1 >= 0 && f2 >= 0 && rotationAngle >= 0 + && not VFuzzyComparePossibleNulls(f1, f2)) + { + VEllipticalArc elArc = VEllipticalArc(*first, radius1, radius2, f1, f2, rotationAngle); + DrawPath(this, elArc.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap); + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolEllipticalArc::setRadius1(const QString &expression) +{ + radius1 = FindLength(expression, Visualization::data->PlainVariables()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolEllipticalArc::setRadius2(const QString &expression) +{ + radius2 = FindLength(expression, Visualization::data->PlainVariables()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolEllipticalArc::setF1(const QString &expression) +{ + f1 = FindVal(expression, Visualization::data->PlainVariables()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolEllipticalArc::setF2(const QString &expression) +{ + f2 = FindVal(expression, Visualization::data->PlainVariables()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolEllipticalArc::setRotationAngle(const QString &expression) +{ + rotationAngle = FindVal(expression, Visualization::data->PlainVariables()); +} diff --git a/src/libs/vtools/visualization/path/vistoolellipticalarc.h b/src/libs/vtools/visualization/path/vistoolellipticalarc.h new file mode 100644 index 000000000..cf8967456 --- /dev/null +++ b/src/libs/vtools/visualization/path/vistoolellipticalarc.h @@ -0,0 +1,69 @@ +/************************************************************************ + ** + ** @file vistoolellipticalarc.h + ** @author Valentina Zhuravska + ** @date 24 10, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef VISTOOLELLIPTICALARC_H +#define VISTOOLELLIPTICALARC_H + +#include +#include +#include +#include +#include +#include + +#include "../vmisc/def.h" +#include "vispath.h" + +class VContainer; + +class VisToolEllipticalArc : public VisPath +{ + Q_OBJECT +public: + explicit VisToolEllipticalArc(const VContainer *data, QGraphicsItem *parent = 0); + virtual ~VisToolEllipticalArc() Q_DECL_OVERRIDE; + + virtual void RefreshGeometry() Q_DECL_OVERRIDE; + void setRadius1(const QString &expression); + void setRadius2(const QString &expression); + void setF1(const QString &expression); + void setF2(const QString &expression); + void setRotationAngle(const QString &expression); + + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Vis::ToolEllipticalArc)}; +private: + Q_DISABLE_COPY(VisToolEllipticalArc) + QGraphicsEllipseItem *arcCenter; + qreal radius1; + qreal radius2; + qreal f1; + qreal f2; + qreal rotationAngle; +}; + +#endif // VISTOOLELLIPTICALARC_H diff --git a/src/libs/vtools/visualization/visualization.pri b/src/libs/vtools/visualization/visualization.pri index 7eee605f6..5a02ea230 100644 --- a/src/libs/vtools/visualization/visualization.pri +++ b/src/libs/vtools/visualization/visualization.pri @@ -1,78 +1,80 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -HEADERS += \ - $$PWD/visualization.h \ - $$PWD/line/visline.h \ - $$PWD/line/vistoolline.h \ - $$PWD/line/vistoolendline.h \ - $$PWD/line/vistoolalongline.h \ - $$PWD/line/vistoolbisector.h \ - $$PWD/line/vistoolshoulderpoint.h \ - $$PWD/line/vistoolnormal.h \ - $$PWD/line/vistoolheight.h \ - $$PWD/line/vistoolpointofintersection.h \ - $$PWD/line/vistooltriangle.h \ - $$PWD/line/vistoolpointofcontact.h \ - $$PWD/line/vistoollineintersect.h \ - $$PWD/line/vistoollineintersectaxis.h \ - $$PWD/line/vistooltruedarts.h \ - $$PWD/line/vistoolcurveintersectaxis.h \ - $$PWD/line/vistoolpointofintersectionarcs.h \ - $$PWD/line/vistoolpointofintersectioncircles.h \ - $$PWD/line/vistoolpointfromcircleandtangent.h \ - $$PWD/line/vistoolpointfromarcandtangent.h \ - $$PWD/line/operation/vistoolrotation.h \ - $$PWD/line/operation/vistoolflippingbyline.h \ - $$PWD/path/vispath.h \ - $$PWD/path/vistoolarc.h \ - $$PWD/path/vistoolcutarc.h \ - $$PWD/path/vistoolspline.h \ - $$PWD/path/vistoolcutspline.h \ - $$PWD/path/vistoolsplinepath.h \ - $$PWD/path/vistoolcutsplinepath.h \ - $$PWD/path/vistoolarcwithlength.h \ - $$PWD/path/vistoolpointofintersectioncurves.h \ - $$PWD/path/vistoolcubicbezier.h \ - $$PWD/path/vistoolcubicbezierpath.h \ - $$PWD/line/operation/visoperation.h \ - $$PWD/line/operation/vistoolflippingbyaxis.h \ - $$PWD/line/operation/vistoolmove.h - -SOURCES += \ - $$PWD/visualization.cpp \ - $$PWD/line/visline.cpp \ - $$PWD/line/vistoolline.cpp \ - $$PWD/line/vistoolendline.cpp \ - $$PWD/line/vistoolalongline.cpp \ - $$PWD/line/vistoolbisector.cpp \ - $$PWD/line/vistoolshoulderpoint.cpp \ - $$PWD/line/vistoolnormal.cpp \ - $$PWD/line/vistoolheight.cpp \ - $$PWD/line/vistoolpointofintersection.cpp \ - $$PWD/line/vistooltriangle.cpp \ - $$PWD/line/vistoolpointofcontact.cpp \ - $$PWD/line/vistoollineintersect.cpp \ - $$PWD/line/vistoollineintersectaxis.cpp \ - $$PWD/line/vistooltruedarts.cpp \ - $$PWD/line/vistoolcurveintersectaxis.cpp \ - $$PWD/line/vistoolpointofintersectionarcs.cpp \ - $$PWD/line/vistoolpointofintersectioncircles.cpp \ - $$PWD/line/vistoolpointfromcircleandtangent.cpp \ - $$PWD/line/vistoolpointfromarcandtangent.cpp \ - $$PWD/line/operation/vistoolrotation.cpp \ - $$PWD/line/operation/vistoolflippingbyline.cpp \ - $$PWD/path/vispath.cpp \ - $$PWD/path/vistoolarc.cpp \ - $$PWD/path/vistoolcutarc.cpp \ - $$PWD/path/vistoolspline.cpp \ - $$PWD/path/vistoolcutspline.cpp \ - $$PWD/path/vistoolsplinepath.cpp \ - $$PWD/path/vistoolcutsplinepath.cpp \ - $$PWD/path/vistoolarcwithlength.cpp \ - $$PWD/path/vistoolpointofintersectioncurves.cpp \ - $$PWD/path/vistoolcubicbezier.cpp \ - $$PWD/path/vistoolcubicbezierpath.cpp \ - $$PWD/line/operation/visoperation.cpp \ - $$PWD/line/operation/vistoolflippingbyaxis.cpp \ - $$PWD/line/operation/vistoolmove.cpp +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +HEADERS += \ + $$PWD/visualization.h \ + $$PWD/line/visline.h \ + $$PWD/line/vistoolline.h \ + $$PWD/line/vistoolendline.h \ + $$PWD/line/vistoolalongline.h \ + $$PWD/line/vistoolbisector.h \ + $$PWD/line/vistoolshoulderpoint.h \ + $$PWD/line/vistoolnormal.h \ + $$PWD/line/vistoolheight.h \ + $$PWD/line/vistoolpointofintersection.h \ + $$PWD/line/vistooltriangle.h \ + $$PWD/line/vistoolpointofcontact.h \ + $$PWD/line/vistoollineintersect.h \ + $$PWD/line/vistoollineintersectaxis.h \ + $$PWD/line/vistooltruedarts.h \ + $$PWD/line/vistoolcurveintersectaxis.h \ + $$PWD/line/vistoolpointofintersectionarcs.h \ + $$PWD/line/vistoolpointofintersectioncircles.h \ + $$PWD/line/vistoolpointfromcircleandtangent.h \ + $$PWD/line/vistoolpointfromarcandtangent.h \ + $$PWD/line/operation/vistoolrotation.h \ + $$PWD/line/operation/vistoolflippingbyline.h \ + $$PWD/path/vispath.h \ + $$PWD/path/vistoolarc.h \ + $$PWD/path/vistoolcutarc.h \ + $$PWD/path/vistoolspline.h \ + $$PWD/path/vistoolcutspline.h \ + $$PWD/path/vistoolsplinepath.h \ + $$PWD/path/vistoolcutsplinepath.h \ + $$PWD/path/vistoolarcwithlength.h \ + $$PWD/path/vistoolpointofintersectioncurves.h \ + $$PWD/path/vistoolcubicbezier.h \ + $$PWD/path/vistoolcubicbezierpath.h \ + $$PWD/line/operation/visoperation.h \ + $$PWD/line/operation/vistoolflippingbyaxis.h \ + $$PWD/line/operation/vistoolmove.h \ + $$PWD/path/vistoolellipticalarc.h + +SOURCES += \ + $$PWD/visualization.cpp \ + $$PWD/line/visline.cpp \ + $$PWD/line/vistoolline.cpp \ + $$PWD/line/vistoolendline.cpp \ + $$PWD/line/vistoolalongline.cpp \ + $$PWD/line/vistoolbisector.cpp \ + $$PWD/line/vistoolshoulderpoint.cpp \ + $$PWD/line/vistoolnormal.cpp \ + $$PWD/line/vistoolheight.cpp \ + $$PWD/line/vistoolpointofintersection.cpp \ + $$PWD/line/vistooltriangle.cpp \ + $$PWD/line/vistoolpointofcontact.cpp \ + $$PWD/line/vistoollineintersect.cpp \ + $$PWD/line/vistoollineintersectaxis.cpp \ + $$PWD/line/vistooltruedarts.cpp \ + $$PWD/line/vistoolcurveintersectaxis.cpp \ + $$PWD/line/vistoolpointofintersectionarcs.cpp \ + $$PWD/line/vistoolpointofintersectioncircles.cpp \ + $$PWD/line/vistoolpointfromcircleandtangent.cpp \ + $$PWD/line/vistoolpointfromarcandtangent.cpp \ + $$PWD/line/operation/vistoolrotation.cpp \ + $$PWD/line/operation/vistoolflippingbyline.cpp \ + $$PWD/path/vispath.cpp \ + $$PWD/path/vistoolarc.cpp \ + $$PWD/path/vistoolcutarc.cpp \ + $$PWD/path/vistoolspline.cpp \ + $$PWD/path/vistoolcutspline.cpp \ + $$PWD/path/vistoolsplinepath.cpp \ + $$PWD/path/vistoolcutsplinepath.cpp \ + $$PWD/path/vistoolarcwithlength.cpp \ + $$PWD/path/vistoolpointofintersectioncurves.cpp \ + $$PWD/path/vistoolcubicbezier.cpp \ + $$PWD/path/vistoolcubicbezierpath.cpp \ + $$PWD/line/operation/visoperation.cpp \ + $$PWD/line/operation/vistoolflippingbyaxis.cpp \ + $$PWD/line/operation/vistoolmove.cpp \ + $$PWD/path/vistoolellipticalarc.cpp From a5f504a71045fc8fda9fd97bd06dfce301909be3 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:10:05 +0200 Subject: [PATCH 3/9] Added DialogEllipticalArc. --HG-- branch : feature --- src/libs/vtools/dialogs/dialogs.pri | 255 +++-- src/libs/vtools/dialogs/tooldialogs.h | 1 + .../dialogs/tools/dialogellipticalarc.cpp | 638 +++++++++++ .../dialogs/tools/dialogellipticalarc.h | 178 +++ .../dialogs/tools/dialogellipticalarc.ui | 1018 +++++++++++++++++ 5 files changed, 1964 insertions(+), 126 deletions(-) create mode 100644 src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp create mode 100644 src/libs/vtools/dialogs/tools/dialogellipticalarc.h create mode 100644 src/libs/vtools/dialogs/tools/dialogellipticalarc.ui diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index 343b5a64c..9b3ae9de4 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -1,126 +1,129 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -HEADERS += \ - $$PWD/tooldialogs.h \ - $$PWD/tools/dialogalongline.h \ - $$PWD/tools/dialogarc.h \ - $$PWD/tools/dialogarcwithlength.h \ - $$PWD/tools/dialogbisector.h \ - $$PWD/tools/dialogcurveintersectaxis.h \ - $$PWD/tools/dialogcutarc.h \ - $$PWD/tools/dialogcutspline.h \ - $$PWD/tools/dialogcutsplinepath.h \ - $$PWD/tools/dialogdetail.h \ - $$PWD/tools/dialogendline.h \ - $$PWD/tools/dialogheight.h \ - $$PWD/tools/dialogline.h \ - $$PWD/tools/dialoglineintersect.h \ - $$PWD/tools/dialoglineintersectaxis.h \ - $$PWD/tools/dialognormal.h \ - $$PWD/tools/dialogpointfromarcandtangent.h \ - $$PWD/tools/dialogpointfromcircleandtangent.h \ - $$PWD/tools/dialogpointofcontact.h \ - $$PWD/tools/dialogpointofintersection.h \ - $$PWD/tools/dialogpointofintersectionarcs.h \ - $$PWD/tools/dialogpointofintersectioncircles.h \ - $$PWD/tools/dialogshoulderpoint.h \ - $$PWD/tools/dialogsinglepoint.h \ - $$PWD/tools/dialogspline.h \ - $$PWD/tools/dialogsplinepath.h \ - $$PWD/tools/dialogtool.h \ - $$PWD/tools/dialogtriangle.h \ - $$PWD/tools/dialoguniondetails.h \ - $$PWD/support/dialogeditwrongformula.h \ - $$PWD/support/dialogundo.h \ - $$PWD/tools/dialogtruedarts.h \ - $$PWD/tools/dialogpointofintersectioncurves.h \ - $$PWD/tools/dialogcubicbezier.h \ - $$PWD/tools/dialogcubicbezierpath.h \ - $$PWD/tools/dialoggroup.h \ - $$PWD/tools/dialogrotation.h \ - $$PWD/tools/dialogflippingbyline.h \ - $$PWD/tools/dialogflippingbyaxis.h \ - $$PWD/tools/dialogmove.h - - -SOURCES += \ - $$PWD/tools/dialogalongline.cpp \ - $$PWD/tools/dialogarc.cpp \ - $$PWD/tools/dialogarcwithlength.cpp \ - $$PWD/tools/dialogbisector.cpp \ - $$PWD/tools/dialogcurveintersectaxis.cpp \ - $$PWD/tools/dialogcutarc.cpp \ - $$PWD/tools/dialogcutspline.cpp \ - $$PWD/tools/dialogcutsplinepath.cpp \ - $$PWD/tools/dialogdetail.cpp \ - $$PWD/tools/dialogendline.cpp \ - $$PWD/tools/dialogheight.cpp \ - $$PWD/tools/dialogline.cpp \ - $$PWD/tools/dialoglineintersect.cpp \ - $$PWD/tools/dialoglineintersectaxis.cpp \ - $$PWD/tools/dialognormal.cpp \ - $$PWD/tools/dialogpointfromarcandtangent.cpp \ - $$PWD/tools/dialogpointfromcircleandtangent.cpp \ - $$PWD/tools/dialogpointofcontact.cpp \ - $$PWD/tools/dialogpointofintersection.cpp \ - $$PWD/tools/dialogpointofintersectionarcs.cpp \ - $$PWD/tools/dialogpointofintersectioncircles.cpp \ - $$PWD/tools/dialogshoulderpoint.cpp \ - $$PWD/tools/dialogsinglepoint.cpp \ - $$PWD/tools/dialogspline.cpp \ - $$PWD/tools/dialogsplinepath.cpp \ - $$PWD/tools/dialogtool.cpp \ - $$PWD/tools/dialogtriangle.cpp \ - $$PWD/tools/dialoguniondetails.cpp \ - $$PWD/support/dialogeditwrongformula.cpp \ - $$PWD/support/dialogundo.cpp \ - $$PWD/tools/dialogtruedarts.cpp \ - $$PWD/tools/dialogpointofintersectioncurves.cpp \ - $$PWD/tools/dialogcubicbezier.cpp \ - $$PWD/tools/dialogcubicbezierpath.cpp \ - $$PWD/tools/dialoggroup.cpp \ - $$PWD/tools/dialogrotation.cpp \ - $$PWD/tools/dialogflippingbyline.cpp \ - $$PWD/tools/dialogflippingbyaxis.cpp \ - $$PWD/tools/dialogmove.cpp - -FORMS += \ - $$PWD/tools/dialogalongline.ui \ - $$PWD/tools/dialogarc.ui \ - $$PWD/tools/dialogarcwithlength.ui \ - $$PWD/tools/dialogbisector.ui \ - $$PWD/tools/dialogcurveintersectaxis.ui \ - $$PWD/tools/dialogcutarc.ui \ - $$PWD/tools/dialogcutspline.ui \ - $$PWD/tools/dialogcutsplinepath.ui \ - $$PWD/tools/dialogdetail.ui \ - $$PWD/tools/dialogendline.ui \ - $$PWD/tools/dialogheight.ui \ - $$PWD/tools/dialogline.ui \ - $$PWD/tools/dialoglineintersect.ui \ - $$PWD/tools/dialoglineintersectaxis.ui \ - $$PWD/tools/dialognormal.ui \ - $$PWD/tools/dialogpointfromarcandtangent.ui \ - $$PWD/tools/dialogpointfromcircleandtangent.ui \ - $$PWD/tools/dialogpointofcontact.ui \ - $$PWD/tools/dialogpointofintersection.ui \ - $$PWD/tools/dialogpointofintersectionarcs.ui \ - $$PWD/tools/dialogpointofintersectioncircles.ui \ - $$PWD/tools/dialogshoulderpoint.ui \ - $$PWD/tools/dialogsinglepoint.ui \ - $$PWD/tools/dialogspline.ui \ - $$PWD/tools/dialogsplinepath.ui \ - $$PWD/tools/dialogtriangle.ui \ - $$PWD/tools/dialoguniondetails.ui \ - $$PWD/support/dialogeditwrongformula.ui \ - $$PWD/support/dialogundo.ui \ - $$PWD/tools/dialogtruedarts.ui \ - $$PWD/tools/dialogpointofintersectioncurves.ui \ - $$PWD/tools/dialogcubicbezier.ui \ - $$PWD/tools/dialogcubicbezierpath.ui \ - $$PWD/tools/dialoggroup.ui \ - $$PWD/tools/dialogrotation.ui \ - $$PWD/tools/dialogflippingbyline.ui \ - $$PWD/tools/dialogflippingbyaxis.ui \ - $$PWD/tools/dialogmove.ui +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +HEADERS += \ + $$PWD/tooldialogs.h \ + $$PWD/tools/dialogalongline.h \ + $$PWD/tools/dialogarc.h \ + $$PWD/tools/dialogarcwithlength.h \ + $$PWD/tools/dialogbisector.h \ + $$PWD/tools/dialogcurveintersectaxis.h \ + $$PWD/tools/dialogcutarc.h \ + $$PWD/tools/dialogcutspline.h \ + $$PWD/tools/dialogcutsplinepath.h \ + $$PWD/tools/dialogdetail.h \ + $$PWD/tools/dialogendline.h \ + $$PWD/tools/dialogheight.h \ + $$PWD/tools/dialogline.h \ + $$PWD/tools/dialoglineintersect.h \ + $$PWD/tools/dialoglineintersectaxis.h \ + $$PWD/tools/dialognormal.h \ + $$PWD/tools/dialogpointfromarcandtangent.h \ + $$PWD/tools/dialogpointfromcircleandtangent.h \ + $$PWD/tools/dialogpointofcontact.h \ + $$PWD/tools/dialogpointofintersection.h \ + $$PWD/tools/dialogpointofintersectionarcs.h \ + $$PWD/tools/dialogpointofintersectioncircles.h \ + $$PWD/tools/dialogshoulderpoint.h \ + $$PWD/tools/dialogsinglepoint.h \ + $$PWD/tools/dialogspline.h \ + $$PWD/tools/dialogsplinepath.h \ + $$PWD/tools/dialogtool.h \ + $$PWD/tools/dialogtriangle.h \ + $$PWD/tools/dialoguniondetails.h \ + $$PWD/support/dialogeditwrongformula.h \ + $$PWD/support/dialogundo.h \ + $$PWD/tools/dialogtruedarts.h \ + $$PWD/tools/dialogpointofintersectioncurves.h \ + $$PWD/tools/dialogcubicbezier.h \ + $$PWD/tools/dialogcubicbezierpath.h \ + $$PWD/tools/dialoggroup.h \ + $$PWD/tools/dialogrotation.h \ + $$PWD/tools/dialogflippingbyline.h \ + $$PWD/tools/dialogflippingbyaxis.h \ + $$PWD/tools/dialogmove.h \ + $$PWD/tools/dialogellipticalarc.h + + +SOURCES += \ + $$PWD/tools/dialogalongline.cpp \ + $$PWD/tools/dialogarc.cpp \ + $$PWD/tools/dialogarcwithlength.cpp \ + $$PWD/tools/dialogbisector.cpp \ + $$PWD/tools/dialogcurveintersectaxis.cpp \ + $$PWD/tools/dialogcutarc.cpp \ + $$PWD/tools/dialogcutspline.cpp \ + $$PWD/tools/dialogcutsplinepath.cpp \ + $$PWD/tools/dialogdetail.cpp \ + $$PWD/tools/dialogendline.cpp \ + $$PWD/tools/dialogheight.cpp \ + $$PWD/tools/dialogline.cpp \ + $$PWD/tools/dialoglineintersect.cpp \ + $$PWD/tools/dialoglineintersectaxis.cpp \ + $$PWD/tools/dialognormal.cpp \ + $$PWD/tools/dialogpointfromarcandtangent.cpp \ + $$PWD/tools/dialogpointfromcircleandtangent.cpp \ + $$PWD/tools/dialogpointofcontact.cpp \ + $$PWD/tools/dialogpointofintersection.cpp \ + $$PWD/tools/dialogpointofintersectionarcs.cpp \ + $$PWD/tools/dialogpointofintersectioncircles.cpp \ + $$PWD/tools/dialogshoulderpoint.cpp \ + $$PWD/tools/dialogsinglepoint.cpp \ + $$PWD/tools/dialogspline.cpp \ + $$PWD/tools/dialogsplinepath.cpp \ + $$PWD/tools/dialogtool.cpp \ + $$PWD/tools/dialogtriangle.cpp \ + $$PWD/tools/dialoguniondetails.cpp \ + $$PWD/support/dialogeditwrongformula.cpp \ + $$PWD/support/dialogundo.cpp \ + $$PWD/tools/dialogtruedarts.cpp \ + $$PWD/tools/dialogpointofintersectioncurves.cpp \ + $$PWD/tools/dialogcubicbezier.cpp \ + $$PWD/tools/dialogcubicbezierpath.cpp \ + $$PWD/tools/dialoggroup.cpp \ + $$PWD/tools/dialogrotation.cpp \ + $$PWD/tools/dialogflippingbyline.cpp \ + $$PWD/tools/dialogflippingbyaxis.cpp \ + $$PWD/tools/dialogmove.cpp \ + $$PWD/tools/dialogellipticalarc.cpp + +FORMS += \ + $$PWD/tools/dialogalongline.ui \ + $$PWD/tools/dialogarc.ui \ + $$PWD/tools/dialogarcwithlength.ui \ + $$PWD/tools/dialogbisector.ui \ + $$PWD/tools/dialogcurveintersectaxis.ui \ + $$PWD/tools/dialogcutarc.ui \ + $$PWD/tools/dialogcutspline.ui \ + $$PWD/tools/dialogcutsplinepath.ui \ + $$PWD/tools/dialogdetail.ui \ + $$PWD/tools/dialogendline.ui \ + $$PWD/tools/dialogheight.ui \ + $$PWD/tools/dialogline.ui \ + $$PWD/tools/dialoglineintersect.ui \ + $$PWD/tools/dialoglineintersectaxis.ui \ + $$PWD/tools/dialognormal.ui \ + $$PWD/tools/dialogpointfromarcandtangent.ui \ + $$PWD/tools/dialogpointfromcircleandtangent.ui \ + $$PWD/tools/dialogpointofcontact.ui \ + $$PWD/tools/dialogpointofintersection.ui \ + $$PWD/tools/dialogpointofintersectionarcs.ui \ + $$PWD/tools/dialogpointofintersectioncircles.ui \ + $$PWD/tools/dialogshoulderpoint.ui \ + $$PWD/tools/dialogsinglepoint.ui \ + $$PWD/tools/dialogspline.ui \ + $$PWD/tools/dialogsplinepath.ui \ + $$PWD/tools/dialogtriangle.ui \ + $$PWD/tools/dialoguniondetails.ui \ + $$PWD/support/dialogeditwrongformula.ui \ + $$PWD/support/dialogundo.ui \ + $$PWD/tools/dialogtruedarts.ui \ + $$PWD/tools/dialogpointofintersectioncurves.ui \ + $$PWD/tools/dialogcubicbezier.ui \ + $$PWD/tools/dialogcubicbezierpath.ui \ + $$PWD/tools/dialoggroup.ui \ + $$PWD/tools/dialogrotation.ui \ + $$PWD/tools/dialogflippingbyline.ui \ + $$PWD/tools/dialogflippingbyaxis.ui \ + $$PWD/tools/dialogmove.ui \ + $$PWD/tools/dialogellipticalarc.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index 23f99447c..1090e905d 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -65,6 +65,7 @@ #include "tools/dialogflippingbyline.h" #include "tools/dialogflippingbyaxis.h" #include "tools/dialogmove.h" +#include "tools/dialogellipticalarc.h" #include "support/dialogeditwrongformula.h" #include "support/dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp new file mode 100644 index 000000000..50327af3f --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp @@ -0,0 +1,638 @@ +/************************************************************************ + ** + ** @file dialogellipticalarc.cpp + ** @author Valentina Zhuravska + ** @date 15 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "dialogellipticalarc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../ifc/xml/vdomdocument.h" +#include "../vpatterndb/vtranslatevars.h" +#include "../../visualization/path/vistoolellipticalarc.h" +#include "../../visualization/visualization.h" +#include "../support/dialogeditwrongformula.h" +#include "../vmisc/vabstractapplication.h" +#include "../vmisc/vcommonsettings.h" +#include "ui_dialogellipticalarc.h" + +class QCloseEvent; +class QWidget; +class VContainer; + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief DialogEllipticalArc create dialog + * @param data container with data + * @param parent parent widget + */ +DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent) +:DialogTool(data, toolId, parent), ui(new Ui::DialogEllipticalArc) +{ + ui->setupUi(this); + + this->formulaBaseHeightRadius1 = ui->plainTextEditRadius1->height(); + this->formulaBaseHeightRadius2 = ui->plainTextEditRadius2->height(); + this->formulaBaseHeightF1 = ui->plainTextEditF1->height(); + this->formulaBaseHeightF2 = ui->plainTextEditF2->height(); + this->formulaBaseHeightRotationAngle = ui->plainTextEditRotationAngle->height(); + + ui->plainTextEditRadius1->installEventFilter(this); + ui->plainTextEditRadius2->installEventFilter(this); + ui->plainTextEditF1->installEventFilter(this); + ui->plainTextEditF2->installEventFilter(this); + ui->plainTextEditRotationAngle->installEventFilter(this); + + timerRadius1 = new QTimer(this); + connect(timerRadius1, &QTimer::timeout, this, &DialogEllipticalArc::EvalRadiuses); + + timerRadius2 = new QTimer(this); + connect(timerRadius2, &QTimer::timeout, this, &DialogEllipticalArc::EvalRadiuses); + + timerF1 = new QTimer(this); + connect(timerF1, &QTimer::timeout, this, &DialogEllipticalArc::EvalAngles); + + timerF2 = new QTimer(this); + connect(timerF2, &QTimer::timeout, this, &DialogEllipticalArc::EvalAngles); + + timerRotationAngle = new QTimer(this); + connect(timerRotationAngle, &QTimer::timeout, this, &DialogEllipticalArc::EvalAngles); + + InitOkCancelApply(ui); + + FillComboBoxPoints(ui->comboBoxBasePoint); + FillComboBoxLineColors(ui->comboBoxColor); + + CheckState(); + + connect(ui->toolButtonExprRadius1, &QPushButton::clicked, this, &DialogEllipticalArc::FXRadius1); + connect(ui->toolButtonExprRadius2, &QPushButton::clicked, this, &DialogEllipticalArc::FXRadius2); + connect(ui->toolButtonExprF1, &QPushButton::clicked, this, &DialogEllipticalArc::FXF1); + connect(ui->toolButtonExprF2, &QPushButton::clicked, this, &DialogEllipticalArc::FXF2); + connect(ui->toolButtonExprRotationAngle, &QPushButton::clicked, this, &DialogEllipticalArc::FXRotationAngle); + + connect(ui->plainTextEditRadius1, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::Radius1Changed); + connect(ui->plainTextEditRadius2, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::Radius2Changed); + connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::F1Changed); + connect(ui->plainTextEditF2, &QPlainTextEdit::textChanged, this, &DialogEllipticalArc::F2Changed); + connect(ui->plainTextEditRotationAngle, &QPlainTextEdit::textChanged, + this, &DialogEllipticalArc::RotationAngleChanged); + + connect(ui->pushButtonGrowLengthRadius1, &QPushButton::clicked, this, &DialogEllipticalArc::DeployRadius1TextEdit); + connect(ui->pushButtonGrowLengthRadius2, &QPushButton::clicked, this, &DialogEllipticalArc::DeployRadius2TextEdit); + connect(ui->pushButtonGrowLengthF1, &QPushButton::clicked, this, &DialogEllipticalArc::DeployF1TextEdit); + connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogEllipticalArc::DeployF2TextEdit); + connect(ui->pushButtonGrowLengthRotationAngle, &QPushButton::clicked, + this, &DialogEllipticalArc::DeployRotationAngleTextEdit); + + vis = new VisToolEllipticalArc(data); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogEllipticalArc::~DialogEllipticalArc() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetCenter return id of center point + * @return id id + */ +quint32 DialogEllipticalArc::GetCenter() const +{ + return getCurrentObjectId(ui->comboBoxBasePoint); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetCenter set id of center point + * @param value id + */ +void DialogEllipticalArc::SetCenter(const quint32 &value) +{ + ChangeCurrentData(ui->comboBoxBasePoint, value); + vis->setObject1Id(value); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetRadius1 return formula of radius1 + * @return formula + */ +QString DialogEllipticalArc::GetRadius1() const +{ + return qApp->TrVars()->TryFormulaFromUser(radius1, qApp->Settings()->GetOsSeparator()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetRadius1 set formula of radius1 + * @param value formula + */ +void DialogEllipticalArc::SetRadius1(const QString &value) +{ + radius1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (radius1.length() > 80) + { + this->DeployRadius1TextEdit(); + } + ui->plainTextEditRadius1->setPlainText(radius1); + + VisToolEllipticalArc *path = qobject_cast(vis); + SCASSERT(path != nullptr); + path->setRadius1(radius1); + + MoveCursorToEnd(ui->plainTextEditRadius1); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetRadius2 return formula of radius2 + * @return formula + */ +QString DialogEllipticalArc::GetRadius2() const +{ + return qApp->TrVars()->TryFormulaFromUser(radius2, qApp->Settings()->GetOsSeparator()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetRadius2 set formula of radius2 + * @param value formula + */ +void DialogEllipticalArc::SetRadius2(const QString &value) +{ + radius2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (radius2.length() > 80) + { + this->DeployRadius2TextEdit(); + } + ui->plainTextEditRadius2->setPlainText(radius2); + + VisToolEllipticalArc *path = qobject_cast(vis); + SCASSERT(path != nullptr); + path->setRadius2(radius2); + + MoveCursorToEnd(ui->plainTextEditRadius2); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetF1 return formula first angle of elliptical arc + * @return formula + */ +QString DialogEllipticalArc::GetF1() const +{ + return qApp->TrVars()->TryFormulaFromUser(f1, qApp->Settings()->GetOsSeparator()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetF1 set formula first angle of elliptical arc + * @param value formula + */ +void DialogEllipticalArc::SetF1(const QString &value) +{ + f1 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (f1.length() > 80) + { + this->DeployF1TextEdit(); + } + ui->plainTextEditF1->setPlainText(f1); + + VisToolEllipticalArc *path = qobject_cast(vis); + SCASSERT(path != nullptr); + path->setF1(f1); + + MoveCursorToEnd(ui->plainTextEditF1); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetF2 return formula second angle of elliptical arc + * @return formula + */ +QString DialogEllipticalArc::GetF2() const +{ + return qApp->TrVars()->TryFormulaFromUser(f2, qApp->Settings()->GetOsSeparator()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetF2 set formula second angle of elliptical arc + * @param value formula + */ +void DialogEllipticalArc::SetF2(const QString &value) +{ + f2 = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (f2.length() > 80) + { + this->DeployF2TextEdit(); + } + ui->plainTextEditF2->setPlainText(f2); + + VisToolEllipticalArc *path = qobject_cast(vis); + SCASSERT(path != nullptr); + path->setF2(f2); + + MoveCursorToEnd(ui->plainTextEditF2); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetRotationAngle return formula rotation angle of elliptical arc + * @return formula + */ +QString DialogEllipticalArc::GetRotationAngle() const +{ + return qApp->TrVars()->TryFormulaFromUser(rotationAngle, qApp->Settings()->GetOsSeparator()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetRotationAngle set formula rotation angle of elliptical arc + * @param value formula + */ +void DialogEllipticalArc::SetRotationAngle(const QString &value) +{ + rotationAngle = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (rotationAngle.length() > 80) + { + this->DeployRotationAngleTextEdit(); + } + ui->plainTextEditRotationAngle->setPlainText(rotationAngle); + + VisToolEllipticalArc *path = qobject_cast(vis); + SCASSERT(path != nullptr); + path->setRotationAngle(rotationAngle); + + MoveCursorToEnd(ui->plainTextEditRotationAngle); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetColor return color of elliptical arc + * @return formula + */ +QString DialogEllipticalArc::GetColor() const +{ + return GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SetColor set color of elliptical arc + * @param value formula + */ +void DialogEllipticalArc::SetColor(const QString &value) +{ + ChangeCurrentData(ui->comboBoxColor, value); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief EvalRadiuses calculate value of radiuses + */ +void DialogEllipticalArc::EvalRadiuses() +{ + labelEditFormula = ui->labelEditRadius1; + const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const qreal radius_1 = Eval(ui->plainTextEditRadius1->toPlainText(), flagRadius1, ui->labelResultRadius1, postfix); + + if (radius_1 < 0) + { + flagRadius1 = false; + ChangeColor(labelEditFormula, Qt::red); + ui->labelResultRadius1->setText(tr("Error")); + ui->labelResultRadius1->setToolTip(tr("Radius can't be negative")); + + DialogEllipticalArc::CheckState(); + } + + labelEditFormula = ui->labelEditRadius2; + const qreal radius_2 = Eval(ui->plainTextEditRadius2->toPlainText(), flagRadius2, ui->labelResultRadius2, postfix); + if (radius_2 < 0) + { + flagRadius2 = false; + ChangeColor(labelEditFormula, Qt::red); + ui->labelResultRadius2->setText(tr("Error")); + ui->labelResultRadius2->setToolTip(tr("Radius can't be negative")); + + DialogEllipticalArc::CheckState(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief EvalAngles calculate value of angles + */ +void DialogEllipticalArc::EvalAngles() +{ + labelEditFormula = ui->labelEditF1; + angleF1 = Eval(ui->plainTextEditF1->toPlainText(), flagF1, ui->labelResultF1, degreeSymbol, false); + + labelEditFormula = ui->labelEditF2; + angleF2 = Eval(ui->plainTextEditF2->toPlainText(), flagF2, ui->labelResultF2, degreeSymbol, false); + + labelEditFormula = ui->labelEditRotationAngle; + rotationAngle = Eval(ui->plainTextEditRotationAngle->toPlainText(), flagRotationAngle, + ui->labelResultRotationAngle, degreeSymbol, false); + + CheckAngles(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::CheckAngles() +{ + if (static_cast(angleF1) == INT_MIN || static_cast(angleF2) == INT_MIN) + { + return; + } + + if (VFuzzyComparePossibleNulls(angleF1, angleF2)) + { + flagF1 = false; + ChangeColor(ui->labelEditF1, Qt::red); + ui->labelResultF1->setText(tr("Error")); + ui->labelResultF1->setToolTip(tr("Angles equal")); + + flagF2 = false; + ChangeColor(ui->labelEditF2, Qt::red); + ui->labelResultF2->setText(tr("Error")); + ui->labelResultF2->setToolTip(tr("Angles equal")); + } + + DialogEllipticalArc::CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::FXRadius1() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit radius1")); + dialog->SetFormula(GetRadius1()); + dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + if (dialog->exec() == QDialog::Accepted) + { + SetRadius1(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::FXRadius2() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit radius2")); + dialog->SetFormula(GetRadius2()); + dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + if (dialog->exec() == QDialog::Accepted) + { + SetRadius2(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::FXF1() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit first angle")); + dialog->SetFormula(GetF1()); + dialog->setPostfix(degreeSymbol); + if (dialog->exec() == QDialog::Accepted) + { + SetF1(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::FXF2() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit second angle")); + dialog->SetFormula(GetF2()); + dialog->setPostfix(degreeSymbol); + if (dialog->exec() == QDialog::Accepted) + { + SetF2(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::FXRotationAngle() +{ + DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); + dialog->setWindowTitle(tr("Edit rotation angle")); + dialog->SetFormula(GetRotationAngle()); + dialog->setPostfix(degreeSymbol); + if (dialog->exec() == QDialog::Accepted) + { + SetRotationAngle(dialog->GetFormula()); + } + delete dialog; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Radius1Changed after change formula of radius1 calculate value and show result + */ +void DialogEllipticalArc::Radius1Changed() +{ + labelEditFormula = ui->labelEditRadius1; + labelResultCalculation = ui->labelResultRadius1; + const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + ValFormulaChanged(flagRadius1, ui->plainTextEditRadius1, timerRadius1, postfix); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief Radius2Changed after change formula of radius2 calculate value and show result + */ +void DialogEllipticalArc::Radius2Changed() +{ + labelEditFormula = ui->labelEditRadius2; + labelResultCalculation = ui->labelResultRadius2; + const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + ValFormulaChanged(flagRadius2, ui->plainTextEditRadius2, timerRadius2, postfix); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief F1Changed after change formula of first angle calculate value and show result + */ +void DialogEllipticalArc::F1Changed() +{ + labelEditFormula = ui->labelEditF1; + labelResultCalculation = ui->labelResultF1; + ValFormulaChanged(flagF1, ui->plainTextEditF1, timerF1, degreeSymbol); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief F2Changed after change formula of second angle calculate value and show result + */ +void DialogEllipticalArc::F2Changed() +{ + labelEditFormula = ui->labelEditF2; + labelResultCalculation = ui->labelResultF2; + ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2, degreeSymbol); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief RotationAngleChanged after change formula of rotation angle calculate value and show result + */ +void DialogEllipticalArc::RotationAngleChanged() +{ + labelEditFormula = ui->labelEditRotationAngle; + labelResultCalculation = ui->labelResultF2; + ValFormulaChanged(flagRotationAngle, ui->plainTextEditRotationAngle, timerRotationAngle, degreeSymbol); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::DeployRadius1TextEdit() +{ + DeployFormula(ui->plainTextEditRadius1, ui->pushButtonGrowLengthRadius1, formulaBaseHeightRadius1); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::DeployRadius2TextEdit() +{ + DeployFormula(ui->plainTextEditRadius2, ui->pushButtonGrowLengthRadius2, formulaBaseHeightRadius2); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::DeployF1TextEdit() +{ + DeployFormula(ui->plainTextEditF1, ui->pushButtonGrowLengthF1, formulaBaseHeightF1); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::DeployF2TextEdit() +{ + DeployFormula(ui->plainTextEditF2, ui->pushButtonGrowLengthF2, formulaBaseHeightF2); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::DeployRotationAngleTextEdit() +{ + DeployFormula(ui->plainTextEditRotationAngle, ui->pushButtonGrowLengthRotationAngle,formulaBaseHeightRotationAngle); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. + * @param id id of point or detail + * @param type type of object + */ +void DialogEllipticalArc::ChosenObject(quint32 id, const SceneObject &type) +{ + if (prepare == false)// After first choose we ignore all objects + { + if (type == SceneObject::Point) + { + if (SetObject(id, ui->comboBoxBasePoint, "")) + { + vis->VisualMode(id); + prepare = true; + this->setModal(true); + this->show(); + } + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief CheckState if all is right enable button ok + */ +void DialogEllipticalArc::CheckState() +{ + SCASSERT(bOk != nullptr); + bOk->setEnabled(flagRadius1 && flagRadius2 && flagF1 && flagF2 && flagRotationAngle); + SCASSERT(bApply != nullptr); + bApply->setEnabled(flagRadius1 && flagRadius2 && flagF1 && flagF2 && flagRotationAngle); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::ShowVisualization() +{ + AddVisualization(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::SaveData() +{ + radius1 = ui->plainTextEditRadius1->toPlainText(); + radius1.replace("\n", " "); + radius2 = ui->plainTextEditRadius2->toPlainText(); + radius2.replace("\n", " "); + f1 = ui->plainTextEditF1->toPlainText(); + f1.replace("\n", " "); + f2 = ui->plainTextEditF2->toPlainText(); + f2.replace("\n", " "); + rotationAngle = ui->plainTextEditRotationAngle->toPlainText(); + rotationAngle.replace("\n", " "); + + VisToolEllipticalArc *path = qobject_cast(vis); + SCASSERT(path != nullptr); + + path->setObject1Id(GetCenter()); + path->setRadius1(radius1); + path->setRadius2(radius2); + path->setF1(f1); + path->setF2(f2); + path->setRotationAngle(rotationAngle); + path->RefreshGeometry(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogEllipticalArc::closeEvent(QCloseEvent *event) +{ + ui->plainTextEditRadius1->blockSignals(true); + ui->plainTextEditRadius2->blockSignals(true); + ui->plainTextEditF1->blockSignals(true); + ui->plainTextEditF2->blockSignals(true); + ui->plainTextEditRotationAngle->blockSignals(true); + DialogTool::closeEvent(event); +} diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.h b/src/libs/vtools/dialogs/tools/dialogellipticalarc.h new file mode 100644 index 000000000..ff03b3ba4 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.h @@ -0,0 +1,178 @@ +/************************************************************************ + ** + ** @file dialogellipticalarc.h + ** @author Valentina Zhuravska + ** @date 15 9, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef DIALOGELLIPTICALARC_H +#define DIALOGELLIPTICALARC_H + +#include +#include +#include +#include +#include + +#include "../vmisc/def.h" +#include "dialogtool.h" + +class QCloseEvent; +class QTimer; +class QWidget; +class VContainer; + +namespace Ui +{ + class DialogEllipticalArc; +} + +class DialogEllipticalArc : public DialogTool +{ + Q_OBJECT +public: + DialogEllipticalArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); + virtual ~DialogEllipticalArc() Q_DECL_OVERRIDE; + + quint32 GetCenter() const; + void SetCenter(const quint32 &value); + + QString GetRadius1() const; + void SetRadius1(const QString &value); + + QString GetRadius2() const; + void SetRadius2(const QString &value); + + QString GetF1() const; + void SetF1(const QString &value); + + QString GetF2() const; + void SetF2(const QString &value); + + QString GetRotationAngle() const; + void SetRotationAngle(const QString &value); + + QString GetColor() const; + void SetColor(const QString &value); + +public slots: + virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; + /** + * @brief DeployFormulaTextEdit grow or shrink formula input + */ + void DeployRadius1TextEdit(); + void DeployRadius2TextEdit(); + void DeployF1TextEdit(); + void DeployF2TextEdit(); + void DeployRotationAngleTextEdit(); + + void Radius1Changed(); + void Radius2Changed(); + void F1Changed(); + void F2Changed(); + void RotationAngleChanged(); + + void FXRadius1(); + void FXRadius2(); + void FXF1(); + void FXF2(); + void FXRotationAngle(); + +protected: + virtual void CheckState() Q_DECL_OVERRIDE; + virtual void ShowVisualization() Q_DECL_OVERRIDE; + /** + * @brief SaveData Put dialog data in local variables + */ + virtual void SaveData() Q_DECL_OVERRIDE; + virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; + +private: + Q_DISABLE_COPY(DialogEllipticalArc) + + /** @brief ui keeps information about user interface */ + Ui::DialogEllipticalArc *ui; + + /** @brief flagRadius1 true if value of radius1 is correct */ + bool flagRadius1; + + /** @brief flagRadius2 true if value of radius2 is correct */ + bool flagRadius2; + + /** @brief flagF1 true if value of first angle is correct */ + bool flagF1; + + /** @brief flagF2 true if value of second angle is correct */ + bool flagF2; + + /** @brief flagRotationAngle true if value of rotation angle is correct */ + bool flagRotationAngle; + + /** @brief timerRadius1 timer of check formula of radius1 */ + QTimer *timerRadius1; + + /** @brief timerRadius2 timer of check formula of radius2 */ + QTimer *timerRadius2; + + /** @brief timerF1 timer of check formula of first angle */ + QTimer *timerF1; + + /** @brief timerF2 timer of check formula of second angle */ + QTimer *timerF2; + + /** @brief timerRotationAngle timer of check formula of rotation angle */ + QTimer *timerRotationAngle; + + /** @brief radius1 formula of radius1 */ + QString radius1; + + /** @brief radius2 formula of radius2 */ + QString radius2; + + /** @brief f1 formula of first angle */ + QString f1; + + /** @brief f2 formula of second angle */ + QString f2; + + /** @brief rotationAngle formula of rotation angle */ + QString rotationAngle; + + /** @brief formulaBaseHeight base height defined by dialogui */ + int formulaBaseHeightRadius1; + int formulaBaseHeightRadius2; + int formulaBaseHeightF1; + int formulaBaseHeightF2; + int formulaBaseHeightRotationAngle; + + qreal angleF1; + qreal angleF2; + qreal angleRotation; + + void EvalRadiuses(); + void EvalAngles(); + void CheckAngles(); +}; + +#endif // DIALOGELLIPTICALARC_H diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.ui b/src/libs/vtools/dialogs/tools/dialogellipticalarc.ui new file mode 100644 index 000000000..ea551e763 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.ui @@ -0,0 +1,1018 @@ + + + DialogEllipticalArc + + + + 0 + 0 + 425 + 523 + + + + Dialog + + + + + 10 + 10 + 401 + 501 + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Radius1: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calulation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Radius2: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calulation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + First angle: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Second angle: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Rotation angle: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 0 + 0 + + + + Center point: + + + + + + + Select center point of the arc + + + + + + + + + + + + + + Color: + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + From aa24976f9a568844dd76c6f969281b5d6da52507 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:17:29 +0200 Subject: [PATCH 4/9] Added elliptical arc tool to MainWindow. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 30 ++++++- src/app/valentina/mainwindow.h | 1 + src/app/valentina/mainwindow.ui | 80 ++++++++++++++++++ src/app/valentina/share/resources/cursor.qrc | 2 + .../share/resources/cursor/el_arc_cursor.png | Bin 0 -> 473 bytes .../resources/cursor/el_arc_cursor@2x.png | Bin 0 -> 964 bytes .../valentina/share/resources/toolicon.qrc | 2 + .../share/resources/toolicon/32x32/el_arc.png | Bin 0 -> 579 bytes .../resources/toolicon/32x32/el_arc@2x.png | Bin 0 -> 1178 bytes src/libs/ifc/xml/vabstractpattern.cpp | 8 +- src/libs/vmisc/share/resources/icon.qrc | 2 + .../resources/icon/16x16/toolsectionelarc.png | Bin 0 -> 305 bytes .../icon/16x16/toolsectionelarc@2x.png | Bin 0 -> 736 bytes 13 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 src/app/valentina/share/resources/cursor/el_arc_cursor.png create mode 100644 src/app/valentina/share/resources/cursor/el_arc_cursor@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/el_arc.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/el_arc@2x.png create mode 100644 src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc.png create mode 100644 src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc@2x.png diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 9ef669c1b..f67d7ad0a 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -874,6 +874,20 @@ void MainWindow::ToolArc(bool checked) &MainWindow::ApplyDialog); } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ToolEllipticalArc handler tool arc. + * @param checked true - button checked. + */ +void MainWindow::ToolEllipticalArc(bool checked) +{ + ToolSelectPointByRelease(); + SetToolButtonWithApply(checked, Tool::EllipticalArc, ":/cursor/el_arc_cursor.png", + tr("Select point of center of elliptical arc"), + &MainWindow::ClosedDialogWithApply, + &MainWindow::ApplyDialog); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ToolSplinePath handler tool splinePath. @@ -1698,6 +1712,7 @@ void MainWindow::InitToolButtons() toolButtonPointerList.append(ui->toolButtonPointerArc); toolButtonPointerList.append(ui->toolButtonPointerDetail); toolButtonPointerList.append(ui->toolButtonPointerOperations); + toolButtonPointerList.append(ui->toolButtonPointerEllipticalArc); for (auto pointer : toolButtonPointerList) { @@ -1746,6 +1761,7 @@ void MainWindow::InitToolButtons() connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove); connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint); connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs); + connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc); } //--------------------------------------------------------------------------------------------------------------------- @@ -1773,7 +1789,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::CancelTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1922,6 +1938,9 @@ void MainWindow::CancelTool() case Tool::Move: ui->toolButtonMove->setChecked(false); break; + case Tool::EllipticalArc: + ui->toolButtonEllipticalArc->setChecked(false); + break; } // Crash: using CRTL+Z while using line tool. @@ -2972,7 +2991,7 @@ void MainWindow::SetEnableTool(bool enable) } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools were handled."); //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); @@ -3011,6 +3030,7 @@ void MainWindow::SetEnableTool(bool enable) ui->toolButtonFlippingByAxis->setEnabled(drawTools); ui->toolButtonMove->setEnabled(drawTools); ui->toolButtonMidpoint->setEnabled(drawTools); + ui->toolButtonEllipticalArc->setEnabled(drawTools); ui->actionLast_tool->setEnabled(drawTools); @@ -3292,7 +3312,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::LastUsedTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled."); if (currentTool == lastUsedTool) { @@ -3470,6 +3490,10 @@ void MainWindow::LastUsedTool() ui->toolButtonMove->setChecked(true); ToolMove(true); break; + case Tool::EllipticalArc: + ui->toolButtonEllipticalArc->setChecked(true); + ToolEllipticalArc(true); + break; } } diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 8bc530b0c..1739fdd9c 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -129,6 +129,7 @@ private slots: void ToolCubicBezier(bool checked); void ToolCutSpline(bool checked); void ToolArc(bool checked); + void ToolEllipticalArc(bool checked); void ToolSplinePath(bool checked); void ToolCubicBezierPath(bool checked); void ToolCutSplinePath(bool checked); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 27f576e5e..0b44070b6 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -1058,6 +1058,86 @@ + + + + 0 + 0 + 130 + 56 + + + + + 0 + 0 + + + + Tools for creating elliptical arcs. + + + + :/icon/16x16/toolsectionelarc@2x.png:/icon/16x16/toolsectionelarc@2x.png + + + Elliptical Arc + + + + + + false + + + Tool pointer + + + ... + + + + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png + + + + 32 + 32 + + + + true + + + + + + + false + + + Arc + + + ... + + + + :/toolicon/32x32/el_arc.png:/toolicon/32x32/el_arc.png + + + + 32 + 32 + + + + true + + + + + diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index b2631218b..e92f24e13 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -76,5 +76,7 @@ cursor/flipping_axis_cursor@2x.png cursor/move_cursor.png cursor/move_cursor@2x.png + cursor/el_arc_cursor.png + cursor/el_arc_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/el_arc_cursor.png b/src/app/valentina/share/resources/cursor/el_arc_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..03b9d0ef50a234261c5fe5c51335d85e5fbd12af GIT binary patch literal 473 zcmV;~0Ve*5P)Ml$(gFW~_$v@Q45S18LmlBX5DxeYb-;i*;t!Go2E-BQ4xqaueq(U}T^;cY zhXd&52z(Bpiz9v#Z~)C6@q-8l(9{vcI)G-5_)dZYXyS-(BszfVjv&VYL_6XqD}(+Y zPKNORTnt|O85mfwsrgE#18_P5D8cxLiy`GNC&PXq?)$^dkno?Ip%UnjeLy)bboE~- zZ~%rQfCAzmi~n#iBx98MTny4I1iCKu2F zJFsc^h-Ud7Am%62a!w$=4{c+3q4=JIq2)IhgAX=MACN4c2gIxtgt8D)8?zYhdo~75 zVBBxSrRf7yQw^1(8q~y32VzEO&~yCbV%QDL8Irg(TnFMPnzeYj7&iRo7?>tMBQV&P z|6yYYqPxwo6c0>v-gLJd7~Hm?qWBjlgE`$T2bS{zK+7k;XJ8N*^gUt#ZWbVjU}x-O P00000NkvXXu0mjfM|{Ky literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/cursor/el_arc_cursor@2x.png b/src/app/valentina/share/resources/cursor/el_arc_cursor@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..32949c8e22c18f577418fe20cafedb5ceb69dcac GIT binary patch literal 964 zcmV;#13UbQP)*(V2Nj|CI4goe zg@P?A)gmHVwQ5`Y(!SC(yBlX>l(Z(cTw z2#W#$0u4bFKwu%HZ2$-)gaw-b0tdkffIvY=IRp?G2=f&H2n2*m0Z0#F&IJHcLzs05 zfV2?Y1Ry1Z8J7V_2VuGj0HlIYEdbI$_*F#!Qb71wWdOd1PzwOQhA>ql0KSDVSwjH6 zgivb$zJoB~0RYz^EQYb$h~cuK;g+7jLnDDM(ss)0r06lmJp$ku!Z#p6Mqbi2Oq&`^ z(mC4hHyUxDKn&35jG4e3!P(a2)0=r zcg$k|LJ%@h93_KNrQHC$B!Dre&3As+f&< z!23M`LNWkY0%2-LGD%-FWLKk^a{Ia-##y^_g%QP-Y!k8^4dup-`Ut>32xI#at=Tq& z=!@ogV6Br1L36}a5dgzJ1Hk$me>NIeot8)faF0{q0+#`Fq_U{*sx-_try-!`@L6Pxa1&p7_Uw{{KvEVxRDb`-g**}3^%KdSx*^-Pv+nSmoY@5gXJ^dv)NjPHTBFHP<&a!qNA+#fdMcm^B&!k_% zUJiL$=B9?c?@?+e+|wH|oX_1D)$qv5b@D&*@@W%&&hCqm^2(Mxdv0000toolicon/32x32/flipping_axis@2x.png toolicon/32x32/move.png toolicon/32x32/move@2x.png + toolicon/32x32/el_arc.png + toolicon/32x32/el_arc@2x.png diff --git a/src/app/valentina/share/resources/toolicon/32x32/el_arc.png b/src/app/valentina/share/resources/toolicon/32x32/el_arc.png new file mode 100644 index 0000000000000000000000000000000000000000..d2af0b2c424bd98ad5fcb3a319aaaaad59ce7761 GIT binary patch literal 579 zcmV-J0=)f+P)m7q>Xw9Tvw=k+bPqjd#yG*J>rvd_=yk@6cT`;!*U`q^R{ld8^h3$ck7_IZP< zJoc?Bzy~uam3BjG^if9%DsZkMl@%|*pY7sH@I16j_9j|Xu&@0ffctN9f5Q8}#*H~D z0*KKb-UP7s1^BG|N}4EES6D*e6W#h>ML;RpU&+=Bj*0Xtl??qbW4z1>2e_U`uE;|YTQ_wL(l RZ1eyC002ovPDHLkV1ghv7(D<0 literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/toolicon/32x32/el_arc@2x.png b/src/app/valentina/share/resources/toolicon/32x32/el_arc@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e5c97ba7b984a3182e7380e1bf39406b2932729d GIT binary patch literal 1178 zcmV;L1ZDe)P)VR%kYD zDp7^%qIIf7jgZ5tk4{34;{7hwO{?*}JKq2osUE5W$X0+HRTT=UC8W+NGEJynI*8}I zxek1x>Y&{riM}TVomdecp|t8;1YQP9pGgQxq1liEg~&97-`oJe7Fc^93j-+XUPz|T z24yMahxaVc72q@5DWEJHE?f;o!$ZGHdq;D7h2Gl%yhekK@$WEuK;{KKS?Al) z`8a7a$2z-6w1zNz&Mktf!~*Z78r}LR$>LdGqBcGD-E>|o@N73(p&6ZiTe$8>rLldv z3dml_Wk@|`xMINloAuJ?qdq%m^@0; z^|xq*CtUY`vV#%3DPS-~1>8)-_1T`|TRro8sMU_;xibauK}zEc52fx3w+em26k6AxO{Jf z70&zQ7J$3CtpC7nl-KOl-YIUggB^WWiv!+6JM_g)IP32e34E>L_J^0+MOx=^~_qI!Te{^v)gF;Lr;`R?vZ*g=IM%ZIPVU&VI|@*TVrtG8b~tJ9XU0&#jNYI*JQ sq=ya(k>%r(-gdbAabbu}q2)pQ2e+bE7@G33*Z=?k07*qoM6N<$f@t0~^Z)<= literal 0 HcmV?d00001 diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index c7ed109f2..05076bd9f 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1422,7 +1422,7 @@ QStringList VAbstractPattern::ListPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1493,7 +1493,7 @@ QStringList VAbstractPattern::ListArcExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1554,7 +1554,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1620,7 +1620,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const { // Check if new tool doesn't bring new attribute with a formula. // If no just increment number - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49); QStringList expressions; const QDomNodeList list = elementsByTagName(TagOperation); diff --git a/src/libs/vmisc/share/resources/icon.qrc b/src/libs/vmisc/share/resources/icon.qrc index ee4e61b21..012520e8b 100644 --- a/src/libs/vmisc/share/resources/icon.qrc +++ b/src/libs/vmisc/share/resources/icon.qrc @@ -64,5 +64,7 @@ icon/16x16/allow_detail@2x.png icon/16x16/forbid_detail.png icon/16x16/forbid_detail@2x.png + icon/16x16/toolsectionelarc.png + icon/16x16/toolsectionelarc@2x.png diff --git a/src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc.png b/src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc.png new file mode 100644 index 0000000000000000000000000000000000000000..2178c0aab183e9e11389b8538690e8c3fd8e5b66 GIT binary patch literal 305 zcmV-10nYx3P)oURpOmX?lWdJ4Wfy0t>5_ULuV!`UvIXe;g$xP_95@Zo za!$RVUyBYOnxkZIm`e6IJG|Za}Zeh00000NkvXXu0mjf D@Q!<| literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc@2x.png b/src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..2f66ae8b378e3f6a8e4bb315d556d4593c4b1958 GIT binary patch literal 736 zcmV<60w4W}P)`%qmqOxU^Yj`DYYq4|)jLV&iQ8coC0YEb2`>D5wWT5K&wZ z@gj(VhoTh^Qa#v%^w5Kdh+u8C)kyW=H>npv%uJ#PB@Z(BC-CNb-}k=vGO<`a>QRq{ zA8K<-_t~VnYx#eHPvvY`GW=%(aS#19Mz}PDEM-Nh0*FsCsHF?YC4)jd$-&LH?(b>3l@kRmuMI`Q3PPI10 z(&?5kxq|KiH+&dm%a(DNJc%N*Q)A(0(e5ed9K-Pg)wi-v5{S%AObG`BZw z?yAk!T7aT(T0-t46v9WAo>#n_K)jK8$2&*E$yaDXpOd`qo&s0ll z1a6yuF_~Og#^&uF%=i#kk4R(CJOEd;*6*Kub<@irpXIYH{&+VQKwks~+`O5b*;bhtBkd S2|geI0000 Date: Sat, 17 Dec 2016 03:34:12 +0200 Subject: [PATCH 5/9] Added VEllipticalArcRadius. --HG-- branch : feature --- .../variables/vellipticalarcradius.cpp | 80 ++++++++++++ .../variables/vellipticalarcradius.h | 51 ++++++++ src/libs/vpatterndb/vpatterndb.pri | 122 +++++++++--------- 3 files changed, 193 insertions(+), 60 deletions(-) create mode 100644 src/libs/vpatterndb/variables/vellipticalarcradius.cpp create mode 100644 src/libs/vpatterndb/variables/vellipticalarcradius.h diff --git a/src/libs/vpatterndb/variables/vellipticalarcradius.cpp b/src/libs/vpatterndb/variables/vellipticalarcradius.cpp new file mode 100644 index 000000000..aa900362f --- /dev/null +++ b/src/libs/vpatterndb/variables/vellipticalarcradius.cpp @@ -0,0 +1,80 @@ +/************************************************************************ + ** + ** @file vellipticalarcradius.cpp + ** @author Valentina Zhuravska + ** @date 16 12, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#include "vellipticalarcradius.h" + +#include +#include + +#include "../ifc/ifcdef.h" +#include "../vgeometry/vellipticalarc.h" +#include "vcurvevariable.h" + +//--------------------------------------------------------------------------------------------------------------------- +VEllipticalArcRadius::VEllipticalArcRadius() + :VCurveVariable() +{ + SetType(VarType::ArcRadius); +} + +//--------------------------------------------------------------------------------------------------------------------- +VEllipticalArcRadius::VEllipticalArcRadius(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc, + const int numberRadius, Unit patternUnit) : VCurveVariable(id, parentId) +{ + SCASSERT(elArc != nullptr); + + SetType(VarType::ArcRadius); + SetName(QString(radius_V+"%1"+"%2").arg(numberRadius).arg(elArc->name())); + if (numberRadius == 1) + { + SetValue(FromPixel(elArc->GetRadius1(), patternUnit)); + } + else + { + SetValue(FromPixel(elArc->GetRadius2(), patternUnit)); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VEllipticalArcRadius::VEllipticalArcRadius(const VEllipticalArcRadius &var) + :VCurveVariable(var) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VEllipticalArcRadius &VEllipticalArcRadius::operator=(const VEllipticalArcRadius &var) +{ + if ( &var == this ) + { + return *this; + } + VCurveVariable::operator=(var); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VEllipticalArcRadius::~VEllipticalArcRadius() +{} diff --git a/src/libs/vpatterndb/variables/vellipticalarcradius.h b/src/libs/vpatterndb/variables/vellipticalarcradius.h new file mode 100644 index 000000000..2ce41edf4 --- /dev/null +++ b/src/libs/vpatterndb/variables/vellipticalarcradius.h @@ -0,0 +1,51 @@ +/************************************************************************ + ** + ** @file vellipticalarcradius.h + ** @author Valentina Zhuravska + ** @date 16 12, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef VELLIPTICALARCRADIUS_H +#define VELLIPTICALARCRADIUS_H + +#include +#include + +#include "../vmisc/def.h" +#include "../ifc/ifcdef.h" +#include "vcurvevariable.h" + +class VEllipticalArc; + +class VEllipticalArcRadius :public VCurveVariable +{ +public: + VEllipticalArcRadius(); + VEllipticalArcRadius(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc, + const int numberRadius, Unit patternUnit); + VEllipticalArcRadius(const VEllipticalArcRadius &var); + VEllipticalArcRadius &operator=(const VEllipticalArcRadius &var); + virtual ~VEllipticalArcRadius() Q_DECL_OVERRIDE; +}; + +#endif // VELLIPTICALARCRADIUS_H diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index c1ae5168a..ead57870f 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -1,60 +1,62 @@ -# ADD TO EACH PATH $$PWD VARIABLE!!!!!! -# This need for corect working file translations.pro - -SOURCES += \ - $$PWD/vcontainer.cpp \ - $$PWD/calculator.cpp \ - $$PWD/vdetail.cpp \ - $$PWD/vnodedetail.cpp \ - $$PWD/vtranslatevars.cpp \ - $$PWD/variables/varcradius.cpp \ - $$PWD/variables/vcurveangle.cpp \ - $$PWD/variables/vcurvelength.cpp \ - $$PWD/variables/vcurvevariable.cpp \ - $$PWD/variables/vincrement.cpp \ - $$PWD/variables/vinternalvariable.cpp \ - $$PWD/variables/vlineangle.cpp \ - $$PWD/variables/vlinelength.cpp \ - $$PWD/variables/vmeasurement.cpp \ - $$PWD/variables/vvariable.cpp \ - $$PWD/vformula.cpp \ - $$PWD/vpatternpiecedata.cpp \ - $$PWD/vpatterninfogeometry.cpp \ - $$PWD/vgrainlinegeometry.cpp \ - $$PWD/variables/vcurveclength.cpp - -win32-msvc*:SOURCES += $$PWD/stable.cpp - -HEADERS += \ - $$PWD/vcontainer.h \ - $$PWD/stable.h \ - $$PWD/calculator.h \ - $$PWD/variables.h \ - $$PWD/vdetail.h \ - $$PWD/vdetail_p.h \ - $$PWD/vnodedetail.h \ - $$PWD/vnodedetail_p.h \ - $$PWD/vtranslatevars.h \ - $$PWD/variables/varcradius.h \ - $$PWD/variables/varcradius_p.h \ - $$PWD/variables/vcurveangle.h \ - $$PWD/variables/vcurvelength.h \ - $$PWD/variables/vcurvevariable.h \ - $$PWD/variables/vcurvevariable_p.h \ - $$PWD/variables/vincrement.h \ - $$PWD/variables/vincrement_p.h \ - $$PWD/variables/vinternalvariable.h \ - $$PWD/variables/vinternalvariable_p.h \ - $$PWD/variables/vlineangle.h \ - $$PWD/variables/vlineangle_p.h \ - $$PWD/variables/vlinelength.h \ - $$PWD/variables/vlinelength_p.h \ - $$PWD/variables/vmeasurement.h \ - $$PWD/variables/vmeasurement_p.h \ - $$PWD/variables/vvariable.h \ - $$PWD/variables/vvariable_p.h \ - $$PWD/vformula.h \ - $$PWD/vpatternpiecedata.h \ - $$PWD/vpatterninfogeometry.h \ - $$PWD/vgrainlinegeometry.h \ - $$PWD/variables/vcurveclength.h +# ADD TO EACH PATH $$PWD VARIABLE!!!!!! +# This need for corect working file translations.pro + +SOURCES += \ + $$PWD/vcontainer.cpp \ + $$PWD/calculator.cpp \ + $$PWD/vdetail.cpp \ + $$PWD/vnodedetail.cpp \ + $$PWD/vtranslatevars.cpp \ + $$PWD/variables/varcradius.cpp \ + $$PWD/variables/vcurveangle.cpp \ + $$PWD/variables/vcurvelength.cpp \ + $$PWD/variables/vcurvevariable.cpp \ + $$PWD/variables/vincrement.cpp \ + $$PWD/variables/vinternalvariable.cpp \ + $$PWD/variables/vlineangle.cpp \ + $$PWD/variables/vlinelength.cpp \ + $$PWD/variables/vmeasurement.cpp \ + $$PWD/variables/vvariable.cpp \ + $$PWD/vformula.cpp \ + $$PWD/vpatternpiecedata.cpp \ + $$PWD/vpatterninfogeometry.cpp \ + $$PWD/vgrainlinegeometry.cpp \ + $$PWD/variables/vcurveclength.cpp \ + $$PWD/variables/vellipticalarcradius.cpp + +win32-msvc*:SOURCES += $$PWD/stable.cpp + +HEADERS += \ + $$PWD/vcontainer.h \ + $$PWD/stable.h \ + $$PWD/calculator.h \ + $$PWD/variables.h \ + $$PWD/vdetail.h \ + $$PWD/vdetail_p.h \ + $$PWD/vnodedetail.h \ + $$PWD/vnodedetail_p.h \ + $$PWD/vtranslatevars.h \ + $$PWD/variables/varcradius.h \ + $$PWD/variables/varcradius_p.h \ + $$PWD/variables/vcurveangle.h \ + $$PWD/variables/vcurvelength.h \ + $$PWD/variables/vcurvevariable.h \ + $$PWD/variables/vcurvevariable_p.h \ + $$PWD/variables/vincrement.h \ + $$PWD/variables/vincrement_p.h \ + $$PWD/variables/vinternalvariable.h \ + $$PWD/variables/vinternalvariable_p.h \ + $$PWD/variables/vlineangle.h \ + $$PWD/variables/vlineangle_p.h \ + $$PWD/variables/vlinelength.h \ + $$PWD/variables/vlinelength_p.h \ + $$PWD/variables/vmeasurement.h \ + $$PWD/variables/vmeasurement_p.h \ + $$PWD/variables/vvariable.h \ + $$PWD/variables/vvariable_p.h \ + $$PWD/vformula.h \ + $$PWD/vpatternpiecedata.h \ + $$PWD/vpatterninfogeometry.h \ + $$PWD/vgrainlinegeometry.h \ + $$PWD/variables/vcurveclength.h \ + $$PWD/variables/vellipticalarcradius.h From 50f6418f10b05a10186b3c08b1cdcd031ca64255 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:40:17 +0200 Subject: [PATCH 6/9] Added AddEllipticalArc method to VContainer. --HG-- branch : feature --- src/libs/vpatterndb/vcontainer.cpp | 16 +++++++++++++++- src/libs/vpatterndb/vcontainer.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 5661de0c3..4af8fe2bf 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -40,10 +40,12 @@ #include "../vgeometry/vpointf.h" #include "../vgeometry/vspline.h" #include "../vgeometry/varc.h" +#include "../vgeometry/vellipticalarc.h" #include "../vmisc/diagnostic.h" #include "../vmisc/logging.h" #include "../vmisc/vabstractapplication.h" #include "variables/varcradius.h" +#include "variables/vellipticalarcradius.h" #include "variables/vcurveangle.h" #include "variables/vcurvelength.h" #include "variables/vcurveclength.h" @@ -388,13 +390,25 @@ void VContainer::AddArc(const QSharedPointer &arc, const quint32 &id, cons AddVariable(radius->GetName(), radius); } +//--------------------------------------------------------------------------------------------------------------------- +void VContainer::AddEllipticalArc(const QSharedPointer &arc, const quint32 &id, const quint32 &parentId) +{ + AddCurve(arc, id, parentId); + + VEllipticalArcRadius *radius1 = new VEllipticalArcRadius(id, parentId, arc.data(), 1, *GetPatternUnit()); + AddVariable(radius1->GetName(), radius1); + + VEllipticalArcRadius *radius2 = new VEllipticalArcRadius(id, parentId, arc.data(), 2, *GetPatternUnit()); + AddVariable(radius2->GetName(), radius2); +} + //--------------------------------------------------------------------------------------------------------------------- void VContainer::AddCurve(const QSharedPointer &curve, const quint32 &id, quint32 parentId) { const GOType curveType = curve->getType(); if (curveType != GOType::Spline && curveType != GOType::SplinePath && curveType != GOType::CubicBezier && curveType != GOType::CubicBezierPath && - curveType != GOType::Arc) + curveType != GOType::Arc && curveType != GOType::EllipticalArc) { throw VException(tr("Can't create a curve with type '%1'").arg(static_cast(curveType))); } diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 028d763ce..94eccfdac 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -59,6 +59,7 @@ class VAbstractCubicBezierPath; class VAbstractCurve; class VArc; +class VEllipticalArc; class VArcRadius; class VCurveAngle; class VCurveLength; @@ -146,6 +147,8 @@ public: quint32 AddDetail(const VDetail &detail); void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); void AddArc(const QSharedPointer &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID); + void AddEllipticalArc(const QSharedPointer &arc, const quint32 &arcId, + const quint32 &parentId = NULL_ID); void AddSpline(const QSharedPointer &curve, quint32 id, quint32 parentId = NULL_ID); void AddCurveWithSegments(const QSharedPointer &curve, const quint32 &id, quint32 parentId = NULL_ID); From 51b21bc99cbb7ff725b97d90e76cba35080f1c72 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:41:33 +0200 Subject: [PATCH 7/9] Added formulaRotationAngle to VEllipticalArc. --HG-- branch : feature --- src/libs/vgeometry/vellipticalarc.cpp | 45 +++++++++++++++++++-------- src/libs/vgeometry/vellipticalarc.h | 9 ++++-- src/libs/vgeometry/vellipticalarc_p.h | 19 +++++++---- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/src/libs/vgeometry/vellipticalarc.cpp b/src/libs/vgeometry/vellipticalarc.cpp index 09b5d790f..ad8186dd9 100644 --- a/src/libs/vgeometry/vellipticalarc.cpp +++ b/src/libs/vgeometry/vellipticalarc.cpp @@ -58,9 +58,10 @@ VEllipticalArc::VEllipticalArc() */ VEllipticalArc::VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2, - const QString &formulaF2, qreal rotationAngle, quint32 idObject, Draw mode) + const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle, + quint32 idObject, Draw mode) : VAbstractArc(GOType::EllipticalArc, center, f1, formulaF1, f2, formulaF2, idObject, mode), - d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle)) + d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle)) { CreateName(); } @@ -77,9 +78,10 @@ VEllipticalArc::VEllipticalArc(const VPointF ¢er, qreal radius1, qreal radiu //--------------------------------------------------------------------------------------------------------------------- VEllipticalArc::VEllipticalArc(qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, - const QString &formulaF1, qreal rotationAngle, quint32 idObject, Draw mode) + const QString &formulaF1, qreal rotationAngle, const QString &formulaRotationAngle, + quint32 idObject, Draw mode) : VAbstractArc(GOType::EllipticalArc, formulaLength, center, f1, formulaF1, idObject, mode), - d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle)) + d (new VEllipticalArcData(radius1, radius2, formulaRadius1, formulaRadius2, rotationAngle, formulaRotationAngle)) { CreateName(); FindF2(length); @@ -445,12 +447,12 @@ QPointF VEllipticalArc::CutArc(const qreal &length, VEllipticalArc &arc1, VEllip // the first arc has given length and startAngle just like in the origin arc arc1 = VEllipticalArc (len, QString().setNum(length), GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, GetStartAngle(), GetFormulaF1(), d->rotationAngle, - getIdObject(), getMode()); + GetFormulaRotationAngle(), getIdObject(), getMode()); // the second arc has startAngle just like endAngle of the first arc // and it has endAngle just like endAngle of the origin arc arc2 = VEllipticalArc (GetCenter(), d->radius1, d->radius2, d->formulaRadius1, d->formulaRadius2, arc1.GetEndAngle(), arc1.GetFormulaF2(), GetEndAngle(), GetFormulaF2(), d->rotationAngle, - getIdObject(), getMode()); + GetFormulaRotationAngle(), getIdObject(), getMode()); return arc1.GetP1(); } @@ -540,7 +542,7 @@ qreal VEllipticalArc::MaxLength() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return arc major radius. + * @brief GetFormulaRadius1 return formula for major radius. * @return radius. */ QString VEllipticalArc::GetFormulaRadius1() const @@ -550,7 +552,7 @@ QString VEllipticalArc::GetFormulaRadius1() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return arc minor radius. + * @brief GetFormulaRadius2 return formula for minor radius. * @return radius. */ QString VEllipticalArc::GetFormulaRadius2() const @@ -560,12 +562,12 @@ QString VEllipticalArc::GetFormulaRadius2() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRotationAngle return rotation angle. + * @brief GetFormulaRotationAngle return formula for rotation angle. * @return rotationAngle. */ -qreal VEllipticalArc::GetRotationAngle() const +QString VEllipticalArc::GetFormulaRotationAngle() const { - return d->rotationAngle; + return d->formulaRotationAngle; } //--------------------------------------------------------------------------------------------------------------------- @@ -582,9 +584,16 @@ void VEllipticalArc::SetFormulaRadius2(const QString &formula, qreal value) d->radius2 = value; } +//--------------------------------------------------------------------------------------------------------------------- +void VEllipticalArc::SetFormulaRotationAngle(const QString &formula, qreal value) +{ + d->formulaRotationAngle = formula; + d->rotationAngle = value; +} + //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return formula for major radius. + * @brief GetRadius1 return elliptical arc major radius. * @return string with formula. */ qreal VEllipticalArc::GetRadius1() const @@ -594,10 +603,20 @@ qreal VEllipticalArc::GetRadius1() const //--------------------------------------------------------------------------------------------------------------------- /** - * @brief GetRadius return formula for minor radius. + * @brief GetRadius2 return elliptical arc minor radius. * @return string with formula. */ qreal VEllipticalArc::GetRadius2() const { return d->radius2; } + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetRotationAngle return rotation angle. + * @return rotationAngle. + */ +qreal VEllipticalArc::GetRotationAngle() const +{ + return d->rotationAngle; +} diff --git a/src/libs/vgeometry/vellipticalarc.h b/src/libs/vgeometry/vellipticalarc.h index 1f15025e4..8527f3498 100644 --- a/src/libs/vgeometry/vellipticalarc.h +++ b/src/libs/vgeometry/vellipticalarc.h @@ -52,11 +52,12 @@ public: VEllipticalArc(); VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, qreal f2, - const QString &formulaF2, qreal rotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); + const QString &formulaF2, qreal rotationAngle, const QString &formulaRotationAngle, + quint32 idObject = 0, Draw mode = Draw::Calculation); VEllipticalArc (const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal f2, qreal rotationAngle); VEllipticalArc (qreal length, const QString &formulaLength, const VPointF ¢er, qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, qreal f1, const QString &formulaF1, - qreal rotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); + qreal rotationAngle, const QString &formulaRotationAngle, quint32 idObject = 0, Draw mode = Draw::Calculation); VEllipticalArc (qreal length, const VPointF ¢er, qreal radius1, qreal radius2, qreal f1, qreal rotationAngle); VEllipticalArc(const VEllipticalArc &arc); @@ -68,7 +69,9 @@ public: virtual ~VEllipticalArc() Q_DECL_OVERRIDE; - qreal GetRotationAngle() const; + QString GetFormulaRotationAngle () const; + void SetFormulaRotationAngle (const QString &formula, qreal value); + qreal GetRotationAngle() const; QString GetFormulaRadius1 () const; void SetFormulaRadius1 (const QString &formula, qreal value); diff --git a/src/libs/vgeometry/vellipticalarc_p.h b/src/libs/vgeometry/vellipticalarc_p.h index ed8ec938e..e829153c3 100644 --- a/src/libs/vgeometry/vellipticalarc_p.h +++ b/src/libs/vgeometry/vellipticalarc_p.h @@ -14,7 +14,7 @@ class VEllipticalArcData : public QSharedData public: VEllipticalArcData (); VEllipticalArcData (qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, - qreal rotationAngle); + qreal rotationAngle, const QString &formulaRotationAngle); VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle); VEllipticalArcData(const VEllipticalArcData &arc); @@ -30,6 +30,8 @@ public: QString formulaRadius2; /** @brief rotationAngle in degree. */ qreal rotationAngle; + /** @brief formulaRotationAngle formula for rotationAngle. */ + QString formulaRotationAngle; private: VEllipticalArcData &operator=(const VEllipticalArcData &) Q_DECL_EQ_DELETE; @@ -41,17 +43,20 @@ VEllipticalArcData::VEllipticalArcData() radius2(0), formulaRadius1(), formulaRadius2(), - rotationAngle(0) + rotationAngle(0), + formulaRotationAngle() {} //--------------------------------------------------------------------------------------------------------------------- VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1, - const QString &formulaRadius2, qreal rotationAngle) + const QString &formulaRadius2, qreal rotationAngle, + const QString &formulaRotationAngle) : radius1(radius1), radius2(radius2), formulaRadius1(formulaRadius1), formulaRadius2(formulaRadius2), - rotationAngle(rotationAngle) + rotationAngle(rotationAngle), + formulaRotationAngle(formulaRotationAngle) {} //--------------------------------------------------------------------------------------------------------------------- @@ -60,7 +65,8 @@ VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotat radius2(radius2), formulaRadius1(QString().number(qApp->fromPixel(radius1))), formulaRadius2(QString().number(qApp->fromPixel(radius2))), - rotationAngle(rotationAngle) + rotationAngle(rotationAngle), + formulaRotationAngle(QString().number(qApp->fromPixel(rotationAngle))) {} //--------------------------------------------------------------------------------------------------------------------- @@ -70,7 +76,8 @@ VEllipticalArcData::VEllipticalArcData(const VEllipticalArcData &arc) radius2(arc.radius2), formulaRadius1(arc.formulaRadius1), formulaRadius2(arc.formulaRadius2), - rotationAngle(arc.rotationAngle) + rotationAngle(arc.rotationAngle), + formulaRotationAngle(arc.formulaRotationAngle) {} //--------------------------------------------------------------------------------------------------------------------- From a8a3487996c718325a941a89f15a7af90eab421e Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:53:47 +0200 Subject: [PATCH 8/9] Added new schema v0.3.9. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 91 +++- src/app/valentina/xml/vpattern.h | 4 + src/libs/ifc/ifcdef.cpp | 3 + src/libs/ifc/ifcdef.h | 3 + src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.3.9.xsd | 655 +++++++++++++++++++++++++ src/libs/ifc/xml/vabstractpattern.cpp | 1 + src/libs/ifc/xml/vabstractpattern.h | 1 + src/libs/ifc/xml/vpatternconverter.cpp | 4 +- 9 files changed, 759 insertions(+), 4 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.3.9.xsd diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 624f5ff2e..b5a7efbc6 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -558,7 +558,8 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const { scene = sceneDetail; } - const QStringList tags = QStringList() << TagPoint << TagLine << TagSpline << TagArc << TagTools << TagOperation; + const QStringList tags = QStringList() << TagPoint << TagLine << TagSpline << TagArc << TagTools << TagOperation + << TagElArc; const QDomNodeList nodeList = node.childNodes(); const qint32 num = nodeList.size(); for (qint32 i = 0; i < num; ++i) @@ -592,6 +593,10 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const qCDebug(vXML, "Tag operation."); ParseOperationElement(scene, domElement, parse, domElement.attribute(AttrType, "")); break; + case 6: // TagElArc + qCDebug(vXML, "Tag elliptical arc."); + ParseEllipticalArcElement(scene, domElement, parse, domElement.attribute(AttrType, "")); + break; default: VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName())); throw e; @@ -2438,6 +2443,58 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, } } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) +{ + SCASSERT(scene != nullptr); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + + try + { + quint32 id = 0; + + ToolsCommonAttributes(domElement, id); + const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR); + const QString radius1 = GetParametrString(domElement, AttrRadius1, "10"); + const QString radius2 = GetParametrString(domElement, AttrRadius2, "10"); + QString r1 = radius1;//need for saving fixed formula; + QString r2 = radius2;//need for saving fixed formula; + const QString f1 = GetParametrString(domElement, AttrAngle1, "180"); + QString f1Fix = f1;//need for saving fixed formula; + const QString f2 = GetParametrString(domElement, AttrAngle2, "270"); + QString f2Fix = f2;//need for saving fixed formula; + const QString frotation = GetParametrString(domElement, AttrRotationAngle, "0"); + QString frotationFix = frotation;//need for saving fixed formula; + const QString color = GetParametrString(domElement, AttrColor, ColorBlack); + + VToolEllipticalArc::Create(id, center, r1, r2, f1Fix, f2Fix, frotationFix, color, 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) + { + SetAttribute(domElement, AttrRadius1, r1); + SetAttribute(domElement, AttrRadius2, r2); + SetAttribute(domElement, AttrAngle1, f1Fix); + SetAttribute(domElement, AttrAngle2, f2Fix); + SetAttribute(domElement, AttrRotationAngle, frotationFix); + modified = true; + haveLiteChange(); + } + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating simple elliptical arc"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + catch (qmu::QmuParserError &e) + { + VExceptionObjectError excep(tr("Error creating or updating simple elliptical arc"), domElement); + excep.AddMoreInformation(QString("Message: " + e.GetMsg() + "\n"+ "Expression: " + e.GetExpr())); + throw excep; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse) { @@ -2865,6 +2922,34 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen } } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ParseEllipticalArcElement parse elliptical arc tag. + * @param scene scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + * @param type type of spline. + */ +void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, + const QString &type) +{ + SCASSERT(scene != nullptr); + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty"); + + QStringList arcs = QStringList() << VToolEllipticalArc::ToolType; /*0*/ + + switch (arcs.indexOf(type)) + { + case 0: //VToolArc::ToolType + ParseToolEllipticalArc(scene, domElement, parse); + break; + default: + VException e(tr("Unknown elliptical arc type '%1'.").arg(type)); + throw e; + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ParseToolsElement parse tools tag. @@ -3442,7 +3527,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QRectF VPattern::ActiveDrawBoundingRect() const { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used."); QRectF rec; @@ -3563,6 +3648,8 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::Move: rec = ToolBoundingRect(rec, tool.getId()); break; + case Tool::EllipticalArc: + rec = ToolBoundingRect(rec, tool.getId()); //These tools are not accesseble in Draw mode, but still 'history' contains them. case Tool::Detail: case Tool::UnionDetails: diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index b21f86751..dd8c68496 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -125,6 +125,8 @@ private: const Document &parse, const QString& type); void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, const QString& type); + void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, + const QString &type); void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement, const Document &parse, const QString& type); void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, @@ -193,6 +195,8 @@ private: void ParseNodeArc(const QDomElement &domElement, const Document &parse); void ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); + void ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); + void ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 450dede6e..0e4fa1022 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -90,6 +90,8 @@ const QString AttrSecondPoint = QStringLiteral("secondPoint"); const QString AttrThirdPoint = QStringLiteral("thirdPoint"); const QString AttrCenter = QStringLiteral("center"); const QString AttrRadius = QStringLiteral("radius"); +const QString AttrRadius1 = QStringLiteral("radius1"); +const QString AttrRadius2 = QStringLiteral("radius2"); const QString AttrAngle = QStringLiteral("angle"); const QString AttrAngle1 = QStringLiteral("angle1"); const QString AttrAngle2 = QStringLiteral("angle2"); @@ -136,6 +138,7 @@ const QString AttrArc = QStringLiteral("arc"); const QString AttrSuffix = QStringLiteral("suffix"); const QString AttrIdObject = QStringLiteral("idObject"); const QString AttrInLayout = QStringLiteral("inLayout"); +const QString AttrRotationAngle = QStringLiteral("rotationAngle"); const QString TypeLineNone = QStringLiteral("none"); const QString TypeLineLine = QStringLiteral("hair"); diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index d3594f201..dfc86eb6b 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -91,9 +91,12 @@ extern const QString AttrSecondPoint; extern const QString AttrThirdPoint; extern const QString AttrCenter; extern const QString AttrRadius; +extern const QString AttrRadius1; +extern const QString AttrRadius2; extern const QString AttrAngle; extern const QString AttrAngle1; extern const QString AttrAngle2; +extern const QString AttrRotationAngle; extern const QString AttrLength1; extern const QString AttrLength2; extern const QString AttrP1Line; diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index 33ca3fdf5..770590cbb 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -32,5 +32,6 @@ schema/individual_measurements/v0.3.1.xsd schema/individual_measurements/v0.3.2.xsd schema/individual_measurements/v0.3.3.xsd + schema/pattern/v0.3.9.xsd diff --git a/src/libs/ifc/schema/pattern/v0.3.9.xsd b/src/libs/ifc/schema/pattern/v0.3.9.xsd new file mode 100644 index 000000000..e78d7b6f3 --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.3.9.xsd @@ -0,0 +1,655 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 05076bd9f..20a153bc0 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -72,6 +72,7 @@ const QString VAbstractPattern::TagPoint = QStringLiteral("point"); const QString VAbstractPattern::TagLine = QStringLiteral("line"); const QString VAbstractPattern::TagSpline = QStringLiteral("spline"); const QString VAbstractPattern::TagArc = QStringLiteral("arc"); +const QString VAbstractPattern::TagElArc = QStringLiteral("elArc"); const QString VAbstractPattern::TagTools = QStringLiteral("tools"); const QString VAbstractPattern::TagOperation = QStringLiteral("operation"); const QString VAbstractPattern::TagGradation = QStringLiteral("gradation"); diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index d5036b3f0..086ed7445 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -177,6 +177,7 @@ public: static const QString TagLine; static const QString TagSpline; static const QString TagArc; + static const QString TagElArc; static const QString TagTools; static const QString TagOperation; static const QString TagGradation; diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index deff9a092..96ea1b8ea 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.8"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.8.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.9"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.9.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! From 947f4eb97c1e10e141a7382c51599264ef4c4795 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 17 Dec 2016 03:57:01 +0200 Subject: [PATCH 9/9] Added ShowOptionsToolEllipticalArc method. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 29 ++++++++++++++++--- .../core/vtooloptionspropertybrowser.h | 1 + src/app/valentina/dialogs/dialoghistory.cpp | 9 +++++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 40183cc34..ce89f36fd 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -77,7 +77,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser() void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); switch (item->type()) { @@ -196,6 +196,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) case VToolMove::Type: ShowOptionsToolMove(item); break; + case VToolEllipticalArc::Type: + ShowOptionsToolEllipticalArc(item); + break; default: break; } @@ -210,7 +213,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); switch (currentItem->type()) { @@ -354,7 +357,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in switch."); switch (currentItem->type()) { @@ -2148,6 +2151,21 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolFlippingByAxis(QGraphicsItem *i AddPropertyOperationSuffix(i, tr("Suffix")); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolOptionsPropertyBrowser::ShowOptionsToolEllipticalArc(QGraphicsItem *item) +{ + VToolEllipticalArc *i = qgraphicsitem_cast(item); + i->ShowVisualization(true); + formView->setTitle(tr("Elliptical arc")); + + AddPropertyFormula(tr("Radius"), i->GetFormulaRadius1(), AttrRadius1); + AddPropertyFormula(tr("Radius"), i->GetFormulaRadius2(), AttrRadius2); + AddPropertyFormula(tr("First angle"), i->GetFormulaF1(), AttrAngle1); + AddPropertyFormula(tr("Second angle"), i->GetFormulaF2(), AttrAngle2); + AddPropertyFormula(tr("Rotation angle"), i->GetFormulaRotationAngle(), AttrRotationAngle); + AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), AttrColor); +} + //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint() { @@ -2680,6 +2698,9 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const << AttrLength1 /* 36 */ << AttrLength2 /* 37 */ << AttrSuffix /* 38 */ - << AttrAxisType; /* 39 */ + << AttrAxisType /* 39 */ + << AttrRadius1 /* 40 */ + << AttrRadius2 /* 41 */ + << AttrRotationAngle; /* 42 */ return attr; } diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.h b/src/app/valentina/core/vtooloptionspropertybrowser.h index 59f59a200..e5d74f23d 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.h +++ b/src/app/valentina/core/vtooloptionspropertybrowser.h @@ -195,6 +195,7 @@ private: void ShowOptionsToolMove(QGraphicsItem *item); void ShowOptionsToolFlippingByLine(QGraphicsItem *item); void ShowOptionsToolFlippingByAxis(QGraphicsItem *item); + void ShowOptionsToolEllipticalArc(QGraphicsItem *item); void UpdateOptionsToolSinglePoint(); void UpdateOptionsToolEndLine(); diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index bd177bdea..c3170d409 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -29,6 +29,7 @@ #include "dialoghistory.h" #include "ui_dialoghistory.h" #include "../vgeometry/varc.h" +#include "../vgeometry/vellipticalarc.h" #include "../vgeometry/vcubicbezier.h" #include "../vgeometry/vsplinepath.h" #include "../vgeometry/vcubicbezierpath.h" @@ -208,7 +209,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QString DialogHistory::Record(const VToolRecord &tool) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 48, "Not all tools was used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -378,6 +379,12 @@ QString DialogHistory::Record(const VToolRecord &tool) .arg(PointName(AttrUInt(domElem, AttrDartP1))) .arg(PointName(AttrUInt(domElem, AttrDartP2))) .arg(PointName(AttrUInt(domElem, AttrDartP2))); + case Tool::EllipticalArc: + { + const QSharedPointer elArc = data->GeometricObject(tool.getId()); + SCASSERT(elArc != nullptr); + return elArc->NameForHistory(tr("Elliptical arc")); + } //Because "history" not only show history of pattern, but help restore current data for each pattern's //piece, we need add record about details and nodes, but don't show them. case Tool::Detail: