Fixed issue 168.
--HG-- branch : develop
This commit is contained in:
parent
8c572ab70d
commit
ca32f1c9df
|
@ -167,18 +167,18 @@ void Calculator::InitVariables(const VContainer *data, const QMap<int, QString>
|
|||
vVarVal = new qreal[2];
|
||||
}
|
||||
|
||||
const QHash<QString, VInternalVariable*> *vars = data->DataVariables();
|
||||
const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables();
|
||||
|
||||
QMap<int, QString>::const_iterator i = tokens.constBegin();
|
||||
while (i != tokens.constEnd())
|
||||
{
|
||||
if (vars->contains(i.value()))
|
||||
{
|
||||
VInternalVariable *var = vars->value(i.value());
|
||||
QSharedPointer<VInternalVariable> var = vars->value(i.value());
|
||||
if ((qApp->patternType() == MeasurementsType::Standard) &&
|
||||
(var->GetType() == VarType::Measurement || var->GetType() == VarType::Increment))
|
||||
{
|
||||
VVariable *m = data->GetVariable<VVariable *>(i.value());
|
||||
QSharedPointer<VVariable> m = data->GetVariable<VVariable>(i.value());
|
||||
m->SetValue(data->size(), data->height());
|
||||
}
|
||||
DefineVar(i.value(), var->GetValue());
|
||||
|
|
|
@ -35,17 +35,16 @@
|
|||
#include <QtAlgorithms>
|
||||
|
||||
quint32 VContainer::_id = NULL_ID;
|
||||
qreal VContainer::_size = 50;
|
||||
qreal VContainer::_height = 176;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief VContainer create empty container
|
||||
*/
|
||||
VContainer::VContainer()
|
||||
:_size(50), sizeName(size_M), _height(176), heightName(height_M),
|
||||
gObjects(QHash<quint32, VGObject *>()), variables(QHash<QString, VInternalVariable*> ()),
|
||||
details(QHash<quint32, VDetail>())
|
||||
{
|
||||
}
|
||||
:d(new VContainerData)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -59,7 +58,7 @@ VContainer &VContainer::operator =(const VContainer &data)
|
|||
{
|
||||
return *this;
|
||||
}
|
||||
setData(data);
|
||||
d = data.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -69,12 +68,8 @@ VContainer &VContainer::operator =(const VContainer &data)
|
|||
* @param data container
|
||||
*/
|
||||
VContainer::VContainer(const VContainer &data)
|
||||
:_size(50), sizeName(size_M), _height(176), heightName(height_M),
|
||||
gObjects(QHash<quint32, VGObject *>()), variables(QHash<QString, VInternalVariable*> ()),
|
||||
details(QHash<quint32, VDetail>())
|
||||
{
|
||||
setData(data);
|
||||
}
|
||||
:d(data.d)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VContainer::~VContainer()
|
||||
|
@ -83,79 +78,6 @@ VContainer::~VContainer()
|
|||
ClearVariables();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setData copy data from container
|
||||
* @param data container
|
||||
*/
|
||||
void VContainer::setData(const VContainer &data)
|
||||
{
|
||||
_size = data.size();
|
||||
sizeName = data.SizeName();
|
||||
_height = data.height();
|
||||
heightName = data.HeightName();
|
||||
{
|
||||
ClearGObjects();
|
||||
QHash<quint32, VGObject*>::const_iterator i;
|
||||
for (i = data.gObjects.constBegin(); i != data.gObjects.constEnd(); ++i)
|
||||
{
|
||||
switch (i.value()->getType())
|
||||
{
|
||||
case (GOType::Arc):
|
||||
CopyGObject<VArc>(data, i.key());
|
||||
break;
|
||||
case (GOType::Point):
|
||||
CopyGObject<VPointF>(data, i.key());
|
||||
break;
|
||||
case (GOType::Spline):
|
||||
CopyGObject<VSpline>(data, i.key());
|
||||
break;
|
||||
case (GOType::SplinePath):
|
||||
CopyGObject<VSplinePath>(data, i.key());
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Don't know how copy this type.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
ClearVariables();
|
||||
QHash<QString, VInternalVariable*>::const_iterator i;
|
||||
for (i = data.variables.constBegin(); i != data.variables.constEnd(); ++i)
|
||||
{
|
||||
switch (i.value()->GetType())
|
||||
{
|
||||
case (VarType::Measurement):
|
||||
CopyVar<VMeasurement>(data, i.key());
|
||||
break;
|
||||
case (VarType::Increment):
|
||||
CopyVar<VIncrement>(data, i.key());
|
||||
break;
|
||||
case (VarType::LineLength):
|
||||
CopyVar<VLengthLine>(data, i.key());
|
||||
break;
|
||||
case (VarType::SplineLength):
|
||||
CopyVar<VSplineLength>(data, i.key());
|
||||
break;
|
||||
case (VarType::ArcLength):
|
||||
CopyVar<VArcLength>(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();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetGObject returns a point by id
|
||||
|
@ -163,9 +85,9 @@ void VContainer::setData(const VContainer &data)
|
|||
* @return point
|
||||
*/
|
||||
// cppcheck-suppress unusedFunction
|
||||
const VGObject *VContainer::GetGObject(quint32 id)const
|
||||
const QSharedPointer<VGObject> VContainer::GetGObject(quint32 id)const
|
||||
{
|
||||
return GetObject(gObjects, id);
|
||||
return GetObject(d->gObjects, id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -196,9 +118,9 @@ const val VContainer::GetObject(const QHash<key, val> &obj, key id) const
|
|||
*/
|
||||
const VDetail VContainer::GetDetail(quint32 id) const
|
||||
{
|
||||
if (details.contains(id))
|
||||
if (d->details.contains(id))
|
||||
{
|
||||
return details.value(id);
|
||||
return d->details.value(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -214,7 +136,9 @@ const VDetail VContainer::GetDetail(quint32 id) const
|
|||
*/
|
||||
quint32 VContainer::AddGObject(VGObject *obj)
|
||||
{
|
||||
return AddObject(gObjects, obj);
|
||||
SCASSERT(obj != nullptr);
|
||||
QSharedPointer<VGObject> pointer(obj);
|
||||
return AddObject(d->gObjects, pointer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -226,7 +150,7 @@ quint32 VContainer::AddGObject(VGObject *obj)
|
|||
quint32 VContainer::AddDetail(VDetail detail)
|
||||
{
|
||||
quint32 id = getNextId();
|
||||
details[id] = detail;
|
||||
d->details[id] = detail;
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -265,12 +189,11 @@ template <typename val>
|
|||
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
|
||||
{
|
||||
Q_ASSERT_X(id > NULL_ID, Q_FUNC_INFO, "id = 0");
|
||||
SCASSERT(point != nullptr);
|
||||
SCASSERT(point.isNull() == false);
|
||||
point->setId(id);
|
||||
if (gObjects.contains(id))
|
||||
if (d->gObjects.contains(id))
|
||||
{
|
||||
delete gObjects.value(id);
|
||||
gObjects.remove(id);
|
||||
d->gObjects[id].clear();
|
||||
}
|
||||
obj[id] = point;
|
||||
UpdateId(id);
|
||||
|
@ -284,7 +207,7 @@ void VContainer::Clear()
|
|||
{
|
||||
_id = NULL_ID;
|
||||
|
||||
details.clear();
|
||||
d->details.clear();
|
||||
ClearVariables();
|
||||
ClearGObjects();
|
||||
}
|
||||
|
@ -295,23 +218,34 @@ void VContainer::Clear()
|
|||
*/
|
||||
void VContainer::ClearGObjects()
|
||||
{
|
||||
qDeleteAll(gObjects);
|
||||
gObjects.clear();
|
||||
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
||||
for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i)
|
||||
{
|
||||
i.value().clear();
|
||||
}
|
||||
d->gObjects.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContainer::ClearCalculationGObjects()
|
||||
{
|
||||
if (gObjects.size()>0)
|
||||
if (d->gObjects.size()>0)
|
||||
{
|
||||
QHashIterator<quint32, VGObject*> i(gObjects);
|
||||
while (i.hasNext())
|
||||
QVector<quint32> keys;
|
||||
QHash<quint32, QSharedPointer<VGObject> >::iterator i;
|
||||
for (i = d->gObjects.begin(); i != d->gObjects.end(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if (i.value()->getMode() == Draw::Calculation)
|
||||
{
|
||||
delete i.value();
|
||||
gObjects.remove(i.key());
|
||||
i.value().clear();
|
||||
keys.append(i.key());
|
||||
}
|
||||
}
|
||||
if (keys.size()>0)
|
||||
{
|
||||
for (int i = 0; i < keys.size(); ++i)
|
||||
{
|
||||
d->gObjects.remove(keys.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,23 +254,34 @@ void VContainer::ClearCalculationGObjects()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContainer::ClearVariables(const VarType &type)
|
||||
{
|
||||
if (variables.size()>0)
|
||||
if (d->variables.size()>0)
|
||||
{
|
||||
if (type == VarType::Unknown)
|
||||
{
|
||||
qDeleteAll(variables);
|
||||
variables.clear();
|
||||
QHash<QString, QSharedPointer<VInternalVariable> >::iterator i;
|
||||
for (i = d->variables.begin(); i != d->variables.end(); ++i)
|
||||
{
|
||||
i.value().clear();
|
||||
}
|
||||
d->variables.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
QHashIterator<QString, VInternalVariable*> i(variables);
|
||||
while (i.hasNext())
|
||||
QVector<QString> keys;
|
||||
QHash<QString, QSharedPointer<VInternalVariable> >::iterator i;
|
||||
for (i = d->variables.begin(); i != d->variables.end(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if (i.value()->GetType() == type)
|
||||
{
|
||||
delete i.value();
|
||||
variables.remove(i.key());
|
||||
i.value().clear();
|
||||
keys.append(i.key());
|
||||
}
|
||||
}
|
||||
if (keys.size()>0)
|
||||
{
|
||||
for (int i = 0; i < keys.size(); ++i)
|
||||
{
|
||||
d->variables.remove(keys.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -351,13 +296,13 @@ void VContainer::ClearVariables(const VarType &type)
|
|||
*/
|
||||
void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
|
||||
{
|
||||
const VPointF *first = GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *second = GeometricObject<const VPointF *>(secondPointId);
|
||||
const QSharedPointer<VPointF> first = GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> second = GeometricObject<VPointF>(secondPointId);
|
||||
|
||||
VLengthLine *length = new VLengthLine(first, firstPointId, second, secondPointId);
|
||||
VLengthLine *length = new VLengthLine(first.data(), firstPointId, second.data(), secondPointId);
|
||||
AddVariable(length->GetName(), length);
|
||||
|
||||
VLineAngle *angle = new VLineAngle(first, firstPointId, second, secondPointId);
|
||||
VLineAngle *angle = new VLineAngle(first.data(), firstPointId, second.data(), secondPointId);
|
||||
AddVariable(angle->GetName(), angle);
|
||||
}
|
||||
|
||||
|
@ -387,7 +332,8 @@ quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
|
|||
void VContainer::UpdateGObject(quint32 id, VGObject* obj)
|
||||
{
|
||||
SCASSERT(obj != nullptr);
|
||||
UpdateObject(gObjects, id, obj);
|
||||
QSharedPointer<VGObject> pointer(obj);
|
||||
UpdateObject(d->gObjects, id, pointer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -399,14 +345,14 @@ void VContainer::UpdateGObject(quint32 id, VGObject* obj)
|
|||
void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
|
||||
{
|
||||
Q_ASSERT_X(id > NULL_ID, Q_FUNC_INFO, "id = 0");
|
||||
details[id] = detail;
|
||||
d->details[id] = detail;
|
||||
UpdateId(id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VContainer::GetTableValue(const QString &name) const
|
||||
{
|
||||
VVariable *m = GetVariable<VVariable*>(name);
|
||||
QSharedPointer<VVariable> m = GetVariable<VVariable>(name);
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
m->SetValue(size(), height());
|
||||
|
@ -421,42 +367,42 @@ qreal VContainer::GetTableValue(const QString &name) const
|
|||
*/
|
||||
void VContainer::RemoveIncrement(const QString &name)
|
||||
{
|
||||
delete variables.value(name);
|
||||
variables.remove(name);
|
||||
d->variables[name].clear();
|
||||
d->variables.remove(name);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, VMeasurement*> VContainer::DataMeasurements() const
|
||||
const QMap<QString, QSharedPointer<VMeasurement> > VContainer::DataMeasurements() const
|
||||
{
|
||||
return DataVar<VMeasurement>(VarType::Measurement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, VIncrement *> VContainer::DataIncrements() const
|
||||
const QMap<QString, QSharedPointer<VIncrement> > VContainer::DataIncrements() const
|
||||
{
|
||||
return DataVar<VIncrement>(VarType::Increment);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, VLengthLine *> VContainer::DataLengthLines() const
|
||||
const QMap<QString, QSharedPointer<VLengthLine> > VContainer::DataLengthLines() const
|
||||
{
|
||||
return DataVar<VLengthLine>(VarType::LineLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, VSplineLength *> VContainer::DataLengthSplines() const
|
||||
const QMap<QString, QSharedPointer<VSplineLength> > VContainer::DataLengthSplines() const
|
||||
{
|
||||
return DataVar<VSplineLength>(VarType::SplineLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, VArcLength *> VContainer::DataLengthArcs() const
|
||||
const QMap<QString, QSharedPointer<VArcLength> > VContainer::DataLengthArcs() const
|
||||
{
|
||||
return DataVar<VArcLength>(VarType::ArcLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QMap<QString, VLineAngle *> VContainer::DataAngleLines() const
|
||||
const QMap<QString, QSharedPointer<VLineAngle> > VContainer::DataAngleLines() const
|
||||
{
|
||||
return DataVar<VLineAngle>(VarType::LineAngle);
|
||||
}
|
||||
|
@ -469,40 +415,119 @@ const QMap<QString, VLineAngle *> VContainer::DataAngleLines() const
|
|||
*/
|
||||
bool VContainer::VariableExist(const QString &name)
|
||||
{
|
||||
return variables.contains(name);
|
||||
return d->variables.contains(name);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void VContainer::CopyGObject(const VContainer &data, const quint32 &id)
|
||||
const QMap<QString, QSharedPointer<T> > VContainer::DataVar(const VarType &type) const
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
const QMap<QString, T *> VContainer::DataVar(const VarType &type) const
|
||||
{
|
||||
QHashIterator<QString, VInternalVariable*> i(variables);
|
||||
QMap<QString, T*> map;
|
||||
QMap<QString, QSharedPointer<T> > map;
|
||||
//Sorting QHash by id
|
||||
while (i.hasNext())
|
||||
QHash<QString, QSharedPointer<VInternalVariable> >::const_iterator i;
|
||||
for (i = d->variables.constBegin(); i != d->variables.constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if(i.value()->GetType() == type)
|
||||
{
|
||||
T *var = GetVariable<T *>(i.key());
|
||||
QSharedPointer<T> var = GetVariable<T>(i.key());
|
||||
map.insert(qApp->VarToUser(i.key()), var);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContainer::ClearDetails()
|
||||
{
|
||||
d->details.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetSize set value of size
|
||||
* @param size value of size
|
||||
*/
|
||||
void VContainer::SetSize(qreal size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContainer::SetSizeName(const QString &name)
|
||||
{
|
||||
d->sizeName = name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetGrowth set value of growth
|
||||
* @param height value of height
|
||||
*/
|
||||
void VContainer::SetHeight(qreal height)
|
||||
{
|
||||
_height = height;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VContainer::SetHeightName(const QString &name)
|
||||
{
|
||||
d->heightName = name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief size return size
|
||||
* @return size in mm
|
||||
*/
|
||||
qreal VContainer::size() const
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VContainer::SizeName() const
|
||||
{
|
||||
return d->sizeName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief height return height
|
||||
* @return height in pattern units
|
||||
*/
|
||||
qreal VContainer::height() const
|
||||
{
|
||||
return _height;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VContainer::HeightName() const
|
||||
{
|
||||
return d->heightName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief data container with datagObjects return container of gObjects
|
||||
* @return pointer on container of gObjects
|
||||
*/
|
||||
const QHash<quint32, QSharedPointer<VGObject> > *VContainer::DataGObjects() const
|
||||
{
|
||||
return &d->gObjects;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief data container with dataDetails return container of details
|
||||
* @return pointer on container of details
|
||||
*/
|
||||
const QHash<quint32, VDetail> *VContainer::DataDetails() const
|
||||
{
|
||||
return &d->details;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QHash<QString, QSharedPointer<VInternalVariable> > *VContainer::DataVariables() const
|
||||
{
|
||||
return &d->variables;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,39 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QHash>
|
||||
|
||||
class VContainerData : public QSharedData
|
||||
{
|
||||
public:
|
||||
|
||||
VContainerData()
|
||||
:sizeName(size_M), heightName(height_M), gObjects(QHash<quint32, QSharedPointer<VGObject> >()),
|
||||
variables(QHash<QString, QSharedPointer<VInternalVariable> > ()), details(QHash<quint32, VDetail>())
|
||||
{}
|
||||
|
||||
VContainerData(const VContainerData &data)
|
||||
:QSharedData(data), sizeName(data.sizeName), heightName(data.heightName), gObjects(data.gObjects),
|
||||
variables(data.variables), details(data.details)
|
||||
{}
|
||||
|
||||
virtual ~VContainerData() {}
|
||||
|
||||
QString sizeName;
|
||||
QString heightName;
|
||||
/**
|
||||
* @brief gObjects graphicals objects of pattern.
|
||||
*/
|
||||
QHash<quint32, QSharedPointer<VGObject> > gObjects;
|
||||
|
||||
/**
|
||||
* @brief variables container for measurements, increments, lines lengths, lines angles, arcs lengths, curve lengths
|
||||
*/
|
||||
QHash<QString, QSharedPointer<VInternalVariable>> variables;
|
||||
/**
|
||||
* @brief details container of details
|
||||
*/
|
||||
QHash<quint32, VDetail> details;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The VContainer class container of all variables.
|
||||
*/
|
||||
|
@ -50,37 +83,33 @@ public:
|
|||
VContainer(const VContainer &data);
|
||||
~VContainer();
|
||||
|
||||
void setData(const VContainer &data);
|
||||
|
||||
template <typename T>
|
||||
const T GeometricObject(const quint32 &id) const
|
||||
const QSharedPointer<T> GeometricObject(const quint32 &id) const
|
||||
{
|
||||
VGObject *gObj = nullptr;
|
||||
if (gObjects.contains(id))
|
||||
QSharedPointer<VGObject> gObj = QSharedPointer<VGObject>();
|
||||
if (d->gObjects.contains(id))
|
||||
{
|
||||
gObj = gObjects.value(id);
|
||||
gObj = d->gObjects.value(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw VExceptionBadId(tr("Can't find object"), id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
T obj = dynamic_cast<T>(gObj);
|
||||
SCASSERT(obj != nullptr);
|
||||
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(gObj);
|
||||
SCASSERT(obj.isNull() == false);
|
||||
return obj;
|
||||
}
|
||||
catch (const std::bad_alloc &)
|
||||
{
|
||||
throw VExceptionBadId(tr("Can't cast object"), id);
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
return QSharedPointer<T>();
|
||||
}
|
||||
|
||||
const VGObject *GetGObject(quint32 id) const;
|
||||
const QSharedPointer<VGObject> GetGObject(quint32 id) const;
|
||||
const VDetail GetDetail(quint32 id) const;
|
||||
qreal GetTableValue(const QString& name) const;
|
||||
template <typename T>
|
||||
|
@ -89,27 +118,25 @@ public:
|
|||
* @param name variable's name
|
||||
* @return variable
|
||||
*/
|
||||
T GetVariable(QString name) const
|
||||
QSharedPointer<T> GetVariable(QString name) const
|
||||
{
|
||||
SCASSERT(name.isEmpty()==false);
|
||||
if (variables.contains(name))
|
||||
if (d->variables.contains(name))
|
||||
{
|
||||
try
|
||||
{
|
||||
T value = dynamic_cast<T>(variables.value(name));
|
||||
SCASSERT(value != nullptr);
|
||||
QSharedPointer<T> value = qSharedPointerDynamicCast<T>(d->variables.value(name));
|
||||
SCASSERT(value.isNull() == false);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,31 +158,25 @@ public:
|
|||
*/
|
||||
void AddCurveLength(const quint32 &id, const quint32 &parentId = 0)
|
||||
{
|
||||
const VAbstractCurve *var = GeometricObject<const VAbstractCurve *>(id);
|
||||
AddVariable(var->name(), new TLength(id, parentId, var));
|
||||
const QSharedPointer<VAbstractCurve> var = GeometricObject<VAbstractCurve>(id);
|
||||
AddVariable(var->name(), new TLength(id, parentId, var.data()));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void AddVariable(const QString& name, T var)
|
||||
void AddVariable(const QString& name, T *var)
|
||||
{
|
||||
if(variables.contains(name))
|
||||
if(d->variables.contains(name))
|
||||
{
|
||||
if(variables.value(name)->GetType() == var->GetType())
|
||||
if(d->variables.value(name)->GetType() == var->GetType())
|
||||
{
|
||||
T v = dynamic_cast<T>(variables.value(name));
|
||||
SCASSERT(v != nullptr);
|
||||
*v = *var;
|
||||
delete var;
|
||||
d->variables[name].clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw VExceptionBadId(tr("Can't find object. Type mismatch."), name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
variables[name] = var;
|
||||
}
|
||||
d->variables[name] = QSharedPointer<T>(var);
|
||||
}
|
||||
|
||||
void UpdateGObject(quint32 id, VGObject* obj);
|
||||
|
@ -180,16 +201,16 @@ public:
|
|||
|
||||
void RemoveIncrement(const QString& name);
|
||||
|
||||
const QHash<quint32, VGObject*> *DataGObjects() const;
|
||||
const QHash<quint32, QSharedPointer<VGObject> > *DataGObjects() const;
|
||||
const QHash<quint32, VDetail> *DataDetails() const;
|
||||
const QHash<QString, VInternalVariable*> *DataVariables() const;
|
||||
const QHash<QString, QSharedPointer<VInternalVariable>> *DataVariables() const;
|
||||
|
||||
const QMap<QString, VMeasurement *> DataMeasurements() const;
|
||||
const QMap<QString, VIncrement *> DataIncrements() const;
|
||||
const QMap<QString, VLengthLine *> DataLengthLines() const;
|
||||
const QMap<QString, VSplineLength *> DataLengthSplines() const;
|
||||
const QMap<QString, VArcLength *> DataLengthArcs() const;
|
||||
const QMap<QString, VLineAngle *> DataAngleLines() const;
|
||||
const QMap<QString, QSharedPointer<VMeasurement> > DataMeasurements() const;
|
||||
const QMap<QString, QSharedPointer<VIncrement> > DataIncrements() const;
|
||||
const QMap<QString, QSharedPointer<VLengthLine> > DataLengthLines() const;
|
||||
const QMap<QString, QSharedPointer<VSplineLength> > DataLengthSplines() const;
|
||||
const QMap<QString, QSharedPointer<VArcLength> > DataLengthArcs() const;
|
||||
const QMap<QString, QSharedPointer<VLineAngle> > DataAngleLines() const;
|
||||
|
||||
|
||||
private:
|
||||
|
@ -197,23 +218,16 @@ private:
|
|||
* @brief _id current id. New object will have value +1. For empty class equal 0.
|
||||
*/
|
||||
static quint32 _id;
|
||||
qreal _size;
|
||||
QString sizeName;
|
||||
qreal _height;
|
||||
QString heightName;
|
||||
/**
|
||||
* @brief gObjects graphicals objects of pattern.
|
||||
*/
|
||||
QHash<quint32, VGObject*> gObjects;
|
||||
static qreal _size;
|
||||
static qreal _height;
|
||||
|
||||
/**
|
||||
* @brief variables container for measurements, increments, lines lengths, lines angles, arcs lengths, curve lengths
|
||||
*/
|
||||
QHash<QString, VInternalVariable*> variables;
|
||||
/**
|
||||
* @brief details container of details
|
||||
*/
|
||||
QHash<quint32, VDetail> details;
|
||||
QSharedDataPointer<VContainerData> d;
|
||||
|
||||
template <class T>
|
||||
uint qHash( const QSharedPointer<T> &p )
|
||||
{
|
||||
return qHash( p.data() );
|
||||
}
|
||||
|
||||
template <typename key, typename val>
|
||||
// cppcheck-suppress functionStatic
|
||||
|
@ -226,109 +240,7 @@ private:
|
|||
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);
|
||||
|
||||
template <typename T>
|
||||
const QMap<QString, T*> DataVar(const VarType &type) const;
|
||||
const QMap<QString, QSharedPointer<T> > DataVar(const VarType &type) const;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VContainer::ClearDetails()
|
||||
{
|
||||
details.clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetSize set value of size
|
||||
* @param size value of size
|
||||
*/
|
||||
inline void VContainer::SetSize(qreal size)
|
||||
{
|
||||
_size = size;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VContainer::SetSizeName(const QString &name)
|
||||
{
|
||||
sizeName = name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetGrowth set value of growth
|
||||
* @param height value of height
|
||||
*/
|
||||
inline void VContainer::SetHeight(qreal height)
|
||||
{
|
||||
_height = height;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VContainer::SetHeightName(const QString &name)
|
||||
{
|
||||
heightName = name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief size return size
|
||||
* @return size in mm
|
||||
*/
|
||||
inline qreal VContainer::size() const
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VContainer::SizeName() const
|
||||
{
|
||||
return sizeName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief height return height
|
||||
* @return height in pattern units
|
||||
*/
|
||||
inline qreal VContainer::height() const
|
||||
{
|
||||
return _height;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VContainer::HeightName() const
|
||||
{
|
||||
return heightName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief data container with datagObjects return container of gObjects
|
||||
* @return pointer on container of gObjects
|
||||
*/
|
||||
inline const QHash<quint32, VGObject *> *VContainer::DataGObjects() const
|
||||
{
|
||||
return &gObjects;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief data container with dataDetails return container of details
|
||||
* @return pointer on container of details
|
||||
*/
|
||||
inline const QHash<quint32, VDetail> *VContainer::DataDetails() const
|
||||
{
|
||||
return &details;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline const QHash<QString, VInternalVariable *> *VContainer::DataVariables() const
|
||||
{
|
||||
return &variables;
|
||||
}
|
||||
|
||||
#endif // VCONTAINER_H
|
||||
|
|
|
@ -269,19 +269,19 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
}
|
||||
case Tool::SplineTool:
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(tool.getId());
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
|
||||
SCASSERT(spl != nullptr);
|
||||
return QString(tr("Curve %1_%2")).arg(PointName(spl->GetP1().id())).arg(PointName(spl->GetP4().id()));
|
||||
}
|
||||
case Tool::ArcTool:
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(tool.getId());
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
|
||||
SCASSERT(arc != nullptr);
|
||||
return QString(tr("Arc with center in point %1")).arg(PointName(arc->GetCenter().id()));
|
||||
}
|
||||
case Tool::SplinePathTool:
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(tool.getId());
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
|
||||
SCASSERT(splPath != nullptr);
|
||||
const QVector<VSplinePoint> points = splPath->GetSplinePath();
|
||||
QString record;
|
||||
|
@ -333,7 +333,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
}
|
||||
case Tool::CutArcTool:
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(AttrUInt(domElem, VToolCutArc::AttrArc));
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, VToolCutArc::AttrArc));
|
||||
SCASSERT(arc != nullptr);
|
||||
return QString(tr("%1 - cut arc with center %2"))
|
||||
.arg(PointName(tool.getId()))
|
||||
|
@ -342,7 +342,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
case Tool::CutSplineTool:
|
||||
{
|
||||
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splineId);
|
||||
SCASSERT(spl != nullptr);
|
||||
return QString(tr("%1 - cut curve %2_%3"))
|
||||
.arg(PointName(tool.getId()))
|
||||
|
@ -352,7 +352,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
case Tool::CutSplinePathTool:
|
||||
{
|
||||
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId);
|
||||
SCASSERT(splPath != nullptr);
|
||||
const QVector<VSplinePoint> points = splPath->GetSplinePath();
|
||||
QString record;
|
||||
|
@ -440,7 +440,7 @@ void DialogHistory::ShowPoint()
|
|||
*/
|
||||
QString DialogHistory::PointName(quint32 pointId)
|
||||
{
|
||||
return data->GeometricObject<const VPointF *>(pointId)->name();
|
||||
return data->GeometricObject<VPointF>(pointId)->name();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -143,14 +143,13 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
|
|||
*/
|
||||
void DialogIncrements::FillMeasurements()
|
||||
{
|
||||
const QMap<QString, VMeasurement*> table = data->DataMeasurements();
|
||||
const QMap<QString, QSharedPointer<VMeasurement> > table = data->DataMeasurements();
|
||||
qint32 currentRow = -1;
|
||||
QMapIterator<QString, VMeasurement*> iMap(table);
|
||||
QMap<QString, QSharedPointer<VMeasurement> >::const_iterator iMap;
|
||||
ui->tableWidgetMeasurements->setRowCount ( table.size() );
|
||||
while (iMap.hasNext())
|
||||
for (iMap = table.constBegin(); iMap != table.constEnd(); ++iMap)
|
||||
{
|
||||
iMap.next();
|
||||
VMeasurement *m = iMap.value();
|
||||
QSharedPointer<VMeasurement> m = iMap.value();
|
||||
currentRow++;
|
||||
|
||||
QTableWidgetItem *item = new QTableWidgetItem(QString(iMap.key()));
|
||||
|
@ -220,14 +219,13 @@ void DialogIncrements::FillMeasurements()
|
|||
*/
|
||||
void DialogIncrements::FillIncrements()
|
||||
{
|
||||
const QMap<QString, VIncrement*> increments = data->DataIncrements();
|
||||
QMapIterator<QString, VIncrement*> i(increments);
|
||||
const QMap<QString, QSharedPointer<VIncrement> > increments = data->DataIncrements();
|
||||
QMap<QString, QSharedPointer<VIncrement> >::const_iterator i;
|
||||
QMap<quint32, QString> map;
|
||||
//Sorting QHash by id
|
||||
while (i.hasNext())
|
||||
for (i = increments.constBegin(); i != increments.constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
VIncrement *incr = i.value();
|
||||
QSharedPointer<VIncrement> incr = i.value();
|
||||
map.insert(incr->getId(), i.key());
|
||||
}
|
||||
|
||||
|
@ -236,7 +234,7 @@ void DialogIncrements::FillIncrements()
|
|||
while (iMap.hasNext())
|
||||
{
|
||||
iMap.next();
|
||||
VIncrement *incr = increments.value(iMap.value());
|
||||
QSharedPointer<VIncrement> incr = increments.value(iMap.value());
|
||||
currentRow++;
|
||||
ui->tableWidgetIncrement->setRowCount ( increments.size() );
|
||||
|
||||
|
@ -694,7 +692,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
|
|||
case 5: // VPattern::IncrementDescription
|
||||
{
|
||||
doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text());
|
||||
VIncrement *incr = data->GetVariable<VIncrement*>(itemName->text());
|
||||
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(itemName->text());
|
||||
incr->SetDescription(item->text());
|
||||
ui->tableWidgetIncrement->resizeColumnsToContents();
|
||||
ui->tableWidgetIncrement->resizeRowsToContents();
|
||||
|
@ -719,7 +717,7 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
|
|||
const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0);// name column
|
||||
QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2);
|
||||
|
||||
VMeasurement *measur = data->GetVariable<VMeasurement*>(qApp->VarFromUser(itemName->text()));
|
||||
QSharedPointer<VMeasurement> measur = data->GetVariable<VMeasurement>(qApp->VarFromUser(itemName->text()));
|
||||
const QString tag = measur->TagName();
|
||||
QDomNodeList list = m->elementsByTagName(tag);
|
||||
QDomElement domElement = list.at(0).toElement();
|
||||
|
|
|
@ -246,7 +246,7 @@ void DialogArc::ValChenged(int row)
|
|||
QListWidgetItem *item = ui->listWidget->item( row );
|
||||
if (ui->radioButtonAngleLine->isChecked())
|
||||
{
|
||||
qreal angle = *data->GetVariable<VLineAngle*>(item->text())->GetValue();
|
||||
qreal angle = *data->GetVariable<VLineAngle>(item->text())->GetValue();
|
||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(angle).arg(tr("Value of angle of line."));
|
||||
ui->labelDescription->setText(desc);
|
||||
return;
|
||||
|
@ -375,11 +375,10 @@ void DialogArc::ShowLineAngles()
|
|||
ui->listWidget->blockSignals(true);
|
||||
ui->listWidget->clear();
|
||||
ui->listWidget->blockSignals(false);
|
||||
const QMap<QString, VLineAngle *> lineAnglesTable = data->DataAngleLines();
|
||||
QMapIterator<QString, VLineAngle *> i(lineAnglesTable);
|
||||
while (i.hasNext())
|
||||
const QMap<QString, QSharedPointer<VLineAngle> > lineAnglesTable = data->DataAngleLines();
|
||||
QMap<QString, QSharedPointer<VLineAngle> >::const_iterator i;
|
||||
for (i = lineAnglesTable.constBegin(); i != lineAnglesTable.constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
QListWidgetItem *item = new QListWidgetItem(i.key());
|
||||
|
||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||
|
|
|
@ -141,25 +141,25 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
|
|||
{
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
||||
name = point->name();
|
||||
break;
|
||||
}
|
||||
case (Tool::NodeArc):
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(id);
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(id);
|
||||
name = arc->name();
|
||||
break;
|
||||
}
|
||||
case (Tool::NodeSpline):
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(id);
|
||||
name = spl->name();
|
||||
break;
|
||||
}
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(id);
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(id);
|
||||
name = splPath->name();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ void DialogEndLine::ShowDialog(bool click)
|
|||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(basePointId);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId);
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
|
|
|
@ -203,9 +203,9 @@ void DialogHeight::PointNameChanged()
|
|||
set.insert(p1LineId);
|
||||
set.insert(p2LineId);
|
||||
|
||||
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
|
||||
const VPointF *p1Line = data->GeometricObject<const VPointF *>(p1LineId);
|
||||
const VPointF *p2Line = data->GeometricObject<const VPointF *>(p2LineId);
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
const QSharedPointer<VPointF> p1Line = data->GeometricObject<VPointF>(p1LineId);
|
||||
const QSharedPointer<VPointF> p2Line = data->GeometricObject<VPointF>(p2LineId);
|
||||
|
||||
QColor color = okColor;
|
||||
if (set.size() != 3 || VAbstractTool::ClosestPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()),
|
||||
|
|
|
@ -233,10 +233,10 @@ void DialogLineIntersect::PointNameChanged()
|
|||
set.insert(p1Line2Id);
|
||||
set.insert(p2Line2Id);
|
||||
|
||||
const VPointF *p1Line1 = data->GeometricObject<const VPointF *>(p1Line1Id);
|
||||
const VPointF *p2Line1 = data->GeometricObject<const VPointF *>(p2Line1Id);
|
||||
const VPointF *p1Line2 = data->GeometricObject<const VPointF *>(p1Line2Id);
|
||||
const VPointF *p2Line2 = data->GeometricObject<const VPointF *>(p2Line2Id);
|
||||
const QSharedPointer<VPointF> p1Line1 = data->GeometricObject<VPointF>(p1Line1Id);
|
||||
const QSharedPointer<VPointF> p2Line1 = data->GeometricObject<VPointF>(p2Line1Id);
|
||||
const QSharedPointer<VPointF> p1Line2 = data->GeometricObject<VPointF>(p1Line2Id);
|
||||
const QSharedPointer<VPointF> p2Line2 = data->GeometricObject<VPointF>(p2Line2Id);
|
||||
|
||||
QLineF line1(p1Line1->toQPointF(), p2Line1->toQPointF());
|
||||
QLineF line2(p1Line2->toQPointF(), p2Line2->toQPointF());
|
||||
|
@ -299,10 +299,10 @@ void DialogLineIntersect::CheckState()
|
|||
*/
|
||||
bool DialogLineIntersect::CheckIntersecion()
|
||||
{
|
||||
const VPointF *p1L1 = data->GeometricObject<const VPointF *>(p1Line1);
|
||||
const VPointF *p2L1 = data->GeometricObject<const VPointF *>(p2Line1);
|
||||
const VPointF *p1L2 = data->GeometricObject<const VPointF *>(p1Line2);
|
||||
const VPointF *p2L2 = data->GeometricObject<const VPointF *>(p2Line2);
|
||||
const QSharedPointer<VPointF> p1L1 = data->GeometricObject<VPointF>(p1Line1);
|
||||
const QSharedPointer<VPointF> p2L1 = data->GeometricObject<VPointF>(p2Line1);
|
||||
const QSharedPointer<VPointF> p1L2 = data->GeometricObject<VPointF>(p1Line2);
|
||||
const QSharedPointer<VPointF> p2L2 = data->GeometricObject<VPointF>(p2Line2);
|
||||
|
||||
QLineF line1(p1L1->toQPointF(), p2L1->toQPointF());
|
||||
QLineF line2(p1L2->toQPointF(), p2L2->toQPointF());
|
||||
|
|
|
@ -96,7 +96,7 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
break;
|
||||
case 1:
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
||||
qint32 index = ui->comboBoxP4->findText(point->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
|
@ -105,8 +105,8 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
index = ui->comboBoxP1->currentIndex();
|
||||
quint32 p1Id = qvariant_cast<quint32>(ui->comboBoxP1->itemData(index));
|
||||
|
||||
QPointF p1 = data->GeometricObject<const VPointF *>(p1Id)->toQPointF();
|
||||
QPointF p4 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
QPointF p1 = data->GeometricObject<VPointF>(p1Id)->toQPointF();
|
||||
QPointF p4 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(QLineF(p1, p4).angle()));
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(QLineF(p4, p1).angle()));
|
||||
|
|
|
@ -138,7 +138,7 @@ void DialogSplinePath::currentPointChanged(int index)
|
|||
qint32 row = ui->listWidget->currentRow();
|
||||
QListWidgetItem *item = ui->listWidget->item( row );
|
||||
VSplinePoint p = qvariant_cast<VSplinePoint>(item->data(Qt::UserRole));
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
||||
p.SetP(*point);
|
||||
DataPoint(p.P().id(), p.KAsm1(), p.Angle1(), p.KAsm2(), p.Angle2());
|
||||
EnableFields();
|
||||
|
@ -225,7 +225,7 @@ void DialogSplinePath::UpdateList()
|
|||
*/
|
||||
void DialogSplinePath::NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(id);
|
||||
QListWidgetItem *item = new QListWidgetItem(point->name());
|
||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||
VSplinePoint p(*point, kAsm1, angle1, kAsm2, angle2);
|
||||
|
|
|
@ -117,18 +117,17 @@ void DialogTool::showEvent(QShowEvent *event)
|
|||
void DialogTool::FillComboBoxPoints(QComboBox *box) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject*> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject*> i(*objs);
|
||||
const QHash<quint32, QSharedPointer<VGObject> > *objs = data->DataGObjects();
|
||||
QMap<QString, quint32> list;
|
||||
while (i.hasNext())
|
||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::Point && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(i.key());
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(i.key());
|
||||
list[point->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -140,20 +139,19 @@ void DialogTool::FillComboBoxPoints(QComboBox *box) const
|
|||
void DialogTool::FillComboBoxArcs(QComboBox *box, ComboBoxCutArc cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject*> i(*objs);
|
||||
const QHash<quint32, QSharedPointer<VGObject> > *objs = data->DataGObjects();
|
||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||
QMap<QString, quint32> list;
|
||||
while (i.hasNext())
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if (cut == ComboBoxCutArc::CutArc)
|
||||
{
|
||||
if (i.key() != toolId + 1 && i.key() != toolId + 2)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::Arc && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(i.key());
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(i.key());
|
||||
list[arc->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -162,10 +160,10 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, ComboBoxCutArc cut) const
|
|||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::Arc && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(i.key());
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(i.key());
|
||||
list[arc->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -183,20 +181,19 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, ComboBoxCutArc cut) const
|
|||
void DialogTool::FillComboBoxSplines(QComboBox *box, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject*> i(*objs);
|
||||
const QHash<quint32, QSharedPointer<VGObject> > *objs = data->DataGObjects();
|
||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||
QMap<QString, quint32> list;
|
||||
while (i.hasNext())
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if (cut == ComboBoxCutSpline::CutSpline)
|
||||
{
|
||||
if (i.key() != toolId + 1 && i.key() != toolId + 2)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::Spline && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(i.key());
|
||||
list[spl->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -205,10 +202,10 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, ComboBoxCutSpline cut) cons
|
|||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::Spline && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(i.key());
|
||||
list[spl->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -226,20 +223,19 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, ComboBoxCutSpline cut) cons
|
|||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const QHash<quint32, VGObject *> *objs = data->DataGObjects();
|
||||
QHashIterator<quint32, VGObject *> i(*objs);
|
||||
const QHash<quint32, QSharedPointer<VGObject> > *objs = data->DataGObjects();
|
||||
QMap<QString, quint32> list;
|
||||
while (i.hasNext())
|
||||
QHash<quint32, QSharedPointer<VGObject> >::const_iterator i;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
i.next();
|
||||
if (cut == ComboBoxCutSpline::CutSpline)
|
||||
{
|
||||
if (i.key() != toolId + 1 && i.key() != toolId + 2)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::SplinePath && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(i.key());
|
||||
list[splPath->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -248,10 +244,10 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, ComboBoxCutSpline cut)
|
|||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
VGObject *obj = i.value();
|
||||
QSharedPointer<VGObject> obj = i.value();
|
||||
if (obj->getType() == GOType::SplinePath && obj->getMode() == Draw::Calculation)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(i.key());
|
||||
list[splPath->name()] = i.key();
|
||||
}
|
||||
}
|
||||
|
@ -563,8 +559,8 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
|
|||
bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip)
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
const VGObject *obj = data->GetGObject(id);
|
||||
SCASSERT(obj != nullptr);
|
||||
const QSharedPointer<VGObject> obj = data->GetGObject(id);
|
||||
SCASSERT(obj.isNull() == false);
|
||||
const qint32 index = box->findText(obj->name());
|
||||
if ( index != -1 )
|
||||
{ // -1 for not found
|
||||
|
@ -964,7 +960,7 @@ void DialogTool::ValChenged(int row)
|
|||
if (radioButtonStandardTable->isChecked())
|
||||
{
|
||||
QString name = qApp->VarFromUser(item->text());
|
||||
VMeasurement *stable = data->GetVariable<VMeasurement *>(name);
|
||||
QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
|
||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(name))
|
||||
.arg(stable->GetGuiText());
|
||||
labelDescription->setText(desc);
|
||||
|
@ -972,7 +968,7 @@ void DialogTool::ValChenged(int row)
|
|||
}
|
||||
if (radioButtonIncrements->isChecked())
|
||||
{
|
||||
VIncrement *incr = data->GetVariable<VIncrement *>(item->text());
|
||||
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(item->text());
|
||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(item->text()))
|
||||
.arg(incr->GetDescription());
|
||||
labelDescription->setText(desc);
|
||||
|
@ -981,7 +977,7 @@ void DialogTool::ValChenged(int row)
|
|||
if (radioButtonLengthLine->isChecked())
|
||||
{
|
||||
QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||
.arg(*data->GetVariable<VLengthLine*>(qApp->VarFromUser(item->text()))->GetValue())
|
||||
.arg(*data->GetVariable<VLengthLine>(qApp->VarFromUser(item->text()))->GetValue())
|
||||
.arg(tr("Line length"));
|
||||
labelDescription->setText(desc);
|
||||
return;
|
||||
|
@ -989,7 +985,7 @@ void DialogTool::ValChenged(int row)
|
|||
if (radioButtonLengthArc->isChecked())
|
||||
{
|
||||
QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||
.arg(*data->GetVariable<VArcLength *>(qApp->VarFromUser(item->text()))->GetValue())
|
||||
.arg(*data->GetVariable<VArcLength>(qApp->VarFromUser(item->text()))->GetValue())
|
||||
.arg(tr("Arc length"));
|
||||
labelDescription->setText(desc);
|
||||
return;
|
||||
|
@ -997,7 +993,7 @@ void DialogTool::ValChenged(int row)
|
|||
if (radioButtonLengthCurve->isChecked())
|
||||
{
|
||||
QString desc = QString("%1(%2) - %3").arg(item->text())
|
||||
.arg(*data->GetVariable<VSplineLength *>(qApp->VarFromUser(item->text()))->GetValue())
|
||||
.arg(*data->GetVariable<VSplineLength>(qApp->VarFromUser(item->text()))->GetValue())
|
||||
.arg(tr("Curve length"));
|
||||
labelDescription->setText(desc);
|
||||
return;
|
||||
|
|
|
@ -49,7 +49,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
{
|
||||
case (Tool::NodePoint):
|
||||
{
|
||||
const VPointF *point = data->GeometricObject<const VPointF*>(detail.at(i).getId());
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(detail.at(i).getId());
|
||||
points.append(point->toQPointF());
|
||||
if (detail.getSeamAllowance() == true)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
break;
|
||||
case (Tool::NodeArc):
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(detail.at(i).getId());
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(detail.at(i).getId());
|
||||
qreal len1 = GetLengthContour(points, arc->GetPoints());
|
||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc->GetPoints()));
|
||||
if (len1 <= lenReverse)
|
||||
|
@ -86,7 +86,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
break;
|
||||
case (Tool::NodeSpline):
|
||||
{
|
||||
const VSpline *spline = data->GeometricObject<const VSpline *>(detail.at(i).getId());
|
||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(detail.at(i).getId());
|
||||
qreal len1 = GetLengthContour(points, spline->GetPoints());
|
||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline->GetPoints()));
|
||||
if (len1 <= lenReverse)
|
||||
|
@ -110,7 +110,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer
|
|||
break;
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(detail.at(i).getId());
|
||||
const QSharedPointer<VSplinePath> splinePath = data->GeometricObject<VSplinePath>(detail.at(i).getId());
|
||||
qreal len1 = GetLengthContour(points, splinePath->GetPoints());
|
||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath->GetPoints()));
|
||||
if (len1 <= lenReverse)
|
||||
|
|
|
@ -205,7 +205,7 @@ void VAbstractSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const
|
||||
{
|
||||
const VAbstractCurve *curve = VAbstractTool::data.GeometricObject<const VAbstractCurve *>(id);
|
||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(id);
|
||||
QPainterPath path;
|
||||
path.addPath(curve->GetPath(direction));
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -119,7 +119,7 @@ void VToolAlongLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolAlongLine::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -142,7 +142,7 @@ void VToolAlongLine::AddToFile()
|
|||
*/
|
||||
void VToolAlongLine::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ void VToolAlongLine::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setFirstPointId(basePointId);
|
||||
|
@ -249,8 +249,8 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
QLineF line = QLineF(firstPoint->toQPointF(), secondPoint->toQPointF());
|
||||
|
||||
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
|
||||
|
|
|
@ -74,7 +74,7 @@ void VToolArc::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogArc *dialogTool = qobject_cast<DialogArc*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
dialogTool->SetCenter(arc->GetCenter().id());
|
||||
dialogTool->SetF1(arc->GetFormulaF1());
|
||||
dialogTool->SetF2(arc->GetFormulaF2());
|
||||
|
@ -132,7 +132,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra
|
|||
calcF1 = CheckFormula(_id, f1, data);
|
||||
calcF2 = CheckFormula(_id, f2, data);
|
||||
|
||||
VPointF c = *data->GeometricObject<const VPointF *>(center);
|
||||
VPointF c = *data->GeometricObject<VPointF>(center);
|
||||
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -189,7 +189,7 @@ void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolArc::AddToFile()
|
||||
{
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -208,7 +208,7 @@ void VToolArc::AddToFile()
|
|||
*/
|
||||
void VToolArc::RefreshDataInFile()
|
||||
{
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ void VToolArc::RefreshDataInFile()
|
|||
*/
|
||||
void VToolArc::RemoveReferens()
|
||||
{
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
doc->DecrementReferens(arc->GetCenter().id());
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void VToolBisector::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setFirstPointId(firstPointId);
|
||||
|
@ -173,9 +173,9 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
|
|||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
||||
const VPointF *thirdPoint = data->GeometricObject<const VPointF *>(thirdPointId);
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
const QSharedPointer<VPointF> thirdPoint = data->GeometricObject<VPointF>(thirdPointId);
|
||||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
|
@ -269,7 +269,7 @@ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolBisector::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -293,7 +293,7 @@ void VToolBisector::AddToFile()
|
|||
*/
|
||||
void VToolBisector::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ void VToolCut::RefreshGeometry()
|
|||
{
|
||||
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
|
||||
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -75,7 +75,7 @@ void VToolCutArc::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->setArcId(curveCutId);
|
||||
dialogTool->setPointName(point->name());
|
||||
|
@ -125,7 +125,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(arcId);
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(arcId);
|
||||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
|
@ -225,7 +225,7 @@ void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolCutArc::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -246,7 +246,7 @@ void VToolCutArc::AddToFile()
|
|||
*/
|
||||
void VToolCutArc::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
|
|||
void VToolCutArc::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||
PathDirection direction)
|
||||
{
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(curveId);
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(curveId);
|
||||
QPainterPath path;
|
||||
path.addPath(arc->GetPath(direction));
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -74,7 +74,7 @@ void VToolCutSpline::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->setSplineId(curveCutId);
|
||||
dialogTool->setPointName(point->name());
|
||||
|
@ -119,7 +119,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VSpline *spl = data->GeometricObject<const VSpline *>(splineId);
|
||||
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(splineId);
|
||||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
|
@ -223,7 +223,7 @@ void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolCutSpline::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -244,7 +244,7 @@ void VToolCutSpline::AddToFile()
|
|||
*/
|
||||
void VToolCutSpline::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
|
|||
void VToolCutSpline::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||
PathDirection direction)
|
||||
{
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(curveId);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(curveId);
|
||||
QPainterPath path;
|
||||
path.addPath(spl->GetPath(direction));
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -77,7 +77,7 @@ void VToolCutSplinePath::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->setSplinePathId(curveCutId);
|
||||
dialogTool->setPointName(point->name());
|
||||
|
@ -122,7 +122,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QSt
|
|||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(splinePathId);
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId);
|
||||
SCASSERT(splPath != nullptr);
|
||||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
@ -278,7 +278,7 @@ void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolCutSplinePath::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -299,7 +299,7 @@ void VToolCutSplinePath::AddToFile()
|
|||
*/
|
||||
void VToolCutSplinePath::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
|
|||
void VToolCutSplinePath::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||
PathDirection direction)
|
||||
{
|
||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(curveId);
|
||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(curveId);
|
||||
QPainterPath path;
|
||||
path.addPath(splPath->GetPath(direction));
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -73,7 +73,7 @@ void VToolEndLine::setDialog()
|
|||
dialog->setModal(true);
|
||||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setAngle(formulaAngle);
|
||||
|
@ -134,7 +134,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
||||
|
||||
line.setLength(qApp->toPixel(CheckFormula(_id, formulaLength, data)));
|
||||
|
@ -213,7 +213,7 @@ void VToolEndLine::ShowContextMenu(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolEndLine::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -236,7 +236,7 @@ void VToolEndLine::AddToFile()
|
|||
*/
|
||||
void VToolEndLine::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ void VToolHeight::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setBasePointId(basePointId);
|
||||
dialogTool->setP1LineId(p1LineId);
|
||||
|
@ -132,9 +132,9 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *basePoint = data->GeometricObject<const VPointF *>(basePointId);
|
||||
const VPointF *p1Line = data->GeometricObject<const VPointF *>(p1LineId);
|
||||
const VPointF *p2Line = data->GeometricObject<const VPointF *>(p2LineId);
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
const QSharedPointer<VPointF> p1Line = data->GeometricObject<VPointF>(p1LineId);
|
||||
const QSharedPointer<VPointF> p2Line = data->GeometricObject<VPointF>(p2LineId);
|
||||
|
||||
QPointF pHeight = FindPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()), basePoint->toQPointF());
|
||||
quint32 id = _id;
|
||||
|
@ -230,7 +230,7 @@ void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolHeight::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -254,7 +254,7 @@ void VToolHeight::AddToFile()
|
|||
*/
|
||||
void VToolHeight::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -53,8 +53,8 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
|
|||
this->typeLine = typeLine;
|
||||
ignoreFullUpdate = true;
|
||||
//Line
|
||||
const VPointF *first = data->GeometricObject<const VPointF *>(firstPoint);
|
||||
const VPointF *second = data->GeometricObject<const VPointF *>(secondPoint);
|
||||
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
|
||||
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
|
||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
|
@ -379,8 +379,8 @@ void VToolLine::RefreshGeometry()
|
|||
secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0");
|
||||
typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine);
|
||||
}
|
||||
const VPointF *first = VAbstractTool::data.GeometricObject<const VPointF *>(firstPoint);
|
||||
const VPointF *second = VAbstractTool::data.GeometricObject<const VPointF *>(secondPoint);
|
||||
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
||||
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ void VToolLineIntersect::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setP1Line1(p1Line1);
|
||||
dialogTool->setP2Line1(p2Line1);
|
||||
dialogTool->setP1Line2(p1Line2);
|
||||
|
@ -134,10 +134,10 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
|
|||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *p1Line1 = data->GeometricObject<const VPointF *>(p1Line1Id);
|
||||
const VPointF *p2Line1 = data->GeometricObject<const VPointF *>(p2Line1Id);
|
||||
const VPointF *p1Line2 = data->GeometricObject<const VPointF *>(p1Line2Id);
|
||||
const VPointF *p2Line2 = data->GeometricObject<const VPointF *>(p2Line2Id);
|
||||
const QSharedPointer<VPointF> p1Line1 = data->GeometricObject<VPointF>(p1Line1Id);
|
||||
const QSharedPointer<VPointF> p2Line1 = data->GeometricObject<VPointF>(p2Line1Id);
|
||||
const QSharedPointer<VPointF> p1Line2 = data->GeometricObject<VPointF>(p1Line2Id);
|
||||
const QSharedPointer<VPointF> p2Line2 = data->GeometricObject<VPointF>(p2Line2Id);
|
||||
|
||||
QLineF line1(p1Line1->toQPointF(), p2Line1->toQPointF());
|
||||
QLineF line2(p1Line2->toQPointF(), p2Line2->toQPointF());
|
||||
|
@ -200,7 +200,7 @@ void VToolLineIntersect::FullUpdateFromFile()
|
|||
p1Line2 = domElement.attribute(AttrP1Line2, "").toUInt();
|
||||
p2Line2 = domElement.attribute(AttrP2Line2, "").toUInt();
|
||||
}
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -211,7 +211,7 @@ void VToolLineIntersect::FullUpdateFromFile()
|
|||
void VToolLineIntersect::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -240,7 +240,7 @@ void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolLineIntersect::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -263,7 +263,7 @@ void VToolLineIntersect::AddToFile()
|
|||
*/
|
||||
void VToolLineIntersect::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -49,8 +49,8 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i
|
|||
{
|
||||
this->typeLine = typeLine;
|
||||
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
|
||||
QPointF point1 = data->GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
||||
QPointF point2 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
QPointF point1 = data->GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||
QPointF point2 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||
mainLine->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
|
@ -82,9 +82,9 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
|||
void VToolLinePoint::RefreshGeometry()
|
||||
{
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||
QPointF point = VDrawTool::data.GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
QPointF point = VDrawTool::data.GeometricObject<VPointF>(id)->toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||
mainLine->setLine(QLineF(basePoint - point, QPointF()));
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ void VToolNormal::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setAngle(angle);
|
||||
|
@ -135,8 +135,8 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
|
|||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
|
@ -248,7 +248,7 @@ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolNormal::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -272,7 +272,7 @@ void VToolNormal::AddToFile()
|
|||
*/
|
||||
void VToolNormal::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
|
|||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -79,7 +79,7 @@ void VToolPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
*/
|
||||
void VToolPoint::NameChangePosition(const QPointF &pos)
|
||||
{
|
||||
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
QPointF p = pos - this->pos();
|
||||
point->setMx(p.x());
|
||||
point->setMy(p.y());
|
||||
|
@ -155,7 +155,7 @@ void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
|||
void VToolPoint::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -72,7 +72,7 @@ void VToolPointOfContact::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfContact *dialogTool = qobject_cast<DialogPointOfContact*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setRadius(arcRadius);
|
||||
dialogTool->setCenter(center);
|
||||
dialogTool->setFirstPoint(firstPointId);
|
||||
|
@ -167,9 +167,9 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
|
|||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *centerP = data->GeometricObject<const VPointF *>(center);
|
||||
const VPointF *firstP = data->GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *secondP = data->GeometricObject<const VPointF *>(secondPointId);
|
||||
const QSharedPointer<VPointF> centerP = data->GeometricObject<VPointF>(center);
|
||||
const QSharedPointer<VPointF> firstP = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondP = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
||||
const qreal result = CheckFormula(_id, radius, data);
|
||||
|
||||
|
@ -226,7 +226,7 @@ void VToolPointOfContact::FullUpdateFromFile()
|
|||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -237,7 +237,7 @@ void VToolPointOfContact::FullUpdateFromFile()
|
|||
void VToolPointOfContact::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -266,7 +266,7 @@ void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
|
|||
*/
|
||||
void VToolPointOfContact::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -289,7 +289,7 @@ void VToolPointOfContact::AddToFile()
|
|||
*/
|
||||
void VToolPointOfContact::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ void VToolPointOfIntersection::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfIntersection *dialogTool = qobject_cast<DialogPointOfIntersection*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFirstPointId(firstPointId);
|
||||
dialogTool->setSecondPointId(secondPointId);
|
||||
dialogTool->setPointName(p->name());
|
||||
|
@ -124,8 +124,8 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
|
|||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
||||
QPointF point(firstPoint->x(), secondPoint->y());
|
||||
quint32 id = _id;
|
||||
|
@ -170,7 +170,7 @@ void VToolPointOfIntersection::FullUpdateFromFile()
|
|||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -209,7 +209,7 @@ void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *
|
|||
*/
|
||||
void VToolPointOfIntersection::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -230,7 +230,7 @@ void VToolPointOfIntersection::AddToFile()
|
|||
*/
|
||||
void VToolPointOfIntersection::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ void VToolShoulderPoint::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogShoulderPoint *dialogTool = qobject_cast<DialogShoulderPoint*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setP1Line(basePointId);
|
||||
|
@ -174,9 +174,9 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
|
|||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(p1Line);
|
||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(p2Line);
|
||||
const VPointF *shoulderPoint = data->GeometricObject<const VPointF *>(pShoulder);
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(p1Line);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(p2Line);
|
||||
const QSharedPointer<VPointF> shoulderPoint = data->GeometricObject<VPointF>(pShoulder);
|
||||
|
||||
const qreal result = CheckFormula(_id, formula, data);
|
||||
|
||||
|
@ -273,7 +273,7 @@ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolShoulderPoint::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -297,7 +297,7 @@ void VToolShoulderPoint::AddToFile()
|
|||
*/
|
||||
void VToolShoulderPoint::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ void VToolSinglePoint::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogSinglePoint *dialogTool = qobject_cast<DialogSinglePoint*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setData(p->name(), p->toQPointF());
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void VToolSinglePoint::AddToFile()
|
|||
{
|
||||
Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty");
|
||||
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement sPoint = doc->createElement(TagName);
|
||||
|
||||
// Create SPoint tag
|
||||
|
@ -125,7 +125,7 @@ void VToolSinglePoint::AddToFile()
|
|||
*/
|
||||
void VToolSinglePoint::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event
|
|||
*/
|
||||
void VToolSinglePoint::FullUpdateFromFile()
|
||||
{
|
||||
VPointF point = *VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
VPointF point = *VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
RefreshPointGeometry(point);
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ void VToolSinglePoint::ChangedActivDraw(const QString &newName)
|
|||
void VToolSinglePoint::SetFactor(qreal factor)
|
||||
{
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<const VPointF *>(id)));
|
||||
RefreshPointGeometry(*(VAbstractTool::data.GeometricObject<VPointF>(id)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -54,7 +54,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Sour
|
|||
this->setAcceptHoverEvents(true);
|
||||
this->setPath(ToolPath());
|
||||
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
VControlPointSpline *controlPoint1 = new VControlPointSpline(1, SplinePointPosition::FirstPoint, spl->GetP2(),
|
||||
spl->GetP1().toQPointF(), this);
|
||||
connect(controlPoint1, &VControlPointSpline::ControlPointChangePosition, this,
|
||||
|
@ -90,7 +90,7 @@ void VToolSpline::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
dialogTool->setP1(spl->GetP1().id());
|
||||
dialogTool->setP4(spl->GetP4().id());
|
||||
dialogTool->setAngle1(spl->GetAngle1());
|
||||
|
@ -154,8 +154,8 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui
|
|||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
|
||||
VPointF point4 = *data->GeometricObject<const VPointF *>(p4);
|
||||
VPointF point1 = *data->GeometricObject<VPointF>(p1);
|
||||
VPointF point4 = *data->GeometricObject<VPointF>(p4);
|
||||
VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -199,7 +199,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
|
|||
const QPointF &pos)
|
||||
{
|
||||
Q_UNUSED(indexSpline);
|
||||
const VSpline *spline = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spline = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
VSpline spl;
|
||||
if (position == SplinePointPosition::FirstPoint)
|
||||
{
|
||||
|
@ -210,7 +210,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
|
|||
spl = VSpline(spline->GetP1(), spline->GetP2(), pos, spline->GetP4(), spline->GetKcurve());
|
||||
}
|
||||
|
||||
MoveSpline *moveSpl = new MoveSpline(doc, spline, spl, id, this->scene());
|
||||
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
|
||||
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(moveSpl);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolSpline::AddToFile()
|
||||
{
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -253,7 +253,7 @@ void VToolSpline::AddToFile()
|
|||
*/
|
||||
void VToolSpline::RefreshDataInFile()
|
||||
{
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ void VToolSpline::RefreshDataInFile()
|
|||
*/
|
||||
void VToolSpline::RemoveReferens()
|
||||
{
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
doc->DecrementReferens(spl->GetP1().id());
|
||||
doc->DecrementReferens(spl->GetP4().id());
|
||||
}
|
||||
|
@ -288,8 +288,8 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
|
|||
DialogSpline *dialogTool = qobject_cast<DialogSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
|
||||
VPointF point1 = *VAbstractTool::data.GeometricObject<const VPointF *>(dialogTool->getP1());
|
||||
VPointF point4 = *VAbstractTool::data.GeometricObject<const VPointF *>(dialogTool->getP4());
|
||||
VPointF point1 = *VAbstractTool::data.GeometricObject<VPointF>(dialogTool->getP1());
|
||||
VPointF point4 = *VAbstractTool::data.GeometricObject<VPointF>(dialogTool->getP4());
|
||||
VSpline spl = VSpline (point1, point4, dialogTool->getAngle1(), dialogTool->getAngle2(),
|
||||
dialogTool->getKAsm1(), dialogTool->getKAsm2(), dialogTool->getKCurve());
|
||||
|
||||
|
@ -329,11 +329,11 @@ void VToolSpline::RefreshGeometry()
|
|||
this->setPath(ToolPath());
|
||||
}
|
||||
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
QPointF splinePoint = VAbstractTool::data.GeometricObject<const VPointF *>(spl->GetP1().id())->toQPointF();
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
QPointF splinePoint = VAbstractTool::data.GeometricObject<VPointF>(spl->GetP1().id())->toQPointF();
|
||||
QPointF controlPoint = spl->GetP2();
|
||||
emit RefreshLine(1, SplinePointPosition::FirstPoint, controlPoint, splinePoint);
|
||||
splinePoint = VAbstractTool::data.GeometricObject<const VPointF *>(spl->GetP4().id())->toQPointF();
|
||||
splinePoint = VAbstractTool::data.GeometricObject<VPointF>(spl->GetP4().id())->toQPointF();
|
||||
controlPoint = spl->GetP3();
|
||||
emit RefreshLine(1, SplinePointPosition::LastPoint, controlPoint, splinePoint);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
|
|||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(id);
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(id);
|
||||
for (qint32 i = 1; i<=splPath->Count(); ++i)
|
||||
{
|
||||
VSpline spl = splPath->GetSpline(i);
|
||||
|
@ -92,7 +92,7 @@ void VToolSplinePath::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
dialogTool->SetPath(*splPath);
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics
|
|||
void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position,
|
||||
const QPointF &pos)
|
||||
{
|
||||
VSplinePath oldSplPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
VSplinePath oldSplPath = *VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
VSplinePath newSplPath = oldSplPath;
|
||||
VSpline spl = newSplPath.GetSpline(indexSpline);
|
||||
if (position == SplinePointPosition::FirstPoint)
|
||||
|
@ -272,7 +272,7 @@ void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolSplinePath::AddToFile()
|
||||
{
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -299,7 +299,7 @@ void VToolSplinePath::RefreshDataInFile()
|
|||
qDebug()<<"Can't find element with id="<<id<<"in pattern file";
|
||||
return;
|
||||
}
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
RefreshSplinePath(splPath);
|
||||
doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve()));
|
||||
UpdatePathPoint(doc, domElement, splPath);
|
||||
|
@ -329,7 +329,7 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &
|
|||
*/
|
||||
void VToolSplinePath::RemoveReferens()
|
||||
{
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
VSplinePath splPath = *VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
for (qint32 i = 0; i < splPath.Count(); ++i)
|
||||
{
|
||||
doc->DecrementReferens(splPath.at(i).P().id());
|
||||
|
@ -367,7 +367,7 @@ void VToolSplinePath::RefreshGeometry()
|
|||
this->setPath(ToolPath());
|
||||
}
|
||||
|
||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
for (qint32 i = 1; i<=splPath->Count(); ++i)
|
||||
{
|
||||
VSpline spl = splPath->GetSpline(i);
|
||||
|
|
|
@ -73,7 +73,7 @@ void VToolTriangle::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogTriangle *dialogTool = qobject_cast<DialogTriangle*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const VPointF *p = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setAxisP1Id(axisP1Id);
|
||||
dialogTool->setAxisP2Id(axisP2Id);
|
||||
dialogTool->setFirstPointId(firstPointId);
|
||||
|
@ -133,10 +133,10 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
|
|||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const VPointF *axisP1 = data->GeometricObject<const VPointF *>(axisP1Id);
|
||||
const VPointF *axisP2 = data->GeometricObject<const VPointF *>(axisP2Id);
|
||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
||||
const QSharedPointer<VPointF> axisP1 = data->GeometricObject<VPointF>(axisP1Id);
|
||||
const QSharedPointer<VPointF> axisP2 = data->GeometricObject<VPointF>(axisP2Id);
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
||||
QPointF point = FindPoint(axisP1->toQPointF(), axisP2->toQPointF(), firstPoint->toQPointF(),
|
||||
secondPoint->toQPointF());
|
||||
|
@ -228,7 +228,7 @@ void VToolTriangle::FullUpdateFromFile()
|
|||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -269,7 +269,7 @@ void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
*/
|
||||
void VToolTriangle::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -292,7 +292,7 @@ void VToolTriangle::AddToFile()
|
|||
*/
|
||||
void VToolTriangle::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
|
|
@ -211,7 +211,7 @@ void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
*/
|
||||
void VNodeArc::RefreshGeometry()
|
||||
{
|
||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
QPainterPath path;
|
||||
path.addPath(arc->GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -64,7 +64,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo
|
|||
this->setBrush(QBrush(Qt::NoBrush));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
AddToFile();
|
||||
|
@ -142,7 +142,7 @@ void VNodePoint::RestoreNode()
|
|||
*/
|
||||
void VNodePoint::FullUpdateFromFile()
|
||||
{
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -151,7 +151,7 @@ void VNodePoint::FullUpdateFromFile()
|
|||
*/
|
||||
void VNodePoint::AddToFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->createElement(TagName);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
|
@ -173,7 +173,7 @@ void VNodePoint::AddToFile()
|
|||
*/
|
||||
void VNodePoint::RefreshDataInFile()
|
||||
{
|
||||
const VPointF *point = VAbstractTool::data.GeometricObject<const VPointF *>(id);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
|
@ -230,7 +230,7 @@ void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
*/
|
||||
void VNodePoint::NameChangePosition(const QPointF &pos)
|
||||
{
|
||||
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
QPointF p = pos - this->pos();
|
||||
point->setMx(p.x());
|
||||
point->setMy(p.y());
|
||||
|
|
|
@ -214,7 +214,7 @@ void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
*/
|
||||
void VNodeSpline::RefreshGeometry()
|
||||
{
|
||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
QPainterPath path;
|
||||
path.addPath(spl->GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -86,7 +86,7 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3
|
|||
{
|
||||
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
||||
doc->AddTool(id, splPath);
|
||||
const VSplinePath *path = data->GeometricObject<const VSplinePath *>(id);
|
||||
const QSharedPointer<VSplinePath> path = data->GeometricObject<VSplinePath>(id);
|
||||
const QVector<VSplinePoint> *points = path->GetPoint();
|
||||
for (qint32 i = 0; i<points->size(); ++i)
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
*/
|
||||
void VNodeSplinePath::RefreshGeometry()
|
||||
{
|
||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
QPainterPath path;
|
||||
path.addPath(splPath->GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
|
|
|
@ -74,6 +74,8 @@ inline VContainer VDataTool::getData() const
|
|||
*/
|
||||
inline void VDataTool::setData(const VContainer *value)
|
||||
{
|
||||
data.ClearVariables();
|
||||
data.ClearGObjects();
|
||||
data = *value;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
static quint32 CreateNode(VContainer *data, const quint32 &id)
|
||||
{
|
||||
//We can't use exist object. Need create new.
|
||||
T *node = new T(*data->GeometricObject<const T *>(id));
|
||||
T *node = new T(*data->GeometricObject<T>(id).data());
|
||||
node->setMode(Draw::Modeling);
|
||||
return data->AddGObject(node);
|
||||
}
|
||||
|
|
|
@ -104,9 +104,9 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
|||
}
|
||||
else
|
||||
{
|
||||
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
||||
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
||||
point->setMode(Draw::Modeling);
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
idObject = data->AddGObject(point);
|
||||
VPointF *point1 = new VPointF(*point);
|
||||
|
@ -124,13 +124,13 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
|||
}
|
||||
else
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(det.at(i).getId());
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
||||
VPointF p1 = VPointF(arc->GetP1(), "A", 0, 0);
|
||||
BiasRotatePoint(&p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
VPointF p2 = VPointF(arc->GetP2(), "A", 0, 0);
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
VPointF *center = new VPointF(arc->GetCenter());
|
||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
|
||||
QLineF l1(center->toQPointF(), p1.toQPointF());
|
||||
|
@ -160,20 +160,20 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
|||
}
|
||||
else
|
||||
{
|
||||
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
||||
|
||||
VPointF *p1 = new VPointF(spline->GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
//quint32 idP1 = data->AddGObject(p1);
|
||||
|
||||
VPointF p2 = VPointF(spline->GetP2());
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
|
||||
VPointF p3 = VPointF(spline->GetP3());
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
|
||||
VPointF *p4 = new VPointF(spline->GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
//quint32 idP4 = data->AddGObject(p4);
|
||||
|
||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||
|
@ -197,7 +197,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
|||
{
|
||||
VSplinePath *path = new VSplinePath();
|
||||
path->setMode(Draw::Modeling);
|
||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||
const QSharedPointer<VSplinePath> splinePath = data->GeometricObject<VSplinePath>(det.at(i).getId());
|
||||
qint32 k = splinePath->getMaxCountPoints();
|
||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||
{
|
||||
|
@ -206,21 +206,21 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer
|
|||
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
||||
|
||||
VPointF *p1 = new VPointF(spline.GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
//quint32 idP1 = data->AddGObject(p1);
|
||||
--k;
|
||||
|
||||
VPointF p2 = VPointF(spline.GetP2());
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
|
||||
VPointF p3 = VPointF(spline.GetP3());
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
|
||||
VPointF *p4 = new VPointF(spline.GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
//quint32 idP4 = data->AddGObject(p4);
|
||||
--k;
|
||||
|
@ -278,9 +278,9 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
{
|
||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
||||
{
|
||||
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
||||
VPointF *point = new VPointF(*data->GeometricObject<VPointF>(det.at(i).getId()));
|
||||
point->setMode(Draw::Modeling);
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
++idCount;
|
||||
data->UpdateGObject(idDetail+idCount, point);
|
||||
|
||||
|
@ -292,13 +292,13 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
{
|
||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
||||
{
|
||||
const VArc *arc = data->GeometricObject<const VArc *>(det.at(i).getId());
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(det.at(i).getId());
|
||||
VPointF p1 = VPointF(arc->GetP1());
|
||||
BiasRotatePoint(&p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
VPointF p2 = VPointF(arc->GetP2());
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
VPointF *center = new VPointF(arc->GetCenter());
|
||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
|
||||
QLineF l1(center->toQPointF(), p1.toQPointF());
|
||||
|
@ -320,21 +320,21 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
{
|
||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
||||
{
|
||||
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
||||
const QSharedPointer<VSpline> spline = data->GeometricObject<VSpline>(det.at(i).getId());
|
||||
|
||||
VPointF *p1 = new VPointF(spline->GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
++idCount;
|
||||
data->UpdateGObject(idDetail+idCount, p1);
|
||||
|
||||
VPointF p2 = VPointF(spline->GetP2());
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
|
||||
VPointF p3 = VPointF(spline->GetP3());
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
|
||||
VPointF *p4 = new VPointF(spline->GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(), angle);
|
||||
++idCount;
|
||||
data->UpdateGObject(idDetail+idCount, p4);
|
||||
|
||||
|
@ -354,7 +354,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
{
|
||||
VSplinePath *path = new VSplinePath();
|
||||
path->setMode(Draw::Modeling);
|
||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||
const QSharedPointer<VSplinePath> splinePath = data->GeometricObject<VSplinePath>(det.at(i).getId());
|
||||
SCASSERT(splinePath != nullptr);
|
||||
qint32 k = splinePath->getMaxCountPoints();
|
||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||
|
@ -364,22 +364,22 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data,
|
|||
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
||||
|
||||
VPointF *p1 = new VPointF(spline.GetP1());
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
++idCount;
|
||||
data->UpdateGObject(idDetail+idCount, p1);
|
||||
--k;
|
||||
|
||||
VPointF p2 = VPointF(spline.GetP2());
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
|
||||
VPointF p3 = VPointF(spline.GetP3());
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
|
||||
VPointF *p4 = new VPointF(spline.GetP4());
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<VPointF>(pRotate)->toQPointF(),
|
||||
angle);
|
||||
++idCount;
|
||||
data->UpdateGObject(idDetail+idCount, p4);
|
||||
|
@ -617,8 +617,8 @@ void VToolUnionDetails::PointsOnEdge(const VDetail &d, const quint32 &index, VPo
|
|||
VNodeDetail det2p1;
|
||||
VNodeDetail det2p2;
|
||||
d.NodeOnEdge(index, det2p1, det2p2);
|
||||
p1 = VPointF(*data->GeometricObject<const VPointF *>(det2p1.getId()));
|
||||
p2 = VPointF(*data->GeometricObject<const VPointF *>(det2p2.getId()));
|
||||
p1 = VPointF(*data->GeometricObject<VPointF>(det2p1.getId()));
|
||||
p2 = VPointF(*data->GeometricObject<VPointF>(det2p2.getId()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -65,7 +65,7 @@ void VisToolAlongLine::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id <= 0)
|
||||
|
@ -74,7 +74,7 @@ void VisToolAlongLine::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
|
|
@ -47,7 +47,7 @@ void VisToolArc::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(arcCenter, first->toQPointF(), supportColor);
|
||||
|
||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false && f1 >= 0 && f2 >= 0 && qFuzzyCompare(1 + f1, 1 + f2) == false)
|
||||
|
|
|
@ -73,7 +73,7 @@ void VisToolBisector::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id <= 0)
|
||||
|
@ -82,7 +82,7 @@ void VisToolBisector::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
@ -93,7 +93,7 @@ void VisToolBisector::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *third = Visualization::data->GeometricObject<const VPointF *>(point3Id);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(point3Id);
|
||||
DrawPoint(line2P2, third->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||
|
|
|
@ -53,7 +53,7 @@ void VisToolCutArc::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VArc *arc = Visualization::data->GeometricObject<const VArc *>(point1Id);
|
||||
const QSharedPointer<VArc> arc = Visualization::data->GeometricObject<VArc>(point1Id);
|
||||
DrawPath(this, arc->GetPath(PathDirection::Show), supportColor, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
||||
|
|
|
@ -50,7 +50,7 @@ VisToolEndLine::~VisToolEndLine()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolEndLine::RefreshGeometry()
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
QLineF line;
|
||||
if (qFuzzyCompare(1 + length, 1 + 0))
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ void VisToolHeight::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(base_point, first->toQPointF(), supportColor);
|
||||
|
||||
if (lineP1Id <= 0)
|
||||
|
@ -62,7 +62,7 @@ void VisToolHeight::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(lineP1Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP1Id);
|
||||
DrawPoint(lineP1, second->toQPointF(), supportColor);
|
||||
|
||||
QLineF base_line;
|
||||
|
@ -73,7 +73,7 @@ void VisToolHeight::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *third = Visualization::data->GeometricObject<const VPointF *>(lineP2Id);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(lineP2Id);
|
||||
DrawPoint(lineP2, third->toQPointF(), supportColor);
|
||||
|
||||
base_line = QLineF(second->toQPointF(), third->toQPointF());
|
||||
|
|
|
@ -46,14 +46,14 @@ VisToolLine::~VisToolLine()
|
|||
void VisToolLine::RefreshGeometry()
|
||||
{
|
||||
QLineF line;
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
if (point2Id == 0)
|
||||
{
|
||||
line = QLineF(first->toQPointF(), Visualization::scenePos);
|
||||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
line = QLineF(first->toQPointF(), second->toQPointF());
|
||||
}
|
||||
DrawLine(this, line, mainColor, lineStyle);
|
||||
|
|
|
@ -54,7 +54,7 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||
|
||||
if (line1P2Id <= 0)
|
||||
|
@ -63,7 +63,7 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(line1P2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(line1P2Id);
|
||||
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
@ -74,7 +74,7 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *third = Visualization::data->GeometricObject<const VPointF *>(line2P1Id);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(line2P1Id);
|
||||
DrawPoint(line2P1, third->toQPointF(), supportColor);
|
||||
|
||||
if (line2P2Id <= 0)
|
||||
|
@ -92,7 +92,7 @@ void VisToolLineIntersect::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *forth = Visualization::data->GeometricObject<const VPointF *>(line2P2Id);
|
||||
const QSharedPointer<VPointF> forth = Visualization::data->GeometricObject<VPointF>(line2P2Id);
|
||||
DrawPoint(line2P2, forth->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(this, QLineF(third->toQPointF(), forth->toQPointF()), supportColor);
|
||||
|
|
|
@ -53,7 +53,7 @@ void VisToolNormal::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id <= 0)
|
||||
|
@ -67,7 +67,7 @@ void VisToolNormal::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
|
||||
QLineF line_mouse(first->toQPointF(), second->toQPointF());
|
||||
|
|
|
@ -52,7 +52,7 @@ void VisToolPointOfContact::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
|
||||
if (lineP2Id <= 0)
|
||||
|
@ -61,7 +61,7 @@ void VisToolPointOfContact::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(lineP2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP2Id);
|
||||
DrawPoint(lineP2, second->toQPointF(), supportColor);
|
||||
DrawLine(this, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
||||
|
@ -71,7 +71,7 @@ void VisToolPointOfContact::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *third = Visualization::data->GeometricObject<const VPointF *>(radiusId);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(radiusId);
|
||||
DrawPoint(arc_point, third->toQPointF(), supportColor);
|
||||
|
||||
if (qFuzzyCompare(1 + radius, 1 + 0) == false)
|
||||
|
|
|
@ -50,7 +50,7 @@ void VisToolPointOfIntersection::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(axisP1, first->toQPointF(), supportColor);
|
||||
|
||||
QLineF axisL1 = Axis(first->toQPointF(), 90);
|
||||
|
@ -63,7 +63,7 @@ void VisToolPointOfIntersection::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(axisP2, second->toQPointF(), supportColor);
|
||||
axisL2 = Axis(second->toQPointF(), 180);
|
||||
ShowIntersection(axisL1, axisL2);
|
||||
|
|
|
@ -55,7 +55,7 @@ void VisToolShoulderPoint::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||
|
||||
if (lineP1Id <= 0)
|
||||
|
@ -64,7 +64,7 @@ void VisToolShoulderPoint::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(lineP1Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(lineP1Id);
|
||||
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
@ -75,7 +75,7 @@ void VisToolShoulderPoint::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *third = Visualization::data->GeometricObject<const VPointF *>(lineP2Id);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(lineP2Id);
|
||||
DrawPoint(line2P2, third->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||
|
|
|
@ -52,7 +52,7 @@ void VisToolSpline::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(lineP1, first->toQPointF(), supportColor);
|
||||
|
||||
if (point4Id <= 0)
|
||||
|
@ -61,7 +61,7 @@ void VisToolSpline::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point4Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point4Id);
|
||||
DrawPoint(lineP4, second->toQPointF(), supportColor);
|
||||
|
||||
if (qFuzzyCompare(angle1, EMPTY_ANGLE) || qFuzzyCompare(angle2, EMPTY_ANGLE))
|
||||
|
|
|
@ -58,7 +58,7 @@ void VisToolTriangle::RefreshGeometry()
|
|||
{
|
||||
if (point1Id > 0)
|
||||
{
|
||||
const VPointF *first = Visualization::data->GeometricObject<const VPointF *>(point1Id);
|
||||
const QSharedPointer<VPointF> first = Visualization::data->GeometricObject<VPointF>(point1Id);
|
||||
DrawPoint(axisP1, first->toQPointF(), supportColor);
|
||||
|
||||
if (point2Id <= 0)
|
||||
|
@ -67,7 +67,7 @@ void VisToolTriangle::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *second = Visualization::data->GeometricObject<const VPointF *>(point2Id);
|
||||
const QSharedPointer<VPointF> second = Visualization::data->GeometricObject<VPointF>(point2Id);
|
||||
DrawPoint(axisP2, second->toQPointF(), supportColor);
|
||||
|
||||
DrawAimedAxis(axis, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||
|
@ -78,7 +78,7 @@ void VisToolTriangle::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *third = Visualization::data->GeometricObject<const VPointF *>(hypotenuseP1Id);
|
||||
const QSharedPointer<VPointF> third = Visualization::data->GeometricObject<VPointF>(hypotenuseP1Id);
|
||||
DrawPoint(hypotenuseP1, third->toQPointF(), supportColor);
|
||||
|
||||
if (hypotenuseP2Id <= 0)
|
||||
|
@ -94,7 +94,7 @@ void VisToolTriangle::RefreshGeometry()
|
|||
}
|
||||
else
|
||||
{
|
||||
const VPointF *forth = Visualization::data->GeometricObject<const VPointF *>(hypotenuseP2Id);
|
||||
const QSharedPointer<VPointF> forth = Visualization::data->GeometricObject<VPointF>(hypotenuseP2Id);
|
||||
DrawPoint(hypotenuseP2, forth->toQPointF(), supportColor);
|
||||
|
||||
DrawLine(this, QLineF(third->toQPointF(), forth->toQPointF()), supportColor, Qt::DashLine);
|
||||
|
|
|
@ -431,7 +431,7 @@ void VPattern::setCurrentData()
|
|||
if (tools.size() > 0)
|
||||
{
|
||||
const VDataTool *vTool = tools.value(id);
|
||||
data->setData(vTool->getData());
|
||||
*data = vTool->getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1340,7 +1340,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
PointsCommonAttributes(domElement, id, mx, my);
|
||||
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
||||
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
||||
const VPointF *point = data->GeometricObject<const VPointF *>(idObject );
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(idObject );
|
||||
data->UpdateGObject(id, new VPointF(point->toQPointF(), point->name(), mx, my, idObject,
|
||||
Draw::Modeling));
|
||||
VNodePoint::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
||||
|
@ -1684,7 +1684,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
|||
const qreal angle = GetParametrDouble(element, VAbstractTool::AttrAngle, "0");
|
||||
const qreal kAsm2 = GetParametrDouble(element, VAbstractTool::AttrKAsm2, "1.0");
|
||||
const quint32 pSpline = GetParametrUInt(element, VAbstractTool::AttrPSpline, "0");
|
||||
const VPointF p = *data->GeometricObject<const VPointF *>(pSpline);
|
||||
const VPointF p = *data->GeometricObject<VPointF>(pSpline);
|
||||
|
||||
QLineF line(0, 0, 100, 0);
|
||||
line.setAngle(angle+180);
|
||||
|
@ -1712,7 +1712,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
|||
try
|
||||
{
|
||||
SplinesCommonAttributes(domElement, id, idObject, idTool);
|
||||
VSpline *spl = new VSpline(*data->GeometricObject<const VSpline *>(idObject));
|
||||
VSpline *spl = new VSpline(*data->GeometricObject<VSpline>(idObject));
|
||||
spl->setIdObject(idObject);
|
||||
spl->setMode(Draw::Modeling);
|
||||
data->UpdateGObject(id, spl);
|
||||
|
@ -1729,7 +1729,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
|||
try
|
||||
{
|
||||
SplinesCommonAttributes(domElement, id, idObject, idTool);
|
||||
VSplinePath *path = new VSplinePath(*data->GeometricObject<const VSplinePath *>(idObject));
|
||||
VSplinePath *path = new VSplinePath(*data->GeometricObject<VSplinePath>(idObject));
|
||||
path->setIdObject(idObject);
|
||||
path->setMode(Draw::Modeling);
|
||||
data->UpdateGObject(id, path);
|
||||
|
@ -1809,7 +1809,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
|
|||
ToolsCommonAttributes(domElement, id);
|
||||
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0");
|
||||
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0");
|
||||
VArc *arc = new VArc(*data->GeometricObject<const VArc *>(idObject));
|
||||
VArc *arc = new VArc(*data->GeometricObject<VArc>(idObject));
|
||||
arc->setIdObject(idObject);
|
||||
arc->setMode(Draw::Modeling);
|
||||
data->UpdateGObject(id, arc);
|
||||
|
|
Loading…
Reference in New Issue
Block a user