Improve performance. Calling method RefreshDataInFile() slows down parsing.
--HG-- branch : develop
This commit is contained in:
parent
0894f686ef
commit
ca66c8ebe2
|
@ -198,7 +198,7 @@ QDomElement VDomDocument::elementById(const QString& id)
|
|||
{
|
||||
if (map.contains(id))
|
||||
{
|
||||
QDomElement e = map[id];
|
||||
const QDomElement e = map[id];
|
||||
if (e.parentNode().nodeType() != QDomNode::BaseNode)
|
||||
{
|
||||
return e;
|
||||
|
@ -241,7 +241,7 @@ bool VDomDocument::find(const QDomElement &node, const QString& id)
|
|||
|
||||
for (qint32 i=0; i<node.childNodes().length(); ++i)
|
||||
{
|
||||
QDomNode n = node.childNodes().at(i);
|
||||
const QDomNode n = node.childNodes().at(i);
|
||||
if (n.isElement())
|
||||
{
|
||||
if (this->find(n.toElement(), id))
|
||||
|
|
|
@ -425,21 +425,6 @@ void VAbstractOperation::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractOperation::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
|
||||
SaveOptions(domElement, obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vTool, "Can't find tool with id = %u", id);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractOperation::UpdateNamePosition(quint32 id)
|
||||
{
|
||||
|
|
|
@ -118,7 +118,6 @@ protected:
|
|||
QGraphicsItem *parent = nullptr);
|
||||
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
|
||||
void UpdateNamePosition(quint32 id);
|
||||
void SaveSourceDestination(QDomElement &tag);
|
||||
|
|
|
@ -363,18 +363,3 @@ void VToolDoublePoint::AddToFile()
|
|||
SaveOptions(domElement, obj);
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolDoublePoint::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
QSharedPointer<VGObject> obj = VContainer::GetFakeGObject(id);
|
||||
SaveOptions(domElement, obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vTool, "Can't find tool with id = %u", id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ protected:
|
|||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolDoublePoint)
|
||||
|
|
|
@ -134,24 +134,6 @@ void VDrawTool::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VDrawTool::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOptions(domElement, obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vTool, "Can't find tool with id = %u", id);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::SaveOption(QSharedPointer<VGObject> &obj)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,6 @@ protected:
|
|||
virtual void SaveDialog(QDomElement &domElement)=0;
|
||||
virtual void SaveDialogChange() Q_DECL_FINAL;
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
void SaveOption(QSharedPointer<VGObject> &obj);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
|
||||
|
|
|
@ -287,24 +287,6 @@ void VToolLine::AddToFile()
|
|||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VToolLine::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
QSharedPointer<VGObject> obj = QSharedPointer<VGObject> ();
|
||||
SaveOptions(domElement, obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief hoverEnterEvent handle hover enter events.
|
||||
|
|
|
@ -92,7 +92,6 @@ public slots:
|
|||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -136,20 +136,3 @@ void VNodeArc::AddToFile()
|
|||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VNodeArc::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
|
|
|
@ -107,20 +107,6 @@ void VNodeEllipticalArc::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNodeEllipticalArc::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VNodeEllipticalArc::VNodeEllipticalArc(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idArc,
|
||||
const Source &typeCreation, const QString &drawName, const quint32 &idTool,
|
||||
|
|
|
@ -56,7 +56,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
|
|
|
@ -177,26 +177,6 @@ void VNodePoint::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VNodePoint::RefreshDataInFile()
|
||||
{
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdObject, idNode);
|
||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx()));
|
||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my()));
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VNodePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
|
|
|
@ -77,7 +77,6 @@ public slots:
|
|||
void AllowLabelSelecting(bool enabled);
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void UpdateNamePosition(qreal mx, qreal my);
|
||||
|
|
|
@ -140,20 +140,3 @@ void VNodeSpline::AddToFile()
|
|||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VNodeSpline::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile () Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
|
|
|
@ -138,20 +138,3 @@ void VNodeSplinePath::AddToFile()
|
|||
|
||||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VNodeSplinePath::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode));
|
||||
if (idTool != 0)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
|
|
|
@ -252,19 +252,6 @@ void VToolPiecePath::AddToFile()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPiecePath::RefreshDataInFile()
|
||||
{
|
||||
QDomElement domElement = doc->elementById(id);
|
||||
if (domElement.isElement())
|
||||
{
|
||||
if (idTool != NULL_ID)
|
||||
{
|
||||
doc->SetAttribute(domElement, AttrIdTool, idTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPiecePath::ShowNode()
|
||||
{
|
||||
|
|
|
@ -63,7 +63,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE;
|
||||
virtual void HideNode() Q_DECL_OVERRIDE;
|
||||
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -152,12 +152,6 @@ void VToolPin::AddToFile()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPin::RefreshDataInFile()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPin::VToolPin(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 pointId, quint32 pieceId,
|
||||
const Source &typeCreation, const QString &drawName, const quint32 &idTool, QObject *qoParent)
|
||||
|
|
|
@ -52,7 +52,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void ShowNode() Q_DECL_OVERRIDE {}
|
||||
virtual void HideNode() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
|
|
|
@ -403,6 +403,12 @@ void VAbstractTool::ToolSelectionType(const SelectionType &type)
|
|||
selectionType = type;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractTool::RefreshDataInFile()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractTool::ToolCreation(const Source &typeCreation)
|
||||
{
|
||||
|
|
|
@ -121,7 +121,7 @@ protected:
|
|||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
virtual void RefreshDataInFile()=0;
|
||||
virtual void RefreshDataInFile();
|
||||
/**
|
||||
* @brief RemoveReferens decrement value of reference.
|
||||
*/
|
||||
|
|
|
@ -1512,15 +1512,6 @@ void VToolUnionDetails::AddToFile()
|
|||
AddToModeling(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
|
||||
*/
|
||||
void VToolUnionDetails::RefreshDataInFile()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief AddDetail add detail to xml file.
|
||||
|
|
|
@ -111,7 +111,6 @@ public slots:
|
|||
virtual void AllowSelecting(bool) Q_DECL_OVERRIDE {}
|
||||
protected:
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE {}
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolUnionDetails)
|
||||
|
|
Loading…
Reference in New Issue
Block a user