Resolved issue #441. Broken reference incrementation for tool "True Dart point".

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-02-02 15:34:29 +02:00
parent 7fd45ded4e
commit eb9f8f4b60
31 changed files with 181 additions and 105 deletions

View File

@ -1,4 +1,5 @@
# Version 0.4.2
- [#441] Broken reference incrementation for tool "True Dart point".
- [#439] Widen Formula Dialog.
- Fixed broken tool dialogs "Intersection arcs" and "Point from arc and tangent".
- [#442] 'Broken Formula' error when using Intersect Circles tool.

View File

@ -1871,7 +1871,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
path->append(splPoint);
if (parse == Document::FullParse)
{
IncrementReferens(pSpline);
IncrementReferens(p.getIdTool());
}
}
}

View File

@ -180,6 +180,26 @@ void VGObject::setId(const quint32 &id)
d->_id = id;
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VGObject::getIdTool() const
{
if (d->mode == Draw::Calculation)
{
if (d->idObject != NULL_ID)
{
return d->idObject;
}
else
{
return d->_id;
}
}
else
{
return d->_id;
}
}
//---------------------------------------------------------------------------------------------------------------------
QLineF VGObject::BuildLine(const QPointF &p1, const qreal &length, const qreal &angle)
{

View File

@ -68,6 +68,8 @@ public:
quint32 id() const;
virtual void setId(const quint32 &id);
quint32 getIdTool() const;
static QLineF BuildLine(const QPointF &p1, const qreal& length, const qreal &angle);
static QPointF BuildRay(const QPointF &firstPoint, const qreal &angle, const QRectF &scRect);
static QLineF BuildAxis(const QPointF &p, const qreal &angle, const QRectF &scRect);

View File

@ -160,7 +160,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
connect(scene, &VMainGraphicsScene::NewFactor, toolArc, &VToolArc::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, toolArc, &VToolArc::Disable);
doc->AddTool(id, toolArc);
doc->IncrementReferens(center);
doc->IncrementReferens(c.getIdTool());
return toolArc;
}
return nullptr;
@ -310,8 +310,8 @@ void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolArc::RemoveReferens()
{
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
doc->DecrementReferens(arc->GetCenter().id());
const auto arc = VAbstractTool::data.GeometricObject<VArc>(id);
doc->DecrementReferens(arc->GetCenter().getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -129,7 +129,7 @@ VToolArcWithLength *VToolArcWithLength::Create(const quint32 _id, const quint32
connect(scene, &VMainGraphicsScene::NewFactor, toolArc, &VToolArcWithLength::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, toolArc, &VToolArcWithLength::Disable);
doc->AddTool(id, toolArc);
doc->IncrementReferens(center);
doc->IncrementReferens(c.getIdTool());
return toolArc;
}
return nullptr;
@ -269,8 +269,8 @@ void VToolArcWithLength::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::RemoveReferens()
{
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
doc->DecrementReferens(arc->GetCenter().id());
const auto arc = VAbstractTool::data.GeometricObject<VArc>(id);
doc->DecrementReferens(arc->GetCenter().getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -201,8 +201,8 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui
connect(scene, &VMainGraphicsScene::EnableToolMove, spl, &VToolSpline::EnableToolMove);
connect(scene, &VMainGraphicsScene::CurveDetailsMode, spl, &VToolSpline::DetailsMode);
doc->AddTool(id, spl);
doc->IncrementReferens(p1);
doc->IncrementReferens(p4);
doc->IncrementReferens(point1.getIdTool());
doc->IncrementReferens(point4.getIdTool());
return spl;
}
return nullptr;
@ -287,9 +287,9 @@ void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolSpline::RemoveReferens()
{
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
doc->DecrementReferens(spl->GetP1().id());
doc->DecrementReferens(spl->GetP4().id());
const auto spl = VAbstractTool::data.GeometricObject<VSpline>(id);
doc->DecrementReferens(spl->GetP1().getIdTool());
doc->DecrementReferens(spl->GetP4().getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -130,7 +130,7 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
const QString color = dialogTool->GetColor();
for (qint32 i = 0; i < path->CountPoint(); ++i)
{
doc->IncrementReferens((*path)[i].P().id());
doc->IncrementReferens((*path)[i].P().getIdTool());
}
VToolSplinePath* spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
@ -371,10 +371,10 @@ void VToolSplinePath::AddPathPoint(VAbstractPattern *doc, QDomElement &domElemen
*/
void VToolSplinePath::RemoveReferens()
{
VSplinePath splPath = *VAbstractTool::data.GeometricObject<VSplinePath>(id);
const VSplinePath splPath = *VAbstractTool::data.GeometricObject<VSplinePath>(id);
for (qint32 i = 0; i < splPath.Count(); ++i)
{
doc->DecrementReferens(splPath.at(i).P().id());
doc->DecrementReferens(splPath.at(i).P().getIdTool());
}
}

View File

@ -159,13 +159,13 @@ VToolTrueDarts *VToolTrueDarts::Create(quint32 _id,
if (typeCreation == Source::FromGui)
{
id = data->getNextId();//Just reserve id for tool
p1id = data->AddGObject(new VPointF(fPoint1, point1Name, mx1, my1));
p2id = data->AddGObject(new VPointF(fPoint2, point2Name, mx2, my2));
p1id = data->AddGObject(new VPointF(fPoint1, point1Name, mx1, my1, id));
p2id = data->AddGObject(new VPointF(fPoint2, point2Name, mx2, my2, id));
}
else
{
data->UpdateGObject(p1id, new VPointF(fPoint1, point1Name, mx1, my1));
data->UpdateGObject(p2id, new VPointF(fPoint2, point2Name, mx2, my2));
data->UpdateGObject(p1id, new VPointF(fPoint1, point1Name, mx1, my1, id));
data->UpdateGObject(p2id, new VPointF(fPoint2, point2Name, mx2, my2, id));
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);
@ -182,11 +182,11 @@ VToolTrueDarts *VToolTrueDarts::Create(quint32 _id,
connect(scene, &VMainGraphicsScene::DisableItem, points, &VToolTrueDarts::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, points, &VToolTrueDarts::EnableToolMove);
doc->AddTool(id, points);
doc->IncrementReferens(baseLineP1Id);
doc->IncrementReferens(baseLineP2Id);
doc->IncrementReferens(dartP1Id);
doc->IncrementReferens(dartP2Id);
doc->IncrementReferens(dartP3Id);
doc->IncrementReferens(baseLineP1->getIdTool());
doc->IncrementReferens(baseLineP2->getIdTool());
doc->IncrementReferens(dartP1->getIdTool());
doc->IncrementReferens(dartP2->getIdTool());
doc->IncrementReferens(dartP3->getIdTool());
return points;
}
return nullptr;
@ -305,11 +305,17 @@ void VToolTrueDarts::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::RemoveReferens()
{
doc->DecrementReferens(baseLineP1Id);
doc->DecrementReferens(baseLineP2Id);
doc->DecrementReferens(dartP1Id);
doc->DecrementReferens(dartP2Id);
doc->DecrementReferens(dartP3Id);
const auto baseLineP1 = VAbstractTool::data.GetGObject(baseLineP1Id);
const auto baseLineP2 = VAbstractTool::data.GetGObject(baseLineP2Id);
const auto dartP1 = VAbstractTool::data.GetGObject(dartP1Id);
const auto dartP2 = VAbstractTool::data.GetGObject(dartP2Id);
const auto dartP3 = VAbstractTool::data.GetGObject(dartP3Id);
doc->DecrementReferens(baseLineP1->getIdTool());
doc->DecrementReferens(baseLineP2->getIdTool());
doc->DecrementReferens(dartP1->getIdTool());
doc->DecrementReferens(dartP2->getIdTool());
doc->DecrementReferens(dartP3->getIdTool());
VToolDoublePoint::RemoveReferens();
}

View File

@ -123,7 +123,9 @@ void VToolCut::RefreshGeometry()
*/
void VToolCut::RemoveReferens()
{
doc->DecrementReferens(curveCutId);
const auto curve = VAbstractTool::data.GetGObject(curveCutId);
doc->DecrementReferens(curve->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -170,7 +170,7 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
doc->AddTool(id, point);
doc->AddTool(arc1id, point);
doc->AddTool(arc2id, point);
doc->IncrementReferens(arcId);
doc->IncrementReferens(arc->getIdTool());
return point;
}
return nullptr;

View File

@ -178,7 +178,7 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
doc->AddTool(id, point);
doc->AddTool(spl1id, point);
doc->AddTool(spl2id, point);
doc->IncrementReferens(splineId);
doc->IncrementReferens(spl->getIdTool());
return point;
}
return nullptr;

View File

@ -222,7 +222,7 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
doc->AddTool(id, point);
doc->AddTool(splPath1id, point);
doc->AddTool(splPath2id, point);
doc->IncrementReferens(splinePathId);
doc->IncrementReferens(splPath->getIdTool());
return point;
}
return nullptr;

View File

@ -94,7 +94,8 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolAlongLine::RemoveReferens()
{
doc->DecrementReferens(secondPointId);
const auto secondPoint = VAbstractTool::data.GetGObject(secondPointId);
doc->DecrementReferens(secondPoint->getIdTool());
VToolLinePoint::RemoveReferens();
}
@ -279,8 +280,8 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolAlongLine::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolAlongLine::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
return point;
}
return nullptr;

View File

@ -205,9 +205,9 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolBisector::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolBisector::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(thirdPointId);
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
doc->IncrementReferens(thirdPoint->getIdTool());
return point;
}
return nullptr;
@ -248,8 +248,11 @@ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolBisector::RemoveReferens()
{
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(thirdPointId);
const auto firstPoint = VAbstractTool::data.GetGObject(firstPointId);
const auto thirdPoint = VAbstractTool::data.GetGObject(thirdPointId);
doc->DecrementReferens(firstPoint->getIdTool());
doc->DecrementReferens(thirdPoint->getIdTool());
VToolLinePoint::RemoveReferens();
}

View File

@ -134,8 +134,8 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolCurveIntersectAxis::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolCurveIntersectAxis::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(basePointId);
doc->IncrementReferens(curveId);
doc->IncrementReferens(basePoint->getIdTool());
doc->IncrementReferens(curve->getIdTool());
return point;
}
return nullptr;

View File

@ -170,7 +170,7 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolEndLine::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolEndLine::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(basePointId);
doc->IncrementReferens(basePoint->getIdTool());
return point;
}
return nullptr;

View File

@ -162,9 +162,9 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolHeight::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolHeight::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(basePointId);
doc->IncrementReferens(p1LineId);
doc->IncrementReferens(p2LineId);
doc->IncrementReferens(basePoint->getIdTool());
doc->IncrementReferens(p1Line->getIdTool());
doc->IncrementReferens(p2Line->getIdTool());
return point;
}
return nullptr;

View File

@ -145,9 +145,9 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolLineIntersectAxis::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolLineIntersectAxis::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(basePointId);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(basePoint->getIdTool());
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
return point;
}
return nullptr;

View File

@ -86,7 +86,8 @@ void VToolLinePoint::RefreshGeometry()
*/
void VToolLinePoint::RemoveReferens()
{
doc->DecrementReferens(basePointId);
const auto basePoint = VAbstractTool::data.GetGObject(basePointId);
doc->DecrementReferens(basePoint->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -165,8 +165,8 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolNormal::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolNormal::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
return point;
}
return nullptr;
@ -226,7 +226,8 @@ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolNormal::RemoveReferens()
{
doc->DecrementReferens(secondPointId);
const auto secondPoint = VAbstractTool::data.GetGObject(secondPointId);
doc->DecrementReferens(secondPoint->getIdTool());
VToolLinePoint::RemoveReferens();
}

View File

@ -209,9 +209,9 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolShoulderPoint::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolShoulderPoint::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(p1Line);
doc->IncrementReferens(p2Line);
doc->IncrementReferens(pShoulder);
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
doc->IncrementReferens(shoulderPoint->getIdTool());
return point;
}
return nullptr;
@ -252,8 +252,11 @@ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolShoulderPoint::RemoveReferens()
{
doc->DecrementReferens(p2Line);
doc->DecrementReferens(pShoulder);
const auto p2 = VAbstractTool::data.GetGObject(p2Line);
const auto pS = VAbstractTool::data.GetGObject(pShoulder);
doc->DecrementReferens(p2->getIdTool());
doc->DecrementReferens(pS->getIdTool());
VToolLinePoint::RemoveReferens();
}

View File

@ -169,10 +169,10 @@ VToolLineIntersect* VToolLineIntersect::Create(const quint32 _id, const quint32
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolLineIntersect::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolLineIntersect::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(p1Line1Id);
doc->IncrementReferens(p2Line1Id);
doc->IncrementReferens(p1Line2Id);
doc->IncrementReferens(p2Line2Id);
doc->IncrementReferens(p1Line1->getIdTool());
doc->IncrementReferens(p2Line1->getIdTool());
doc->IncrementReferens(p1Line2->getIdTool());
doc->IncrementReferens(p2Line2->getIdTool());
return point;
}
}
@ -214,10 +214,15 @@ void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
*/
void VToolLineIntersect::RemoveReferens()
{
doc->DecrementReferens(p1Line1);
doc->DecrementReferens(p2Line1);
doc->DecrementReferens(p1Line2);
doc->DecrementReferens(p2Line2);
const auto p1L1 = VAbstractTool::data.GetGObject(p1Line1);
const auto p2L1 = VAbstractTool::data.GetGObject(p2Line1);
const auto p1L2 = VAbstractTool::data.GetGObject(p1Line2);
const auto p2L2 = VAbstractTool::data.GetGObject(p2Line2);
doc->DecrementReferens(p1L1->getIdTool());
doc->DecrementReferens(p2L1->getIdTool());
doc->DecrementReferens(p1L2->getIdTool());
doc->DecrementReferens(p2L2->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -113,8 +113,8 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(const quint32 _
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointFromArcAndTangent::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointFromArcAndTangent::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(arcId);
doc->IncrementReferens(tangentPointId);
doc->IncrementReferens(arc.getIdTool());
doc->IncrementReferens(tPoint.getIdTool());
return point;
}
return nullptr;
@ -260,8 +260,11 @@ void VToolPointFromArcAndTangent::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::RemoveReferens()
{
doc->DecrementReferens(arcId);
doc->DecrementReferens(tangentPointId);
const auto arc = VAbstractTool::data.GetGObject(arcId);
const auto tP = VAbstractTool::data.GetGObject(tangentPointId);
doc->DecrementReferens(arc->getIdTool());
doc->DecrementReferens(tP->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -123,8 +123,8 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(const qui
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointFromCircleAndTangent::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointFromCircleAndTangent::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(circleCenterId);
doc->IncrementReferens(tangentPointId);
doc->IncrementReferens(cPoint.getIdTool());
doc->IncrementReferens(tPoint.getIdTool());
return point;
}
return nullptr;
@ -244,8 +244,11 @@ void VToolPointFromCircleAndTangent::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::RemoveReferens()
{
doc->DecrementReferens(circleCenterId);
doc->DecrementReferens(tangentPointId);
const auto circleCenter = VAbstractTool::data.GetGObject(circleCenterId);
const auto tangentPoint = VAbstractTool::data.GetGObject(tangentPointId);
doc->DecrementReferens(circleCenter->getIdTool());
doc->DecrementReferens(tangentPoint->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -225,9 +225,9 @@ VToolPointOfContact* VToolPointOfContact::Create(const quint32 _id, QString &rad
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfContact::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfContact::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(center);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(centerP->getIdTool());
doc->IncrementReferens(firstP->getIdTool());
doc->IncrementReferens(secondP->getIdTool());
return point;
}
return nullptr;
@ -268,9 +268,13 @@ void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
*/
void VToolPointOfContact::RemoveReferens()
{
doc->DecrementReferens(center);
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(secondPointId);
const auto c = VAbstractTool::data.GetGObject(center);
const auto firstPoint = VAbstractTool::data.GetGObject(firstPointId);
const auto secondPoint = VAbstractTool::data.GetGObject(secondPointId);
doc->DecrementReferens(c->getIdTool());
doc->DecrementReferens(firstPoint->getIdTool());
doc->DecrementReferens(secondPoint->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -146,8 +146,8 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersection::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersection::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
return point;
}
return nullptr;
@ -159,8 +159,11 @@ VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, co
*/
void VToolPointOfIntersection::RemoveReferens()
{
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(secondPointId);
const auto firstPoint = VAbstractTool::data.GetGObject(firstPointId);
const auto secondPoint = VAbstractTool::data.GetGObject(secondPointId);
doc->DecrementReferens(firstPoint->getIdTool());
doc->DecrementReferens(secondPoint->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -114,8 +114,8 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersectionArcs::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersectionArcs::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstArcId);
doc->IncrementReferens(secondArcId);
doc->IncrementReferens(firstArc->getIdTool());
doc->IncrementReferens(secondArc->getIdTool());
return point;
}
return nullptr;
@ -267,8 +267,11 @@ void VToolPointOfIntersectionArcs::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::RemoveReferens()
{
doc->DecrementReferens(firstArcId);
doc->DecrementReferens(secondArcId);
const auto firstArc = VAbstractTool::data.GetGObject(firstArcId);
const auto secondArc = VAbstractTool::data.GetGObject(secondArcId);
doc->DecrementReferens(firstArc->getIdTool());
doc->DecrementReferens(secondArc->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -135,8 +135,8 @@ VToolPointOfIntersectionCircles *VToolPointOfIntersectionCircles::Create(const q
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersectionCircles::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersectionCircles::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(firstCircleCenterId);
doc->IncrementReferens(secondCircleCenterId);
doc->IncrementReferens(c1Point.getIdTool());
doc->IncrementReferens(c2Point.getIdTool());
return point;
}
return nullptr;
@ -280,8 +280,11 @@ void VToolPointOfIntersectionCircles::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::RemoveReferens()
{
doc->DecrementReferens(firstCircleCenterId);
doc->DecrementReferens(secondCircleCenterId);
const auto firstCircleCenter = VAbstractTool::data.GetGObject(firstCircleCenterId);
const auto secondCircleCenter = VAbstractTool::data.GetGObject(secondCircleCenterId);
doc->DecrementReferens(firstCircleCenter->getIdTool());
doc->DecrementReferens(secondCircleCenter->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -156,10 +156,10 @@ VToolTriangle* VToolTriangle::Create(const quint32 _id, const QString &pointName
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolTriangle::Disable);
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolTriangle::EnableToolMove);
doc->AddTool(id, point);
doc->IncrementReferens(axisP1Id);
doc->IncrementReferens(axisP2Id);
doc->IncrementReferens(firstPointId);
doc->IncrementReferens(secondPointId);
doc->IncrementReferens(axisP1->getIdTool());
doc->IncrementReferens(axisP2->getIdTool());
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
return point;
}
return nullptr;
@ -213,10 +213,15 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c
*/
void VToolTriangle::RemoveReferens()
{
doc->DecrementReferens(axisP1Id);
doc->DecrementReferens(axisP2Id);
doc->DecrementReferens(firstPointId);
doc->DecrementReferens(secondPointId);
const auto axisP1 = VAbstractTool::data.GetGObject(axisP1Id);
const auto axisP2 = VAbstractTool::data.GetGObject(axisP2Id);
const auto firstPoint = VAbstractTool::data.GetGObject(firstPointId);
const auto secondPoint = VAbstractTool::data.GetGObject(secondPointId);
doc->DecrementReferens(axisP1->getIdTool());
doc->DecrementReferens(axisP2->getIdTool());
doc->DecrementReferens(firstPoint->getIdTool());
doc->DecrementReferens(secondPoint->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -155,8 +155,12 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
connect(scene, &VMainGraphicsScene::DisableItem, line, &VToolLine::Disable);
doc->AddTool(id, line);
doc->IncrementReferens(firstPoint);
doc->IncrementReferens(secondPoint);
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
doc->IncrementReferens(first->getIdTool());
doc->IncrementReferens(second->getIdTool());
return line;
}
return nullptr;
@ -307,8 +311,11 @@ void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
*/
void VToolLine::RemoveReferens()
{
doc->DecrementReferens(firstPoint);
doc->DecrementReferens(secondPoint);
const auto p1 = VAbstractTool::data.GetGObject(firstPoint);
const auto p2 = VAbstractTool::data.GetGObject(secondPoint);
doc->DecrementReferens(p1->getIdTool());
doc->DecrementReferens(p2->getIdTool());
}
//---------------------------------------------------------------------------------------------------------------------