Unfortunately we can't throw template. QGrapthisItem class is not reachable in

this case.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-03-19 10:38:29 +02:00
parent 19265e1f93
commit 30ece7e856
2 changed files with 60 additions and 2 deletions

View File

@ -3115,35 +3115,91 @@ QRectF VPattern::ActiveDrawBoundingRect() const
Q_UNREACHABLE();
break;
case Tool::BasePoint:
rec = ToolBoundingRect<VToolBasePoint>(rec, tool.getId());
break;
case Tool::EndLine:
rec = ToolBoundingRect<VToolEndLine>(rec, tool.getId());
break;
case Tool::Line:
rec = ToolBoundingRect<VToolLine>(rec, tool.getId());
break;
case Tool::AlongLine:
rec = ToolBoundingRect<VToolAlongLine>(rec, tool.getId());
break;
case Tool::ShoulderPoint:
rec = ToolBoundingRect<VToolShoulderPoint>(rec, tool.getId());
break;
case Tool::Normal:
rec = ToolBoundingRect<VToolNormal>(rec, tool.getId());
break;
case Tool::Bisector:
rec = ToolBoundingRect<VToolBisector>(rec, tool.getId());
break;
case Tool::LineIntersect:
rec = ToolBoundingRect<VToolLineIntersect>(rec, tool.getId());
break;
case Tool::Spline:
rec = ToolBoundingRect<VToolSpline>(rec, tool.getId());
break;
case Tool::CubicBezier:
rec = ToolBoundingRect<VToolCubicBezier>(rec, tool.getId());
break;
case Tool::Arc:
rec = ToolBoundingRect<VToolArc>(rec, tool.getId());
break;
case Tool::SplinePath:
rec = ToolBoundingRect<VToolSplinePath>(rec, tool.getId());
break;
case Tool::CubicBezierPath:
rec = ToolBoundingRect<VToolCubicBezierPath>(rec, tool.getId());
break;
case Tool::PointOfContact:
rec = ToolBoundingRect<VToolPointOfContact>(rec, tool.getId());
break;
case Tool::Height:
rec = ToolBoundingRect<VToolHeight>(rec, tool.getId());
break;
case Tool::Triangle:
rec = ToolBoundingRect<VToolTriangle>(rec, tool.getId());
break;
case Tool::PointOfIntersection:
rec = ToolBoundingRect<VToolPointOfIntersection>(rec, tool.getId());
break;
case Tool::CutArc:
rec = ToolBoundingRect<VToolCutArc>(rec, tool.getId());
break;
case Tool::CutSpline:
rec = ToolBoundingRect<VToolCutSpline>(rec, tool.getId());
break;
case Tool::CutSplinePath:
rec = ToolBoundingRect<VToolCutSplinePath>(rec, tool.getId());
break;
case Tool::ArcWithLength:
rec = ToolBoundingRect<VToolArcWithLength>(rec, tool.getId());
break;
case Tool::LineIntersectAxis:
rec = ToolBoundingRect<VToolLineIntersectAxis>(rec, tool.getId());
break;
case Tool::PointOfIntersectionArcs:
rec = ToolBoundingRect<VToolPointOfIntersectionArcs>(rec, tool.getId());
break;
case Tool::PointOfIntersectionCircles:
rec = ToolBoundingRect<VToolPointOfIntersectionCircles>(rec, tool.getId());
break;
case Tool::PointOfIntersectionCurves:
rec = ToolBoundingRect<VToolPointOfIntersectionCurves>(rec, tool.getId());
break;
case Tool::CurveIntersectAxis:
rec = ToolBoundingRect<VToolCurveIntersectAxis>(rec, tool.getId());
break;
case Tool::PointFromCircleAndTangent:
rec = ToolBoundingRect<VToolPointFromCircleAndTangent>(rec, tool.getId());
break;
case Tool::PointFromArcAndTangent:
rec = ToolBoundingRect<VToolPointFromArcAndTangent>(rec, tool.getId());
break;
case Tool::TrueDarts:
rec = ToolBoundingRect(rec, tool.getId());
rec = ToolBoundingRect<VToolTrueDarts>(rec, tool.getId());
break;
//These tools are not accesseble in Draw mode, but still 'history' contains them.
case Tool::Detail:
@ -3164,12 +3220,13 @@ QRectF VPattern::ActiveDrawBoundingRect() const
#endif
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const
{
QRectF recTool = rec;
if (tools.contains(id))
{
const QGraphicsItem *vTool = qobject_cast<QGraphicsItem *>(tools.value(id));
const T *vTool = qobject_cast<T *>(tools.value(id));
SCASSERT(vTool != nullptr);
QRectF childrenRect = vTool->childrenBoundingRect();

View File

@ -135,6 +135,7 @@ private:
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool);
template <typename T>
QRectF ToolBoundingRect(const QRectF &rec, const quint32 &id) const;
void ParseCurrentPP();
QString GetLabelBase(quint32 index)const;