Remove tool will be disabled, when value reference more than 1.

This commit is contained in:
dismine 2013-09-27 18:00:51 +03:00
parent 7d9dac37b6
commit ed63b97827
14 changed files with 113 additions and 43 deletions

View File

@ -26,11 +26,24 @@ VPointF::VPointF():_name(QString()), _mx(0), _my(0), _x(0), _y(0), _referens(0),
} }
VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _my(point.my()), VPointF::VPointF ( const VPointF & point ):_name(point.name()), _mx(point.mx()), _my(point.my()),
_x(point.x()), _y(point.y()), _referens(0), mode(point.getMode()), idObject(point.getIdObject()){ _x(point.x()), _y(point.y()), _referens(point.referens()), mode(point.getMode()),
idObject(point.getIdObject()){
} }
VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Mode mode, qint64 idObject):_name(name), _mx(mx), VPointF::VPointF (qreal x, qreal y , QString name, qreal mx, qreal my, Draw::Mode mode, qint64 idObject):
_my(my), _x(x), _y(y), _referens(0), mode(mode), idObject(idObject){ _name(name), _mx(mx), _my(my), _x(x), _y(y), _referens(0), mode(mode), idObject(idObject){
}
VPointF &VPointF::operator =(const VPointF &point){
_name = point.name();
_mx = point.mx();
_my = point.my();
_x = point.x();
_y = point.y();
_referens = point.referens();
mode = point.getMode();
idObject = point.getIdObject();
return *this;
} }
VPointF::~VPointF(){ VPointF::~VPointF(){

View File

@ -33,6 +33,7 @@ public:
VPointF (const VPointF &point ); VPointF (const VPointF &point );
VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Mode mode = Draw::Calculation, VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Mode mode = Draw::Calculation,
qint64 idObject = 0); qint64 idObject = 0);
VPointF &operator=(const VPointF &point);
~VPointF(); ~VPointF();
QString name() const; QString name() const;
qreal mx() const; qreal mx() const;

View File

@ -50,10 +50,13 @@ protected:
bool showRemove = true){ bool showRemove = true){
if(!ignoreContextMenuEvent){ if(!ignoreContextMenuEvent){
QMenu menu; QMenu menu;
QAction *actionOption = menu.addAction("Властивості"); QAction *actionOption = menu.addAction(tr("Options"));
QAction *actionRemove; QAction *actionRemove;
if(showRemove){ if(showRemove){
actionRemove = menu.addAction("Видалити"); actionRemove = menu.addAction(tr("Delete"));
} else {
actionRemove = menu.addAction(tr("Delete"));
actionRemove->setEnabled(false);
} }
QAction *selectedAction = menu.exec(event->screenPos()); QAction *selectedAction = menu.exec(event->screenPos());
if(selectedAction == actionOption){ if(selectedAction == actionOption){

View File

@ -65,8 +65,13 @@ void VToolAlongLine::FullUpdateFromGui(int result){
} }
void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogAlongLine, this, event, false);
} else {
ContextMenu(dialogAlongLine, this, event); ContextMenu(dialogAlongLine, this, event);
} }
}
void VToolAlongLine::AddToFile(){ void VToolAlongLine::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);

View File

@ -156,8 +156,13 @@ void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
} }
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VArc arc = VDrawTool::data.GetArc(id);
if(arc.referens() > 1){
ContextMenu(dialogArc, this, event, false);
} else {
ContextMenu(dialogArc, this, event); ContextMenu(dialogArc, this, event);
} }
}
void VToolArc::AddToFile(){ void VToolArc::AddToFile(){
VArc arc = VAbstractTool::data.GetArc(id); VArc arc = VAbstractTool::data.GetArc(id);

View File

@ -147,8 +147,13 @@ void VToolBisector::FullUpdateFromGui(int result){
} }
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogBisector, this, event, false);
} else {
ContextMenu(dialogBisector, this, event); ContextMenu(dialogBisector, this, event);
} }
}
void VToolBisector::AddToFile(){ void VToolBisector::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);

