Fix memory leak.
--HG-- branch : feature
This commit is contained in:
parent
eddcaf8ff2
commit
92e0541b12
|
@ -35,9 +35,9 @@ qint64 VContainer::_id = 0;
|
||||||
|
|
||||||
VContainer::VContainer()
|
VContainer::VContainer()
|
||||||
:base(QHash<QString, qint32>()), gObjects(QHash<qint64, VGObject *>()),
|
:base(QHash<QString, qint32>()), gObjects(QHash<qint64, VGObject *>()),
|
||||||
standartTable(QHash<QString, VStandartTableRow *>()), incrementTable(QHash<QString, VIncrementTableRow *>()),
|
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
|
||||||
lengthLines(QHash<QString, qreal>()),lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
lengthLines(QHash<QString, qreal>()),lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
||||||
lengthArcs(QHash<QString, qreal>()), details(QHash<qint64, VDetail *>())
|
lengthArcs(QHash<QString, qreal>()), details(QHash<qint64, VDetail>())
|
||||||
{
|
{
|
||||||
SetSize(500);
|
SetSize(500);
|
||||||
SetGrowth(1760);
|
SetGrowth(1760);
|
||||||
|
@ -52,13 +52,19 @@ VContainer &VContainer::operator =(const VContainer &data)
|
||||||
|
|
||||||
VContainer::VContainer(const VContainer &data)
|
VContainer::VContainer(const VContainer &data)
|
||||||
:base(QHash<QString, qint32>()), gObjects(QHash<qint64, VGObject *>()),
|
:base(QHash<QString, qint32>()), gObjects(QHash<qint64, VGObject *>()),
|
||||||
standartTable(QHash<QString, VStandartTableRow *>()), incrementTable(QHash<QString, VIncrementTableRow *>()),
|
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
|
||||||
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
|
||||||
lengthArcs(QHash<QString, qreal>()), details(QHash<qint64, VDetail *>())
|
lengthArcs(QHash<QString, qreal>()), details(QHash<qint64, VDetail>())
|
||||||
{
|
{
|
||||||
setData(data);
|
setData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VContainer::~VContainer()
|
||||||
|
{
|
||||||
|
qDeleteAll(gObjects);
|
||||||
|
gObjects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void VContainer::setData(const VContainer &data)
|
void VContainer::setData(const VContainer &data)
|
||||||
{
|
{
|
||||||
base = *data.DataBase();
|
base = *data.DataBase();
|
||||||
|
@ -73,37 +79,36 @@ void VContainer::setData(const VContainer &data)
|
||||||
i.next();
|
i.next();
|
||||||
switch(i.value()->getType())
|
switch(i.value()->getType())
|
||||||
{
|
{
|
||||||
case(GObject::Arc):
|
case(GObject::Arc):
|
||||||
{
|
{
|
||||||
VArc *arc = new VArc(*data.GeometricObject<const VArc *>(i.key()));
|
VArc *arc = new VArc(*data.GeometricObject<const VArc *>(i.key()));
|
||||||
Q_ASSERT(arc != 0);
|
Q_ASSERT(arc != 0);
|
||||||
gObjects.insert(i.key(), arc);
|
UpdateGObject(i.key(), arc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(GObject::Point):
|
case(GObject::Point):
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*data.GeometricObject<const VPointF *>(i.key()));
|
VPointF *point = new VPointF(*data.GeometricObject<const VPointF *>(i.key()));
|
||||||
Q_ASSERT(point != 0);
|
Q_ASSERT(point != 0);
|
||||||
gObjects.insert(i.key(), point);
|
UpdateGObject(i.key(), point);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(GObject::Spline):
|
case(GObject::Spline):
|
||||||
{
|
{
|
||||||
VSpline *spl = new VSpline(*data.GeometricObject<const VSpline *>(i.key()));
|
VSpline *spl = new VSpline(*data.GeometricObject<const VSpline *>(i.key()));
|
||||||
Q_ASSERT(spl != 0);
|
Q_ASSERT(spl != 0);
|
||||||
gObjects.insert(i.key(), spl);
|
UpdateGObject(i.key(), spl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(GObject::SplinePath):
|
case(GObject::SplinePath):
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath(*data.GeometricObject<const VSplinePath *>(i.key()));
|
VSplinePath *path = new VSplinePath(*data.GeometricObject<const VSplinePath *>(i.key()));
|
||||||
Q_ASSERT(path != 0);
|
Q_ASSERT(path != 0);
|
||||||
gObjects.insert(i.key(), path);
|
UpdateGObject(i.key(), path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//gObjects = *data.DataGObjects();
|
|
||||||
standartTable = *data.DataStandartTable();
|
standartTable = *data.DataStandartTable();
|
||||||
incrementTable = *data.DataIncrementTable();
|
incrementTable = *data.DataIncrementTable();
|
||||||
lengthLines = *data.DataLengthLines();
|
lengthLines = *data.DataLengthLines();
|
||||||
|
@ -144,16 +149,16 @@ val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const VStandartTableRow *VContainer::GetStandartTableCell(const QString &name) const
|
const VStandartTableRow VContainer::GetStandartTableCell(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(name.isEmpty()==false);
|
Q_ASSERT(name.isEmpty()==false);
|
||||||
return GetObject(standartTable, name);
|
return GetVariable(standartTable, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const VIncrementTableRow *VContainer::GetIncrementTableRow(const QString& name) const
|
const VIncrementTableRow VContainer::GetIncrementTableRow(const QString& name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(name.isEmpty()==false);
|
Q_ASSERT(name.isEmpty()==false);
|
||||||
return GetObject(incrementTable, name);
|
return GetVariable(incrementTable, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal VContainer::GetLine(const QString &name) const
|
qreal VContainer::GetLine(const QString &name) const
|
||||||
|
@ -180,9 +185,9 @@ qreal VContainer::GetLineAngle(const QString &name) const
|
||||||
return GetVariable(lineAngles, name);
|
return GetVariable(lineAngles, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const VDetail *VContainer::GetDetail(qint64 id) const
|
const VDetail VContainer::GetDetail(qint64 id) const
|
||||||
{
|
{
|
||||||
return GetObject(details, id);
|
return GetVariable(details, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::AddGObject(VGObject *obj)
|
qint64 VContainer::AddGObject(VGObject *obj)
|
||||||
|
@ -190,9 +195,16 @@ qint64 VContainer::AddGObject(VGObject *obj)
|
||||||
return AddObject(gObjects, obj);
|
return AddObject(gObjects, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::AddDetail(VDetail *detail)
|
qint64 VContainer::AddDetail(VDetail detail)
|
||||||
{
|
{
|
||||||
return AddObject(details, detail);
|
qint64 id = getNextId();
|
||||||
|
details[id] = detail;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VContainer::AddIncrementTableRow(const QString &name, VIncrementTableRow row)
|
||||||
|
{
|
||||||
|
incrementTable[name] = row;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 VContainer::getNextId()
|
qint64 VContainer::getNextId()
|
||||||
|
@ -211,100 +223,100 @@ void VContainer::UpdateId(qint64 newId)
|
||||||
|
|
||||||
QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
||||||
{
|
{
|
||||||
const VDetail *detail = GetDetail(idDetail);
|
VDetail detail = GetDetail(idDetail);
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
QVector<QPointF> pointsEkv;
|
QVector<QPointF> pointsEkv;
|
||||||
for (ptrdiff_t i = 0; i< detail->CountNode(); ++i)
|
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
switch (detail->at(i).getTypeTool())
|
switch (detail.at(i).getTypeTool())
|
||||||
{
|
{
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
const VPointF *point = GeometricObject<const VPointF*>(detail->at(i).getId());
|
const VPointF *point = GeometricObject<const VPointF*>(detail.at(i).getId());
|
||||||
points.append(point->toQPointF());
|
points.append(point->toQPointF());
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
QPointF pEkv = point->toQPointF();
|
QPointF pEkv = point->toQPointF();
|
||||||
pEkv.setX(pEkv.x()+detail->at(i).getMx());
|
pEkv.setX(pEkv.x()+detail.at(i).getMx());
|
||||||
pEkv.setY(pEkv.y()+detail->at(i).getMy());
|
pEkv.setY(pEkv.y()+detail.at(i).getMy());
|
||||||
pointsEkv.append(pEkv);
|
pointsEkv.append(pEkv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
{
|
{
|
||||||
const VArc *arc = GeometricObject<const VArc *>(detail->at(i).getId());
|
const VArc *arc = GeometricObject<const VArc *>(detail.at(i).getId());
|
||||||
qreal len1 = GetLengthContour(points, arc->GetPoints());
|
qreal len1 = GetLengthContour(points, arc->GetPoints());
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc->GetPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc->GetPoints()));
|
||||||
if (len1 <= lenReverse)
|
if (len1 <= lenReverse)
|
||||||
{
|
{
|
||||||
points << arc->GetPoints();
|
points << arc->GetPoints();
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
pointsEkv << biasPoints(arc->GetPoints(), detail->at(i).getMx(), detail->at(i).getMy());
|
pointsEkv << biasPoints(arc->GetPoints(), detail.at(i).getMx(), detail.at(i).getMy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
points << GetReversePoint(arc->GetPoints());
|
points << GetReversePoint(arc->GetPoints());
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
pointsEkv << biasPoints(GetReversePoint(arc->GetPoints()), detail->at(i).getMx(),
|
pointsEkv << biasPoints(GetReversePoint(arc->GetPoints()), detail.at(i).getMx(),
|
||||||
detail->at(i).getMy());
|
detail.at(i).getMy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
const VSpline *spline = GeometricObject<const VSpline *>(detail->at(i).getId());
|
const VSpline *spline = GeometricObject<const VSpline *>(detail.at(i).getId());
|
||||||
qreal len1 = GetLengthContour(points, spline->GetPoints());
|
qreal len1 = GetLengthContour(points, spline->GetPoints());
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline->GetPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline->GetPoints()));
|
||||||
if (len1 <= lenReverse)
|
if (len1 <= lenReverse)
|
||||||
{
|
{
|
||||||
points << spline->GetPoints();
|
points << spline->GetPoints();
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
pointsEkv << biasPoints(spline->GetPoints(), detail->at(i).getMx(), detail->at(i).getMy());
|
pointsEkv << biasPoints(spline->GetPoints(), detail.at(i).getMx(), detail.at(i).getMy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
points << GetReversePoint(spline->GetPoints());
|
points << GetReversePoint(spline->GetPoints());
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
pointsEkv << biasPoints(GetReversePoint(spline->GetPoints()), detail->at(i).getMx(),
|
pointsEkv << biasPoints(GetReversePoint(spline->GetPoints()), detail.at(i).getMx(),
|
||||||
detail->at(i).getMy());
|
detail.at(i).getMy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
const VSplinePath *splinePath = GeometricObject<const VSplinePath *>(detail->at(i).getId());
|
const VSplinePath *splinePath = GeometricObject<const VSplinePath *>(detail.at(i).getId());
|
||||||
qreal len1 = GetLengthContour(points, splinePath->GetPathPoints());
|
qreal len1 = GetLengthContour(points, splinePath->GetPathPoints());
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath->GetPathPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath->GetPathPoints()));
|
||||||
if (len1 <= lenReverse)
|
if (len1 <= lenReverse)
|
||||||
{
|
{
|
||||||
points << splinePath->GetPathPoints();
|
points << splinePath->GetPathPoints();
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
pointsEkv << biasPoints(splinePath->GetPathPoints(), detail->at(i).getMx(), detail->at(i).getMy());
|
pointsEkv << biasPoints(splinePath->GetPathPoints(), detail.at(i).getMx(), detail.at(i).getMy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
points << GetReversePoint(splinePath->GetPathPoints());
|
points << GetReversePoint(splinePath->GetPathPoints());
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
pointsEkv << biasPoints(GetReversePoint(splinePath->GetPathPoints()), detail->at(i).getMx(),
|
pointsEkv << biasPoints(GetReversePoint(splinePath->GetPathPoints()), detail.at(i).getMx(),
|
||||||
detail->at(i).getMy());
|
detail.at(i).getMy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Get wrong tool type. Ignore."<<detail->at(i).getTypeTool();
|
qWarning()<<"Get wrong tool type. Ignore."<<detail.at(i).getTypeTool();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,16 +329,16 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
|
||||||
}
|
}
|
||||||
path.lineTo(points[0]);
|
path.lineTo(points[0]);
|
||||||
|
|
||||||
if (detail->getSupplement() == true)
|
if (detail.getSupplement() == true)
|
||||||
{
|
{
|
||||||
QPainterPath ekv;
|
QPainterPath ekv;
|
||||||
if (detail->getClosed() == true)
|
if (detail.getClosed() == true)
|
||||||
{
|
{
|
||||||
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail->getWidth()));
|
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail->getWidth()));
|
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth()));
|
||||||
}
|
}
|
||||||
path.addPath(ekv);
|
path.addPath(ekv);
|
||||||
path.setFillRule(Qt::WindingFill);
|
path.setFillRule(Qt::WindingFill);
|
||||||
|
@ -541,7 +553,7 @@ QVector<QPointF> VContainer::CheckLoops(const QVector<QPointF> &points) const
|
||||||
|
|
||||||
void VContainer::PrepareDetails(QVector<VItem *> &list) const
|
void VContainer::PrepareDetails(QVector<VItem *> &list) const
|
||||||
{
|
{
|
||||||
QHashIterator<qint64, VDetail *> idetail(details);
|
QHashIterator<qint64, VDetail> idetail(details);
|
||||||
while (idetail.hasNext())
|
while (idetail.hasNext())
|
||||||
{
|
{
|
||||||
idetail.next();
|
idetail.next();
|
||||||
|
@ -589,41 +601,32 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value)
|
||||||
|
|
||||||
qreal VContainer::GetValueStandartTableCell(const QString& name) const
|
qreal VContainer::GetValueStandartTableCell(const QString& name) const
|
||||||
{
|
{
|
||||||
const VStandartTableRow *cell = GetStandartTableCell(name);
|
VStandartTableRow cell = GetStandartTableCell(name);
|
||||||
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
|
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
|
||||||
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
|
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
|
||||||
qreal value = cell->GetBase() + k_size*cell->GetKsize() + k_growth*cell->GetKgrowth();
|
qreal value = cell.GetBase() + k_size*cell.GetKsize() + k_growth*cell.GetKgrowth();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal VContainer::GetValueIncrementTableRow(const QString& name) const
|
qreal VContainer::GetValueIncrementTableRow(const QString& name) const
|
||||||
{
|
{
|
||||||
const VIncrementTableRow *cell = GetIncrementTableRow(name);
|
VIncrementTableRow cell = GetIncrementTableRow(name);
|
||||||
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
|
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
|
||||||
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
|
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
|
||||||
qreal value = cell->getBase() + k_size*cell->getKsize() + k_growth*cell->getKgrowth();
|
qreal value = cell.getBase() + k_size*cell.getKsize() + k_growth*cell.getKgrowth();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::Clear()
|
void VContainer::Clear()
|
||||||
{
|
{
|
||||||
_id = 0;
|
_id = 0;
|
||||||
if(standartTable.size()>0)
|
|
||||||
{
|
|
||||||
qDeleteAll(standartTable);
|
|
||||||
}
|
|
||||||
standartTable.clear();
|
standartTable.clear();
|
||||||
if(incrementTable.size()>0)
|
|
||||||
{
|
|
||||||
qDeleteAll(incrementTable);
|
|
||||||
}
|
|
||||||
incrementTable.clear();
|
incrementTable.clear();
|
||||||
lengthLines.clear();
|
lengthLines.clear();
|
||||||
lengthArcs.clear();
|
lengthArcs.clear();
|
||||||
lineAngles.clear();
|
lineAngles.clear();
|
||||||
details.clear();
|
details.clear();
|
||||||
ClearObject();
|
ClearObject();
|
||||||
CreateManTableIGroup ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::ClearObject()
|
void VContainer::ClearObject()
|
||||||
|
@ -718,9 +721,11 @@ void VContainer::UpdateGObject(qint64 id, VGObject* obj)
|
||||||
UpdateObject(gObjects, id, obj);
|
UpdateObject(gObjects, id, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::UpdateDetail(qint64 id,VDetail *detail)
|
void VContainer::UpdateDetail(qint64 id,VDetail detail)
|
||||||
{
|
{
|
||||||
UpdateObject(details, id, detail);
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
|
details[id] = detail;
|
||||||
|
UpdateId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::AddLengthLine(const QString &name, const qreal &value)
|
void VContainer::AddLengthLine(const QString &name, const qreal &value)
|
||||||
|
@ -731,60 +736,64 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value)
|
||||||
|
|
||||||
void VContainer::CreateManTableIGroup ()
|
void VContainer::CreateManTableIGroup ()
|
||||||
{
|
{
|
||||||
AddStandartTableCell("Pkor", new VStandartTableRow(84, 0, 3));
|
AddStandartTableCell("Pkor", VStandartTableRow(84, 0, 3));
|
||||||
AddStandartTableCell("Pkor", new VStandartTableRow(84, 0, 3));
|
AddStandartTableCell("Vtos", VStandartTableRow(1450, 2, 51));
|
||||||
AddStandartTableCell("Vtos", new VStandartTableRow(1450, 2, 51));
|
AddStandartTableCell("Vtosh", VStandartTableRow(1506, 2, 54));
|
||||||
AddStandartTableCell("Vtosh", new VStandartTableRow(1506, 2, 54));
|
AddStandartTableCell("Vpt", VStandartTableRow(1438, 3, 52));
|
||||||
AddStandartTableCell("Vpt", new VStandartTableRow(1438, 3, 52));
|
AddStandartTableCell("Vst", VStandartTableRow(1257, -1, 49));
|
||||||
AddStandartTableCell("Vst", new VStandartTableRow(1257, -1, 49));
|
AddStandartTableCell("Vlt", VStandartTableRow(1102, 0, 43));
|
||||||
AddStandartTableCell("Vlt", new VStandartTableRow(1102, 0, 43));
|
AddStandartTableCell("Vk", VStandartTableRow(503, 0, 22));
|
||||||
AddStandartTableCell("Vk", new VStandartTableRow(503, 0, 22));
|
AddStandartTableCell("Vsht", VStandartTableRow(1522, 2, 54));
|
||||||
AddStandartTableCell("Vsht", new VStandartTableRow(1522, 2, 54));
|
AddStandartTableCell("Vzy", VStandartTableRow(1328, 0, 49));
|
||||||
AddStandartTableCell("Vzy", new VStandartTableRow(1328, 0, 49));
|
AddStandartTableCell("Vlop", VStandartTableRow(1320, 0, 49));
|
||||||
AddStandartTableCell("Vlop", new VStandartTableRow(1320, 0, 49));
|
AddStandartTableCell("Vps", VStandartTableRow(811, -1, 36));
|
||||||
AddStandartTableCell("Vps", new VStandartTableRow(811, -1, 36));
|
AddStandartTableCell("Ssh", VStandartTableRow(202, 4, 1));
|
||||||
AddStandartTableCell("Ssh", new VStandartTableRow(202, 4, 1));
|
AddStandartTableCell("SgI", VStandartTableRow(517, 18, 2));
|
||||||
AddStandartTableCell("SgI", new VStandartTableRow(517, 18, 2));
|
AddStandartTableCell("SgII", VStandartTableRow(522, 19, 1));
|
||||||
AddStandartTableCell("SgII", new VStandartTableRow(522, 19, 1));
|
AddStandartTableCell("SgIII", VStandartTableRow(500, 20, 0));
|
||||||
AddStandartTableCell("SgIII", new VStandartTableRow(500, 20, 0));
|
AddStandartTableCell("SbI", VStandartTableRow(482, 12, 6));
|
||||||
AddStandartTableCell("St", new VStandartTableRow(390, 20, 0));
|
AddStandartTableCell("Obed", VStandartTableRow(566, 18, 6));
|
||||||
AddStandartTableCell("Sb", new VStandartTableRow(492, 15, 5));
|
AddStandartTableCell("Ok", VStandartTableRow(386, 8, 8));
|
||||||
AddStandartTableCell("SbI", new VStandartTableRow(482, 12, 6));
|
AddStandartTableCell("Oi", VStandartTableRow(380, 8, 6));
|
||||||
AddStandartTableCell("Obed", new VStandartTableRow(566, 18, 6));
|
AddStandartTableCell("Osch", VStandartTableRow(234, 4, 4));
|
||||||
AddStandartTableCell("Ok", new VStandartTableRow(386, 8, 8));
|
AddStandartTableCell("Dsb", VStandartTableRow(1120, 0, 44));
|
||||||
AddStandartTableCell("Oi", new VStandartTableRow(380, 8, 6));
|
AddStandartTableCell("Dsp", VStandartTableRow(1110, 0, 43));
|
||||||
AddStandartTableCell("Osch", new VStandartTableRow(234, 4, 4));
|
AddStandartTableCell("Dn", VStandartTableRow(826, -3, 37));
|
||||||
AddStandartTableCell("Dsb", new VStandartTableRow(1120, 0, 44));
|
AddStandartTableCell("Dps", VStandartTableRow(316, 4, 7));
|
||||||
AddStandartTableCell("Dsp", new VStandartTableRow(1110, 0, 43));
|
AddStandartTableCell("Dpob", VStandartTableRow(783, 14, 15));
|
||||||
AddStandartTableCell("Dn", new VStandartTableRow(826, -3, 37));
|
AddStandartTableCell("Ds", VStandartTableRow(260, 1, 6));
|
||||||
AddStandartTableCell("Dps", new VStandartTableRow(316, 4, 7));
|
AddStandartTableCell("Op", VStandartTableRow(316, 12, 0));
|
||||||
AddStandartTableCell("Dpob", new VStandartTableRow(783, 14, 15));
|
AddStandartTableCell("Ozap", VStandartTableRow(180, 4, 0));
|
||||||
AddStandartTableCell("Ds", new VStandartTableRow(260, 1, 6));
|
AddStandartTableCell("Pkis", VStandartTableRow(250, 4, 0));
|
||||||
AddStandartTableCell("Op", new VStandartTableRow(316, 12, 0));
|
AddStandartTableCell("SHp", VStandartTableRow(160, 1, 4));
|
||||||
AddStandartTableCell("Ozap", new VStandartTableRow(180, 4, 0));
|
AddStandartTableCell("Dlych", VStandartTableRow(500, 2, 15));
|
||||||
AddStandartTableCell("Pkis", new VStandartTableRow(250, 4, 0));
|
AddStandartTableCell("Dzap", VStandartTableRow(768, 2, 24));
|
||||||
AddStandartTableCell("SHp", new VStandartTableRow(160, 1, 4));
|
AddStandartTableCell("DIIIp", VStandartTableRow(970, 2, 29));
|
||||||
AddStandartTableCell("Dlych", new VStandartTableRow(500, 2, 15));
|
AddStandartTableCell("Vprp", VStandartTableRow(214, 3, 3));
|
||||||
AddStandartTableCell("Dzap", new VStandartTableRow(768, 2, 24));
|
AddStandartTableCell("Vg", VStandartTableRow(262, 8, 3));
|
||||||
AddStandartTableCell("DIIIp", new VStandartTableRow(970, 2, 29));
|
AddStandartTableCell("Dtp", VStandartTableRow(460, 7, 9));
|
||||||
AddStandartTableCell("Vprp", new VStandartTableRow(214, 3, 3));
|
AddStandartTableCell("Dp", VStandartTableRow(355, 5, 5));
|
||||||
AddStandartTableCell("Vg", new VStandartTableRow(262, 8, 3));
|
AddStandartTableCell("Vprz", VStandartTableRow(208, 3, 5));
|
||||||
AddStandartTableCell("Dtp", new VStandartTableRow(460, 7, 9));
|
AddStandartTableCell("Dts", VStandartTableRow(438, 2, 10));
|
||||||
AddStandartTableCell("Dp", new VStandartTableRow(355, 5, 5));
|
AddStandartTableCell("DtsI", VStandartTableRow(469, 2, 10));
|
||||||
AddStandartTableCell("Vprz", new VStandartTableRow(208, 3, 5));
|
AddStandartTableCell("Dvcht", VStandartTableRow(929, 9, 19));
|
||||||
AddStandartTableCell("Dts", new VStandartTableRow(438, 2, 10));
|
AddStandartTableCell("SHg", VStandartTableRow(370, 14, 4));
|
||||||
AddStandartTableCell("DtsI", new VStandartTableRow(469, 2, 10));
|
AddStandartTableCell("Cg", VStandartTableRow(224, 6, 0));
|
||||||
AddStandartTableCell("Dvcht", new VStandartTableRow(929, 9, 19));
|
AddStandartTableCell("SHs", VStandartTableRow(416, 10, 2));
|
||||||
AddStandartTableCell("SHg", new VStandartTableRow(370, 14, 4));
|
AddStandartTableCell("dpzr", VStandartTableRow(121, 6, 0));
|
||||||
AddStandartTableCell("Cg", new VStandartTableRow(224, 6, 0));
|
AddStandartTableCell("Ogol", VStandartTableRow(576, 4, 4));
|
||||||
AddStandartTableCell("SHs", new VStandartTableRow(416, 10, 2));
|
AddStandartTableCell("Ssh1", VStandartTableRow(205, 5, 0));
|
||||||
AddStandartTableCell("dpzr", new VStandartTableRow(121, 6, 0));
|
|
||||||
AddStandartTableCell("Ogol", new VStandartTableRow(576, 4, 4));
|
//TODO Posible duplicate. Need check.
|
||||||
AddStandartTableCell("Ssh1", new VStandartTableRow(205, 5, 0));
|
//AddStandartTableCell("St", VStandartTableRow(410, 20, 0));
|
||||||
AddStandartTableCell("St", new VStandartTableRow(410, 20, 0));
|
AddStandartTableCell("St", VStandartTableRow(390, 20, 0));
|
||||||
AddStandartTableCell("Drzap", new VStandartTableRow(594, 3, 19));
|
|
||||||
AddStandartTableCell("DbII", new VStandartTableRow(1020, 0, 44));
|
AddStandartTableCell("Drzap", VStandartTableRow(594, 3, 19));
|
||||||
AddStandartTableCell("Sb", new VStandartTableRow(504, 15, 4));
|
AddStandartTableCell("DbII", VStandartTableRow(1020, 0, 44));
|
||||||
|
|
||||||
|
//TODO Posible duplicate. Need check.
|
||||||
|
//AddStandartTableCell("Sb", VStandartTableRow(504, 15, 4));
|
||||||
|
AddStandartTableCell("Sb", VStandartTableRow(492, 15, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QPointF> VContainer::GetReversePoint(const QVector<QPointF> &points) const
|
QVector<QPointF> VContainer::GetReversePoint(const QVector<QPointF> &points) const
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
* @param data container
|
* @param data container
|
||||||
*/
|
*/
|
||||||
VContainer(const VContainer &data);
|
VContainer(const VContainer &data);
|
||||||
|
~VContainer();
|
||||||
/**
|
/**
|
||||||
* @brief setData copy data from container
|
* @brief setData copy data from container
|
||||||
* @param data container
|
* @param data container
|
||||||
|
@ -94,13 +95,13 @@ public:
|
||||||
* @param name name of standart table row
|
* @param name name of standart table row
|
||||||
* @return row of standart table
|
* @return row of standart table
|
||||||
*/
|
*/
|
||||||
const VStandartTableRow *GetStandartTableCell(const QString& name) const;
|
const VStandartTableRow GetStandartTableCell(const QString& name) const;
|
||||||
/**
|
/**
|
||||||
* @brief GetIncrementTableRow return increment table row by name
|
* @brief GetIncrementTableRow return increment table row by name
|
||||||
* @param name name of increment table row
|
* @param name name of increment table row
|
||||||
* @return row of increment table
|
* @return row of increment table
|
||||||
*/
|
*/
|
||||||
const VIncrementTableRow *GetIncrementTableRow(const QString& name) const;
|
const VIncrementTableRow GetIncrementTableRow(const QString& name) const;
|
||||||
/**
|
/**
|
||||||
* @brief GetLine return length of line by name
|
* @brief GetLine return length of line by name
|
||||||
* @param name name of line
|
* @param name name of line
|
||||||
|
@ -130,7 +131,7 @@ public:
|
||||||
* @param id id of detail
|
* @param id id of detail
|
||||||
* @return detail
|
* @return detail
|
||||||
*/
|
*/
|
||||||
const VDetail *GetDetail(qint64 id) const;
|
const VDetail GetDetail(qint64 id) const;
|
||||||
/**
|
/**
|
||||||
* @brief getId return current id
|
* @brief getId return current id
|
||||||
* @return current id
|
* @return current id
|
||||||
|
@ -147,21 +148,20 @@ public:
|
||||||
* @param detail new detail
|
* @param detail new detail
|
||||||
* @return return id of new detail in container
|
* @return return id of new detail in container
|
||||||
*/
|
*/
|
||||||
qint64 AddDetail(VDetail *detail);
|
qint64 AddDetail(VDetail detail);
|
||||||
/**
|
/**
|
||||||
* @brief AddStandartTableCell add new row of standart table
|
* @brief AddStandartTableCell add new row of standart table
|
||||||
* @param name name of row of standart table
|
* @param name name of row of standart table
|
||||||
* @param cell row of standart table
|
* @param cell row of standart table
|
||||||
*/
|
*/
|
||||||
inline void AddStandartTableCell(const QString& name, VStandartTableRow *cell)
|
inline void AddStandartTableCell(const QString& name, VStandartTableRow cell)
|
||||||
{standartTable[name] = cell;}
|
{standartTable[name] = cell;}
|
||||||
/**
|
/**
|
||||||
* @brief AddIncrementTableRow add new row of increment table
|
* @brief AddIncrementTableRow add new row of increment table
|
||||||
* @param name name of new row of increment table
|
* @param name name of new row of increment table
|
||||||
* @param row new row of increment table
|
* @param row new row of increment table
|
||||||
*/
|
*/
|
||||||
inline void AddIncrementTableRow(const QString& name, VIncrementTableRow *row)
|
void AddIncrementTableRow(const QString& name, VIncrementTableRow row);
|
||||||
{incrementTable[name] = row;}
|
|
||||||
/**
|
/**
|
||||||
* @brief AddLengthLine add length of line to container
|
* @brief AddLengthLine add length of line to container
|
||||||
* @param name name of line
|
* @param name name of line
|
||||||
|
@ -223,20 +223,20 @@ public:
|
||||||
* @param id id of existing detail
|
* @param id id of existing detail
|
||||||
* @param detail detail
|
* @param detail detail
|
||||||
*/
|
*/
|
||||||
void UpdateDetail(qint64 id, VDetail *detail);
|
void UpdateDetail(qint64 id, VDetail detail);
|
||||||
/**
|
/**
|
||||||
* @brief UpdateStandartTableCell update standart table row by name
|
* @brief UpdateStandartTableCell update standart table row by name
|
||||||
* @param name name of row
|
* @param name name of row
|
||||||
* @param cell row of standart table
|
* @param cell row of standart table
|
||||||
*/
|
*/
|
||||||
inline void UpdateStandartTableCell(const QString& name, VStandartTableRow *cell)
|
inline void UpdateStandartTableCell(const QString& name, VStandartTableRow cell)
|
||||||
{standartTable[name] = cell;}
|
{standartTable[name] = cell;}
|
||||||
/**
|
/**
|
||||||
* @brief UpdateIncrementTableRow update increment table row by name
|
* @brief UpdateIncrementTableRow update increment table row by name
|
||||||
* @param name name of row
|
* @param name name of row
|
||||||
* @param row row
|
* @param row row
|
||||||
*/
|
*/
|
||||||
inline void UpdateIncrementTableRow(const QString& name, VIncrementTableRow *row)
|
inline void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row)
|
||||||
{incrementTable[name] = row;}
|
{incrementTable[name] = row;}
|
||||||
/**
|
/**
|
||||||
* @brief GetValueStandartTableCell return value of standart table row by name
|
* @brief GetValueStandartTableCell return value of standart table row by name
|
||||||
|
@ -335,12 +335,12 @@ public:
|
||||||
* @brief data container with dataStandartTable return container of standart table
|
* @brief data container with dataStandartTable return container of standart table
|
||||||
* @return pointer on container of standart table
|
* @return pointer on container of standart table
|
||||||
*/
|
*/
|
||||||
inline const QHash<QString, VStandartTableRow *> *DataStandartTable() const {return &standartTable;}
|
inline const QHash<QString, VStandartTableRow> *DataStandartTable() const {return &standartTable;}
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataIncrementTable return container of increment table
|
* @brief data container with dataIncrementTable return container of increment table
|
||||||
* @return pointer on container of increment table
|
* @return pointer on container of increment table
|
||||||
*/
|
*/
|
||||||
inline const QHash<QString, VIncrementTableRow *> *DataIncrementTable() const {return &incrementTable;}
|
inline const QHash<QString, VIncrementTableRow> *DataIncrementTable() const {return &incrementTable;}
|
||||||
/**
|
/**
|
||||||
* @brief data container with dataLengthLines return container of lines lengths
|
* @brief data container with dataLengthLines return container of lines lengths
|
||||||
* @return pointer on container of lines lengths
|
* @return pointer on container of lines lengths
|
||||||
|
@ -365,7 +365,7 @@ public:
|
||||||
* @brief data container with dataDetails return container of details
|
* @brief data container with dataDetails return container of details
|
||||||
* @return pointer on container of details
|
* @return pointer on container of details
|
||||||
*/
|
*/
|
||||||
inline const QHash<qint64, VDetail *> *DataDetails() const {return &details;}
|
inline const QHash<qint64, VDetail> *DataDetails() const {return &details;}
|
||||||
/**
|
/**
|
||||||
* @brief UpdateId update id. If new id bigger when current save new like current.
|
* @brief UpdateId update id. If new id bigger when current save new like current.
|
||||||
* @param newId id
|
* @param newId id
|
||||||
|
@ -427,6 +427,10 @@ public:
|
||||||
* @param list list of details
|
* @param list list of details
|
||||||
*/
|
*/
|
||||||
void PrepareDetails(QVector<VItem *> & list) const;
|
void PrepareDetails(QVector<VItem *> & list) const;
|
||||||
|
/**
|
||||||
|
* @brief CreateManTableIGroup generate man standart table of measurements
|
||||||
|
*/
|
||||||
|
void CreateManTableIGroup ();
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief _id current id. New object will have value +1. For full class equal 0.
|
* @brief _id current id. New object will have value +1. For full class equal 0.
|
||||||
|
@ -443,11 +447,11 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief standartTable container of standart table rows
|
* @brief standartTable container of standart table rows
|
||||||
*/
|
*/
|
||||||
QHash<QString, VStandartTableRow*> standartTable;
|
QHash<QString, VStandartTableRow> standartTable;
|
||||||
/**
|
/**
|
||||||
* @brief incrementTable
|
* @brief incrementTable
|
||||||
*/
|
*/
|
||||||
QHash<QString, VIncrementTableRow*> incrementTable;
|
QHash<QString, VIncrementTableRow> incrementTable;
|
||||||
/**
|
/**
|
||||||
* @brief lengthLines container of lines lengths
|
* @brief lengthLines container of lines lengths
|
||||||
*/
|
*/
|
||||||
|
@ -467,11 +471,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief details container of details
|
* @brief details container of details
|
||||||
*/
|
*/
|
||||||
QHash<qint64, VDetail*> details;
|
QHash<qint64, VDetail> details;
|
||||||
/**
|
|
||||||
* @brief CreateManTableIGroup generate man standart table of measurements
|
|
||||||
*/
|
|
||||||
void CreateManTableIGroup ();
|
|
||||||
/**
|
/**
|
||||||
* @brief GetReversePoint return revers container of points
|
* @brief GetReversePoint return revers container of points
|
||||||
* @param points container with points
|
* @param points container with points
|
||||||
|
|
|
@ -31,5 +31,6 @@
|
||||||
VStandartTableRow::VStandartTableRow()
|
VStandartTableRow::VStandartTableRow()
|
||||||
:base(0), ksize(0), kgrowth(0), description(QString()){}
|
:base(0), ksize(0), kgrowth(0), description(QString()){}
|
||||||
|
|
||||||
VStandartTableRow::VStandartTableRow(qint32 base, qreal ksize, qreal kgrowth, QString description)
|
VStandartTableRow::VStandartTableRow(const qint32 &base, const qreal &ksize, const qreal &kgrowth,
|
||||||
|
const QString &description)
|
||||||
:base(base), ksize(ksize), kgrowth(kgrowth), description(description){}
|
:base(base), ksize(ksize), kgrowth(kgrowth), description(description){}
|
||||||
|
|
|
@ -48,7 +48,9 @@ public:
|
||||||
* @param kgrowth increment in growths
|
* @param kgrowth increment in growths
|
||||||
* @param description description of increment
|
* @param description description of increment
|
||||||
*/
|
*/
|
||||||
VStandartTableRow(qint32 base, qreal ksize, qreal kgrowth, QString description = QString());
|
VStandartTableRow(const qint32 &base, const qreal &ksize, const qreal &kgrowth,
|
||||||
|
const QString &description = QString());
|
||||||
|
~VStandartTableRow(){}
|
||||||
/**
|
/**
|
||||||
* @brief GetBase return value in base size and growth
|
* @brief GetBase return value in base size and growth
|
||||||
* @return value
|
* @return value
|
||||||
|
|
|
@ -69,14 +69,14 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget
|
||||||
|
|
||||||
void DialogIncrements::FillStandartTable()
|
void DialogIncrements::FillStandartTable()
|
||||||
{
|
{
|
||||||
const QHash<QString, VStandartTableRow *> *standartTable = data->DataStandartTable();
|
const QHash<QString, VStandartTableRow> *standartTable = data->DataStandartTable();
|
||||||
qint32 currentRow = -1;
|
qint32 currentRow = -1;
|
||||||
QHashIterator<QString, VStandartTableRow *> i(*standartTable);
|
QHashIterator<QString, VStandartTableRow> i(*standartTable);
|
||||||
ui->tableWidgetStandart->setRowCount ( standartTable->size() );
|
ui->tableWidgetStandart->setRowCount ( standartTable->size() );
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
i.next();
|
i.next();
|
||||||
VStandartTableRow *cell = i.value();
|
VStandartTableRow cell = i.value();
|
||||||
currentRow++;
|
currentRow++;
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
|
QTableWidgetItem *item = new QTableWidgetItem(QString(i.key()));
|
||||||
|
@ -88,19 +88,19 @@ void DialogIncrements::FillStandartTable()
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetStandart->setItem(currentRow, 1, item);
|
ui->tableWidgetStandart->setItem(currentRow, 1, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(cell->GetBase()));
|
item = new QTableWidgetItem(QString().setNum(cell.GetBase()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetStandart->setItem(currentRow, 2, item);
|
ui->tableWidgetStandart->setItem(currentRow, 2, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(cell->GetKsize()));
|
item = new QTableWidgetItem(QString().setNum(cell.GetKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetStandart->setItem(currentRow, 3, item);
|
ui->tableWidgetStandart->setItem(currentRow, 3, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(cell->GetKgrowth()));
|
item = new QTableWidgetItem(QString().setNum(cell.GetKgrowth()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetStandart->setItem(currentRow, 4, item);
|
ui->tableWidgetStandart->setItem(currentRow, 4, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(cell->GetDescription());
|
item = new QTableWidgetItem(cell.GetDescription());
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetStandart->setItem(currentRow, 5, item);
|
ui->tableWidgetStandart->setItem(currentRow, 5, item);
|
||||||
}
|
}
|
||||||
|
@ -111,15 +111,15 @@ void DialogIncrements::FillStandartTable()
|
||||||
|
|
||||||
void DialogIncrements::FillIncrementTable()
|
void DialogIncrements::FillIncrementTable()
|
||||||
{
|
{
|
||||||
const QHash<QString, VIncrementTableRow *> *incrementTable = data->DataIncrementTable();
|
const QHash<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable();
|
||||||
QHashIterator<QString, VIncrementTableRow *> i(*incrementTable);
|
QHashIterator<QString, VIncrementTableRow> i(*incrementTable);
|
||||||
QMap<qint64, QString> map;
|
QMap<qint64, QString> map;
|
||||||
//Sorting QHash by id
|
//Sorting QHash by id
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
i.next();
|
i.next();
|
||||||
VIncrementTableRow *cell = i.value();
|
VIncrementTableRow cell = i.value();
|
||||||
map.insert(cell->getId(), i.key());
|
map.insert(cell.getId(), i.key());
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 currentRow = -1;
|
qint32 currentRow = -1;
|
||||||
|
@ -127,14 +127,14 @@ void DialogIncrements::FillIncrementTable()
|
||||||
while (iMap.hasNext())
|
while (iMap.hasNext())
|
||||||
{
|
{
|
||||||
iMap.next();
|
iMap.next();
|
||||||
VIncrementTableRow *cell = incrementTable->value(iMap.value());
|
VIncrementTableRow cell = incrementTable->value(iMap.value());
|
||||||
currentRow++;
|
currentRow++;
|
||||||
ui->tableWidgetIncrement->setRowCount ( incrementTable->size() );
|
ui->tableWidgetIncrement->setRowCount ( incrementTable->size() );
|
||||||
|
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
|
QTableWidgetItem *item = new QTableWidgetItem(iMap.value());
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
item->setData(Qt::UserRole, cell->getId());
|
item->setData(Qt::UserRole, cell.getId());
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 0, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
|
item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value())));
|
||||||
|
@ -145,19 +145,19 @@ void DialogIncrements::FillIncrementTable()
|
||||||
item->setFlags(flags);
|
item->setFlags(flags);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(cell->getBase()));
|
item = new QTableWidgetItem(QString().setNum(cell.getBase()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(cell->getKsize()));
|
item = new QTableWidgetItem(QString().setNum(cell.getKsize()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(QString().setNum(cell->getKgrowth()));
|
item = new QTableWidgetItem(QString().setNum(cell.getKgrowth()));
|
||||||
item->setTextAlignment(Qt::AlignHCenter);
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(cell->getDescription());
|
item = new QTableWidgetItem(cell.getDescription());
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
item->setTextAlignment(Qt::AlignLeft);
|
||||||
ui->tableWidgetIncrement->setItem(currentRow, 5, item);
|
ui->tableWidgetIncrement->setItem(currentRow, 5, item);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ void DialogIncrements::clickedToolButtonAdd()
|
||||||
qreal ksize = 0;
|
qreal ksize = 0;
|
||||||
qreal kgrowth = 0;
|
qreal kgrowth = 0;
|
||||||
QString description = QString(tr("Description"));
|
QString description = QString(tr("Description"));
|
||||||
VIncrementTableRow *incrementRow = new VIncrementTableRow(id, base, ksize, kgrowth, description);
|
VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description);
|
||||||
data->AddIncrementTableRow(name, incrementRow);
|
data->AddIncrementTableRow(name, incrementRow);
|
||||||
|
|
||||||
AddIncrementToFile(id, name, base, ksize, kgrowth, description);
|
AddIncrementToFile(id, name, base, ksize, kgrowth, description);
|
||||||
|
@ -499,9 +499,8 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column )
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
domElement.setAttribute("description", item->text());
|
domElement.setAttribute("description", item->text());
|
||||||
VIncrementTableRow *incr = new VIncrementTableRow(*data->GetIncrementTableRow(itemName->text()));
|
VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text());
|
||||||
Q_ASSERT(incr != 0);
|
incr.setDescription(item->text());
|
||||||
incr->setDescription(item->text());
|
|
||||||
data->UpdateIncrementTableRow(itemName->text(), incr);
|
data->UpdateIncrementTableRow(itemName->text(), incr);
|
||||||
ui->tableWidgetIncrement->resizeColumnsToContents();
|
ui->tableWidgetIncrement->resizeColumnsToContents();
|
||||||
ui->tableWidgetIncrement->resizeRowsToContents();
|
ui->tableWidgetIncrement->resizeRowsToContents();
|
||||||
|
|
|
@ -510,17 +510,17 @@ void DialogTool::ValChenged(int row)
|
||||||
}
|
}
|
||||||
if (radioButtonStandartTable->isChecked())
|
if (radioButtonStandartTable->isChecked())
|
||||||
{
|
{
|
||||||
const VStandartTableRow *stable = data->GetStandartTableCell(item->text());
|
VStandartTableRow stable = data->GetStandartTableCell(item->text());
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandartTableCell(item->text()))
|
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandartTableCell(item->text()))
|
||||||
.arg(stable->GetDescription());
|
.arg(stable.GetDescription());
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (radioButtonIncrements->isChecked())
|
if (radioButtonIncrements->isChecked())
|
||||||
{
|
{
|
||||||
const VIncrementTableRow *itable = data->GetIncrementTableRow(item->text());
|
VIncrementTableRow itable = data->GetIncrementTableRow(item->text());
|
||||||
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text()))
|
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text()))
|
||||||
.arg(itable->getDescription());
|
.arg(itable.getDescription());
|
||||||
labelDescription->setText(desc);
|
labelDescription->setText(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ bool DialogUnionDetails::CheckObject(const qint64 &id, const qint64 &idDetail) c
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const VDetail *det = data->GetDetail(idDetail);
|
VDetail det = data->GetDetail(idDetail);
|
||||||
return det->Containes(id);
|
return det.Containes(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogUnionDetails::ChoosedDetail(const qint64 &id, const Scene::Scenes &type, qint64 &idDetail, qint64 &p1,
|
void DialogUnionDetails::ChoosedDetail(const qint64 &id, const Scene::Scenes &type, qint64 &idDetail, qint64 &p1,
|
||||||
|
|
|
@ -54,7 +54,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants)
|
||||||
/**
|
/**
|
||||||
* @brief The VDetail class
|
* @brief The VDetail class
|
||||||
*/
|
*/
|
||||||
class VDetail: public QObject
|
class VDetail :public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1216,10 +1216,9 @@ MainWindow::~MainWindow()
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
||||||
delete pattern;
|
delete pattern;
|
||||||
if (doc->isNull() == false)
|
delete doc;
|
||||||
{
|
delete sceneDetails;
|
||||||
delete doc;
|
delete sceneDraw;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenPattern(const QString &fileName)
|
void MainWindow::OpenPattern(const QString &fileName)
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
TableWindow::TableWindow(QWidget *parent)
|
TableWindow::TableWindow(QWidget *parent)
|
||||||
:QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
|
:QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
|
||||||
listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), currentScene(0),
|
listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(0),
|
||||||
paper(0), shadowPaper(0), listOutItems(0), listCollidingItems(QList<QGraphicsItem*>()),
|
paper(0), shadowPaper(0), listOutItems(0), listCollidingItems(QList<QGraphicsItem*>()),
|
||||||
indexDetail(0), sceneRect(QRectF())
|
indexDetail(0), sceneRect(QRectF())
|
||||||
{
|
{
|
||||||
|
@ -46,12 +46,12 @@ TableWindow::TableWindow(QWidget *parent)
|
||||||
outItems = collidingItems = false;
|
outItems = collidingItems = false;
|
||||||
//sceneRect = QRectF(0, 0, toPixel(203), toPixel(287));
|
//sceneRect = QRectF(0, 0, toPixel(203), toPixel(287));
|
||||||
sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171));
|
sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171));
|
||||||
currentScene = new QGraphicsScene(sceneRect);
|
tableScene = new QGraphicsScene(sceneRect);
|
||||||
QBrush *brush = new QBrush();
|
QBrush brush;
|
||||||
brush->setStyle( Qt::SolidPattern );
|
brush.setStyle( Qt::SolidPattern );
|
||||||
brush->setColor( QColor( Qt::gray ) );
|
brush.setColor( QColor( Qt::gray ) );
|
||||||
currentScene->setBackgroundBrush( *brush );
|
tableScene->setBackgroundBrush( brush );
|
||||||
VTableGraphicsView* view = new VTableGraphicsView(currentScene);
|
VTableGraphicsView* view = new VTableGraphicsView(tableScene);
|
||||||
view->fitInView(view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
view->fitInView(view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
||||||
ui->horizontalLayout->addWidget(view);
|
ui->horizontalLayout->addWidget(view);
|
||||||
connect(ui->actionTurn, &QAction::triggered, view, &VTableGraphicsView::rotateItems);
|
connect(ui->actionTurn, &QAction::triggered, view, &VTableGraphicsView::rotateItems);
|
||||||
|
@ -68,6 +68,7 @@ TableWindow::TableWindow(QWidget *parent)
|
||||||
|
|
||||||
TableWindow::~TableWindow()
|
TableWindow::~TableWindow()
|
||||||
{
|
{
|
||||||
|
delete tableScene;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +78,11 @@ void TableWindow::AddPaper()
|
||||||
sceneRect.getCoords(&x1, &y1, &x2, &y2);
|
sceneRect.getCoords(&x1, &y1, &x2, &y2);
|
||||||
shadowPaper = new QGraphicsRectItem(QRectF(x1+4, y1+4, x2+4, y2+4));
|
shadowPaper = new QGraphicsRectItem(QRectF(x1+4, y1+4, x2+4, y2+4));
|
||||||
shadowPaper->setBrush(QBrush(Qt::black));
|
shadowPaper->setBrush(QBrush(Qt::black));
|
||||||
currentScene->addItem(shadowPaper);
|
tableScene->addItem(shadowPaper);
|
||||||
paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2));
|
paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2));
|
||||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||||
paper->setBrush(QBrush(Qt::white));
|
paper->setBrush(QBrush(Qt::white));
|
||||||
currentScene->addItem(paper);
|
tableScene->addItem(paper);
|
||||||
qDebug()<<paper->rect().size().toSize();
|
qDebug()<<paper->rect().size().toSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ void TableWindow::AddDetail()
|
||||||
{
|
{
|
||||||
if (indexDetail<listDetails.count())
|
if (indexDetail<listDetails.count())
|
||||||
{
|
{
|
||||||
currentScene->clearSelection();
|
tableScene->clearSelection();
|
||||||
VItem* Detail = listDetails[indexDetail];
|
VItem* Detail = listDetails[indexDetail];
|
||||||
QObject::connect(Detail, SIGNAL(itemOut(int, bool)), this, SLOT(itemOut(int, bool)));
|
QObject::connect(Detail, SIGNAL(itemOut(int, bool)), this, SLOT(itemOut(int, bool)));
|
||||||
QObject::connect(Detail, SIGNAL(itemColliding(QList<QGraphicsItem*>, int)), this,
|
QObject::connect(Detail, SIGNAL(itemColliding(QList<QGraphicsItem*>, int)), this,
|
||||||
|
@ -102,7 +103,7 @@ void TableWindow::AddDetail()
|
||||||
Detail->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
Detail->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
Detail->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
Detail->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
Detail->setPaper(paper);
|
Detail->setPaper(paper);
|
||||||
currentScene->addItem(Detail);
|
tableScene->addItem(Detail);
|
||||||
Detail->setSelected(true);
|
Detail->setSelected(true);
|
||||||
indexDetail++;
|
indexDetail++;
|
||||||
if (indexDetail==listDetails.count())
|
if (indexDetail==listDetails.count())
|
||||||
|
@ -148,7 +149,7 @@ void TableWindow::showEvent ( QShowEvent * event )
|
||||||
void TableWindow::StopTable()
|
void TableWindow::StopTable()
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
currentScene->clear();
|
tableScene->clear();
|
||||||
delete listOutItems;
|
delete listOutItems;
|
||||||
listDetails.clear();
|
listDetails.clear();
|
||||||
//sceneRect = QRectF(0, 0, 230*resol/25.9, 327*resol/25.9);
|
//sceneRect = QRectF(0, 0, 230*resol/25.9, 327*resol/25.9);
|
||||||
|
@ -166,8 +167,8 @@ void TableWindow::saveScene()
|
||||||
|
|
||||||
QBrush *brush = new QBrush();
|
QBrush *brush = new QBrush();
|
||||||
brush->setColor( QColor( Qt::white ) );
|
brush->setColor( QColor( Qt::white ) );
|
||||||
currentScene->setBackgroundBrush( *brush );
|
tableScene->setBackgroundBrush( *brush );
|
||||||
currentScene->clearSelection(); // Selections would also render to the file, so need delete them
|
tableScene->clearSelection(); // Selections would also render to the file, so need delete them
|
||||||
shadowPaper->setVisible(false);
|
shadowPaper->setVisible(false);
|
||||||
QFileInfo fi(name);
|
QFileInfo fi(name);
|
||||||
if (fi.suffix() == "svg")
|
if (fi.suffix() == "svg")
|
||||||
|
@ -185,7 +186,7 @@ void TableWindow::saveScene()
|
||||||
|
|
||||||
brush->setColor( QColor( Qt::gray ) );
|
brush->setColor( QColor( Qt::gray ) );
|
||||||
brush->setStyle( Qt::SolidPattern );
|
brush->setStyle( Qt::SolidPattern );
|
||||||
currentScene->setBackgroundBrush( *brush );
|
tableScene->setBackgroundBrush( *brush );
|
||||||
shadowPaper->setVisible(true);
|
shadowPaper->setVisible(true);
|
||||||
delete brush;
|
delete brush;
|
||||||
}
|
}
|
||||||
|
@ -310,9 +311,9 @@ void TableWindow::GetNextDetail()
|
||||||
|
|
||||||
void TableWindow::AddLength()
|
void TableWindow::AddLength()
|
||||||
{
|
{
|
||||||
QRectF rect = currentScene->sceneRect();
|
QRectF rect = tableScene->sceneRect();
|
||||||
rect.setHeight(rect.height()+toPixel(279));
|
rect.setHeight(rect.height()+toPixel(279));
|
||||||
currentScene->setSceneRect(rect);
|
tableScene->setSceneRect(rect);
|
||||||
rect = shadowPaper->rect();
|
rect = shadowPaper->rect();
|
||||||
rect.setHeight(rect.height()+toPixel(279));
|
rect.setHeight(rect.height()+toPixel(279));
|
||||||
shadowPaper->setRect(rect);
|
shadowPaper->setRect(rect);
|
||||||
|
@ -325,18 +326,18 @@ void TableWindow::AddLength()
|
||||||
|
|
||||||
void TableWindow::RemoveLength()
|
void TableWindow::RemoveLength()
|
||||||
{
|
{
|
||||||
if (sceneRect.height() <= currentScene->sceneRect().height() - 100)
|
if (sceneRect.height() <= tableScene->sceneRect().height() - 100)
|
||||||
{
|
{
|
||||||
QRectF rect = currentScene->sceneRect();
|
QRectF rect = tableScene->sceneRect();
|
||||||
rect.setHeight(rect.height()-toPixel(279));
|
rect.setHeight(rect.height()-toPixel(279));
|
||||||
currentScene->setSceneRect(rect);
|
tableScene->setSceneRect(rect);
|
||||||
rect = shadowPaper->rect();
|
rect = shadowPaper->rect();
|
||||||
rect.setHeight(rect.height()-toPixel(279));
|
rect.setHeight(rect.height()-toPixel(279));
|
||||||
shadowPaper->setRect(rect);
|
shadowPaper->setRect(rect);
|
||||||
rect = paper->rect();
|
rect = paper->rect();
|
||||||
rect.setHeight(rect.height()-toPixel(279));
|
rect.setHeight(rect.height()-toPixel(279));
|
||||||
paper->setRect(rect);
|
paper->setRect(rect);
|
||||||
if (fabs(sceneRect.height() - currentScene->sceneRect().height()) < 0.01)
|
if (fabs(sceneRect.height() - tableScene->sceneRect().height()) < 0.01)
|
||||||
{
|
{
|
||||||
ui->actionRemove->setDisabled(true);
|
ui->actionRemove->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
@ -378,7 +379,7 @@ void TableWindow::SvgFile(const QString &name) const
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, 1.2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, 1.2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
currentScene->render(&painter);
|
tableScene->render(&painter);
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,6 +396,6 @@ void TableWindow::PngFile(const QString &name) const
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
currentScene->render(&painter);
|
tableScene->render(&painter);
|
||||||
image.save(name);
|
image.save(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief currentScene Зберігається покажчик на сцену.
|
* @brief currentScene Зберігається покажчик на сцену.
|
||||||
*/
|
*/
|
||||||
QGraphicsScene* currentScene;
|
QGraphicsScene* tableScene;
|
||||||
/**
|
/**
|
||||||
* @brief paper Зберігається покажчик на прямокутник що імітує листа паперу.
|
* @brief paper Зберігається покажчик на прямокутник що імітує листа паперу.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,6 +68,7 @@ const QString VAbstractTool::TypeLineLine = QStringLiteral("hair");
|
||||||
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent)
|
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent)
|
||||||
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black)
|
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(doc != 0);
|
||||||
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange);
|
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange);
|
||||||
connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
|
connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile);
|
||||||
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
|
connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree);
|
||||||
|
|
|
@ -28,10 +28,15 @@
|
||||||
|
|
||||||
#include "vdatatool.h"
|
#include "vdatatool.h"
|
||||||
|
|
||||||
|
VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1)
|
||||||
|
{
|
||||||
|
Q_ASSERT(data != 0);
|
||||||
|
}
|
||||||
|
|
||||||
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
||||||
{
|
{
|
||||||
data = tool.getData();
|
data = tool.getData();
|
||||||
_referens = tool.referens();
|
_referens = tool.referens();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
* @param data
|
* @param data
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data), _referens(1){}
|
VDataTool(VContainer *data, QObject *parent = 0);
|
||||||
virtual ~VDataTool(){}
|
virtual ~VDataTool(){}
|
||||||
/**
|
/**
|
||||||
* @brief operator =
|
* @brief operator =
|
||||||
|
|
|
@ -44,7 +44,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer<DialogDetail>()),
|
:VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialogDetail(QSharedPointer<DialogDetail>()),
|
||||||
sceneDetails(scene)
|
sceneDetails(scene)
|
||||||
{
|
{
|
||||||
VDetail detail = VDetail(*data->GetDetail(id));
|
VDetail detail = data->GetDetail(id);
|
||||||
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
|
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
switch (detail[i].getTypeTool())
|
switch (detail[i].getTypeTool())
|
||||||
|
@ -89,8 +89,7 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
|
||||||
VContainer *data)
|
VContainer *data)
|
||||||
{
|
{
|
||||||
VDetail detail = dialog->getDetails();
|
VDetail detail = dialog->getDetails();
|
||||||
VDetail *det = new VDetail();
|
VDetail det;
|
||||||
Q_ASSERT(det != 0);
|
|
||||||
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
|
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
qint64 id = 0;
|
qint64 id = 0;
|
||||||
|
@ -137,13 +136,13 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
VNodeDetail node(id, detail[i].getTypeTool(), NodeDetail::Contour);
|
VNodeDetail node(id, detail[i].getTypeTool(), NodeDetail::Contour);
|
||||||
det->append(node);
|
det.append(node);
|
||||||
}
|
}
|
||||||
det->setName(detail.getName());
|
det.setName(detail.getName());
|
||||||
Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui);
|
Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolDetail::Create(const qint64 _id, VDetail *newDetail, VMainGraphicsScene *scene, VDomDocument *doc,
|
void VToolDetail::Create(const qint64 _id, VDetail newDetail, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||||
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
|
VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
|
||||||
{
|
{
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
|
@ -228,20 +227,20 @@ void VToolDetail::FullUpdateFromGui(int result)
|
||||||
|
|
||||||
void VToolDetail::AddToFile()
|
void VToolDetail::AddToFile()
|
||||||
{
|
{
|
||||||
const VDetail *detail = VAbstractTool::data.GetDetail(id);
|
VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
QDomElement domElement = doc->createElement(TagName);
|
QDomElement domElement = doc->createElement(TagName);
|
||||||
|
|
||||||
AddAttribute(domElement, AttrId, id);
|
AddAttribute(domElement, AttrId, id);
|
||||||
AddAttribute(domElement, AttrName, detail->getName());
|
AddAttribute(domElement, AttrName, detail.getName());
|
||||||
AddAttribute(domElement, AttrMx, toMM(detail->getMx()));
|
AddAttribute(domElement, AttrMx, toMM(detail.getMx()));
|
||||||
AddAttribute(domElement, AttrMy, toMM(detail->getMy()));
|
AddAttribute(domElement, AttrMy, toMM(detail.getMy()));
|
||||||
AddAttribute(domElement, AttrSupplement, detail->getSupplement());
|
AddAttribute(domElement, AttrSupplement, detail.getSupplement());
|
||||||
AddAttribute(domElement, AttrClosed, detail->getClosed());
|
AddAttribute(domElement, AttrClosed, detail.getClosed());
|
||||||
AddAttribute(domElement, AttrWidth, detail->getWidth());
|
AddAttribute(domElement, AttrWidth, detail.getWidth());
|
||||||
|
|
||||||
for (ptrdiff_t i = 0; i < detail->CountNode(); ++i)
|
for (ptrdiff_t i = 0; i < detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
AddNode(domElement, detail->at(i));
|
AddNode(domElement, detail.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
QDomElement element;
|
QDomElement element;
|
||||||
|
@ -257,15 +256,15 @@ void VToolDetail::RefreshDataInFile()
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
{
|
{
|
||||||
const VDetail *det = VAbstractTool::data.GetDetail(id);
|
VDetail det = VAbstractTool::data.GetDetail(id);
|
||||||
domElement.setAttribute(AttrName, det->getName());
|
domElement.setAttribute(AttrName, det.getName());
|
||||||
domElement.setAttribute(AttrSupplement, QString().setNum(det->getSupplement()));
|
domElement.setAttribute(AttrSupplement, QString().setNum(det.getSupplement()));
|
||||||
domElement.setAttribute(AttrClosed, QString().setNum(det->getClosed()));
|
domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed()));
|
||||||
domElement.setAttribute(AttrWidth, QString().setNum(det->getWidth()));
|
domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth()));
|
||||||
RemoveAllChild(domElement);
|
RemoveAllChild(domElement);
|
||||||
for (ptrdiff_t i = 0; i < det->CountNode(); ++i)
|
for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
AddNode(domElement, det->at(i));
|
AddNode(domElement, det.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,10 +328,10 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
|
|
||||||
void VToolDetail::RemoveReferens()
|
void VToolDetail::RemoveReferens()
|
||||||
{
|
{
|
||||||
const VDetail *detail = VAbstractTool::data.GetDetail(id);
|
VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
for (ptrdiff_t i = 0; i< detail->CountNode(); ++i)
|
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
|
||||||
{
|
{
|
||||||
doc->DecrementReferens(detail->at(i).getId());
|
doc->DecrementReferens(detail.at(i).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
* @param parse
|
* @param parse
|
||||||
* @param typeCreation
|
* @param typeCreation
|
||||||
*/
|
*/
|
||||||
static void Create(const qint64 _id, VDetail *newDetail, VMainGraphicsScene *scene,
|
static void Create(const qint64 _id, VDetail newDetail, VMainGraphicsScene *scene,
|
||||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||||
const Tool::Sources &typeCreation);
|
const Tool::Sources &typeCreation);
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -90,8 +90,8 @@ public:
|
||||||
tool->setParentItem(this);
|
tool->setParentItem(this);
|
||||||
connect(tool, &T::ChoosedTool, sceneDetails, &VMainGraphicsScene::ChoosedItem);
|
connect(tool, &T::ChoosedTool, sceneDetails, &VMainGraphicsScene::ChoosedItem);
|
||||||
VNodeDetail node(id, typeTool, Draw::Modeling, NodeDetail::Modeling);
|
VNodeDetail node(id, typeTool, Draw::Modeling, NodeDetail::Modeling);
|
||||||
VDetail *det = VAbstractTool::data.GetDetail(this->id);
|
VDetail det = VAbstractTool::data.GetDetail(this->id);
|
||||||
det->append(node);
|
det.append(node);
|
||||||
VAbstractTool::data.UpdateDetail(this->id, det);
|
VAbstractTool::data.UpdateDetail(this->id, det);
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(this->id));
|
QDomElement domElement = doc->elementById(QString().setNum(this->id));
|
||||||
if (domElement.isElement())
|
if (domElement.isElement())
|
||||||
|
|
|
@ -97,7 +97,7 @@ void VToolUnionDetails::CorectPoints(const VDetail &detail, qint64 &p1, qint64 &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail *newDetail, const VDetail &det, const ptrdiff_t &a,
|
void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, const VDetail &det, const ptrdiff_t &a,
|
||||||
const ptrdiff_t &b, const qreal &dx, const qreal &dy, const qint64 &pRotate,
|
const ptrdiff_t &b, const qreal &dx, const qreal &dy, const qint64 &pRotate,
|
||||||
const qreal &angle) const
|
const qreal &angle) const
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail *newDetail, con
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
newDetail->append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour));
|
newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
|
||||||
void VToolUnionDetails::Create(QSharedPointer<DialogUnionDetails> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
|
void VToolUnionDetails::Create(QSharedPointer<DialogUnionDetails> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||||
VContainer *data)
|
VContainer *data)
|
||||||
{
|
{
|
||||||
VDetail d1 = VDetail(*data->GetDetail(dialog->getD1()));
|
VDetail d1 = data->GetDetail(dialog->getD1());
|
||||||
VDetail d2 = VDetail(*data->GetDetail(dialog->getD2()));
|
VDetail d2 = data->GetDetail(dialog->getD2());
|
||||||
qint64 d1P1 = dialog->getD1P1();
|
qint64 d1P1 = dialog->getD1P1();
|
||||||
qint64 d1P2 = dialog->getD1P2();
|
qint64 d1P2 = dialog->getD1P2();
|
||||||
qint64 d2P1 = dialog->getD2P1();
|
qint64 d2P1 = dialog->getD2P1();
|
||||||
|
@ -447,8 +447,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai
|
||||||
qint64 d2P1 = unionDetails->getD2P1();
|
qint64 d2P1 = unionDetails->getD2P1();
|
||||||
qint64 d2P2 = unionDetails->getD2P2();
|
qint64 d2P2 = unionDetails->getD2P2();
|
||||||
|
|
||||||
VDetail *newDetail = new VDetail();
|
VDetail newDetail;
|
||||||
Q_ASSERT(newDetail != 0);
|
|
||||||
unionDetails->AddToNewDetail(data, newDetail, d1, d1.indexOfNode(d1P1), d1.indexOfNode(d1P2));
|
unionDetails->AddToNewDetail(data, newDetail, d1, d1.indexOfNode(d1P1), d1.indexOfNode(d1P2));
|
||||||
|
|
||||||
const VNodeDetail det1p2 = d1.at(d1.indexOfNode(d1P2));
|
const VNodeDetail det1p2 = d1.at(d1.indexOfNode(d1P2));
|
||||||
|
@ -468,7 +467,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai
|
||||||
unionDetails->AddToNewDetail(data, newDetail, d2, d2.indexOfNode(d2P1)+1, d2.indexOfNode(d2P2)-1, dx, dy,
|
unionDetails->AddToNewDetail(data, newDetail, d2, d2.indexOfNode(d2P1)+1, d2.indexOfNode(d2P2)-1, dx, dy,
|
||||||
d1P2, angle);
|
d1P2, angle);
|
||||||
|
|
||||||
newDetail->setName("Detail");
|
newDetail.setName("Detail");
|
||||||
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Tool::FromTool);
|
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Tool::FromTool);
|
||||||
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
||||||
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d1id));
|
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d1id));
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
inline qint64 getD1P2() const{return d1P2;}
|
inline qint64 getD1P2() const{return d1P2;}
|
||||||
inline qint64 getD2P1() const{return d2P1;}
|
inline qint64 getD2P1() const{return d2P1;}
|
||||||
inline qint64 getD2P2() const{return d2P2;}
|
inline qint64 getD2P2() const{return d2P2;}
|
||||||
void AddToNewDetail(VContainer *data, VDetail *newDetail, const VDetail &det, const ptrdiff_t &a,
|
void AddToNewDetail(VContainer *data, VDetail newDetail, const VDetail &det, const ptrdiff_t &a,
|
||||||
const ptrdiff_t &b, const qreal &dx = 0, const qreal &dy = 0, const qint64 &pRotate = 0,
|
const ptrdiff_t &b, const qreal &dx = 0, const qreal &dy = 0, const qint64 &pRotate = 0,
|
||||||
const qreal &angle = 0) const;
|
const qreal &angle = 0) const;
|
||||||
void UpdatePoints(const qint64 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &a,
|
void UpdatePoints(const qint64 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &a,
|
||||||
|
|
|
@ -321,6 +321,7 @@ void VDomDocument::Parse(const Document::Documents &parse, VMainGraphicsScene *s
|
||||||
{
|
{
|
||||||
TestUniqueId();
|
TestUniqueId();
|
||||||
data->Clear();
|
data->Clear();
|
||||||
|
data->CreateManTableIGroup();
|
||||||
nameActivDraw.clear();
|
nameActivDraw.clear();
|
||||||
sceneDraw->clear();
|
sceneDraw->clear();
|
||||||
sceneDetail->clear();
|
sceneDetail->clear();
|
||||||
|
@ -405,7 +406,7 @@ void VDomDocument::ParseIncrementsElement(const QDomNode &node)
|
||||||
qreal kgrowth = GetParametrDouble(domElement, "kgrowth", "0");
|
qreal kgrowth = GetParametrDouble(domElement, "kgrowth", "0");
|
||||||
QString desc = GetParametrString(domElement, "description", "Description");
|
QString desc = GetParametrString(domElement, "description", "Description");
|
||||||
data->UpdateId(id);
|
data->UpdateId(id);
|
||||||
data->AddIncrementTableRow(name, new VIncrementTableRow(id, base, ksize, kgrowth, desc));
|
data->AddIncrementTableRow(name, VIncrementTableRow(id, base, ksize, kgrowth, desc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,16 +584,15 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VDetail *detail = new VDetail();
|
VDetail detail;
|
||||||
Q_ASSERT(detail != 0);
|
|
||||||
VDetail oldDetail;
|
VDetail oldDetail;
|
||||||
qint64 id = GetParametrId(domElement);
|
qint64 id = GetParametrId(domElement);
|
||||||
detail->setName(GetParametrString(domElement, VAbstractTool::AttrName, ""));
|
detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, ""));
|
||||||
detail->setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0")));
|
detail.setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0")));
|
||||||
detail->setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0")));
|
detail.setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0")));
|
||||||
detail->setSupplement(GetParametrLongLong(domElement, VToolDetail::AttrSupplement, "1"));
|
detail.setSupplement(GetParametrLongLong(domElement, VToolDetail::AttrSupplement, "1"));
|
||||||
detail->setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
||||||
detail->setClosed(GetParametrLongLong(domElement, VToolDetail::AttrClosed, "1"));
|
detail.setClosed(GetParametrLongLong(domElement, VToolDetail::AttrClosed, "1"));
|
||||||
|
|
||||||
QDomNodeList nodeList = domElement.childNodes();
|
QDomNodeList nodeList = domElement.childNodes();
|
||||||
qint32 num = nodeList.size();
|
qint32 num = nodeList.size();
|
||||||
|
@ -633,7 +633,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
||||||
// VSplinePath splPath = data->GetSplinePath(id);
|
// VSplinePath splPath = data->GetSplinePath(id);
|
||||||
// oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, NodeDetail::Contour));
|
// oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, NodeDetail::Contour));
|
||||||
}
|
}
|
||||||
detail->append(VNodeDetail(id, tool, nodeType, mx, my));
|
detail.append(VNodeDetail(id, tool, nodeType, mx, my));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -678,6 +678,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
|
||||||
if (type == VToolSinglePoint::ToolType)
|
if (type == VToolSinglePoint::ToolType)
|
||||||
{
|
{
|
||||||
|
VToolSinglePoint *spoint = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
qint64 id = GetParametrId(domElement);
|
qint64 id = GetParametrId(domElement);
|
||||||
|
@ -695,7 +696,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
}
|
}
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolSinglePoint *spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
||||||
Q_ASSERT(spoint != 0);
|
Q_ASSERT(spoint != 0);
|
||||||
scene->addItem(spoint);
|
scene->addItem(spoint);
|
||||||
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
|
@ -708,6 +709,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
{
|
{
|
||||||
VExceptionObjectError excep(tr("Error creating or updating single point"), domElement);
|
VExceptionObjectError excep(tr("Error creating or updating single point"), domElement);
|
||||||
excep.AddMoreInformation(e.ErrorMessage());
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
|
scene->RemoveTool(spoint);
|
||||||
|
delete spoint;
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user