Filter in dialog curves that was created after cutting.
--HG-- branch : develop
This commit is contained in:
parent
e9dc8d7b98
commit
2cfe392322
|
@ -8,7 +8,8 @@ SOURCES += \
|
|||
container/vlengthline.cpp \
|
||||
container/vlengthspline.cpp \
|
||||
container/vlengtharc.cpp \
|
||||
container/vlineangle.cpp
|
||||
container/vlineangle.cpp \
|
||||
container/vlengthcurve.cpp
|
||||
|
||||
HEADERS += \
|
||||
container/vcontainer.h \
|
||||
|
@ -21,4 +22,5 @@ HEADERS += \
|
|||
container/vlengthspline.h \
|
||||
container/vlengtharc.h \
|
||||
container/vlineangle.h \
|
||||
container/variables.h
|
||||
container/variables.h \
|
||||
container/vlengthcurve.h
|
||||
|
|
|
@ -282,17 +282,6 @@ void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val p
|
|||
UpdateId(id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief AddLengthArc add length of arc to container
|
||||
* @param id id of arc
|
||||
*/
|
||||
void VContainer::AddLengthArc(const quint32 &id)
|
||||
{
|
||||
const VArc * arc = GeometricObject<const VArc *>(id);
|
||||
AddVariable(arc->name(), new VLengthArc(id, arc));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Clear clear data in container. Id will be 0.
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "../geometry/vdetail.h"
|
||||
#include "../geometry/vgobject.h"
|
||||
#include "../exception/vexceptionbadid.h"
|
||||
#include "../geometry/vabstractcurve.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QHash>
|
||||
|
@ -118,9 +119,22 @@ public:
|
|||
|
||||
quint32 AddGObject(VGObject *obj);
|
||||
quint32 AddDetail(VDetail detail);
|
||||
void AddLengthArc(const quint32 &id);
|
||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||
|
||||
template <typename TLength>
|
||||
/**
|
||||
* @brief AddCurveLength add length of curve type to the container
|
||||
* @param id id of variables
|
||||
* @param parentId if of parent object.
|
||||
*
|
||||
* Parent id - id of cutting point
|
||||
*/
|
||||
void AddCurveLength(const quint32 &id, const quint32 &parentId = 0)
|
||||
{
|
||||
const VAbstractCurve *var = GeometricObject<const VAbstractCurve *>(id);
|
||||
AddVariable(var->name(), new TLength(id, parentId, var));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void AddVariable(const QString& name, T var)
|
||||
{
|
||||
|
|
|
@ -27,29 +27,26 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vlengtharc.h"
|
||||
#include "../geometry/varc.h"
|
||||
#include "../geometry/vabstractcurve.h"
|
||||
#include "../widgets/vapplication.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthArc::VLengthArc()
|
||||
:VInternalVariable(), id(0)
|
||||
:VLengthCurve()
|
||||
{
|
||||
type = VarType::LengthArc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthArc::VLengthArc(const quint32 &id, const VArc *arc)
|
||||
:VInternalVariable(), id(id)
|
||||
VLengthArc::VLengthArc(const quint32 &id, const quint32 &parentId, const VAbstractCurve *arc)
|
||||
:VLengthCurve(id, parentId, arc)
|
||||
{
|
||||
type = VarType::LengthArc;
|
||||
SCASSERT(arc != nullptr);
|
||||
name = arc->name();
|
||||
value = qApp->fromPixel(arc->GetLength());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthArc::VLengthArc(const VLengthArc &var)
|
||||
:VInternalVariable(var), id(var.GetId())
|
||||
:VLengthCurve(var)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -59,17 +56,10 @@ VLengthArc &VLengthArc::operator=(const VLengthArc &var)
|
|||
{
|
||||
return *this;
|
||||
}
|
||||
VInternalVariable::operator=(var);
|
||||
this->id = var.GetId();
|
||||
VLengthCurve::operator=(var);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthArc::~VLengthArc()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VLengthArc::Filter(quint32 id)
|
||||
{
|
||||
return this->id == id;
|
||||
}
|
||||
|
|
|
@ -29,28 +29,18 @@
|
|||
#ifndef VLENGTHARC_H
|
||||
#define VLENGTHARC_H
|
||||
|
||||
#include "vinternalvariable.h"
|
||||
#include "vlengthcurve.h"
|
||||
|
||||
class VArc;
|
||||
class VAbstractCurve;
|
||||
|
||||
class VLengthArc :public VInternalVariable
|
||||
class VLengthArc :public VLengthCurve
|
||||
{
|
||||
public:
|
||||
VLengthArc();
|
||||
VLengthArc(const quint32 &id, const VArc * arc);
|
||||
VLengthArc(const quint32 &id, const quint32 &parentId, const VAbstractCurve *arc);
|
||||
VLengthArc(const VLengthArc &var);
|
||||
VLengthArc &operator=(const VLengthArc &var);
|
||||
virtual ~VLengthArc();
|
||||
|
||||
virtual bool Filter(quint32 id);
|
||||
quint32 GetId() const;
|
||||
private:
|
||||
quint32 id;
|
||||
};
|
||||
|
||||
inline quint32 VLengthArc::GetId() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
#endif // VLENGTHARC_H
|
||||
|
|
83
src/app/container/vlengthcurve.cpp
Normal file
83
src/app/container/vlengthcurve.cpp
Normal file
|
@ -0,0 +1,83 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vlengthcurve.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 15 8, 2014
|
||||
**
|
||||
** @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) 2014 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vlengthcurve.h"
|
||||
#include "../widgets/vapplication.h"
|
||||
#include "../geometry/vabstractcurve.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthCurve::VLengthCurve()
|
||||
:VInternalVariable(), id(0), parentId(0)
|
||||
{
|
||||
type = VarType::Unknown;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthCurve::VLengthCurve(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve)
|
||||
:VInternalVariable(), id(id), parentId(parentId)
|
||||
{
|
||||
type = VarType::Unknown;
|
||||
SCASSERT(curve != nullptr);
|
||||
name = curve->name();
|
||||
value = qApp->fromPixel(curve->GetLength());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthCurve::VLengthCurve(const VLengthCurve &var)
|
||||
:VInternalVariable(var), id(var.GetId()), parentId(var.GetParentId())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthCurve &VLengthCurve::operator=(const VLengthCurve &var)
|
||||
{
|
||||
if ( &var == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
VInternalVariable::operator=(var);
|
||||
this->id = var.GetId();
|
||||
this->parentId = var.GetParentId();
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthCurve::~VLengthCurve()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VLengthCurve::Filter(quint32 id)
|
||||
{
|
||||
if (parentId != 0)//Do not check if value zero
|
||||
{// Not all curves have parents. Only those who was created after cutting the parent curve.
|
||||
return this->id == id || parentId == id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->id == id;
|
||||
}
|
||||
}
|
65
src/app/container/vlengthcurve.h
Normal file
65
src/app/container/vlengthcurve.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vlengthcurve.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 15 8, 2014
|
||||
**
|
||||
** @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) 2014 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VLENGTHCURVE_H
|
||||
#define VLENGTHCURVE_H
|
||||
|
||||
#include "vinternalvariable.h"
|
||||
|
||||
class VAbstractCurve;
|
||||
|
||||
class VLengthCurve : public VInternalVariable
|
||||
{
|
||||
public:
|
||||
VLengthCurve();
|
||||
VLengthCurve(const quint32 &id, const quint32 &parentId, const VAbstractCurve *curve);
|
||||
VLengthCurve(const VLengthCurve &var);
|
||||
VLengthCurve &operator=(const VLengthCurve &var);
|
||||
virtual ~VLengthCurve();
|
||||
|
||||
virtual bool Filter(quint32 id);
|
||||
quint32 GetId() const;
|
||||
quint32 GetParentId() const;
|
||||
protected:
|
||||
quint32 id;
|
||||
quint32 parentId;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline quint32 VLengthCurve::GetId() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline quint32 VLengthCurve::GetParentId() const
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
#endif // VLENGTHCURVE_H
|
|
@ -32,31 +32,31 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthSpline::VLengthSpline()
|
||||
:VInternalVariable(), id(0)
|
||||
:VLengthCurve()
|
||||
{
|
||||
type = VarType::LengthSpline;
|
||||
}
|
||||
|
||||
VLengthSpline::VLengthSpline(const quint32 &id, const QString &name, const qreal &value)
|
||||
:VInternalVariable(), id(id)
|
||||
VLengthSpline::VLengthSpline(const quint32 &id, const quint32 &parentId, const QString &name, const qreal &value)
|
||||
:VLengthCurve()
|
||||
{
|
||||
type = VarType::LengthSpline;
|
||||
this->name = name;
|
||||
this->value = value;
|
||||
this->id = id;
|
||||
this->parentId = parentId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthSpline::VLengthSpline(const quint32 &id, const VAbstractCurve *path)
|
||||
:VInternalVariable(), id(id)
|
||||
VLengthSpline::VLengthSpline(const quint32 &id, const quint32 &parentId, const VAbstractCurve *path)
|
||||
:VLengthCurve(id, parentId, path)
|
||||
{
|
||||
type = VarType::LengthSpline;
|
||||
this->name = path->name();
|
||||
this->value = qApp->fromPixel(path->GetLength());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthSpline::VLengthSpline(const VLengthSpline &var)
|
||||
:VInternalVariable(var), id(var.GetId())
|
||||
:VLengthCurve(var)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -66,17 +66,10 @@ VLengthSpline &VLengthSpline::operator=(const VLengthSpline &var)
|
|||
{
|
||||
return *this;
|
||||
}
|
||||
VInternalVariable::operator=(var);
|
||||
this->id = var.GetId();
|
||||
VLengthCurve::operator=(var);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLengthSpline::~VLengthSpline()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VLengthSpline::Filter(quint32 id)
|
||||
{
|
||||
return this->id == id;
|
||||
}
|
||||
|
|
|
@ -29,30 +29,19 @@
|
|||
#ifndef VLENGTHSPLINES_H
|
||||
#define VLENGTHSPLINES_H
|
||||
|
||||
#include "vinternalvariable.h"
|
||||
#include "vlengthcurve.h"
|
||||
|
||||
class VAbstractCurve;
|
||||
|
||||
class VLengthSpline :public VInternalVariable
|
||||
class VLengthSpline :public VLengthCurve
|
||||
{
|
||||
public:
|
||||
VLengthSpline();
|
||||
VLengthSpline(const quint32 &id, const QString &name, const qreal &value);
|
||||
VLengthSpline(const quint32 &id, const VAbstractCurve *path);
|
||||
VLengthSpline(const quint32 &id, const quint32 &parentId, const QString &name, const qreal &value);
|
||||
VLengthSpline(const quint32 &id, const quint32 &parentId, const VAbstractCurve *path);
|
||||
VLengthSpline(const VLengthSpline &var);
|
||||
VLengthSpline &operator=(const VLengthSpline &var);
|
||||
virtual ~VLengthSpline();
|
||||
|
||||
virtual bool Filter(quint32 id);
|
||||
quint32 GetId() const;
|
||||
private:
|
||||
quint32 id;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline quint32 VLengthSpline::GetId() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
#endif // VLENGTHSPLINES_H
|
||||
|
|
|
@ -140,12 +140,12 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(arc);
|
||||
data->AddLengthArc(id);
|
||||
data->AddCurveLength<VLengthArc>(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, arc);
|
||||
data->AddLengthArc(id);
|
||||
data->AddCurveLength<VLengthArc>(id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -142,8 +142,8 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
arc1id = data->AddGObject(new VArc(arc1));
|
||||
arc2id = data->AddGObject(new VArc(arc2));
|
||||
|
||||
data->AddLengthArc(arc1id);
|
||||
data->AddLengthArc(arc2id);
|
||||
data->AddCurveLength<VLengthArc>(arc1id, id);
|
||||
data->AddCurveLength<VLengthArc>(arc2id, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -155,8 +155,8 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
data->UpdateGObject(arc1id, new VArc(arc1));
|
||||
data->UpdateGObject(arc2id, new VArc(arc2));
|
||||
|
||||
data->AddLengthArc(arc1id);
|
||||
data->AddLengthArc(arc2id);
|
||||
data->AddCurveLength<VLengthArc>(arc1id, id);
|
||||
data->AddCurveLength<VLengthArc>(arc2id, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
|
|
@ -136,11 +136,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString
|
|||
|
||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||
spl1id = data->AddGObject(spline1);
|
||||
data->AddVariable(spline1->name(), new VLengthSpline(id, spline1));
|
||||
data->AddCurveLength<VLengthSpline>(spl1id, id);
|
||||
|
||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||
spl2id = data->AddGObject(spline2);
|
||||
data->AddVariable(spline2->name(), new VLengthSpline(id, spline2));
|
||||
data->AddCurveLength<VLengthSpline>(spl2id, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -152,11 +152,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString
|
|||
|
||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||
data->UpdateGObject(spl1id, spline1);
|
||||
data->AddVariable(spline1->name(), new VLengthSpline(id, spline1));
|
||||
data->AddCurveLength<VLengthSpline>(spl1id, id);
|
||||
|
||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||
data->UpdateGObject(spl2id, spline2);
|
||||
data->AddVariable(spline2->name(), new VLengthSpline(id, spline2));
|
||||
data->AddCurveLength<VLengthSpline>(spl2id, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
|
|
@ -198,18 +198,18 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
splPath1id = data->AddGObject(splPath1);
|
||||
data->AddVariable(splPath1->name(), new VLengthSpline(splPath1id, splPath1));
|
||||
data->AddCurveLength<VLengthSpline>(splPath1id, id);
|
||||
|
||||
splPath2id = data->AddGObject(splPath2);
|
||||
data->AddVariable(splPath2->name(), new VLengthSpline(splPath2id, splPath2));
|
||||
data->AddCurveLength<VLengthSpline>(splPath2id, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(splPath1id, splPath1);
|
||||
data->AddVariable(splPath1->name(), new VLengthSpline(splPath1id, splPath1));
|
||||
data->AddCurveLength<VLengthSpline>(splPath1id, id);
|
||||
|
||||
data->UpdateGObject(splPath2id, splPath2);
|
||||
data->AddVariable(splPath2->name(), new VLengthSpline(splPath2id, splPath2));
|
||||
data->AddCurveLength<VLengthSpline>(splPath2id, id);
|
||||
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
|
|
|
@ -154,12 +154,12 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(spline);
|
||||
data->AddVariable(spline->name(), new VLengthSpline(id, spline));
|
||||
data->AddCurveLength<VLengthSpline>(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, spline);
|
||||
data->AddVariable(spline->name(), new VLengthSpline(id, spline));
|
||||
data->AddCurveLength<VLengthSpline>(id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -136,12 +136,12 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
|
|||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(path);
|
||||
data->AddVariable(path->name(), new VLengthSpline(id, path));
|
||||
data->AddCurveLength<VLengthSpline>(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, path);
|
||||
data->AddVariable(path->name(), new VLengthSpline(id, path));
|
||||
data->AddCurveLength<VLengthSpline>(id);
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
|
|
|
@ -36,6 +36,7 @@ VisToolCutArc::VisToolCutArc(const VContainer *data, QGraphicsItem *parent)
|
|||
{
|
||||
point = InitPoint(mainColor, this);
|
||||
point->setZValue(2);
|
||||
point->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user