View File

@ -79,10 +79,9 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
if(parse != Document::FullParse){ if(parse != Document::FullParse){
QMap<qint64, VDataTool*>* tools = doc->getTools(); QMap<qint64, VDataTool*>* tools = doc->getTools();
VDataTool *tool = tools->value(id); VDataTool *tool = tools->value(id);
if(tool != 0){ Q_CHECK_PTR(tool);
tool->VDataTool::setData(data);
data->IncrementReferens(id, Scene::Point); data->IncrementReferens(id, Scene::Point);
} tool->VDataTool::setData(data);
} }
} }
data->AddLine(basePointId, id); data->AddLine(basePointId, id);
@ -94,6 +93,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
QMap<qint64, VDataTool*>* tools = doc->getTools(); QMap<qint64, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
tools->insert(id,point); tools->insert(id,point);
} }
} }
@ -111,8 +111,13 @@ void VToolEndLine::FullUpdateFromFile(){
} }
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogEndLine, this, event, false);
} else {
ContextMenu(dialogEndLine, this, event); ContextMenu(dialogEndLine, this, event);
} }
}
void VToolEndLine::FullUpdateFromGui(int result){ void VToolEndLine::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){ if(result == QDialog::Accepted){

View File

@ -128,8 +128,13 @@ void VToolLineIntersect::FullUpdateFromGui(int result){
} }
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogLineIntersect, this, event, false);
} else {
ContextMenu(dialogLineIntersect, this, event); ContextMenu(dialogLineIntersect, this, event);
} }
}
void VToolLineIntersect::AddToFile(){ void VToolLineIntersect::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);

View File

@ -138,8 +138,13 @@ void VToolNormal::FullUpdateFromGui(int result){
} }
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogNormal, this, event, false);
} else {
ContextMenu(dialogNormal, this, event); ContextMenu(dialogNormal, this, event);
} }
}
void VToolNormal::AddToFile(){ void VToolNormal::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);

View File

@ -147,8 +147,13 @@ void VToolPointOfContact::FullUpdateFromGui(int result){
} }
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogPointOfContact, this, event, false);
} else {
ContextMenu(dialogPointOfContact, this, event); ContextMenu(dialogPointOfContact, this, event);
} }
}
void VToolPointOfContact::AddToFile(){ void VToolPointOfContact::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);

View File

