Refactoring.
--HG-- branch : develop
This commit is contained in:
parent
185636a550
commit
d8c5fafbc3
|
@ -478,7 +478,7 @@ void VAbstractOperation::SaveSourceDestination(QDomElement &tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VSimpleCurve *VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType curveType)
|
void VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType curveType, SceneObject sceneType)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VAbstractCurve> initCurve = data->GeometricObject<VAbstractCurve>(id);
|
const QSharedPointer<VAbstractCurve> initCurve = data->GeometricObject<VAbstractCurve>(id);
|
||||||
VSimpleCurve *curve = new VSimpleCurve(id, initCurve);
|
VSimpleCurve *curve = new VSimpleCurve(id, initCurve);
|
||||||
|
@ -489,10 +489,13 @@ VSimpleCurve *VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType
|
||||||
{
|
{
|
||||||
contextMenuEvent(event);
|
contextMenuEvent(event);
|
||||||
});
|
});
|
||||||
|
connect(curve, &VSimpleCurve::Choosed, this, [this, sceneType](quint32 id)
|
||||||
|
{
|
||||||
|
emit ChoosedTool(id, sceneType);
|
||||||
|
});
|
||||||
connect(curve, &VSimpleCurve::Delete, this, &VAbstractOperation::DeleteFromLabel);
|
connect(curve, &VSimpleCurve::Delete, this, &VAbstractOperation::DeleteFromLabel);
|
||||||
curve->RefreshGeometry(VAbstractTool::data.GeometricObject<VAbstractCurve>(id));
|
curve->RefreshGeometry(VAbstractTool::data.GeometricObject<VAbstractCurve>(id));
|
||||||
operatedObjects.insert(id, curve);
|
operatedObjects.insert(id, curve);
|
||||||
return curve;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -595,43 +598,19 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GOType::Arc:
|
case GOType::Arc:
|
||||||
{
|
InitCurve(object.id, &(VAbstractTool::data), obj->getType(), SceneObject::Arc);
|
||||||
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
|
||||||
connect(curve, &VSimpleCurve::Choosed, this, [this](quint32 id)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::Arc);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case GOType::EllipticalArc:
|
case GOType::EllipticalArc:
|
||||||
{
|
InitCurve(object.id, &(VAbstractTool::data), obj->getType(), SceneObject::ElArc);
|
||||||
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
|
||||||
connect(curve, &VSimpleCurve::Choosed, this, [this](quint32 id)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::ElArc);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case GOType::Spline:
|
case GOType::Spline:
|
||||||
case GOType::CubicBezier:
|
case GOType::CubicBezier:
|
||||||
{
|
InitCurve(object.id, &(VAbstractTool::data), obj->getType(), SceneObject::Spline);
|
||||||
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
|
||||||
connect(curve, &VSimpleCurve::Choosed, this, [this](quint32 id)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::Spline);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case GOType::SplinePath:
|
case GOType::SplinePath:
|
||||||
case GOType::CubicBezierPath:
|
case GOType::CubicBezierPath:
|
||||||
{
|
InitCurve(object.id, &(VAbstractTool::data), obj->getType(), SceneObject::SplinePath);
|
||||||
VSimpleCurve *curve = InitCurve(object.id, &(VAbstractTool::data), obj->getType());
|
|
||||||
connect(curve, &VSimpleCurve::Choosed, this, [this](quint32 id)
|
|
||||||
{
|
|
||||||
emit ChoosedTool(id, SceneObject::SplinePath);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case GOType::Unknown:
|
case GOType::Unknown:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ protected:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ShowToolVisualization(bool show);
|
void ShowToolVisualization(bool show);
|
||||||
|
|
||||||
VSimpleCurve *InitCurve(quint32 id, VContainer *data, GOType curveType);
|
void InitCurve(quint32 id, VContainer *data, GOType curveType, SceneObject sceneType);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void InitOperationToolConnections(VMainGraphicsScene *scene, T *tool);
|
static void InitOperationToolConnections(VMainGraphicsScene *scene, T *tool);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user