Little optimization.

--HG--
branch : develop
This commit is contained in:
dismine 2013-11-07 16:40:39 +02:00
parent 40c58022e7
commit 3119c75981
33 changed files with 74 additions and 66 deletions

View File

@ -163,7 +163,7 @@ QPainterPath VContainer::ContourPath(qint64 idDetail) const
VDetail detail = GetDetail(idDetail); VDetail detail = GetDetail(idDetail);
QVector<QPointF> points; QVector<QPointF> points;
QVector<QPointF> pointsEkv; QVector<QPointF> pointsEkv;
for (qint32 i = 0; i< detail.CountNode(); ++i) for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
{ {
switch (detail[i].getTypeTool()) switch (detail[i].getTypeTool())
{ {

View File

@ -188,7 +188,7 @@ void DialogDetail::setDetails(const VDetail &value)
{ {
details = value; details = value;
ui.listWidget->clear(); ui.listWidget->clear();
for (qint32 i = 0; i < details.CountNode(); ++i) for (ptrdiff_t i = 0; i < details.CountNode(); ++i)
{ {
NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(), NewItem(details[i].getId(), details[i].getTypeTool(), details[i].getMode(), details[i].getTypeNode(),
details[i].getMx(), details[i].getMy()); details[i].getMx(), details[i].getMy());

View File

@ -79,7 +79,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
return; return;
} }
VDetail det = data->GetDetail(idDetail); VDetail det = data->GetDetail(idDetail);
for (qint32 i = 0; i< det.CountNode(); ++i) for (ptrdiff_t i = 0; i< det.CountNode(); ++i)
{ {
if (det[i].getTypeTool() == Tool::NodePoint || if (det[i].getTypeTool() == Tool::NodePoint ||
det[i].getTypeTool() == Tool::AlongLineTool || det[i].getTypeTool() == Tool::AlongLineTool ||

View File

@ -76,7 +76,7 @@ void VSpline::ModifiSpl ( qint64 p1, qint64 p4, qreal angle1, qreal angle2,
this->p3 = p4p3.p2(); this->p3 = p4p3.p2();
} }
void VSpline::ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve) void VSpline::ModifiSpl (const qint64 &p1, const QPointF &p2, const QPointF &p3, const qint64 &p4, const qreal &kCurve)
{ {
this->p1 = p1; this->p1 = p1;
this->p2 = p2; this->p2 = p2;
@ -278,7 +278,7 @@ QVector<QPointF> VSpline::GetPoints () const
// } // }
} }
QVector<QPointF> VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF p4) QVector<QPointF> VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
{ {
QVector<QPointF> pvector; QVector<QPointF> pvector;
QVector<qreal> x; QVector<qreal> x;
@ -298,7 +298,7 @@ QVector<QPointF> VSpline::GetPoints (QPointF p1, QPointF p2, QPointF p3, QPointF
return pvector; return pvector;
} }
qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const
{ {
QPainterPath splinePath; QPainterPath splinePath;
QVector<QPointF> points = GetPoints (p1, p2, p3, p4); QVector<QPointF> points = GetPoints (p1, p2, p3, p4);
@ -351,8 +351,8 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
double dx = x4-x1; double dx = x4-x1;
double dy = y4-y1; double dy = y4-y1;
double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx)); double d2 = fabs((x2 - x4) * dy - (y2 - y4) * dx);
double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx)); double d3 = fabs((x3 - x4) * dy - (y3 - y4) * dx);
double da1, da2, k; double da1, da2, k;
switch ((static_cast<int>(d2 > curve_collinearity_epsilon) << 1) + switch ((static_cast<int>(d2 > curve_collinearity_epsilon) << 1) +
@ -747,7 +747,7 @@ QPainterPath VSpline::GetPath() const
// this->ModifiSpl(P1, P2, P3, P4); // this->ModifiSpl(P1, P2, P3, P4);
//} //}
QVector<QPointF> VSpline::SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve) qreal kAsm2, qreal kCurve)
{ {
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y()); QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());

View File

@ -79,7 +79,8 @@ public:
* @param p3 друга контролююча точка сплайну. * @param p3 друга контролююча точка сплайну.
* @param p4 кінцева точка сплайну. * @param p4 кінцева точка сплайну.
*/ */
void ModifiSpl (qint64 p1, QPointF p2, QPointF p3, qint64 p4, qreal kCurve); void ModifiSpl (const qint64 &p1, const QPointF &p2, const QPointF &p3, const qint64 &p4,
const qreal &kCurve);
/** /**
* @brief RotationSpl поворот сплайна навколо точки на кут в градусах проти годиникової стрілки. * @brief RotationSpl поворот сплайна навколо точки на кут в градусах проти годиникової стрілки.
* @param pRotate точка навколо якої повертаємо. * @param pRotate точка навколо якої повертаємо.
@ -178,8 +179,8 @@ public:
// void Mirror(const QPointF Pmirror); // void Mirror(const QPointF Pmirror);
inline Draw::Draws getMode() const {return mode;} inline Draw::Draws getMode() const {return mode;}
inline void setMode(const Draw::Draws &value) {mode = value;} inline void setMode(const Draw::Draws &value) {mode = value;}
static QVector<QPointF> SplinePoints(QPointF p1, QPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, static QVector<QPointF> SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kCurve); qreal kAsm2, qreal kCurve);
inline qint64 getIdObject() const {return idObject;} inline qint64 getIdObject() const {return idObject;}
inline void setIdObject(const qint64 &value) {idObject = value;} inline void setIdObject(const qint64 &value) {idObject = value;}
VSpline &operator=(const VSpline &spl); VSpline &operator=(const VSpline &spl);
@ -192,7 +193,7 @@ protected:
* @param p4 кінцева точка сплайну. * @param p4 кінцева точка сплайну.
* @return список точок. * @return список точок.
*/ */
static QVector<QPointF> GetPoints ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ); static QVector<QPointF> GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 );
private: private:
/** /**
* @brief p1 початкова точка сплайну * @brief p1 початкова точка сплайну
@ -232,7 +233,7 @@ private:
* @param p4 кінцева точка сплайну. * @param p4 кінцева точка сплайну.
* @return дожина сплайну. * @return дожина сплайну.
*/ */
qreal LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) const; qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const;
/** /**
* @brief PointBezier_r знаходить точки сплайну по його чотирьом точках. * @brief PointBezier_r знаходить точки сплайну по його чотирьом точках.
* @param x1 х координата першої точки сплайну. * @param x1 х координата першої точки сплайну.

View File

@ -32,7 +32,7 @@ VSplinePath::VSplinePath(const VSplinePath &splPath)
: path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()), : path(*splPath.GetPoint()), kCurve(splPath.getKCurve()), mode(splPath.getMode()), points(splPath.GetDataPoints()),
idObject(splPath.getIdObject()){} idObject(splPath.getIdObject()){}
void VSplinePath::append(VSplinePoint point) void VSplinePath::append(const VSplinePoint &point)
{ {
path.append(point); path.append(point);
} }
@ -104,7 +104,7 @@ qreal VSplinePath::GetLength() const
return length; return length;
} }
void VSplinePath::UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point) void VSplinePath::UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point)
{ {
if (indexSpline < 1 || indexSpline > Count()) if (indexSpline < 1 || indexSpline > Count())
{ {

View File

@ -55,7 +55,7 @@ public:
* @brief append додає точку сплайну до шляху. * @brief append додає точку сплайну до шляху.
* @param point точка. * @param point точка.
*/ */
void append(VSplinePoint point); void append(const VSplinePoint &point);
qint32 Count() const; qint32 Count() const;
inline qint32 CountPoint() const {return path.size();} inline qint32 CountPoint() const {return path.size();}
VSpline GetSpline(qint32 index) const; VSpline GetSpline(qint32 index) const;
@ -64,7 +64,7 @@ public:
inline QVector<VSplinePoint> GetSplinePath() const {return path;} inline QVector<VSplinePoint> GetSplinePath() const {return path;}
qreal GetLength() const; qreal GetLength() const;
inline QHash<qint64, VPointF> GetDataPoints() const {return points;} inline QHash<qint64, VPointF> GetDataPoints() const {return points;}
void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point); void UpdatePoint(qint32 indexSpline, const SplinePoint::Position &pos, const VSplinePoint &point);
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const; VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
/** /**
* @brief Clear очищає шлях сплайнів. * @brief Clear очищає шлях сплайнів.

View File

@ -64,7 +64,7 @@ void VToolNormal::Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScen
} }
void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine, const QString pointName, const qint64 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation) const Tool::Sources &typeCreation)

View File

@ -31,12 +31,13 @@ class VToolNormal : public VToolLinePoint
public: public:
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const qint64 &firstPointId, const QString &formula, const qreal &angle, const qint64 &firstPointId,
const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); const qint64 &secondPointId, const Tool::Sources &typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScene *scene, VDomDocument *doc, static void Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data); VContainer *data);
static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine, const QString pointName, const qint64 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data, const Document::Documents &parse, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
const Tool::Sources &typeCreation); const Tool::Sources &typeCreation);

View File

@ -36,7 +36,7 @@ VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphics
RefreshPointGeometry(VAbstractTool::data.GetPoint(id)); RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
} }
void VToolPoint::NameChangePosition(const QPointF pos) void VToolPoint::NameChangePosition(const QPointF &pos)
{ {
VPointF point = VAbstractTool::data.GetPoint(id); VPointF point = VAbstractTool::data.GetPoint(id);
QPointF p = pos - this->pos(); QPointF p = pos - this->pos();

View File

@ -33,7 +33,7 @@ public:
virtual ~VToolPoint(){} virtual ~VToolPoint(){}
static const QString TagName; static const QString TagName;
public slots: public slots:
void NameChangePosition(const QPointF pos); void NameChangePosition(const QPointF &pos);
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
virtual void FullUpdateFromGui(int result) = 0; virtual void FullUpdateFromGui(int result) = 0;
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);

View File

@ -167,8 +167,8 @@ void VToolSpline::FullUpdateFromGui(int result)
dialogSpline.clear(); dialogSpline.clear();
} }
void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
const QPointF pos) const QPointF &pos)
{ {
Q_UNUSED(indexSpline); Q_UNUSED(indexSpline);
VSpline spl = VAbstractTool::data.GetSpline(id); VSpline spl = VAbstractTool::data.GetSpline(id);

View File

@ -50,8 +50,8 @@ signals:
public slots: public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
virtual void FullUpdateFromGui ( int result ); virtual void FullUpdateFromGui ( int result );
void ControlPointChangePosition ( const qint32 &indexSpline, SplinePoint::Position position, void ControlPointChangePosition (const qint32 &indexSpline, const SplinePoint::Position &position,
const QPointF pos); const QPointF &pos);
virtual void ChangedActivDraw ( const QString &newName ); virtual void ChangedActivDraw ( const QString &newName );
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -156,8 +156,8 @@ void VToolSplinePath::FullUpdateFromGui(int result)
dialogSplinePath.clear(); dialogSplinePath.clear();
} }
void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
const QPointF pos) const QPointF &pos)
{ {
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id); VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
VSpline spl = splPath.GetSpline(indexSpline); VSpline spl = splPath.GetSpline(indexSpline);

View File

@ -48,8 +48,8 @@ signals:
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position,
const QPointF pos); const QPointF &pos);
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);

View File

@ -101,8 +101,8 @@ void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qin
} }
} }
QPointF VToolTriangle::FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint,
const QPointF secondPoint) const QPointF &secondPoint)
{ {
qreal c = QLineF(firstPoint, secondPoint).length(); qreal c = QLineF(firstPoint, secondPoint).length();
qreal a = QLineF(axisP2, firstPoint).length(); qreal a = QLineF(axisP2, firstPoint).length();

View File

@ -39,8 +39,8 @@ public:
const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, const Tool::Sources &typeCreation); const Document::Documents &parse, const Tool::Sources &typeCreation);
static QPointF FindPoint(const QPointF axisP1, const QPointF axisP2, const QPointF firstPoint, static QPointF FindPoint(const QPointF &axisP1, const QPointF &axisP2, const QPointF &firstPoint,
const QPointF secondPoint); const QPointF &secondPoint);
static const QString ToolType; static const QString ToolType;
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();

View File

@ -38,7 +38,7 @@ VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, Q
RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id)); RefreshPointGeometry(VAbstractTool::data.GetModelingPoint(id));
} }
void VModelingPoint::NameChangePosition(const QPointF pos) void VModelingPoint::NameChangePosition(const QPointF &pos)
{ {
VPointF point = VAbstractTool::data.GetModelingPoint(id); VPointF point = VAbstractTool::data.GetModelingPoint(id);
QPointF p = pos - this->pos(); QPointF p = pos - this->pos();

View File

@ -33,7 +33,7 @@ public:
virtual ~VModelingPoint() {} virtual ~VModelingPoint() {}
static const QString TagName; static const QString TagName;
public slots: public slots:
void NameChangePosition(const QPointF pos); void NameChangePosition(const QPointF &pos);
virtual void FullUpdateFromGui(int result) = 0; virtual void FullUpdateFromGui(int result) = 0;
protected: protected:
qreal radius; qreal radius;

View File

@ -163,7 +163,7 @@ void VModelingSpline::FullUpdateFromGui(int result)
} }
void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void VModelingSpline::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF pos) const QPointF &pos)
{ {
Q_UNUSED(indexSpline); Q_UNUSED(indexSpline);
VSpline spl = VAbstractTool::data.GetModelingSpline(id); VSpline spl = VAbstractTool::data.GetModelingSpline(id);

View File

@ -50,7 +50,7 @@ public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
virtual void FullUpdateFromGui ( int result ); virtual void FullUpdateFromGui ( int result );
void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position, void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position,
const QPointF pos); const QPointF &pos);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile (); virtual void AddToFile ();

View File

@ -153,7 +153,7 @@ void VModelingSplinePath::FullUpdateFromGui(int result)
} }
void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void VModelingSplinePath::ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF pos) const QPointF &pos)
{ {
VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id); VSplinePath splPath = VAbstractTool::data.GetModelingSplinePath(id);
VSpline spl = splPath.GetSpline(indexSpline); VSpline spl = splPath.GetSpline(indexSpline);

View File

@ -47,7 +47,7 @@ public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position, void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
const QPointF pos); const QPointF &pos);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();

View File

@ -39,7 +39,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
} }
} }
void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Draw::Draws &typeobject,
const Document::Documents &parse, const Tool::Sources &typeCreation) const Document::Documents &parse, const Tool::Sources &typeCreation)
{ {
if (parse == Document::FullParse) if (parse == Document::FullParse)

View File

@ -31,8 +31,8 @@ class VNodeArc :public VAbstractNode, public QGraphicsPathItem
public: public:
VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject, VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, Draw::Draws typeobject,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Draw::Draws &typeobject,
Draw::Draws typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation); const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
public slots: public slots:

View File

@ -44,7 +44,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id
} }
} }
void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Draw::Draws &typeobject,
const Document::Documents &parse, const Tool::Sources &typeCreation) const Document::Documents &parse, const Tool::Sources &typeCreation)
{ {
if (parse == Document::FullParse) if (parse == Document::FullParse)
@ -109,7 +109,7 @@ void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
} }
void VNodePoint::NameChangePosition(const QPointF pos) void VNodePoint::NameChangePosition(const QPointF &pos)
{ {
VPointF point = VAbstractTool::data.GetModelingPoint(id); VPointF point = VAbstractTool::data.GetModelingPoint(id);
QPointF p = pos - this->pos(); QPointF p = pos - this->pos();

View File

@ -31,13 +31,13 @@ class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem
public: public:
VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 );
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject, static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, const Draw::Draws &typeobject,
const Document::Documents &parse, const Tool::Sources &typeCreation); const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
void NameChangePosition(const QPointF pos); void NameChangePosition(const QPointF &pos);
protected: protected:
qreal radius; qreal radius;
VGraphicsSimpleTextItem *namePoint; VGraphicsSimpleTextItem *namePoint;

View File

@ -40,7 +40,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64
} }
VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, const Document::Documents &parse, const Draw::Draws &typeobject, const Document::Documents &parse,
const Tool::Sources &typeCreation) const Tool::Sources &typeCreation)
{ {
VNodeSpline *spl = 0; VNodeSpline *spl = 0;

View File

@ -31,8 +31,9 @@ class VNodeSpline:public VAbstractNode, public QGraphicsPathItem
public: public:
VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject,
const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
const Document::Documents &parse, const Tool::Sources &typeCreation); const Draw::Draws &typeobject, const Document::Documents &parse,
const Tool::Sources &typeCreation);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;
public slots: public slots:

View File

@ -25,7 +25,7 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline");
const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath");
VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent) Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent)
:VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent) :VAbstractNode(doc, data, id, idSpline, typeobject), QGraphicsPathItem(parent)
{ {
RefreshGeometry(); RefreshGeometry();
@ -40,7 +40,8 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
} }
void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, const Document::Documents &parse, const Tool::Sources &typeCreation) const Draw::Draws &typeobject, const Document::Documents &parse,
const Tool::Sources &typeCreation)
{ {
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {

View File

@ -31,7 +31,7 @@ class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem
public: public:
VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); Draw::Draws typeobject, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject, static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, const Draw::Draws &typeobject,
const Document::Documents &parse, const Tool::Sources &typeCreation); const Document::Documents &parse, const Tool::Sources &typeCreation);
static const QString TagName; static const QString TagName;
static const QString ToolType; static const QString ToolType;

View File

@ -40,7 +40,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
sceneDetails(scene) sceneDetails(scene)
{ {
VDetail detail = data->GetDetail(id); VDetail detail = data->GetDetail(id);
for (qint32 i = 0; i< detail.CountNode(); ++i) for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
{ {
switch (detail[i].getTypeTool()) switch (detail[i].getTypeTool())
{ {
@ -127,7 +127,7 @@ void VToolDetail::Create(QSharedPointer<DialogDetail> &dialog, VMainGraphicsScen
{ {
VDetail detail = dialog->getDetails(); VDetail detail = dialog->getDetails();
VDetail det; VDetail det;
for (qint32 i = 0; i< detail.CountNode(); ++i) for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
{ {
qint64 id = 0; qint64 id = 0;
switch (detail[i].getTypeTool()) switch (detail[i].getTypeTool())
@ -252,7 +252,7 @@ void VToolDetail::FullUpdateFromGui(int result)
domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed())); domElement.setAttribute(AttrClosed, QString().setNum(det.getClosed()));
domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth())); domElement.setAttribute(AttrWidth, QString().setNum(det.getWidth()));
RemoveAllChild(domElement); RemoveAllChild(domElement);
for (qint32 i = 0; i < det.CountNode(); ++i) for (ptrdiff_t i = 0; i < det.CountNode(); ++i)
{ {
AddNode(domElement, det[i]); AddNode(domElement, det[i]);
} }
@ -275,7 +275,7 @@ void VToolDetail::AddToFile()
AddAttribute(domElement, AttrClosed, detail.getClosed()); AddAttribute(domElement, AttrClosed, detail.getClosed());
AddAttribute(domElement, AttrWidth, detail.getWidth()); AddAttribute(domElement, AttrWidth, detail.getWidth());
for (qint32 i = 0; i < detail.CountNode(); ++i) for (ptrdiff_t i = 0; i < detail.CountNode(); ++i)
{ {
AddNode(domElement, detail[i]); AddNode(domElement, detail[i]);
} }
@ -371,7 +371,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void VToolDetail::RemoveReferens() void VToolDetail::RemoveReferens()
{ {
VDetail detail = VAbstractTool::data.GetDetail(id); VDetail detail = VAbstractTool::data.GetDetail(id);
for (qint32 i = 0; i< detail.CountNode(); ++i) for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
{ {
doc->DecrementReferens(detail[i].getId()); doc->DecrementReferens(detail[i].getId());
} }

View File

@ -50,9 +50,11 @@ void VTableGraphicsView::MirrorItem()
{ {
for ( qint32 i = 0; i < list.count(); ++i ) for ( qint32 i = 0; i < list.count(); ++i )
{ {
QRectF itemRectOld = list.at(i)->sceneBoundingRect(); QGraphicsItem *item = list.at(i);
Q_ASSERT(item != 0);
QRectF itemRectOld = item->sceneBoundingRect();
//Get the current transform //Get the current transform
QTransform transform(list.at(i)->transform()); QTransform transform(item->transform());
qreal m11 = transform.m11(); // Horizontal scaling qreal m11 = transform.m11(); // Horizontal scaling
qreal m12 = transform.m12(); // Vertical shearing qreal m12 = transform.m12(); // Vertical shearing
@ -71,12 +73,12 @@ void VTableGraphicsView::MirrorItem()
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33); transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
// Set the items transformation // Set the items transformation
list.at(i)->setTransform(transform); item->setTransform(transform);
QRectF itemRectNew = list.at(i)->sceneBoundingRect(); QRectF itemRectNew = item->sceneBoundingRect();
qreal dx, dy; qreal dx, dy;
dx = itemRectOld.center().x()-itemRectNew.center().x(); dx = itemRectOld.center().x()-itemRectNew.center().x();
dy = itemRectOld.center().y()-itemRectNew.center().y(); dy = itemRectOld.center().y()-itemRectNew.center().y();
list.at(i)->moveBy(dx, dy); item->moveBy(dx, dy);
} }
} }
} }
@ -154,8 +156,10 @@ void VTableGraphicsView::rotateIt()
{ {
for ( qint32 i = 0; i < list.count(); ++i ) for ( qint32 i = 0; i < list.count(); ++i )
{ {
list.at(i)->setTransformOriginPoint(list.at(i)->boundingRect().center()); QGraphicsItem *item = list.at(i);
list.at(i)->setRotation(list.at(i)->rotation() + 180); Q_ASSERT(item != 0);
item->setTransformOriginPoint(item->boundingRect().center());
item->setRotation(item->rotation() + 180);
} }
} }
} }