@ -156,8 +156,13 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
} }
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VPointF point = VDrawTool::data.GetPoint(id);
if(point.referens() > 1){
ContextMenu(dialogShoulderPoint, this, event, false);
} else {
ContextMenu(dialogShoulderPoint, this, event); ContextMenu(dialogShoulderPoint, this, event);
} }
}
void VToolShoulderPoint::AddToFile(){ void VToolShoulderPoint::AddToFile(){
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);

View File

@ -177,8 +177,13 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo
} }
void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VSpline spl = VDrawTool::data.GetSpline(id);
if(spl.referens() > 1){
ContextMenu(dialogSpline, this, event, false);
} else {
ContextMenu(dialogSpline, this, event); ContextMenu(dialogSpline, this, event);
} }
}
void VToolSpline::AddToFile(){ void VToolSpline::AddToFile(){
VSpline spl = VAbstractTool::data.GetSpline(id); VSpline spl = VAbstractTool::data.GetSpline(id);

View File

@ -216,8 +216,13 @@ void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
} }
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){ void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
VSplinePath path = VDrawTool::data.GetSplinePath(id);
if(path.referens() > 1){
ContextMenu(dialogSplinePath, this, event, false);
} else {
ContextMenu(dialogSplinePath, this, event); ContextMenu(dialogSplinePath, this, event);
} }
}
void VToolSplinePath::AddToFile(){ void VToolSplinePath::AddToFile(){
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);

View File

@ -567,6 +567,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
QString formula = GetParametrString(domElement, "length"); QString formula = GetParametrString(domElement, "length");
qint64 basePointId = GetParametrLongLong(domElement, "basePoint"); qint64 basePointId = GetParametrLongLong(domElement, "basePoint");
qreal angle = GetParametrDouble(domElement, "angle"); qreal angle = GetParametrDouble(domElement, "angle");
data->IncrementReferens(basePointId, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this, VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this,
data, parse, Tool::FromFile); data, parse, Tool::FromFile);
@ -574,7 +575,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, this, VModelingEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, this,
data, parse, Tool::FromFile); data, parse, Tool::FromFile);
} }
data->IncrementReferens(basePointId, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -593,6 +593,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
QString formula = GetParametrString(domElement, "length"); QString formula = GetParametrString(domElement, "length");
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
scene, this, data, parse, Tool::FromFile); scene, this, data, parse, Tool::FromFile);
@ -600,8 +602,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, VModelingAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
this, data, parse, Tool::FromFile); this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -621,6 +621,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
qint64 p1Line = GetParametrLongLong(domElement, "p1Line"); qint64 p1Line = GetParametrLongLong(domElement, "p1Line");
qint64 p2Line = GetParametrLongLong(domElement, "p2Line"); qint64 p2Line = GetParametrLongLong(domElement, "p2Line");
qint64 pShoulder = GetParametrLongLong(domElement, "pShoulder"); qint64 pShoulder = GetParametrLongLong(domElement, "pShoulder");
data->IncrementReferens(p1Line, Scene::Point, mode);
data->IncrementReferens(p2Line, Scene::Point, mode);
data->IncrementReferens(pShoulder, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my,
scene, this, data, parse, Tool::FromFile); scene, this, data, parse, Tool::FromFile);
@ -628,9 +631,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, VModelingShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx,
my, this, data, parse, Tool::FromFile); my, this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(p1Line, Scene::Point, mode);
data->IncrementReferens(p2Line, Scene::Point, mode);
data->IncrementReferens(pShoulder, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -650,6 +650,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
qreal angle = GetParametrDouble(domElement, "angle"); qreal angle = GetParametrDouble(domElement, "angle");
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
mx, my, scene, this, data, parse, Tool::FromFile); mx, my, scene, this, data, parse, Tool::FromFile);
@ -657,8 +659,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, VModelingNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
mx, my, this, data, parse, Tool::FromFile); mx, my, this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -678,6 +678,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
qint64 thirdPointId = GetParametrLongLong(domElement, "thirdPoint"); qint64 thirdPointId = GetParametrLongLong(domElement, "thirdPoint");
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
data->IncrementReferens(thirdPointId, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
name, mx, my, scene, this, data, parse, Tool::FromFile); name, mx, my, scene, this, data, parse, Tool::FromFile);
@ -685,9 +688,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, VModelingBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
name, mx, my, this, data, parse, Tool::FromFile); name, mx, my, this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
data->IncrementReferens(thirdPointId, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -706,6 +706,10 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
qint64 p2Line1Id = GetParametrLongLong(domElement, "p2Line1"); qint64 p2Line1Id = GetParametrLongLong(domElement, "p2Line1");
qint64 p1Line2Id = GetParametrLongLong(domElement, "p1Line2"); qint64 p1Line2Id = GetParametrLongLong(domElement, "p1Line2");
qint64 p2Line2Id = GetParametrLongLong(domElement, "p2Line2"); qint64 p2Line2Id = GetParametrLongLong(domElement, "p2Line2");
data->IncrementReferens(p1Line1Id, Scene::Point, mode);
data->IncrementReferens(p2Line1Id, Scene::Point, mode);
data->IncrementReferens(p1Line2Id, Scene::Point, mode);
data->IncrementReferens(p2Line2Id, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
scene, this, data, parse, Tool::FromFile); scene, this, data, parse, Tool::FromFile);
@ -713,10 +717,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, VModelingLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
this, data, parse, Tool::FromFile); this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(p1Line1Id, Scene::Point, mode);
data->IncrementReferens(p2Line1Id, Scene::Point, mode);
data->IncrementReferens(p1Line2Id, Scene::Point, mode);
data->IncrementReferens(p2Line2Id, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -735,6 +735,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
qint64 center = GetParametrLongLong(domElement, "center"); qint64 center = GetParametrLongLong(domElement, "center");
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint"); qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint"); qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
data->IncrementReferens(center, Scene::Point, mode);
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my,
scene, this, data, parse, Tool::FromFile); scene, this, data, parse, Tool::FromFile);
@ -742,9 +745,6 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
VModelingPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, VModelingPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx,
my, this, data, parse, Tool::FromFile); my, this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(center, Scene::Point, mode);
data->IncrementReferens(firstPointId, Scene::Point, mode);
data->IncrementReferens(secondPointId, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -790,13 +790,14 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement
qint64 id = GetParametrId(domElement); qint64 id = GetParametrId(domElement);
qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint"); qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint");
qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint"); qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint");
data->IncrementReferens(firstPoint, Scene::Point, mode);
data->IncrementReferens(secondPoint, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile); VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile);
} else { } else {
VModelingLine::Create(id, firstPoint, secondPoint, this, data, parse, Tool::FromFile); VModelingLine::Create(id, firstPoint, secondPoint, this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(firstPoint, Scene::Point, mode);
data->IncrementReferens(secondPoint, Scene::Point, mode);
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
VExceptionObjectError excep(tr("Error creating or updating line"), domElement); VExceptionObjectError excep(tr("Error creating or updating line"), domElement);
@ -820,6 +821,8 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
qreal kAsm1 = GetParametrDouble(domElement, "kAsm1"); qreal kAsm1 = GetParametrDouble(domElement, "kAsm1");
qreal kAsm2 = GetParametrDouble(domElement, "kAsm2"); qreal kAsm2 = GetParametrDouble(domElement, "kAsm2");
qreal kCurve = GetParametrDouble(domElement, "kCurve"); qreal kCurve = GetParametrDouble(domElement, "kCurve");
data->IncrementReferens(point1, Scene::Point, mode);
data->IncrementReferens(point4, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this,
data, parse, Tool::FromFile); data, parse, Tool::FromFile);
@ -827,8 +830,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
VModelingSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, this, VModelingSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, this,
data, parse, Tool::FromFile); data, parse, Tool::FromFile);
} }
data->IncrementReferens(point1, Scene::Point, mode);
data->IncrementReferens(point4, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -888,7 +890,6 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
} }
spl.setMode(typeObject); spl.setMode(typeObject);
spl.setIdObject(idObject); spl.setIdObject(idObject);
data->UpdateModelingSpline(id, spl);
if(typeObject == Draw::Calculation){ if(typeObject == Draw::Calculation){
data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Calculation); data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Calculation);
data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Calculation); data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Calculation);
@ -896,6 +897,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Modeling); data->IncrementReferens(spl.GetP1(), Scene::Point, Draw::Modeling);
data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Modeling); data->IncrementReferens(spl.GetP4(), Scene::Point, Draw::Modeling);
} }
data->UpdateModelingSpline(id, spl);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){
@ -951,12 +953,13 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
QString radius = GetParametrString(domElement, "radius"); QString radius = GetParametrString(domElement, "radius");
QString f1 = GetParametrString(domElement, "angle1"); QString f1 = GetParametrString(domElement, "angle1");
QString f2 = GetParametrString(domElement, "angle2"); QString f2 = GetParametrString(domElement, "angle2");
data->IncrementReferens(center, Scene::Point, mode);
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile);
} else { } else {
VModelingArc::Create(id, center, radius, f1, f2, this, data, parse, Tool::FromFile); VModelingArc::Create(id, center, radius, f1, f2, this, data, parse, Tool::FromFile);
} }
data->IncrementReferens(center, Scene::Point, mode);
return; return;
} }
catch(const VExceptionBadId &e){ catch(const VExceptionBadId &e){