Merged change from default branch.
--HG-- branch : feature
This commit is contained in:
commit
18aa3d71d5
|
@ -33,6 +33,7 @@ public:
|
|||
VPointF (const VPointF &point );
|
||||
VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, Draw::Draws mode = Draw::Calculation,
|
||||
qint64 idObject = 0);
|
||||
VPointF &operator=(const VPointF &point);
|
||||
~VPointF();
|
||||
QString name() const;
|
||||
qreal mx() const;
|
||||
|
|
|
@ -50,10 +50,13 @@ protected:
|
|||
bool showRemove = true){
|
||||
if(!ignoreContextMenuEvent){
|
||||
QMenu menu;
|
||||
QAction *actionOption = menu.addAction("Властивості");
|
||||
QAction *actionOption = menu.addAction(tr("Options"));
|
||||
QAction *actionRemove;
|
||||
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());
|
||||
if(selectedAction == actionOption){
|
||||
|
|
|
@ -65,7 +65,12 @@ void VToolAlongLine::FullUpdateFromGui(int result){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolAlongLine::AddToFile(){
|
||||
|
|
|
@ -156,7 +156,12 @@ void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolArc::AddToFile(){
|
||||
|
|
|
@ -147,7 +147,12 @@ void VToolBisector::FullUpdateFromGui(int result){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolBisector::AddToFile(){
|
||||
|
|
|
@ -79,10 +79,9 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
|
|||
if(parse != Document::FullParse){
|
||||
QMap<qint64, VDataTool*>* tools = doc->getTools();
|
||||
VDataTool *tool = tools->value(id);
|
||||
if(tool != 0){
|
||||
tool->VDataTool::setData(data);
|
||||
Q_CHECK_PTR(tool);
|
||||
data->IncrementReferens(id, Scene::Point);
|
||||
}
|
||||
tool->VDataTool::setData(data);
|
||||
}
|
||||
}
|
||||
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::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
QMap<qint64, VDataTool*>* tools = doc->getTools();
|
||||
Q_CHECK_PTR(tools);
|
||||
tools->insert(id,point);
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,12 @@ void VToolEndLine::FullUpdateFromFile(){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolEndLine::FullUpdateFromGui(int result){
|
||||
|
|
|
@ -128,7 +128,12 @@ void VToolLineIntersect::FullUpdateFromGui(int result){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLineIntersect::AddToFile(){
|
||||
|
|
|
@ -138,7 +138,12 @@ void VToolNormal::FullUpdateFromGui(int result){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolNormal::AddToFile(){
|
||||
|
|
|
@ -147,7 +147,12 @@ void VToolPointOfContact::FullUpdateFromGui(int result){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolPointOfContact::AddToFile(){
|
||||
|
|
|
@ -156,7 +156,12 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolShoulderPoint::AddToFile(){
|
||||
|
|
|
@ -177,7 +177,12 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePo
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSpline::AddToFile(){
|
||||
|
|
|
@ -216,7 +216,12 @@ void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSplinePath::AddToFile(){
|
||||
|
|
|
@ -567,6 +567,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
QString formula = GetParametrString(domElement, "length");
|
||||
qint64 basePointId = GetParametrLongLong(domElement, "basePoint");
|
||||
qreal angle = GetParametrDouble(domElement, "angle");
|
||||
data->IncrementReferens(basePointId, Scene::Point, mode);
|
||||
if(mode == Draw::Calculation){
|
||||
VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, mx, my, scene, this,
|
||||
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,
|
||||
data, parse, Tool::FromFile);
|
||||
}
|
||||
data->IncrementReferens(basePointId, Scene::Point, mode);
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -593,6 +593,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
QString formula = GetParametrString(domElement, "length");
|
||||
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
||||
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
||||
data->IncrementReferens(firstPointId, Scene::Point, mode);
|
||||
data->IncrementReferens(secondPointId, Scene::Point, mode);
|
||||
if(mode == Draw::Calculation){
|
||||
VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my,
|
||||
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,
|
||||
this, data, parse, Tool::FromFile);
|
||||
}
|
||||
data->IncrementReferens(firstPointId, Scene::Point, mode);
|
||||
data->IncrementReferens(secondPointId, Scene::Point, mode);
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -621,6 +621,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
qint64 p1Line = GetParametrLongLong(domElement, "p1Line");
|
||||
qint64 p2Line = GetParametrLongLong(domElement, "p2Line");
|
||||
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){
|
||||
VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my,
|
||||
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,
|
||||
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;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -650,6 +650,8 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
||||
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
||||
qreal angle = GetParametrDouble(domElement, "angle");
|
||||
data->IncrementReferens(firstPointId, Scene::Point, mode);
|
||||
data->IncrementReferens(secondPointId, Scene::Point, mode);
|
||||
if(mode == Draw::Calculation){
|
||||
VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle,
|
||||
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,
|
||||
mx, my, this, data, parse, Tool::FromFile);
|
||||
}
|
||||
data->IncrementReferens(firstPointId, Scene::Point, mode);
|
||||
data->IncrementReferens(secondPointId, Scene::Point, mode);
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -678,6 +678,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
||||
qint64 secondPointId = GetParametrLongLong(domElement, "secondPoint");
|
||||
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){
|
||||
VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine,
|
||||
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,
|
||||
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;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -706,6 +706,10 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
qint64 p2Line1Id = GetParametrLongLong(domElement, "p2Line1");
|
||||
qint64 p1Line2Id = GetParametrLongLong(domElement, "p1Line2");
|
||||
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){
|
||||
VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my,
|
||||
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,
|
||||
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;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -735,6 +735,9 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
qint64 center = GetParametrLongLong(domElement, "center");
|
||||
qint64 firstPointId = GetParametrLongLong(domElement, "firstPoint");
|
||||
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){
|
||||
VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my,
|
||||
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,
|
||||
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;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -790,13 +790,14 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement
|
|||
qint64 id = GetParametrId(domElement);
|
||||
qint64 firstPoint = GetParametrLongLong(domElement, "firstPoint");
|
||||
qint64 secondPoint = GetParametrLongLong(domElement, "secondPoint");
|
||||
data->IncrementReferens(firstPoint, Scene::Point, mode);
|
||||
data->IncrementReferens(secondPoint, Scene::Point, mode);
|
||||
if(mode == Draw::Calculation){
|
||||
VToolLine::Create(id, firstPoint, secondPoint, scene, this, data, parse, Tool::FromFile);
|
||||
} else {
|
||||
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){
|
||||
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 kAsm2 = GetParametrDouble(domElement, "kAsm2");
|
||||
qreal kCurve = GetParametrDouble(domElement, "kCurve");
|
||||
data->IncrementReferens(point1, Scene::Point, mode);
|
||||
data->IncrementReferens(point4, Scene::Point, mode);
|
||||
if(mode == Draw::Calculation){
|
||||
VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this,
|
||||
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,
|
||||
data, parse, Tool::FromFile);
|
||||
}
|
||||
data->IncrementReferens(point1, Scene::Point, mode);
|
||||
data->IncrementReferens(point4, Scene::Point, mode);
|
||||
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -888,7 +890,6 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
|
|||
}
|
||||
spl.setMode(typeObject);
|
||||
spl.setIdObject(idObject);
|
||||
data->UpdateModelingSpline(id, spl);
|
||||
if(typeObject == Draw::Calculation){
|
||||
data->IncrementReferens(spl.GetP1(), 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.GetP4(), Scene::Point, Draw::Modeling);
|
||||
}
|
||||
data->UpdateModelingSpline(id, spl);
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
@ -951,12 +953,13 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
|
|||
QString radius = GetParametrString(domElement, "radius");
|
||||
QString f1 = GetParametrString(domElement, "angle1");
|
||||
QString f2 = GetParametrString(domElement, "angle2");
|
||||
data->IncrementReferens(center, Scene::Point, mode);
|
||||
if(mode == Draw::Calculation){
|
||||
VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile);
|
||||
} else {
|
||||
VModelingArc::Create(id, center, radius, f1, f2, this, data, parse, Tool::FromFile);
|
||||
}
|
||||
data->IncrementReferens(center, Scene::Point, mode);
|
||||
|
||||
return;
|
||||
}
|
||||
catch(const VExceptionBadId &e){
|
||||
|
|
Loading…
Reference in New Issue
Block a user