Merge with feature. Fixed issue #74. Fold Line in pattern piece.
--HG-- branch : develop
This commit is contained in:
commit
17fa00ba75
|
@ -40,10 +40,10 @@ class VContainer;
|
|||
* Note. If created to many parser for different purpes in the same time parser can work wrong.
|
||||
* Example:
|
||||
* DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data);
|
||||
* dialog->setFormula(formula);
|
||||
* dialog->SetFormula(formula);
|
||||
* if (dialog->exec() == QDialog::Accepted)
|
||||
* {
|
||||
* formula = dialog->getFormula();
|
||||
* formula = dialog->GetFormula();
|
||||
* //Need delete dialog here because parser in dialog don't allow use correct separator for parsing here.
|
||||
* //Don't know why.
|
||||
* delete dialog;
|
||||
|
|
|
@ -56,7 +56,7 @@ VFormula &VFormula::operator=(const VFormula &formula)
|
|||
{
|
||||
return *this;
|
||||
}
|
||||
this->formula = formula.getFormula();
|
||||
this->formula = formula.GetFormula();
|
||||
this->value = formula.getStringValue();
|
||||
this->checkZero = formula.getCheckZero();
|
||||
this->data = formula.getData();
|
||||
|
@ -69,7 +69,7 @@ VFormula &VFormula::operator=(const VFormula &formula)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula::VFormula(const VFormula &formula)
|
||||
:formula(formula.getFormula()), value(formula.getStringValue()), checkZero(formula.getCheckZero()),
|
||||
:formula(formula.GetFormula()), value(formula.getStringValue()), checkZero(formula.getCheckZero()),
|
||||
data(formula.getData()), toolId(formula.getToolId()), postfix(formula.getPostfix()), _error(formula.error()),
|
||||
dValue(formula.getDoubleValue())
|
||||
{}
|
||||
|
@ -78,7 +78,7 @@ VFormula::VFormula(const VFormula &formula)
|
|||
bool VFormula::operator==(const VFormula &formula) const
|
||||
{
|
||||
bool isEqual = false;
|
||||
if (this->formula == formula.getFormula() && this->value == formula.getStringValue() &&
|
||||
if (this->formula == formula.GetFormula() && this->value == formula.getStringValue() &&
|
||||
this->checkZero == formula.getCheckZero() && this->data == formula.getData() &&
|
||||
this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() &&
|
||||
this->_error == formula.error() && qFuzzyCompare(this->dValue, formula.getDoubleValue()))
|
||||
|
@ -94,7 +94,7 @@ bool VFormula::operator!=(const VFormula &formula) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VFormula::getFormula(FormulaType type) const
|
||||
QString VFormula::GetFormula(FormulaType type) const
|
||||
{
|
||||
if (type == FormulaType::ToUser)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ QString VFormula::getFormula(FormulaType type) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::setFormula(const QString &value, FormulaType type)
|
||||
void VFormula::SetFormula(const QString &value, FormulaType type)
|
||||
{
|
||||
if (formula != value)
|
||||
{
|
||||
|
|
|
@ -46,8 +46,8 @@ public:
|
|||
bool operator==(const VFormula &formula) const;
|
||||
bool operator!=(const VFormula &formula) const;
|
||||
|
||||
QString getFormula(FormulaType type = FormulaType::ToUser) const;
|
||||
void setFormula(const QString &value, FormulaType type = FormulaType::ToUser);
|
||||
QString GetFormula(FormulaType type = FormulaType::ToUser) const;
|
||||
void SetFormula(const QString &value, FormulaType type = FormulaType::ToUser);
|
||||
|
||||
QString getStringValue() const;
|
||||
qreal getDoubleValue() const;
|
||||
|
|
|
@ -74,7 +74,7 @@ void DialogHistory::DialogAccepted()
|
|||
{
|
||||
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
||||
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||
emit ShowHistoryTool(id, Qt::green, false);
|
||||
emit ShowHistoryTool(id, false);
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
|
@ -103,12 +103,12 @@ void DialogHistory::cellClicked(int row, int column)
|
|||
{
|
||||
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
||||
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||
emit ShowHistoryTool(id, Qt::green, false);
|
||||
emit ShowHistoryTool(id, false);
|
||||
|
||||
cursorToolRecordRow = row;
|
||||
item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
||||
id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||
emit ShowHistoryTool(id, Qt::green, true);
|
||||
emit ShowHistoryTool(id, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ void DialogHistory::ShowPoint()
|
|||
cursorToolRecordRow = 0;
|
||||
item = ui->tableWidget->item(0, 0);
|
||||
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||
emit ShowHistoryTool(id, Qt::green, true);
|
||||
emit ShowHistoryTool(id, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,6 +466,6 @@ void DialogHistory::closeEvent(QCloseEvent *event)
|
|||
{
|
||||
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
|
||||
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
|
||||
emit ShowHistoryTool(id, Qt::green, false);
|
||||
emit ShowHistoryTool(id, false);
|
||||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
|
|
@ -63,10 +63,9 @@ signals:
|
|||
/**
|
||||
* @brief ShowHistoryTool signal change color of selected in records tool
|
||||
* @param id id of tool
|
||||
* @param color new color of tool
|
||||
* @param enable true enable selection, false disable selection
|
||||
*/
|
||||
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
void ShowHistoryTool(quint32 id, bool enable);
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
private:
|
||||
|
|
|
@ -41,9 +41,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine), number(0),
|
||||
typeLine(QString()), formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaBaseHeight(0),
|
||||
line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine),
|
||||
formula(QString()), formulaBaseHeight(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -61,7 +60,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId,
|
|||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
ui->comboBoxLineType->setCurrentIndex(0);
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere);
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged);
|
||||
|
@ -180,16 +179,14 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogAlongLine::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
|
||||
line->setPoint1Id(firstPointId);
|
||||
line->setPoint2Id(secondPointId);
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setLength(formula);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -202,32 +199,32 @@ void DialogAlongLine::closeEvent(QCloseEvent *event)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPointId set id second point of line
|
||||
* @brief SetSecondPointId set id second point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogAlongLine::setSecondPointId(const quint32 &value)
|
||||
void DialogAlongLine::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPointId set id first point of line
|
||||
* @brief SetFirstPointId set id first point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogAlongLine::setFirstPointId(const quint32 &value)
|
||||
void DialogAlongLine::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogAlongLine::setFormula(const QString &value)
|
||||
void DialogAlongLine::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed.
|
||||
|
@ -242,23 +239,74 @@ void DialogAlongLine::setFormula(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogAlongLine::setTypeLine(const QString &value)
|
||||
void DialogAlongLine::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogAlongLine::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAlongLine::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogAlongLine::setPointName(const QString &value)
|
||||
void DialogAlongLine::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogAlongLine::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogAlongLine::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPointId return id first point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogAlongLine::GetFirstPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPointId return id second point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogAlongLine::GetSecondPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
|
|
@ -47,20 +47,23 @@ class DialogAlongLine : public DialogTool
|
|||
public:
|
||||
DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogAlongLine();
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -85,74 +88,12 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogAlongLine *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief formula formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief firstPointId id first point of line */
|
||||
quint32 firstPointId;
|
||||
|
||||
/** @brief secondPointId id second point of line */
|
||||
quint32 secondPointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
VisToolAlongLine *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogAlongLine::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogAlongLine::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogAlongLine::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPointId return id first point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogAlongLine::getFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPointId return id second point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogAlongLine::getSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
#endif // DIALOGALONGLINE_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>499</height>
|
||||
<height>532</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -223,6 +223,9 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelEditNamePoint">
|
||||
<property name="text">
|
||||
|
@ -230,9 +233,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelFirstPoint">
|
||||
<property name="text">
|
||||
|
@ -299,6 +299,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
*/
|
||||
DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false),
|
||||
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(NULL_ID), radius(QString()),
|
||||
f1(QString()), f2(QString()), formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr),
|
||||
angleF1(INT_MIN), angleF2(INT_MIN)
|
||||
timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), radius(QString()), f1(QString()), f2(QString()),
|
||||
formulaBaseHeight(0), formulaBaseHeightF1(0), formulaBaseHeightF2(0), path(nullptr), angleF1(INT_MIN),
|
||||
angleF2(INT_MIN)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -74,6 +74,7 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
|
|||
InitOkCancelApply(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
CheckState();
|
||||
|
||||
|
@ -131,9 +132,8 @@ DialogArc::~DialogArc()
|
|||
*/
|
||||
void DialogArc::SetCenter(const quint32 &value)
|
||||
{
|
||||
center = value;
|
||||
ChangeCurrentData(ui->comboBoxBasePoint, center);
|
||||
path->setPoint1Id(center);
|
||||
ChangeCurrentData(ui->comboBoxBasePoint, value);
|
||||
path->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -154,6 +154,18 @@ void DialogArc::SetF2(const QString &value)
|
|||
MoveCursorToEnd(ui->plainTextEditF2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogArc::GetColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogArc::SetColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetF1 set formula first angle of arc
|
||||
|
@ -234,9 +246,8 @@ void DialogArc::SaveData()
|
|||
f1.replace("\n", " ");
|
||||
f2 = ui->plainTextEditF2->toPlainText();
|
||||
f2.replace("\n", " ");
|
||||
center = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
|
||||
path->setPoint1Id(center);
|
||||
path->setPoint1Id(GetCenter());
|
||||
path->setRadius(radius);
|
||||
path->setF1(f1);
|
||||
path->setF2(f2);
|
||||
|
@ -436,3 +447,43 @@ void DialogArc::CheckAngles()
|
|||
|
||||
DialogArc::CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetCenter return id of center point
|
||||
* @return id id
|
||||
*/
|
||||
quint32 DialogArc::GetCenter() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetRadius return formula of radius
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogArc::GetRadius() const
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetF1 return formula first angle of arc
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogArc::GetF1() const
|
||||
{
|
||||
return f1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetF2 return formula second angle of arc
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogArc::GetF2() const
|
||||
{
|
||||
return f2;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,9 @@ public:
|
|||
|
||||
QString GetF2() const;
|
||||
void SetF2(const QString &value);
|
||||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -108,9 +111,6 @@ private:
|
|||
/** @brief timerF2 timer of check formula of second angle */
|
||||
QTimer *timerF2;
|
||||
|
||||
/** @brief center id of center point */
|
||||
quint32 center;
|
||||
|
||||
/** @brief radius formula of radius */
|
||||
QString radius;
|
||||
|
||||
|
@ -136,44 +136,4 @@ private:
|
|||
void CheckAngles();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetCenter return id of center point
|
||||
* @return id id
|
||||
*/
|
||||
inline quint32 DialogArc::GetCenter() const
|
||||
{
|
||||
return center;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetRadius return formula of radius
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogArc::GetRadius() const
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetF1 return formula first angle of arc
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogArc::GetF1() const
|
||||
{
|
||||
return f1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetF2 return formula second angle of arc
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogArc::GetF2() const
|
||||
{
|
||||
return f2;
|
||||
}
|
||||
|
||||
#endif // DIALOGARC_H
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>423</width>
|
||||
<height>544</height>
|
||||
<width>425</width>
|
||||
<height>577</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -583,32 +583,42 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Center point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxBasePoint">
|
||||
<property name="toolTip">
|
||||
<string>Select point of center of arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Center point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxBasePoint">
|
||||
<property name="toolTip">
|
||||
<string>Select point of center of arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxColor"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
|
@ -782,7 +792,6 @@
|
|||
<tabstop>pushButtonGrowLengthF1</tabstop>
|
||||
<tabstop>toolButtonPutHereF2</tabstop>
|
||||
<tabstop>toolButtonEqualF2</tabstop>
|
||||
<tabstop>comboBoxBasePoint</tabstop>
|
||||
<tabstop>radioButtonSizeGrowth</tabstop>
|
||||
<tabstop>radioButtonStandardTable</tabstop>
|
||||
<tabstop>radioButtonIncrements</tabstop>
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), typeLine(QString()),
|
||||
formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), thirdPointId(NULL_ID), formulaBaseHeight(0),
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), formula(QString()), formulaBaseHeight(0),
|
||||
line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -62,6 +61,7 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW
|
|||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
FillComboBoxPoints(ui->comboBoxThirdPoint);
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere);
|
||||
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal);
|
||||
|
@ -200,10 +200,10 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogBisector::setPointName(const QString &value)
|
||||
void DialogBisector::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -211,22 +211,21 @@ void DialogBisector::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogBisector::setTypeLine(const QString &value)
|
||||
void DialogBisector::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogBisector::setFormula(const QString &value)
|
||||
void DialogBisector::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed.
|
||||
|
@ -241,53 +240,62 @@ void DialogBisector::setFormula(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPointId set id of first point
|
||||
* @brief SetFirstPointId set id of first point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogBisector::setFirstPointId(const quint32 &value)
|
||||
void DialogBisector::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
||||
line->setPoint1Id(firstPointId);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPointId set id of second point
|
||||
* @brief SetSecondPointId set id of second point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogBisector::setSecondPointId(const quint32 &value)
|
||||
void DialogBisector::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
||||
line->setPoint2Id(secondPointId);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setThirdPointId set id of third point
|
||||
* @brief SetThirdPointId set id of third point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogBisector::setThirdPointId(const quint32 &value)
|
||||
void DialogBisector::SetThirdPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxThirdPoint, thirdPointId, value);
|
||||
line->setPoint3Id(thirdPointId);
|
||||
setCurrentPointId(ui->comboBoxThirdPoint, value);
|
||||
line->setPoint3Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogBisector::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogBisector::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
thirdPointId = getCurrentObjectId(ui->comboBoxThirdPoint);
|
||||
|
||||
line->setPoint1Id(firstPointId);
|
||||
line->setPoint2Id(secondPointId);
|
||||
line->setPoint3Id(thirdPointId);
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setPoint3Id(GetThirdPointId());
|
||||
line->setLength(formula);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -297,3 +305,53 @@ void DialogBisector::closeEvent(QCloseEvent *event)
|
|||
ui->plainTextEditFormula->blockSignals(true);
|
||||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogBisector::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogBisector::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogBisector::GetFirstPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogBisector::GetSecondPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetThirdPointId return id of third point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogBisector::GetThirdPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxThirdPoint);
|
||||
}
|
||||
|
|
|
@ -49,23 +49,25 @@ public:
|
|||
DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogBisector();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
|
||||
quint32 getThirdPointId() const;
|
||||
void setThirdPointId(const quint32 &value);
|
||||
quint32 GetThirdPointId() const;
|
||||
void SetThirdPointId(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -90,88 +92,13 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogBisector *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief formula formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief firstPointId id of first point */
|
||||
quint32 firstPointId;
|
||||
|
||||
/** @brief secondPointId id of second point */
|
||||
quint32 secondPointId;
|
||||
|
||||
/** @brief thirdPointId id of third point */
|
||||
quint32 thirdPointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
VisToolBisector *line;
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogBisector::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogBisector::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogBisector::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogBisector::getFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogBisector::getSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getThirdPointId return id of third point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogBisector::getThirdPointId() const
|
||||
{
|
||||
return thirdPointId;
|
||||
}
|
||||
|
||||
#endif // DIALOGBISECTOR_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>532</height>
|
||||
<height>565</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -325,6 +325,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis), number(0), typeLine(QString()),
|
||||
formulaAngle(QString()), basePointId(NULL_ID), curveId(NULL_ID), formulaBaseHeightAngle(0), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCurveIntersectAxis),
|
||||
formulaAngle(QString()), formulaBaseHeightAngle(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -57,6 +57,7 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
|
|||
FillComboBoxPoints(ui->comboBoxAxisPoint);
|
||||
FillComboBoxCurves(ui->comboBoxCurve);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::PutAngle);
|
||||
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogCurveIntersectAxis::PutVal);
|
||||
|
@ -80,40 +81,33 @@ DialogCurveIntersectAxis::~DialogCurveIntersectAxis()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCurveIntersectAxis::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::setPointName(const QString &value)
|
||||
void DialogCurveIntersectAxis::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCurveIntersectAxis::getTypeLine() const
|
||||
QString DialogCurveIntersectAxis::GetTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::setTypeLine(const QString &value)
|
||||
void DialogCurveIntersectAxis::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCurveIntersectAxis::getAngle() const
|
||||
QString DialogCurveIntersectAxis::GetAngle() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formulaAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::setAngle(const QString &value)
|
||||
void DialogCurveIntersectAxis::SetAngle(const QString &value)
|
||||
{
|
||||
formulaAngle = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -123,36 +117,48 @@ void DialogCurveIntersectAxis::setAngle(const QString &value)
|
|||
this->DeployAngleTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formulaAngle);
|
||||
line->setAngle(formulaAngle);
|
||||
line->SetAngle(formulaAngle);
|
||||
MoveCursorToEnd(ui->plainTextEditFormula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogCurveIntersectAxis::getBasePointId() const
|
||||
quint32 DialogCurveIntersectAxis::GetBasePointId() const
|
||||
{
|
||||
return basePointId;
|
||||
return getCurrentObjectId(ui->comboBoxAxisPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::setBasePointId(const quint32 &value)
|
||||
void DialogCurveIntersectAxis::SetBasePointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxAxisPoint, basePointId, value);
|
||||
setCurrentPointId(ui->comboBoxAxisPoint, value);
|
||||
line->setAxisPointId(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogCurveIntersectAxis::getCurveId() const
|
||||
{
|
||||
return curveId;
|
||||
return getCurrentObjectId(ui->comboBoxCurve);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::setCurveId(const quint32 &value)
|
||||
{
|
||||
setCurrentCurveId(ui->comboBoxCurve, curveId, value);
|
||||
setCurrentCurveId(ui->comboBoxCurve, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCurveIntersectAxis::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCurveIntersectAxis::ShowDialog(bool click)
|
||||
{
|
||||
|
@ -163,7 +169,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
|||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
|
@ -174,7 +180,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
|||
}
|
||||
}
|
||||
this->setModal(true);
|
||||
this->setAngle(line->Angle());//Show in dialog angle what user choose
|
||||
this->SetAngle(line->Angle());//Show in dialog angle what user choose
|
||||
emit ToolTip("");
|
||||
timerFormula->start();
|
||||
this->show();
|
||||
|
@ -204,7 +210,6 @@ void DialogCurveIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (SetObject(id, ui->comboBoxAxisPoint, ""))
|
||||
{
|
||||
basePointId = id;
|
||||
line->setAxisPointId(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
|
@ -258,18 +263,14 @@ void DialogCurveIntersectAxis::ShowVisualization()
|
|||
void DialogCurveIntersectAxis::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
|
||||
formulaAngle = ui->plainTextEditFormula->toPlainText();
|
||||
formulaAngle.replace("\n", " ");
|
||||
|
||||
basePointId = getCurrentObjectId(ui->comboBoxAxisPoint);
|
||||
curveId = getCurrentObjectId(ui->comboBoxCurve);
|
||||
|
||||
line->setPoint1Id(curveId);
|
||||
line->setAxisPointId(basePointId);
|
||||
line->setAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setPoint1Id(getCurveId());
|
||||
line->setAxisPointId(GetBasePointId());
|
||||
line->SetAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,21 +45,23 @@ public:
|
|||
DialogCurveIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogCurveIntersectAxis();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString getAngle() const;
|
||||
void setAngle(const QString &value);
|
||||
QString GetAngle() const;
|
||||
void SetAngle(const QString &value);
|
||||
|
||||
quint32 getBasePointId() const;
|
||||
void setBasePointId(const quint32 &value);
|
||||
quint32 GetBasePointId() const;
|
||||
void SetBasePointId(const quint32 &value);
|
||||
|
||||
quint32 getCurveId() const;
|
||||
void setCurveId(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
|
||||
virtual void ShowDialog(bool click);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
|
@ -78,15 +80,7 @@ private:
|
|||
Q_DISABLE_COPY(DialogCurveIntersectAxis)
|
||||
Ui::DialogCurveIntersectAxis *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
QString formulaAngle;
|
||||
quint32 basePointId;
|
||||
quint32 curveId;
|
||||
int formulaBaseHeightAngle;
|
||||
|
||||
VisToolCurveIntersectAxis *line;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>419</width>
|
||||
<height>499</height>
|
||||
<height>532</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -308,6 +308,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()),
|
||||
arcId(NULL_ID), formulaBaseHeight(0), path(nullptr)
|
||||
: DialogTool(data, toolId, parent), ui(new Ui::DialogCutArc), formula(QString()), formulaBaseHeight(0),
|
||||
path(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -58,6 +58,7 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
|
|||
CheckState();
|
||||
|
||||
FillComboBoxArcs(ui->comboBoxArc);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal);
|
||||
|
@ -133,9 +134,8 @@ void DialogCutArc::SaveData()
|
|||
pointName = ui->lineEditNamePoint->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
arcId = getCurrentObjectId(ui->comboBoxArc);
|
||||
|
||||
path->setPoint1Id(arcId);
|
||||
path->setPoint1Id(getArcId());
|
||||
path->setLength(formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
@ -154,16 +154,28 @@ void DialogCutArc::closeEvent(QCloseEvent *event)
|
|||
*/
|
||||
void DialogCutArc::setArcId(const quint32 &value)
|
||||
{
|
||||
setCurrentArcId(ui->comboBoxArc, arcId, value, ComboBoxCutArc::CutArc);
|
||||
path->setPoint1Id(arcId);
|
||||
setCurrentArcId(ui->comboBoxArc, value, ComboBoxCutArc::CutArc);
|
||||
path->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutArc::GetColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutArc::SetColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string with formula length
|
||||
* @brief SetFormula set string with formula length
|
||||
* @param value string with formula
|
||||
*/
|
||||
void DialogCutArc::setFormula(const QString &value)
|
||||
void DialogCutArc::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed.
|
||||
|
@ -178,10 +190,10 @@ void DialogCutArc::setFormula(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name point on arc
|
||||
* @brief SetPointName set name point on arc
|
||||
* @param value name
|
||||
*/
|
||||
void DialogCutArc::setPointName(const QString &value)
|
||||
void DialogCutArc::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -189,10 +201,20 @@ void DialogCutArc::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string with formula length
|
||||
* @brief GetFormula return string with formula length
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogCutArc::getFormula() const
|
||||
QString DialogCutArc::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getArcId return id of arc
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogCutArc::getArcId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxArc);
|
||||
}
|
||||
|
|
|
@ -49,14 +49,16 @@ public:
|
|||
DialogCutArc(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogCutArc();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 getArcId() const;
|
||||
void setArcId(const quint32 &value);
|
||||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -82,33 +84,10 @@ private:
|
|||
/** @brief formula string with formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief arcId keep id of arc */
|
||||
quint32 arcId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
VisToolCutArc *path;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name point on arc
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogCutArc::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getArcId return id of arc
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogCutArc::getArcId() const
|
||||
{
|
||||
return arcId;
|
||||
}
|
||||
|
||||
#endif // DIALOGCUTARC_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>433</height>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -250,6 +250,16 @@
|
|||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()),
|
||||
splineId(NULL_ID), formulaBaseHeight(0), path(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSpline), formula(QString()), formulaBaseHeight(0),
|
||||
path(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -57,6 +57,7 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
|
|||
CheckState();
|
||||
|
||||
FillComboBoxSplines(ui->comboBoxSpline);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal);
|
||||
|
@ -80,10 +81,10 @@ DialogCutSpline::~DialogCutSpline()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogCutSpline::setPointName(const QString &value)
|
||||
void DialogCutSpline::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -91,10 +92,10 @@ void DialogCutSpline::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogCutSpline::setFormula(const QString &value)
|
||||
void DialogCutSpline::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -115,8 +116,20 @@ void DialogCutSpline::setFormula(const QString &value)
|
|||
*/
|
||||
void DialogCutSpline::setSplineId(const quint32 &value)
|
||||
{
|
||||
setCurrentSplineId(ui->comboBoxSpline, splineId, value, ComboBoxCutSpline::CutSpline);
|
||||
path->setPoint1Id(splineId);
|
||||
setCurrentSplineId(ui->comboBoxSpline, value, ComboBoxCutSpline::CutSpline);
|
||||
path->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutSpline::GetColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSpline::SetColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -148,9 +161,8 @@ void DialogCutSpline::SaveData()
|
|||
pointName = ui->lineEditNamePoint->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
splineId = getCurrentObjectId(ui->comboBoxSpline);
|
||||
|
||||
path->setPoint1Id(splineId);
|
||||
path->setPoint1Id(getSplineId());
|
||||
path->setLength(formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
@ -179,3 +191,23 @@ void DialogCutSpline::ShowVisualization()
|
|||
path->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogCutSpline::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSplineId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogCutSpline::getSplineId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSpline);
|
||||
}
|
||||
|
|
|
@ -48,14 +48,16 @@ public:
|
|||
DialogCutSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogCutSpline();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 getSplineId() const;
|
||||
void setSplineId(const quint32 &value);
|
||||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -78,43 +80,10 @@ private:
|
|||
/** @brief formula string with formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief splineId keep id of spline */
|
||||
quint32 splineId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
VisToolCutSpline *path;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogCutSpline::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogCutSpline::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSplineId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogCutSpline::getSplineId() const
|
||||
{
|
||||
return splineId;
|
||||
}
|
||||
|
||||
#endif // DIALOGCUTSPLINE_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>433</height>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -217,7 +217,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -237,7 +237,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEditNamePoint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -250,6 +250,16 @@
|
|||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()),
|
||||
splinePathId(NULL_ID), formulaBaseHeight(0), path(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogCutSplinePath), formula(QString()), formulaBaseHeight(0),
|
||||
path(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -57,6 +57,7 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
|
|||
CheckState();
|
||||
|
||||
FillComboBoxSplinesPath(ui->comboBoxSplinePath);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal);
|
||||
|
@ -80,10 +81,10 @@ DialogCutSplinePath::~DialogCutSplinePath()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogCutSplinePath::setPointName(const QString &value)
|
||||
void DialogCutSplinePath::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -91,10 +92,10 @@ void DialogCutSplinePath::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogCutSplinePath::setFormula(const QString &value)
|
||||
void DialogCutSplinePath::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -115,8 +116,20 @@ void DialogCutSplinePath::setFormula(const QString &value)
|
|||
*/
|
||||
void DialogCutSplinePath::setSplinePathId(const quint32 &value)
|
||||
{
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, ComboBoxCutSpline::CutSpline);
|
||||
path->setPoint1Id(splinePathId);
|
||||
setCurrentSplinePathId(ui->comboBoxSplinePath, value, ComboBoxCutSpline::CutSpline);
|
||||
path->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogCutSplinePath::GetColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCutSplinePath::SetColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -148,9 +161,8 @@ void DialogCutSplinePath::SaveData()
|
|||
pointName = ui->lineEditNamePoint->text();
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
splinePathId = getCurrentObjectId(ui->comboBoxSplinePath);
|
||||
|
||||
path->setPoint1Id(splinePathId);
|
||||
path->setPoint1Id(getSplinePathId());
|
||||
path->setLength(formula);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
@ -179,3 +191,23 @@ void DialogCutSplinePath::ShowVisualization()
|
|||
path->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogCutSplinePath::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSplineId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogCutSplinePath::getSplinePathId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSplinePath);
|
||||
}
|
||||
|
|
|
@ -48,14 +48,16 @@ public:
|
|||
DialogCutSplinePath(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogCutSplinePath();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 getSplinePathId() const;
|
||||
void setSplinePathId(const quint32 &value);
|
||||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -78,43 +80,10 @@ private:
|
|||
/** @brief formula string with formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief splinePathId keep id of splinePath */
|
||||
quint32 splinePathId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
VisToolCutSplinePath *path;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogCutSplinePath::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogCutSplinePath::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSplineId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogCutSplinePath::getSplinePathId() const
|
||||
{
|
||||
return splinePathId;
|
||||
}
|
||||
|
||||
#endif // DIALOGCUTSPLINEPATH_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>433</height>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -217,7 +217,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -237,7 +237,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEditNamePoint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -250,6 +250,22 @@
|
|||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -121,7 +121,7 @@ void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEditWrongFormula::setFormula(const QString &value)
|
||||
void DialogEditWrongFormula::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -147,7 +147,7 @@ void DialogEditWrongFormula::setPostfix(const QString &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogEditWrongFormula::getFormula() const
|
||||
QString DialogEditWrongFormula::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
explicit DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogEditWrongFormula();
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
void setCheckZero(bool value);
|
||||
void setPostfix(const QString &value);
|
||||
public slots:
|
||||
|
|
|
@ -43,9 +43,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine), typeLine(QString()),
|
||||
formulaLength(QString()), formulaAngle(QString()), basePointId(NULL_ID), formulaBaseHeight(0),
|
||||
formulaBaseHeightAngle(0), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogEndLine),
|
||||
formulaLength(QString()), formulaAngle(QString()), formulaBaseHeight(0), formulaBaseHeightAngle(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -64,6 +63,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid
|
|||
|
||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->toolButtonPutHereLength, &QPushButton::clicked, this, &DialogEndLine::PutHere);
|
||||
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogEndLine::PutAngle);
|
||||
|
@ -144,7 +144,6 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (SetObject(id, ui->comboBoxBasePoint, ""))
|
||||
{
|
||||
basePointId = id;
|
||||
line->VisualMode(id);
|
||||
connect(line, &VisToolEndLine::ToolTip, this, &DialogTool::ShowVisToolTip);
|
||||
prepare = true;
|
||||
|
@ -155,10 +154,10 @@ void DialogEndLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogEndLine::setPointName(const QString &value)
|
||||
void DialogEndLine::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -166,22 +165,21 @@ void DialogEndLine::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogEndLine::setTypeLine(const QString &value)
|
||||
void DialogEndLine::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogEndLine::setFormula(const QString &value)
|
||||
void DialogEndLine::SetFormula(const QString &value)
|
||||
{
|
||||
formulaLength = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -197,10 +195,10 @@ void DialogEndLine::setFormula(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setAngle set angle of line
|
||||
* @brief SetAngle set angle of line
|
||||
* @param value angle in degree
|
||||
*/
|
||||
void DialogEndLine::setAngle(const QString &value)
|
||||
void DialogEndLine::SetAngle(const QString &value)
|
||||
{
|
||||
formulaAngle = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -210,21 +208,33 @@ void DialogEndLine::setAngle(const QString &value)
|
|||
this->DeployAngleTextEdit();
|
||||
}
|
||||
ui->plainTextEditAngle->setPlainText(formulaAngle);
|
||||
line->setAngle(formulaAngle);
|
||||
line->SetAngle(formulaAngle);
|
||||
MoveCursorToEnd(ui->plainTextEditAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setBasePointId set id base point of line
|
||||
* @brief SetBasePointId set id base point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogEndLine::setBasePointId(const quint32 &value)
|
||||
void DialogEndLine::SetBasePointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxBasePoint, basePointId, value);
|
||||
setCurrentPointId(ui->comboBoxBasePoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogEndLine::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEndLine::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogEndLine::ShowDialog show dialog after finish working with visual part
|
||||
|
@ -239,7 +249,7 @@ void DialogEndLine::ShowDialog(bool click)
|
|||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
|
@ -250,7 +260,7 @@ void DialogEndLine::ShowDialog(bool click)
|
|||
}
|
||||
}
|
||||
this->setModal(true);
|
||||
this->setAngle(line->Angle());//Show in dialog angle what user choose
|
||||
this->SetAngle(line->Angle());//Show in dialog angle what user choose
|
||||
emit ToolTip("");
|
||||
timerFormula->start();
|
||||
this->show();
|
||||
|
@ -274,7 +284,6 @@ void DialogEndLine::ShowVisualization()
|
|||
void DialogEndLine::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
|
||||
formulaLength = ui->plainTextEditFormula->toPlainText();
|
||||
formulaLength.replace("\n", " ");
|
||||
|
@ -282,12 +291,10 @@ void DialogEndLine::SaveData()
|
|||
formulaAngle = ui->plainTextEditAngle->toPlainText();
|
||||
formulaAngle.replace("\n", " ");
|
||||
|
||||
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
|
||||
line->setPoint1Id(basePointId);
|
||||
line->setPoint1Id(GetBasePointId());
|
||||
line->setLength(formulaLength);
|
||||
line->setAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->SetAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -308,3 +315,43 @@ DialogEndLine::~DialogEndLine()
|
|||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogEndLine::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogEndLine::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formulaLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetAngle return formula angle of line
|
||||
* @return angle formula
|
||||
*/
|
||||
QString DialogEndLine::GetAngle() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formulaAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetBasePointId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogEndLine::GetBasePointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
}
|
||||
|
|
|
@ -48,20 +48,23 @@ public:
|
|||
DialogEndLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogEndLine();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
QString getAngle() const;
|
||||
void setAngle(const QString &value);
|
||||
QString GetAngle() const;
|
||||
void SetAngle(const QString &value);
|
||||
|
||||
quint32 GetBasePointId() const;
|
||||
void SetBasePointId(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
|
||||
quint32 getBasePointId() const;
|
||||
void setBasePointId(const quint32 &value);
|
||||
virtual void ShowDialog(bool click);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
|
@ -90,75 +93,17 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogEndLine *ui;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief formula formula */
|
||||
QString formulaLength;
|
||||
|
||||
/** @brief angle angle of line */
|
||||
QString formulaAngle;
|
||||
|
||||
/** @brief basePointId id base point of line */
|
||||
quint32 basePointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
int formulaBaseHeightAngle;
|
||||
|
||||
VisToolEndLine *line;
|
||||
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogEndLine::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogEndLine::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogEndLine::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formulaLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getAngle return formula angle of line
|
||||
* @return angle formula
|
||||
*/
|
||||
inline QString DialogEndLine::getAngle() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formulaAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getBasePointId return id base point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogEndLine::getBasePointId() const
|
||||
{
|
||||
return basePointId;
|
||||
}
|
||||
|
||||
#endif // DIALOGENDLINE_H
|
||||
|
|
|
@ -409,6 +409,9 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
|
@ -477,6 +480,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), number(0),
|
||||
typeLine(QString()), basePointId(NULL_ID), p1LineId(NULL_ID), p2LineId(NULL_ID), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogHeight), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
|
@ -55,6 +54,8 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
|
|||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogHeight::NamePointChanged);
|
||||
connect(ui->comboBoxBasePoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogHeight::PointNameChanged);
|
||||
|
@ -78,10 +79,10 @@ DialogHeight::~DialogHeight()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogHeight::setPointName(const QString &value)
|
||||
void DialogHeight::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -89,47 +90,58 @@ void DialogHeight::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogHeight::setTypeLine(const QString &value)
|
||||
void DialogHeight::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setBasePointId set id base point of height
|
||||
* @brief SetBasePointId set id base point of height
|
||||
* @param value id
|
||||
*/
|
||||
void DialogHeight::setBasePointId(const quint32 &value)
|
||||
void DialogHeight::SetBasePointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxBasePoint, basePointId, value);
|
||||
line->setPoint1Id(basePointId);
|
||||
setCurrentPointId(ui->comboBoxBasePoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP1LineId set id first point of line
|
||||
* @brief SetP1LineId set id first point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogHeight::setP1LineId(const quint32 &value)
|
||||
void DialogHeight::SetP1LineId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP1Line, p1LineId, value);
|
||||
line->setLineP1Id(p1LineId);
|
||||
setCurrentPointId(ui->comboBoxP1Line, value);
|
||||
line->setLineP1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP2LineId set id second point of line
|
||||
* @brief SetP2LineId set id second point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogHeight::setP2LineId(const quint32 &value)
|
||||
void DialogHeight::SetP2LineId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP2Line, p2LineId, value);
|
||||
line->setLineP2Id(p2LineId);
|
||||
setCurrentPointId(ui->comboBoxP2Line, value);
|
||||
line->setLineP2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogHeight::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogHeight::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -195,15 +207,11 @@ void DialogHeight::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogHeight::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
basePointId = getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
p1LineId = getCurrentObjectId(ui->comboBoxP1Line);
|
||||
p2LineId = getCurrentObjectId(ui->comboBoxP2Line);
|
||||
|
||||
line->setPoint1Id(basePointId);
|
||||
line->setLineP1Id(p1LineId);
|
||||
line->setLineP2Id(p2LineId);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setPoint1Id(GetBasePointId());
|
||||
line->setLineP1Id(GetP1LineId());
|
||||
line->setLineP2Id(GetP2LineId());
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -261,3 +269,43 @@ void DialogHeight::ShowVisualization()
|
|||
line->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogHeight::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetBasePointId return id base point of height
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogHeight::GetBasePointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxBasePoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP1LineId return id first point of line
|
||||
* @return id id
|
||||
*/
|
||||
quint32 DialogHeight::GetP1LineId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP1Line);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP2LineId return id second point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogHeight::GetP2LineId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP2Line);
|
||||
}
|
||||
|
|
|
@ -48,20 +48,22 @@ public:
|
|||
DialogHeight(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogHeight();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
quint32 getBasePointId() const;
|
||||
void setBasePointId(const quint32 &value);
|
||||
quint32 GetBasePointId() const;
|
||||
void SetBasePointId(const quint32 &value);
|
||||
|
||||
quint32 getP1LineId() const;
|
||||
void setP1LineId(const quint32 &value);
|
||||
quint32 GetP1LineId() const;
|
||||
void SetP1LineId(const quint32 &value);
|
||||
|
||||
quint32 getP2LineId() const;
|
||||
void setP2LineId(const quint32 &value);
|
||||
quint32 GetP2LineId() const;
|
||||
void SetP2LineId(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void PointNameChanged();
|
||||
|
@ -78,71 +80,7 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogHeight *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief basePointId id base point of height */
|
||||
quint32 basePointId;
|
||||
|
||||
/** @brief p1LineId id first point of line */
|
||||
quint32 p1LineId;
|
||||
|
||||
/** @brief p2LineId id second point of line */
|
||||
quint32 p2LineId;
|
||||
VisToolHeight *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogHeight::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogHeight::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getBasePointId return id base point of height
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogHeight::getBasePointId() const
|
||||
{
|
||||
return basePointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP1LineId return id first point of line
|
||||
* @return id id
|
||||
*/
|
||||
inline quint32 DialogHeight::getP1LineId() const
|
||||
{
|
||||
return p1LineId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP2LineId return id second point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogHeight::getP2LineId() const
|
||||
{
|
||||
return p2LineId;
|
||||
}
|
||||
|
||||
#endif // DIALOGHEIGHT_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>285</width>
|
||||
<height>212</height>
|
||||
<height>245</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -134,6 +134,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogLine), number(0), firstPoint(NULL_ID), secondPoint(NULL_ID),
|
||||
typeLine(QString()), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogLine), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
QMap<QString, QIcon> stylesPics = VAbstractTool::LineStylesPics();
|
||||
stylesPics.remove(VAbstractTool::TypeLineNone);// Prevent hiding line
|
||||
|
@ -78,35 +78,46 @@ DialogLine::~DialogLine()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPoint set id second point
|
||||
* @brief SetSecondPoint set id second point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogLine::setSecondPoint(const quint32 &value)
|
||||
void DialogLine::SetSecondPoint(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPoint, value);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogLine::setTypeLine(const QString &value)
|
||||
void DialogLine::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogLine::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLine::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPoint set id first point
|
||||
* @brief SetFirstPoint set id first point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogLine::setFirstPoint(const quint32 &value)
|
||||
void DialogLine::SetFirstPoint(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPoint, value);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
|
@ -153,15 +164,9 @@ void DialogLine::ShowVisualization()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLine::SaveData()
|
||||
{
|
||||
qint32 index = ui->comboBoxFirstPoint->currentIndex();
|
||||
firstPoint = qvariant_cast<quint32>(ui->comboBoxFirstPoint->itemData(index));
|
||||
index = ui->comboBoxSecondPoint->currentIndex();
|
||||
secondPoint = qvariant_cast<quint32>(ui->comboBoxSecondPoint->itemData(index));
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
|
||||
line->setPoint1Id(firstPoint);
|
||||
line->setPoint2Id(secondPoint);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setPoint1Id(GetFirstPoint());
|
||||
line->setPoint2Id(GetSecondPoint());
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -203,3 +208,33 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPoint return id first point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogLine::GetFirstPoint() const
|
||||
{
|
||||
return qvariant_cast<quint32>(ui->comboBoxFirstPoint->currentData());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPoint return id second point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogLine::GetSecondPoint() const
|
||||
{
|
||||
return qvariant_cast<quint32>(ui->comboBoxSecondPoint->currentData());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogLine::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
|
|
@ -48,14 +48,17 @@ public:
|
|||
DialogLine(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogLine();
|
||||
|
||||
quint32 getFirstPoint() const;
|
||||
void setFirstPoint(const quint32 &value);
|
||||
quint32 GetFirstPoint() const;
|
||||
void SetFirstPoint(const quint32 &value);
|
||||
|
||||
quint32 getSecondPoint() const;
|
||||
void setSecondPoint(const quint32 &value);
|
||||
quint32 GetSecondPoint() const;
|
||||
void SetSecondPoint(const quint32 &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void PointNameChanged();
|
||||
|
@ -72,49 +75,8 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogLine *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief firstPoint id first point */
|
||||
quint32 firstPoint;
|
||||
|
||||
/** @brief secondPoint id second point */
|
||||
quint32 secondPoint;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
VisToolLine *line;
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPoint return id first point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogLine::getFirstPoint() const
|
||||
{
|
||||
return firstPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPoint return id second point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogLine::getSecondPoint() const
|
||||
{
|
||||
return secondPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogLine::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
#endif // DIALOGLINE_H
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>286</width>
|
||||
<height>151</height>
|
||||
<height>179</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>286</width>
|
||||
<height>151</height>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>286</width>
|
||||
<height>151</height>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -143,6 +143,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersect), number(0),
|
||||
p1Line1(NULL_ID), p2Line1(NULL_ID), p1Line2(NULL_ID), p2Line2(NULL_ID), flagPoint(true), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersect), flagPoint(true), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
number = 0;
|
||||
|
@ -97,7 +96,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (SetObject(id, ui->comboBoxP1Line1, tr("Select second point of first line")))
|
||||
{
|
||||
number++;
|
||||
p1Line1 = id;
|
||||
line->VisualMode(id);
|
||||
}
|
||||
break;
|
||||
|
@ -107,7 +105,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (SetObject(id, ui->comboBoxP2Line1, tr("Select first point of second line")))
|
||||
{
|
||||
number++;
|
||||
p2Line1 = id;
|
||||
line->setLine1P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
@ -117,7 +114,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
if (SetObject(id, ui->comboBoxP1Line2, tr("Select second point of second line")))
|
||||
{
|
||||
number++;
|
||||
p1Line2 = id;
|
||||
line->setLine2P1Id(id);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
@ -134,7 +130,6 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (SetObject(id, ui->comboBoxP2Line2, ""))
|
||||
{
|
||||
p2Line2 = id;
|
||||
line->setLine2P2Id(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
|
@ -144,16 +139,16 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
this->show();
|
||||
connect(ui->comboBoxP1Line1,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P1Line1Changed);
|
||||
&DialogLineIntersect::PointChanged);
|
||||
connect(ui->comboBoxP2Line1,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P2Line1Changed);
|
||||
&DialogLineIntersect::PointChanged);
|
||||
connect(ui->comboBoxP1Line2,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P1Line2Changed);
|
||||
&DialogLineIntersect::PointChanged);
|
||||
connect(ui->comboBoxP2Line2,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&DialogLineIntersect::P2Line2Changed);
|
||||
&DialogLineIntersect::PointChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,15 +164,11 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogLineIntersect::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
p1Line1 = getCurrentObjectId(ui->comboBoxP1Line1);
|
||||
p2Line1 = getCurrentObjectId(ui->comboBoxP2Line1);
|
||||
p1Line2 = getCurrentObjectId(ui->comboBoxP1Line2);
|
||||
p2Line2 = getCurrentObjectId(ui->comboBoxP2Line2);
|
||||
|
||||
line->setPoint1Id(p1Line1);
|
||||
line->setLine1P2Id(p2Line1);
|
||||
line->setLine2P1Id(p1Line2);
|
||||
line->setLine2P2Id(p2Line2);
|
||||
line->setPoint1Id(GetP1Line1());
|
||||
line->setLine1P2Id(GetP2Line1());
|
||||
line->setLine2P1Id(GetP1Line2());
|
||||
line->setLine2P2Id(GetP2Line2());
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -186,55 +177,10 @@ void DialogLineIntersect::SaveData()
|
|||
* @brief P1Line1Changed changed first point of first line
|
||||
* @param index index in list
|
||||
*/
|
||||
void DialogLineIntersect::P1Line1Changed( int index)
|
||||
void DialogLineIntersect::PointChanged()
|
||||
{
|
||||
p1Line1 = qvariant_cast<quint32>(ui->comboBoxP1Line1->itemData(index));
|
||||
flagPoint = CheckIntersecion();
|
||||
CheckState();
|
||||
|
||||
line->setPoint1Id(p1Line1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief P2Line1Changed changed second point of first line
|
||||
* @param index index in list
|
||||
*/
|
||||
void DialogLineIntersect::P2Line1Changed(int index)
|
||||
{
|
||||
p2Line1 = qvariant_cast<quint32>(ui->comboBoxP2Line1->itemData(index));
|
||||
flagPoint = CheckIntersecion();
|
||||
CheckState();
|
||||
|
||||
line->setLine1P2Id(p2Line1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief P1Line2Changed changed first point of second line
|
||||
* @param index index in list
|
||||
*/
|
||||
void DialogLineIntersect::P1Line2Changed(int index)
|
||||
{
|
||||
p1Line2 = qvariant_cast<quint32>(ui->comboBoxP1Line2->itemData(index));
|
||||
flagPoint = CheckIntersecion();
|
||||
CheckState();
|
||||
|
||||
line->setLine2P1Id(p1Line2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief P2Line2Changed changed second point of second line
|
||||
* @param index index in list
|
||||
*/
|
||||
void DialogLineIntersect::P2Line2Changed(int index)
|
||||
{
|
||||
p2Line2 = qvariant_cast<quint32>(ui->comboBoxP2Line2->itemData(index));
|
||||
flagPoint = CheckIntersecion();
|
||||
CheckState();
|
||||
|
||||
line->setLine2P2Id(p2Line2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -317,10 +263,10 @@ void DialogLineIntersect::CheckState()
|
|||
*/
|
||||
bool DialogLineIntersect::CheckIntersecion()
|
||||
{
|
||||
const QSharedPointer<VPointF> p1L1 = data->GeometricObject<VPointF>(p1Line1);
|
||||
const QSharedPointer<VPointF> p2L1 = data->GeometricObject<VPointF>(p2Line1);
|
||||
const QSharedPointer<VPointF> p1L2 = data->GeometricObject<VPointF>(p1Line2);
|
||||
const QSharedPointer<VPointF> p2L2 = data->GeometricObject<VPointF>(p2Line2);
|
||||
const QSharedPointer<VPointF> p1L1 = data->GeometricObject<VPointF>(GetP1Line1());
|
||||
const QSharedPointer<VPointF> p2L1 = data->GeometricObject<VPointF>(GetP2Line1());
|
||||
const QSharedPointer<VPointF> p1L2 = data->GeometricObject<VPointF>(GetP1Line2());
|
||||
const QSharedPointer<VPointF> p2L2 = data->GeometricObject<VPointF>(GetP2Line2());
|
||||
|
||||
QLineF line1(p1L1->toQPointF(), p2L1->toQPointF());
|
||||
QLineF line2(p1L2->toQPointF(), p2L2->toQPointF());
|
||||
|
@ -338,55 +284,95 @@ bool DialogLineIntersect::CheckIntersecion()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP2Line2 set id second point of second line
|
||||
* @brief SetP2Line2 set id second point of second line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogLineIntersect::setP2Line2(const quint32 &value)
|
||||
void DialogLineIntersect::SetP2Line2(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP2Line2, p2Line2, value);
|
||||
line->setLine2P2Id(p2Line2);
|
||||
setCurrentPointId(ui->comboBoxP2Line2, value);
|
||||
line->setLine2P2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP1Line2 set id first point of second line
|
||||
* @brief SetP1Line2 set id first point of second line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogLineIntersect::setP1Line2(const quint32 &value)
|
||||
void DialogLineIntersect::SetP1Line2(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP1Line2, p1Line2, value);
|
||||
line->setLine2P1Id(p1Line2);
|
||||
setCurrentPointId(ui->comboBoxP1Line2, value);
|
||||
line->setLine2P1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP2Line1 set id second point of first line
|
||||
* @brief SetP2Line1 set id second point of first line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogLineIntersect::setP2Line1(const quint32 &value)
|
||||
void DialogLineIntersect::SetP2Line1(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP2Line1, p2Line1, value);
|
||||
line->setLine1P2Id(p2Line1);
|
||||
setCurrentPointId(ui->comboBoxP2Line1, value);
|
||||
line->setLine1P2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP1Line1 set id first point of first line
|
||||
* @brief SetP1Line1 set id first point of first line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogLineIntersect::setP1Line1(const quint32 &value)
|
||||
void DialogLineIntersect::SetP1Line1(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP1Line1, p1Line1, value);
|
||||
line->setPoint1Id(p1Line1);
|
||||
setCurrentPointId(ui->comboBoxP1Line1, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name of point
|
||||
*/
|
||||
void DialogLineIntersect::setPointName(const QString &value)
|
||||
void DialogLineIntersect::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP1Line1 return id first point of first line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogLineIntersect::GetP1Line1() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP1Line1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP2Line1 return id second point of first line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogLineIntersect::GetP2Line1() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP2Line1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP1Line2 return id first point of second line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogLineIntersect::GetP1Line2() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP1Line2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP2Line2 return id second point of second line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogLineIntersect::GetP2Line2() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP2Line2);
|
||||
}
|
||||
|
|
|
@ -48,26 +48,22 @@ public:
|
|||
DialogLineIntersect(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogLineIntersect();
|
||||
|
||||
quint32 getP1Line1() const;
|
||||
void setP1Line1(const quint32 &value);
|
||||
quint32 GetP1Line1() const;
|
||||
void SetP1Line1(const quint32 &value);
|
||||
|
||||
quint32 getP2Line1() const;
|
||||
void setP2Line1(const quint32 &value);
|
||||
quint32 GetP2Line1() const;
|
||||
void SetP2Line1(const quint32 &value);
|
||||
|
||||
quint32 getP1Line2() const;
|
||||
void setP1Line2(const quint32 &value);
|
||||
quint32 GetP1Line2() const;
|
||||
void SetP1Line2(const quint32 &value);
|
||||
|
||||
quint32 getP2Line2() const;
|
||||
void setP2Line2(const quint32 &value);
|
||||
quint32 GetP2Line2() const;
|
||||
void SetP2Line2(const quint32 &value);
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
void P1Line1Changed( int index);
|
||||
void P2Line1Changed( int index);
|
||||
void P1Line2Changed( int index);
|
||||
void P2Line2Changed( int index);
|
||||
void PointChanged();
|
||||
virtual void PointNameChanged();
|
||||
virtual void UpdateList();
|
||||
protected:
|
||||
|
@ -82,21 +78,6 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogLineIntersect *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief p1Line1 id first point of first line */
|
||||
quint32 p1Line1;
|
||||
|
||||
/** @brief p2Line1 id second point of first line */
|
||||
quint32 p2Line1;
|
||||
|
||||
/** @brief p1Line2 id first point of second line */
|
||||
quint32 p1Line2;
|
||||
|
||||
/** @brief p2Line2 id second point of second line */
|
||||
quint32 p2Line2;
|
||||
|
||||
/** @brief flagPoint keep state of point */
|
||||
bool flagPoint;
|
||||
|
||||
|
@ -106,54 +87,4 @@ private:
|
|||
bool CheckIntersecion();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP1Line1 return id first point of first line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogLineIntersect::getP1Line1() const
|
||||
{
|
||||
return p1Line1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP2Line1 return id second point of first line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogLineIntersect::getP2Line1() const
|
||||
{
|
||||
return p2Line1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP1Line2 return id first point of second line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogLineIntersect::getP1Line2() const
|
||||
{
|
||||
return p1Line2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP2Line2 return id second point of second line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogLineIntersect::getP2Line2() const
|
||||
{
|
||||
return p2Line2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name of point
|
||||
*/
|
||||
inline QString DialogLineIntersect::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
#endif // DIALOGLINEINTERSECT_H
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), number(0), typeLine(QString()),
|
||||
formulaAngle(QString()), basePointId(NULL_ID), firstPointId(NULL_ID), secondPointId(NULL_ID),
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogLineIntersectAxis), formulaAngle(QString()),
|
||||
formulaBaseHeightAngle(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -58,6 +57,7 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
|
|||
FillComboBoxPoints(ui->comboBoxFirstLinePoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondLinePoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::PutAngle);
|
||||
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogLineIntersectAxis::PutVal);
|
||||
|
@ -89,40 +89,33 @@ DialogLineIntersectAxis::~DialogLineIntersectAxis()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogLineIntersectAxis::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::setPointName(const QString &value)
|
||||
void DialogLineIntersectAxis::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogLineIntersectAxis::getTypeLine() const
|
||||
QString DialogLineIntersectAxis::GetTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::setTypeLine(const QString &value)
|
||||
void DialogLineIntersectAxis::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogLineIntersectAxis::getAngle() const
|
||||
QString DialogLineIntersectAxis::GetAngle() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formulaAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::setAngle(const QString &value)
|
||||
void DialogLineIntersectAxis::SetAngle(const QString &value)
|
||||
{
|
||||
formulaAngle = qApp->FormulaToUser(value);
|
||||
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
||||
|
@ -132,49 +125,61 @@ void DialogLineIntersectAxis::setAngle(const QString &value)
|
|||
this->DeployAngleTextEdit();
|
||||
}
|
||||
ui->plainTextEditFormula->setPlainText(formulaAngle);
|
||||
line->setAngle(formulaAngle);
|
||||
line->SetAngle(formulaAngle);
|
||||
MoveCursorToEnd(ui->plainTextEditFormula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogLineIntersectAxis::getBasePointId() const
|
||||
quint32 DialogLineIntersectAxis::GetBasePointId() const
|
||||
{
|
||||
return basePointId;
|
||||
return getCurrentObjectId(ui->comboBoxAxisPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::setBasePointId(const quint32 &value)
|
||||
void DialogLineIntersectAxis::SetBasePointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxAxisPoint, basePointId, value);
|
||||
setCurrentPointId(ui->comboBoxAxisPoint, value);
|
||||
line->setAxisPointId(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogLineIntersectAxis::getFirstPointId() const
|
||||
quint32 DialogLineIntersectAxis::GetFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
return getCurrentObjectId(ui->comboBoxFirstLinePoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::setFirstPointId(const quint32 &value)
|
||||
void DialogLineIntersectAxis::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxFirstLinePoint, firstPointId, value);
|
||||
setCurrentPointId(ui->comboBoxFirstLinePoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogLineIntersectAxis::getSecondPointId() const
|
||||
quint32 DialogLineIntersectAxis::GetSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
return getCurrentObjectId(ui->comboBoxSecondLinePoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::setSecondPointId(const quint32 &value)
|
||||
void DialogLineIntersectAxis::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxSecondLinePoint, secondPointId, value);
|
||||
setCurrentPointId(ui->comboBoxSecondLinePoint, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogLineIntersectAxis::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLineIntersectAxis::ShowDialog(bool click)
|
||||
{
|
||||
|
@ -185,7 +190,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
|||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(basePointId);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
||||
//Radius of point circle, but little bigger. Need handle with hover sizes.
|
||||
|
@ -196,7 +201,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
|||
}
|
||||
}
|
||||
this->setModal(true);
|
||||
this->setAngle(line->Angle());//Show in dialog angle what user choose
|
||||
this->SetAngle(line->Angle());//Show in dialog angle what user choose
|
||||
emit ToolTip("");
|
||||
timerFormula->start();
|
||||
this->show();
|
||||
|
@ -242,7 +247,6 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
|
|||
{
|
||||
if (SetObject(id, ui->comboBoxAxisPoint, ""))
|
||||
{
|
||||
basePointId = id;
|
||||
line->setAxisPointId(id);
|
||||
line->RefreshGeometry();
|
||||
prepare = true;
|
||||
|
@ -323,20 +327,15 @@ void DialogLineIntersectAxis::ShowVisualization()
|
|||
void DialogLineIntersectAxis::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
|
||||
formulaAngle = ui->plainTextEditFormula->toPlainText();
|
||||
formulaAngle.replace("\n", " ");
|
||||
|
||||
basePointId = getCurrentObjectId(ui->comboBoxAxisPoint);
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstLinePoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondLinePoint);
|
||||
|
||||
line->setPoint1Id(firstPointId);
|
||||
line->setPoint2Id(secondPointId);
|
||||
line->setAxisPointId(basePointId);
|
||||
line->setAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setAxisPointId(GetBasePointId());
|
||||
line->SetAngle(formulaAngle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,23 +45,25 @@ public:
|
|||
DialogLineIntersectAxis(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogLineIntersectAxis();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString getAngle() const;
|
||||
void setAngle(const QString &value);
|
||||
QString GetAngle() const;
|
||||
void SetAngle(const QString &value);
|
||||
|
||||
quint32 getBasePointId() const;
|
||||
void setBasePointId(const quint32 &value);
|
||||
quint32 GetBasePointId() const;
|
||||
void SetBasePointId(const quint32 &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
|
||||
virtual void ShowDialog(bool click);
|
||||
public slots:
|
||||
|
@ -82,16 +84,7 @@ private:
|
|||
Q_DISABLE_COPY(DialogLineIntersectAxis)
|
||||
Ui::DialogLineIntersectAxis *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
QString formulaAngle;
|
||||
quint32 basePointId;
|
||||
quint32 firstPointId;
|
||||
quint32 secondPointId;
|
||||
int formulaBaseHeightAngle;
|
||||
|
||||
VisToolLineIntersectAxis *line;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>532</height>
|
||||
<height>565</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -325,6 +325,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), number(0), typeLine(QString()),
|
||||
formula(QString()), angle(0), firstPointId(NULL_ID), secondPointId(NULL_ID), formulaBaseHeight(0), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogNormal), formula(QString()), angle(0), formulaBaseHeight(0),
|
||||
line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -57,6 +57,7 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge
|
|||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
InitArrow(ui);
|
||||
|
||||
|
@ -172,18 +173,15 @@ void DialogNormal::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogNormal::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
angle = ui->doubleSpinBoxAngle->value();
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
|
||||
line->setPoint1Id(firstPointId);
|
||||
line->setPoint2Id(secondPointId);
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->setLength(formula);
|
||||
line->setAngle(angle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->SetAngle(angle);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -196,44 +194,56 @@ void DialogNormal::closeEvent(QCloseEvent *event)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPointId set id of second point
|
||||
* @brief SetSecondPointId set id of second point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogNormal::setSecondPointId(const quint32 &value)
|
||||
void DialogNormal::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogNormal::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNormal::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPointId set id of first point
|
||||
* @brief SetFirstPointId set id of first point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogNormal::setFirstPointId(const quint32 &value)
|
||||
void DialogNormal::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setAngle set aditional angle of normal
|
||||
* @brief SetAngle set aditional angle of normal
|
||||
* @param value angle in degree
|
||||
*/
|
||||
void DialogNormal::setAngle(const qreal &value)
|
||||
void DialogNormal::SetAngle(const qreal &value)
|
||||
{
|
||||
angle = value;
|
||||
ui->doubleSpinBoxAngle->setValue(angle);
|
||||
line->setAngle(angle);
|
||||
line->SetAngle(angle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogNormal::setFormula(const QString &value)
|
||||
void DialogNormal::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed.
|
||||
|
@ -248,23 +258,72 @@ void DialogNormal::setFormula(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogNormal::setTypeLine(const QString &value)
|
||||
void DialogNormal::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogNormal::setPointName(const QString &value)
|
||||
void DialogNormal::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogNormal::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogNormal::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetAngle return aditional angle of normal
|
||||
* @return angle in degree
|
||||
*/
|
||||
qreal DialogNormal::GetAngle() const
|
||||
{
|
||||
return angle;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogNormal::GetFirstPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogNormal::GetSecondPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
|
|
@ -48,23 +48,25 @@ public:
|
|||
DialogNormal(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogNormal();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
qreal getAngle() const;
|
||||
void setAngle(const qreal &value);
|
||||
qreal GetAngle() const;
|
||||
void SetAngle(const qreal &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -89,88 +91,16 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogNormal *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief formula formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief angle aditional angle of normal */
|
||||
qreal angle;
|
||||
|
||||
/** @brief firstPointId id first point of line */
|
||||
quint32 firstPointId;
|
||||
|
||||
/** @brief secondPointId id second point of line */
|
||||
quint32 secondPointId;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
VisToolNormal *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogNormal::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogNormal::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogNormal::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getAngle return aditional angle of normal
|
||||
* @return angle in degree
|
||||
*/
|
||||
inline qreal DialogNormal::getAngle() const
|
||||
{
|
||||
return angle;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogNormal::getFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogNormal::getSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
#endif // DIALOGNORMAL_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>517</width>
|
||||
<height>645</height>
|
||||
<height>678</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -480,44 +480,54 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Type of line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxLineType">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show line from first point to this point</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Type of line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineType">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show line from first point to this point</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>14</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
@ -697,7 +707,6 @@
|
|||
<tabstop>toolButtonArrowLeftDown</tabstop>
|
||||
<tabstop>toolButtonArrowLeft</tabstop>
|
||||
<tabstop>toolButtonArrowLeftUp</tabstop>
|
||||
<tabstop>comboBoxLineType</tabstop>
|
||||
<tabstop>radioButtonSizeGrowth</tabstop>
|
||||
<tabstop>radioButtonStandardTable</tabstop>
|
||||
<tabstop>radioButtonIncrements</tabstop>
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfContact), number(0),
|
||||
radius(QString()), center(NULL_ID), firstPoint(NULL_ID), secondPoint(NULL_ID), formulaBaseHeight(0), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfContact),
|
||||
radius(QString()), formulaBaseHeight(0), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -217,13 +217,10 @@ void DialogPointOfContact::SaveData()
|
|||
pointName = ui->lineEditNamePoint->text();
|
||||
radius = ui->plainTextEditFormula->toPlainText();
|
||||
radius.replace("\n", " ");
|
||||
center = getCurrentObjectId(ui->comboBoxCenter);
|
||||
firstPoint = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPoint = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
|
||||
line->setPoint1Id(firstPoint);
|
||||
line->setLineP2Id(secondPoint);
|
||||
line->setRadiusId(center);
|
||||
line->setPoint1Id(GetFirstPoint());
|
||||
line->setLineP2Id(GetSecondPoint());
|
||||
line->setRadiusId(getCenter());
|
||||
line->setRadius(radius);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
@ -237,24 +234,24 @@ void DialogPointOfContact::closeEvent(QCloseEvent *event)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPoint set id second point
|
||||
* @brief SetSecondPoint set id second point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogPointOfContact::setSecondPoint(const quint32 &value)
|
||||
void DialogPointOfContact::SetSecondPoint(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPoint, value);
|
||||
line->setLineP2Id(secondPoint);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setLineP2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPoint set id first point
|
||||
* @brief SetFirstPoint set id first point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogPointOfContact::setFirstPoint(const quint32 &value)
|
||||
void DialogPointOfContact::SetFirstPoint(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPoint, value);
|
||||
line->setPoint1Id(firstPoint);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -264,8 +261,8 @@ void DialogPointOfContact::setFirstPoint(const quint32 &value)
|
|||
*/
|
||||
void DialogPointOfContact::setCenter(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxCenter, center, value);
|
||||
line->setRadiusId(center);
|
||||
setCurrentPointId(ui->comboBoxCenter, value);
|
||||
line->setRadiusId(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -288,11 +285,51 @@ void DialogPointOfContact::setRadius(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogPointOfContact::setPointName(const QString &value)
|
||||
void DialogPointOfContact::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getRadius return formula radius of arc
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogPointOfContact::getRadius() const
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetCenter return id of center point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogPointOfContact::getCenter() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxCenter);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPoint return id first point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogPointOfContact::GetFirstPoint() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxFirstPoint);;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPoint return id second point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogPointOfContact::GetSecondPoint() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
|
|
@ -49,8 +49,7 @@ public:
|
|||
DialogPointOfContact(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
virtual ~DialogPointOfContact();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getRadius() const;
|
||||
void setRadius(const QString &value);
|
||||
|
@ -58,11 +57,11 @@ public:
|
|||
quint32 getCenter() const;
|
||||
void setCenter(const quint32 &value);
|
||||
|
||||
quint32 getFirstPoint() const;
|
||||
void setFirstPoint(const quint32 &value);
|
||||
quint32 GetFirstPoint() const;
|
||||
void SetFirstPoint(const quint32 &value);
|
||||
|
||||
quint32 getSecondPoint() const;
|
||||
void setSecondPoint(const quint32 &value);
|
||||
quint32 GetSecondPoint() const;
|
||||
void SetSecondPoint(const quint32 &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -87,75 +86,13 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogPointOfContact *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief radius radius of arc */
|
||||
QString radius;
|
||||
|
||||
/** @brief center id center point of arc */
|
||||
quint32 center;
|
||||
|
||||
/** @brief firstPoint id first point of line */
|
||||
quint32 firstPoint;
|
||||
|
||||
/** @brief secondPoint id second point of line */
|
||||
quint32 secondPoint;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
|
||||
VisToolPointOfContact *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogPointOfContact::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getRadius return formula radius of arc
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogPointOfContact::getRadius() const
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetCenter return id of center point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogPointOfContact::getCenter() const
|
||||
{
|
||||
return center;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPoint return id first point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogPointOfContact::getFirstPoint() const
|
||||
{
|
||||
return firstPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPoint return id second point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogPointOfContact::getSecondPoint() const
|
||||
{
|
||||
return secondPoint;
|
||||
}
|
||||
|
||||
#endif // DIALOGPOINTOFCONTACT_H
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0),
|
||||
firstPointId(NULL_ID), secondPointId(NULL_ID), line(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
|
@ -77,13 +76,13 @@ DialogPointOfIntersection::~DialogPointOfIntersection()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPointId set id of second point
|
||||
* @brief SetSecondPointId set id of second point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogPointOfIntersection::setSecondPointId(const quint32 &value)
|
||||
void DialogPointOfIntersection::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
||||
line->setPoint2Id(secondPointId);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -132,11 +131,9 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
|
|||
void DialogPointOfIntersection::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
|
||||
line->setPoint1Id(firstPointId);
|
||||
line->setPoint2Id(secondPointId);
|
||||
line->setPoint1Id(GetFirstPointId());
|
||||
line->setPoint2Id(GetSecondPointId());
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -181,22 +178,42 @@ void DialogPointOfIntersection::ShowVisualization()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPointId set id of first point
|
||||
* @brief SetFirstPointId set id of first point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogPointOfIntersection::setFirstPointId(const quint32 &value)
|
||||
void DialogPointOfIntersection::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
||||
line->setPoint1Id(firstPointId);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogPointOfIntersection::setPointName(const QString &value)
|
||||
void DialogPointOfIntersection::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogPointOfIntersection::GetFirstPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogPointOfIntersection::GetSecondPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
|
|
@ -48,14 +48,13 @@ public:
|
|||
DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogPointOfIntersection();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void PointNameChanged();
|
||||
|
@ -72,45 +71,7 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogPointOfIntersection *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief firstPointId id first point of line */
|
||||
quint32 firstPointId;
|
||||
|
||||
/** @brief secondPointId id second point of line */
|
||||
quint32 secondPointId;
|
||||
VisToolPointOfIntersection *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogPointOfIntersection::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogPointOfIntersection::getFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogPointOfIntersection::getSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
#endif // DIALOGPOINTOFINTERSECTION_H
|
||||
|
|
|
@ -42,9 +42,8 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), number(0),
|
||||
typeLine(QString()), formula(QString()), p1Line(NULL_ID), p2Line(NULL_ID), pShoulder(NULL_ID), formulaBaseHeight(0),
|
||||
line (nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogShoulderPoint), formula(QString()),
|
||||
formulaBaseHeight(0), line (nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitVariables(ui);
|
||||
|
@ -62,6 +61,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &
|
|||
FillComboBoxPoints(ui->comboBoxP1Line);
|
||||
FillComboBoxPoints(ui->comboBoxP2Line);
|
||||
FillComboBoxPoints(ui->comboBoxP3);
|
||||
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||
|
||||
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere);
|
||||
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal);
|
||||
|
@ -201,18 +201,14 @@ void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogShoulderPoint::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
formula = ui->plainTextEditFormula->toPlainText();
|
||||
formula.replace("\n", " ");
|
||||
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
||||
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
||||
pShoulder = getCurrentObjectId(ui->comboBoxP3);
|
||||
|
||||
line->setPoint1Id(pShoulder);
|
||||
line->setLineP1Id(p1Line);
|
||||
line->setLineP2Id(p2Line);
|
||||
line->setPoint1Id(GetP3());
|
||||
line->setLineP1Id(GetP1Line());
|
||||
line->setLineP2Id(GetP2Line());
|
||||
line->setLength(formula);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(GetTypeLine()));
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -228,40 +224,52 @@ void DialogShoulderPoint::closeEvent(QCloseEvent *event)
|
|||
* @brief setPShoulder set id shoulder point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogShoulderPoint::setP3(const quint32 &value)
|
||||
void DialogShoulderPoint::SetP3(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP3, pShoulder, value);
|
||||
line->setPoint1Id(pShoulder);
|
||||
setCurrentPointId(ui->comboBoxP3, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogShoulderPoint::GetLineColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogShoulderPoint::SetLineColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxLineColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP2Line set id second point of line
|
||||
* @brief SetP2Line set id second point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogShoulderPoint::setP2Line(const quint32 &value)
|
||||
void DialogShoulderPoint::SetP2Line(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP2Line, p2Line, value);
|
||||
line->setLineP2Id(p2Line);
|
||||
setCurrentPointId(ui->comboBoxP2Line, value);
|
||||
line->setLineP2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP1Line set id first point of line
|
||||
* @brief SetP1Line set id first point of line
|
||||
* @param value id
|
||||
*/
|
||||
void DialogShoulderPoint::setP1Line(const quint32 &value)
|
||||
void DialogShoulderPoint::SetP1Line(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP1Line, p1Line, value);
|
||||
line->setLineP1Id(p1Line);
|
||||
setCurrentPointId(ui->comboBoxP1Line, value);
|
||||
line->setLineP1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFormula set string of formula
|
||||
* @brief SetFormula set string of formula
|
||||
* @param value formula
|
||||
*/
|
||||
void DialogShoulderPoint::setFormula(const QString &value)
|
||||
void DialogShoulderPoint::SetFormula(const QString &value)
|
||||
{
|
||||
formula = qApp->FormulaToUser(value);
|
||||
// increase height if needed.
|
||||
|
@ -276,23 +284,72 @@ void DialogShoulderPoint::setFormula(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setTypeLine set type of line
|
||||
* @brief SetTypeLine set type of line
|
||||
* @param value type
|
||||
*/
|
||||
void DialogShoulderPoint::setTypeLine(const QString &value)
|
||||
void DialogShoulderPoint::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
ChangeCurrentData(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyleToPenStyle(value));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogShoulderPoint::setPointName(const QString &value)
|
||||
void DialogShoulderPoint::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
QString DialogShoulderPoint::GetTypeLine() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
QString DialogShoulderPoint::GetFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP1Line return id first point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogShoulderPoint::GetP1Line() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP1Line);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetP2Line return id second point of line
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogShoulderPoint::GetP2Line() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP2Line);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPShoulder return id shoulder point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogShoulderPoint::GetP3() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxP3);
|
||||
}
|
||||
|
|
|
@ -48,23 +48,25 @@ public:
|
|||
DialogShoulderPoint(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogShoulderPoint();
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
QString getTypeLine() const;
|
||||
void setTypeLine(const QString &value);
|
||||
QString GetTypeLine() const;
|
||||
void SetTypeLine(const QString &value);
|
||||
|
||||
QString getFormula() const;
|
||||
void setFormula(const QString &value);
|
||||
QString GetFormula() const;
|
||||
void SetFormula(const QString &value);
|
||||
|
||||
quint32 getP1Line() const;
|
||||
void setP1Line(const quint32 &value);
|
||||
quint32 GetP1Line() const;
|
||||
void SetP1Line(const quint32 &value);
|
||||
|
||||
quint32 getP2Line() const;
|
||||
void setP2Line(const quint32 &value);
|
||||
quint32 GetP2Line() const;
|
||||
void SetP2Line(const quint32 &value);
|
||||
|
||||
quint32 getP3() const;
|
||||
void setP3(const quint32 &value);
|
||||
quint32 GetP3() const;
|
||||
void SetP3(const quint32 &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
void SetLineColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
/**
|
||||
|
@ -89,87 +91,12 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogShoulderPoint *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief formula formula */
|
||||
QString formula;
|
||||
|
||||
/** @brief p1Line id first point of line */
|
||||
quint32 p1Line;
|
||||
|
||||
/** @brief p2Line id second point of line */
|
||||
quint32 p2Line;
|
||||
|
||||
/** @brief pShoulder id shoulder point */
|
||||
quint32 pShoulder;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int formulaBaseHeight;
|
||||
VisToolShoulderPoint *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogShoulderPoint::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @return type
|
||||
*/
|
||||
inline QString DialogShoulderPoint::getTypeLine() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFormula return string of formula
|
||||
* @return formula
|
||||
*/
|
||||
inline QString DialogShoulderPoint::getFormula() const
|
||||
{
|
||||
return qApp->FormulaFromUser(formula);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP1Line return id first point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogShoulderPoint::getP1Line() const
|
||||
{
|
||||
return p1Line;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP2Line return id second point of line
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogShoulderPoint::getP2Line() const
|
||||
{
|
||||
return p2Line;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPShoulder return id shoulder point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogShoulderPoint::getP3() const
|
||||
{
|
||||
return pShoulder;
|
||||
}
|
||||
|
||||
#endif // DIALOGSHOULDERPOINT_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>488</width>
|
||||
<height>532</height>
|
||||
<height>565</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -364,6 +364,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -92,7 +92,7 @@ void DialogSinglePoint::UpdateList()
|
|||
* @param name name of point
|
||||
* @param point data for point
|
||||
*/
|
||||
void DialogSinglePoint::setData(const QString &name, const QPointF &point)
|
||||
void DialogSinglePoint::SetData(const QString &name, const QPointF &point)
|
||||
{
|
||||
pointName = name;
|
||||
this->point = point;
|
||||
|
@ -107,3 +107,13 @@ DialogSinglePoint::~DialogSinglePoint()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPoint return point
|
||||
* @return point
|
||||
*/
|
||||
QPointF DialogSinglePoint::GetPoint() const
|
||||
{
|
||||
return point;
|
||||
}
|
||||
|
|
|
@ -45,9 +45,10 @@ class DialogSinglePoint : public DialogTool
|
|||
public:
|
||||
DialogSinglePoint(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogSinglePoint();
|
||||
void setData(const QString &name, const QPointF &point);
|
||||
QString getName()const;
|
||||
QPointF getPoint()const;
|
||||
|
||||
void SetData(const QString &name, const QPointF &point);
|
||||
QPointF GetPoint()const;
|
||||
|
||||
public slots:
|
||||
void mousePress(const QPointF &scenePos);
|
||||
virtual void UpdateList();
|
||||
|
@ -66,24 +67,4 @@ private:
|
|||
QPointF point;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getName return name
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogSinglePoint::getName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPoint return point
|
||||
* @return point
|
||||
*/
|
||||
inline QPointF DialogSinglePoint::getPoint() const
|
||||
{
|
||||
return point;
|
||||
}
|
||||
|
||||
#endif // DIALOGSINGLEPOINT_H
|
||||
|
|
|
@ -41,14 +41,16 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), number(0), p1(NULL_ID), p4(NULL_ID), angle1(0),
|
||||
angle2(0), kAsm1(1), kAsm2(1), kCurve(1), path(nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogSpline), angle1(0), angle2(0), kAsm1(1), kAsm2(1),
|
||||
kCurve(1), path(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxP1);
|
||||
FillComboBoxPoints(ui->comboBoxP4);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->comboBoxP1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSpline::PointNameChanged);
|
||||
connect(ui->comboBoxP4, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
|
@ -69,12 +71,12 @@ DialogSpline::~DialogSpline()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP1 return id first point of spline
|
||||
* @brief GetP1 return id first point of spline
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogSpline::getP1() const
|
||||
quint32 DialogSpline::GetP1() const
|
||||
{
|
||||
return p1;
|
||||
return getCurrentObjectId(ui->comboBoxP1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -139,21 +141,19 @@ void DialogSpline::ChosenObject(quint32 id, const SceneObject &type)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSpline::SaveData()
|
||||
{
|
||||
p1 = getCurrentObjectId(ui->comboBoxP1);
|
||||
p4 = getCurrentObjectId(ui->comboBoxP4);
|
||||
angle1 = ui->spinBoxAngle1->value();
|
||||
angle2 = ui->spinBoxAngle2->value();
|
||||
kAsm1 = ui->doubleSpinBoxKasm1->value();
|
||||
kAsm2 = ui->doubleSpinBoxKasm2->value();
|
||||
kCurve = ui->doubleSpinBoxKcurve->value();
|
||||
|
||||
path->setPoint1Id(p1);
|
||||
path->setPoint4Id(p4);
|
||||
path->setAngle1(angle1);
|
||||
path->setAngle2(angle2);
|
||||
path->setKAsm1(kAsm1);
|
||||
path->setKAsm2(kAsm2);
|
||||
path->setKCurve(kCurve);
|
||||
path->setPoint1Id(GetP1());
|
||||
path->setPoint4Id(GetP4());
|
||||
path->SetAngle1(angle1);
|
||||
path->SetAngle2(angle2);
|
||||
path->SetKAsm1(kAsm1);
|
||||
path->SetKAsm2(kAsm2);
|
||||
path->SetKCurve(kCurve);
|
||||
path->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -203,92 +203,154 @@ void DialogSpline::ShowVisualization()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setKCurve set coefficient curve
|
||||
* @brief SetKCurve set coefficient curve
|
||||
* @param value value. Can be >= 0.
|
||||
*/
|
||||
void DialogSpline::setKCurve(const qreal &value)
|
||||
void DialogSpline::SetKCurve(const qreal &value)
|
||||
{
|
||||
kCurve = value;
|
||||
ui->doubleSpinBoxKcurve->setValue(value);
|
||||
path->setKCurve(kCurve);
|
||||
path->SetKCurve(kCurve);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSpline::GetColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSpline::SetColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setKAsm2 set second coefficient asymmetry
|
||||
* @brief SetKAsm2 set second coefficient asymmetry
|
||||
* @param value value. Can be >= 0.
|
||||
*/
|
||||
void DialogSpline::setKAsm2(const qreal &value)
|
||||
void DialogSpline::SetKAsm2(const qreal &value)
|
||||
{
|
||||
kAsm2 = value;
|
||||
ui->doubleSpinBoxKasm2->setValue(value);
|
||||
path->setKAsm2(kAsm2);
|
||||
path->SetKAsm2(kAsm2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setKAsm1 set first coefficient asymmetry
|
||||
* @brief SetKAsm1 set first coefficient asymmetry
|
||||
* @param value value. Can be >= 0.
|
||||
*/
|
||||
void DialogSpline::setKAsm1(const qreal &value)
|
||||
void DialogSpline::SetKAsm1(const qreal &value)
|
||||
{
|
||||
kAsm1 = value;
|
||||
ui->doubleSpinBoxKasm1->setValue(value);
|
||||
path->setKAsm1(kAsm1);
|
||||
path->SetKAsm1(kAsm1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setAngle2 set second angle of spline
|
||||
* @brief SetAngle2 set second angle of spline
|
||||
* @param value angle in degree
|
||||
*/
|
||||
void DialogSpline::setAngle2(const qreal &value)
|
||||
void DialogSpline::SetAngle2(const qreal &value)
|
||||
{
|
||||
angle2 = value;
|
||||
ui->spinBoxAngle2->setValue(static_cast<qint32>(value));
|
||||
path->setAngle2(angle2);
|
||||
path->SetAngle2(angle2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setAngle1 set first angle of spline
|
||||
* @brief SetAngle1 set first angle of spline
|
||||
* @param value angle in degree
|
||||
*/
|
||||
void DialogSpline::setAngle1(const qreal &value)
|
||||
void DialogSpline::SetAngle1(const qreal &value)
|
||||
{
|
||||
angle1 = value;
|
||||
ui->spinBoxAngle1->setValue(static_cast<qint32>(value));
|
||||
path->setAngle1(angle1);
|
||||
path->SetAngle1(angle1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP4 set id fourth point of spline
|
||||
* @brief SetP4 set id fourth point of spline
|
||||
* @param value id
|
||||
*/
|
||||
void DialogSpline::setP4(const quint32 &value)
|
||||
void DialogSpline::SetP4(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP4, p4, value);
|
||||
path->setPoint4Id(p4);
|
||||
setCurrentPointId(ui->comboBoxP4, value);
|
||||
path->setPoint4Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setP1 set id first point of spline
|
||||
* @brief SetP1 set id first point of spline
|
||||
* @param value id
|
||||
*/
|
||||
void DialogSpline::setP1(const quint32 &value)
|
||||
void DialogSpline::SetP1(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxP1, p1, value);
|
||||
path->setPoint1Id(p1);
|
||||
setCurrentPointId(ui->comboBoxP1, value);
|
||||
path->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getP4 return id fourth point of spline
|
||||
* @brief GetP4 return id fourth point of spline
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogSpline::getP4() const
|
||||
quint32 DialogSpline::GetP4() const
|
||||
{
|
||||
return p4;
|
||||
return getCurrentObjectId(ui->comboBoxP4);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetAngle1 return first angle of spline
|
||||
* @return angle in degree
|
||||
*/
|
||||
qreal DialogSpline::GetAngle1() const
|
||||
{
|
||||
return angle1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetAngle2 return second angle of spline
|
||||
* @return angle in degree
|
||||
*/
|
||||
qreal DialogSpline::GetAngle2() const
|
||||
{
|
||||
return angle2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetKAsm1 return first coefficient asymmetry
|
||||
* @return value. Can be >= 0.
|
||||
*/
|
||||
qreal DialogSpline::GetKAsm1() const
|
||||
{
|
||||
return kAsm1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetKAsm2 return second coefficient asymmetry
|
||||
* @return value. Can be >= 0.
|
||||
*/
|
||||
qreal DialogSpline::GetKAsm2() const
|
||||
{
|
||||
return kAsm2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetKCurve return coefficient curve
|
||||
* @return value. Can be >= 0.
|
||||
*/
|
||||
qreal DialogSpline::GetKCurve() const
|
||||
{
|
||||
return kCurve;
|
||||
}
|
||||
|
|
|
@ -48,26 +48,29 @@ public:
|
|||
DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogSpline();
|
||||
|
||||
quint32 getP1() const;
|
||||
void setP1(const quint32 &value);
|
||||
quint32 GetP1() const;
|
||||
void SetP1(const quint32 &value);
|
||||
|
||||
quint32 getP4() const;
|
||||
void setP4(const quint32 &value);
|
||||
quint32 GetP4() const;
|
||||
void SetP4(const quint32 &value);
|
||||
|
||||
qreal getAngle1() const;
|
||||
void setAngle1(const qreal &value);
|
||||
qreal GetAngle1() const;
|
||||
void SetAngle1(const qreal &value);
|
||||
|
||||
qreal getAngle2() const;
|
||||
void setAngle2(const qreal &value);
|
||||
qreal GetAngle2() const;
|
||||
void SetAngle2(const qreal &value);
|
||||
|
||||
qreal getKAsm1() const;
|
||||
void setKAsm1(const qreal &value);
|
||||
qreal GetKAsm1() const;
|
||||
void SetKAsm1(const qreal &value);
|
||||
|
||||
qreal getKAsm2() const;
|
||||
void setKAsm2(const qreal &value);
|
||||
qreal GetKAsm2() const;
|
||||
void SetKAsm2(const qreal &value);
|
||||
|
||||
qreal getKCurve() const;
|
||||
void setKCurve(const qreal &value);
|
||||
qreal GetKCurve() const;
|
||||
void SetKCurve(const qreal &value);
|
||||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void PointNameChanged();
|
||||
|
@ -84,15 +87,6 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogSpline *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief p1 id first point of spline */
|
||||
quint32 p1;
|
||||
|
||||
/** @brief p4 id fourth point of spline */
|
||||
quint32 p4;
|
||||
|
||||
/** @brief angle1 first angle of spline in degree */
|
||||
qreal angle1;
|
||||
|
||||
|
@ -111,54 +105,4 @@ private:
|
|||
VisToolSpline *path;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getAngle1 return first angle of spline
|
||||
* @return angle in degree
|
||||
*/
|
||||
inline qreal DialogSpline::getAngle1() const
|
||||
{
|
||||
return angle1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getAngle2 return second angle of spline
|
||||
* @return angle in degree
|
||||
*/
|
||||
inline qreal DialogSpline::getAngle2() const
|
||||
{
|
||||
return angle2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getKAsm1 return first coefficient asymmetry
|
||||
* @return value. Can be >= 0.
|
||||
*/
|
||||
inline qreal DialogSpline::getKAsm1() const
|
||||
{
|
||||
return kAsm1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getKAsm2 return second coefficient asymmetry
|
||||
* @return value. Can be >= 0.
|
||||
*/
|
||||
inline qreal DialogSpline::getKAsm2() const
|
||||
{
|
||||
return kAsm2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getKCurve return coefficient curve
|
||||
* @return value. Can be >= 0.
|
||||
*/
|
||||
inline qreal DialogSpline::getKCurve() const
|
||||
{
|
||||
return kCurve;
|
||||
}
|
||||
|
||||
#endif // DIALOGSPLINE_H
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>254</height>
|
||||
<width>540</width>
|
||||
<height>233</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -152,8 +152,11 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
|
@ -172,7 +175,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxKcurve">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
|
@ -194,6 +197,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -215,7 +228,6 @@
|
|||
<tabstop>comboBoxP4</tabstop>
|
||||
<tabstop>doubleSpinBoxKasm2</tabstop>
|
||||
<tabstop>spinBoxAngle2</tabstop>
|
||||
<tabstop>doubleSpinBoxKcurve</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
|
|
@ -46,6 +46,7 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
|
|||
bOk->setEnabled(false);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
FillComboBoxLineColors(ui->comboBoxColor);
|
||||
|
||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged);
|
||||
connect(ui->comboBoxPoint, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
|
@ -87,12 +88,24 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
|
|||
NewItem(path.at(i).P().id(), path.at(i).KAsm1(), path.at(i).Angle1(), path.at(i).KAsm2(), path.at(i).Angle2());
|
||||
}
|
||||
ui->listWidget->setFocus(Qt::OtherFocusReason);
|
||||
ui->doubleSpinBoxKcurve->setValue(path.getKCurve());
|
||||
ui->doubleSpinBoxKcurve->setValue(path.GetKCurve());
|
||||
|
||||
visPath->setPath(path);
|
||||
ui->listWidget->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSplinePath::GetColor() const
|
||||
{
|
||||
return GetComboBoxCurrentData(ui->comboBoxColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSplinePath::SetColor(const QString &value)
|
||||
{
|
||||
ChangeCurrentData(ui->comboBoxColor, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
|
||||
|
@ -362,5 +375,5 @@ void DialogSplinePath::SavePath()
|
|||
QListWidgetItem *item = ui->listWidget->item(i);
|
||||
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
|
||||
}
|
||||
path.setKCurve(ui->doubleSpinBoxKcurve->value());
|
||||
path.SetKCurve(ui->doubleSpinBoxKcurve->value());
|
||||
}
|
||||
|
|
|
@ -51,6 +51,9 @@ public:
|
|||
|
||||
VSplinePath GetPath() const;
|
||||
void SetPath(const VSplinePath &value);
|
||||
|
||||
QString GetColor() const;
|
||||
void SetColor(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
void PointChanged(int row);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>321</height>
|
||||
<width>528</width>
|
||||
<height>322</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -141,8 +141,11 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
|
@ -161,7 +164,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxKcurve">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
|
@ -183,6 +186,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -204,7 +217,6 @@
|
|||
<tabstop>doubleSpinBoxKasm2</tabstop>
|
||||
<tabstop>doubleSpinBoxAngle2</tabstop>
|
||||
<tabstop>listWidget</tabstop>
|
||||
<tabstop>doubleSpinBoxKcurve</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
|
|
@ -67,7 +67,7 @@ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *p
|
|||
radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr),
|
||||
radioButtonLengthCurve(nullptr), radioButtonAngleLine(nullptr), checkBoxHideEmpty(nullptr),
|
||||
okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr),
|
||||
toolId(toolId), prepare(false), pointName(QString())
|
||||
toolId(toolId), prepare(false), pointName(QString()), number(0)
|
||||
{
|
||||
SCASSERT(data != nullptr);
|
||||
timerFormula = new QTimer(this);
|
||||
|
@ -302,12 +302,23 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon>
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getTypeLine return type of line
|
||||
* @param box combobox
|
||||
* @return type
|
||||
*/
|
||||
QString DialogTool::GetTypeLine(const QComboBox *box) const
|
||||
void DialogTool::FillComboBoxLineColors(QComboBox *box) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
|
||||
const QMap<QString, QString> map = VAbstractTool::ColorsList();
|
||||
QMap<QString, QString>::const_iterator i = map.constBegin();
|
||||
while (i != map.constEnd())
|
||||
{
|
||||
QPixmap pix(16, 16);
|
||||
pix.fill(QColor(i.key()));
|
||||
box->addItem(QIcon(pix), i.value(), QVariant(i.key()));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogTool::GetComboBoxCurrentData(const QComboBox *box) const
|
||||
{
|
||||
SCASSERT(box != nullptr)
|
||||
QString value = box->currentData().toString();
|
||||
|
@ -318,29 +329,13 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const
|
|||
return value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SetupTypeLine setupe type of line
|
||||
* @param box combobox
|
||||
* @param value string from pattern file
|
||||
*/
|
||||
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value)
|
||||
{
|
||||
SCASSERT(box != nullptr)
|
||||
const qint32 index = box->findData(value);
|
||||
if (index != -1)
|
||||
{
|
||||
box->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ChangeCurrentData select item in combobox by id
|
||||
* @param box combobox
|
||||
* @param value id of item
|
||||
*/
|
||||
void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const
|
||||
void DialogTool::ChangeCurrentData(QComboBox *box, const QVariant &value) const
|
||||
{
|
||||
SCASSERT(box != nullptr)
|
||||
const qint32 index = box->findData(value);
|
||||
|
@ -542,28 +537,29 @@ qreal DialogTool::Eval(const QString &text, bool &flag, QLabel *label, const QSt
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const
|
||||
void DialogTool::setCurrentPointId(QComboBox *box, const quint32 &value) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
|
||||
box->blockSignals(true);
|
||||
|
||||
FillComboBoxPoints(box);
|
||||
pointId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
|
||||
box->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setCurrentSplineId set current spline id in combobox
|
||||
* @param box combobox
|
||||
* @param splineId save current spline id
|
||||
* @param value spline id
|
||||
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
||||
ComboBoxCutSpline cut) const
|
||||
void DialogTool::setCurrentSplineId(QComboBox *box, const quint32 &value, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplines(box, cut);
|
||||
splineId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
||||
|
@ -571,15 +567,13 @@ void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const qui
|
|||
/**
|
||||
* @brief setCurrentArcId
|
||||
* @param box combobox
|
||||
* @param arcId save current arc id
|
||||
* @param value arc id
|
||||
* @param cut if set to ComboMode::CutArc don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, ComboBoxCutArc cut) const
|
||||
void DialogTool::setCurrentArcId(QComboBox *box, const quint32 &value, ComboBoxCutArc cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxArcs(box, cut);
|
||||
arcId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
||||
|
@ -587,25 +581,21 @@ void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &
|
|||
/**
|
||||
* @brief setCurrentSplinePathId set current splinePath id in combobox
|
||||
* @param box combobox
|
||||
* @param splinePathId save current splinePath id
|
||||
* @param value splinePath id
|
||||
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
|
||||
*/
|
||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
|
||||
ComboBoxCutSpline cut) const
|
||||
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, ComboBoxCutSpline cut) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxSplinesPath(box, cut);
|
||||
splinePathId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::setCurrentCurveId(QComboBox *box, quint32 &curveId, const quint32 &value) const
|
||||
void DialogTool::setCurrentCurveId(QComboBox *box, const quint32 &value) const
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
FillComboBoxCurves(box);
|
||||
curveId = value;
|
||||
ChangeCurrentData(box, value);
|
||||
}
|
||||
|
||||
|
@ -760,15 +750,6 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
|
|||
widget->setPalette(palette);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogTool::setPointId(QComboBox *box, quint32 &pointId, const quint32 &value)
|
||||
{
|
||||
SCASSERT(box != nullptr);
|
||||
box->blockSignals(true);
|
||||
setCurrentPointId(box, pointId, value);
|
||||
box->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
|
@ -1147,6 +1128,12 @@ void DialogTool::SetToolId(const quint32 &value)
|
|||
toolId = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogTool::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ShowVariable show variables in list
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
|
||||
quint32 GetToolId() const;
|
||||
void SetToolId(const quint32 &value);
|
||||
|
||||
QString getPointName() const;
|
||||
signals:
|
||||
/**
|
||||
* @brief DialogClosed signal dialog closed
|
||||
|
@ -207,8 +209,12 @@ protected:
|
|||
/** @brief pointName name of point */
|
||||
QString pointName;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
virtual void showEvent( QShowEvent *event );
|
||||
|
||||
void FillComboBoxPoints(QComboBox *box)const;
|
||||
void FillComboBoxArcs(QComboBox *box, ComboBoxCutArc cut = ComboBoxCutArc::NoCutArc)const;
|
||||
void FillComboBoxSplines(QComboBox *box, ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline)const;
|
||||
|
@ -216,26 +222,27 @@ protected:
|
|||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline)const;
|
||||
void FillComboBoxCurves(QComboBox *box)const;
|
||||
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
|
||||
void FillComboBoxLineColors(QComboBox *box)const;
|
||||
|
||||
virtual void CheckState();
|
||||
QString GetTypeLine(const QComboBox *box)const;
|
||||
QString GetComboBoxCurrentData(const QComboBox *box)const;
|
||||
template <class key, class val>
|
||||
void ShowVariable(const QMap<key, val> var);
|
||||
void SetupTypeLine(QComboBox *box, const QString &value);
|
||||
void ChangeCurrentData(QComboBox *box, const quint32 &value) const;
|
||||
void ChangeCurrentData(QComboBox *box, const QVariant &value) const;
|
||||
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
|
||||
void PutValHere(QPlainTextEdit *plainTextEdit, QListWidget *listWidget);
|
||||
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
|
||||
void ValFormulaChanged(bool &flag, QPlainTextEdit *edit, QTimer * timer);
|
||||
qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix,
|
||||
bool checkZero = true);
|
||||
void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value) const;
|
||||
void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value,
|
||||
void setCurrentPointId(QComboBox *box, const quint32 &value) const;
|
||||
void setCurrentSplineId(QComboBox *box, const quint32 &value,
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
||||
void setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value,
|
||||
void setCurrentArcId(QComboBox *box, const quint32 &value,
|
||||
ComboBoxCutArc cut = ComboBoxCutArc::NoCutArc) const;
|
||||
void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value,
|
||||
void setCurrentSplinePathId(QComboBox *box, const quint32 &value,
|
||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline) const;
|
||||
void setCurrentCurveId(QComboBox *box, quint32 &curveId, const quint32 &value) const;
|
||||
void setCurrentCurveId(QComboBox *box, const quint32 &value) const;
|
||||
quint32 getCurrentObjectId(QComboBox *box) const;
|
||||
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
|
||||
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
|
||||
|
@ -328,7 +335,6 @@ protected:
|
|||
}
|
||||
|
||||
void ChangeColor(QWidget *widget, const QColor &color);
|
||||
void setPointId(QComboBox *box, quint32 &pointId, const quint32 &value);
|
||||
virtual void ShowVisualization(){}
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
* @param parent parent widget
|
||||
*/
|
||||
DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogTriangle), number(0), axisP1Id(NULL_ID),
|
||||
axisP2Id(NULL_ID), firstPointId(NULL_ID), secondPointId(NULL_ID), line (nullptr)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogTriangle), line (nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
|
@ -161,15 +160,11 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogTriangle::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
axisP1Id = getCurrentObjectId(ui->comboBoxAxisP1);
|
||||
axisP2Id = getCurrentObjectId(ui->comboBoxAxisP2);
|
||||
|
||||
line->setPoint1Id(axisP1Id);
|
||||
line->setPoint2Id(axisP2Id);
|
||||
line->setHypotenuseP1Id(firstPointId);
|
||||
line->setHypotenuseP2Id(secondPointId);
|
||||
line->setPoint1Id(GetAxisP1Id());
|
||||
line->setPoint2Id(GetAxisP2Id());
|
||||
line->setHypotenuseP1Id(GetFirstPointId());
|
||||
line->setHypotenuseP2Id(GetSecondPointId());
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
|
@ -223,10 +218,10 @@ void DialogTriangle::ShowVisualization()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setPointName set name of point
|
||||
* @brief SetPointName set name of point
|
||||
* @param value name
|
||||
*/
|
||||
void DialogTriangle::setPointName(const QString &value)
|
||||
void DialogTriangle::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
|
@ -234,44 +229,84 @@ void DialogTriangle::setPointName(const QString &value)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setSecondPointId set id of second point
|
||||
* @brief SetSecondPointId set id of second point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogTriangle::setSecondPointId(const quint32 &value)
|
||||
void DialogTriangle::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
||||
line->setHypotenuseP2Id(secondPointId);
|
||||
setCurrentPointId(ui->comboBoxSecondPoint, value);
|
||||
line->setHypotenuseP2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setFirstPointId set id of first point
|
||||
* @brief SetFirstPointId set id of first point
|
||||
* @param value id
|
||||
*/
|
||||
void DialogTriangle::setFirstPointId(const quint32 &value)
|
||||
void DialogTriangle::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
||||
line->setHypotenuseP1Id(firstPointId);
|
||||
setCurrentPointId(ui->comboBoxFirstPoint, value);
|
||||
line->setHypotenuseP1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setAxisP2Id set id second point of axis
|
||||
* @brief SetAxisP2Id set id second point of axis
|
||||
* @param value id
|
||||
*/
|
||||
void DialogTriangle::setAxisP2Id(const quint32 &value)
|
||||
void DialogTriangle::SetAxisP2Id(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxAxisP2, axisP2Id, value);
|
||||
line->setPoint2Id(axisP2Id);
|
||||
setCurrentPointId(ui->comboBoxAxisP2, value);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setAxisP1Id set id first point of axis
|
||||
* @brief SetAxisP1Id set id first point of axis
|
||||
* @param value id
|
||||
*/
|
||||
void DialogTriangle::setAxisP1Id(const quint32 &value)
|
||||
void DialogTriangle::SetAxisP1Id(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxAxisP1, axisP1Id, value);
|
||||
line->setPoint1Id(axisP1Id);
|
||||
setCurrentPointId(ui->comboBoxAxisP1, value);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetAxisP1Id return id first point of axis
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogTriangle::GetAxisP1Id() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxAxisP1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetAxisP2Id return id second point of axis
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogTriangle::GetAxisP2Id() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxAxisP2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogTriangle::GetFirstPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief GetSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
quint32 DialogTriangle::GetSecondPointId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||
}
|
||||
|
|
|
@ -48,20 +48,19 @@ public:
|
|||
DialogTriangle(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
|
||||
~DialogTriangle();
|
||||
|
||||
quint32 getAxisP1Id() const;
|
||||
void setAxisP1Id(const quint32 &value);
|
||||
quint32 GetAxisP1Id() const;
|
||||
void SetAxisP1Id(const quint32 &value);
|
||||
|
||||
quint32 getAxisP2Id() const;
|
||||
void setAxisP2Id(const quint32 &value);
|
||||
quint32 GetAxisP2Id() const;
|
||||
void SetAxisP2Id(const quint32 &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
|
||||
QString getPointName() const;
|
||||
void setPointName(const QString &value);
|
||||
void SetPointName(const QString &value);
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void PointNameChanged();
|
||||
|
@ -78,72 +77,7 @@ private:
|
|||
/** @brief ui keeps information about user interface */
|
||||
Ui::DialogTriangle *ui;
|
||||
|
||||
/** @brief number number of handled objects */
|
||||
qint32 number;
|
||||
|
||||
/** @brief axisP1Id id first point of axis */
|
||||
quint32 axisP1Id;
|
||||
|
||||
/** @brief axisP2Id id second point of axis */
|
||||
quint32 axisP2Id;
|
||||
|
||||
/** @brief firstPointId id first point of line */
|
||||
quint32 firstPointId;
|
||||
|
||||
/** @brief secondPointId id second point of line */
|
||||
quint32 secondPointId;
|
||||
|
||||
VisToolTriangle *line;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getAxisP1Id return id first point of axis
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogTriangle::getAxisP1Id() const
|
||||
{
|
||||
return axisP1Id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getAxisP2Id return id second point of axis
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogTriangle::getAxisP2Id() const
|
||||
{
|
||||
return axisP2Id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getFirstPointId return id of first point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogTriangle::getFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getSecondPointId return id of second point
|
||||
* @return id
|
||||
*/
|
||||
inline quint32 DialogTriangle::getSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief getPointName return name of point
|
||||
* @return name
|
||||
*/
|
||||
inline QString DialogTriangle::getPointName() const
|
||||
{
|
||||
return pointName;
|
||||
}
|
||||
|
||||
#endif // DIALOGTRIANGLE_H
|
||||
|
|
|
@ -255,7 +255,7 @@ QString VArc::GetFormulaF1() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VArc::SetFormulaF1(const VFormula &value)
|
||||
{
|
||||
d->formulaF1 = value.getFormula(FormulaType::FromUser);
|
||||
d->formulaF1 = value.GetFormula(FormulaType::FromUser);
|
||||
d->f1 = value.getDoubleValue();
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ QString VArc::GetFormulaF2() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VArc::SetFormulaF2(const VFormula &value)
|
||||
{
|
||||
d->formulaF2 = value.getFormula(FormulaType::FromUser);
|
||||
d->formulaF2 = value.GetFormula(FormulaType::FromUser);
|
||||
d->f2 = value.getDoubleValue();
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ QString VArc::GetFormulaRadius() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VArc::SetFormulaRadius(const VFormula &value)
|
||||
{
|
||||
d->formulaRadius = value.getFormula(FormulaType::FromUser);
|
||||
d->formulaRadius = value.GetFormula(FormulaType::FromUser);
|
||||
d->radius = value.getDoubleValue();
|
||||
}
|
||||
|
||||
|
|
|
@ -255,13 +255,13 @@ void VSplinePath::Clear()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSplinePath::getKCurve() const
|
||||
qreal VSplinePath::GetKCurve() const
|
||||
{
|
||||
return d->kCurve;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSplinePath::setKCurve(const qreal &value)
|
||||
void VSplinePath::SetKCurve(const qreal &value)
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
|
|
|
@ -118,15 +118,15 @@ public:
|
|||
*/
|
||||
void Clear();
|
||||
/**
|
||||
* @brief getKCurve return coefficient of curvature spline path.
|
||||
* @brief GetKCurve return coefficient of curvature spline path.
|
||||
* @return coefficient of curvature spline.
|
||||
*/
|
||||
qreal getKCurve() const;
|
||||
qreal GetKCurve() const;
|
||||
/**
|
||||
* @brief setKCurve set coefficient of curvature spline path.
|
||||
* @brief SetKCurve set coefficient of curvature spline path.
|
||||
* @param value coefficient of curvature spline path.
|
||||
*/
|
||||
void setKCurve(const qreal &value);
|
||||
void SetKCurve(const qreal &value);
|
||||
/**
|
||||
* @brief GetPoint pointer to list spline point.
|
||||
* @return list.
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
*
|
||||
* VSplinePoint splP1 = splPath->at(p1);
|
||||
* VSplinePoint splP2 = splPath->at(p2);
|
||||
* VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->getKCurve());
|
||||
* VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve());
|
||||
* VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->GetKCurve());
|
||||
* VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->GetKCurve());
|
||||
* @param length length first spline path.
|
||||
* @param p1 index first spline point in list.
|
||||
* @param p2 index second spline point in list.
|
||||
|
|
|
@ -68,13 +68,18 @@ QString VAbstractSpline::getTagName() const
|
|||
*/
|
||||
void VAbstractSpline::FullUpdateFromFile()
|
||||
{
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::Disable(bool disable)
|
||||
{
|
||||
DisableItem(this, disable);
|
||||
enabled = !disable;
|
||||
this->setEnabled(enabled);
|
||||
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthMainLine())/factor, Qt::SolidLine,
|
||||
Qt::RoundCap));
|
||||
emit setEnabledPoint(enabled);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -84,23 +89,18 @@ void VAbstractSpline::Disable(bool disable)
|
|||
*/
|
||||
void VAbstractSpline::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
const bool selectable = (nameActivDraw == newName);
|
||||
this->setEnabled(selectable);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
emit setEnabledPoint(selectable);
|
||||
Disable(!(nameActivDraw == newName));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ShowTool highlight tool.
|
||||
* @param id object id in container
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||
void VAbstractSpline::ShowTool(quint32 id, bool enable)
|
||||
{
|
||||
ShowItem(this, id, color, enable);
|
||||
ShowItem(this, id, enable);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -123,7 +123,8 @@ void VAbstractSpline::SetFactor(qreal factor)
|
|||
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, Qt::SolidLine, Qt::RoundCap));
|
||||
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthMainLine())/factor, Qt::SolidLine,
|
||||
Qt::RoundCap));
|
||||
this->setPath(ToolPath(PathDirection::Show));
|
||||
isHovered = true;
|
||||
QGraphicsPathItem::hoverEnterEvent(event);
|
||||
|
@ -138,7 +139,7 @@ void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||
void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
this->setPath(ToolPath());
|
||||
isHovered = false;
|
||||
QGraphicsPathItem::hoverLeaveEvent(event);
|
||||
|
@ -211,6 +212,12 @@ QPainterPath VAbstractSpline::ToolPath(PathDirection direction) const
|
|||
return path;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::ShowFoot(bool show)
|
||||
{
|
||||
|
@ -219,3 +226,17 @@ void VAbstractSpline::ShowFoot(bool show)
|
|||
controlPoints.at(i)->setVisible(show);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::setEnabled(bool enabled)
|
||||
{
|
||||
QGraphicsPathItem::setEnabled(enabled);
|
||||
if (enabled)
|
||||
{
|
||||
setPen(QPen(QColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
}
|
||||
else
|
||||
{
|
||||
setPen(QPen(Qt::gray, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ public:
|
|||
enum { Type = UserType + static_cast<int>(Tool::AbstractSpline)};
|
||||
virtual QString getTagName() const;
|
||||
void ShowFoot(bool show);
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile ();
|
||||
void Disable(bool disable);
|
||||
|
@ -75,7 +78,7 @@ protected:
|
|||
*/
|
||||
virtual void RefreshGeometry ()=0;
|
||||
virtual void ChangedActivDraw ( const QString &newName );
|
||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void ShowTool(quint32 id, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
|
@ -83,6 +86,7 @@ protected:
|
|||
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||
QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractSpline)
|
||||
};
|
||||
|
|
|
@ -46,8 +46,8 @@ qreal VDrawTool::factor = 1;
|
|||
* @param id object id in container.
|
||||
*/
|
||||
VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
||||
:VAbstractTool(doc, data, id, parent), ignoreFullUpdate(false),
|
||||
nameActivDraw(doc->GetNameActivPP()), dialog(nullptr)
|
||||
:VAbstractTool(doc, data, id, parent), ignoreFullUpdate(false), nameActivDraw(doc->GetNameActivPP()),
|
||||
dialog(nullptr), typeLine(TypeLineLine), lineColor(ColorBlack), enabled(true)
|
||||
{
|
||||
connect(this->doc, &VPattern::ChangedActivPP, this, &VDrawTool::ChangedActivDraw);
|
||||
connect(this->doc, &VPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw);
|
||||
|
@ -64,33 +64,14 @@ VDrawTool::~VDrawTool()
|
|||
/**
|
||||
* @brief ShowTool highlight tool.
|
||||
* @param id object id in container.
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||
void VDrawTool::ShowTool(quint32 id, bool enable)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(color);
|
||||
Q_UNUSED(enable);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
|
||||
* @param newName new name active pattern peace. name new active pattern peace.
|
||||
*/
|
||||
void VDrawTool::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
if (nameActivDraw == newName)
|
||||
{
|
||||
currentColor = baseColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ChangedNameDraw save new name active pattern peace.
|
||||
|
@ -175,7 +156,34 @@ void VDrawTool::RefreshDataInFile()
|
|||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||
qCDebug(vTool)<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QColor VDrawTool::CorrectColor(const QColor &color) const
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Qt::gray;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::ReadAttributes()
|
||||
{
|
||||
const QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
ReadToolAttributes(domElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vTool)<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,10 +249,10 @@ qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContaine
|
|||
{
|
||||
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, qApp->getMainWindow());
|
||||
dialog->setWindowTitle(tr("Edit wrong formula"));
|
||||
dialog->setFormula(formula);
|
||||
dialog->SetFormula(formula);
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
formula = dialog->getFormula();
|
||||
formula = dialog->GetFormula();
|
||||
/* Need delete dialog here because parser in dialog don't allow use correct separator for parsing
|
||||
* here. */
|
||||
delete dialog;
|
||||
|
@ -285,3 +293,34 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement)
|
|||
connect(addToCal, &AddToCalc::NeedFullParsing, doc, &VPattern::NeedFullParsing);
|
||||
qApp->getUndoStack()->push(addToCal);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VDrawTool::getLineType() const
|
||||
{
|
||||
return typeLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VDrawTool::GetLineColor() const
|
||||
{
|
||||
return lineColor;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::SetLineColor(const QString &value)
|
||||
{
|
||||
lineColor = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
|
|
|
@ -55,9 +55,16 @@ public:
|
|||
virtual void setDialog() {}
|
||||
virtual void DialogLinkDestroy();
|
||||
static qreal CheckFormula(const quint32 &toolId, QString &formula, VContainer *data);
|
||||
|
||||
QString getLineType() const;
|
||||
virtual void SetTypeLine(const QString &value);
|
||||
|
||||
QString GetLineColor() const;
|
||||
virtual void SetLineColor(const QString &value);
|
||||
|
||||
public slots:
|
||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
virtual void ShowTool(quint32 id, bool enable);
|
||||
virtual void ChangedActivDraw(const QString &newName) = 0;
|
||||
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
||||
virtual void FullUpdateFromGuiOk(int result);
|
||||
virtual void FullUpdateFromGuiApply();
|
||||
|
@ -71,7 +78,15 @@ protected:
|
|||
QString nameActivDraw;
|
||||
|
||||
/** @brief dialog dialog options.*/
|
||||
DialogTool *dialog;
|
||||
DialogTool *dialog;
|
||||
|
||||
/** @brief typeLine line type. */
|
||||
QString typeLine;
|
||||
|
||||
/** @brief lineColor color line or curve, but not a point. */
|
||||
QString lineColor;
|
||||
|
||||
bool enabled;
|
||||
|
||||
void AddToCalculation(const QDomElement &domElement);
|
||||
|
||||
|
@ -80,6 +95,10 @@ protected:
|
|||
void SaveDialogChange();
|
||||
virtual void AddToFile();
|
||||
virtual void RefreshDataInFile();
|
||||
QColor CorrectColor(const QColor &color) const;
|
||||
|
||||
void ReadAttributes();
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement)=0;
|
||||
|
||||
template <typename Dialog, typename Tool>
|
||||
/**
|
||||
|
@ -142,39 +161,16 @@ protected:
|
|||
* @brief ShowItem highlight tool.
|
||||
* @param item tool.
|
||||
* @param id object id in container.
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
void ShowItem(Item *item, quint32 id, Qt::GlobalColor color, bool enable)
|
||||
void ShowItem(Item *item, quint32 id, bool enable)
|
||||
{
|
||||
SCASSERT(item != nullptr);
|
||||
if (id == item->id)
|
||||
{
|
||||
if (enable == false)
|
||||
{
|
||||
currentColor = baseColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentColor = color;
|
||||
}
|
||||
item->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
ShowVisualization(enable);
|
||||
}
|
||||
}
|
||||
template <typename Item>
|
||||
void DisableItem(Item *item, bool disable)
|
||||
{
|
||||
SCASSERT(item != nullptr);
|
||||
if (disable)
|
||||
{
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentColor = baseColor;
|
||||
}
|
||||
item->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(VDrawTool)
|
||||
};
|
||||
|
|
|
@ -50,9 +50,9 @@ const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
|
|||
*/
|
||||
VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const QString &typeLine, const Source &typeCreation,
|
||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, firstPointId, 0, parent), secondPointId(secondPointId)
|
||||
{
|
||||
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -71,14 +71,7 @@ VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, cons
|
|||
*/
|
||||
void VToolAlongLine::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formulaLength = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -144,10 +137,11 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement)
|
|||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, dialogTool->getFirstPointId());
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, dialogTool->GetFirstPointId());
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, dialogTool->GetSecondPointId());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -163,19 +157,30 @@ void VToolAlongLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrLength, formulaLength);
|
||||
doc->SetAttribute(tag, AttrFirstPoint, basePointId);
|
||||
doc->SetAttribute(tag, AttrSecondPoint, secondPointId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolAlongLine::getSecondPointId() const
|
||||
void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolAlongLine::GetSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolAlongLine::setSecondPointId(const quint32 &value)
|
||||
void VToolAlongLine::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -231,11 +236,12 @@ void VToolAlongLine::setDialog()
|
|||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setFirstPointId(basePointId);
|
||||
dialogTool->setSecondPointId(secondPointId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
dialogTool->SetFormula(formulaLength);
|
||||
dialogTool->SetFirstPointId(basePointId);
|
||||
dialogTool->SetSecondPointId(secondPointId);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -251,14 +257,15 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogAlongLine *dialogTool = qobject_cast<DialogAlongLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formula = dialogTool->GetFormula();
|
||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
VToolAlongLine *point=nullptr;
|
||||
point = Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -284,9 +291,10 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
const QString &lineColor, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
@ -314,8 +322,8 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
|
|||
VDrawTool::AddRecord(id, Tool::AlongLine, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId,
|
||||
secondPointId, typeLine, typeCreation);
|
||||
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine,
|
||||
lineColor, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolAlongLine::SetFactor);
|
||||
|
|
|
@ -40,20 +40,21 @@ class VToolAlongLine : public VToolLinePoint
|
|||
public:
|
||||
|
||||
VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const QString &typeLine, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolAlongLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
const QString &lineColor, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::AlongLine)};
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
|
@ -64,6 +65,7 @@ protected:
|
|||
virtual void RemoveReferens();
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
/** @brief secondPointId id second point of line. */
|
||||
quint32 secondPointId;
|
||||
|
|
|
@ -47,10 +47,12 @@ const QString VToolArc::ToolType = QStringLiteral("simple");
|
|||
* @param typeCreation way we create this tool.
|
||||
* @param parent parent object
|
||||
*/
|
||||
VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem *parent)
|
||||
VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VAbstractSpline(doc, data, id, parent)
|
||||
{
|
||||
sceneType = SceneObject::Arc;
|
||||
lineColor = color;
|
||||
|
||||
this->setPath(ToolPath());
|
||||
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
|
@ -82,6 +84,7 @@ void VToolArc::setDialog()
|
|||
dialogTool->SetF1(arc->GetFormulaF1());
|
||||
dialogTool->SetF2(arc->GetFormulaF2());
|
||||
dialogTool->SetRadius(arc->GetFormulaRadius());
|
||||
dialogTool->SetColor(lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -101,8 +104,9 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
|
|||
QString radius = dialogTool->GetRadius();
|
||||
QString f1 = dialogTool->GetF1();
|
||||
QString f2 = dialogTool->GetF2();
|
||||
const QString color = dialogTool->GetColor();
|
||||
VToolArc* point = nullptr;
|
||||
point=Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
point=Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -125,8 +129,8 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, QString &f2,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
|
||||
|
||||
|
@ -155,7 +159,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra
|
|||
VDrawTool::AddRecord(id, Tool::Arc, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
|
||||
VToolArc *toolArc = new VToolArc(doc, data, id, color, typeCreation);
|
||||
scene->addItem(toolArc);
|
||||
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, toolArc, &VToolArc::SetFactor);
|
||||
|
@ -197,7 +201,7 @@ void VToolArc::setCenter(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolArc::getFormulaRadius() const
|
||||
VFormula VToolArc::GetFormulaRadius() const
|
||||
{
|
||||
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
SCASSERT(arc.isNull() == false);
|
||||
|
@ -210,7 +214,7 @@ VFormula VToolArc::getFormulaRadius() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::setFormulaRadius(const VFormula &value)
|
||||
void VToolArc::SetFormulaRadius(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
|
@ -225,7 +229,7 @@ void VToolArc::setFormulaRadius(const VFormula &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolArc::getFormulaF1() const
|
||||
VFormula VToolArc::GetFormulaF1() const
|
||||
{
|
||||
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
SCASSERT(arc.isNull() == false);
|
||||
|
@ -238,7 +242,7 @@ VFormula VToolArc::getFormulaF1() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::setFormulaF1(const VFormula &value)
|
||||
void VToolArc::SetFormulaF1(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
|
@ -254,7 +258,7 @@ void VToolArc::setFormulaF1(const VFormula &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolArc::getFormulaF2() const
|
||||
VFormula VToolArc::GetFormulaF2() const
|
||||
{
|
||||
QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
SCASSERT(arc.isNull() == false);
|
||||
|
@ -267,7 +271,7 @@ VFormula VToolArc::getFormulaF2() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolArc::setFormulaF2(const VFormula &value)
|
||||
void VToolArc::SetFormulaF2(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
|
@ -351,6 +355,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
|
|||
doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius());
|
||||
doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1());
|
||||
doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2());
|
||||
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -365,6 +370,7 @@ void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrRadius, arc->GetFormulaRadius());
|
||||
doc->SetAttribute(tag, AttrAngle1, arc->GetFormulaF1());
|
||||
doc->SetAttribute(tag, AttrAngle2, arc->GetFormulaF2());
|
||||
doc->SetAttribute(tag, AttrColor, lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -373,7 +379,7 @@ void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
*/
|
||||
void VToolArc::RefreshGeometry()
|
||||
{
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
this->setPath(ToolPath());
|
||||
|
||||
if (vis != nullptr)
|
||||
|
|
|
@ -40,12 +40,13 @@ class VToolArc :public VAbstractSpline
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
VToolArc(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolArc* Create(const quint32 _id, const quint32 ¢er, QString &radius, QString &f1, QString &f2,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static const QString TagName;
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
|
@ -55,14 +56,14 @@ public:
|
|||
quint32 getCenter() const;
|
||||
void setCenter(const quint32 &value);
|
||||
|
||||
VFormula getFormulaRadius() const;
|
||||
void setFormulaRadius(const VFormula &value);
|
||||
VFormula GetFormulaRadius() const;
|
||||
void SetFormulaRadius(const VFormula &value);
|
||||
|
||||
VFormula getFormulaF1() const;
|
||||
void setFormulaF1(const VFormula &value);
|
||||
VFormula GetFormulaF1() const;
|
||||
void SetFormulaF1(const VFormula &value);
|
||||
|
||||
VFormula getFormulaF2() const;
|
||||
void setFormulaF2(const VFormula &value);
|
||||
VFormula GetFormulaF2() const;
|
||||
void SetFormulaF2(const VFormula &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
protected:
|
||||
|
|
|
@ -49,9 +49,10 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector");
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const quint32 &thirdPointId, const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(NULL_ID),
|
||||
const QString &lineColor, const QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const quint32 &thirdPointId, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, secondPointId, 0, parent), firstPointId(NULL_ID),
|
||||
thirdPointId(NULL_ID)
|
||||
{
|
||||
this->firstPointId = firstPointId;
|
||||
|
@ -112,12 +113,13 @@ void VToolBisector::setDialog()
|
|||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setFirstPointId(firstPointId);
|
||||
dialogTool->setSecondPointId(basePointId);
|
||||
dialogTool->setThirdPointId(thirdPointId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
dialogTool->SetFormula(formulaLength);
|
||||
dialogTool->SetFirstPointId(firstPointId);
|
||||
dialogTool->SetSecondPointId(basePointId);
|
||||
dialogTool->SetThirdPointId(thirdPointId);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -134,15 +136,16 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const quint32 thirdPointId = dialogTool->getThirdPointId();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formula = dialogTool->GetFormula();
|
||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||
const quint32 thirdPointId = dialogTool->GetThirdPointId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
VToolBisector *point = nullptr;
|
||||
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor, pointName, 5, 10, scene,
|
||||
doc, data, Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -169,10 +172,10 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
|
||||
const QString &pointName, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
|
||||
const QString &lineColor, const QString &pointName, const qreal &mx,
|
||||
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
@ -200,12 +203,12 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
|
|||
VDrawTool::AddRecord(id, Tool::Bisector, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId,
|
||||
thirdPointId, typeCreation);
|
||||
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, lineColor, formula, firstPointId,
|
||||
secondPointId, thirdPointId, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolBisector::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolBisector::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
@ -221,15 +224,7 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
|
|||
*/
|
||||
void VToolBisector::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formulaLength = domElement.attribute(AttrLength, "");
|
||||
firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||
basePointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt();
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -296,11 +291,12 @@ void VToolBisector::SaveDialog(QDomElement &domElement)
|
|||
DialogBisector *dialogTool = qobject_cast<DialogBisector*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
|
||||
doc->SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogTool->getThirdPointId()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPointId()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPointId()));
|
||||
doc->SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogTool->GetThirdPointId()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -316,6 +312,7 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrLength, formulaLength);
|
||||
doc->SetAttribute(tag, AttrFirstPoint, firstPointId);
|
||||
doc->SetAttribute(tag, AttrSecondPoint, basePointId);
|
||||
|
@ -323,13 +320,24 @@ void VToolBisector::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolBisector::getThirdPointId() const
|
||||
void VToolBisector::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||
firstPointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||
thirdPointId = doc->GetParametrUInt(domElement, AttrThirdPoint, NULL_ID_STR);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolBisector::GetThirdPointId() const
|
||||
{
|
||||
return thirdPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::setThirdPointId(const quint32 &value)
|
||||
void VToolBisector::SetThirdPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -377,13 +385,13 @@ void VToolBisector::ShowVisualization(bool show)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolBisector::getFirstPointId() const
|
||||
quint32 VToolBisector::GetFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::setFirstPointId(const quint32 &value)
|
||||
void VToolBisector::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
|
|
@ -39,9 +39,9 @@ class VToolBisector : public VToolLinePoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
|
||||
VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &thirdPointId,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
|
||||
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const quint32 &thirdPointId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
static qreal BisectorAngle(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint);
|
||||
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint,
|
||||
const qreal& length);
|
||||
|
@ -49,18 +49,18 @@ public:
|
|||
static VToolBisector* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
|
||||
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const QString &lineColor, const QString &pointName, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::Bisector)};
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getThirdPointId() const;
|
||||
void setThirdPointId(const quint32 &value);
|
||||
quint32 GetThirdPointId() const;
|
||||
void SetThirdPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
|
@ -72,6 +72,7 @@ protected:
|
|||
virtual void RemoveReferens();
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
/** @brief firstPointId id first point of angle. */
|
||||
quint32 firstPointId;
|
||||
|
|
|
@ -38,10 +38,11 @@ const QString VToolCurveIntersectAxis::ToolType = QStringLiteral("curveIntersect
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolCurveIntersectAxis::VToolCurveIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
const QString &typeLine, const QString &formulaAngle,
|
||||
const quint32 &basePointId, const quint32 &curveId,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
|
||||
const QString &typeLine, const QString &lineColor,
|
||||
const QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &curveId, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
|
||||
curveId(curveId)
|
||||
{
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -66,11 +67,12 @@ void VToolCurveIntersectAxis::setDialog()
|
|||
DialogCurveIntersectAxis *dialogTool = qobject_cast<DialogCurveIntersectAxis*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setAngle(formulaAngle);
|
||||
dialogTool->setBasePointId(basePointId);
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
dialogTool->SetAngle(formulaAngle);
|
||||
dialogTool->SetBasePointId(basePointId);
|
||||
dialogTool->setCurveId(curveId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -81,13 +83,14 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
|
|||
DialogCurveIntersectAxis *dialogTool = qobject_cast<DialogCurveIntersectAxis*>(dialog);
|
||||
SCASSERT(dialogTool);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formulaAngle = dialogTool->getAngle();
|
||||
const quint32 basePointId = dialogTool->getBasePointId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
QString formulaAngle = dialogTool->GetAngle();
|
||||
const quint32 basePointId = dialogTool->GetBasePointId();
|
||||
const quint32 curveId = dialogTool->getCurveId();
|
||||
|
||||
VToolCurveIntersectAxis *point = nullptr;
|
||||
point=Create(0, pointName, typeLine, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data,
|
||||
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
|
@ -98,9 +101,9 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, const QString &pointName,
|
||||
const QString &typeLine, QString &formulaAngle,
|
||||
const quint32 &basePointId, const quint32 &curveId,
|
||||
const qreal &mx, const qreal &my,
|
||||
const QString &typeLine, const QString &lineColor,
|
||||
QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &curveId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
|
@ -127,12 +130,12 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
|
|||
VDrawTool::AddRecord(id, Tool::CurveIntersectAxis, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCurveIntersectAxis *point = new VToolCurveIntersectAxis(doc, data, id, typeLine, formulaAngle, basePointId,
|
||||
curveId, typeCreation);
|
||||
VToolCurveIntersectAxis *point = new VToolCurveIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle,
|
||||
basePointId, curveId, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCurveIntersectAxis::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCurveIntersectAxis::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
doc->IncrementReferens(curveId);
|
||||
|
@ -173,7 +176,7 @@ QPointF VToolCurveIntersectAxis::FindPoint(const QPointF &point, qreal angle,
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolCurveIntersectAxis::getFormulaAngle() const
|
||||
VFormula VToolCurveIntersectAxis::GetFormulaAngle() const
|
||||
{
|
||||
VFormula fAngle(formulaAngle, getData());
|
||||
fAngle.setCheckZero(false);
|
||||
|
@ -183,11 +186,11 @@ VFormula VToolCurveIntersectAxis::getFormulaAngle() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCurveIntersectAxis::setFormulaAngle(const VFormula &value)
|
||||
void VToolCurveIntersectAxis::SetFormulaAngle(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
formulaAngle = value.getFormula(FormulaType::FromUser);
|
||||
formulaAngle = value.GetFormula(FormulaType::FromUser);
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
|
@ -226,7 +229,7 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
|
|||
|
||||
visual->setPoint1Id(curveId);
|
||||
visual->setAxisPointId(basePointId);
|
||||
visual->setAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
|
@ -250,14 +253,7 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCurveIntersectAxis::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
||||
curveId = domElement.attribute(AttrCurve, "").toUInt();
|
||||
formulaAngle = domElement.attribute(AttrAngle, "");
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -265,7 +261,7 @@ void VToolCurveIntersectAxis::FullUpdateFromFile()
|
|||
VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||
visual->setPoint1Id(curveId);
|
||||
visual->setAxisPointId(basePointId);
|
||||
visual->setAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
@ -290,9 +286,10 @@ void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement)
|
|||
DialogCurveIntersectAxis *dialogTool = qobject_cast<DialogCurveIntersectAxis*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->getAngle());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrCurve, QString().setNum(dialogTool->getCurveId()));
|
||||
}
|
||||
|
||||
|
@ -309,7 +306,18 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObj
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||
doc->SetAttribute(tag, AttrCurve, curveId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||
curveId = doc->GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
|
||||
formulaAngle = doc->GetParametrString(domElement, AttrAngle, "");
|
||||
}
|
||||
|
|
|
@ -36,17 +36,18 @@ class VToolCurveIntersectAxis : public VToolLinePoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolCurveIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const QString &formulaAngle, const quint32 &basePointId, const quint32 &curveId,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
const QString &lineColor, const QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &curveId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual ~VToolCurveIntersectAxis();
|
||||
virtual void setDialog();
|
||||
|
||||
static VToolCurveIntersectAxis *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data);
|
||||
static VToolCurveIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formulaAngle, const quint32 &basePointId, const quint32 &curveId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &curveId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
|
||||
static QPointF FindPoint(const QPointF &point, qreal angle, const QSharedPointer<VAbstractCurve> &curve);
|
||||
|
||||
|
@ -54,8 +55,8 @@ public:
|
|||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::CurveIntersectAxis)};
|
||||
|
||||
VFormula getFormulaAngle() const;
|
||||
void setFormulaAngle(const VFormula &value);
|
||||
VFormula GetFormulaAngle() const;
|
||||
void SetFormulaAngle(const VFormula &value);
|
||||
|
||||
quint32 getCurveId() const;
|
||||
void setCurveId(const quint32 &value);
|
||||
|
@ -68,6 +69,7 @@ protected:
|
|||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolCurveIntersectAxis)
|
||||
QString formulaAngle;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id,
|
||||
const quint32 &curveCutId, const quint32 &curve1id, const quint32 &curve2id, const QString &color,
|
||||
QGraphicsItem *parent)
|
||||
:VToolPoint(doc, data, id, parent), formula(formula), firstCurve(nullptr), secondCurve(nullptr),
|
||||
curveCutId(curveCutId), curve1id(curve1id), curve2id(curve2id)
|
||||
|
@ -41,12 +41,14 @@ VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QSt
|
|||
Q_ASSERT_X(curve1id > 0, Q_FUNC_INFO, "curve1id <= 0");
|
||||
Q_ASSERT_X(curve2id > 0, Q_FUNC_INFO, "curve2id <= 0");
|
||||
|
||||
firstCurve = new VSimpleCurve(curve1id, ¤tColor, SimpleCurvePoint::ForthPoint, &factor);
|
||||
lineColor = color;
|
||||
|
||||
firstCurve = new VSimpleCurve(curve1id, QColor(lineColor), SimpleCurvePoint::ForthPoint, &factor);
|
||||
firstCurve->setParentItem(this);
|
||||
connect(firstCurve, &VSimpleCurve::Choosed, this, &VToolCut::CurveChoosed);
|
||||
connect(firstCurve, &VSimpleCurve::HoverPath, this, &VToolCut::HoverPath);
|
||||
|
||||
secondCurve = new VSimpleCurve(curve2id, ¤tColor, SimpleCurvePoint::FirstPoint, &factor);
|
||||
secondCurve = new VSimpleCurve(curve2id, QColor(lineColor), SimpleCurvePoint::FirstPoint, &factor);
|
||||
secondCurve->setParentItem(this);
|
||||
connect(secondCurve, &VSimpleCurve::Choosed, this, &VToolCut::CurveChoosed);
|
||||
connect(secondCurve, &VSimpleCurve::HoverPath, this, &VToolCut::HoverPath);
|
||||
|
@ -59,11 +61,7 @@ VToolCut::VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QSt
|
|||
*/
|
||||
void VToolCut::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
const bool flag = (nameActivDraw == newName);
|
||||
this->setEnabled(flag);
|
||||
firstCurve->ChangedActivDraw(flag);
|
||||
secondCurve->ChangedActivDraw(flag);
|
||||
Disable(!(nameActivDraw == newName));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -76,6 +74,14 @@ void VToolCut::HoverPath(quint32 id, SimpleCurvePoint curvePosition, PathDirecti
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCut::Disable(bool disable)
|
||||
{
|
||||
VToolPoint::Disable(disable);
|
||||
firstCurve->ChangedActivDraw(enabled);
|
||||
secondCurve->ChangedActivDraw(enabled);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolCut::getCurveCutId() const
|
||||
{
|
||||
|
@ -94,7 +100,7 @@ void VToolCut::setCurveCutId(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolCut::getFormula() const
|
||||
VFormula VToolCut::GetFormula() const
|
||||
{
|
||||
VFormula val(formula, getData());
|
||||
val.setCheckZero(true);
|
||||
|
@ -104,11 +110,11 @@ VFormula VToolCut::getFormula() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCut::setFormula(const VFormula &value)
|
||||
void VToolCut::SetFormula(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
formula = value.getFormula(FormulaType::FromUser);
|
||||
formula = value.GetFormula(FormulaType::FromUser);
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
|
@ -146,5 +152,4 @@ void VToolCut::FullUpdateCurveFromFile(const QString &attrCurve)
|
|||
formula = domElement.attribute(AttrLength, "");
|
||||
curveCutId = domElement.attribute(attrCurve, "").toUInt();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -39,12 +39,12 @@ class VToolCut : public VToolPoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolCut(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &curveCutId,
|
||||
const quint32 &curve1id, const quint32 &curve2id, QGraphicsItem * parent = nullptr);
|
||||
const quint32 &curve1id, const quint32 &curve2id, const QString &color, QGraphicsItem * parent = nullptr);
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::Cut)};
|
||||
|
||||
VFormula getFormula() const;
|
||||
void setFormula(const VFormula &value);
|
||||
VFormula GetFormula() const;
|
||||
void SetFormula(const VFormula &value);
|
||||
|
||||
quint32 getCurveCutId() const;
|
||||
void setCurveCutId(const quint32 &value);
|
||||
|
@ -53,6 +53,7 @@ public slots:
|
|||
virtual void ChangedActivDraw(const QString &newName);
|
||||
virtual void CurveChoosed(quint32 id)=0;
|
||||
void HoverPath(quint32 id, SimpleCurvePoint curvePosition, PathDirection direction);
|
||||
void Disable(bool disable);
|
||||
protected:
|
||||
/** @brief formula keep formula of length */
|
||||
QString formula;
|
||||
|
|
|
@ -50,9 +50,9 @@ const QString VToolCutArc::AttrArc = QStringLiteral("arc");
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id,
|
||||
const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const QString &color,
|
||||
const Source &typeCreation, QGraphicsItem * parent)
|
||||
:VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, parent)
|
||||
:VToolCut(doc, data, id, formula, arcId, arc1id, arc2id, color, parent)
|
||||
{
|
||||
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
|
||||
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
|
||||
|
@ -77,9 +77,10 @@ void VToolCutArc::setDialog()
|
|||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->SetFormula(formula);
|
||||
dialogTool->setArcId(curveCutId);
|
||||
dialogTool->setPointName(point->name());
|
||||
dialogTool->SetPointName(point->name());
|
||||
dialogTool->SetColor(lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -96,10 +97,11 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
|||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
QString formula = dialogTool->getFormula();
|
||||
QString formula = dialogTool->GetFormula();
|
||||
const quint32 arcId = dialogTool->getArcId();
|
||||
const QString color = dialogTool->GetColor();
|
||||
VToolCutArc* point = nullptr;
|
||||
point=Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
point=Create(0, pointName, formula, arcId, 5, 10, color, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -123,8 +125,8 @@ VToolCutArc* VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(arcId);
|
||||
|
||||
|
@ -167,11 +169,11 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
VDrawTool::AddRecord(id, Tool::CutArc, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, typeCreation);
|
||||
VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, color, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutArc::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCutArc::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(arc1id, point);
|
||||
doc->AddTool(arc2id, point);
|
||||
|
@ -220,7 +222,8 @@ void VToolCutArc::ShowVisualization(bool show)
|
|||
*/
|
||||
void VToolCutArc::FullUpdateFromFile()
|
||||
{
|
||||
FullUpdateCurveFromFile(AttrArc);
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -271,8 +274,9 @@ void VToolCutArc::SaveDialog(QDomElement &domElement)
|
|||
DialogCutArc *dialogTool = qobject_cast<DialogCutArc*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId()));
|
||||
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -296,6 +300,7 @@ void VToolCutArc::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurve
|
|||
{
|
||||
path.translate(-arc->GetP2().x(), -arc->GetP2().y());
|
||||
}
|
||||
curve->SetCurrentColor(QColor(lineColor));
|
||||
curve->setPath(path);
|
||||
}
|
||||
|
||||
|
@ -310,7 +315,16 @@ void VToolCutArc::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrName, point->name());
|
||||
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
|
||||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
doc->SetAttribute(tag, AttrColor, lineColor);
|
||||
|
||||
doc->SetAttribute(tag, AttrLength, formula);
|
||||
doc->SetAttribute(tag, AttrArc, curveCutId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutArc::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||
curveCutId = doc->GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
|
||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ class VToolCutArc : public VToolCut
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId,
|
||||
const quint32 &arc1id, const quint32 &arc2id, const Source &typeCreation,
|
||||
const quint32 &arc1id, const quint32 &arc2id, const QString &color, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolCutArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolCutArc* Create(const quint32 _id, const QString &pointName, QString &formula, const quint32 &arcId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
const qreal &mx, const qreal &my, const QString &color, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
static const QString AttrArc;
|
||||
virtual int type() const {return Type;}
|
||||
|
@ -61,6 +61,7 @@ protected:
|
|||
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||
PathDirection direction = PathDirection::Hide);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolCutArc)
|
||||
};
|
||||
|
|
|
@ -50,8 +50,8 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline");
|
|||
*/
|
||||
VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, parent)
|
||||
const QString &color, const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splineId, spl1id, spl2id, color, parent)
|
||||
{
|
||||
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
|
||||
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
|
||||
|
@ -76,9 +76,10 @@ void VToolCutSpline::setDialog()
|
|||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->SetFormula(formula);
|
||||
dialogTool->setSplineId(curveCutId);
|
||||
dialogTool->setPointName(point->name());
|
||||
dialogTool->SetPointName(point->name());
|
||||
dialogTool->SetColor(lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -96,10 +97,12 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
|
|||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
QString formula = dialogTool->getFormula();
|
||||
QString formula = dialogTool->GetFormula();
|
||||
const quint32 splineId = dialogTool->getSplineId();
|
||||
const QString color = dialogTool->GetColor();
|
||||
VToolCutSpline* point = nullptr;
|
||||
point = Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
point = Create(0, pointName, formula, splineId, 5, 10, color, scene, doc, data, Document::FullParse,
|
||||
Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -123,7 +126,7 @@ VToolCutSpline* VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *s
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointName, QString &formula,
|
||||
const quint32 &splineId, const qreal &mx, const qreal &my,
|
||||
const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
|
@ -174,11 +177,12 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
|
|||
VDrawTool::AddRecord(id, Tool::CutSpline, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation);
|
||||
VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, color,
|
||||
typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSpline::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCutSpline::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(spl1id, point);
|
||||
doc->AddTool(spl2id, point);
|
||||
|
@ -231,7 +235,8 @@ void VToolCutSpline::ShowVisualization(bool show)
|
|||
*/
|
||||
void VToolCutSpline::FullUpdateFromFile()
|
||||
{
|
||||
FullUpdateCurveFromFile(AttrSpline);
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -282,8 +287,9 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement)
|
|||
DialogCutSpline *dialogTool = qobject_cast<DialogCutSpline*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId()));
|
||||
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -307,6 +313,7 @@ void VToolCutSpline::RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCu
|
|||
{
|
||||
path.translate(-spl->GetP4().toQPointF().x(), -spl->GetP4().toQPointF().y());
|
||||
}
|
||||
curve->SetCurrentColor(QColor(lineColor));
|
||||
curve->setPath(path);
|
||||
}
|
||||
|
||||
|
@ -321,7 +328,16 @@ void VToolCutSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj
|
|||
doc->SetAttribute(tag, AttrName, point->name());
|
||||
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
|
||||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
doc->SetAttribute(tag, AttrColor, lineColor);
|
||||
|
||||
doc->SetAttribute(tag, AttrLength, formula);
|
||||
doc->SetAttribute(tag, AttrSpline, curveCutId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||
curveCutId = doc->GetParametrUInt(domElement, AttrSpline, NULL_ID_STR);
|
||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
||||
}
|
||||
|
|
|
@ -40,13 +40,14 @@ class VToolCutSpline : public VToolCut
|
|||
public:
|
||||
|
||||
VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id,
|
||||
const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const QString &color,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolCutSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolCutSpline *Create(const quint32 _id, const QString &pointName, QString &formula,
|
||||
const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
const quint32 &splineId, const qreal &mx, const qreal &my, const QString &color,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
static const QString AttrSpline;
|
||||
virtual int type() const {return Type;}
|
||||
|
@ -62,6 +63,7 @@ protected:
|
|||
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||
PathDirection direction = PathDirection::Hide);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolCutSpline)
|
||||
};
|
||||
|
|
|
@ -53,9 +53,9 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath");
|
|||
*/
|
||||
VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
const QString &formula, const quint32 &splinePathId,
|
||||
const quint32 &splPath1id, const quint32 &splPath2id,
|
||||
const quint32 &splPath1id, const quint32 &splPath2id, const QString &color,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, parent)
|
||||
:VToolCut(doc, data, id, formula, splinePathId, splPath1id, splPath2id, color, parent)
|
||||
{
|
||||
RefreshCurve(firstCurve, curve1id, SimpleCurvePoint::ForthPoint);
|
||||
RefreshCurve(secondCurve, curve2id, SimpleCurvePoint::FirstPoint);
|
||||
|
@ -80,9 +80,10 @@ void VToolCutSplinePath::setDialog()
|
|||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setFormula(formula);
|
||||
dialogTool->SetFormula(formula);
|
||||
dialogTool->setSplinePathId(curveCutId);
|
||||
dialogTool->setPointName(point->name());
|
||||
dialogTool->SetPointName(point->name());
|
||||
dialogTool->SetColor(lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -100,10 +101,12 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
|
|||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
QString formula = dialogTool->getFormula();
|
||||
QString formula = dialogTool->GetFormula();
|
||||
const quint32 splinePathId = dialogTool->getSplinePathId();
|
||||
const QString color = dialogTool->GetColor();
|
||||
VToolCutSplinePath* point = nullptr;
|
||||
point = Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
point = Create(0, pointName, formula, splinePathId, 5, 10, color, scene, doc, data, Document::FullParse,
|
||||
Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -128,8 +131,8 @@ VToolCutSplinePath* VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphics
|
|||
*/
|
||||
VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, QString &formula,
|
||||
const quint32 &splinePathId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
const QString &color, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(splinePathId);
|
||||
SCASSERT(splPath != nullptr);
|
||||
|
@ -156,8 +159,8 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
|
||||
VSplinePoint splP1 = splPath->at(p1);
|
||||
VSplinePoint splP2 = splPath->at(p2);
|
||||
const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->getKCurve());
|
||||
const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve());
|
||||
const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->GetKCurve());
|
||||
const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->GetKCurve());
|
||||
|
||||
VSplinePath *splPath1 = new VSplinePath();
|
||||
VSplinePath *splPath2 = new VSplinePath();
|
||||
|
@ -191,8 +194,8 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
splPath2->append(splPath->at(i));
|
||||
}
|
||||
}
|
||||
splPath1->setKCurve(splPath->getKCurve());
|
||||
splPath2->setKCurve(splPath->getKCurve());
|
||||
splPath1->SetKCurve(splPath->GetKCurve());
|
||||
splPath2->SetKCurve(splPath->GetKCurve());
|
||||
|
||||
splPath1->setMaxCountPoints(splPath->CountPoint());
|
||||
splPath2->setMaxCountPoints(splPath->CountPoint());
|
||||
|
@ -223,11 +226,11 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id,
|
||||
splPath2id, typeCreation);
|
||||
splPath2id, color, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCutSplinePath::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCutSplinePath::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->AddTool(splPath1id, point);
|
||||
doc->AddTool(splPath2id, point);
|
||||
|
@ -280,7 +283,8 @@ void VToolCutSplinePath::ShowVisualization(bool show)
|
|||
*/
|
||||
void VToolCutSplinePath::FullUpdateFromFile()
|
||||
{
|
||||
FullUpdateCurveFromFile(AttrSplinePath);
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
|
@ -331,8 +335,9 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement)
|
|||
DialogCutSplinePath *dialogTool = qobject_cast<DialogCutSplinePath*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId()));
|
||||
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -358,6 +363,7 @@ void VToolCutSplinePath::RefreshCurve(VSimpleCurve *curve, quint32 curveId, Simp
|
|||
VSpline spl = splPath->GetSpline(splPath->Count());
|
||||
path.translate(-spl.GetP4().toQPointF().x(), -spl.GetP4().toQPointF().y());
|
||||
}
|
||||
curve->SetCurrentColor(QColor(lineColor));
|
||||
curve->setPath(path);
|
||||
}
|
||||
|
||||
|
@ -372,7 +378,16 @@ void VToolCutSplinePath::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
|||
doc->SetAttribute(tag, AttrName, point->name());
|
||||
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
|
||||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
doc->SetAttribute(tag, AttrColor, lineColor);
|
||||
|
||||
doc->SetAttribute(tag, AttrLength, formula);
|
||||
doc->SetAttribute(tag, AttrSplinePath, curveCutId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
formula = doc->GetParametrString(domElement, AttrLength, "");
|
||||
curveCutId = doc->GetParametrUInt(domElement, AttrSplinePath, NULL_ID_STR);
|
||||
lineColor = doc->GetParametrString(domElement, AttrColor, ColorBlack);
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ public:
|
|||
|
||||
VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula,
|
||||
const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
const QString &color, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolCutSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolCutSplinePath *Create(const quint32 _id, const QString &pointName, QString &formula,
|
||||
const quint32 &splinePathId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
static const QString AttrSplinePath;
|
||||
|
@ -64,6 +64,7 @@ protected:
|
|||
virtual void RefreshCurve(VSimpleCurve *curve, quint32 curveId, SimpleCurvePoint curvePosition,
|
||||
PathDirection direction = PathDirection::Hide);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||
};
|
||||
|
|
|
@ -50,9 +50,10 @@ const QString VToolEndLine::ToolType = QStringLiteral("endLine");
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const QString &formulaLength, const QString &formulaAngle, const quint32 &basePointId,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, formulaLength, basePointId, 0, parent), formulaAngle(formulaAngle)
|
||||
const QString &lineColor, const QString &formulaLength, const QString &formulaAngle,
|
||||
const quint32 &basePointId, const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, formulaLength, basePointId, 0, parent),
|
||||
formulaAngle(formulaAngle)
|
||||
{
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
@ -79,11 +80,12 @@ void VToolEndLine::setDialog()
|
|||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setAngle(formulaAngle);
|
||||
dialogTool->setBasePointId(basePointId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
dialogTool->SetFormula(formulaLength);
|
||||
dialogTool->SetAngle(formulaAngle);
|
||||
dialogTool->SetBasePointId(basePointId);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -101,13 +103,14 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
|||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
SCASSERT(dialogTool);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formulaLength = dialogTool->getFormula();
|
||||
QString formulaAngle = dialogTool->getAngle();
|
||||
const quint32 basePointId = dialogTool->getBasePointId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
QString formulaLength = dialogTool->GetFormula();
|
||||
QString formulaAngle = dialogTool->GetAngle();
|
||||
const quint32 basePointId = dialogTool->GetBasePointId();
|
||||
|
||||
VToolEndLine *point = nullptr;
|
||||
point=Create(0, pointName, typeLine, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
|
||||
point=Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
|
@ -122,6 +125,7 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
|||
* @param _id tool id, 0 if tool doesn't exist yet.
|
||||
* @param pointName point name.
|
||||
* @param typeLine line type.
|
||||
* @param lineColor line color.
|
||||
* @param formulaLength string with formula length of line.
|
||||
* @param formulaAngle formula angle of line.
|
||||
* @param basePointId id first point of line.
|
||||
|
@ -135,9 +139,10 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
|
|||
* @return the created tool
|
||||
*/
|
||||
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formulaLength, QString &formulaAngle, const quint32 &basePointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
const QString &lineColor, QString &formulaLength, QString &formulaAngle,
|
||||
const quint32 &basePointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
||||
|
@ -162,12 +167,12 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
|||
VDrawTool::AddRecord(id, Tool::EndLine, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formulaLength, formulaAngle, basePointId,
|
||||
typeCreation);
|
||||
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, lineColor, formulaLength, formulaAngle,
|
||||
basePointId, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolEndLine::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolEndLine::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
return point;
|
||||
|
@ -181,14 +186,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
|
|||
*/
|
||||
void VToolEndLine::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formulaLength = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
||||
formulaAngle = domElement.attribute(AttrAngle, "");
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -196,7 +194,7 @@ void VToolEndLine::FullUpdateFromFile()
|
|||
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setLength(qApp->FormulaToUser(formulaLength));
|
||||
visual->setAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
@ -232,10 +230,11 @@ void VToolEndLine::SaveDialog(QDomElement &domElement)
|
|||
DialogEndLine *dialogTool = qobject_cast<DialogEndLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->getAngle());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -251,13 +250,24 @@ void VToolEndLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrLength, formulaLength);
|
||||
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolEndLine::getFormulaAngle() const
|
||||
void VToolEndLine::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||
formulaAngle = doc->GetParametrString(domElement, AttrAngle, "");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolEndLine::GetFormulaAngle() const
|
||||
{
|
||||
VFormula fAngle(formulaAngle, getData());
|
||||
fAngle.setCheckZero(false);
|
||||
|
@ -267,11 +277,11 @@ VFormula VToolEndLine::getFormulaAngle() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolEndLine::setFormulaAngle(const VFormula &value)
|
||||
void VToolEndLine::SetFormulaAngle(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
formulaAngle = value.getFormula(FormulaType::FromUser);
|
||||
formulaAngle = value.GetFormula(FormulaType::FromUser);
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
|
@ -292,7 +302,7 @@ void VToolEndLine::ShowVisualization(bool show)
|
|||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setLength(qApp->FormulaToUser(formulaLength));
|
||||
visual->setAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
|
|
|
@ -39,22 +39,23 @@ class VToolEndLine : public VToolLinePoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
|
||||
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
|
||||
const QString &formulaLength, const QString &formulaAngle, const quint32 &basePointId,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual ~VToolEndLine();
|
||||
virtual void setDialog();
|
||||
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formulaLength, QString &formulaAngle, const quint32 &basePointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
const QString &lineColor, QString &formulaLength, QString &formulaAngle,
|
||||
const quint32 &basePointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::EndLine)};
|
||||
|
||||
VFormula getFormulaAngle() const;
|
||||
void setFormulaAngle(const VFormula &value);
|
||||
VFormula GetFormulaAngle() const;
|
||||
void SetFormulaAngle(const VFormula &value);
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
|
@ -63,6 +64,7 @@ protected:
|
|||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
QString formulaAngle;
|
||||
};
|
||||
|
|
|
@ -47,9 +47,10 @@ const QString VToolHeight::ToolType = QStringLiteral("height");
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
|
||||
const Source &typeCreation, QGraphicsItem * parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId)
|
||||
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
|
||||
const quint32 &p2LineId, const Source &typeCreation, QGraphicsItem * parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), p1LineId(p1LineId),
|
||||
p2LineId(p2LineId)
|
||||
{
|
||||
ignoreFullUpdate = true;
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -72,11 +73,12 @@ void VToolHeight::setDialog()
|
|||
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setBasePointId(basePointId);
|
||||
dialogTool->setP1LineId(p1LineId);
|
||||
dialogTool->setP2LineId(p2LineId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
dialogTool->SetBasePointId(basePointId);
|
||||
dialogTool->SetP1LineId(p1LineId);
|
||||
dialogTool->SetP2LineId(p2LineId);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -95,13 +97,14 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
|||
SCASSERT(dialogTool != nullptr);
|
||||
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
const quint32 basePointId = dialogTool->getBasePointId();
|
||||
const quint32 p1LineId = dialogTool->getP1LineId();
|
||||
const quint32 p2LineId = dialogTool->getP2LineId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
const quint32 basePointId = dialogTool->GetBasePointId();
|
||||
const quint32 p1LineId = dialogTool->GetP1LineId();
|
||||
const quint32 p2LineId = dialogTool->GetP2LineId();
|
||||
|
||||
VToolHeight *point = nullptr;
|
||||
point = Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
|
||||
point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
|
@ -129,9 +132,9 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
|||
* @return the created tool
|
||||
*/
|
||||
VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
|
||||
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
const QSharedPointer<VPointF> p1Line = data->GeometricObject<VPointF>(p1LineId);
|
||||
|
@ -160,12 +163,12 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
|
|||
VDrawTool::AddRecord(id, Tool::Height, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolHeight *point = new VToolHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId,
|
||||
VToolHeight *point = new VToolHeight(doc, data, id, typeLine, lineColor, basePointId, p1LineId, p2LineId,
|
||||
typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolHeight::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolHeight::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
doc->IncrementReferens(p1LineId);
|
||||
|
@ -193,14 +196,7 @@ QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point)
|
|||
*/
|
||||
void VToolHeight::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
||||
p1LineId = domElement.attribute(AttrP1Line, "").toUInt();
|
||||
p2LineId = domElement.attribute(AttrP2Line, "").toUInt();
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -244,10 +240,11 @@ void VToolHeight::SaveDialog(QDomElement &domElement)
|
|||
DialogHeight *dialogTool = qobject_cast<DialogHeight*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1LineId()));
|
||||
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2LineId()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->GetP1LineId()));
|
||||
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->GetP2LineId()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -263,19 +260,30 @@ void VToolHeight::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||
doc->SetAttribute(tag, AttrP1Line, p1LineId);
|
||||
doc->SetAttribute(tag, AttrP2Line, p2LineId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolHeight::getP2LineId() const
|
||||
void VToolHeight::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||
p1LineId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
|
||||
p2LineId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolHeight::GetP2LineId() const
|
||||
{
|
||||
return p2LineId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolHeight::setP2LineId(const quint32 &value)
|
||||
void VToolHeight::SetP2LineId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -322,13 +330,13 @@ void VToolHeight::ShowVisualization(bool show)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolHeight::getP1LineId() const
|
||||
quint32 VToolHeight::GetP1LineId() const
|
||||
{
|
||||
return p1LineId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolHeight::setP1LineId(const quint32 &value)
|
||||
void VToolHeight::SetP1LineId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
|
|
@ -39,25 +39,25 @@ class VToolHeight: public VToolLinePoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
|
||||
VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const quint32 &basePointId,
|
||||
const quint32 &p1LineId, const quint32 &p2LineId, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
|
||||
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
|
||||
const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolHeight *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolHeight *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
|
||||
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
static QPointF FindPoint(const QLineF &line, const QPointF &point);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::Height)};
|
||||
|
||||
quint32 getP1LineId() const;
|
||||
void setP1LineId(const quint32 &value);
|
||||
quint32 GetP1LineId() const;
|
||||
void SetP1LineId(const quint32 &value);
|
||||
|
||||
quint32 getP2LineId() const;
|
||||
void setP2LineId(const quint32 &value);
|
||||
quint32 GetP2LineId() const;
|
||||
void SetP2LineId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
|
@ -67,6 +67,7 @@ protected:
|
|||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
/** @brief p1LineId id first point of line. */
|
||||
quint32 p1LineId;
|
||||
|
|
|
@ -48,10 +48,12 @@ const QString VToolLine::TagName = QStringLiteral("line");
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||
const QString &typeLine, const Source &typeCreation, QGraphicsItem *parent)
|
||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint)
|
||||
{
|
||||
this->typeLine = typeLine;
|
||||
this->lineColor = lineColor;
|
||||
ignoreFullUpdate = true;
|
||||
//Line
|
||||
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
|
||||
|
@ -82,9 +84,10 @@ void VToolLine::setDialog()
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
dialogTool->setFirstPoint(firstPoint);
|
||||
dialogTool->setSecondPoint(secondPoint);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->SetFirstPoint(firstPoint);
|
||||
dialogTool->SetSecondPoint(secondPoint);
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -100,12 +103,14 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 firstPoint = dialogTool->getFirstPoint();
|
||||
const quint32 secondPoint = dialogTool->getSecondPoint();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
const quint32 firstPoint = dialogTool->GetFirstPoint();
|
||||
const quint32 secondPoint = dialogTool->GetSecondPoint();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
|
||||
VToolLine *line = nullptr;
|
||||
line = Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse,
|
||||
Source::FromGui);
|
||||
if (line != nullptr)
|
||||
{
|
||||
line->dialog=dialogTool;
|
||||
|
@ -127,8 +132,8 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
|
||||
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
const QString &typeLine, const QString &lineColor, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
SCASSERT(scene != nullptr);
|
||||
SCASSERT(doc != nullptr);
|
||||
|
@ -151,7 +156,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
|
|||
VDrawTool::AddRecord(id, Tool::Line, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation);
|
||||
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, lineColor, typeCreation);
|
||||
scene->addItem(line);
|
||||
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
|
||||
|
@ -189,6 +194,7 @@ QString VToolLine::getTagName() const
|
|||
*/
|
||||
void VToolLine::FullUpdateFromFile()
|
||||
{
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -205,12 +211,11 @@ void VToolLine::FullUpdateFromFile()
|
|||
/**
|
||||
* @brief ShowTool highlight tool.
|
||||
* @param id object id in container
|
||||
* @param color highlight color.
|
||||
* @param enable enable or disable highlight.
|
||||
*/
|
||||
void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||
void VToolLine::ShowTool(quint32 id, bool enable)
|
||||
{
|
||||
ShowItem(this, id, color, enable);
|
||||
ShowItem(this, id, enable);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -227,7 +232,9 @@ void VToolLine::SetFactor(qreal factor)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::Disable(bool disable)
|
||||
{
|
||||
DisableItem(this, disable);
|
||||
enabled = !disable;
|
||||
this->setEnabled(enabled);
|
||||
this->setPen(QPen(QColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -237,9 +244,7 @@ void VToolLine::Disable(bool disable)
|
|||
*/
|
||||
void VToolLine::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
this->setEnabled(nameActivDraw == newName);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
Disable(!(nameActivDraw == newName));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -290,7 +295,8 @@ void VToolLine::RefreshDataInFile()
|
|||
void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthMainLine())/factor,
|
||||
LineStyleToPenStyle(typeLine)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -301,7 +307,11 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
if (vis == nullptr)
|
||||
{
|
||||
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor,
|
||||
LineStyleToPenStyle(typeLine)));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -366,9 +376,10 @@ void VToolLine::SaveDialog(QDomElement &domElement)
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPoint()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPoint()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -380,22 +391,32 @@ void VToolLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrFirstPoint, firstPoint);
|
||||
doc->SetAttribute(tag, AttrSecondPoint, secondPoint);
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLine::getSecondPoint() const
|
||||
void VToolLine::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
firstPoint = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||
secondPoint = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLine::GetSecondPoint() const
|
||||
{
|
||||
return secondPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::setSecondPoint(const quint32 &value)
|
||||
void VToolLine::SetSecondPoint(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
secondPoint = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
@ -431,11 +452,12 @@ void VToolLine::ShowVisualization(bool show)
|
|||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
hoverLeaveEvent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::setTypeLine(const QString &value)
|
||||
void VToolLine::SetTypeLine(const QString &value)
|
||||
{
|
||||
typeLine = value;
|
||||
|
||||
|
@ -444,19 +466,28 @@ void VToolLine::setTypeLine(const QString &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLine::getFirstPoint() const
|
||||
void VToolLine::SetLineColor(const QString &value)
|
||||
{
|
||||
lineColor = value;
|
||||
|
||||
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
|
||||
SaveOption(obj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLine::GetFirstPoint() const
|
||||
{
|
||||
return firstPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::setFirstPoint(const quint32 &value)
|
||||
void VToolLine::SetFirstPoint(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
firstPoint = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
@ -467,15 +498,8 @@ void VToolLine::setFirstPoint(const quint32 &value)
|
|||
*/
|
||||
void VToolLine::RefreshGeometry()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
firstPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
|
||||
secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
|
||||
typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine);
|
||||
}
|
||||
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
|
||||
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
|
||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
this->setPen(QPen(CorrectColor(lineColor), pen().widthF(), LineStyleToPenStyle(typeLine)));
|
||||
}
|
||||
|
|
|
@ -40,29 +40,32 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||
const QString &typeLine, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolLine *Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
|
||||
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
const QString &typeLine, const QString &lineColor, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
static const QString TagName;
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::Line)};
|
||||
virtual QString getTagName() const;
|
||||
quint32 getFirstPoint() const;
|
||||
void setFirstPoint(const quint32 &value);
|
||||
quint32 GetFirstPoint() const;
|
||||
void SetFirstPoint(const quint32 &value);
|
||||
|
||||
quint32 getSecondPoint() const;
|
||||
void setSecondPoint(const quint32 &value);
|
||||
quint32 GetSecondPoint() const;
|
||||
void SetSecondPoint(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
virtual void setTypeLine(const QString &value);
|
||||
|
||||
virtual void SetTypeLine(const QString &value);
|
||||
virtual void SetLineColor(const QString &value);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void ShowTool(quint32 id, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
void Disable(bool disable);
|
||||
protected:
|
||||
|
@ -76,6 +79,7 @@ protected:
|
|||
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
/** @brief firstPoint id first line point. */
|
||||
quint32 firstPoint;
|
||||
|
|
|
@ -74,11 +74,11 @@ void VToolLineIntersect::setDialog()
|
|||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setP1Line1(p1Line1);
|
||||
dialogTool->setP2Line1(p2Line1);
|
||||
dialogTool->setP1Line2(p1Line2);
|
||||
dialogTool->setP2Line2(p2Line2);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetP1Line1(p1Line1);
|
||||
dialogTool->SetP2Line1(p2Line1);
|
||||
dialogTool->SetP1Line2(p1Line2);
|
||||
dialogTool->SetP2Line2(p2Line2);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -96,10 +96,10 @@ VToolLineIntersect* VToolLineIntersect::Create(DialogTool *dialog, VMainGraphics
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 p1Line1Id = dialogTool->getP1Line1();
|
||||
const quint32 p2Line1Id = dialogTool->getP2Line1();
|
||||
const quint32 p1Line2Id = dialogTool->getP1Line2();
|
||||
const quint32 p2Line2Id = dialogTool->getP2Line2();
|
||||
const quint32 p1Line1Id = dialogTool->GetP1Line1();
|
||||
const quint32 p2Line1Id = dialogTool->GetP2Line1();
|
||||
const quint32 p1Line2Id = dialogTool->GetP1Line2();
|
||||
const quint32 p2Line2Id = dialogTool->GetP2Line2();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
VToolLineIntersect* point = nullptr;
|
||||
point = Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data,
|
||||
|
@ -175,7 +175,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolLineIntersect::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolLineIntersect::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(p1Line1Id);
|
||||
doc->IncrementReferens(p2Line1Id);
|
||||
|
@ -193,14 +193,7 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
|
|||
*/
|
||||
void VToolLineIntersect::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
p1Line1 = domElement.attribute(AttrP1Line1, "").toUInt();
|
||||
p2Line1 = domElement.attribute(AttrP2Line1, "").toUInt();
|
||||
p1Line2 = domElement.attribute(AttrP1Line2, "").toUInt();
|
||||
p2Line2 = domElement.attribute(AttrP2Line2, "").toUInt();
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -267,10 +260,10 @@ void VToolLineIntersect::SaveDialog(QDomElement &domElement)
|
|||
DialogLineIntersect *dialogTool = qobject_cast<DialogLineIntersect*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1()));
|
||||
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1()));
|
||||
doc->SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogTool->getP1Line2()));
|
||||
doc->SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogTool->getP2Line2()));
|
||||
doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->GetP1Line1()));
|
||||
doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->GetP2Line1()));
|
||||
doc->SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogTool->GetP1Line2()));
|
||||
doc->SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogTool->GetP2Line2()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -292,13 +285,22 @@ void VToolLineIntersect::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersect::getP2Line2() const
|
||||
void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
p1Line1 = doc->GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR);
|
||||
p2Line1 = doc->GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR);
|
||||
p1Line2 = doc->GetParametrUInt(domElement, AttrP1Line2, NULL_ID_STR);
|
||||
p2Line2 = doc->GetParametrUInt(domElement, AttrP2Line2, NULL_ID_STR);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersect::GetP2Line2() const
|
||||
{
|
||||
return p2Line2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::setP2Line2(const quint32 &value)
|
||||
void VToolLineIntersect::SetP2Line2(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -345,13 +347,13 @@ void VToolLineIntersect::ShowVisualization(bool show)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersect::getP1Line2() const
|
||||
quint32 VToolLineIntersect::GetP1Line2() const
|
||||
{
|
||||
return p1Line2;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::setP1Line2(const quint32 &value)
|
||||
void VToolLineIntersect::SetP1Line2(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -363,13 +365,13 @@ void VToolLineIntersect::setP1Line2(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersect::getP2Line1() const
|
||||
quint32 VToolLineIntersect::GetP2Line1() const
|
||||
{
|
||||
return p2Line1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::setP2Line1(const quint32 &value)
|
||||
void VToolLineIntersect::SetP2Line1(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -381,13 +383,13 @@ void VToolLineIntersect::setP2Line1(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersect::getP1Line1() const
|
||||
quint32 VToolLineIntersect::GetP1Line1() const
|
||||
{
|
||||
return p1Line1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::setP1Line1(const quint32 &value)
|
||||
void VToolLineIntersect::SetP1Line1(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
|
|
@ -51,17 +51,17 @@ public:
|
|||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::LineIntersect)};
|
||||
|
||||
quint32 getP1Line1() const;
|
||||
void setP1Line1(const quint32 &value);
|
||||
quint32 GetP1Line1() const;
|
||||
void SetP1Line1(const quint32 &value);
|
||||
|
||||
quint32 getP2Line1() const;
|
||||
void setP2Line1(const quint32 &value);
|
||||
quint32 GetP2Line1() const;
|
||||
void SetP2Line1(const quint32 &value);
|
||||
|
||||
quint32 getP1Line2() const;
|
||||
void setP1Line2(const quint32 &value);
|
||||
quint32 GetP1Line2() const;
|
||||
void SetP1Line2(const quint32 &value);
|
||||
|
||||
quint32 getP2Line2() const;
|
||||
void setP2Line2(const quint32 &value);
|
||||
quint32 GetP2Line2() const;
|
||||
void SetP2Line2(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
|
@ -73,6 +73,7 @@ protected:
|
|||
virtual void RemoveReferens();
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
/** @brief p1Line1 id first point first line. */
|
||||
quint32 p1Line1;
|
||||
|
|
|
@ -38,11 +38,11 @@ const QString VToolLineIntersectAxis::ToolType = QStringLiteral("lineIntersectAx
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolLineIntersectAxis::VToolLineIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
const QString &typeLine, const QString &formulaAngle,
|
||||
const quint32 &basePointId, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
|
||||
const QString &typeLine, const QString &lineColor,
|
||||
const QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
|
||||
firstPointId(firstPointId), secondPointId(secondPointId)
|
||||
{
|
||||
if (typeCreation == Source::FromGui)
|
||||
|
@ -67,12 +67,13 @@ void VToolLineIntersectAxis::setDialog()
|
|||
DialogLineIntersectAxis *dialogTool = qobject_cast<DialogLineIntersectAxis*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setAngle(formulaAngle);
|
||||
dialogTool->setBasePointId(basePointId);
|
||||
dialogTool->setFirstPointId(firstPointId);
|
||||
dialogTool->setSecondPointId(secondPointId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetLineColor(lineColor);
|
||||
dialogTool->SetAngle(formulaAngle);
|
||||
dialogTool->SetBasePointId(basePointId);
|
||||
dialogTool->SetFirstPointId(firstPointId);
|
||||
dialogTool->SetSecondPointId(secondPointId);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -83,15 +84,16 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
|
|||
DialogLineIntersectAxis *dialogTool = qobject_cast<DialogLineIntersectAxis*>(dialog);
|
||||
SCASSERT(dialogTool);
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formulaAngle = dialogTool->getAngle();
|
||||
const quint32 basePointId = dialogTool->getBasePointId();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
QString formulaAngle = dialogTool->GetAngle();
|
||||
const quint32 basePointId = dialogTool->GetBasePointId();
|
||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||
|
||||
VToolLineIntersectAxis *point = nullptr;
|
||||
point=Create(0, pointName, typeLine, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10, scene, doc,
|
||||
data, Document::FullParse, Source::FromGui);
|
||||
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10,
|
||||
scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -101,11 +103,12 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const QString &pointName,
|
||||
const QString &typeLine, QString &formulaAngle,
|
||||
const quint32 &basePointId, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
const QString &typeLine, const QString &lineColor,
|
||||
QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
|
||||
QLineF axis = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
|
||||
|
@ -138,13 +141,13 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
|
|||
VDrawTool::AddRecord(id, Tool::LineIntersectAxis, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolLineIntersectAxis *point = new VToolLineIntersectAxis(doc, data, id, typeLine, formulaAngle,
|
||||
VToolLineIntersectAxis *point = new VToolLineIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle,
|
||||
basePointId, firstPointId, secondPointId,
|
||||
typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolLineIntersectAxis::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolLineIntersectAxis::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
|
@ -170,7 +173,7 @@ QPointF VToolLineIntersectAxis::FindPoint(const QLineF &axis, const QLineF &line
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolLineIntersectAxis::getFormulaAngle() const
|
||||
VFormula VToolLineIntersectAxis::GetFormulaAngle() const
|
||||
{
|
||||
VFormula fAngle(formulaAngle, getData());
|
||||
fAngle.setCheckZero(false);
|
||||
|
@ -180,11 +183,11 @@ VFormula VToolLineIntersectAxis::getFormulaAngle() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersectAxis::setFormulaAngle(const VFormula &value)
|
||||
void VToolLineIntersectAxis::SetFormulaAngle(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
formulaAngle = value.getFormula(FormulaType::FromUser);
|
||||
formulaAngle = value.GetFormula(FormulaType::FromUser);
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
|
@ -192,13 +195,13 @@ void VToolLineIntersectAxis::setFormulaAngle(const VFormula &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersectAxis::getFirstPointId() const
|
||||
quint32 VToolLineIntersectAxis::GetFirstPointId() const
|
||||
{
|
||||
return firstPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersectAxis::setFirstPointId(const quint32 &value)
|
||||
void VToolLineIntersectAxis::SetFirstPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -210,13 +213,13 @@ void VToolLineIntersectAxis::setFirstPointId(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersectAxis::getSecondPointId() const
|
||||
quint32 VToolLineIntersectAxis::GetSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersectAxis::setSecondPointId(const quint32 &value)
|
||||
void VToolLineIntersectAxis::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -242,7 +245,7 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
|
|||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setAxisPointId(basePointId);
|
||||
visual->setAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
|
@ -266,15 +269,7 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersectAxis::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
basePointId = domElement.attribute(AttrBasePoint, "").toUInt();
|
||||
firstPointId = domElement.attribute(AttrP1Line, "").toUInt();
|
||||
secondPointId = domElement.attribute(AttrP2Line, "").toUInt();
|
||||
formulaAngle = domElement.attribute(AttrAngle, "");
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -283,7 +278,7 @@ void VToolLineIntersectAxis::FullUpdateFromFile()
|
|||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setAxisPointId(basePointId);
|
||||
visual->setAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->SetAngle(qApp->FormulaToUser(formulaAngle));
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
@ -308,11 +303,12 @@ void VToolLineIntersectAxis::SaveDialog(QDomElement &domElement)
|
|||
DialogLineIntersectAxis *dialogTool = qobject_cast<DialogLineIntersectAxis*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->getAngle());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getFirstPointId()));
|
||||
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getSecondPointId()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
||||
doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->GetFirstPointId()));
|
||||
doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->GetSecondPointId()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -328,8 +324,20 @@ void VToolLineIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObje
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||
doc->SetAttribute(tag, AttrP1Line, firstPointId);
|
||||
doc->SetAttribute(tag, AttrP2Line, secondPointId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||
firstPointId = doc->GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
|
||||
secondPointId = doc->GetParametrUInt(domElement, AttrP2Line, NULL_ID_STR);
|
||||
formulaAngle = doc->GetParametrString(domElement, AttrAngle, "");
|
||||
}
|
||||
|
|
|
@ -36,15 +36,16 @@ class VToolLineIntersectAxis : public VToolLinePoint
|
|||
Q_OBJECT
|
||||
public:
|
||||
VToolLineIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const QString &formulaAngle, const quint32 &basePointId, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
const QString &lineColor, const QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual ~VToolLineIntersectAxis();
|
||||
virtual void setDialog();
|
||||
|
||||
static VToolLineIntersectAxis *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data);
|
||||
static VToolLineIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
|
||||
QString &formulaAngle, const quint32 &basePointId,
|
||||
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse, const Source &typeCreation);
|
||||
|
@ -55,14 +56,14 @@ public:
|
|||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::LineIntersectAxis)};
|
||||
|
||||
VFormula getFormulaAngle() const;
|
||||
void setFormulaAngle(const VFormula &value);
|
||||
VFormula GetFormulaAngle() const;
|
||||
void SetFormulaAngle(const VFormula &value);
|
||||
|
||||
quint32 getFirstPointId() const;
|
||||
void setFirstPointId(const quint32 &value);
|
||||
quint32 GetFirstPointId() const;
|
||||
void SetFirstPointId(const quint32 &value);
|
||||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
quint32 GetSecondPointId() const;
|
||||
void SetSecondPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
|
@ -72,6 +73,7 @@ protected:
|
|||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolLineIntersectAxis)
|
||||
QString formulaAngle;
|
||||
|
|
|
@ -36,18 +36,20 @@
|
|||
* @param data container with variables.
|
||||
* @param id object id in container.
|
||||
* @param typeLine line type.
|
||||
* @param lineColor line color.
|
||||
* @param formula string with length formula.
|
||||
* @param basePointId id base line point.
|
||||
* @param angle line angle.
|
||||
* @param parent parent object.
|
||||
*/
|
||||
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
const QString &typeLine, const QString &formula, const quint32 &basePointId,
|
||||
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const QString &lineColor, const QString &formula, const quint32 &basePointId,
|
||||
const qreal &angle, QGraphicsItem *parent)
|
||||
:VToolPoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
||||
:VToolPoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
||||
mainLine(nullptr)
|
||||
{
|
||||
this->typeLine = typeLine;
|
||||
this->lineColor = lineColor;
|
||||
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
|
||||
QPointF point1 = data->GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||
QPointF point2 = data->GeometricObject<VPointF>(id)->toQPointF();
|
||||
|
@ -69,9 +71,7 @@ VToolLinePoint::~VToolLinePoint()
|
|||
*/
|
||||
void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
||||
{
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
this->setEnabled(nameActivDraw == newName);
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
Disable(!(nameActivDraw == newName));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -80,7 +80,8 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
|||
*/
|
||||
void VToolLinePoint::RefreshGeometry()
|
||||
{
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
|
||||
mainLine->setPen(QPen(CorrectColor(QColor(lineColor)), qApp->toPixel(qApp->widthHairLine())/factor,
|
||||
LineStyleToPenStyle(typeLine)));
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
QPointF point = VDrawTool::data.GeometricObject<VPointF>(id)->toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GeometricObject<VPointF>(basePointId)->toQPointF();
|
||||
|
@ -108,13 +109,22 @@ void VToolLinePoint::SetFactor(qreal factor)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VToolLinePoint::getAngle() const
|
||||
void VToolLinePoint::Disable(bool disable)
|
||||
{
|
||||
VToolPoint::Disable(disable);
|
||||
mainLine->setPen(QPen(QColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor,
|
||||
LineStyleToPenStyle(typeLine)));
|
||||
mainLine->setEnabled(enabled);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VToolLinePoint::GetAngle() const
|
||||
{
|
||||
return angle;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLinePoint::setAngle(const qreal &value)
|
||||
void VToolLinePoint::SetAngle(const qreal &value)
|
||||
{
|
||||
angle = value;
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
|
@ -122,13 +132,13 @@ void VToolLinePoint::setAngle(const qreal &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLinePoint::getBasePointId() const
|
||||
quint32 VToolLinePoint::GetBasePointId() const
|
||||
{
|
||||
return basePointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLinePoint::setBasePointId(const quint32 &value)
|
||||
void VToolLinePoint::SetBasePointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -140,7 +150,7 @@ void VToolLinePoint::setBasePointId(const quint32 &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula VToolLinePoint::getFormulaLength() const
|
||||
VFormula VToolLinePoint::GetFormulaLength() const
|
||||
{
|
||||
VFormula fLength(formulaLength, this->getData());
|
||||
fLength.setCheckZero(true);
|
||||
|
@ -151,11 +161,11 @@ VFormula VToolLinePoint::getFormulaLength() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLinePoint::setFormulaLength(const VFormula &value)
|
||||
void VToolLinePoint::SetFormulaLength(const VFormula &value)
|
||||
{
|
||||
if (value.error() == false)
|
||||
{
|
||||
formulaLength = value.getFormula(FormulaType::FromUser);
|
||||
formulaLength = value.GetFormula(FormulaType::FromUser);
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
|
|
|
@ -39,23 +39,24 @@ class VToolLinePoint : public VToolPoint
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
|
||||
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor, const QString &formula,
|
||||
const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr);
|
||||
virtual ~VToolLinePoint();
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::LinePoint)};
|
||||
VFormula getFormulaLength() const;
|
||||
void setFormulaLength(const VFormula &value);
|
||||
VFormula GetFormulaLength() const;
|
||||
void SetFormulaLength(const VFormula &value);
|
||||
|
||||
quint32 getBasePointId() const;
|
||||
void setBasePointId(const quint32 &value);
|
||||
quint32 GetBasePointId() const;
|
||||
void SetBasePointId(const quint32 &value);
|
||||
|
||||
qreal getAngle() const;
|
||||
void setAngle(const qreal &value);
|
||||
qreal GetAngle() const;
|
||||
void SetAngle(const qreal &value);
|
||||
|
||||
public slots:
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
virtual void SetFactor(qreal factor);
|
||||
void Disable(bool disable);
|
||||
protected:
|
||||
/** @brief formula string with length formula. */
|
||||
QString formulaLength;
|
||||
|
|
|
@ -49,9 +49,10 @@ const QString VToolNormal::ToolType = QStringLiteral("normal");
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
|
||||
const QString &formula, const qreal &angle, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const Source &typeCreation, QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
|
||||
const QString &lineColor, const QString &formula, const qreal &angle,
|
||||
const quint32 &firstPointId, const quint32 &secondPointId, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, firstPointId, angle, parent),
|
||||
secondPointId(secondPointId)
|
||||
{
|
||||
|
||||
|
@ -75,12 +76,12 @@ void VToolNormal::setDialog()
|
|||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->setTypeLine(typeLine);
|
||||
dialogTool->setFormula(formulaLength);
|
||||
dialogTool->setAngle(angle);
|
||||
dialogTool->setFirstPointId(basePointId);
|
||||
dialogTool->setSecondPointId(secondPointId);
|
||||
dialogTool->setPointName(p->name());
|
||||
dialogTool->SetTypeLine(typeLine);
|
||||
dialogTool->SetFormula(formulaLength);
|
||||
dialogTool->SetAngle(angle);
|
||||
dialogTool->SetFirstPointId(basePointId);
|
||||
dialogTool->SetSecondPointId(secondPointId);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -96,15 +97,16 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
|||
SCASSERT(dialog != nullptr);
|
||||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
QString formula = dialogTool->getFormula();
|
||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
QString formula = dialogTool->GetFormula();
|
||||
const quint32 firstPointId = dialogTool->GetFirstPointId();
|
||||
const quint32 secondPointId = dialogTool->GetSecondPointId();
|
||||
const QString typeLine = dialogTool->GetTypeLine();
|
||||
const QString lineColor = dialogTool->GetLineColor();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
const qreal angle = dialogTool->getAngle();
|
||||
const qreal angle = dialogTool->GetAngle();
|
||||
VToolNormal *point = nullptr;
|
||||
point=Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
|
||||
Document::FullParse, Source::FromGui);
|
||||
point=Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10, scene, doc,
|
||||
data, Document::FullParse, Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
|
@ -131,10 +133,10 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
|||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
|
||||
const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
|
||||
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
|
||||
const QString &pointName, const qreal angle, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
|
||||
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
|
||||
|
@ -161,12 +163,12 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
|
|||
VDrawTool::AddRecord(id, Tool::Normal, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,
|
||||
firstPointId, secondPointId, typeCreation);
|
||||
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, lineColor, formula, angle, firstPointId,
|
||||
secondPointId, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolNormal::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPoint::Disable);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolNormal::Disable);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
@ -200,15 +202,7 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP
|
|||
*/
|
||||
void VToolNormal::FullUpdateFromFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if (domElement.isElement())
|
||||
{
|
||||
typeLine = domElement.attribute(AttrTypeLine, "");
|
||||
formulaLength = domElement.attribute(AttrLength, "");
|
||||
basePointId = domElement.attribute(AttrFirstPoint, "").toUInt();
|
||||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
||||
}
|
||||
ReadAttributes();
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
|
@ -217,7 +211,7 @@ void VToolNormal::FullUpdateFromFile()
|
|||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setLength(qApp->FormulaToUser(formulaLength));
|
||||
visual->setAngle(angle);
|
||||
visual->SetAngle(angle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
|
@ -274,11 +268,12 @@ void VToolNormal::SaveDialog(QDomElement &domElement)
|
|||
DialogNormal *dialogTool = qobject_cast<DialogNormal*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula());
|
||||
doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle()));
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId()));
|
||||
doc->SetAttribute(domElement, AttrTypeLine, dialogTool->GetTypeLine());
|
||||
doc->SetAttribute(domElement, AttrLineColor, dialogTool->GetLineColor());
|
||||
doc->SetAttribute(domElement, AttrLength, dialogTool->GetFormula());
|
||||
doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->GetAngle()));
|
||||
doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->GetFirstPointId()));
|
||||
doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->GetSecondPointId()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -294,6 +289,7 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrTypeLine, typeLine);
|
||||
doc->SetAttribute(tag, AttrLineColor, lineColor);
|
||||
doc->SetAttribute(tag, AttrLength, formulaLength);
|
||||
doc->SetAttribute(tag, AttrAngle, angle);
|
||||
doc->SetAttribute(tag, AttrFirstPoint, basePointId);
|
||||
|
@ -301,13 +297,24 @@ void VToolNormal::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolNormal::getSecondPointId() const
|
||||
void VToolNormal::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
typeLine = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||
formulaLength = doc->GetParametrString(domElement, AttrLength, "");
|
||||
basePointId = doc->GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
|
||||
secondPointId = doc->GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
|
||||
angle = doc->GetParametrDouble(domElement, AttrAngle, "0");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolNormal::GetSecondPointId() const
|
||||
{
|
||||
return secondPointId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolNormal::setSecondPointId(const quint32 &value)
|
||||
void VToolNormal::SetSecondPointId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
|
@ -333,7 +340,7 @@ void VToolNormal::ShowVisualization(bool show)
|
|||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setLength(qApp->FormulaToUser(formulaLength));
|
||||
visual->setAngle(angle);
|
||||
visual->SetAngle(angle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyleToPenStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user