Store information about object's id that created internal variable.
--HG-- branch : develop
This commit is contained in:
parent
13d369f560
commit
484f149929
|
@ -154,23 +154,23 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
num +=2;
|
num +=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QHash<QString, qreal> *lengthLines = data->DataLengthLines();
|
const QMap<QString, qreal> lengthLines = data->DataLengthLines();
|
||||||
num += lengthLines->size();
|
num += lengthLines.size();
|
||||||
|
|
||||||
const QHash<QString, qreal> *lengthSplines = data->DataLengthSplines();
|
const QMap<QString, qreal> lengthSplines = data->DataLengthSplines();
|
||||||
num += lengthSplines->size();
|
num += lengthSplines.size();
|
||||||
|
|
||||||
const QHash<QString, qreal> *lengthArcs = data->DataLengthArcs();
|
const QMap<QString, qreal> lengthArcs = data->DataLengthArcs();
|
||||||
num += lengthArcs->size();
|
num += lengthArcs.size();
|
||||||
|
|
||||||
const QHash<QString, qreal> *lineAngles = data->DataLineAngles();
|
const QMap<QString, qreal> lineAngles = data->DataLineAngles();
|
||||||
num += lineAngles->size();
|
num += lineAngles.size();
|
||||||
|
|
||||||
const QHash<QString, VMeasurement> *measurements = data->DataMeasurements();
|
const QMap<QString, VMeasurement*> measurements = data->DataMeasurements();
|
||||||
num += measurements->size();
|
num += measurements.size();
|
||||||
|
|
||||||
const QHash<QString, VIncrement> *increments = data->DataIncrements();
|
const QMap<QString, VIncrement*> increments = data->DataIncrements();
|
||||||
num += increments->size();
|
num += increments.size();
|
||||||
|
|
||||||
vVarVal = new qreal[num];
|
vVarVal = new qreal[num];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -187,8 +187,8 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QHash<QString, qreal>::const_iterator i = lengthLines->constBegin();
|
QMap<QString, qreal>::const_iterator i = lengthLines.constBegin();
|
||||||
while (i != lengthLines->constEnd())
|
while (i != lengthLines.constEnd())
|
||||||
{
|
{
|
||||||
vVarVal[j] = i.value();
|
vVarVal[j] = i.value();
|
||||||
DefineVar(i.key(), &vVarVal[j]);
|
DefineVar(i.key(), &vVarVal[j]);
|
||||||
|
@ -198,8 +198,8 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QHash<QString, qreal>::const_iterator i = lengthSplines->constBegin();
|
QMap<QString, qreal>::const_iterator i = lengthSplines.constBegin();
|
||||||
while (i != lengthSplines->constEnd())
|
while (i != lengthSplines.constEnd())
|
||||||
{
|
{
|
||||||
vVarVal[j] = i.value();
|
vVarVal[j] = i.value();
|
||||||
DefineVar(i.key(), &vVarVal[j]);
|
DefineVar(i.key(), &vVarVal[j]);
|
||||||
|
@ -209,8 +209,8 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QHash<QString, qreal>::const_iterator i = lengthArcs->constBegin();
|
QMap<QString, qreal>::const_iterator i = lengthArcs.constBegin();
|
||||||
while (i != lengthArcs->constEnd())
|
while (i != lengthArcs.constEnd())
|
||||||
{
|
{
|
||||||
vVarVal[j] = i.value();
|
vVarVal[j] = i.value();
|
||||||
DefineVar(i.key(), &vVarVal[j]);
|
DefineVar(i.key(), &vVarVal[j]);
|
||||||
|
@ -220,8 +220,8 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QHash<QString, qreal>::const_iterator i = lineAngles->constBegin();
|
QMap<QString, qreal>::const_iterator i = lineAngles.constBegin();
|
||||||
while (i != lineAngles->constEnd())
|
while (i != lineAngles.constEnd())
|
||||||
{
|
{
|
||||||
vVarVal[j] = i.value();
|
vVarVal[j] = i.value();
|
||||||
DefineVar(i.key(), &vVarVal[j]);
|
DefineVar(i.key(), &vVarVal[j]);
|
||||||
|
@ -231,17 +231,15 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QHash<QString, VMeasurement>::const_iterator i = measurements->constBegin();
|
QMap<QString, VMeasurement*>::const_iterator i = measurements.constBegin();
|
||||||
while (i != measurements->constEnd())
|
while (i != measurements.constEnd())
|
||||||
{
|
{
|
||||||
|
VMeasurement *m = i.value();
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
vVarVal[j] = i.value().GetValue(data->size(), data->height());
|
m->SetValue(data->size(), data->height());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vVarVal[j] = i.value().GetValue();
|
|
||||||
}
|
}
|
||||||
|
vVarVal[j] = *m->GetValue();
|
||||||
DefineVar(i.key(), &vVarVal[j]);
|
DefineVar(i.key(), &vVarVal[j]);
|
||||||
++j;
|
++j;
|
||||||
++i;
|
++i;
|
||||||
|
@ -249,17 +247,15 @@ void Calculator::InitVariables(const VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QHash<QString, VIncrement>::const_iterator i = increments->constBegin();
|
QMap<QString, VIncrement*>::const_iterator i = increments.constBegin();
|
||||||
while (i != increments->constEnd())
|
while (i != increments.constEnd())
|
||||||
{
|
{
|
||||||
|
VIncrement *incr = i.value();
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
vVarVal[j] = i.value().GetValue(data->size(), data->height());
|
incr->SetValue(data->size(), data->height());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vVarVal[j] = i.value().GetValue();
|
|
||||||
}
|
}
|
||||||
|
vVarVal[j] = *incr->GetValue();
|
||||||
DefineVar(i.key(), &vVarVal[j]);
|
DefineVar(i.key(), &vVarVal[j]);
|
||||||
++j;
|
++j;
|
||||||
++i;
|
++i;
|
||||||
|
|
|
@ -3,11 +3,22 @@ SOURCES += \
|
||||||
container/calculator.cpp \
|
container/calculator.cpp \
|
||||||
container/vmeasurement.cpp \
|
container/vmeasurement.cpp \
|
||||||
container/vincrement.cpp \
|
container/vincrement.cpp \
|
||||||
container/vvariable.cpp
|
container/vvariable.cpp \
|
||||||
|
container/vinternalvariable.cpp \
|
||||||
|
container/vlengthline.cpp \
|
||||||
|
container/vlengthspline.cpp \
|
||||||
|
container/vlengtharc.cpp \
|
||||||
|
container/vlineangle.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
container/vcontainer.h \
|
container/vcontainer.h \
|
||||||
container/calculator.h \
|
container/calculator.h \
|
||||||
container/vmeasurement.h \
|
container/vmeasurement.h \
|
||||||
container/vincrement.h \
|
container/vincrement.h \
|
||||||
container/vvariable.h
|
container/vvariable.h \
|
||||||
|
container/vinternalvariable.h \
|
||||||
|
container/vlengthline.h \
|
||||||
|
container/vlengthspline.h \
|
||||||
|
container/vlengtharc.h \
|
||||||
|
container/vlineangle.h \
|
||||||
|
container/variables.h
|
||||||
|
|
40
src/app/container/variables.h
Normal file
40
src/app/container/variables.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file variables.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 VARIABLES_H
|
||||||
|
#define VARIABLES_H
|
||||||
|
|
||||||
|
#include "vinternalvariable.h"
|
||||||
|
#include "vmeasurement.h"
|
||||||
|
#include "vincrement.h"
|
||||||
|
#include "vlengtharc.h"
|
||||||
|
#include "vlengthline.h"
|
||||||
|
#include "vlengthspline.h"
|
||||||
|
#include "vlineangle.h"
|
||||||
|
|
||||||
|
#endif // VARIABLES_H
|
|
@ -41,11 +41,11 @@ quint32 VContainer::_id = 0;
|
||||||
* @brief VContainer create empty container
|
* @brief VContainer create empty container
|
||||||
*/
|
*/
|
||||||
VContainer::VContainer()
|
VContainer::VContainer()
|
||||||
:_size(50), sizeName(size_M), _height(176), heightName(height_M), gObjects(QHash<quint32, VGObject *>()),
|
:_size(50), sizeName(size_M), _height(176), heightName(height_M),
|
||||||
measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
|
gObjects(QHash<quint32, VGObject *>()), variables(QHash<QString, VInternalVariable*> ()),
|
||||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
details(QHash<quint32, VDetail>())
|
||||||
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
|
{
|
||||||
{}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -69,10 +69,9 @@ VContainer &VContainer::operator =(const VContainer &data)
|
||||||
* @param data container
|
* @param data container
|
||||||
*/
|
*/
|
||||||
VContainer::VContainer(const VContainer &data)
|
VContainer::VContainer(const VContainer &data)
|
||||||
:_size(50), sizeName(size_M), _height(176), heightName(height_M), gObjects(QHash<quint32, VGObject *>()),
|
:_size(50), sizeName(size_M), _height(176), heightName(height_M),
|
||||||
measurements(QHash<QString, VMeasurement>()), increments(QHash<QString, VIncrement>()),
|
gObjects(QHash<quint32, VGObject *>()), variables(QHash<QString, VInternalVariable*> ()),
|
||||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
details(QHash<quint32, VDetail>())
|
||||||
lengthArcs(QHash<QString, qreal>()), details(QHash<quint32, VDetail>())
|
|
||||||
{
|
{
|
||||||
setData(data);
|
setData(data);
|
||||||
}
|
}
|
||||||
|
@ -80,8 +79,8 @@ VContainer::VContainer(const VContainer &data)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer::~VContainer()
|
VContainer::~VContainer()
|
||||||
{
|
{
|
||||||
qDeleteAll(gObjects);
|
ClearGObjects();
|
||||||
gObjects.clear();
|
ClearVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -95,9 +94,8 @@ void VContainer::setData(const VContainer &data)
|
||||||
sizeName = data.SizeName();
|
sizeName = data.SizeName();
|
||||||
_height = data.height();
|
_height = data.height();
|
||||||
heightName = data.HeightName();
|
heightName = data.HeightName();
|
||||||
|
{
|
||||||
qDeleteAll(gObjects);
|
ClearGObjects();
|
||||||
gObjects.clear();
|
|
||||||
const QHash<quint32, VGObject*> *obj = data.DataGObjects();
|
const QHash<quint32, VGObject*> *obj = data.DataGObjects();
|
||||||
SCASSERT(obj != nullptr);
|
SCASSERT(obj != nullptr);
|
||||||
QHashIterator<quint32, VGObject*> i(*obj);
|
QHashIterator<quint32, VGObject*> i(*obj);
|
||||||
|
@ -123,12 +121,44 @@ void VContainer::setData(const VContainer &data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
measurements = *data.DataMeasurements();
|
}
|
||||||
increments = *data.DataIncrements();
|
|
||||||
lengthLines = *data.DataLengthLines();
|
{
|
||||||
lineAngles = *data.DataLineAngles();
|
ClearVariables();
|
||||||
lengthSplines = *data.DataLengthSplines();
|
const QHash<QString, VInternalVariable*> *vars = data.DataVariables();
|
||||||
lengthArcs = *data.DataLengthArcs();
|
SCASSERT(vars != nullptr);
|
||||||
|
QHashIterator<QString, VInternalVariable*> i(*vars);
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
i.next();
|
||||||
|
switch (i.value()->GetType())
|
||||||
|
{
|
||||||
|
case (VarType::Measurement):
|
||||||
|
CopyVar<VMeasurement>(data, i.key());
|
||||||
|
break;
|
||||||
|
case (VarType::Increment):
|
||||||
|
CopyVar<VIncrement>(data, i.key());
|
||||||
|
break;
|
||||||
|
case (VarType::LengthLine):
|
||||||
|
CopyVar<VLengthLine>(data, i.key());
|
||||||
|
break;
|
||||||
|
case (VarType::LengthSpline):
|
||||||
|
CopyVar<VLengthSpline>(data, i.key());
|
||||||
|
break;
|
||||||
|
case (VarType::LengthArc):
|
||||||
|
CopyVar<VLengthArc>(data, i.key());
|
||||||
|
break;
|
||||||
|
case (VarType::LineAngle):
|
||||||
|
CopyVar<VLineAngle>(data, i.key());
|
||||||
|
break;
|
||||||
|
case (VarType::Unknown):
|
||||||
|
default:
|
||||||
|
qDebug()<<"Don't know how copy this type.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
details = *data.DataDetails();
|
details = *data.DataDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,98 +194,6 @@ const val VContainer::GetObject(const QHash<key, val> &obj, key id) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetObject return object from container
|
|
||||||
* @param obj container
|
|
||||||
* @param id id of object
|
|
||||||
* @return Object
|
|
||||||
*/
|
|
||||||
template <typename key, typename val>
|
|
||||||
val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
|
|
||||||
{
|
|
||||||
if (obj.contains(id))
|
|
||||||
{
|
|
||||||
return obj.value(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw VExceptionBadId(tr("Can't find object"), id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetMeasurement return measurement by name
|
|
||||||
* @param name short measurement name
|
|
||||||
* @return measurement
|
|
||||||
*/
|
|
||||||
const VMeasurement VContainer::GetMeasurement(const QString &name) const
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty()==false);
|
|
||||||
return GetVariable(measurements, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetIncrement return increment table row by name
|
|
||||||
* @param name name of increment table row
|
|
||||||
* @return increment
|
|
||||||
*/
|
|
||||||
const VIncrement VContainer::GetIncrement(const QString& name) const
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty()==false);
|
|
||||||
return GetVariable(increments, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetLine return length of line by name
|
|
||||||
* @param name name of line
|
|
||||||
* @return length of line in mm
|
|
||||||
*/
|
|
||||||
qreal VContainer::GetLine(const QString &name) const
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty()==false);
|
|
||||||
return GetVariable(lengthLines, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetLengthArc return length of arc by name
|
|
||||||
* @param name name of arc
|
|
||||||
* @return length of arc in mm
|
|
||||||
*/
|
|
||||||
qreal VContainer::GetLengthArc(const QString &name) const
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty()==false);
|
|
||||||
return GetVariable(lengthArcs, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetLengthSpline return length of spline by name
|
|
||||||
* @param name name of spline
|
|
||||||
* @return length of spline in mm
|
|
||||||
*/
|
|
||||||
qreal VContainer::GetLengthSpline(const QString &name) const
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty()==false);
|
|
||||||
return GetVariable(lengthSplines, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetLineAngle return angle of line
|
|
||||||
* @param name name of line angle
|
|
||||||
* @return angle in degree
|
|
||||||
*/
|
|
||||||
qreal VContainer::GetLineAngle(const QString &name) const
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty()==false);
|
|
||||||
return GetVariable(lineAngles, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief GetDetail return detail by id
|
* @brief GetDetail return detail by id
|
||||||
|
@ -264,7 +202,14 @@ qreal VContainer::GetLineAngle(const QString &name) const
|
||||||
*/
|
*/
|
||||||
const VDetail VContainer::GetDetail(quint32 id) const
|
const VDetail VContainer::GetDetail(quint32 id) const
|
||||||
{
|
{
|
||||||
return GetVariable(details, id);
|
if (details.contains(id))
|
||||||
|
{
|
||||||
|
return details.value(id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't find object"), id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -291,17 +236,6 @@ quint32 VContainer::AddDetail(VDetail detail)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief AddIncrement add new increment
|
|
||||||
* @param name increment name
|
|
||||||
* @param incr increment
|
|
||||||
*/
|
|
||||||
void VContainer::AddIncrement(const QString &name, VIncrement incr)
|
|
||||||
{
|
|
||||||
increments[name] = incr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief getNextId generate next unique id
|
* @brief getNextId generate next unique id
|
||||||
|
@ -348,18 +282,6 @@ void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val p
|
||||||
UpdateId(id);
|
UpdateId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief AddLengthSpline add length of spline to container
|
|
||||||
* @param name name of spline
|
|
||||||
* @param value length of spline
|
|
||||||
*/
|
|
||||||
void VContainer::AddLengthSpline(const QString &name, const qreal &value)
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty() == false);
|
|
||||||
lengthSplines[name] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddLengthArc add length of arc to container
|
* @brief AddLengthArc add length of arc to container
|
||||||
|
@ -368,57 +290,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value)
|
||||||
void VContainer::AddLengthArc(const quint32 &id)
|
void VContainer::AddLengthArc(const quint32 &id)
|
||||||
{
|
{
|
||||||
const VArc * arc = GeometricObject<const VArc *>(id);
|
const VArc * arc = GeometricObject<const VArc *>(id);
|
||||||
lengthArcs[arc->name()] = qApp->fromPixel(arc->GetLength());
|
AddVariable(arc->name(), new VLengthArc(id, arc));
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief AddLineAngle add angle of line to container
|
|
||||||
* @param name name of line angle
|
|
||||||
* @param value angle in degree
|
|
||||||
*/
|
|
||||||
void VContainer::AddLineAngle(const QString &name, const qreal &value)
|
|
||||||
{
|
|
||||||
SCASSERT(name.isEmpty() == false);
|
|
||||||
lineAngles[name] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetValueStandardTableRow return value of measurement by name
|
|
||||||
* @param name name of measurement
|
|
||||||
* @return value in measurement units
|
|
||||||
*/
|
|
||||||
qreal VContainer::GetValueStandardTableRow(const QString& name) const
|
|
||||||
{
|
|
||||||
const VMeasurement m = GetMeasurement(name);
|
|
||||||
if (qApp->patternType() == MeasurementsType::Individual)
|
|
||||||
{
|
|
||||||
return m.GetValue();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return m.GetValue(size(), height());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetValueIncrementTableRow return value of increment table row by name
|
|
||||||
* @param name name of row
|
|
||||||
* @return value of row in mm
|
|
||||||
*/
|
|
||||||
qreal VContainer::GetValueIncrementTableRow(const QString& name) const
|
|
||||||
{
|
|
||||||
const VIncrement icr = GetIncrement(name);
|
|
||||||
if (qApp->patternType() == MeasurementsType::Individual)
|
|
||||||
{
|
|
||||||
return icr.GetValue();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return icr.GetValue(size(), height());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -428,13 +300,9 @@ qreal VContainer::GetValueIncrementTableRow(const QString& name) const
|
||||||
void VContainer::Clear()
|
void VContainer::Clear()
|
||||||
{
|
{
|
||||||
_id = 0;
|
_id = 0;
|
||||||
measurements.clear();
|
|
||||||
increments.clear();
|
|
||||||
lengthLines.clear();
|
|
||||||
lengthArcs.clear();
|
|
||||||
lineAngles.clear();
|
|
||||||
details.clear();
|
details.clear();
|
||||||
lengthSplines.clear();
|
ClearVariables();
|
||||||
ClearGObjects();
|
ClearGObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,10 +312,7 @@ void VContainer::Clear()
|
||||||
*/
|
*/
|
||||||
void VContainer::ClearGObjects()
|
void VContainer::ClearGObjects()
|
||||||
{
|
{
|
||||||
if (gObjects.size()>0)
|
|
||||||
{
|
|
||||||
qDeleteAll(gObjects);
|
qDeleteAll(gObjects);
|
||||||
}
|
|
||||||
gObjects.clear();
|
gObjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,6 +334,32 @@ void VContainer::ClearCalculationGObjects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VContainer::ClearVariables(const VarType &type)
|
||||||
|
{
|
||||||
|
if (variables.size()>0)
|
||||||
|
{
|
||||||
|
if (type == VarType::Unknown)
|
||||||
|
{
|
||||||
|
qDeleteAll(variables);
|
||||||
|
variables.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QHashIterator<QString, VInternalVariable*> i(variables);
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
i.next();
|
||||||
|
if (i.value()->GetType() == type)
|
||||||
|
{
|
||||||
|
delete i.value();
|
||||||
|
variables.remove(i.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddLine add line to container
|
* @brief AddLine add line to container
|
||||||
|
@ -477,12 +368,14 @@ void VContainer::ClearCalculationGObjects()
|
||||||
*/
|
*/
|
||||||
void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
|
void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
|
||||||
{
|
{
|
||||||
QString nameLine = GetNameLine(firstPointId, secondPointId);
|
|
||||||
const VPointF *first = GeometricObject<const VPointF *>(firstPointId);
|
const VPointF *first = GeometricObject<const VPointF *>(firstPointId);
|
||||||
const VPointF *second = GeometricObject<const VPointF *>(secondPointId);
|
const VPointF *second = GeometricObject<const VPointF *>(secondPointId);
|
||||||
AddLengthLine(nameLine, qApp->fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length()));
|
|
||||||
nameLine = GetNameLineAngle(firstPointId, secondPointId);
|
VLengthLine *length = new VLengthLine(first, firstPointId, second, secondPointId);
|
||||||
AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle());
|
AddVariable(length->GetName(), length);
|
||||||
|
|
||||||
|
VLineAngle *angle = new VLineAngle(first, firstPointId, second, secondPointId);
|
||||||
|
AddVariable(angle->GetName(), angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -502,36 +395,6 @@ quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetNameLine return name of line
|
|
||||||
* @param firstPoint id of first point of line
|
|
||||||
* @param secondPoint id of second point of line
|
|
||||||
* @return name of line
|
|
||||||
*/
|
|
||||||
QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const
|
|
||||||
{
|
|
||||||
const VPointF *first = GeometricObject<const VPointF *>(firstPoint);
|
|
||||||
const VPointF *second = GeometricObject<const VPointF *>(secondPoint);
|
|
||||||
|
|
||||||
return QString(line_+"%1_%2").arg(first->name(), second->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief GetNameLineAngle return name of line angle
|
|
||||||
* @param firstPoint id of first point of line
|
|
||||||
* @param secondPoint id of second point of line
|
|
||||||
* @return name of angle of line
|
|
||||||
*/
|
|
||||||
QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const
|
|
||||||
{
|
|
||||||
const VPointF *first = GeometricObject<const VPointF *>(firstPoint);
|
|
||||||
const VPointF *second = GeometricObject<const VPointF *>(secondPoint);
|
|
||||||
|
|
||||||
return QString(angleLine_+"%1_%2").arg(first->name(), second->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief UpdateGObject update GObject by id
|
* @brief UpdateGObject update GObject by id
|
||||||
|
@ -558,13 +421,122 @@ void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
qreal VContainer::GetTableValue(const QString &name) const
|
||||||
* @brief AddLengthLine add length of line to container
|
|
||||||
* @param name name of line
|
|
||||||
* @param value length of line
|
|
||||||
*/
|
|
||||||
void VContainer::AddLengthLine(const QString &name, const qreal &value)
|
|
||||||
{
|
{
|
||||||
SCASSERT(name.isEmpty() == false);
|
VVariable *m = GetVariable<VVariable*>(name);
|
||||||
lengthLines[name] = value;
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
|
{
|
||||||
|
m->SetValue(size(), height());
|
||||||
|
}
|
||||||
|
return *m->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief RemoveIncrement remove increment by name from increment table
|
||||||
|
* @param name name of existing increment
|
||||||
|
*/
|
||||||
|
void VContainer::RemoveIncrement(const QString &name)
|
||||||
|
{
|
||||||
|
delete variables.value(name);
|
||||||
|
variables.remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QMap<QString, VMeasurement*> VContainer::DataMeasurements() const
|
||||||
|
{
|
||||||
|
return DataTableVar<VMeasurement>(VarType::Measurement);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QMap<QString, VIncrement *> VContainer::DataIncrements() const
|
||||||
|
{
|
||||||
|
return DataTableVar<VIncrement>(VarType::Increment);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QMap<QString, qreal> VContainer::DataLengthLines() const
|
||||||
|
{
|
||||||
|
return DataVar(VarType::LengthLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QMap<QString, qreal> VContainer::DataLengthSplines() const
|
||||||
|
{
|
||||||
|
return DataVar(VarType::LengthSpline);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QMap<QString, qreal> VContainer::DataLengthArcs() const
|
||||||
|
{
|
||||||
|
return DataVar(VarType::LengthArc);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QMap<QString, qreal> VContainer::DataLineAngles() const
|
||||||
|
{
|
||||||
|
return DataVar(VarType::LineAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief IncrementTableContains check if increment table contains name
|
||||||
|
* @param name name of row
|
||||||
|
* @return true if contains
|
||||||
|
*/
|
||||||
|
bool VContainer::IncrementExist(const QString &name)
|
||||||
|
{
|
||||||
|
return variables.contains(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
void VContainer::CopyGObject(const VContainer &data, const quint32 &id)
|
||||||
|
{
|
||||||
|
T *obj = new T(*data.GeometricObject<const T *>(id));
|
||||||
|
UpdateGObject(id, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
void VContainer::CopyVar(const VContainer &data, const QString &name)
|
||||||
|
{
|
||||||
|
T *var = new T(*data.GetVariable<T*>(name));
|
||||||
|
AddVariable(name, var);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMap<QString, qreal> VContainer::DataVar(const VarType &type) const
|
||||||
|
{
|
||||||
|
QHashIterator<QString, VInternalVariable*> i(variables);
|
||||||
|
QMap<QString, qreal> map;
|
||||||
|
//Sorting QHash by id
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
i.next();
|
||||||
|
if(i.value()->GetType() == type)
|
||||||
|
{
|
||||||
|
map.insert(qApp->VarToUser(i.key()), *i.value()->GetValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
const QMap<QString, T *> VContainer::DataTableVar(const VarType &type) const
|
||||||
|
{
|
||||||
|
QHashIterator<QString, VInternalVariable*> i(variables);
|
||||||
|
QMap<QString, T*> map;
|
||||||
|
//Sorting QHash by id
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
i.next();
|
||||||
|
if(i.value()->GetType() == type)
|
||||||
|
{
|
||||||
|
T *var = GetVariable<T *>(i.key());
|
||||||
|
map.insert(qApp->VarToUser(i.key()), var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
#ifndef VCONTAINER_H
|
#ifndef VCONTAINER_H
|
||||||
#define VCONTAINER_H
|
#define VCONTAINER_H
|
||||||
|
|
||||||
#include "vmeasurement.h"
|
#include "variables.h"
|
||||||
#include "vincrement.h"
|
|
||||||
#include "../geometry/vdetail.h"
|
#include "../geometry/vdetail.h"
|
||||||
#include "../geometry/vgobject.h"
|
#include "../geometry/vgobject.h"
|
||||||
#include "../exception/vexceptionbadid.h"
|
#include "../exception/vexceptionbadid.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
|
@ -48,13 +48,9 @@ public:
|
||||||
VContainer &operator=(const VContainer &data);
|
VContainer &operator=(const VContainer &data);
|
||||||
VContainer(const VContainer &data);
|
VContainer(const VContainer &data);
|
||||||
~VContainer();
|
~VContainer();
|
||||||
template <typename T>
|
|
||||||
void CopyGObject(const VContainer &data, const quint32 &id)
|
|
||||||
{
|
|
||||||
T *obj = new T(*data.GeometricObject<const T *>(id));
|
|
||||||
UpdateGObject(id, obj);
|
|
||||||
}
|
|
||||||
void setData(const VContainer &data);
|
void setData(const VContainer &data);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T GeometricObject(const quint32 &id) const
|
const T GeometricObject(const quint32 &id) const
|
||||||
{
|
{
|
||||||
|
@ -84,43 +80,79 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const VGObject *GetGObject(quint32 id) const;
|
const VGObject *GetGObject(quint32 id) const;
|
||||||
const VMeasurement GetMeasurement(const QString& name) const;
|
|
||||||
const VIncrement GetIncrement(const QString& name) const;
|
|
||||||
qreal GetLine(const QString &name) const;
|
|
||||||
qreal GetLengthArc(const QString &name) const;
|
|
||||||
qreal GetLengthSpline(const QString &name) const;
|
|
||||||
qreal GetLineAngle(const QString &name) const;
|
|
||||||
const VDetail GetDetail(quint32 id) const;
|
const VDetail GetDetail(quint32 id) const;
|
||||||
|
qreal GetTableValue(const QString& name) const;
|
||||||
|
template <typename T>
|
||||||
|
/**
|
||||||
|
* @brief GetVariable return varible by name
|
||||||
|
* @param name variable's name
|
||||||
|
* @return variable
|
||||||
|
*/
|
||||||
|
T GetVariable(QString name) const
|
||||||
|
{
|
||||||
|
SCASSERT(name.isEmpty()==false);
|
||||||
|
if (variables.contains(name))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
T value = dynamic_cast<T>(variables.value(name));
|
||||||
|
SCASSERT(value != nullptr);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
catch (const std::bad_alloc &)
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't cast object"), name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't find object"), name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static quint32 getId(){return _id;}
|
static quint32 getId(){return _id;}
|
||||||
|
static quint32 getNextId();
|
||||||
|
static void UpdateId(quint32 newId);
|
||||||
|
|
||||||
quint32 AddGObject(VGObject *obj);
|
quint32 AddGObject(VGObject *obj);
|
||||||
quint32 AddDetail(VDetail detail);
|
quint32 AddDetail(VDetail detail);
|
||||||
void AddMeasurement(const QString& name, const VMeasurement &m);
|
|
||||||
void AddIncrement(const QString& name, VIncrement incr);
|
|
||||||
void AddLengthLine(const QString &name, const qreal &value);
|
|
||||||
void AddLengthSpline(const QString &name, const qreal &value);
|
|
||||||
void AddLengthArc(const quint32 &id);
|
void AddLengthArc(const quint32 &id);
|
||||||
void AddLineAngle(const QString &name, const qreal &value);
|
|
||||||
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId);
|
||||||
// cppcheck-suppress functionStatic
|
|
||||||
QString GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const;
|
template <typename T>
|
||||||
// cppcheck-suppress functionStatic
|
void AddVariable(const QString& name, T var)
|
||||||
QString GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const;
|
{
|
||||||
|
if(variables.contains(name))
|
||||||
|
{
|
||||||
|
if(variables.value(name)->GetType() == var->GetType())
|
||||||
|
{
|
||||||
|
T v = dynamic_cast<T>(variables.value(name));
|
||||||
|
SCASSERT(v != nullptr);
|
||||||
|
*v = *var;
|
||||||
|
delete var;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw VExceptionBadId(tr("Can't find object. Type mismatch."), name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
variables[name] = var;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateGObject(quint32 id, VGObject* obj);
|
void UpdateGObject(quint32 id, VGObject* obj);
|
||||||
void UpdateDetail(quint32 id, const VDetail &detail);
|
void UpdateDetail(quint32 id, const VDetail &detail);
|
||||||
void UpdateMeasurement(const QString& name, VMeasurement m);
|
|
||||||
void UpdateIncrement(const QString& name, VIncrement incr);
|
|
||||||
qreal GetValueStandardTableRow(const QString& name) const;
|
|
||||||
qreal GetValueIncrementTableRow(const QString& name) const;
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void ClearGObjects();
|
void ClearGObjects();
|
||||||
void ClearCalculationGObjects();
|
void ClearCalculationGObjects();
|
||||||
void ClearIncrementTable();
|
void ClearVariables(const VarType &type = VarType::Unknown);
|
||||||
void ClearMeasurements();
|
|
||||||
void ClearLengthLines();
|
|
||||||
void ClearLengthSplines();
|
|
||||||
void ClearLengthArcs();
|
|
||||||
void ClearLineAngles();
|
|
||||||
void ClearDetails();
|
void ClearDetails();
|
||||||
|
|
||||||
void SetSize(qreal size);
|
void SetSize(qreal size);
|
||||||
void SetSizeName(const QString &name);
|
void SetSizeName(const QString &name);
|
||||||
void SetHeight(qreal height);
|
void SetHeight(qreal height);
|
||||||
|
@ -129,18 +161,23 @@ public:
|
||||||
QString SizeName()const;
|
QString SizeName()const;
|
||||||
qreal height() const;
|
qreal height() const;
|
||||||
QString HeightName()const;
|
QString HeightName()const;
|
||||||
bool IncrementTableContains(const QString& name);
|
|
||||||
static quint32 getNextId();
|
bool IncrementExist(const QString& name);
|
||||||
void RemoveIncrementTableRow(const QString& name);
|
|
||||||
static void UpdateId(quint32 newId);
|
void RemoveIncrement(const QString& name);
|
||||||
|
|
||||||
const QHash<quint32, VGObject*> *DataGObjects() const;
|
const QHash<quint32, VGObject*> *DataGObjects() const;
|
||||||
const QHash<QString, VMeasurement> *DataMeasurements() const;
|
|
||||||
const QHash<QString, VIncrement> *DataIncrements() const;
|
|
||||||
const QHash<QString, qreal> *DataLengthLines() const;
|
|
||||||
const QHash<QString, qreal> *DataLengthSplines() const;
|
|
||||||
const QHash<QString, qreal> *DataLengthArcs() const;
|
|
||||||
const QHash<QString, qreal> *DataLineAngles() const;
|
|
||||||
const QHash<quint32, VDetail> *DataDetails() const;
|
const QHash<quint32, VDetail> *DataDetails() const;
|
||||||
|
const QHash<QString, VInternalVariable*> *DataVariables() const;
|
||||||
|
|
||||||
|
const QMap<QString, VMeasurement *> DataMeasurements() const;
|
||||||
|
const QMap<QString, VIncrement *> DataIncrements() const;
|
||||||
|
const QMap<QString, qreal> DataLengthLines() const;
|
||||||
|
const QMap<QString, qreal> DataLengthSplines() const;
|
||||||
|
const QMap<QString, qreal> DataLengthArcs() const;
|
||||||
|
const QMap<QString, qreal> DataLineAngles() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief _id current id. New object will have value +1. For empty class equal 0.
|
* @brief _id current id. New object will have value +1. For empty class equal 0.
|
||||||
|
@ -154,30 +191,11 @@ private:
|
||||||
* @brief gObjects graphicals objects of pattern.
|
* @brief gObjects graphicals objects of pattern.
|
||||||
*/
|
*/
|
||||||
QHash<quint32, VGObject*> gObjects;
|
QHash<quint32, VGObject*> gObjects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief measurements container of measurements.
|
* @brief variables container for measurements, increments, lines lengths, lines angles, arcs lengths, curve lengths
|
||||||
*/
|
*/
|
||||||
QHash<QString, VMeasurement> measurements;
|
QHash<QString, VInternalVariable*> variables;
|
||||||
/**
|
|
||||||
* @brief increments
|
|
||||||
*/
|
|
||||||
QHash<QString, VIncrement> increments;
|
|
||||||
/**
|
|
||||||
* @brief lengthLines container of lines lengths
|
|
||||||
*/
|
|
||||||
QHash<QString, qreal> lengthLines;
|
|
||||||
/**
|
|
||||||
* @brief lineAngles container of angles of lines
|
|
||||||
*/
|
|
||||||
QHash<QString, qreal> lineAngles;
|
|
||||||
/**
|
|
||||||
* @brief lengthSplines container of splines length
|
|
||||||
*/
|
|
||||||
QHash<QString, qreal> lengthSplines;
|
|
||||||
/**
|
|
||||||
* @brief lengthArcs container of arcs length
|
|
||||||
*/
|
|
||||||
QHash<QString, qreal> lengthArcs;
|
|
||||||
/**
|
/**
|
||||||
* @brief details container of details
|
* @brief details container of details
|
||||||
*/
|
*/
|
||||||
|
@ -187,101 +205,24 @@ private:
|
||||||
// cppcheck-suppress functionStatic
|
// cppcheck-suppress functionStatic
|
||||||
const val GetObject(const QHash<key, val> &obj, key id) const;
|
const val GetObject(const QHash<key, val> &obj, key id) const;
|
||||||
|
|
||||||
template <typename key, typename val>
|
|
||||||
// cppcheck-suppress functionStatic
|
|
||||||
val GetVariable(const QHash<key, val> &obj, key id) const;
|
|
||||||
|
|
||||||
template <typename val>
|
template <typename val>
|
||||||
void UpdateObject(QHash<quint32, val > &obj, const quint32 &id, val point);
|
void UpdateObject(QHash<quint32, val > &obj, const quint32 &id, val point);
|
||||||
|
|
||||||
template <typename key, typename val>
|
template <typename key, typename val>
|
||||||
static quint32 AddObject(QHash<key, val> &obj, val value);
|
static quint32 AddObject(QHash<key, val> &obj, val value);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CopyGObject(const VContainer &data, const quint32 &id);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void CopyVar(const VContainer &data, const QString &name);
|
||||||
|
|
||||||
|
QMap<QString, qreal> DataVar(const VarType &type) const;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
const QMap<QString, T*> DataTableVar(const VarType &type) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief AddMeasurement add new measurement
|
|
||||||
* @param name short measurement name
|
|
||||||
* @param m measurement
|
|
||||||
*/
|
|
||||||
inline void VContainer::AddMeasurement(const QString &name, const VMeasurement &m)
|
|
||||||
{
|
|
||||||
measurements[name] = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief UpdateMeasurement update measurement by name
|
|
||||||
* @param name short measurement name
|
|
||||||
* @param m measurement
|
|
||||||
*/
|
|
||||||
inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m)
|
|
||||||
{
|
|
||||||
measurements[name] = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief UpdateIncrement update increment table row by name
|
|
||||||
* @param name name of row
|
|
||||||
* @param incr increment
|
|
||||||
*/
|
|
||||||
inline void VContainer::UpdateIncrement(const QString &name, VIncrement incr)
|
|
||||||
{
|
|
||||||
increments[name] = incr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ClearIncrementTable clear increment table
|
|
||||||
*/
|
|
||||||
inline void VContainer::ClearIncrementTable()
|
|
||||||
{
|
|
||||||
increments.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline void VContainer::ClearMeasurements()
|
|
||||||
{
|
|
||||||
measurements.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ClearLengthLines clear length lines
|
|
||||||
*/
|
|
||||||
inline void VContainer::ClearLengthLines()
|
|
||||||
{
|
|
||||||
lengthLines.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ClearLengthSplines clear length splines
|
|
||||||
*/
|
|
||||||
inline void VContainer::ClearLengthSplines()
|
|
||||||
{
|
|
||||||
lengthSplines.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ClearLengthArcs clear length arcs
|
|
||||||
*/
|
|
||||||
inline void VContainer::ClearLengthArcs()
|
|
||||||
{
|
|
||||||
lengthArcs.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ClearLineAngles clear angles of lines
|
|
||||||
*/
|
|
||||||
inline void VContainer::ClearLineAngles()
|
|
||||||
{
|
|
||||||
lineAngles.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline void VContainer::ClearDetails()
|
inline void VContainer::ClearDetails()
|
||||||
{
|
{
|
||||||
|
@ -352,27 +293,6 @@ inline QString VContainer::HeightName() const
|
||||||
return heightName;
|
return heightName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief IncrementTableContains check if increment table contains name
|
|
||||||
* @param name name of row
|
|
||||||
* @return true if contains
|
|
||||||
*/
|
|
||||||
inline bool VContainer::IncrementTableContains(const QString &name)
|
|
||||||
{
|
|
||||||
return increments.contains(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RemoveIncrementTableRow remove row by name from increment table
|
|
||||||
* @param name name of existing row
|
|
||||||
*/
|
|
||||||
inline void VContainer::RemoveIncrementTableRow(const QString &name)
|
|
||||||
{
|
|
||||||
increments.remove(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief data container with datagObjects return container of gObjects
|
* @brief data container with datagObjects return container of gObjects
|
||||||
|
@ -383,66 +303,6 @@ inline const QHash<quint32, VGObject *> *VContainer::DataGObjects() const
|
||||||
return &gObjects;
|
return &gObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief DataMeasurements container with measurements.
|
|
||||||
* @return pointer to measurements.
|
|
||||||
*/
|
|
||||||
inline const QHash<QString, VMeasurement> *VContainer::DataMeasurements() const
|
|
||||||
{
|
|
||||||
return &measurements;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief data container with dataIncrements return container of increment table
|
|
||||||
* @return pointer on container of increment table
|
|
||||||
*/
|
|
||||||
inline const QHash<QString, VIncrement> *VContainer::DataIncrements() const
|
|
||||||
{
|
|
||||||
return &increments;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief data container with dataLengthLines return container of lines lengths
|
|
||||||
* @return pointer on container of lines lengths
|
|
||||||
*/
|
|
||||||
inline const QHash<QString, qreal> *VContainer::DataLengthLines() const
|
|
||||||
{
|
|
||||||
return &lengthLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief data container with dataLengthSplines return container of splines lengths
|
|
||||||
* @return pointer on container of splines lengths
|
|
||||||
*/
|
|
||||||
inline const QHash<QString, qreal> *VContainer::DataLengthSplines() const
|
|
||||||
{
|
|
||||||
return &lengthSplines;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief data container with dataLengthArcs return container of arcs length
|
|
||||||
* @return pointer on container of arcs length
|
|
||||||
*/
|
|
||||||
inline const QHash<QString, qreal> *VContainer::DataLengthArcs() const
|
|
||||||
{
|
|
||||||
return &lengthArcs;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief data container with dataLineAngles return container of angles of line
|
|
||||||
* @return pointer on container of angles of line
|
|
||||||
*/
|
|
||||||
inline const QHash<QString, qreal> *VContainer::DataLineAngles() const
|
|
||||||
{
|
|
||||||
return &lineAngles;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataDetails return container of details
|
* @brief data container with dataDetails return container of details
|
||||||
|
@ -453,4 +313,10 @@ inline const QHash<quint32, VDetail> *VContainer::DataDetails() const
|
||||||
return &details;
|
return &details;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline const QHash<QString, VInternalVariable *> *VContainer::DataVariables() const
|
||||||
|
{
|
||||||
|
return &variables;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // VCONTAINER_H
|
#endif // VCONTAINER_H
|
||||||
|
|
|
@ -34,20 +34,25 @@
|
||||||
*/
|
*/
|
||||||
VIncrement::VIncrement()
|
VIncrement::VIncrement()
|
||||||
:VVariable(), id(0)
|
:VVariable(), id(0)
|
||||||
{}
|
{
|
||||||
|
type = VarType::Increment;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief VIncrementTableRow create increment
|
* @brief VIncrementTableRow create increment
|
||||||
|
* @param name increment's name
|
||||||
* @param id id
|
* @param id id
|
||||||
* @param base value in base size and height
|
* @param base value in base size and height
|
||||||
* @param ksize increment in sizes
|
* @param ksize increment in sizes
|
||||||
* @param kheight increment in heights
|
* @param kheight increment in heights
|
||||||
* @param description description of increment
|
* @param description description of increment
|
||||||
*/
|
*/
|
||||||
VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description)
|
VIncrement::VIncrement(const QString &name, quint32 id, qreal base, qreal ksize, qreal kheight, QString description)
|
||||||
:VVariable(base, ksize, kheight, description), id(id)
|
:VVariable(name, base, ksize, kheight, description), id(id)
|
||||||
{}
|
{
|
||||||
|
type = VarType::Increment;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VIncrement::VIncrement(const VIncrement &incr)
|
VIncrement::VIncrement(const VIncrement &incr)
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define VINCREMENTTABLEROW_H
|
#define VINCREMENTTABLEROW_H
|
||||||
|
|
||||||
#include "vvariable.h"
|
#include "vvariable.h"
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VIncrement class keep data row of increment table
|
* @brief The VIncrement class keep data row of increment table
|
||||||
|
@ -39,7 +38,8 @@ class VIncrement :public VVariable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VIncrement();
|
VIncrement();
|
||||||
VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description = QString());
|
VIncrement(const QString &name, quint32 id, qreal base, qreal ksize, qreal kheight,
|
||||||
|
QString description = QString());
|
||||||
VIncrement(const VIncrement &incr);
|
VIncrement(const VIncrement &incr);
|
||||||
VIncrement &operator=(const VIncrement &incr);
|
VIncrement &operator=(const VIncrement &incr);
|
||||||
virtual ~VIncrement();
|
virtual ~VIncrement();
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
void setKheight(const qreal &value);
|
void setKheight(const qreal &value);
|
||||||
void setDescription(const QString &value);
|
void setDescription(const QString &value);
|
||||||
private:
|
private:
|
||||||
/** @brief id identificator */
|
/** @brief id each increment have unique identificator */
|
||||||
quint32 id;
|
quint32 id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
63
src/app/container/vinternalvariable.cpp
Normal file
63
src/app/container/vinternalvariable.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vinternalvariable.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 "vinternalvariable.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VInternalVariable::VInternalVariable()
|
||||||
|
:type(VarType::Unknown), value(0), name(QString())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VInternalVariable::VInternalVariable(const VInternalVariable &var)
|
||||||
|
:type(var.GetType()), value(var.GetValue()), name(var.GetName())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VInternalVariable &VInternalVariable::operator=(const VInternalVariable &var)
|
||||||
|
{
|
||||||
|
if ( &var == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
this->type = var.GetType();
|
||||||
|
this->value = var.GetValue();
|
||||||
|
this->name = var.GetName();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VInternalVariable::~VInternalVariable()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VInternalVariable::Filter(quint32 id)
|
||||||
|
{
|
||||||
|
Q_UNUSED(id);
|
||||||
|
return false;
|
||||||
|
}
|
83
src/app/container/vinternalvariable.h
Normal file
83
src/app/container/vinternalvariable.h
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vinternalvariable.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 VINTERNALVARIABLE_H
|
||||||
|
#define VINTERNALVARIABLE_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
enum class VarType : char { Measurement, Increment, LengthLine, LengthSpline, LengthArc, LineAngle, Unknown };
|
||||||
|
|
||||||
|
class VInternalVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VInternalVariable();
|
||||||
|
VInternalVariable(const VInternalVariable &var);
|
||||||
|
VInternalVariable &operator=(const VInternalVariable &var);
|
||||||
|
virtual ~VInternalVariable();
|
||||||
|
|
||||||
|
qreal GetValue() const;
|
||||||
|
qreal* GetValue();
|
||||||
|
QString GetName() const;
|
||||||
|
VarType GetType() const;
|
||||||
|
|
||||||
|
virtual bool Filter(quint32 id);
|
||||||
|
protected:
|
||||||
|
VarType type;
|
||||||
|
|
||||||
|
/** @brief value variable's value */
|
||||||
|
qreal value;
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline qreal VInternalVariable::GetValue() const
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline qreal *VInternalVariable::GetValue()
|
||||||
|
{
|
||||||
|
return &value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline QString VInternalVariable::GetName() const
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline VarType VInternalVariable::GetType() const
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VINTERNALVARIABLE_H
|
75
src/app/container/vlengtharc.cpp
Normal file
75
src/app/container/vlengtharc.cpp
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlengtharc.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 "vlengtharc.h"
|
||||||
|
#include "../geometry/varc.h"
|
||||||
|
#include "../widgets/vapplication.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthArc::VLengthArc()
|
||||||
|
:VInternalVariable(), id(0)
|
||||||
|
{
|
||||||
|
type = VarType::LengthArc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthArc::VLengthArc(const quint32 &id, const VArc *arc)
|
||||||
|
:VInternalVariable(), id(id)
|
||||||
|
{
|
||||||
|
type = VarType::LengthArc;
|
||||||
|
SCASSERT(arc != nullptr);
|
||||||
|
name = arc->name();
|
||||||
|
value = qApp->fromPixel(arc->GetLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthArc::VLengthArc(const VLengthArc &var)
|
||||||
|
:VInternalVariable(var), id(var.GetId())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthArc &VLengthArc::operator=(const VLengthArc &var)
|
||||||
|
{
|
||||||
|
if ( &var == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
VInternalVariable::operator=(var);
|
||||||
|
this->id = var.GetId();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthArc::~VLengthArc()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VLengthArc::Filter(quint32 id)
|
||||||
|
{
|
||||||
|
return this->id == id;
|
||||||
|
}
|
56
src/app/container/vlengtharc.h
Normal file
56
src/app/container/vlengtharc.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlengtharc.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 VLENGTHARC_H
|
||||||
|
#define VLENGTHARC_H
|
||||||
|
|
||||||
|
#include "vinternalvariable.h"
|
||||||
|
|
||||||
|
class VArc;
|
||||||
|
|
||||||
|
class VLengthArc :public VInternalVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VLengthArc();
|
||||||
|
VLengthArc(const quint32 &id, const VArc * 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
|
89
src/app/container/vlengthline.cpp
Normal file
89
src/app/container/vlengthline.cpp
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlengthline.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 "vlengthline.h"
|
||||||
|
#include "../geometry/vpointf.h"
|
||||||
|
#include "../widgets/vapplication.h"
|
||||||
|
|
||||||
|
#include <QLineF>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthLine::VLengthLine()
|
||||||
|
:VInternalVariable(), p1Id(0), p2Id(0)
|
||||||
|
{
|
||||||
|
type = VarType::LengthLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthLine::VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id)
|
||||||
|
:VInternalVariable(), p1Id(p1Id), p2Id(p2Id)
|
||||||
|
{
|
||||||
|
SCASSERT(p1 != nullptr);
|
||||||
|
SCASSERT(p2 != nullptr);
|
||||||
|
|
||||||
|
type = VarType::LengthLine;
|
||||||
|
name = QString(line_+"%1_%2").arg(p1->name(), p2->name());
|
||||||
|
SetValue(p1, p2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthLine::VLengthLine(const VLengthLine &var)
|
||||||
|
:VInternalVariable(var), p1Id(var.GetP1Id()), p2Id(var.GetP2Id())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthLine &VLengthLine::operator=(const VLengthLine &var)
|
||||||
|
{
|
||||||
|
if ( &var == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
VInternalVariable::operator=(var);
|
||||||
|
this->p1Id = var.GetP1Id();
|
||||||
|
this->p2Id = var.GetP2Id();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthLine::~VLengthLine()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VLengthLine::Filter(quint32 id)
|
||||||
|
{
|
||||||
|
return id == p1Id || id == p2Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLengthLine::SetValue(const VPointF *p1, const VPointF *p2)
|
||||||
|
{
|
||||||
|
SCASSERT(p1 != nullptr);
|
||||||
|
SCASSERT(p2 != nullptr);
|
||||||
|
|
||||||
|
value = qApp->fromPixel(QLineF(p1->toQPointF(), p2->toQPointF()).length());
|
||||||
|
}
|
66
src/app/container/vlengthline.h
Normal file
66
src/app/container/vlengthline.h
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlengthline.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 VLENGTHLINE_H
|
||||||
|
#define VLENGTHLINE_H
|
||||||
|
|
||||||
|
#include "vinternalvariable.h"
|
||||||
|
|
||||||
|
class VPointF;
|
||||||
|
|
||||||
|
class VLengthLine :public VInternalVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VLengthLine();
|
||||||
|
VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id);
|
||||||
|
VLengthLine(const VLengthLine &var);
|
||||||
|
VLengthLine &operator=(const VLengthLine &var);
|
||||||
|
virtual ~VLengthLine();
|
||||||
|
|
||||||
|
virtual bool Filter(quint32 id);
|
||||||
|
void SetValue(const VPointF *p1, const VPointF *p2);
|
||||||
|
quint32 GetP1Id() const;
|
||||||
|
quint32 GetP2Id() const;
|
||||||
|
private:
|
||||||
|
quint32 p1Id;
|
||||||
|
quint32 p2Id;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline quint32 VLengthLine::GetP1Id() const
|
||||||
|
{
|
||||||
|
return p1Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline quint32 VLengthLine::GetP2Id() const
|
||||||
|
{
|
||||||
|
return p2Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VLENGTHLINE_H
|
82
src/app/container/vlengthspline.cpp
Normal file
82
src/app/container/vlengthspline.cpp
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlengthsplines.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 "vlengthspline.h"
|
||||||
|
#include "../geometry/vabstractcurve.h"
|
||||||
|
#include "../widgets/vapplication.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthSpline::VLengthSpline()
|
||||||
|
:VInternalVariable(), id(0)
|
||||||
|
{
|
||||||
|
type = VarType::LengthSpline;
|
||||||
|
}
|
||||||
|
|
||||||
|
VLengthSpline::VLengthSpline(const quint32 &id, const QString &name, const qreal &value)
|
||||||
|
:VInternalVariable(), id(id)
|
||||||
|
{
|
||||||
|
type = VarType::LengthSpline;
|
||||||
|
this->name = name;
|
||||||
|
this->value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthSpline::VLengthSpline(const quint32 &id, const VAbstractCurve *path)
|
||||||
|
:VInternalVariable(), id(id)
|
||||||
|
{
|
||||||
|
type = VarType::LengthSpline;
|
||||||
|
this->name = path->name();
|
||||||
|
this->value = qApp->fromPixel(path->GetLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthSpline::VLengthSpline(const VLengthSpline &var)
|
||||||
|
:VInternalVariable(var), id(var.GetId())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthSpline &VLengthSpline::operator=(const VLengthSpline &var)
|
||||||
|
{
|
||||||
|
if ( &var == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
VInternalVariable::operator=(var);
|
||||||
|
this->id = var.GetId();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLengthSpline::~VLengthSpline()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VLengthSpline::Filter(quint32 id)
|
||||||
|
{
|
||||||
|
return this->id == id;
|
||||||
|
}
|
58
src/app/container/vlengthspline.h
Normal file
58
src/app/container/vlengthspline.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlengthsplines.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 VLENGTHSPLINES_H
|
||||||
|
#define VLENGTHSPLINES_H
|
||||||
|
|
||||||
|
#include "vinternalvariable.h"
|
||||||
|
|
||||||
|
class VAbstractCurve;
|
||||||
|
|
||||||
|
class VLengthSpline :public VInternalVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VLengthSpline();
|
||||||
|
VLengthSpline(const quint32 &id, const QString &name, const qreal &value);
|
||||||
|
VLengthSpline(const quint32 &id, 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
|
89
src/app/container/vlineangle.cpp
Normal file
89
src/app/container/vlineangle.cpp
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlineangle.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 "vlineangle.h"
|
||||||
|
#include "../geometry/vpointf.h"
|
||||||
|
#include "../widgets/vapplication.h"
|
||||||
|
|
||||||
|
#include <QLineF>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLineAngle::VLineAngle()
|
||||||
|
:VInternalVariable(), p1Id(0), p2Id(0)
|
||||||
|
{
|
||||||
|
type = VarType::LineAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLineAngle::VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id)
|
||||||
|
:VInternalVariable(), p1Id(p1Id), p2Id(p2Id)
|
||||||
|
{
|
||||||
|
type = VarType::LineAngle;
|
||||||
|
|
||||||
|
SCASSERT(p1 != nullptr);
|
||||||
|
SCASSERT(p2 != nullptr);
|
||||||
|
|
||||||
|
name = QString(angleLine_+"%1_%2").arg(p1->name(), p2->name());
|
||||||
|
SetValue(p1, p2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLineAngle::VLineAngle(const VLineAngle &var)
|
||||||
|
:VInternalVariable(var), p1Id(var.GetP1Id()), p2Id(var.GetP2Id())
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLineAngle &VLineAngle::operator=(const VLineAngle &var)
|
||||||
|
{
|
||||||
|
if ( &var == this )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
VInternalVariable::operator=(var);
|
||||||
|
this->p1Id = var.GetP1Id();
|
||||||
|
this->p2Id = var.GetP2Id();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VLineAngle::~VLineAngle()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VLineAngle::Filter(quint32 id)
|
||||||
|
{
|
||||||
|
return id == p1Id || id == p2Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLineAngle::SetValue(const VPointF *p1, const VPointF *p2)
|
||||||
|
{
|
||||||
|
SCASSERT(p1 != nullptr);
|
||||||
|
SCASSERT(p2 != nullptr);
|
||||||
|
value = QLineF(p1->toQPointF(), p2->toQPointF()).angle();
|
||||||
|
}
|
66
src/app/container/vlineangle.h
Normal file
66
src/app/container/vlineangle.h
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vlineangle.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 28 7, 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 VLINEANGLE_H
|
||||||
|
#define VLINEANGLE_H
|
||||||
|
|
||||||
|
#include "vinternalvariable.h"
|
||||||
|
|
||||||
|
class VPointF;
|
||||||
|
|
||||||
|
class VLineAngle :public VInternalVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VLineAngle();
|
||||||
|
VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2, const quint32 &p2Id);
|
||||||
|
VLineAngle(const VLineAngle &var);
|
||||||
|
VLineAngle &operator=(const VLineAngle &var);
|
||||||
|
virtual ~VLineAngle();
|
||||||
|
|
||||||
|
virtual bool Filter(quint32 id);
|
||||||
|
void SetValue(const VPointF *p1, const VPointF *p2);
|
||||||
|
quint32 GetP1Id() const;
|
||||||
|
quint32 GetP2Id() const;
|
||||||
|
private:
|
||||||
|
quint32 p1Id;
|
||||||
|
quint32 p2Id;
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline quint32 VLineAngle::GetP1Id() const
|
||||||
|
{
|
||||||
|
return p1Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
inline quint32 VLineAngle::GetP2Id() const
|
||||||
|
{
|
||||||
|
return p2Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VLINEANGLE_H
|
|
@ -36,11 +36,14 @@
|
||||||
*/
|
*/
|
||||||
VMeasurement::VMeasurement()
|
VMeasurement::VMeasurement()
|
||||||
:VVariable(), gui_text(QString()), _tagName(QString())
|
:VVariable(), gui_text(QString()), _tagName(QString())
|
||||||
{}
|
{
|
||||||
|
type = VarType::Measurement;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief VMeasurement create measurement for standard table
|
* @brief VMeasurement create measurement for standard table
|
||||||
|
* @param name measurement's name
|
||||||
* @param base value in base size and height
|
* @param base value in base size and height
|
||||||
* @param ksize increment in sizes
|
* @param ksize increment in sizes
|
||||||
* @param kheight increment in heights
|
* @param kheight increment in heights
|
||||||
|
@ -48,23 +51,28 @@ VMeasurement::VMeasurement()
|
||||||
* @param description measurement full description
|
* @param description measurement full description
|
||||||
* @param tagName measurement's tag name in file
|
* @param tagName measurement's tag name in file
|
||||||
*/
|
*/
|
||||||
VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kheight,
|
VMeasurement::VMeasurement(const QString &name, const qreal &base, const qreal &ksize, const qreal &kheight,
|
||||||
const QString &gui_text, const QString &description, const QString &tagName)
|
const QString &gui_text, const QString &description, const QString &tagName)
|
||||||
:VVariable(base, ksize, kheight, description), gui_text(gui_text), _tagName(tagName)
|
:VVariable(name, base, ksize, kheight, description), gui_text(gui_text), _tagName(tagName)
|
||||||
{}
|
{
|
||||||
|
type = VarType::Measurement;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief VMeasurement create measurement for individual table
|
* @brief VMeasurement create measurement for individual table
|
||||||
|
* @param name measurement's name
|
||||||
* @param base value in base size and height
|
* @param base value in base size and height
|
||||||
* @param gui_text shor tooltip for user
|
* @param gui_text shor tooltip for user
|
||||||
* @param description measurement full description
|
* @param description measurement full description
|
||||||
* @param tagName measurement's tag name in file
|
* @param tagName measurement's tag name in file
|
||||||
*/
|
*/
|
||||||
VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &description,
|
VMeasurement::VMeasurement(const QString &name, const qreal &base, const QString &gui_text, const QString &description,
|
||||||
const QString &tagName)
|
const QString &tagName)
|
||||||
:VVariable(base, description), gui_text(gui_text), _tagName(tagName)
|
:VVariable(name, base, description), gui_text(gui_text), _tagName(tagName)
|
||||||
{}
|
{
|
||||||
|
type = VarType::Measurement;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMeasurement::VMeasurement(const VMeasurement &m)
|
VMeasurement::VMeasurement(const VMeasurement &m)
|
||||||
|
@ -91,12 +99,13 @@ VMeasurement::~VMeasurement()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VMeasurement::ListHeights()
|
QStringList VMeasurement::ListHeights()
|
||||||
{
|
{
|
||||||
|
QStringList list;
|
||||||
if (qApp->patternUnit() == Unit::Inch)
|
if (qApp->patternUnit() == Unit::Inch)
|
||||||
{
|
{
|
||||||
qWarning()<<"Standard table doesn't support inches.";
|
qWarning()<<"Standard table doesn't support inches.";
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList list;
|
|
||||||
// from 92 cm to 188 cm
|
// from 92 cm to 188 cm
|
||||||
for (int i = 92; i<= 188; i = i+6)
|
for (int i = 92; i<= 188; i = i+6)
|
||||||
{
|
{
|
||||||
|
@ -108,12 +117,13 @@ QStringList VMeasurement::ListHeights()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VMeasurement::ListSizes()
|
QStringList VMeasurement::ListSizes()
|
||||||
{
|
{
|
||||||
|
QStringList list;
|
||||||
if (qApp->patternUnit() == Unit::Inch)
|
if (qApp->patternUnit() == Unit::Inch)
|
||||||
{
|
{
|
||||||
qWarning()<<"Standard table doesn't support inches.";
|
qWarning()<<"Standard table doesn't support inches.";
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList list;
|
|
||||||
// from 22 cm to 56 cm
|
// from 22 cm to 56 cm
|
||||||
for (int i = 22; i<= 56; i = i+2)
|
for (int i = 22; i<= 56; i = i+2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
#define VSTANDARDTABLEROW_H
|
#define VSTANDARDTABLEROW_H
|
||||||
|
|
||||||
#include "vvariable.h"
|
#include "vvariable.h"
|
||||||
#include <QString>
|
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VMeasurement class keep data row of standard table
|
* @brief The VMeasurement class keep data row of standard table
|
||||||
|
@ -39,10 +40,10 @@ class VMeasurement :public VVariable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VMeasurement();
|
VMeasurement();
|
||||||
VMeasurement(const qreal &base, const qreal &ksize, const qreal &kheight,
|
VMeasurement(const QString &name, const qreal &base, const qreal &ksize, const qreal &kheight,
|
||||||
const QString &gui_text = QString(), const QString &description = QString(),
|
const QString &gui_text = QString(), const QString &description = QString(),
|
||||||
const QString &TagName = QString());
|
const QString &TagName = QString());
|
||||||
VMeasurement(const qreal &base, const QString &gui_text = QString(),
|
VMeasurement(const QString &name, const qreal &base, const QString &gui_text = QString(),
|
||||||
const QString &description = QString(), const QString &TagName = QString());
|
const QString &description = QString(), const QString &TagName = QString());
|
||||||
VMeasurement(const VMeasurement &m);
|
VMeasurement(const VMeasurement &m);
|
||||||
VMeasurement &operator=(const VMeasurement &m);
|
VMeasurement &operator=(const VMeasurement &m);
|
||||||
|
|
|
@ -32,26 +32,34 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable::VVariable()
|
VVariable::VVariable()
|
||||||
:base(0), ksize(0), kheight(0), description(QString())
|
:VInternalVariable(), base(0), ksize(0), kheight(0), description(QString())
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
value = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable::VVariable(const qreal &base, const qreal &ksize, const qreal &kheight, const QString &description)
|
VVariable::VVariable(const QString &name, const qreal &base, const qreal &ksize, const qreal &kheight,
|
||||||
:base(base), ksize(ksize), kheight(kheight), description(description)
|
const QString &description)
|
||||||
{}
|
:VInternalVariable(), base(base), ksize(ksize), kheight(kheight), description(description)
|
||||||
|
{
|
||||||
|
value = base;
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable::VVariable(const qreal &base, const QString &description)
|
VVariable::VVariable(const QString &name, const qreal &base, const QString &description)
|
||||||
:base(base), ksize(0), kheight(0), description(description)
|
:base(base), ksize(0), kheight(0), description(description)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
value = base;
|
||||||
|
this->name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VVariable::VVariable(const VVariable &var)
|
VVariable::VVariable(const VVariable &var)
|
||||||
:base(var.GetBase()), ksize(var.GetKsize()), kheight(var.GetKheight()), description(var.GetDescription())
|
:VInternalVariable(var), base(var.GetBase()), ksize(var.GetKsize()), kheight(var.GetKheight()),
|
||||||
|
description(var.GetDescription())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -61,6 +69,7 @@ VVariable &VVariable::operator=(const VVariable &var)
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
VInternalVariable::operator=(var);
|
||||||
this->base = var.GetBase();
|
this->base = var.GetBase();
|
||||||
this->ksize = var.GetKsize();
|
this->ksize = var.GetKsize();
|
||||||
this->kheight = var.GetKheight();
|
this->kheight = var.GetKheight();
|
||||||
|
@ -73,10 +82,13 @@ VVariable::~VVariable()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VVariable::GetValue(const qreal &size, const qreal &height) const
|
void VVariable::SetValue(const qreal &size, const qreal &height)
|
||||||
{
|
{
|
||||||
if (qApp->patternUnit() != Unit::Inch)
|
if (qApp->patternUnit() == Unit::Inch)
|
||||||
{
|
{
|
||||||
|
qWarning("Gradation doesn't support inches");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const qreal baseSize = VAbstractMeasurements::UnitConvertor(50.0, Unit::Cm, qApp->patternUnit());
|
const qreal baseSize = VAbstractMeasurements::UnitConvertor(50.0, Unit::Cm, qApp->patternUnit());
|
||||||
const qreal baseHeight = VAbstractMeasurements::UnitConvertor(176.0, Unit::Cm, qApp->patternUnit());
|
const qreal baseHeight = VAbstractMeasurements::UnitConvertor(176.0, Unit::Cm, qApp->patternUnit());
|
||||||
const qreal sizeIncrement = VAbstractMeasurements::UnitConvertor(2.0, Unit::Cm, qApp->patternUnit());
|
const qreal sizeIncrement = VAbstractMeasurements::UnitConvertor(2.0, Unit::Cm, qApp->patternUnit());
|
||||||
|
@ -85,12 +97,7 @@ qreal VVariable::GetValue(const qreal &size, const qreal &height) const
|
||||||
// Formula for calculation gradation
|
// Formula for calculation gradation
|
||||||
const qreal k_size = ( size - baseSize ) / sizeIncrement;
|
const qreal k_size = ( size - baseSize ) / sizeIncrement;
|
||||||
const qreal k_height = ( height - baseHeight ) / heightIncrement;
|
const qreal k_height = ( height - baseHeight ) / heightIncrement;
|
||||||
return base + k_size * ksize + k_height * kheight;
|
value = base + k_size * ksize + k_height * kheight;
|
||||||
}
|
|
||||||
else// Must not be reached!!!!
|
|
||||||
{
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -29,14 +29,15 @@
|
||||||
#ifndef VVARIABLE_H
|
#ifndef VVARIABLE_H
|
||||||
#define VVARIABLE_H
|
#define VVARIABLE_H
|
||||||
|
|
||||||
#include <QString>
|
#include "vinternalvariable.h"
|
||||||
|
|
||||||
class VVariable
|
class VVariable :public VInternalVariable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VVariable();
|
VVariable();
|
||||||
VVariable(const qreal &base, const qreal &ksize, const qreal &kheight, const QString &description = QString());
|
VVariable(const QString &name, const qreal &base, const qreal &ksize, const qreal &kheight,
|
||||||
VVariable(const qreal &base, const QString &description = QString());
|
const QString &description = QString());
|
||||||
|
VVariable(const QString &name, const qreal &base, const QString &description = QString());
|
||||||
VVariable(const VVariable &var);
|
VVariable(const VVariable &var);
|
||||||
VVariable &operator=(const VVariable &var);
|
VVariable &operator=(const VVariable &var);
|
||||||
virtual ~VVariable();
|
virtual ~VVariable();
|
||||||
|
@ -46,8 +47,7 @@ public:
|
||||||
qreal GetKsize() const;
|
qreal GetKsize() const;
|
||||||
qreal GetKheight() const;
|
qreal GetKheight() const;
|
||||||
QString GetDescription() const;
|
QString GetDescription() const;
|
||||||
qreal GetValue() const;
|
void SetValue(const qreal &size, const qreal &height);
|
||||||
qreal GetValue(const qreal &size, const qreal &height) const;
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief base value in base size and height */
|
/** @brief base value in base size and height */
|
||||||
qreal base;
|
qreal base;
|
||||||
|
@ -106,10 +106,4 @@ inline QString VVariable::GetDescription() const
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
inline qreal VVariable::GetValue() const
|
|
||||||
{
|
|
||||||
return base;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VVARIABLE_H
|
#endif // VVARIABLE_H
|
||||||
|
|
|
@ -144,28 +144,20 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
||||||
*/
|
*/
|
||||||
void DialogIncrements::FillMeasurements()
|
void DialogIncrements::FillMeasurements()
|
||||||
{
|
{
|
||||||
const QHash<QString, VMeasurement> *table = data->DataMeasurements();
|
const QMap<QString, VMeasurement*> table = data->DataMeasurements();
|
||||||
QHashIterator<QString, VMeasurement> i(*table);
|
|
||||||
QMap<QString, VMeasurement> map;
|
|
||||||
//Sorting QHash by id
|
|
||||||
while (i.hasNext())
|
|
||||||
{
|
|
||||||
i.next();
|
|
||||||
map.insert(qApp->VarToUser(i.key()), i.value());
|
|
||||||
}
|
|
||||||
qint32 currentRow = -1;
|
qint32 currentRow = -1;
|
||||||
QMapIterator<QString, VMeasurement> iMap(map);
|
QMapIterator<QString, VMeasurement*> iMap(table);
|
||||||
ui->tableWidgetMeasurements->setRowCount ( table->size() );
|
ui->tableWidgetMeasurements->setRowCount ( table.size() );
|
||||||
while (iMap.hasNext())
|
while (iMap.hasNext())
|
||||||
{
|
{
|
||||||
iMap.next();
|
iMap.next();
|
||||||
VMeasurement m = iMap.value();
|
VMeasurement *m = iMap.value();
|
||||||
currentRow++;
|
currentRow++;
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString(iMap.key()));
|
QTableWidgetItem *item = new QTableWidgetItem(QString(iMap.key()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
item->setToolTip(m.GetGuiText());
|
item->setToolTip(m->GetGuiText());
|
||||||
// set the item non-editable (view only), and non-selectable
|
// set the item non-editable (view only), and non-selectable
|
||||||
Qt::ItemFlags flags = item->flags();
|
Qt::ItemFlags flags = item->flags();
|
||||||
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag
|
||||||
|
@ -175,7 +167,7 @@ void DialogIncrements::FillMeasurements()
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key())));
|
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetTableValue(iMap.key())));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
// set the item non-editable (view only), and non-selectable
|
// set the item non-editable (view only), and non-selectable
|
||||||
Qt::ItemFlags flags = item->flags();
|
Qt::ItemFlags flags = item->flags();
|
||||||
|
@ -184,13 +176,13 @@ void DialogIncrements::FillMeasurements()
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);// calculated value
|
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);// calculated value
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(m.GetBase()));
|
item = new QTableWidgetItem(QString().setNum(m->GetBase()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 2, item);
|
ui->tableWidgetMeasurements->setItem(currentRow, 2, item);
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize()));
|
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m->GetKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
// set the item non-editable (view only), and non-selectable
|
// set the item non-editable (view only), and non-selectable
|
||||||
Qt::ItemFlags flags = item->flags();
|
Qt::ItemFlags flags = item->flags();
|
||||||
|
@ -198,7 +190,7 @@ void DialogIncrements::FillMeasurements()
|
||||||
item->setFlags(flags);
|
item->setFlags(flags);
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);// in sizes
|
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);// in sizes
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(m.GetKheight()));
|
item = new QTableWidgetItem(QString().setNum(m->GetKheight()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
// set the item non-editable (view only), and non-selectable
|
// set the item non-editable (view only), and non-selectable
|
||||||
flags = item->flags();
|
flags = item->flags();
|
||||||
|
@ -207,8 +199,8 @@ void DialogIncrements::FillMeasurements()
|
||||||
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);// in heights
|
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);// in heights
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(m.GetDescription());
|
item = new QTableWidgetItem(m->GetDescription());
|
||||||
item->setToolTip(m.GetDescription());
|
item->setToolTip(m->GetDescription());
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
// set the item non-editable (view only), and non-selectable
|
// set the item non-editable (view only), and non-selectable
|
||||||
flags = item->flags();
|
flags = item->flags();
|
||||||
|
@ -228,15 +220,15 @@ void DialogIncrements::FillMeasurements()
|
||||||
*/
|
*/
|
||||||
void DialogIncrements::FillIncrements()
|
void DialogIncrements::FillIncrements()
|
||||||
{
|
{
|
||||||
const QHash<QString, VIncrement> *increments = data->DataIncrements();
|
const QMap<QString, VIncrement*> increments = data->DataIncrements();
|
||||||
QHashIterator<QString, VIncrement> i(*increments);
|
QMapIterator<QString, VIncrement*> i(increments);
|
||||||
QMap<quint32, QString> map;
|
QMap<quint32, QString> map;
|
||||||
//Sorting QHash by id
|
//Sorting QHash by id
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
i.next();
|
i.next();
|
||||||
VIncrement incr = i.value();
|
VIncrement *incr = i.value();
|
||||||
map.insert(incr.getId(), i.key());
|
map.insert(incr->getId(), i.key());
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 currentRow = -1;
|
qint32 currentRow = -1;
|
||||||
|
@ -244,19 +236,19 @@ void DialogIncrements::FillIncrements()
|
||||||
while (iMap.hasNext())
|
while (iMap.hasNext())
|
||||||
{
|
{
|
||||||
iMap.next();
|
iMap.next();
|
||||||
VIncrement incr = increments->value(iMap.value());
|
VIncrement *incr = increments.value(iMap.value());
|
||||||
currentRow++;
|
currentRow++;
|
||||||
ui->tableWidgetIncrement->setRowCount ( increments->size() );
|
ui->tableWidgetIncrement->setRowCount ( increments.size() );
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
|
QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
item->setData(Qt::UserRole, incr.getId());
|
item->setData(Qt::UserRole, incr->getId());
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 0, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
|
item = new QTableWidgetItem(QString().setNum(data->GetTableValue(iMap.value())));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
// set the item non-editable (view only), and non-selectable
|
// set the item non-editable (view only), and non-selectable
|
||||||
Qt::ItemFlags flags = item->flags();
|
Qt::ItemFlags flags = item->flags();
|
||||||
|
@ -265,23 +257,23 @@ void DialogIncrements::FillIncrements()
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(incr.GetBase()));
|
item = new QTableWidgetItem(QString().setNum(incr->GetBase()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
item = new QTableWidgetItem(QString().setNum(incr.GetKsize()));
|
item = new QTableWidgetItem(QString().setNum(incr->GetKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(incr.GetKheight()));
|
item = new QTableWidgetItem(QString().setNum(incr->GetKheight()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new QTableWidgetItem(incr.GetDescription());
|
item = new QTableWidgetItem(incr->GetDescription());
|
||||||
item->setToolTip(incr.GetDescription());
|
item->setToolTip(incr->GetDescription());
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
item->setTextAlignment(Qt::AlignLeft);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 5, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 5, item);
|
||||||
}
|
}
|
||||||
|
@ -295,28 +287,18 @@ void DialogIncrements::FillIncrements()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogIncrements::FillTable(const QHash<QString, qreal> *varTable, QTableWidget *table)
|
void DialogIncrements::FillTable(const QMap<QString, qreal> varTable, QTableWidget *table)
|
||||||
{
|
{
|
||||||
SCASSERT(table != nullptr);
|
SCASSERT(table != nullptr);
|
||||||
SCASSERT(varTable != nullptr);
|
|
||||||
|
|
||||||
QHashIterator<QString, qreal> iHash(*varTable);
|
|
||||||
QMap<QString, qreal> map;
|
|
||||||
//Sorting QHash by name
|
|
||||||
while (iHash.hasNext())
|
|
||||||
{
|
|
||||||
iHash.next();
|
|
||||||
map.insert(qApp->VarToUser(iHash.key()), iHash.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
qint32 currentRow = -1;
|
qint32 currentRow = -1;
|
||||||
QMapIterator<QString, qreal> i(map);
|
QMapIterator<QString, qreal> i(varTable);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
i.next();
|
i.next();
|
||||||
qreal length = i.value();
|
qreal length = i.value();
|
||||||
currentRow++;
|
currentRow++;
|
||||||
table->setRowCount ( varTable->size() );
|
table->setRowCount ( varTable.size() );
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(i.key());
|
QTableWidgetItem *item = new QTableWidgetItem(i.key());
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
item->setTextAlignment(Qt::AlignLeft);
|
||||||
|
@ -485,7 +467,7 @@ void DialogIncrements::OpenTable()
|
||||||
}
|
}
|
||||||
delete m;
|
delete m;
|
||||||
m = m1;
|
m = m1;
|
||||||
data->ClearMeasurements();
|
data->ClearVariables(VarType::Measurement);
|
||||||
m->Measurements();
|
m->Measurements();
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
|
|
||||||
|
@ -517,7 +499,7 @@ void DialogIncrements::OpenTable()
|
||||||
}
|
}
|
||||||
m1->SetSize();
|
m1->SetSize();
|
||||||
m1->SetHeight();
|
m1->SetHeight();
|
||||||
data->ClearMeasurements();
|
data->ClearVariables(VarType::Measurement);
|
||||||
m1->Measurements();
|
m1->Measurements();
|
||||||
delete m1;
|
delete m1;
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
|
@ -553,12 +535,12 @@ void DialogIncrements::clickedToolButtonAdd()
|
||||||
{
|
{
|
||||||
name = QString(tr("Name_%1")).arg(num);
|
name = QString(tr("Name_%1")).arg(num);
|
||||||
num++;
|
num++;
|
||||||
} while (data->IncrementTableContains(name));
|
} while (data->IncrementExist(name));
|
||||||
|
|
||||||
const quint32 id = data->getNextId();
|
const quint32 id = data->getNextId();
|
||||||
const QString description(tr("Description"));
|
const QString description(tr("Description"));
|
||||||
VIncrement incr = VIncrement(id, 0, 0, 0, description);
|
VIncrement *incr = new VIncrement(name, id, 0, 0, 0, description);
|
||||||
data->AddIncrement(name, incr);
|
data->AddVariable(name, incr);
|
||||||
|
|
||||||
AddIncrementToFile(id, name, 0, 0, 0, description);
|
AddIncrementToFile(id, name, 0, 0, 0, description);
|
||||||
|
|
||||||
|
@ -610,7 +592,7 @@ void DialogIncrements::clickedToolButtonRemove()
|
||||||
QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem();
|
QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem();
|
||||||
qint32 row = item->row();
|
qint32 row = item->row();
|
||||||
QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
|
QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
|
||||||
data->RemoveIncrementTableRow(itemName->text());
|
data->RemoveIncrement(itemName->text());
|
||||||
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
|
@ -687,7 +669,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
|
||||||
{
|
{
|
||||||
case 0: // VPattern::IncrementName
|
case 0: // VPattern::IncrementName
|
||||||
doc->SetAttribute(domElement, VPattern::IncrementName, item->text());
|
doc->SetAttribute(domElement, VPattern::IncrementName, item->text());
|
||||||
data->ClearIncrementTable();
|
data->ClearVariables(VarType::Increment);
|
||||||
this->column = 2;
|
this->column = 2;
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
break;
|
break;
|
||||||
|
@ -709,9 +691,8 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
|
||||||
case 5: // VPattern::IncrementDescription
|
case 5: // VPattern::IncrementDescription
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text());
|
doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text());
|
||||||
VIncrement incr = data->GetIncrement(itemName->text());
|
VIncrement *incr = data->GetVariable<VIncrement*>(itemName->text());
|
||||||
incr.setDescription(item->text());
|
incr->setDescription(item->text());
|
||||||
data->UpdateIncrement(itemName->text(), incr);
|
|
||||||
ui->tableWidgetIncrement->resizeColumnsToContents();
|
ui->tableWidgetIncrement->resizeColumnsToContents();
|
||||||
ui->tableWidgetIncrement->resizeRowsToContents();
|
ui->tableWidgetIncrement->resizeRowsToContents();
|
||||||
this->column = 0;
|
this->column = 0;
|
||||||
|
@ -734,8 +715,8 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
|
||||||
const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);// name column
|
const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);// name column
|
||||||
QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
|
QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
|
||||||
|
|
||||||
VMeasurement measur = data->GetMeasurement(qApp->VarFromUser(itemName->text()));
|
VMeasurement *measur = data->GetVariable<VMeasurement*>(qApp->VarFromUser(itemName->text()));
|
||||||
const QString tag = measur.TagName();
|
const QString tag = measur->TagName();
|
||||||
QDomNodeList list = m->elementsByTagName(tag);
|
QDomNodeList list = m->elementsByTagName(tag);
|
||||||
QDomElement domElement = list.at(0).toElement();
|
QDomElement domElement = list.at(0).toElement();
|
||||||
if (domElement.isElement() == false)
|
if (domElement.isElement() == false)
|
||||||
|
@ -748,13 +729,13 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
|
||||||
qreal base = item->text().replace(",", ".").toDouble(&ok);
|
qreal base = item->text().replace(",", ".").toDouble(&ok);
|
||||||
if (ok == false)
|
if (ok == false)
|
||||||
{
|
{
|
||||||
measur.SetBase(0);
|
measur->SetBase(0);
|
||||||
item->setText("0");
|
item->setText("0");
|
||||||
qDebug()<<"Can't convert toDouble measurement value"<<Q_FUNC_INFO;
|
qDebug()<<"Can't convert toDouble measurement value"<<Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
measur.SetBase(base);
|
measur->SetBase(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert value to measurements table unit
|
// Convert value to measurements table unit
|
||||||
|
@ -766,7 +747,7 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
|
||||||
qDebug()<<"Can't save measurement";
|
qDebug()<<"Can't save measurement";
|
||||||
}
|
}
|
||||||
|
|
||||||
data->ClearMeasurements();
|
data->ClearVariables();
|
||||||
m->Measurements();
|
m->Measurements();
|
||||||
|
|
||||||
emit FullUpdateTree();
|
emit FullUpdateTree();
|
||||||
|
|
|
@ -94,7 +94,7 @@ private:
|
||||||
|
|
||||||
void FillMeasurements();
|
void FillMeasurements();
|
||||||
void FillIncrements();
|
void FillIncrements();
|
||||||
void FillTable(const QHash<QString, qreal> *varTable, QTableWidget *table);
|
void FillTable(const QMap<QString, qreal> varTable, QTableWidget *table);
|
||||||
void FillLengthLines();
|
void FillLengthLines();
|
||||||
void FillLengthSplines();
|
void FillLengthSplines();
|
||||||
void FillLengthArcs();
|
void FillLengthArcs();
|
||||||
|
|
|
@ -231,8 +231,8 @@ void DialogArc::ValChenged(int row)
|
||||||
QListWidgetItem *item = ui->listWidget->item( row );
|
QListWidgetItem *item = ui->listWidget->item( row );
|
||||||
if (ui->radioButtonLineAngles->isChecked())
|
if (ui->radioButtonLineAngles->isChecked())
|
||||||
{
|
{
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineAngle(item->text()))
|
qreal angle = *data->GetVariable<VLineAngle*>(item->text())->GetValue();
|
||||||
.arg(tr("Value of angle of line."));
|
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(angle).arg(tr("Value of angle of line."));
|
||||||
ui->labelDescription->setText(desc);
|
ui->labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -357,9 +357,8 @@ void DialogArc::ShowLineAngles()
|
||||||
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
||||||
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
|
const QMap<QString, qreal> lineAnglesTable = data->DataLineAngles();
|
||||||
SCASSERT(lineAnglesTable != nullptr);
|
QMapIterator<QString, qreal> i(lineAnglesTable);
|
||||||
QHashIterator<QString, qreal> i(*lineAnglesTable);
|
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
i.next();
|
i.next();
|
||||||
|
|
|
@ -967,30 +967,32 @@ void DialogTool::ValChenged(int row)
|
||||||
if (radioButtonStandardTable->isChecked())
|
if (radioButtonStandardTable->isChecked())
|
||||||
{
|
{
|
||||||
QString name = qApp->VarFromUser(item->text());
|
QString name = qApp->VarFromUser(item->text());
|
||||||
VMeasurement stable = data->GetMeasurement(name);
|
VMeasurement *stable = data->GetVariable<VMeasurement *>(name);
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandardTableRow(name))
|
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(name))
|
||||||
.arg(stable.GetGuiText());
|
.arg(stable->GetGuiText());
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (radioButtonIncrements->isChecked())
|
if (radioButtonIncrements->isChecked())
|
||||||
{
|
{
|
||||||
VIncrement incr = data->GetIncrement(item->text());
|
VIncrement *incr = data->GetVariable<VIncrement *>(item->text());
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text()))
|
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(item->text()))
|
||||||
.arg(incr.GetDescription());
|
.arg(incr->GetDescription());
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (radioButtonLengthLine->isChecked())
|
if (radioButtonLengthLine->isChecked())
|
||||||
{
|
{
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(qApp->VarFromUser(item->text())))
|
QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||||
|
.arg(*data->GetVariable<VLengthLine*>(qApp->VarFromUser(item->text()))->GetValue())
|
||||||
.arg(tr("Line length"));
|
.arg(tr("Line length"));
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (radioButtonLengthArc->isChecked())
|
if (radioButtonLengthArc->isChecked())
|
||||||
{
|
{
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLengthArc(qApp->VarFromUser(item->text())))
|
QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||||
|
.arg(*data->GetVariable<VLengthArc *>(qApp->VarFromUser(item->text()))->GetValue())
|
||||||
.arg(tr("Arc length"));
|
.arg(tr("Arc length"));
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
|
@ -998,7 +1000,8 @@ void DialogTool::ValChenged(int row)
|
||||||
if (radioButtonLengthCurve->isChecked())
|
if (radioButtonLengthCurve->isChecked())
|
||||||
{
|
{
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text())
|
QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||||
.arg(data->GetLengthSpline(qApp->VarFromUser(item->text()))).arg(tr("Curve length"));
|
.arg(*data->GetVariable<VLengthSpline *>(qApp->VarFromUser(item->text()))->GetValue())
|
||||||
|
.arg(tr("Curve length"));
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1049,21 +1052,13 @@ void DialogTool::UpdateList()
|
||||||
* @param var container with variables
|
* @param var container with variables
|
||||||
*/
|
*/
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
void DialogTool::ShowVariable(const QHash<key, val> *var)
|
void DialogTool::ShowVariable(const QMap<key, val> var)
|
||||||
{
|
{
|
||||||
SCASSERT(listWidget != nullptr);
|
SCASSERT(listWidget != nullptr);
|
||||||
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||||
listWidget->clear();
|
listWidget->clear();
|
||||||
|
|
||||||
QHashIterator<key, val> i(*var);
|
QMapIterator<key, val> iMap(var);
|
||||||
QMap<key, val> map;
|
|
||||||
while (i.hasNext())
|
|
||||||
{
|
|
||||||
i.next();
|
|
||||||
map.insert(qApp->VarToUser(i.key()), i.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
QMapIterator<key, val> iMap(map);
|
|
||||||
while (iMap.hasNext())
|
while (iMap.hasNext())
|
||||||
{
|
{
|
||||||
iMap.next();
|
iMap.next();
|
||||||
|
|
|
@ -197,7 +197,7 @@ protected:
|
||||||
virtual void CheckState();
|
virtual void CheckState();
|
||||||
QString GetTypeLine(const QComboBox *box)const;
|
QString GetTypeLine(const QComboBox *box)const;
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
void ShowVariable(const QHash<key, val> *var);
|
void ShowVariable(const QMap<key, val> var);
|
||||||
void SetupTypeLine(QComboBox *box, const QString &value);
|
void SetupTypeLine(QComboBox *box, const QString &value);
|
||||||
void ChangeCurrentText(QComboBox *box, const QString &value);
|
void ChangeCurrentText(QComboBox *box, const QString &value);
|
||||||
void ChangeCurrentData(QComboBox *box, const quint32 &value) const;
|
void ChangeCurrentData(QComboBox *box, const quint32 &value) const;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
* @brief VGObject default constructor.
|
* @brief VGObject default constructor.
|
||||||
*/
|
*/
|
||||||
VGObject::VGObject()
|
VGObject::VGObject()
|
||||||
:_id(0), type(GOType::Point), idObject(0), _name(QString()), mode(Draw::Calculation)
|
:_id(0), type(GOType::Unknown), idObject(0), _name(QString()), mode(Draw::Calculation)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
enum class GOType : char { Point, Arc, Spline, SplinePath };
|
enum class GOType : char { Point, Arc, Spline, SplinePath, Unknown };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VGObject class keep information graphical objects.
|
* @brief The VGObject class keep information graphical objects.
|
||||||
|
|
|
@ -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());
|
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||||
spl1id = data->AddGObject(spline1);
|
spl1id = data->AddGObject(spline1);
|
||||||
data->AddLengthSpline(spline1->name(), qApp->fromPixel(spline1->GetLength()));
|
data->AddVariable(spline1->name(), new VLengthSpline(id, spline1));
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||||
spl2id = data->AddGObject(spline2);
|
spl2id = data->AddGObject(spline2);
|
||||||
data->AddLengthSpline(spline2->name(), qApp->fromPixel(spline2->GetLength()));
|
data->AddVariable(spline2->name(), new VLengthSpline(id, spline2));
|
||||||
}
|
}
|
||||||
else
|
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());
|
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||||
data->UpdateGObject(spl1id, spline1);
|
data->UpdateGObject(spl1id, spline1);
|
||||||
data->AddLengthSpline(spline1->name(), qApp->fromPixel(spline1->GetLength()));
|
data->AddVariable(spline1->name(), new VLengthSpline(id, spline1));
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||||
data->UpdateGObject(spl2id, spline2);
|
data->UpdateGObject(spl2id, spline2);
|
||||||
data->AddLengthSpline(spline2->name(), qApp->fromPixel(spline2->GetLength()));
|
data->AddVariable(spline2->name(), new VLengthSpline(id, spline2));
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,18 +198,18 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
splPath1id = data->AddGObject(splPath1);
|
splPath1id = data->AddGObject(splPath1);
|
||||||
data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
|
data->AddVariable(splPath1->name(), new VLengthSpline(splPath1id, splPath1));
|
||||||
|
|
||||||
splPath2id = data->AddGObject(splPath2);
|
splPath2id = data->AddGObject(splPath2);
|
||||||
data->AddLengthSpline(splPath2->name(), qApp->fromPixel(splPath2->GetLength()));
|
data->AddVariable(splPath2->name(), new VLengthSpline(splPath2id, splPath2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(splPath1id, splPath1);
|
data->UpdateGObject(splPath1id, splPath1);
|
||||||
data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength()));
|
data->AddVariable(splPath1->name(), new VLengthSpline(splPath1id, splPath1));
|
||||||
|
|
||||||
data->UpdateGObject(splPath2id, splPath2);
|
data->UpdateGObject(splPath2id, splPath2);
|
||||||
data->AddLengthSpline(splPath2->name(), qApp->fromPixel(splPath2->GetLength()));
|
data->AddVariable(splPath2->name(), new VLengthSpline(splPath2id, splPath2));
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -154,12 +154,12 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(spline);
|
id = data->AddGObject(spline);
|
||||||
data->AddLengthSpline(spline->name(), qApp->fromPixel(spline->GetLength()));
|
data->AddVariable(spline->name(), new VLengthSpline(id, spline));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, spline);
|
data->UpdateGObject(id, spline);
|
||||||
data->AddLengthSpline(spline->name(), qApp->fromPixel(spline->GetLength()));
|
data->AddVariable(spline->name(), new VLengthSpline(id, spline));
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -136,12 +136,12 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(path);
|
id = data->AddGObject(path);
|
||||||
data->AddLengthSpline(path->name(), qApp->fromPixel(path->GetLength()));
|
data->AddVariable(path->name(), new VLengthSpline(id, path));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, path);
|
data->UpdateGObject(id, path);
|
||||||
data->AddLengthSpline(path->name(), qApp->fromPixel(path->GetLength()));
|
data->AddVariable(path->name(), new VLengthSpline(id, path));
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
|
|
|
@ -70,7 +70,7 @@ void VIndividualMeasurements::ReadMeasurement(const QDomElement &domElement, con
|
||||||
{
|
{
|
||||||
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
|
qreal value = GetParametrDouble(domElement, AttrValue, "0.0");
|
||||||
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
value = UnitConvertor(value, MUnit(), qApp->patternUnit());
|
||||||
data->AddMeasurement(tag, VMeasurement(value, qApp->GuiText(tag), qApp->Description(tag), tag));
|
data->AddVariable(tag, new VMeasurement(tag, value, qApp->GuiText(tag), qApp->Description(tag), tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
|
||||||
const qreal kgrowth = GetParametrDouble(domElement, IncrementKgrowth, "0");
|
const qreal kgrowth = GetParametrDouble(domElement, IncrementKgrowth, "0");
|
||||||
const QString desc = GetParametrString(domElement, IncrementDescription, "Description");
|
const QString desc = GetParametrString(domElement, IncrementDescription, "Description");
|
||||||
data->UpdateId(id);
|
data->UpdateId(id);
|
||||||
data->AddIncrement(name, VIncrement(id, base, ksize, kgrowth, desc));
|
data->AddVariable(name, new VIncrement(name, id, base, ksize, kgrowth, desc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1835,13 +1835,8 @@ void VPattern::PrepareForParse(const Document &parse)
|
||||||
patternPieces.clear();
|
patternPieces.clear();
|
||||||
tools.clear();
|
tools.clear();
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
}
|
|
||||||
data->ClearLengthLines();
|
|
||||||
data->ClearLengthArcs();
|
|
||||||
data->ClearLengthSplines();
|
|
||||||
data->ClearLineAngles();
|
|
||||||
data->ClearDetails();
|
|
||||||
history.clear();
|
history.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -75,7 +75,7 @@ void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const
|
||||||
qWarning()<<"Standard table can't use inch unit.";
|
qWarning()<<"Standard table can't use inch unit.";
|
||||||
}
|
}
|
||||||
|
|
||||||
data->AddMeasurement(tag, VMeasurement(value, size_increase, height_increase, qApp->GuiText(tag),
|
data->AddVariable(tag, new VMeasurement(tag, value, size_increase, height_increase, qApp->GuiText(tag),
|
||||||
qApp->Description(tag), tag));
|
qApp->Description(tag), tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user