Q_CHECK_PTR() instead Q_ASSERT()
--HG-- branch : develop
This commit is contained in:
parent
d4db51c04c
commit
5804f54459
|
@ -72,7 +72,7 @@ void VContainer::setData(const VContainer &data)
|
||||||
qDeleteAll(gObjects);
|
qDeleteAll(gObjects);
|
||||||
gObjects.clear();
|
gObjects.clear();
|
||||||
const QHash<qint64, VGObject*> *obj = data.DataGObjects();
|
const QHash<qint64, VGObject*> *obj = data.DataGObjects();
|
||||||
Q_ASSERT(obj != 0);
|
Q_CHECK_PTR(obj);
|
||||||
QHashIterator<qint64, VGObject*> i(*obj);
|
QHashIterator<qint64, VGObject*> i(*obj);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ template <typename val>
|
||||||
void VContainer::UpdateObject(QHash<qint64, val> &obj, const qint64 &id, val point)
|
void VContainer::UpdateObject(QHash<qint64, val> &obj, const qint64 &id, val point)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
Q_ASSERT(point != 0);
|
Q_CHECK_PTR(point);
|
||||||
point->setId(id);
|
point->setId(id);
|
||||||
if (gObjects.contains(id))
|
if (gObjects.contains(id))
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,7 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId
|
||||||
template <typename key, typename val>
|
template <typename key, typename val>
|
||||||
qint64 VContainer::AddObject(QHash<key, val> &obj, val value)
|
qint64 VContainer::AddObject(QHash<key, val> &obj, val value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(value != 0);
|
Q_CHECK_PTR(value);
|
||||||
qint64 id = getNextId();
|
qint64 id = getNextId();
|
||||||
value->setId(id);
|
value->setId(id);
|
||||||
obj[id] = value;
|
obj[id] = value;
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
void CopyGObject(const VContainer &data, const qint64 &id)
|
void CopyGObject(const VContainer &data, const qint64 &id)
|
||||||
{
|
{
|
||||||
T *obj = new T(*data.GeometricObject<const T *>(id));
|
T *obj = new T(*data.GeometricObject<const T *>(id));
|
||||||
Q_ASSERT(obj != 0);
|
Q_CHECK_PTR(obj);
|
||||||
UpdateGObject(id, obj);
|
UpdateGObject(id, obj);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
throw VExceptionBadId(tr("Can't find object"), id);
|
throw VExceptionBadId(tr("Can't find object"), id);
|
||||||
}
|
}
|
||||||
T obj = dynamic_cast<T>(gObj);
|
T obj = dynamic_cast<T>(gObj);
|
||||||
Q_ASSERT(obj != 0);
|
Q_CHECK_PTR(obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ void DialogArc::F2Changed()
|
||||||
|
|
||||||
void DialogArc::CheckState()
|
void DialogArc::CheckState()
|
||||||
{
|
{
|
||||||
Q_ASSERT(bOk != 0);
|
Q_CHECK_PTR(bOk);
|
||||||
bOk->setEnabled(flagRadius && flagF1 && flagF2);
|
bOk->setEnabled(flagRadius && flagF1 && flagF2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ void DialogArc::ShowLineAngles()
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
|
||||||
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
|
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
|
||||||
Q_ASSERT(lineAnglesTable != 0);
|
Q_CHECK_PTR(lineAnglesTable);
|
||||||
QHashIterator<QString, qreal> i(*lineAnglesTable);
|
QHashIterator<QString, qreal> i(*lineAnglesTable);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,7 +180,7 @@ void DialogDetail::BiasXChanged(qreal d)
|
||||||
{
|
{
|
||||||
qint32 row = ui.listWidget->currentRow();
|
qint32 row = ui.listWidget->currentRow();
|
||||||
QListWidgetItem *item = ui.listWidget->item( row );
|
QListWidgetItem *item = ui.listWidget->item( row );
|
||||||
Q_ASSERT(item != 0);
|
Q_CHECK_PTR(item);
|
||||||
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||||
node.setMx(toPixel(d));
|
node.setMx(toPixel(d));
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
|
@ -190,7 +190,7 @@ void DialogDetail::BiasYChanged(qreal d)
|
||||||
{
|
{
|
||||||
qint32 row = ui.listWidget->currentRow();
|
qint32 row = ui.listWidget->currentRow();
|
||||||
QListWidgetItem *item = ui.listWidget->item( row );
|
QListWidgetItem *item = ui.listWidget->item( row );
|
||||||
Q_ASSERT(item != 0);
|
Q_CHECK_PTR(item);
|
||||||
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||||
node.setMy(toPixel(d));
|
node.setMy(toPixel(d));
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
|
|
|
@ -170,7 +170,7 @@ void DialogLineIntersect::P2Line2Changed(int index)
|
||||||
|
|
||||||
void DialogLineIntersect::CheckState()
|
void DialogLineIntersect::CheckState()
|
||||||
{
|
{
|
||||||
Q_ASSERT(bOk != 0);
|
Q_CHECK_PTR(bOk);
|
||||||
bOk->setEnabled(flagName && flagPoint);
|
bOk->setEnabled(flagName && flagPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent)
|
||||||
radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0),
|
radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0),
|
||||||
lineStyles(QStringList())
|
lineStyles(QStringList())
|
||||||
{
|
{
|
||||||
Q_ASSERT(data != 0);
|
Q_CHECK_PTR(data);
|
||||||
timerFormula = new QTimer(this);
|
timerFormula = new QTimer(this);
|
||||||
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
|
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
|
||||||
//Keep synchronize with VAbstractTool styles list!!!
|
//Keep synchronize with VAbstractTool styles list!!!
|
||||||
|
@ -70,7 +70,7 @@ void DialogTool::showEvent(QShowEvent *event)
|
||||||
|
|
||||||
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
|
void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
const QHash<qint64, VGObject*> *objs = data->DataGObjects();
|
const QHash<qint64, VGObject*> *objs = data->DataGObjects();
|
||||||
QHashIterator<qint64, VGObject*> i(*objs);
|
QHashIterator<qint64, VGObject*> i(*objs);
|
||||||
QMap<QString, qint64> list;
|
QMap<QString, qint64> list;
|
||||||
|
@ -92,7 +92,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
|
||||||
|
|
||||||
void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutArc cut) const
|
void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutArc cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
||||||
QHashIterator<qint64, VGObject*> i(*objs);
|
QHashIterator<qint64, VGObject*> i(*objs);
|
||||||
QMap<QString, qint64> list;
|
QMap<QString, qint64> list;
|
||||||
|
@ -129,7 +129,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::C
|
||||||
|
|
||||||
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
||||||
QHashIterator<qint64, VGObject*> i(*objs);
|
QHashIterator<qint64, VGObject*> i(*objs);
|
||||||
QMap<QString, qint64> list;
|
QMap<QString, qint64> list;
|
||||||
|
@ -166,7 +166,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode
|
||||||
|
|
||||||
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
||||||
QHashIterator<qint64, VGObject *> i(*objs);
|
QHashIterator<qint64, VGObject *> i(*objs);
|
||||||
QMap<QString, qint64> list;
|
QMap<QString, qint64> list;
|
||||||
|
@ -203,7 +203,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo
|
||||||
|
|
||||||
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
|
void DialogTool::FillComboBoxTypeLine(QComboBox *box) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
box->addItems(lineStyles);
|
box->addItems(lineStyles);
|
||||||
box->setCurrentIndex(1);
|
box->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
@ -270,8 +270,8 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const
|
||||||
|
|
||||||
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
||||||
{
|
{
|
||||||
Q_ASSERT(lineEdit != 0);
|
Q_CHECK_PTR(lineEdit);
|
||||||
Q_ASSERT(listWidget != 0);
|
Q_CHECK_PTR(listWidget);
|
||||||
QListWidgetItem *item = listWidget->currentItem();
|
QListWidgetItem *item = listWidget->currentItem();
|
||||||
int pos = lineEdit->cursorPosition();
|
int pos = lineEdit->cursorPosition();
|
||||||
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text()));
|
||||||
|
@ -281,9 +281,9 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget)
|
||||||
|
|
||||||
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
|
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
|
||||||
{
|
{
|
||||||
Q_ASSERT(edit != 0);
|
Q_CHECK_PTR(edit);
|
||||||
Q_ASSERT(timer != 0);
|
Q_CHECK_PTR(timer);
|
||||||
Q_ASSERT(labelEditFormula != 0);
|
Q_CHECK_PTR(labelEditFormula);
|
||||||
if (edit->text().isEmpty())
|
if (edit->text().isEmpty())
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
|
@ -298,10 +298,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer)
|
||||||
|
|
||||||
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
||||||
{
|
{
|
||||||
Q_ASSERT(edit != 0);
|
Q_CHECK_PTR(edit);
|
||||||
Q_ASSERT(timer != 0);
|
Q_CHECK_PTR(timer);
|
||||||
Q_ASSERT(label != 0);
|
Q_CHECK_PTR(label);
|
||||||
Q_ASSERT(labelEditFormula != 0);
|
Q_CHECK_PTR(labelEditFormula);
|
||||||
QPalette palette = labelEditFormula->palette();
|
QPalette palette = labelEditFormula->palette();
|
||||||
if (edit->text().isEmpty())
|
if (edit->text().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -333,7 +333,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
|
||||||
|
|
||||||
void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const
|
void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
FillComboBoxPoints(box, id);
|
FillComboBoxPoints(box, id);
|
||||||
pointId = value;
|
pointId = value;
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
|
@ -342,7 +342,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64
|
||||||
void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
|
void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
|
||||||
ComboMode::ComboBoxCutSpline cut) const
|
ComboMode::ComboBoxCutSpline cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
FillComboBoxSplines(box, id, cut);
|
FillComboBoxSplines(box, id, cut);
|
||||||
splineId = value;
|
splineId = value;
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
|
@ -351,7 +351,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint
|
||||||
void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id,
|
void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id,
|
||||||
ComboMode::ComboBoxCutArc cut) const
|
ComboMode::ComboBoxCutArc cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
FillComboBoxArcs(box, id, cut);
|
FillComboBoxArcs(box, id, cut);
|
||||||
arcId = value;
|
arcId = value;
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
|
@ -360,7 +360,7 @@ void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &va
|
||||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
|
void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
|
||||||
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
FillComboBoxSplinesPath(box, id, cut);
|
FillComboBoxSplinesPath(box, id, cut);
|
||||||
splinePathId = value;
|
splinePathId = value;
|
||||||
ChangeCurrentData(box, value);
|
ChangeCurrentData(box, value);
|
||||||
|
@ -368,7 +368,7 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, co
|
||||||
|
|
||||||
qint64 DialogTool::getCurrentObjectId(QComboBox *box) const
|
qint64 DialogTool::getCurrentObjectId(QComboBox *box) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
qint32 index = box->currentIndex();
|
qint32 index = box->currentIndex();
|
||||||
Q_ASSERT(index != -1);
|
Q_ASSERT(index != -1);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
@ -383,7 +383,7 @@ qint64 DialogTool::getCurrentObjectId(QComboBox *box) const
|
||||||
|
|
||||||
void DialogTool::FillList(QComboBox *box, const QMap<QString, qint64> &list) const
|
void DialogTool::FillList(QComboBox *box, const QMap<QString, qint64> &list) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_CHECK_PTR(box);
|
||||||
box->clear();
|
box->clear();
|
||||||
|
|
||||||
QMapIterator<QString, qint64> iter(list);
|
QMapIterator<QString, qint64> iter(list);
|
||||||
|
@ -396,7 +396,7 @@ void DialogTool::FillList(QComboBox *box, const QMap<QString, qint64> &list) con
|
||||||
|
|
||||||
void DialogTool::CheckState()
|
void DialogTool::CheckState()
|
||||||
{
|
{
|
||||||
Q_ASSERT(bOk != 0);
|
Q_CHECK_PTR(bOk);
|
||||||
bOk->setEnabled(flagFormula && flagName);
|
bOk->setEnabled(flagFormula && flagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ void DialogTool::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||||
|
|
||||||
void DialogTool::NamePointChanged()
|
void DialogTool::NamePointChanged()
|
||||||
{
|
{
|
||||||
Q_ASSERT(labelEditNamePoint != 0);
|
Q_CHECK_PTR(labelEditNamePoint);
|
||||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
|
@ -452,56 +452,56 @@ void DialogTool::FormulaChanged()
|
||||||
|
|
||||||
void DialogTool::ArrowUp()
|
void DialogTool::ArrowUp()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(90);
|
spinBoxAngle->setValue(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowDown()
|
void DialogTool::ArrowDown()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(270);
|
spinBoxAngle->setValue(270);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowLeft()
|
void DialogTool::ArrowLeft()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(180);
|
spinBoxAngle->setValue(180);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowRight()
|
void DialogTool::ArrowRight()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(0);
|
spinBoxAngle->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowLeftUp()
|
void DialogTool::ArrowLeftUp()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(135);
|
spinBoxAngle->setValue(135);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowLeftDown()
|
void DialogTool::ArrowLeftDown()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(225);
|
spinBoxAngle->setValue(225);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowRightUp()
|
void DialogTool::ArrowRightUp()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(45);
|
spinBoxAngle->setValue(45);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::ArrowRightDown()
|
void DialogTool::ArrowRightDown()
|
||||||
{
|
{
|
||||||
Q_ASSERT(spinBoxAngle != 0);
|
Q_CHECK_PTR(spinBoxAngle);
|
||||||
spinBoxAngle->setValue(315);
|
spinBoxAngle->setValue(315);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogTool::EvalFormula()
|
void DialogTool::EvalFormula()
|
||||||
{
|
{
|
||||||
Q_ASSERT(lineEditFormula != 0);
|
Q_CHECK_PTR(lineEditFormula);
|
||||||
Q_ASSERT(labelResultCalculation != 0);
|
Q_CHECK_PTR(labelResultCalculation);
|
||||||
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
|
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,8 +542,8 @@ void DialogTool::PutHere()
|
||||||
|
|
||||||
void DialogTool::PutVal(QListWidgetItem *item)
|
void DialogTool::PutVal(QListWidgetItem *item)
|
||||||
{
|
{
|
||||||
Q_ASSERT(lineEditFormula != 0);
|
Q_CHECK_PTR(lineEditFormula);
|
||||||
Q_ASSERT(item != 0);
|
Q_CHECK_PTR(item);
|
||||||
int pos = lineEditFormula->cursorPosition();
|
int pos = lineEditFormula->cursorPosition();
|
||||||
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
|
lineEditFormula->setText(lineEditFormula->text().insert(lineEditFormula->cursorPosition(),
|
||||||
item->text()));
|
item->text()));
|
||||||
|
@ -553,14 +553,14 @@ void DialogTool::PutVal(QListWidgetItem *item)
|
||||||
|
|
||||||
void DialogTool::ValChenged(int row)
|
void DialogTool::ValChenged(int row)
|
||||||
{
|
{
|
||||||
Q_ASSERT(listWidget != 0);
|
Q_CHECK_PTR(listWidget);
|
||||||
Q_ASSERT(labelDescription != 0);
|
Q_CHECK_PTR(labelDescription);
|
||||||
Q_ASSERT(radioButtonSizeGrowth != 0);
|
Q_CHECK_PTR(radioButtonSizeGrowth);
|
||||||
Q_ASSERT(radioButtonStandardTable != 0);
|
Q_CHECK_PTR(radioButtonStandardTable);
|
||||||
Q_ASSERT(radioButtonIncrements != 0);
|
Q_CHECK_PTR(radioButtonIncrements);
|
||||||
Q_ASSERT(radioButtonLengthLine != 0);
|
Q_CHECK_PTR(radioButtonLengthLine);
|
||||||
Q_ASSERT(radioButtonLengthArc != 0);
|
Q_CHECK_PTR(radioButtonLengthArc);
|
||||||
Q_ASSERT(radioButtonLengthCurve != 0);
|
Q_CHECK_PTR(radioButtonLengthCurve);
|
||||||
if (listWidget->count() == 0)
|
if (listWidget->count() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -621,12 +621,12 @@ void DialogTool::ValChenged(int row)
|
||||||
|
|
||||||
void DialogTool::UpdateList()
|
void DialogTool::UpdateList()
|
||||||
{
|
{
|
||||||
Q_ASSERT(radioButtonSizeGrowth != 0);
|
Q_CHECK_PTR(radioButtonSizeGrowth);
|
||||||
Q_ASSERT(radioButtonStandardTable != 0);
|
Q_CHECK_PTR(radioButtonStandardTable);
|
||||||
Q_ASSERT(radioButtonIncrements != 0);
|
Q_CHECK_PTR(radioButtonIncrements);
|
||||||
Q_ASSERT(radioButtonLengthLine != 0);
|
Q_CHECK_PTR(radioButtonLengthLine);
|
||||||
Q_ASSERT(radioButtonLengthArc != 0);
|
Q_CHECK_PTR(radioButtonLengthArc);
|
||||||
Q_ASSERT(radioButtonLengthCurve != 0);
|
Q_CHECK_PTR(radioButtonLengthCurve);
|
||||||
|
|
||||||
if (radioButtonSizeGrowth->isChecked())
|
if (radioButtonSizeGrowth->isChecked())
|
||||||
{
|
{
|
||||||
|
@ -657,7 +657,7 @@ void DialogTool::UpdateList()
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
void DialogTool::ShowVariable(const QHash<key, val> *var)
|
void DialogTool::ShowVariable(const QHash<key, val> *var)
|
||||||
{
|
{
|
||||||
Q_ASSERT(listWidget != 0);
|
Q_CHECK_PTR(listWidget);
|
||||||
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
|
||||||
listWidget->clear();
|
listWidget->clear();
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,9 @@ void VException::CriticalMessageBox(const QString &situation) const
|
||||||
}
|
}
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
Q_ASSERT(horizontalSpacer != 0);
|
Q_CHECK_PTR(horizontalSpacer);
|
||||||
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
|
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
|
||||||
Q_ASSERT(layout != 0);
|
Q_CHECK_PTR(layout);
|
||||||
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
QPainterPath VEquidistant::ContourPath(const qint64 &idDetail, const VContainer *data) const
|
QPainterPath VEquidistant::ContourPath(const qint64 &idDetail, const VContainer *data) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(data != 0);
|
Q_CHECK_PTR(data);
|
||||||
VDetail detail = data->GetDetail(idDetail);
|
VDetail detail = data->GetDetail(idDetail);
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
QVector<QPointF> pointsEkv;
|
QVector<QPointF> pointsEkv;
|
||||||
|
|
|
@ -307,7 +307,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso
|
||||||
{
|
{
|
||||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||||
{
|
{
|
||||||
Q_ASSERT(tButton != 0);
|
Q_CHECK_PTR(tButton);
|
||||||
tButton->setChecked(true);
|
tButton->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
||||||
if (lis.size()-2 <= 0)
|
if (lis.size()-2 <= 0)
|
||||||
{
|
{
|
||||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
|
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
|
||||||
Q_ASSERT(bitem != 0);
|
Q_CHECK_PTR(bitem);
|
||||||
bitem->setPen(QPen(Qt::black, widthMainLine));
|
bitem->setPen(QPen(Qt::black, widthMainLine));
|
||||||
listCollidingItems.removeAt(i);
|
listCollidingItems.removeAt(i);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
||||||
else if (listCollidingItems.size()==1)
|
else if (listCollidingItems.size()==1)
|
||||||
{
|
{
|
||||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
|
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
|
||||||
Q_ASSERT(bitem != 0);
|
Q_CHECK_PTR(bitem);
|
||||||
bitem->setPen(QPen(Qt::black, widthMainLine));
|
bitem->setPen(QPen(Qt::black, widthMainLine));
|
||||||
listCollidingItems.clear();
|
listCollidingItems.clear();
|
||||||
collidingItems = true;
|
collidingItems = true;
|
||||||
|
|
|
@ -121,8 +121,8 @@ protected:
|
||||||
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
|
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
|
||||||
bool showRemove = true)
|
bool showRemove = true)
|
||||||
{
|
{
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
Q_ASSERT(event != 0);
|
Q_CHECK_PTR(event);
|
||||||
if (ignoreContextMenuEvent == false)
|
if (ignoreContextMenuEvent == false)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
@ -176,7 +176,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
void ShowItem(Item *item, qint64 id, Qt::GlobalColor color, bool enable)
|
void ShowItem(Item *item, qint64 id, Qt::GlobalColor color, bool enable)
|
||||||
{
|
{
|
||||||
Q_ASSERT(item != 0);
|
Q_CHECK_PTR(item);
|
||||||
if (id == item->id)
|
if (id == item->id)
|
||||||
{
|
{
|
||||||
if (enable == false)
|
if (enable == false)
|
||||||
|
|
|
@ -106,7 +106,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad
|
||||||
|
|
||||||
VPointF c = *data->GeometricObject<const VPointF *>(center);
|
VPointF c = *data->GeometricObject<const VPointF *>(center);
|
||||||
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 );
|
||||||
Q_ASSERT(arc != 0);
|
Q_CHECK_PTR(arc);
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,13 +43,13 @@ VToolCutArc::VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0");
|
Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0");
|
||||||
|
|
||||||
firstArc = new VSimpleArc(arc1id, ¤tColor, &factor);
|
firstArc = new VSimpleArc(arc1id, ¤tColor, &factor);
|
||||||
Q_ASSERT(firstArc != 0);
|
Q_CHECK_PTR(firstArc);
|
||||||
RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
|
RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
|
||||||
firstArc->setParentItem(this);
|
firstArc->setParentItem(this);
|
||||||
connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
||||||
|
|
||||||
secondArc = new VSimpleArc(arc2id, ¤tColor, &factor);
|
secondArc = new VSimpleArc(arc2id, ¤tColor, &factor);
|
||||||
Q_ASSERT(secondArc != 0);
|
Q_CHECK_PTR(secondArc);
|
||||||
RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint);
|
RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint);
|
||||||
secondArc->setParentItem(this);
|
secondArc->setParentItem(this);
|
||||||
connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
|
||||||
|
@ -102,32 +102,32 @@ void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QStri
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_ASSERT(p != 0);
|
Q_CHECK_PTR(p);
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
|
||||||
VArc * ar1 = new VArc(arc1);
|
VArc * ar1 = new VArc(arc1);
|
||||||
Q_ASSERT(ar1 != 0);
|
Q_CHECK_PTR(ar1);
|
||||||
arc1id = data->AddGObject(ar1);
|
arc1id = data->AddGObject(ar1);
|
||||||
|
|
||||||
VArc * ar2 = new VArc(arc2);
|
VArc * ar2 = new VArc(arc2);
|
||||||
Q_ASSERT(ar2 != 0);
|
Q_CHECK_PTR(ar2);
|
||||||
arc2id = data->AddGObject(ar2);
|
arc2id = data->AddGObject(ar2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_ASSERT(p != 0);
|
Q_CHECK_PTR(p);
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
|
|
||||||
arc1id = id + 1;
|
arc1id = id + 1;
|
||||||
arc2id = id + 2;
|
arc2id = id + 2;
|
||||||
|
|
||||||
VArc * ar1 = new VArc(arc1);
|
VArc * ar1 = new VArc(arc1);
|
||||||
Q_ASSERT(ar1 != 0);
|
Q_CHECK_PTR(ar1);
|
||||||
data->UpdateGObject(arc1id, ar1);
|
data->UpdateGObject(arc1id, ar1);
|
||||||
|
|
||||||
VArc * ar2 = new VArc(arc2);
|
VArc * ar2 = new VArc(arc2);
|
||||||
Q_ASSERT(ar2 != 0);
|
Q_CHECK_PTR(ar2);
|
||||||
data->UpdateGObject(arc2id, ar2);
|
data->UpdateGObject(arc2id, ar2);
|
||||||
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
|
|
|
@ -43,13 +43,13 @@ VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64
|
||||||
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||||
|
|
||||||
firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor);
|
firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor);
|
||||||
Q_ASSERT(firstSpline != 0);
|
Q_CHECK_PTR(firstSpline);
|
||||||
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint);
|
||||||
firstSpline->setParentItem(this);
|
firstSpline->setParentItem(this);
|
||||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||||
|
|
||||||
secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor);
|
secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor);
|
||||||
Q_ASSERT(secondSpline != 0);
|
Q_CHECK_PTR(secondSpline);
|
||||||
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint);
|
||||||
secondSpline->setParentItem(this);
|
secondSpline->setParentItem(this);
|
||||||
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed);
|
||||||
|
@ -102,35 +102,35 @@ void VToolCutSpline::Create(const qint64 _id, const QString &pointName,
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_ASSERT(p != 0);
|
Q_CHECK_PTR(p != 0);
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
|
|
||||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||||
Q_ASSERT(spline1);
|
Q_CHECK_PTR(spline1);
|
||||||
spl1id = data->AddGObject(spline1);
|
spl1id = data->AddGObject(spline1);
|
||||||
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||||
Q_ASSERT(spline2);
|
Q_CHECK_PTR(spline2);
|
||||||
spl2id = data->AddGObject(spline2);
|
spl2id = data->AddGObject(spline2);
|
||||||
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_ASSERT(p != 0);
|
Q_CHECK_PTR(p);
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
|
|
||||||
spl1id = id + 1;
|
spl1id = id + 1;
|
||||||
spl2id = id + 2;
|
spl2id = id + 2;
|
||||||
|
|
||||||
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve());
|
||||||
Q_ASSERT(spline1);
|
Q_CHECK_PTR(spline1);
|
||||||
data->UpdateGObject(spl1id, spline1);
|
data->UpdateGObject(spl1id, spline1);
|
||||||
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength()));
|
||||||
|
|
||||||
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve());
|
||||||
Q_ASSERT(spline2);
|
Q_CHECK_PTR(spline2);
|
||||||
data->UpdateGObject(spl2id, spline2);
|
data->UpdateGObject(spl2id, spline2);
|
||||||
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength()));
|
||||||
|
|
||||||
|
|
|
@ -45,13 +45,13 @@ VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, cons
|
||||||
Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0");
|
||||||
|
|
||||||
firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor);
|
firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor);
|
||||||
Q_ASSERT(firstSpline != 0);
|
Q_CHECK_PTR(firstSpline);
|
||||||
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint);
|
||||||
firstSpline->setParentItem(this);
|
firstSpline->setParentItem(this);
|
||||||
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||||
|
|
||||||
secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor);
|
secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor);
|
||||||
Q_ASSERT(secondSpline != 0);
|
Q_CHECK_PTR(secondSpline);
|
||||||
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint);
|
||||||
secondSpline->setParentItem(this);
|
secondSpline->setParentItem(this);
|
||||||
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed);
|
||||||
|
@ -105,7 +105,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_ASSERT(p);
|
Q_CHECK_PTR(p);
|
||||||
id = data->AddGObject(p);
|
id = data->AddGObject(p);
|
||||||
splPath1id = id + 1;
|
splPath1id = id + 1;
|
||||||
splPath2id = id + 2;
|
splPath2id = id + 2;
|
||||||
|
@ -117,9 +117,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
|
|
||||||
|
|
||||||
VSplinePath *splPath1 = new VSplinePath();
|
VSplinePath *splPath1 = new VSplinePath();
|
||||||
Q_ASSERT(splPath1);
|
Q_CHECK_PTR(splPath1);
|
||||||
VSplinePath *splPath2 = new VSplinePath();
|
VSplinePath *splPath2 = new VSplinePath();
|
||||||
Q_ASSERT(splPath2);
|
Q_CHECK_PTR(splPath2);
|
||||||
for (qint32 i = 0; i < splPath->CountPoint(); i++)
|
for (qint32 i = 0; i < splPath->CountPoint(); i++)
|
||||||
{
|
{
|
||||||
if (i <= p1 && i < p2)
|
if (i <= p1 && i < p2)
|
||||||
|
@ -159,7 +159,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
|
||||||
Q_ASSERT(p);
|
Q_CHECK_PTR(p);
|
||||||
data->UpdateGObject(id, p);
|
data->UpdateGObject(id, p);
|
||||||
|
|
||||||
splPath1id = id + 1;
|
splPath1id = id + 1;
|
||||||
|
@ -171,9 +171,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve());
|
VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve());
|
||||||
|
|
||||||
VSplinePath *splPath1 = new VSplinePath();
|
VSplinePath *splPath1 = new VSplinePath();
|
||||||
Q_ASSERT(splPath1 != 0);
|
Q_CHECK_PTR(splPath1);
|
||||||
VSplinePath *splPath2 = new VSplinePath();
|
VSplinePath *splPath2 = new VSplinePath();
|
||||||
Q_ASSERT(splPath2 != 0);
|
Q_CHECK_PTR(splPath2);
|
||||||
for (qint32 i = 0; i < splPath->CountPoint(); i++)
|
for (qint32 i = 0; i < splPath->CountPoint(); i++)
|
||||||
{
|
{
|
||||||
if (i <= p1 && i < p2)
|
if (i <= p1 && i < p2)
|
||||||
|
|
|
@ -74,9 +74,9 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
|
||||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||||
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
const Document::Documents &parse, const Tool::Sources &typeCreation)
|
||||||
{
|
{
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
Q_ASSERT(doc != 0);
|
Q_CHECK_PTR(doc);
|
||||||
Q_ASSERT(data != 0);
|
Q_CHECK_PTR(data);
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
|
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
|
||||||
Q_ASSERT(line != 0);
|
Q_CHECK_PTR(line);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
|
||||||
|
|
|
@ -34,11 +34,11 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics
|
||||||
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
|
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0)
|
||||||
{
|
{
|
||||||
namePoint = new VGraphicsSimpleTextItem(this);
|
namePoint = new VGraphicsSimpleTextItem(this);
|
||||||
Q_ASSERT(namePoint != 0);
|
Q_CHECK_PTR(namePoint);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
||||||
namePoint->setBrush(Qt::black);
|
namePoint->setBrush(Qt::black);
|
||||||
lineName = new QGraphicsLineItem(this);
|
lineName = new QGraphicsLineItem(this);
|
||||||
Q_ASSERT(lineName != 0);
|
Q_CHECK_PTR(lineName);
|
||||||
lineName->setPen(QPen(Qt::black));
|
lineName->setPen(QPen(Qt::black));
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
this->setBrush(QBrush(Qt::NoBrush));
|
||||||
|
@ -51,7 +51,7 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics
|
||||||
void VToolPoint::NameChangePosition(const QPointF &pos)
|
void VToolPoint::NameChangePosition(const QPointF &pos)
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<const VPointF *>(id));
|
||||||
Q_ASSERT(point != 0);
|
Q_CHECK_PTR(point);
|
||||||
QPointF p = pos - this->pos();
|
QPointF p = pos - this->pos();
|
||||||
point->setMx(p.x());
|
point->setMx(p.x());
|
||||||
point->setMy(p.y());
|
point->setMy(p.y());
|
||||||
|
|
|
@ -110,7 +110,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
|
||||||
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
|
VPointF point1 = *data->GeometricObject<const VPointF *>(p1);
|
||||||
VPointF point4 = *data->GeometricObject<const VPointF *>(p4);
|
VPointF point4 = *data->GeometricObject<const VPointF *>(p4);
|
||||||
VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve);
|
VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve);
|
||||||
Q_ASSERT(spline != 0);
|
Q_CHECK_PTR(spline);
|
||||||
qint64 id = _id;
|
qint64 id = _id;
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,7 @@ void VToolSplinePath::Create(QSharedPointer<DialogSplinePath> &dialog, VMainGrap
|
||||||
VDomDocument *doc, VContainer *data)
|
VDomDocument *doc, VContainer *data)
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath(dialog->GetPath());
|
VSplinePath *path = new VSplinePath(dialog->GetPath());
|
||||||
Q_ASSERT(path);
|
Q_CHECK_PTR(path);
|
||||||
for (qint32 i = 0; i < path->CountPoint(); ++i)
|
for (qint32 i = 0; i < path->CountPoint(); ++i)
|
||||||
{
|
{
|
||||||
doc->IncrementReferens((*path)[i].P().id());
|
doc->IncrementReferens((*path)[i].P().id());
|
||||||
|
|
|
@ -57,14 +57,14 @@ void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idA
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent);
|
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent);
|
||||||
Q_ASSERT(arc != 0);
|
Q_CHECK_PTR(arc);
|
||||||
doc->AddTool(id, arc);
|
doc->AddTool(id, arc);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
doc->IncrementReferens(idTool);
|
doc->IncrementReferens(idTool);
|
||||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||||
VDataTool *tool = doc->getTool(idTool);
|
VDataTool *tool = doc->getTool(idTool);
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
arc->setParent(tool);
|
arc->setParent(tool);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -68,14 +68,14 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i
|
||||||
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
||||||
//Better check garbage before each saving file. Check only modeling tags.
|
//Better check garbage before each saving file. Check only modeling tags.
|
||||||
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
||||||
Q_ASSERT(point != 0);
|
Q_CHECK_PTR(point);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
if (idTool != 0)
|
if (idTool != 0)
|
||||||
{
|
{
|
||||||
doc->IncrementReferens(idTool);
|
doc->IncrementReferens(idTool);
|
||||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||||
VDataTool *tool = doc->getTool(idTool);
|
VDataTool *tool = doc->getTool(idTool);
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
point->setParent(tool);
|
point->setParent(tool);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -66,7 +66,7 @@ VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id,
|
||||||
doc->IncrementReferens(idTool);
|
doc->IncrementReferens(idTool);
|
||||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||||
VDataTool *tool = doc->getTool(idTool);
|
VDataTool *tool = doc->getTool(idTool);
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
spl->setParent(tool);
|
spl->setParent(tool);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -59,7 +59,7 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
||||||
Q_ASSERT(splPath != 0);
|
Q_CHECK_PTR(splPath);
|
||||||
doc->AddTool(id, splPath);
|
doc->AddTool(id, splPath);
|
||||||
const VSplinePath *path = data->GeometricObject<const VSplinePath *>(id);
|
const VSplinePath *path = data->GeometricObject<const VSplinePath *>(id);
|
||||||
const QVector<VSplinePoint> *points = path->GetPoint();
|
const QVector<VSplinePoint> *points = path->GetPoint();
|
||||||
|
@ -70,7 +70,7 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin
|
||||||
doc->IncrementReferens(idTool);
|
doc->IncrementReferens(idTool);
|
||||||
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
//Some nodes we don't show on scene. Tool that create this nodes must free memory.
|
||||||
VDataTool *tool = doc->getTool(idTool);
|
VDataTool *tool = doc->getTool(idTool);
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
splPath->setParent(tool);
|
splPath->setParent(tool);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -72,7 +72,7 @@ const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDot
|
||||||
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), typeLine(TypeLineLine)
|
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine)
|
||||||
{
|
{
|
||||||
Q_ASSERT(doc != 0);
|
Q_CHECK_PTR(doc);
|
||||||
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);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1)
|
VDataTool::VDataTool(VContainer *data, QObject *parent): QObject(parent), data(*data), _referens(1)
|
||||||
{
|
{
|
||||||
Q_ASSERT(data != 0);
|
Q_CHECK_PTR(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
VDataTool &VDataTool::operator =(const VDataTool &tool)
|
||||||
|
|
|
@ -390,9 +390,9 @@ template <typename Tool>
|
||||||
void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
|
void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node)
|
||||||
{
|
{
|
||||||
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
||||||
Q_ASSERT(tools != 0);
|
Q_CHECK_PTR(tools);
|
||||||
Tool *tool = qobject_cast<Tool*>(tools->value(node.getId()));
|
Tool *tool = qobject_cast<Tool*>(tools->value(node.getId()));
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
tool->setParentItem(this);
|
tool->setParentItem(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
{
|
{
|
||||||
//We can't use exist object. Need create new.
|
//We can't use exist object. Need create new.
|
||||||
T *node = new T(*data->GeometricObject<const T *>(id));
|
T *node = new T(*data->GeometricObject<const T *>(id));
|
||||||
Q_ASSERT(node != 0);
|
Q_CHECK_PTR(node);
|
||||||
node->setMode(Draw::Modeling);
|
node->setMode(Draw::Modeling);
|
||||||
return data->AddGObject(node);
|
return data->AddGObject(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,13 +72,13 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
VPointF *point = new VPointF(*data->GeometricObject<const VPointF *>(det.at(i).getId()));
|
||||||
Q_ASSERT(point != 0);
|
Q_CHECK_PTR(point);
|
||||||
point->setMode(Draw::Modeling);
|
point->setMode(Draw::Modeling);
|
||||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
idObject = data->AddGObject(point);
|
idObject = data->AddGObject(point);
|
||||||
VPointF *point1 = new VPointF(*point);
|
VPointF *point1 = new VPointF(*point);
|
||||||
Q_ASSERT(point1 != 0);
|
Q_CHECK_PTR(point1);
|
||||||
point1->setMode(Draw::Modeling);
|
point1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(point1);
|
id = data->AddGObject(point1);
|
||||||
VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
||||||
|
@ -99,7 +99,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0);
|
VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0);
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
VPointF *center = new VPointF(arc->GetCenter());
|
VPointF *center = new VPointF(arc->GetCenter());
|
||||||
Q_ASSERT(center != 0);
|
Q_CHECK_PTR(center);
|
||||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
|
@ -111,12 +111,12 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(),
|
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(),
|
||||||
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
|
l1.angle(), QString().setNum(l1.angle()), l2.angle(),
|
||||||
QString().setNum(l2.angle()));
|
QString().setNum(l2.angle()));
|
||||||
Q_ASSERT(arc1 != 0);
|
Q_CHECK_PTR(arc1);
|
||||||
arc1->setMode(Draw::Modeling);
|
arc1->setMode(Draw::Modeling);
|
||||||
idObject = data->AddGObject(arc1);
|
idObject = data->AddGObject(arc1);
|
||||||
|
|
||||||
VArc *arc2 = new VArc(*arc1);
|
VArc *arc2 = new VArc(*arc1);
|
||||||
Q_ASSERT(arc2 != 0);
|
Q_CHECK_PTR(arc2);
|
||||||
arc2->setMode(Draw::Modeling);
|
arc2->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(arc2);
|
id = data->AddGObject(arc2);
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *p1 = new VPointF(spline->GetP1());
|
||||||
Q_ASSERT(p1 != 0);
|
Q_CHECK_PTR(p1);
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
qint64 idP1 = data->AddGObject(p1);
|
qint64 idP1 = data->AddGObject(p1);
|
||||||
|
|
||||||
|
@ -146,17 +146,17 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline->GetP4());
|
VPointF *p4 = new VPointF(spline->GetP4());
|
||||||
Q_ASSERT(p4 != 0);
|
Q_CHECK_PTR(p4);
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
qint64 idP4 = data->AddGObject(p4);
|
qint64 idP4 = data->AddGObject(p4);
|
||||||
|
|
||||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||||
Draw::Modeling);
|
Draw::Modeling);
|
||||||
Q_ASSERT(spl != 0);
|
Q_CHECK_PTR(spl);
|
||||||
idObject = data->AddGObject(spl);
|
idObject = data->AddGObject(spl);
|
||||||
|
|
||||||
VSpline *spl1 = new VSpline(*spl);
|
VSpline *spl1 = new VSpline(*spl);
|
||||||
Q_ASSERT(spl1 != 0);
|
Q_CHECK_PTR(spl1);
|
||||||
spl1->setMode(Draw::Modeling);
|
spl1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(spl1);
|
id = data->AddGObject(spl1);
|
||||||
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
||||||
|
@ -172,7 +172,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
Q_ASSERT(path != 0);
|
Q_CHECK_PTR(path);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
qint32 k = splinePath->getMaxCountPoints();
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
|
@ -183,7 +183,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
VPointF *p1 = new VPointF(spline.GetP1());
|
||||||
Q_ASSERT(p1 != 0);
|
Q_CHECK_PTR(p1);
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
qint64 idP1 = data->AddGObject(p1);
|
qint64 idP1 = data->AddGObject(p1);
|
||||||
|
@ -198,7 +198,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline.GetP4());
|
VPointF *p4 = new VPointF(spline.GetP4());
|
||||||
Q_ASSERT(p4 != 0);
|
Q_CHECK_PTR(p4);
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
qint64 idP4 = data->AddGObject(p4);
|
qint64 idP4 = data->AddGObject(p4);
|
||||||
|
@ -221,7 +221,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
idObject = data->AddGObject(path);
|
idObject = data->AddGObject(path);
|
||||||
|
|
||||||
VSplinePath *path1 = new VSplinePath(*path);
|
VSplinePath *path1 = new VSplinePath(*path);
|
||||||
Q_ASSERT(path1 != 0);
|
Q_CHECK_PTR(path1);
|
||||||
path1->setMode(Draw::Modeling);
|
path1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(path1);
|
id = data->AddGObject(path1);
|
||||||
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool);
|
||||||
|
@ -246,7 +246,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
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<const VPointF *>(det.at(i).getId()));
|
||||||
Q_ASSERT(point != 0);
|
Q_CHECK_PTR(point);
|
||||||
point->setMode(Draw::Modeling);
|
point->setMode(Draw::Modeling);
|
||||||
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(point, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
|
@ -266,7 +266,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
VPointF p2 = VPointF(arc->GetP2());
|
VPointF p2 = VPointF(arc->GetP2());
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
VPointF *center = new VPointF(arc->GetCenter());
|
VPointF *center = new VPointF(arc->GetCenter());
|
||||||
Q_ASSERT(center != 0);
|
Q_CHECK_PTR(center);
|
||||||
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
data->UpdateGObject(idDetail+idCount, center);
|
data->UpdateGObject(idDetail+idCount, center);
|
||||||
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
|
VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(),
|
||||||
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle()));
|
||||||
Q_ASSERT(arc1);
|
Q_CHECK_PTR(arc1);
|
||||||
arc1->setMode(Draw::Modeling);
|
arc1->setMode(Draw::Modeling);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, arc1);
|
data->UpdateGObject(idDetail+idCount, arc1);
|
||||||
|
@ -293,7 +293,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
const VSpline *spline = data->GeometricObject<const VSpline *>(det.at(i).getId());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline->GetP1());
|
VPointF *p1 = new VPointF(spline->GetP1());
|
||||||
Q_ASSERT(p1 != 0);
|
Q_CHECK_PTR(p1);
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p1);
|
data->UpdateGObject(idDetail+idCount, p1);
|
||||||
|
@ -305,7 +305,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline->GetP4());
|
VPointF *p4 = new VPointF(spline->GetP4());
|
||||||
Q_ASSERT(p4 != 0);
|
Q_CHECK_PTR(p4);
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p4);
|
data->UpdateGObject(idDetail+idCount, p4);
|
||||||
|
@ -313,7 +313,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0,
|
||||||
Draw::Modeling);
|
Draw::Modeling);
|
||||||
|
|
||||||
Q_ASSERT(spl != 0);
|
Q_CHECK_PTR(spl);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, spl);
|
data->UpdateGObject(idDetail+idCount, spl);
|
||||||
|
|
||||||
|
@ -326,10 +326,10 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0)
|
||||||
{
|
{
|
||||||
VSplinePath *path = new VSplinePath();
|
VSplinePath *path = new VSplinePath();
|
||||||
Q_ASSERT(path != 0);
|
Q_CHECK_PTR(path);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
Q_ASSERT(splinePath != 0);
|
Q_CHECK_PTR(splinePath);
|
||||||
qint32 k = splinePath->getMaxCountPoints();
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -338,7 +338,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
splinePath->at(i).KAsm1(), splinePath->getKCurve());
|
||||||
|
|
||||||
VPointF *p1 = new VPointF(spline.GetP1());
|
VPointF *p1 = new VPointF(spline.GetP1());
|
||||||
Q_ASSERT(p1 != 0);
|
Q_CHECK_PTR(p1);
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
|
@ -354,7 +354,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
angle);
|
angle);
|
||||||
|
|
||||||
VPointF *p4 = new VPointF(spline.GetP4());
|
VPointF *p4 = new VPointF(spline.GetP4());
|
||||||
Q_ASSERT(p4 != 0);
|
Q_CHECK_PTR(p4);
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
|
|
|
@ -37,7 +37,7 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
|
||||||
Q_ASSERT(editor != 0);
|
Q_CHECK_PTR(editor);
|
||||||
editor->setMinimum(-10000.0);
|
editor->setMinimum(-10000.0);
|
||||||
editor->setMaximum(10000.0);
|
editor->setMaximum(10000.0);
|
||||||
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor);
|
||||||
|
@ -50,7 +50,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in
|
||||||
qreal value = index.model()->data(index, Qt::EditRole).toDouble();
|
qreal value = index.model()->data(index, Qt::EditRole).toDouble();
|
||||||
|
|
||||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
|
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
|
||||||
Q_ASSERT(spinBox != 0);
|
Q_CHECK_PTR(spinBox);
|
||||||
spinBox->setValue(value);
|
spinBox->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void DoubleSpinBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &in
|
||||||
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
void DoubleSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
|
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(editor);
|
||||||
Q_ASSERT(spinBox != 0);
|
Q_CHECK_PTR(spinBox);
|
||||||
spinBox->interpretText();
|
spinBox->interpretText();
|
||||||
qreal value = spinBox->value();
|
qreal value = spinBox->value();
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ void DoubleSpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOp
|
||||||
void DoubleSpinBoxDelegate::commitAndCloseEditor()
|
void DoubleSpinBoxDelegate::commitAndCloseEditor()
|
||||||
{
|
{
|
||||||
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(sender());
|
||||||
Q_ASSERT(spinBox != 0);
|
Q_CHECK_PTR(spinBox);
|
||||||
qreal value = spinBox->value();
|
qreal value = spinBox->value();
|
||||||
if (qFuzzyCompare ( lastValue, value ) == false)
|
if (qFuzzyCompare ( lastValue, value ) == false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimeLine *anim = new QTimeLine(300, this);
|
QTimeLine *anim = new QTimeLine(300, this);
|
||||||
Q_ASSERT(anim != 0);
|
Q_CHECK_PTR(anim);
|
||||||
anim->setUpdateInterval(20);
|
anim->setUpdateInterval(20);
|
||||||
|
|
||||||
if (QApplication::keyboardModifiers() == Qt::ControlModifier)
|
if (QApplication::keyboardModifiers() == Qt::ControlModifier)
|
||||||
|
|
|
@ -62,7 +62,7 @@ void VTableGraphicsView::MirrorItem()
|
||||||
for ( qint32 i = 0; i < list.count(); ++i )
|
for ( qint32 i = 0; i < list.count(); ++i )
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = list.at(i);
|
QGraphicsItem *item = list.at(i);
|
||||||
Q_ASSERT(item != 0);
|
Q_CHECK_PTR(item);
|
||||||
QRectF itemRectOld = item->sceneBoundingRect();
|
QRectF itemRectOld = item->sceneBoundingRect();
|
||||||
//Get the current transform
|
//Get the current transform
|
||||||
QTransform transform(item->transform());
|
QTransform transform(item->transform());
|
||||||
|
@ -170,7 +170,7 @@ void VTableGraphicsView::rotateIt()
|
||||||
for ( qint32 i = 0; i < list.count(); ++i )
|
for ( qint32 i = 0; i < list.count(); ++i )
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = list.at(i);
|
QGraphicsItem *item = list.at(i);
|
||||||
Q_ASSERT(item != 0);
|
Q_CHECK_PTR(item);
|
||||||
item->setTransformOriginPoint(item->boundingRect().center());
|
item->setTransformOriginPoint(item->boundingRect().center());
|
||||||
item->setRotation(item->rotation() + 90);
|
item->setRotation(item->rotation() + 90);
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,8 +335,8 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element
|
||||||
void VDomDocument::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
void VDomDocument::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
||||||
VMainGraphicsScene *sceneDetail)
|
VMainGraphicsScene *sceneDetail)
|
||||||
{
|
{
|
||||||
Q_ASSERT(sceneDraw != 0);
|
Q_CHECK_PTR(sceneDraw);
|
||||||
Q_ASSERT(sceneDetail != 0);
|
Q_CHECK_PTR(sceneDetail);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
TestUniqueId();
|
TestUniqueId();
|
||||||
|
@ -577,8 +577,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics
|
||||||
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
||||||
const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode)
|
const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode)
|
||||||
{
|
{
|
||||||
Q_ASSERT(sceneDraw != 0);
|
Q_CHECK_PTR(sceneDraw);
|
||||||
Q_ASSERT(sceneDetail != 0);
|
Q_CHECK_PTR(sceneDetail);
|
||||||
VMainGraphicsScene *scene = 0;
|
VMainGraphicsScene *scene = 0;
|
||||||
if (mode == Draw::Calculation)
|
if (mode == Draw::Calculation)
|
||||||
{
|
{
|
||||||
|
@ -627,7 +627,7 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce
|
||||||
void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT(sceneDetail != 0);
|
Q_CHECK_PTR(sceneDetail);
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -697,7 +697,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
||||||
void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT(sceneDetail != 0);
|
Q_CHECK_PTR(sceneDetail);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
QDomNode domNode = domElement.firstChild();
|
QDomNode domNode = domElement.firstChild();
|
||||||
while (domNode.isNull() == false)
|
while (domNode.isNull() == false)
|
||||||
|
@ -720,7 +720,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme
|
||||||
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
||||||
const Document::Documents &parse, const QString& type)
|
const Document::Documents &parse, const QString& type)
|
||||||
{
|
{
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
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)
|
||||||
|
@ -744,7 +744,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
|
||||||
Q_ASSERT(spoint != 0);
|
Q_CHECK_PTR(spoint);
|
||||||
scene->addItem(spoint);
|
scene->addItem(spoint);
|
||||||
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||||
|
@ -1093,7 +1093,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -1114,7 +1114,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement
|
||||||
void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type)
|
const Document::Documents &parse, const QString &type)
|
||||||
{
|
{
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
||||||
if (type == VToolSpline::ToolType)
|
if (type == VToolSpline::ToolType)
|
||||||
|
@ -1148,7 +1148,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
||||||
qint64 id = GetParametrId(domElement);
|
qint64 id = GetParametrId(domElement);
|
||||||
qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
|
qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
|
||||||
VSplinePath *path = new VSplinePath(kCurve);
|
VSplinePath *path = new VSplinePath(kCurve);
|
||||||
Q_ASSERT(path != 0);
|
Q_CHECK_PTR(path);
|
||||||
|
|
||||||
QDomNodeList nodeList = domElement.childNodes();
|
QDomNodeList nodeList = domElement.childNodes();
|
||||||
qint32 num = nodeList.size();
|
qint32 num = nodeList.size();
|
||||||
|
@ -1193,7 +1193,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
||||||
qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0");
|
qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0");
|
||||||
qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0");
|
qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0");
|
||||||
VSpline *spl = new VSpline(*data->GeometricObject<const VSpline *>(idObject));
|
VSpline *spl = new VSpline(*data->GeometricObject<const VSpline *>(idObject));
|
||||||
Q_ASSERT(spl != 0);
|
Q_CHECK_PTR(spl);
|
||||||
spl->setIdObject(idObject);
|
spl->setIdObject(idObject);
|
||||||
spl->setMode(Draw::Modeling);
|
spl->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, spl);
|
data->UpdateGObject(id, spl);
|
||||||
|
@ -1215,7 +1215,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
||||||
qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0");
|
qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0");
|
||||||
qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0");
|
qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0");
|
||||||
VSplinePath *path = new VSplinePath(*data->GeometricObject<const VSplinePath *>(idObject));
|
VSplinePath *path = new VSplinePath(*data->GeometricObject<const VSplinePath *>(idObject));
|
||||||
Q_ASSERT(path != 0);
|
Q_CHECK_PTR(path);
|
||||||
path->setIdObject(idObject);
|
path->setIdObject(idObject);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, path);
|
data->UpdateGObject(id, path);
|
||||||
|
@ -1234,7 +1234,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
||||||
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type)
|
const Document::Documents &parse, const QString &type)
|
||||||
{
|
{
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
||||||
if (type == VToolArc::ToolType)
|
if (type == VToolArc::ToolType)
|
||||||
|
@ -1266,7 +1266,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
|
||||||
qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0");
|
qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0");
|
||||||
qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0");
|
qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0");
|
||||||
VArc *arc = new VArc(*data->GeometricObject<const VArc *>(idObject));
|
VArc *arc = new VArc(*data->GeometricObject<const VArc *>(idObject));
|
||||||
Q_ASSERT(arc != 0);
|
Q_CHECK_PTR(arc);
|
||||||
arc->setIdObject(idObject);
|
arc->setIdObject(idObject);
|
||||||
arc->setMode(Draw::Modeling);
|
arc->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
|
@ -1285,7 +1285,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
|
||||||
void VDomDocument::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VDomDocument::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type)
|
const Document::Documents &parse, const QString &type)
|
||||||
{
|
{
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
||||||
if (type == VToolUnionDetails::ToolType)
|
if (type == VToolUnionDetails::ToolType)
|
||||||
|
@ -1315,7 +1315,7 @@ void VDomDocument::ParseToolsElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
void VDomDocument::FullUpdateTree()
|
void VDomDocument::FullUpdateTree()
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
VMainGraphicsScene *scene = new VMainGraphicsScene();
|
||||||
Q_ASSERT(scene != 0);
|
Q_CHECK_PTR(scene);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Parse(Document::LiteParse, scene, scene);
|
Parse(Document::LiteParse, scene, scene);
|
||||||
|
@ -1403,16 +1403,16 @@ void VDomDocument::setCurrentData()
|
||||||
void VDomDocument::AddTool(const qint64 &id, VDataTool *tool)
|
void VDomDocument::AddTool(const qint64 &id, VDataTool *tool)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
tools.insert(id, tool);
|
tools.insert(id, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data)
|
void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
Q_ASSERT(data != 0);
|
Q_CHECK_PTR(data);
|
||||||
VDataTool *tool = tools.value(id);
|
VDataTool *tool = tools.value(id);
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
tool->VDataTool::setData(data);
|
tool->VDataTool::setData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1420,7 +1420,7 @@ void VDomDocument::IncrementReferens(qint64 id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
VDataTool *tool = tools.value(id);
|
VDataTool *tool = tools.value(id);
|
||||||
Q_ASSERT(tool != 0);
|
Q_CHECK_PTR(tool);
|
||||||
tool->incrementReferens();
|
tool->incrementReferens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user