Supplement for seams.
--HG-- branch : develop
This commit is contained in:
parent
aac3dca764
commit
473c90c72c
|
@ -177,11 +177,18 @@ void VContainer::UpdateId(qint64 newId){
|
||||||
QPainterPath VContainer::ContourPath(qint64 idDetail) const{
|
QPainterPath VContainer::ContourPath(qint64 idDetail) const{
|
||||||
VDetail detail = GetDetail(idDetail);
|
VDetail detail = GetDetail(idDetail);
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
|
QVector<QPointF> pointsEkv;
|
||||||
for(qint32 i = 0; i< detail.CountNode(); ++i){
|
for(qint32 i = 0; i< detail.CountNode(); ++i){
|
||||||
switch(detail[i].getTypeTool()){
|
switch(detail[i].getTypeTool()){
|
||||||
case(Tool::NodePoint):{
|
case(Tool::NodePoint):{
|
||||||
VPointF point = GetModelingPoint(detail[i].getId());
|
VPointF point = GetModelingPoint(detail[i].getId());
|
||||||
points.append(point.toQPointF());
|
points.append(point.toQPointF());
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
QPointF pEkv = point.toQPointF();
|
||||||
|
pEkv.setX(pEkv.x()+detail[i].getMx());
|
||||||
|
pEkv.setY(pEkv.y()+detail[i].getMy());
|
||||||
|
pointsEkv.append(pEkv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case(Tool::NodeArc):{
|
case(Tool::NodeArc):{
|
||||||
|
@ -190,8 +197,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(arc.GetPoints()));
|
||||||
if(len1 <= lenReverse){
|
if(len1 <= lenReverse){
|
||||||
points << arc.GetPoints();
|
points << arc.GetPoints();
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
pointsEkv << biasPoints(arc.GetPoints(), detail[i].getMx(), detail[i].getMy());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
points << GetReversePoint(arc.GetPoints());
|
points << GetReversePoint(arc.GetPoints());
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
pointsEkv << biasPoints(GetReversePoint(arc.GetPoints()), detail[i].getMx(),
|
||||||
|
detail[i].getMy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -201,8 +215,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(spline.GetPoints()));
|
||||||
if(len1 <= lenReverse){
|
if(len1 <= lenReverse){
|
||||||
points << spline.GetPoints();
|
points << spline.GetPoints();
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
pointsEkv << biasPoints(spline.GetPoints(), detail[i].getMx(), detail[i].getMy());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
points << GetReversePoint(spline.GetPoints());
|
points << GetReversePoint(spline.GetPoints());
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
pointsEkv << biasPoints(GetReversePoint(spline.GetPoints()), detail[i].getMx(),
|
||||||
|
detail[i].getMy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -212,8 +233,15 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
|
||||||
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
|
qreal lenReverse = GetLengthContour(points, GetReversePoint(splinePath.GetPathPoints()));
|
||||||
if(len1 <= lenReverse){
|
if(len1 <= lenReverse){
|
||||||
points << splinePath.GetPathPoints();
|
points << splinePath.GetPathPoints();
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
pointsEkv << biasPoints(splinePath.GetPathPoints(), detail[i].getMx(), detail[i].getMy());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
points << GetReversePoint(splinePath.GetPathPoints());
|
points << GetReversePoint(splinePath.GetPathPoints());
|
||||||
|
if(detail.getSupplement() == true){
|
||||||
|
pointsEkv << biasPoints(GetReversePoint(splinePath.GetPathPoints()), detail[i].getMx(),
|
||||||
|
detail[i].getMy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -224,18 +252,38 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QPainterPath ekv = Equidistant(points, Detail::CloseEquidistant, toPixel(10));
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.moveTo(points[0]);
|
path.moveTo(points[0]);
|
||||||
for (qint32 i = 1; i < points.count(); ++i){
|
for (qint32 i = 1; i < points.count(); ++i){
|
||||||
path.lineTo(points[i]);
|
path.lineTo(points[i]);
|
||||||
}
|
}
|
||||||
path.lineTo(points[0]);
|
path.lineTo(points[0]);
|
||||||
path.addPath(ekv);
|
|
||||||
path.setFillRule(Qt::WindingFill);
|
if(detail.getSupplement() == true){
|
||||||
|
QPainterPath ekv;
|
||||||
|
if(detail.getClosed() == true){
|
||||||
|
ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth()));
|
||||||
|
} else {
|
||||||
|
ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth()));
|
||||||
|
}
|
||||||
|
path.addPath(ekv);
|
||||||
|
path.setFillRule(Qt::WindingFill);
|
||||||
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<QPointF> VContainer::biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const{
|
||||||
|
QVector<QPointF> p;
|
||||||
|
for(qint32 i = 0; i < points.size(); ++i){
|
||||||
|
QPointF point = points.at(i);
|
||||||
|
point.setX(point.x() + mx);
|
||||||
|
point.setY(point.x() + my);
|
||||||
|
p.append(point);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
QPainterPath VContainer::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
|
QPainterPath VContainer::Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
|
||||||
const qreal &width) const{
|
const qreal &width) const{
|
||||||
QPainterPath ekv;
|
QPainterPath ekv;
|
||||||
|
|
|
@ -140,6 +140,7 @@ public:
|
||||||
const QHash<qint64, VDetail> *DataDetails() const;
|
const QHash<qint64, VDetail> *DataDetails() const;
|
||||||
static void UpdateId(qint64 newId);
|
static void UpdateId(qint64 newId);
|
||||||
QPainterPath ContourPath(qint64 idDetail) const;
|
QPainterPath ContourPath(qint64 idDetail) const;
|
||||||
|
QVector<QPointF> biasPoints(const QVector<QPointF> &points, const qreal &mx, const qreal &my) const;
|
||||||
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
|
QPainterPath Equidistant(QVector<QPointF> points, const Detail::Equidistant &eqv,
|
||||||
const qreal &width)const;
|
const qreal &width)const;
|
||||||
static QLineF ParallelLine(const QLineF &line, qreal width );
|
static QLineF ParallelLine(const QLineF &line, qreal width );
|
||||||
|
|
|
@ -23,13 +23,24 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) :
|
DialogDetail::DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent) :
|
||||||
DialogTool(data, mode, parent), ui(), details(VDetail()){
|
DialogTool(data, mode, parent), ui(), details(VDetail()), supplement(true), closed(true){
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
labelEditNamePoint = ui.labelEditNameDetail;
|
||||||
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted);
|
||||||
|
flagName = false;
|
||||||
|
CheckState();
|
||||||
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected);
|
connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected);
|
||||||
|
|
||||||
|
connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged);
|
||||||
|
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogDetail::BiasXChanged);
|
||||||
|
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogDetail::BiasYChanged);
|
||||||
|
connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams);
|
||||||
|
connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed);
|
||||||
|
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
|
void DialogDetail::ChoosedObject(qint64 id, Scene::Scenes type){
|
||||||
|
@ -72,12 +83,16 @@ void DialogDetail::DialogAccepted(){
|
||||||
QListWidgetItem *item = ui.listWidget->item(i);
|
QListWidgetItem *item = ui.listWidget->item(i);
|
||||||
details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
|
details.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
|
||||||
}
|
}
|
||||||
|
details.setWidth(ui.doubleSpinBoxSeams->value());
|
||||||
details.setName(ui.lineEditNameDetail->text());
|
details.setName(ui.lineEditNameDetail->text());
|
||||||
|
details.setSupplement(supplement);
|
||||||
|
details.setClosed(closed);
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
emit DialogClosed(QDialog::Accepted);
|
emit DialogClosed(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode){
|
void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx,
|
||||||
|
qreal my){
|
||||||
QString name;
|
QString name;
|
||||||
switch(typeTool){
|
switch(typeTool){
|
||||||
case(Tool::NodePoint):{
|
case(Tool::NodePoint):{
|
||||||
|
@ -127,9 +142,19 @@ void DialogDetail::NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, No
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
QListWidgetItem *item = new QListWidgetItem(name);
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
VNodeDetail node(id, typeTool, mode, typeNode);
|
VNodeDetail node(id, typeTool, mode, typeNode, mx, my);
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
ui.listWidget->addItem(item);
|
ui.listWidget->addItem(item);
|
||||||
|
disconnect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogDetail::BiasXChanged);
|
||||||
|
disconnect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogDetail::BiasYChanged);
|
||||||
|
ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx()));
|
||||||
|
ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy()));
|
||||||
|
connect(ui.doubleSpinBoxBiasX, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogDetail::BiasXChanged);
|
||||||
|
connect(ui.doubleSpinBoxBiasY, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogDetail::BiasYChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
VDetail DialogDetail::getDetails() const{
|
VDetail DialogDetail::getDetails() const{
|
||||||
|
@ -140,9 +165,49 @@ void DialogDetail::setDetails(const VDetail &value){
|
||||||
details = value;
|
details = value;
|
||||||
ui.listWidget->clear();
|
ui.listWidget->clear();
|
||||||
for(qint32 i = 0; i < details.CountNode(); ++i){
|
for(qint32 i = 0; i < details.CountNode(); ++i){
|
||||||
NewItem(details[i].getId(), details[i].getTypeTool(),details[i].getMode(), details[i].getTypeNode());
|
NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), details[i].getMx(),
|
||||||
|
details[i].getMy());
|
||||||
}
|
}
|
||||||
details.setName(ui.lineEditNameDetail->text());
|
ui.lineEditNameDetail->setText(details.getName());
|
||||||
|
ui.checkBoxSeams->setChecked(details.getSupplement());
|
||||||
|
ui.checkBoxClosed->setChecked(details.getClosed());
|
||||||
|
ui.doubleSpinBoxSeams->setValue(details.getWidth());
|
||||||
|
ui.listWidget->setCurrentRow(0);
|
||||||
ui.listWidget->setFocus(Qt::OtherFocusReason);
|
ui.listWidget->setFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogDetail::BiasXChanged(qreal d){
|
||||||
|
qint32 row = ui.listWidget->currentRow();
|
||||||
|
QListWidgetItem *item = ui.listWidget->item( row );
|
||||||
|
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||||
|
node.setMx(toPixel(d));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogDetail::BiasYChanged(qreal d){
|
||||||
|
qint32 row = ui.listWidget->currentRow();
|
||||||
|
QListWidgetItem *item = ui.listWidget->item( row );
|
||||||
|
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||||
|
node.setMy(toPixel(d));
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogDetail::ClickedSeams(bool checked){
|
||||||
|
supplement = checked;
|
||||||
|
ui.checkBoxClosed->setEnabled(checked);
|
||||||
|
ui.doubleSpinBoxSeams->setEnabled(checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogDetail::ClickedClosed(bool checked){
|
||||||
|
closed = checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogDetail::ObjectChanged(int row){
|
||||||
|
if(ui.listWidget->count() == 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QListWidgetItem *item = ui.listWidget->item( row );
|
||||||
|
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
|
||||||
|
ui.doubleSpinBoxBiasX->setValue(toMM(node.getMx()));
|
||||||
|
ui.doubleSpinBoxBiasY->setValue(toMM(node.getMy()));
|
||||||
|
}
|
||||||
|
|
|
@ -29,17 +29,24 @@
|
||||||
class DialogDetail : public DialogTool{
|
class DialogDetail : public DialogTool{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
|
DialogDetail(const VContainer *data, Draw::Draws mode, QWidget *parent = 0);
|
||||||
VDetail getDetails() const;
|
VDetail getDetails() const;
|
||||||
void setDetails(const VDetail &value);
|
void setDetails(const VDetail &value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
|
virtual void ChoosedObject(qint64 id, Scene::Scenes type);
|
||||||
virtual void DialogAccepted();
|
virtual void DialogAccepted();
|
||||||
|
void BiasXChanged(qreal d);
|
||||||
|
void BiasYChanged(qreal d);
|
||||||
|
void ClickedSeams(bool checked);
|
||||||
|
void ClickedClosed(bool checked);
|
||||||
|
void ObjectChanged(int row);
|
||||||
private:
|
private:
|
||||||
Ui::DialogDetail ui;
|
Ui::DialogDetail ui;
|
||||||
VDetail details;
|
VDetail details;
|
||||||
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode);
|
bool supplement;
|
||||||
|
bool closed;
|
||||||
|
void NewItem(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode, qreal mx = 0,
|
||||||
|
qreal my = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGDETAIL_H
|
#endif // DIALOGDETAIL_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>340</width>
|
<width>544</width>
|
||||||
<height>298</height>
|
<height>327</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -20,47 +20,196 @@
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
<locale language="English" country="UnitedStates"/>
|
<locale language="English" country="UnitedStates"/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelEditNameDetail">
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bias X</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasX">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-10000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="locale">
|
|
||||||
<locale language="English" country="UnitedStates"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name detail</string>
|
<string>Bias Y</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEditNameDetail"/>
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxBiasY">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-10000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<item>
|
<property name="title">
|
||||||
<widget class="QCheckBox" name="checkBoxClosed">
|
<string>Option</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Closed</string>
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
</property>
|
<item>
|
||||||
<property name="checked">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<bool>true</bool>
|
<item>
|
||||||
</property>
|
<widget class="QLabel" name="labelEditNameDetail">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
</item>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
</layout>
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="locale">
|
||||||
|
<locale language="English" country="UnitedStates"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name of detail</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditNameDetail">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSeams">
|
||||||
|
<property name="text">
|
||||||
|
<string>Supplement for seams</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="locale">
|
||||||
|
<locale language="English" country="UnitedStates"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Width</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSeams">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-10000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxClosed">
|
||||||
|
<property name="text">
|
||||||
|
<string>Closed</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -83,7 +232,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>lineEditNameDetail</tabstop>
|
<tabstop>lineEditNameDetail</tabstop>
|
||||||
<tabstop>checkBoxClosed</tabstop>
|
|
||||||
<tabstop>listWidget</tabstop>
|
<tabstop>listWidget</tabstop>
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
|
|
@ -21,14 +21,30 @@
|
||||||
|
|
||||||
#include "vdetail.h"
|
#include "vdetail.h"
|
||||||
|
|
||||||
VDetail::VDetail():nodes(QVector<VNodeDetail>()),name(QString()), mx(0), my(0){
|
VDetail::VDetail():nodes(QVector<VNodeDetail>()),name(QString()), mx(0), my(0), supplement(true), closed(true),
|
||||||
|
width(10){
|
||||||
}
|
}
|
||||||
|
|
||||||
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes):nodes(QVector<VNodeDetail>()),
|
VDetail::VDetail(const QString &name, const QVector<VNodeDetail> &nodes):nodes(QVector<VNodeDetail>()),
|
||||||
name(name), mx(0), my(0){
|
name(name), mx(0), my(0), supplement(true), closed(true), width(10){
|
||||||
this->nodes = nodes;
|
this->nodes = nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VDetail::VDetail(const VDetail &detail):nodes(detail.getNodes()), name(detail.getName()), mx(detail.getMx()),
|
||||||
|
my(detail.getMy()), supplement(detail.getSupplement()), closed(detail.getClosed()), width(detail.getWidth()){
|
||||||
|
}
|
||||||
|
|
||||||
|
VDetail &VDetail::operator =(const VDetail &detail){
|
||||||
|
nodes = detail.getNodes();
|
||||||
|
name = detail.getName();
|
||||||
|
mx = detail.getMx();
|
||||||
|
my = detail.getMy();
|
||||||
|
supplement = detail.getSupplement();
|
||||||
|
closed = detail.getClosed();
|
||||||
|
width = detail.getWidth();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void VDetail::append(const VNodeDetail &node){
|
void VDetail::append(const VNodeDetail &node){
|
||||||
nodes.append(node);
|
nodes.append(node);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +54,9 @@ void VDetail::Clear(){
|
||||||
name.clear();
|
name.clear();
|
||||||
mx = 0;
|
mx = 0;
|
||||||
my = 0;
|
my = 0;
|
||||||
|
supplement = true;
|
||||||
|
closed = true;
|
||||||
|
width = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 VDetail::CountNode() const{
|
qint32 VDetail::CountNode() const{
|
||||||
|
@ -81,3 +100,35 @@ QString VDetail::getName() const{
|
||||||
void VDetail::setName(const QString &value){
|
void VDetail::setName(const QString &value){
|
||||||
name = value;
|
name = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal VDetail::getWidth() const{
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VDetail::setWidth(const qreal &value){
|
||||||
|
width = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VDetail::getClosed() const{
|
||||||
|
return closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VDetail::setClosed(bool value){
|
||||||
|
closed = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VDetail::getSupplement() const{
|
||||||
|
return supplement;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VDetail::setSupplement(bool value){
|
||||||
|
supplement = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<VNodeDetail> VDetail::getNodes() const{
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VDetail::setNodes(const QVector<VNodeDetail> &value){
|
||||||
|
nodes = value;
|
||||||
|
}
|
||||||
|
|
|
@ -39,24 +39,37 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants)
|
||||||
|
|
||||||
class VDetail{
|
class VDetail{
|
||||||
public:
|
public:
|
||||||
VDetail();
|
VDetail();
|
||||||
VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
|
VDetail(const QString &name, const QVector<VNodeDetail> &nodes);
|
||||||
void append(const VNodeDetail &node);
|
VDetail(const VDetail &detail);
|
||||||
void Clear();
|
VDetail &operator=(const VDetail &detail);
|
||||||
qint32 CountNode() const;
|
void append(const VNodeDetail &node);
|
||||||
bool Containes(const qint64 &id)const;
|
void Clear();
|
||||||
|
qint32 CountNode() const;
|
||||||
|
bool Containes(const qint64 &id)const;
|
||||||
VNodeDetail & operator[](int indx);
|
VNodeDetail & operator[](int indx);
|
||||||
QString getName() const;
|
QString getName() const;
|
||||||
void setName(const QString &value);
|
void setName(const QString &value);
|
||||||
qreal getMx() const;
|
qreal getMx() const;
|
||||||
void setMx(const qreal &value);
|
void setMx(const qreal &value);
|
||||||
qreal getMy() const;
|
qreal getMy() const;
|
||||||
void setMy(const qreal &value);
|
void setMy(const qreal &value);
|
||||||
|
bool getSupplement() const;
|
||||||
|
void setSupplement(bool value);
|
||||||
|
bool getClosed() const;
|
||||||
|
void setClosed(bool value);
|
||||||
|
qreal getWidth() const;
|
||||||
|
void setWidth(const qreal &value);
|
||||||
|
QVector<VNodeDetail> getNodes() const;
|
||||||
|
void setNodes(const QVector<VNodeDetail> &value);
|
||||||
private:
|
private:
|
||||||
QVector<VNodeDetail> nodes;
|
QVector<VNodeDetail> nodes;
|
||||||
QString name;
|
QString name;
|
||||||
qreal mx;
|
qreal mx;
|
||||||
qreal my;
|
qreal my;
|
||||||
|
bool supplement;
|
||||||
|
bool closed;
|
||||||
|
qreal width;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VDETAIL_H
|
#endif // VDETAIL_H
|
||||||
|
|
|
@ -21,16 +21,27 @@
|
||||||
|
|
||||||
#include "vnodedetail.h"
|
#include "vnodedetail.h"
|
||||||
|
|
||||||
VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Calculation),
|
VNodeDetail::VNodeDetail():id(0), typeTool(Tool::NodePoint), mode(Draw::Modeling),
|
||||||
typeNode(NodeDetail::Contour){
|
typeNode(NodeDetail::Contour), mx(0), my(0){
|
||||||
}
|
}
|
||||||
|
|
||||||
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode):id(id),
|
VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
|
||||||
typeTool(typeTool), mode(mode), typeNode(typeNode){
|
qreal mx, qreal my):id(id), typeTool(typeTool), mode(mode), typeNode(typeNode),
|
||||||
|
mx(mx), my(my){
|
||||||
}
|
}
|
||||||
|
|
||||||
VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(node.getTypeTool()),
|
VNodeDetail::VNodeDetail(const VNodeDetail &node):id(node.getId()), typeTool(node.getTypeTool()),
|
||||||
mode(node.getMode()), typeNode(node.getTypeNode()){
|
mode(node.getMode()), typeNode(node.getTypeNode()), mx(node.getMx()), my(node.getMy()){
|
||||||
|
}
|
||||||
|
|
||||||
|
VNodeDetail &VNodeDetail::operator =(const VNodeDetail &node){
|
||||||
|
id = node.getId();
|
||||||
|
typeTool = node.getTypeTool();
|
||||||
|
mode = node.getMode();
|
||||||
|
typeNode = node.getTypeNode();
|
||||||
|
mx = node.getMx();
|
||||||
|
my = node.getMy();
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tool::Tools VNodeDetail::getTypeTool() const{
|
Tool::Tools VNodeDetail::getTypeTool() const{
|
||||||
|
@ -64,3 +75,19 @@ NodeDetail::NodeDetails VNodeDetail::getTypeNode() const{
|
||||||
void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){
|
void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value){
|
||||||
typeNode = value;
|
typeNode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal VNodeDetail::getMy() const{
|
||||||
|
return my;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VNodeDetail::setMy(const qreal &value){
|
||||||
|
my = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal VNodeDetail::getMx() const{
|
||||||
|
return mx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VNodeDetail::setMx(const qreal &value){
|
||||||
|
mx = value;
|
||||||
|
}
|
||||||
|
|
|
@ -31,26 +31,32 @@ namespace NodeDetail {
|
||||||
}
|
}
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails)
|
||||||
|
|
||||||
class VNodeDetail
|
class VNodeDetail{
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VNodeDetail();
|
VNodeDetail();
|
||||||
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode);
|
VNodeDetail(qint64 id, Tool::Tools typeTool, Draw::Draws mode, NodeDetail::NodeDetails typeNode,
|
||||||
VNodeDetail(const VNodeDetail &node);
|
qreal mx = 0, qreal my = 0);
|
||||||
qint64 getId() const;
|
VNodeDetail(const VNodeDetail &node);
|
||||||
void setId(const qint64 &value);
|
VNodeDetail &operator=(const VNodeDetail &node);
|
||||||
|
qint64 getId() const;
|
||||||
|
void setId(const qint64 &value);
|
||||||
Tool::Tools getTypeTool() const;
|
Tool::Tools getTypeTool() const;
|
||||||
void setTypeTool(const Tool::Tools &value);
|
void setTypeTool(const Tool::Tools &value);
|
||||||
Draw::Draws getMode() const;
|
Draw::Draws getMode() const;
|
||||||
void setMode(const Draw::Draws &value);
|
void setMode(const Draw::Draws &value);
|
||||||
NodeDetail::NodeDetails getTypeNode() const;
|
NodeDetail::NodeDetails getTypeNode() const;
|
||||||
void setTypeNode(const NodeDetail::NodeDetails &value);
|
void setTypeNode(const NodeDetail::NodeDetails &value);
|
||||||
|
qreal getMx() const;
|
||||||
|
void setMx(const qreal &value);
|
||||||
|
qreal getMy() const;
|
||||||
|
void setMy(const qreal &value);
|
||||||
private:
|
private:
|
||||||
qint64 id;
|
qint64 id;
|
||||||
Tool::Tools typeTool;
|
Tool::Tools typeTool;
|
||||||
Draw::Draws mode;
|
Draw::Draws mode;
|
||||||
NodeDetail::NodeDetails typeNode;
|
NodeDetail::NodeDetails typeNode;
|
||||||
|
qreal mx;
|
||||||
|
qreal my;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(VNodeDetail)
|
Q_DECLARE_METATYPE(VNodeDetail)
|
||||||
|
|
|
@ -192,10 +192,8 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
|
|
||||||
void VToolDetail::setDialog(){
|
void VToolDetail::setDialog(){
|
||||||
Q_ASSERT(!dialogDetail.isNull());
|
Q_ASSERT(!dialogDetail.isNull());
|
||||||
if(!dialogDetail.isNull()){
|
VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
VDetail detail = VAbstractTool::data.GetDetail(id);
|
dialogDetail->setDetails(detail);
|
||||||
dialogDetail->setDetails(detail);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScene *scene,
|
void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScene *scene,
|
||||||
|
@ -257,7 +255,7 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
VNodeDetail node(id, detail[i].getTypeTool(), detail[i].getMode(), NodeDetail::Contour);
|
VNodeDetail node(id, detail[i].getTypeTool(), Draw::Modeling, NodeDetail::Contour);
|
||||||
det.append(node);
|
det.append(node);
|
||||||
}
|
}
|
||||||
det.setName(detail.getName());
|
det.setName(detail.getName());
|
||||||
|
@ -290,7 +288,26 @@ void VToolDetail::FullUpdateFromFile(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolDetail::FullUpdateFromGui(int result){
|
void VToolDetail::FullUpdateFromGui(int result){
|
||||||
Q_UNUSED(result);
|
if(result == QDialog::Accepted){
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if(domElement.isElement()){
|
||||||
|
VDetail det = dialogDetail->getDetails();
|
||||||
|
domElement.setAttribute("name", det.getName());
|
||||||
|
domElement.setAttribute("supplement", QString().setNum(det.getSupplement()));
|
||||||
|
domElement.setAttribute("closed", QString().setNum(det.getClosed()));
|
||||||
|
domElement.setAttribute("width", QString().setNum(det.getWidth()));
|
||||||
|
if ( domElement.hasChildNodes() ){
|
||||||
|
while ( domElement.childNodes().length() >= 1 ){
|
||||||
|
domElement.removeChild( domElement.firstChild() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(qint32 i = 0; i < det.CountNode(); ++i){
|
||||||
|
AddNode(domElement, det[i]);
|
||||||
|
}
|
||||||
|
emit FullUpdateTree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogDetail.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolDetail::AddToFile(){
|
void VToolDetail::AddToFile(){
|
||||||
|
@ -299,8 +316,11 @@ void VToolDetail::AddToFile(){
|
||||||
|
|
||||||
AddAttribute(domElement, "id", id);
|
AddAttribute(domElement, "id", id);
|
||||||
AddAttribute(domElement, "name", detail.getName());
|
AddAttribute(domElement, "name", detail.getName());
|
||||||
AddAttribute(domElement, "mx", detail.getMx());
|
AddAttribute(domElement, "mx", toMM(detail.getMx()));
|
||||||
AddAttribute(domElement, "my", detail.getMy());
|
AddAttribute(domElement, "my", toMM(detail.getMy()));
|
||||||
|
AddAttribute(domElement, "supplement", detail.getSupplement());
|
||||||
|
AddAttribute(domElement, "closed", detail.getClosed());
|
||||||
|
AddAttribute(domElement, "width", detail.getWidth());
|
||||||
|
|
||||||
for(qint32 i = 0; i < detail.CountNode(); ++i){
|
for(qint32 i = 0; i < detail.CountNode(); ++i){
|
||||||
AddNode(domElement, detail[i]);
|
AddNode(domElement, detail[i]);
|
||||||
|
@ -338,7 +358,7 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
|
||||||
|
|
||||||
void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
//QAction *actionOption = menu.addAction(tr("Options"));
|
QAction *actionOption = menu.addAction(tr("Options"));
|
||||||
QAction *actionRemove = menu.addAction(tr("Delete"));
|
QAction *actionRemove = menu.addAction(tr("Delete"));
|
||||||
if(_referens > 1){
|
if(_referens > 1){
|
||||||
actionRemove->setEnabled(false);
|
actionRemove->setEnabled(false);
|
||||||
|
@ -346,21 +366,15 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
actionRemove->setEnabled(true);
|
actionRemove->setEnabled(true);
|
||||||
}
|
}
|
||||||
QAction *selectedAction = menu.exec(event->screenPos());
|
QAction *selectedAction = menu.exec(event->screenPos());
|
||||||
// if(selectedAction == actionOption){
|
if(selectedAction == actionOption){
|
||||||
// dialog = QSharedPointer<Dialog>(new Dialog(getData()));
|
dialogDetail = QSharedPointer<DialogDetail>(new DialogDetail(getData(), Draw::Modeling));
|
||||||
|
connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject,
|
||||||
// connect(qobject_cast< VMainGraphicsScene * >(tool->scene()), &VMainGraphicsScene::ChoosedObject,
|
dialogDetail.data(), &DialogDetail::ChoosedObject);
|
||||||
// dialog.data(), &Dialog::ChoosedObject);
|
connect(dialogDetail.data(), &DialogDetail::DialogClosed, this, &VToolDetail::FullUpdateFromGui);
|
||||||
// connect(dialog.data(), &Dialog::DialogClosed, tool,
|
setDialog();
|
||||||
// &Tool::FullUpdateFromGui);
|
dialogDetail->show();
|
||||||
// connect(doc, &VDomDocument::FullUpdateFromFile, dialog.data(), &Dialog::UpdateList);
|
}
|
||||||
|
|
||||||
// tool->setDialog();
|
|
||||||
|
|
||||||
// dialog->show();
|
|
||||||
// }
|
|
||||||
if(selectedAction == actionRemove){
|
if(selectedAction == actionRemove){
|
||||||
|
|
||||||
//remove form xml file
|
//remove form xml file
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if(domElement.isElement()){
|
if(domElement.isElement()){
|
||||||
|
@ -393,6 +407,8 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){
|
||||||
QDomElement nod = doc->createElement("node");
|
QDomElement nod = doc->createElement("node");
|
||||||
|
|
||||||
AddAttribute(nod, "idObject", node.getId());
|
AddAttribute(nod, "idObject", node.getId());
|
||||||
|
AddAttribute(nod, "mx", toMM(node.getMx()));
|
||||||
|
AddAttribute(nod, "my", toMM(node.getMy()));
|
||||||
if(node.getTypeNode() == NodeDetail::Contour){
|
if(node.getTypeNode() == NodeDetail::Contour){
|
||||||
AddAttribute(nod, "nodeType", "Contour");
|
AddAttribute(nod, "nodeType", "Contour");
|
||||||
} else {
|
} else {
|
||||||
|
@ -444,6 +460,15 @@ void VToolDetail::AddNode(QDomElement &domElement, VNodeDetail &node){
|
||||||
case(Tool::SplineTool):
|
case(Tool::SplineTool):
|
||||||
AddAttribute(nod, "type", "SplineTool");
|
AddAttribute(nod, "type", "SplineTool");
|
||||||
break;
|
break;
|
||||||
|
case(Tool::Height):
|
||||||
|
AddAttribute(nod, "type", "Height");
|
||||||
|
break;
|
||||||
|
case(Tool::Triangle):
|
||||||
|
AddAttribute(nod, "type", "Triangle");
|
||||||
|
break;
|
||||||
|
case(Tool::PointOfIntersection):
|
||||||
|
AddAttribute(nod, "type", "PointOfIntersection");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qWarning()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -473,6 +473,9 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
||||||
detail.setName(GetParametrString(domElement, "name"));
|
detail.setName(GetParametrString(domElement, "name"));
|
||||||
detail.setMx(toPixel(GetParametrDouble(domElement, "mx")));
|
detail.setMx(toPixel(GetParametrDouble(domElement, "mx")));
|
||||||
detail.setMy(toPixel(GetParametrDouble(domElement, "my")));
|
detail.setMy(toPixel(GetParametrDouble(domElement, "my")));
|
||||||
|
detail.setSupplement(GetParametrLongLong(domElement, "supplement"));
|
||||||
|
detail.setWidth(GetParametrDouble(domElement, "width"));
|
||||||
|
detail.setClosed(GetParametrLongLong(domElement, "closed"));
|
||||||
|
|
||||||
QDomNodeList nodeList = domElement.childNodes();
|
QDomNodeList nodeList = domElement.childNodes();
|
||||||
qint32 num = nodeList.size();
|
qint32 num = nodeList.size();
|
||||||
|
@ -481,6 +484,8 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
||||||
if(!element.isNull()){
|
if(!element.isNull()){
|
||||||
if(element.tagName() == "node"){
|
if(element.tagName() == "node"){
|
||||||
qint64 id = GetParametrLongLong(element, "idObject");
|
qint64 id = GetParametrLongLong(element, "idObject");
|
||||||
|
qreal mx = toPixel(GetParametrDouble(element, "mx"));
|
||||||
|
qreal my = toPixel(GetParametrDouble(element, "my"));
|
||||||
Tool::Tools tool;
|
Tool::Tools tool;
|
||||||
Draw::Draws mode;
|
Draw::Draws mode;
|
||||||
NodeDetail::NodeDetails nodeType = NodeDetail::Contour;
|
NodeDetail::NodeDetails nodeType = NodeDetail::Contour;
|
||||||
|
@ -527,8 +532,14 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
|
||||||
tool = Tool::SplinePathTool;
|
tool = Tool::SplinePathTool;
|
||||||
} else if(t == "SplineTool"){
|
} else if(t == "SplineTool"){
|
||||||
tool = Tool::SplineTool;
|
tool = Tool::SplineTool;
|
||||||
|
} else if(t == "Height"){
|
||||||
|
tool = Tool::Height;
|
||||||
|
} else if(t == "Triangle"){
|
||||||
|
tool = Tool::Triangle;
|
||||||
|
} else if(t == "PointOfIntersection"){
|
||||||
|
tool = Tool::PointOfIntersection;
|
||||||
}
|
}
|
||||||
detail.append(VNodeDetail(id, tool, mode, nodeType));
|
detail.append(VNodeDetail(id, tool, Draw::Modeling, nodeType, mx, my));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user