Removing objects before each FullParse. NodeArc, NodeSpline, NodeSplinePath are
not part of a scene anymore. --HG-- branch : develop
This commit is contained in:
parent
9eac04654c
commit
85f5df4b21
|
@ -1940,7 +1940,7 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
|
||||||
spl->setIdObject(idObject);
|
spl->setIdObject(idObject);
|
||||||
spl->setMode(Draw::Modeling);
|
spl->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, spl);
|
data->UpdateGObject(id, spl);
|
||||||
VNodeSpline::Create(this, data, sceneDetail, id, idObject, parse, Source::FromFile, idTool);
|
VNodeSpline::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
@ -1966,7 +1966,7 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document
|
||||||
path->setIdObject(idObject);
|
path->setIdObject(idObject);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, path);
|
data->UpdateGObject(id, path);
|
||||||
VNodeSplinePath::Create(this, data, sceneDetail, id, idObject, parse, Source::FromFile, idTool);
|
VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
@ -2037,7 +2037,7 @@ void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse
|
||||||
arc->setIdObject(idObject);
|
arc->setIdObject(idObject);
|
||||||
arc->setMode(Draw::Modeling);
|
arc->setMode(Draw::Modeling);
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
VNodeArc::Create(this, data, sceneDetail, id, idObject, parse, Source::FromFile, idTool);
|
VNodeArc::Create(this, data, id, idObject, parse, Source::FromFile, idTool);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
@ -2767,6 +2767,7 @@ void VPattern::PrepareForParse(const Document &parse)
|
||||||
data->ClearForFullParse();
|
data->ClearForFullParse();
|
||||||
nameActivPP.clear();
|
nameActivPP.clear();
|
||||||
patternPieces.clear();
|
patternPieces.clear();
|
||||||
|
qDeleteAll(toolsOnRemove);//Remove all invisible on a scene objects.
|
||||||
tools.clear();
|
tools.clear();
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
history.clear();
|
history.clear();
|
||||||
|
|
|
@ -107,7 +107,8 @@ const QString VAbstractPattern::IncrementDescription = QStringLiteral("descripti
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractPattern::VAbstractPattern(QObject *parent)
|
VAbstractPattern::VAbstractPattern(QObject *parent)
|
||||||
: QObject(parent), VDomDocument(), nameActivPP(QString()), cursor(0), tools(QHash<quint32, VDataTool*>()),
|
: QObject(parent), VDomDocument(), nameActivPP(QString()), cursor(0), tools(QHash<quint32, VDataTool*>()),
|
||||||
history(QVector<VToolRecord>()), patternPieces(QStringList()), modified(false)
|
toolsOnRemove(QVector<VDataTool*>()), history(QVector<VToolRecord>()), patternPieces(QStringList()),
|
||||||
|
modified(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -431,6 +432,13 @@ void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool)
|
||||||
tools.insert(id, tool);
|
tools.insert(id, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::AddToolOnRemove(VDataTool *tool)
|
||||||
|
{
|
||||||
|
SCASSERT(tool != nullptr);
|
||||||
|
toolsOnRemove.append(tool);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief getHistory return list with list of history records.
|
* @brief getHistory return list with list of history records.
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
VDataTool *getTool(const quint32 &id);
|
VDataTool *getTool(const quint32 &id);
|
||||||
void AddTool(const quint32 &id, VDataTool *tool);
|
void AddTool(const quint32 &id, VDataTool *tool);
|
||||||
|
|
||||||
|
void AddToolOnRemove(VDataTool *tool);
|
||||||
|
|
||||||
QVector<VToolRecord> *getHistory();
|
QVector<VToolRecord> *getHistory();
|
||||||
QVector<VToolRecord> getLocalHistory() const;
|
QVector<VToolRecord> getLocalHistory() const;
|
||||||
|
|
||||||
|
@ -240,6 +242,8 @@ protected:
|
||||||
/** @brief tools list with pointer on tools. */
|
/** @brief tools list with pointer on tools. */
|
||||||
QHash<quint32, VDataTool*> tools;
|
QHash<quint32, VDataTool*> tools;
|
||||||
|
|
||||||
|
QVector<VDataTool*> toolsOnRemove;
|
||||||
|
|
||||||
/** @brief history history records. */
|
/** @brief history history records. */
|
||||||
QVector<VToolRecord> history;
|
QVector<VToolRecord> history;
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ void VContainer::AddVariable(const QString& name, T *var)
|
||||||
throw VExceptionBadId(tr("Can't find object. Type mismatch."), name);
|
throw VExceptionBadId(tr("Can't find object. Type mismatch."), name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d->variables[name] = QSharedPointer<T>(var);
|
d->variables.insert(name, QSharedPointer<T>(var));
|
||||||
uniqueNames.insert(name);
|
uniqueNames.insert(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,9 @@ const QString VNodeArc::ToolType = QStringLiteral("modeling");
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VNodeArc::VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
VNodeArc::VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
||||||
const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
|
const quint32 &idTool, QObject *qoParent)
|
||||||
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
|
:VAbstractNode(doc, data, id, idArc, idTool, qoParent)
|
||||||
{
|
{
|
||||||
RefreshGeometry();
|
|
||||||
this->setPen(QPen(baseColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
|
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,13 +65,13 @@ VNodeArc::VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32
|
||||||
* @param idTool tool id.
|
* @param idTool tool id.
|
||||||
* @param parent QObject parent
|
* @param parent QObject parent
|
||||||
*/
|
*/
|
||||||
void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id, quint32 idArc,
|
void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc,
|
||||||
const Document &parse, const Source &typeCreation, const quint32 &idTool, QObject *parent)
|
const Document &parse, const Source &typeCreation, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodeArc, doc);
|
VAbstractTool::AddRecord(id, Tool::NodeArc, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent);
|
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, doc);
|
||||||
|
|
||||||
doc->AddTool(id, arc);
|
doc->AddTool(id, arc);
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
|
@ -86,10 +83,8 @@ void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScen
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try to prevent memory leak
|
// Help to delete the node before each FullParse
|
||||||
scene->addItem(arc);// First adopted by scene
|
doc->AddToolOnRemove(arc);
|
||||||
arc->hide();// If no one will use node, it will stay hidden
|
|
||||||
arc->SetParentType(ParentType::Scene);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -104,15 +99,6 @@ QString VNodeArc::getTagName() const
|
||||||
return VNodeArc::TagName;
|
return VNodeArc::TagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile update tool data form file.
|
|
||||||
*/
|
|
||||||
void VNodeArc::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddToFile add tag with informations about tool into file.
|
* @brief AddToFile add tag with informations about tool into file.
|
||||||
|
@ -148,68 +134,3 @@ void VNodeArc::RefreshDataInFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent handle mouse release events.
|
|
||||||
* @param event mouse release event.
|
|
||||||
*/
|
|
||||||
void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::Arc);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
|
||||||
* @param event hover move event.
|
|
||||||
*/
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent handle hover leave events.
|
|
||||||
* @param event hover leave event.
|
|
||||||
*/
|
|
||||||
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VNodeArc::ShowNode()
|
|
||||||
{
|
|
||||||
if (parentType != ParentType::Scene)
|
|
||||||
{
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VNodeArc::HideNode()
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
|
||||||
*/
|
|
||||||
void VNodeArc::RefreshGeometry()
|
|
||||||
{
|
|
||||||
// const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
|
||||||
// QPainterPath path;
|
|
||||||
// path.addPath(arc->GetPath());
|
|
||||||
// path.setFillRule( Qt::WindingFill );
|
|
||||||
// this->setPath(path);
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,33 +35,27 @@
|
||||||
/**
|
/**
|
||||||
* @brief The VNodeArc class arc detail node.
|
* @brief The VNodeArc class arc detail node.
|
||||||
*/
|
*/
|
||||||
class VNodeArc :public VAbstractNode, public QGraphicsPathItem
|
class VNodeArc :public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
VNodeArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
|
const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
|
|
||||||
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id,
|
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document &parse,
|
||||||
quint32 idArc, const Document &parse,
|
const Source &typeCreation, const quint32 &idTool = 0);
|
||||||
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr);
|
|
||||||
static const QString TagName;
|
static const QString TagName;
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
|
||||||
enum { Type = UserType + static_cast<int>(Tool::NodeArc)};
|
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE {}
|
||||||
protected:
|
protected:
|
||||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void ShowNode() Q_DECL_OVERRIDE;
|
|
||||||
virtual void HideNode() Q_DECL_OVERRIDE;
|
|
||||||
private:
|
private:
|
||||||
void RefreshGeometry();
|
Q_DISABLE_COPY(VNodeArc)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODEARC_H4
|
#endif // VNODEARC_H4
|
||||||
|
|
|
@ -81,14 +81,14 @@ VNodePoint::VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quin
|
||||||
*/
|
*/
|
||||||
void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
||||||
quint32 id, quint32 idPoint, const Document &parse,
|
quint32 id, quint32 idPoint, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *parent)
|
const Source &typeCreation, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
|
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
//TODO Need create garbage collector and remove all nodes, what we don't use.
|
||||||
//Better check garbage before each saving file. Check only modeling tags.
|
//Better check garbage before each saving file. Check only modeling tags.
|
||||||
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, doc);
|
||||||
|
|
||||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VNodePoint::EnableToolMove);
|
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VNodePoint::EnableToolMove);
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene,
|
||||||
quint32 id, quint32 idPoint, const Document &parse,
|
quint32 id, quint32 idPoint, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr);
|
const Source &typeCreation, const quint32 &idTool = 0);
|
||||||
static const QString TagName;
|
static const QString TagName;
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
||||||
|
|
|
@ -47,13 +47,9 @@ const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline");
|
||||||
* @param parent QGraphicsItem parent.
|
* @param parent QGraphicsItem parent.
|
||||||
*/
|
*/
|
||||||
VNodeSpline::VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
VNodeSpline::VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *qoParent,
|
const Source &typeCreation, const quint32 &idTool, QObject *qoParent)
|
||||||
QGraphicsItem * parent)
|
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent)
|
||||||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
|
||||||
{
|
{
|
||||||
RefreshGeometry();
|
|
||||||
this->setPen(QPen(baseColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
|
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,15 +65,15 @@ VNodeSpline::VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, qu
|
||||||
* @param idTool id node.
|
* @param idTool id node.
|
||||||
* @return pointer to node.
|
* @return pointer to node.
|
||||||
*/
|
*/
|
||||||
VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id,
|
VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *parent)
|
const Source &typeCreation, const quint32 &idTool)
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodeSpline, doc);
|
VAbstractTool::AddRecord(id, Tool::NodeSpline, doc);
|
||||||
VNodeSpline *spl = nullptr;
|
VNodeSpline *spl = nullptr;
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, parent);
|
spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, doc);
|
||||||
|
|
||||||
doc->AddTool(id, spl);
|
doc->AddTool(id, spl);
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
|
@ -89,10 +85,8 @@ VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, VMainG
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try to prevent memory leak
|
// Help to delete the node before each FullParse
|
||||||
scene->addItem(spl);// First adopted by scene
|
doc->AddToolOnRemove(spl);
|
||||||
spl->hide();// If no one will use node, it will stay hidden
|
|
||||||
spl->SetParentType(ParentType::Scene);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -108,15 +102,6 @@ QString VNodeSpline::getTagName() const
|
||||||
return VNodeSpline::TagName;
|
return VNodeSpline::TagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile update tool data form file.
|
|
||||||
*/
|
|
||||||
void VNodeSpline::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddToFile add tag with informations about tool into file.
|
* @brief AddToFile add tag with informations about tool into file.
|
||||||
|
@ -152,67 +137,3 @@ void VNodeSpline::RefreshDataInFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent handle mouse release events.
|
|
||||||
* @param event mouse release event.
|
|
||||||
*/
|
|
||||||
void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::Spline);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
|
||||||
* @param event hover move event.
|
|
||||||
*/
|
|
||||||
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent handle hover leave events.
|
|
||||||
* @param event hover leave event.
|
|
||||||
*/
|
|
||||||
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VNodeSpline::ShowNode()
|
|
||||||
{
|
|
||||||
if (parentType != ParentType::Scene)
|
|
||||||
{
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VNodeSpline::HideNode()
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
|
||||||
*/
|
|
||||||
void VNodeSpline::RefreshGeometry()
|
|
||||||
{
|
|
||||||
// const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
|
||||||
// QPainterPath path;
|
|
||||||
// path.addPath(spl->GetPath());
|
|
||||||
// path.setFillRule( Qt::WindingFill );
|
|
||||||
// this->setPath(path);
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,33 +35,28 @@
|
||||||
/**
|
/**
|
||||||
* @brief The VNodeSpline class spline detail node.
|
* @brief The VNodeSpline class spline detail node.
|
||||||
*/
|
*/
|
||||||
class VNodeSpline:public VAbstractNode, public QGraphicsPathItem
|
class VNodeSpline:public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
VNodeSpline(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
|
const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
|
|
||||||
static VNodeSpline *Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id,
|
static VNodeSpline *Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr);
|
const Source &typeCreation, const quint32 &idTool = 0);
|
||||||
static const QString TagName;
|
static const QString TagName;
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
|
||||||
enum { Type = UserType + static_cast<int>(Tool::NodeSpline)};
|
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE {}
|
||||||
protected:
|
protected:
|
||||||
virtual void AddToFile () Q_DECL_OVERRIDE;
|
virtual void AddToFile () Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void ShowNode() Q_DECL_OVERRIDE;
|
|
||||||
virtual void HideNode() Q_DECL_OVERRIDE;
|
|
||||||
private:
|
private:
|
||||||
void RefreshGeometry ();
|
Q_DISABLE_COPY(VNodeSpline)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODESPLINE_H
|
#endif // VNODESPLINE_H
|
||||||
|
|
|
@ -48,13 +48,9 @@ const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VNodeSplinePath::VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
VNodeSplinePath::VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline,
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *qoParent,
|
const Source &typeCreation, const quint32 &idTool, QObject *qoParent)
|
||||||
QGraphicsItem * parent)
|
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent)
|
||||||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
|
||||||
{
|
{
|
||||||
RefreshGeometry();
|
|
||||||
this->setPen(QPen(baseColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
|
|
||||||
ToolCreation(typeCreation);
|
ToolCreation(typeCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,14 +66,13 @@ VNodeSplinePath::VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint3
|
||||||
* @param idTool tool id.
|
* @param idTool tool id.
|
||||||
* @param parent QObject parent.
|
* @param parent QObject parent.
|
||||||
*/
|
*/
|
||||||
void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id,
|
void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse, const Source &typeCreation, const quint32 &idTool)
|
||||||
const Source &typeCreation, const quint32 &idTool, QObject *parent)
|
|
||||||
{
|
{
|
||||||
VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc);
|
VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent);
|
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, doc);
|
||||||
|
|
||||||
doc->AddTool(id, splPath);
|
doc->AddTool(id, splPath);
|
||||||
if (idTool != NULL_ID)
|
if (idTool != NULL_ID)
|
||||||
|
@ -89,10 +84,8 @@ void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, VMainGraph
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try to prevent memory leak
|
// Help to delete the node before each FullParse
|
||||||
scene->addItem(splPath);// First adopted by scene
|
doc->AddToolOnRemove(splPath);
|
||||||
splPath->hide();// If no one will use node, it will stay hidden
|
|
||||||
splPath->SetParentType(ParentType::Scene);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -107,15 +100,6 @@ QString VNodeSplinePath::getTagName() const
|
||||||
return VNodeSplinePath::TagName;
|
return VNodeSplinePath::TagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief FullUpdateFromFile update tool data form file.
|
|
||||||
*/
|
|
||||||
void VNodeSplinePath::FullUpdateFromFile()
|
|
||||||
{
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief AddToFile add tag with informations about tool into file.
|
* @brief AddToFile add tag with informations about tool into file.
|
||||||
|
@ -151,67 +135,3 @@ void VNodeSplinePath::RefreshDataInFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent handle mouse release events.
|
|
||||||
* @param event mouse release event.
|
|
||||||
*/
|
|
||||||
void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::SplinePath);
|
|
||||||
}
|
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
|
||||||
* @param event hover move event.
|
|
||||||
*/
|
|
||||||
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthMainLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief hoverLeaveEvent handle hover leave events.
|
|
||||||
* @param event hover leave event.
|
|
||||||
*/
|
|
||||||
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|
||||||
{
|
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VNodeSplinePath::ShowNode()
|
|
||||||
{
|
|
||||||
if (parentType != ParentType::Scene)
|
|
||||||
{
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VNodeSplinePath::HideNode()
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
|
||||||
*/
|
|
||||||
void VNodeSplinePath::RefreshGeometry()
|
|
||||||
{
|
|
||||||
// const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
|
||||||
// QPainterPath path;
|
|
||||||
// path.addPath(splPath->GetPath());
|
|
||||||
// path.setFillRule( Qt::WindingFill );
|
|
||||||
// this->setPath(path);
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,32 +35,27 @@
|
||||||
/**
|
/**
|
||||||
* @brief The VNodeSplinePath class spline path detail node.
|
* @brief The VNodeSplinePath class spline path detail node.
|
||||||
*/
|
*/
|
||||||
class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem
|
class VNodeSplinePath : public VAbstractNode
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
VNodeSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Source &typeCreation,
|
||||||
const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr);
|
const quint32 &idTool = 0, QObject *qoParent = nullptr);
|
||||||
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id,
|
static void Create(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||||
quint32 idSpline, const Document &parse,
|
quint32 idSpline, const Document &parse,
|
||||||
const Source &typeCreation, const quint32 &idTool = 0, QObject *parent = 0);
|
const Source &typeCreation, const quint32 &idTool = 0);
|
||||||
static const QString TagName;
|
static const QString TagName;
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
|
||||||
enum { Type = UserType + static_cast<int>(Tool::SplinePath)};
|
|
||||||
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
virtual QString getTagName() const Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
|
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE {}
|
||||||
protected:
|
protected:
|
||||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
||||||
virtual void ShowNode() Q_DECL_OVERRIDE;
|
|
||||||
virtual void HideNode() Q_DECL_OVERRIDE;
|
|
||||||
private:
|
private:
|
||||||
void RefreshGeometry();
|
Q_DISABLE_COPY(VNodeSplinePath)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNODESPLINEPATH_H
|
#endif // VNODESPLINEPATH_H
|
||||||
|
|
|
@ -88,13 +88,13 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
|
||||||
InitTool<VNodePoint>(scene, detail.at(i));
|
InitTool<VNodePoint>(scene, detail.at(i));
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
InitTool<VNodeArc>(scene, detail.at(i));
|
doc->IncrementReferens(detail.at(i).getId());
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
InitTool<VNodeSpline>(scene, detail.at(i));
|
doc->IncrementReferens(detail.at(i).getId());
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
InitTool<VNodeSplinePath>(scene, detail.at(i));
|
doc->IncrementReferens(detail.at(i).getId());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug()<<"Get wrong tool type. Ignore.";
|
qDebug()<<"Get wrong tool type. Ignore.";
|
||||||
|
@ -173,26 +173,27 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
{
|
{
|
||||||
id = CreateNode<VArc>(data, nodeD.getId());
|
id = CreateNode<VArc>(data, nodeD.getId());
|
||||||
VNodeArc::Create(doc, data, scene, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
VNodeArc::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSpline):
|
case (Tool::NodeSpline):
|
||||||
{
|
{
|
||||||
id = CreateNode<VSpline>(data, nodeD.getId());
|
id = CreateNode<VSpline>(data, nodeD.getId());
|
||||||
VNodeSpline::Create(doc, data, scene, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
VNodeSpline::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeSplinePath):
|
case (Tool::NodeSplinePath):
|
||||||
{
|
{
|
||||||
id = CreateNode<VSplinePath>(data, nodeD.getId());
|
id = CreateNode<VSplinePath>(data, nodeD.getId());
|
||||||
VNodeSplinePath::Create(doc, data, scene, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
VNodeSplinePath::Create(doc, data, id, nodeD.getId(), Document::FullParse, Source::FromGui);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
qDebug()<<"May be wrong tool type!!! Ignoring."<<Q_FUNC_INFO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
VNodeDetail node(id, nodeD.getTypeTool(), NodeDetail::Contour, nodeD.getMx(), nodeD.getMy(), nodeD.getReverse());
|
VNodeDetail node(id, nodeD.getTypeTool(), NodeDetail::Contour, nodeD.getMx(), nodeD.getMy(),
|
||||||
|
nodeD.getReverse());
|
||||||
det.append(node);
|
det.append(node);
|
||||||
}
|
}
|
||||||
det.setName(detail.getName());
|
det.setName(detail.getName());
|
||||||
|
|
|
@ -102,7 +102,7 @@ VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, co
|
||||||
* @param pRotate point rotation.
|
* @param pRotate point rotation.
|
||||||
* @param angle angle rotation.
|
* @param angle angle rotation.
|
||||||
*/
|
*/
|
||||||
void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
void VToolUnionDetails::AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||||
VContainer *data, VDetail &newDetail, const VDetail &det, const int &i,
|
VContainer *data, VDetail &newDetail, const VDetail &det, const int &i,
|
||||||
const quint32 &idTool, QVector<quint32> &children, const qreal &dx,
|
const quint32 &idTool, QVector<quint32> &children, const qreal &dx,
|
||||||
const qreal &dy, const quint32 &pRotate, const qreal &angle)
|
const qreal &dy, const quint32 &pRotate, const qreal &angle)
|
||||||
|
@ -127,7 +127,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
||||||
VPointF *point1 = new VPointF(*point);
|
VPointF *point1 = new VPointF(*point);
|
||||||
point1->setMode(Draw::Modeling);
|
point1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(point1);
|
id = data->AddGObject(point1);
|
||||||
VNodePoint::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, idTool, tool);
|
VNodePoint::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -164,7 +164,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
||||||
arc2->setMode(Draw::Modeling);
|
arc2->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(arc2);
|
id = data->AddGObject(arc2);
|
||||||
|
|
||||||
VNodeArc::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, idTool, tool);
|
VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -199,7 +199,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
||||||
VSpline *spl1 = new VSpline(*spl);
|
VSpline *spl1 = new VSpline(*spl);
|
||||||
spl1->setMode(Draw::Modeling);
|
spl1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(spl1);
|
id = data->AddGObject(spl1);
|
||||||
VNodeSpline::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, idTool, tool);
|
VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
||||||
|
|
||||||
delete p4;
|
delete p4;
|
||||||
delete p1;
|
delete p1;
|
||||||
|
@ -255,8 +255,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene,
|
||||||
VSplinePath *path1 = new VSplinePath(*path);
|
VSplinePath *path1 = new VSplinePath(*path);
|
||||||
path1->setMode(Draw::Modeling);
|
path1->setMode(Draw::Modeling);
|
||||||
id = data->AddGObject(path1);
|
id = data->AddGObject(path1);
|
||||||
VNodeSplinePath::Create(doc, data, scene, id, idObject, Document::FullParse, Source::FromGui, idTool,
|
VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Source::FromGui, idTool);
|
||||||
tool);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -552,6 +551,8 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
//Scene doesn't show this tool, so doc will destroy this object.
|
//Scene doesn't show this tool, so doc will destroy this object.
|
||||||
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc);
|
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc);
|
||||||
doc->AddTool(id, unionDetails);
|
doc->AddTool(id, unionDetails);
|
||||||
|
// Unfortunatelly doc will destroy all objects only in the end, but we should delete them before each FullParse
|
||||||
|
doc->AddToolOnRemove(unionDetails);
|
||||||
}
|
}
|
||||||
//Then create new details
|
//Then create new details
|
||||||
VNodeDetail det1p1;
|
VNodeDetail det1p1;
|
||||||
|
@ -592,7 +593,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
QVector<quint32> children;
|
QVector<quint32> children;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
AddToNewDetail(unionDetails, scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id, children);
|
AddToNewDetail(scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id, children);
|
||||||
++i;
|
++i;
|
||||||
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1)
|
if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1)
|
||||||
{
|
{
|
||||||
|
@ -604,7 +605,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
{
|
{
|
||||||
j=0;
|
j=0;
|
||||||
}
|
}
|
||||||
AddToNewDetail(unionDetails, scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, children,
|
AddToNewDetail(scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, children,
|
||||||
dx, dy, det1p1.getId(), angle);
|
dx, dy, det1p1.getId(), angle);
|
||||||
++pointsD2;
|
++pointsD2;
|
||||||
++j;
|
++j;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
static const QString AttrNodeType;
|
static const QString AttrNodeType;
|
||||||
static const QString NodeTypeContour;
|
static const QString NodeTypeContour;
|
||||||
static const QString NodeTypeModeling;
|
static const QString NodeTypeModeling;
|
||||||
static void AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
static void AddToNewDetail(VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
||||||
VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool,
|
VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool,
|
||||||
QVector<quint32> &children, const qreal &dx = 0,
|
QVector<quint32> &children, const qreal &dx = 0,
|
||||||
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
|
const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0);
|
||||||
|
|
|
@ -89,7 +89,13 @@ void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMainGraphicsScene::InitOrigins()
|
void VMainGraphicsScene::InitOrigins()
|
||||||
{
|
{
|
||||||
qDeleteAll(origins);
|
foreach (QGraphicsItem *item, origins)
|
||||||
|
{
|
||||||
|
if (this->items().contains(item))
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QPen originsPen(Qt::green, ToPixel(WidthHairLine(Unit::Mm), Unit::Mm), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
QPen originsPen(Qt::green, ToPixel(WidthHairLine(Unit::Mm), Unit::Mm), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
QBrush axisTextBrush(Qt::green);
|
QBrush axisTextBrush(Qt::green);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user