Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-27 13:56:05 +02:00
parent 61be0a0a93
commit 50cd9a7f20
62 changed files with 325 additions and 475 deletions

View File

@ -21,16 +21,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include <QLabel>
#include <QSpinBox>
#include <QScrollBar>
#include <QShowEvent>
#include <QDebug>
#include <QInputDialog>
#include <QFileDialog>
#include <QDebug>
#include "geometry/vspline.h" #include "geometry/vspline.h"
#include <QMessageBox>
#include "exception/vexceptionobjecterror.h" #include "exception/vexceptionobjecterror.h"
#include "exception/vexceptionconversionerror.h" #include "exception/vexceptionconversionerror.h"
#include "exception/vexceptionemptyparameter.h" #include "exception/vexceptionemptyparameter.h"

View File

@ -23,19 +23,14 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include <QLabel>
#include <QtXml>
#include <QComboBox>
#include <QSharedPointer>
#include <QToolButton>
#include "widgets/vmaingraphicsscene.h" #include "widgets/vmaingraphicsscene.h"
#include "widgets/vmaingraphicsview.h" #include "widgets/vmaingraphicsview.h"
#include "widgets/vitem.h" #include "widgets/vitem.h"
#include "dialogs/dialogs.h" #include "dialogs/dialogs.h"
#include "tools/vtooldetail.h"
#include "tools/drawTools/drawtools.h" #include "tools/drawTools/drawtools.h"
#include "tools/modelingTools/modelingtools.h" #include "tools/modelingTools/modelingtools.h"
#include "xml/vdomdocument.h" #include "xml/vdomdocument.h"
#include "tools/vtooldetail.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;

View File

@ -21,12 +21,8 @@
#include "tablewindow.h" #include "tablewindow.h"
#include "ui_tablewindow.h" #include "ui_tablewindow.h"
#include <QCloseEvent>
#include <QDesktopWidget>
#include "widgets/vtablegraphicsview.h" #include "widgets/vtablegraphicsview.h"
#include <QFileDialog>
#include "options.h" #include "options.h"
#include <QtSvg/QtSvg>
TableWindow::TableWindow(QWidget *parent) : TableWindow::TableWindow(QWidget *parent) :
QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow), QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),

View File

@ -23,7 +23,6 @@
#define TABLEWINDOW_H #define TABLEWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include <QLabel>
#include "widgets/vitem.h" #include "widgets/vitem.h"
namespace Ui { namespace Ui {

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vdrawtool.h" #include "vdrawtool.h"
#include <QDebug>
qreal VDrawTool::factor = 1; qreal VDrawTool::factor = 1;
@ -32,12 +31,6 @@ VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *pa
connect(this->doc, &VDomDocument::ShowTool, this, &VDrawTool::ShowTool); connect(this->doc, &VDomDocument::ShowTool, this, &VDrawTool::ShowTool);
} }
VDrawTool::~VDrawTool(){
}
void VDrawTool::setDialog(){
}
void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc){ void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc){
qint64 cursor = doc->getCursor(); qint64 cursor = doc->getCursor();
QVector<VToolRecord> *history = doc->getHistory(); QVector<VToolRecord> *history = doc->getHistory();
@ -56,10 +49,6 @@ void VDrawTool::AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *d
} }
} }
void VDrawTool::ignoreContextMenu(bool enable){
ignoreContextMenuEvent = enable;
}
void VDrawTool::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){ void VDrawTool::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
Q_UNUSED(id); Q_UNUSED(id);
Q_UNUSED(color); Q_UNUSED(color);

View File

@ -23,16 +23,15 @@
#define VDRAWTOOL_H #define VDRAWTOOL_H
#include "../vabstracttool.h" #include "../vabstracttool.h"
#include <QMenu>
class VDrawTool : public VAbstractTool{ class VDrawTool : public VAbstractTool{
Q_OBJECT Q_OBJECT
public: public:
VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
virtual ~VDrawTool(); virtual ~VDrawTool() {}
virtual void setDialog(); virtual void setDialog() {}
static void AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc); static void AddRecord(const qint64 id, Tool::Tools toolType, VDomDocument *doc);
void ignoreContextMenu(bool enable); void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;}
public slots: public slots:
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
virtual void ChangedActivDraw(const QString newName); virtual void ChangedActivDraw(const QString newName);

View File

@ -20,8 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoolalongline.h" #include "vtoolalongline.h"
#include <QDialog>
#include <QDebug>
#include "container/calculator.h" #include "container/calculator.h"
VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,

View File

@ -29,26 +29,25 @@ class VToolAlongLine : public VToolLinePoint{
Q_OBJECT Q_OBJECT
public: public:
VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine,
const QString &typeLine, Tool::Sources typeCreation, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogAlongLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc, static void Create(QSharedPointer<DialogAlongLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data); VContainer *data);
static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula,
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
qint64 secondPointId; qint64 secondPointId;
QSharedPointer<DialogAlongLine> dialogAlongLine; QSharedPointer<DialogAlongLine> dialogAlongLine;
}; };

View File

@ -27,20 +27,19 @@
class VToolBisector : public VToolLinePoint{ class VToolBisector : public VToolLinePoint{
public: public:
VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &typeLine, const QString &formula, const qint64 &firstPointId, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, const qint64 &thirdPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
Tool::Sources typeCreation, QGraphicsItem * parent = 0); static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint,
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal& length);
const QPointF &thirdPoint, const qreal& length);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogBisector> &dialog, VMainGraphicsScene *scene, static void Create(QSharedPointer<DialogBisector> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data); VDomDocument *doc, 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 qint64 &thirdPointId, const QString &typeLine, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
const Document::Documents &parse, Tool::Sources typeCreation); Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);

View File

@ -20,8 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoolendline.h" #include "vtoolendline.h"
#include <QDebug>
#include <QMenu>
#include "widgets/vmaingraphicsscene.h" #include "widgets/vmaingraphicsscene.h"
#include <container/calculator.h> #include <container/calculator.h>

View File

@ -3,7 +3,6 @@
#include "vtoollinepoint.h" #include "vtoollinepoint.h"
#include "dialogs/dialogheight.h" #include "dialogs/dialogheight.h"
#include <QLineF>
class VToolHeight: public VToolLinePoint{ class VToolHeight: public VToolLinePoint{
Q_OBJECT Q_OBJECT

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoolline.h" #include "vtoolline.h"
#include <QDebug>
VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint,
Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id), Tool::Sources typeCreation, QGraphicsItem *parent):VDrawTool(doc, data, id),

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoollineintersect.h" #include "vtoollineintersect.h"
#include <QMenu>
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,

View File

@ -28,17 +28,16 @@
class VToolLineIntersect:public VToolPoint{ class VToolLineIntersect:public VToolPoint{
Q_OBJECT Q_OBJECT
public: public:
VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1,
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2,
const qint64 &p2Line2, Tool::Sources typeCreation, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogLineIntersect> &dialog, VMainGraphicsScene *scene, static void Create(QSharedPointer<DialogLineIntersect> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VDomDocument *doc, VContainer *data); VContainer *data);
static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id,
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation); const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);

View File

@ -64,10 +64,6 @@ void VToolLinePoint::RefreshGeometry(){
} }
} }
void VToolLinePoint::RemoveReferens(){
doc->DecrementReferens(basePointId);
}
void VToolLinePoint::SetFactor(qreal factor){ void VToolLinePoint::SetFactor(qreal factor){
VDrawTool::SetFactor(factor); VDrawTool::SetFactor(factor);
RefreshGeometry(); RefreshGeometry();

View File

@ -27,9 +27,9 @@
class VToolLinePoint : public VToolPoint{ class VToolLinePoint : public VToolPoint{
Q_OBJECT Q_OBJECT
public: public:
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &typeLine, const QString &formula, const QString &formula, const qint64 &basePointId, const qreal &angle,
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
public slots: public slots:
virtual void ChangedActivDraw(const QString newName); virtual void ChangedActivDraw(const QString newName);
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
@ -40,7 +40,7 @@ protected:
qint64 basePointId; qint64 basePointId;
QGraphicsLineItem *mainLine; QGraphicsLineItem *mainLine;
virtual void RefreshGeometry(); virtual void RefreshGeometry();
virtual void RemoveReferens(); virtual void RemoveReferens() {doc->DecrementReferens(basePointId);}
private: private:
Q_DISABLE_COPY(VToolLinePoint) Q_DISABLE_COPY(VToolLinePoint)
}; };

View File

@ -30,8 +30,7 @@ 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, Tool::Sources typeCreation, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
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);

View File

@ -20,11 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoolpoint.h" #include "vtoolpoint.h"
#include <QPen>
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id,
QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsItem *parent):VDrawTool(doc, data, id),
@ -151,6 +146,3 @@ void VToolPoint::RefreshLine(){
lineName->setVisible(true); lineName->setVisible(true);
} }
} }
VToolPoint::~VToolPoint(){
}

View File

@ -28,9 +28,8 @@
class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{ class VToolPoint: public VDrawTool, public QGraphicsEllipseItem{
Q_OBJECT Q_OBJECT
public: public:
VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0); virtual ~VToolPoint(){}
virtual ~VToolPoint();
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);

View File

@ -7,15 +7,16 @@
class VToolPointOfIntersection : public VToolPoint{ class VToolPointOfIntersection : public VToolPoint{
Q_OBJECT Q_OBJECT
public: public:
VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0); const qint64 &firstPointId, const qint64 &secondPointId,
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogPointOfIntersection> &dialog, VMainGraphicsScene *scene, static void Create(QSharedPointer<DialogPointOfIntersection> &dialog, VMainGraphicsScene *scene,
VDomDocument *doc, VContainer *data); VDomDocument *doc, VContainer *data);
static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId,
const qint64 &secondPointId, const qreal &mx, const qreal &my, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
const Document::Documents &parse, Tool::Sources typeCreation); Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);

View File

@ -33,7 +33,6 @@ VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, cons
if(typeCreation == Tool::FromGui){ if(typeCreation == Tool::FromGui){
AddToFile(); AddToFile();
} }
} }
void VToolShoulderPoint::setDialog(){ void VToolShoulderPoint::setDialog(){

View File

@ -27,19 +27,17 @@
class VToolShoulderPoint : public VToolLinePoint{ class VToolShoulderPoint : public VToolLinePoint{
public: public:
VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &typeLine, const QString &formula, const qint64 &p1Line, const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
const qint64 &p2Line, const qint64 &pShoulder, const qint64 &pShoulder, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder, static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
const qreal &length); const qreal &length);
static void Create(QSharedPointer<DialogShoulderPoint> &dialog, VMainGraphicsScene *scene, static void Create(QSharedPointer<DialogShoulderPoint> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VDomDocument *doc, VContainer *data); VContainer *data);
static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx,
const QString &pointName, const qreal &mx, const qreal &my, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation); const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();

View File

@ -20,11 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoolsinglepoint.h" #include "vtoolsinglepoint.h"
#include <QPen>
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
#include <QGraphicsSceneContextMenuEvent>
VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
QGraphicsItem * parent ):VToolPoint(doc, data, id, parent), QGraphicsItem * parent ):VToolPoint(doc, data, id, parent),

View File

@ -41,8 +41,8 @@ public:
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation); const Document::Documents &parse, Tool::Sources typeCreation);
signals: signals:
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint,
const QPointF &controlPoint, const QPointF &splinePoint ); const QPointF &splinePoint );
void setEnabledPoint ( bool enable ); void setEnabledPoint ( bool enable );
public slots: public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vtoolsplinepath.h" #include "vtoolsplinepath.h"
#include <QMenu>
VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation, Tool::Sources typeCreation,

View File

@ -7,32 +7,31 @@
class VToolTriangle : public VToolPoint{ class VToolTriangle : public VToolPoint{
Q_OBJECT Q_OBJECT
public: public:
VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
Tool::Sources typeCreation, QGraphicsItem * parent = 0); Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static void Create(QSharedPointer<DialogTriangle> &dialog, VMainGraphicsScene *scene, VDomDocument *doc, static void Create(QSharedPointer<DialogTriangle> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
VContainer *data); VContainer *data);
static void Create(const qint64 _id, const QString &pointName, static void Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, const qint64 &axisP2Id,
const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my,
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, Tool::Sources typeCreation);
const Document::Documents &parse, 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);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void RemoveReferens(); virtual void RemoveReferens();
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
private: private:
Q_DISABLE_COPY(VToolTriangle) Q_DISABLE_COPY(VToolTriangle)
qint64 axisP1Id; qint64 axisP1Id;
qint64 axisP2Id; qint64 axisP2Id;
qint64 firstPointId; qint64 firstPointId;
qint64 secondPointId; qint64 secondPointId;
QSharedPointer<DialogTriangle> dialogTriangle; QSharedPointer<DialogTriangle> dialogTriangle;
}; };

View File

@ -20,8 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingalongline.h" #include "vmodelingalongline.h"
#include <QDialog>
#include <QDebug>
#include "container/calculator.h" #include "container/calculator.h"
VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, VModelingAlongLine::VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,

View File

@ -28,27 +28,25 @@
class VModelingAlongLine : public VModelingLinePoint{ class VModelingAlongLine : public VModelingLinePoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id, VModelingAlongLine(VDomDocument *doc, VContainer *data, qint64 id,
const QString &formula, const qint64 &firstPointId, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString &typeLine, const qint64 &secondPointId, const QString &typeLine,
Tool::Sources typeCreation, QGraphicsItem * parent = 0); Tool::Sources typeCreation, QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingAlongLine* Create(QSharedPointer<DialogAlongLine> &dialog, VDomDocument *doc, static VModelingAlongLine* Create(QSharedPointer<DialogAlongLine> &dialog, VDomDocument *doc, VContainer *data);
VContainer *data); static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
static VModelingAlongLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
const QString &formula, const qint64 &firstPointId, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const qint64 &secondPointId, const qreal &mx, const qreal &my, const Document::Documents &parse, Tool::Sources typeCreation);
VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
qint64 secondPointId; qint64 secondPointId;
QSharedPointer<DialogAlongLine> dialogAlongLine; QSharedPointer<DialogAlongLine> dialogAlongLine;
}; };

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingarc.h" #include "vmodelingarc.h"
#include <QMenu>
#include "container/calculator.h" #include "container/calculator.h"
VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation, VModelingArc::VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,

View File

@ -30,26 +30,26 @@
class VModelingArc :public VModelingTool, public QGraphicsPathItem{ class VModelingArc :public VModelingTool, public QGraphicsPathItem{
Q_OBJECT Q_OBJECT
public: public:
VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, VModelingArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
Tool::Sources typeCreation, QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingArc* Create(QSharedPointer<DialogArc> &dialog, VDomDocument *doc, VContainer *data); static VModelingArc* Create(QSharedPointer<DialogArc> &dialog, VDomDocument *doc, VContainer *data);
static VModelingArc* Create(const qint64 _id, const qint64 &center, const QString &radius, static VModelingArc* Create(const qint64 _id, const qint64 &center, const QString &radius, const QString &f1,
const QString &f1, const QString &f2, VDomDocument *doc, VContainer *data, const QString &f2, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation); const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
QSharedPointer<DialogArc> dialogArc; QSharedPointer<DialogArc> dialogArc;
void RefreshGeometry(); void RefreshGeometry();
}; };
#endif // VMODELINGARC_H #endif // VMODELINGARC_H

View File

@ -34,13 +34,11 @@ public:
const qint64 &thirdPointId, Tool::Sources typeCreation, const qint64 &thirdPointId, Tool::Sources typeCreation,
QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingBisector* Create(QSharedPointer<DialogBisector> &dialog, VDomDocument *doc, static VModelingBisector* Create(QSharedPointer<DialogBisector> &dialog, VDomDocument *doc, VContainer *data);
VContainer *data);
static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, static VModelingBisector* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const qint64 &thirdPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine,
const QString &typeLine, const QString &pointName, const qreal &mx, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
const qreal &my, VDomDocument *doc, VContainer *data, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);

View File

@ -28,24 +28,22 @@
class VModelingEndLine : public VModelingLinePoint{ class VModelingEndLine : public VModelingLinePoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const QString &typeLine, const QString &formula, const qreal &angle,
const qreal &angle, const qint64 &basePointId, const qint64 &basePointId, Tool::Sources typeCreation,
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0); virtual void setDialog();
virtual void setDialog(); static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc, VContainer *data);
static VModelingEndLine* Create(QSharedPointer<DialogEndLine> &dialog, VDomDocument *doc, static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
VContainer *data); const QString &formula, const qreal &angle, const qint64 &basePointId,
static VModelingEndLine* Create(const qint64 _id, const QString &pointName, const QString &typeLine, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const QString &formula, const qreal &angle, const qint64 &basePointId, const Document::Documents &parse, Tool::Sources typeCreation);
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
private: private:
QSharedPointer<DialogEndLine> dialogEndLine; QSharedPointer<DialogEndLine> dialogEndLine;
}; };

View File

@ -8,12 +8,11 @@ class VModelingHeight : public VModelingLinePoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingHeight(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const qint64 &basePointId, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId,
const qint64 &p1LineId, const qint64 &p2LineId, const qint64 &p2LineId, Tool::Sources typeCreation,
Tool::Sources typeCreation, QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingHeight* Create(QSharedPointer<DialogHeight> &dialog, VDomDocument *doc, static VModelingHeight* Create(QSharedPointer<DialogHeight> &dialog, VDomDocument *doc, VContainer *data);
VContainer *data);
static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine, static VModelingHeight* Create(const qint64 _id, const QString &pointName, const QString &typeLine,
const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId,
const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingline.h" #include "vmodelingline.h"
#include <QDebug>
VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, VModelingLine::VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent): qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem *parent):

View File

@ -29,26 +29,25 @@
class VModelingLine: public VModelingTool, public QGraphicsLineItem{ class VModelingLine: public VModelingTool, public QGraphicsLineItem{
Q_OBJECT Q_OBJECT
public: public:
VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, VModelingLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
qint64 secondPoint, Tool::Sources typeCreation, qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0); virtual void setDialog();
virtual void setDialog(); static VModelingLine* Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data);
static VModelingLine* Create(QSharedPointer<DialogLine> &dialog, VDomDocument *doc, VContainer *data); static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
static VModelingLine* Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
qint64 firstPoint; qint64 firstPoint;
qint64 secondPoint; qint64 secondPoint;
QSharedPointer<DialogLine> dialogLine; QSharedPointer<DialogLine> dialogLine;
}; };

View File

@ -28,33 +28,29 @@
class VModelingLineIntersect:public VModelingPoint{ class VModelingLineIntersect:public VModelingPoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingLineIntersect(VDomDocument *doc, VContainer *data, VModelingLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &id, const qint64 &p1Line1, const qint64 &p1Line1, const qint64 &p2Line1,
const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p1Line2, const qint64 &p2Line2,
const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
Tool::Sources typeCreation, virtual void setDialog();
QGraphicsItem * parent = 0); static VModelingLineIntersect* Create(QSharedPointer<DialogLineIntersect> &dialog, VDomDocument *doc,
virtual void setDialog(); VContainer *data);
static VModelingLineIntersect* Create(QSharedPointer<DialogLineIntersect> &dialog, static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
VDomDocument *doc,VContainer *data); const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
static VModelingLineIntersect* Create(const qint64 _id, const qint64 &p1Line1Id, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
const qint64 &p2Line1Id, const qint64 &p1Line2Id, const Document::Documents &parse, Tool::Sources typeCreation);
const qint64 &p2Line2Id, const QString &pointName,
const qreal &mx, const qreal &my, VDomDocument *doc,
VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
qint64 p1Line1; qint64 p1Line1;
qint64 p2Line1; qint64 p2Line1;
qint64 p1Line2; qint64 p1Line2;
qint64 p2Line2; qint64 p2Line2;
QSharedPointer<DialogLineIntersect> dialogLineIntersect; QSharedPointer<DialogLineIntersect> dialogLineIntersect;
}; };

View File

@ -50,7 +50,3 @@ void VModelingLinePoint::RefreshGeometry(){
mainLine->setVisible(true); mainLine->setVisible(true);
} }
} }
void VModelingLinePoint::RemoveReferens(){
doc->DecrementReferens(basePointId);
}

View File

@ -27,9 +27,8 @@
class VModelingLinePoint : public VModelingPoint{ class VModelingLinePoint : public VModelingPoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const QString &typeLine, const QString &formula, const QString &formula, const qint64 &basePointId, const qreal &angle,
const qint64 &basePointId, const qreal &angle,
QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
protected: protected:
QString typeLine; QString typeLine;
@ -38,7 +37,7 @@ protected:
qint64 basePointId; qint64 basePointId;
QGraphicsLineItem *mainLine; QGraphicsLineItem *mainLine;
virtual void RefreshGeometry(); virtual void RefreshGeometry();
virtual void RemoveReferens(); virtual void RemoveReferens() {doc->DecrementReferens(basePointId);}
private: private:
Q_DISABLE_COPY(VModelingLinePoint) Q_DISABLE_COPY(VModelingLinePoint)
}; };

View File

@ -33,7 +33,6 @@ VModelingNormal::VModelingNormal(VDomDocument *doc, VContainer *data, const qint
if(typeCreation == Tool::FromGui){ if(typeCreation == Tool::FromGui){
AddToFile(); AddToFile();
} }
} }
void VModelingNormal::setDialog(){ void VModelingNormal::setDialog(){

View File

@ -29,17 +29,15 @@ class VModelingNormal : public VModelingLinePoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
const QString &typeLine, const QString &formula, const QString &typeLine, const QString &formula, const qreal &angle,
const qreal &angle, const qint64 &firstPointId, const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &secondPointId, Tool::Sources typeCreation, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingNormal* Create(QSharedPointer<DialogNormal> &dialog, VDomDocument *doc, VContainer *data); static VModelingNormal* Create(QSharedPointer<DialogNormal> &dialog, VDomDocument *doc, VContainer *data);
static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, static VModelingNormal* Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
const qint64 &secondPointId, const QString typeLine, const qint64 &secondPointId, const QString typeLine, const QString pointName,
const QString pointName, const qreal angle, const qreal &mx, const qreal angle, const qreal &mx, const qreal &my, VDomDocument *doc,
const qreal &my, VDomDocument *doc, VContainer *data, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);

View File

@ -20,10 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingpoint.h" #include "vmodelingpoint.h"
#include <QPen>
#include <QBrush>
#include <QDebug>
#include <QGraphicsItem>
#include "container/vpointf.h" #include "container/vpointf.h"
VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, VModelingPoint::VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id,
@ -102,6 +98,3 @@ void VModelingPoint::RefreshLine(){
lineName->setVisible(true); lineName->setVisible(true);
} }
} }
VModelingPoint::~VModelingPoint(){
}

View File

@ -28,9 +28,8 @@
class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{ class VModelingPoint: public VModelingTool, public QGraphicsEllipseItem{
Q_OBJECT Q_OBJECT
public: public:
VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, VModelingPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0);
QGraphicsItem * parent = 0); virtual ~VModelingPoint() {}
virtual ~VModelingPoint();
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;

View File

@ -28,15 +28,13 @@
class VModelingPointOfContact : public VModelingPoint{ class VModelingPointOfContact : public VModelingPoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingPointOfContact(VDomDocument *doc, VContainer *data, VModelingPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
const qint64 &id, const QString &radius, const QString &radius, const qint64 &center,
const qint64 &center, const qint64 &firstPointId, const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
Tool::Sources typeCreation,
QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingPointOfContact* Create(QSharedPointer<DialogPointOfContact> &dialog, static VModelingPointOfContact* Create(QSharedPointer<DialogPointOfContact> &dialog, VDomDocument *doc,
VDomDocument *doc, VContainer *data); VContainer *data);
static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 &center, static VModelingPointOfContact* Create(const qint64 _id, const QString &radius, const qint64 &center,
const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &firstPointId, const qint64 &secondPointId,
const QString &pointName, const qreal &mx, const qreal &my, const QString &pointName, const qreal &mx, const qreal &my,

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingshoulderpoint.h" #include "vmodelingshoulderpoint.h"
#include <QDebug>
#include "../drawTools/vtoolshoulderpoint.h" #include "../drawTools/vtoolshoulderpoint.h"
#include <container/calculator.h> #include <container/calculator.h>
@ -34,7 +33,6 @@ VModelingShoulderPoint::VModelingShoulderPoint(VDomDocument *doc, VContainer *da
if(typeCreation == Tool::FromGui){ if(typeCreation == Tool::FromGui){
AddToFile(); AddToFile();
} }
} }
void VModelingShoulderPoint::setDialog(){ void VModelingShoulderPoint::setDialog(){

View File

@ -28,30 +28,28 @@
class VModelingShoulderPoint : public VModelingLinePoint{ class VModelingShoulderPoint : public VModelingLinePoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingShoulderPoint(VDomDocument *doc, VContainer *data, VModelingShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
const QString &formula, const qint64 &p1Line, const qint64 &pShoulder, Tool::Sources typeCreation,
const qint64 &p2Line, const qint64 &pShoulder, QGraphicsItem * parent = 0);
Tool::Sources typeCreation, virtual void setDialog();
QGraphicsItem * parent = 0);
virtual void setDialog();
static VModelingShoulderPoint* Create(QSharedPointer<DialogShoulderPoint> &dialog, VDomDocument *doc, static VModelingShoulderPoint* Create(QSharedPointer<DialogShoulderPoint> &dialog, VDomDocument *doc,
VContainer *data); VContainer *data);
static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line, static VModelingShoulderPoint* Create(const qint64 _id, const QString &formula, const qint64 &p1Line,
const qint64 &p2Line, const qint64 &pShoulder, const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine,
const QString &typeLine, const QString &pointName, const qreal &mx, const QString &pointName, const qreal &mx, const qreal &my, VDomDocument *doc,
const qreal &my, VDomDocument *doc, VContainer *data, VContainer *data, const Document::Documents &parse,
const Document::Documents &parse, const Tool::Sources &typeCreation); const Tool::Sources &typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
qint64 p2Line; qint64 p2Line;
qint64 pShoulder; qint64 pShoulder;
QSharedPointer<DialogShoulderPoint> dialogShoulderPoint; QSharedPointer<DialogShoulderPoint> dialogShoulderPoint;
}; };

View File

@ -20,11 +20,8 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingspline.h" #include "vmodelingspline.h"
#include <QMenu>
#include <QDebug>
#include "geometry/vspline.h" #include "geometry/vspline.h"
VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id, VModelingSpline::VModelingSpline(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation, Tool::Sources typeCreation,
QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent), QGraphicsItem *parent):VModelingTool(doc, data, id), QGraphicsPathItem(parent),

View File

@ -31,37 +31,34 @@
class VModelingSpline:public VModelingTool, public QGraphicsPathItem{ class VModelingSpline:public VModelingTool, public QGraphicsPathItem{
Q_OBJECT Q_OBJECT
public: public:
VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, VModelingSpline (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
Tool::Sources typeCreation, QGraphicsItem * parent = 0 ); QGraphicsItem * parent = 0 );
virtual void setDialog(); virtual void setDialog();
static VModelingSpline* Create(QSharedPointer<DialogSpline> &dialog, VDomDocument *doc, static VModelingSpline* Create(QSharedPointer<DialogSpline> &dialog, VDomDocument *doc, VContainer *data);
VContainer *data); static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
static VModelingSpline* Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
const qreal &angle2, const qreal &kCurve, VDomDocument *doc, Tool::Sources typeCreation);
VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation);
signals: signals:
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, void RefreshLine (const qint32 &indexSpline, SplinePoint::Position position,
const QPointF &controlPoint, const QPointF &splinePoint ); const QPointF &controlPoint, const QPointF &splinePoint );
void setEnabledPoint ( bool enable ); void setEnabledPoint ( bool enable );
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, void ControlPointChangePosition (const qint32 &indexSpline, SplinePoint::Position position,
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 ();
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
QSharedPointer<DialogSpline> dialogSpline; QSharedPointer<DialogSpline> dialogSpline;
QVector<VControlPointSpline *> controlPoints; QVector<VControlPointSpline *> controlPoints;
void RefreshGeometry (); void RefreshGeometry ();
}; };
#endif // VMODELINGSPLINE_H #endif // VMODELINGSPLINE_H

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vmodelingsplinepath.h" #include "vmodelingsplinepath.h"
#include <QMenu>
VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, VModelingSplinePath::VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
Tool::Sources typeCreation, Tool::Sources typeCreation,

View File

@ -30,38 +30,35 @@
class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem{ class VModelingSplinePath:public VModelingTool, public QGraphicsPathItem{
Q_OBJECT Q_OBJECT
public: public:
VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, VModelingSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
Tool::Sources typeCreation, QGraphicsItem * parent = 0); QGraphicsItem * parent = 0);
virtual void setDialog(); virtual void setDialog();
static VModelingSplinePath* Create(QSharedPointer<DialogSplinePath> &dialog, VDomDocument *doc, static VModelingSplinePath* Create(QSharedPointer<DialogSplinePath> &dialog, VDomDocument *doc, VContainer *data);
VContainer *data);
static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc, static VModelingSplinePath* Create(const qint64 _id, const VSplinePath &path, VDomDocument *doc,
VContainer *data, const Document::Documents &parse, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
Tool::Sources typeCreation);
signals: signals:
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, const QPointF &controlPoint,
const QPointF &controlPoint, const QPointF &splinePoint); const QPointF &splinePoint);
void setEnabledPoint(bool enable); void setEnabledPoint(bool enable);
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, void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
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();
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void RemoveReferens(); virtual void RemoveReferens();
private: private:
QSharedPointer<DialogSplinePath> dialogSplinePath; QSharedPointer<DialogSplinePath> dialogSplinePath;
QVector<VControlPointSpline *> controlPoints; QVector<VControlPointSpline *> controlPoints;
void RefreshGeometry(); void RefreshGeometry();
void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint); void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint);
void UpdatePathPoint(QDomNode& node, VSplinePath &path); void UpdatePathPoint(QDomNode& node, VSplinePath &path);
void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline);
const qint32 &indexSpline);
}; };
#endif // VMODELINGSPLINEPATH_H #endif // VMODELINGSPLINEPATH_H

View File

@ -27,16 +27,6 @@ VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false), ignoreFullU
_referens = 0; _referens = 0;
} }
VModelingTool::~VModelingTool(){
}
void VModelingTool::setDialog(){
}
void VModelingTool::ignoreContextMenu(bool enable){
ignoreContextMenuEvent = enable;
}
void VModelingTool::AddToModeling(const QDomElement &domElement){ void VModelingTool::AddToModeling(const QDomElement &domElement){
QDomElement modelingElement; QDomElement modelingElement;
bool ok = doc->GetActivModelingElement(modelingElement); bool ok = doc->GetActivModelingElement(modelingElement);

View File

@ -25,14 +25,13 @@
#include "../vabstracttool.h" #include "../vabstracttool.h"
#include <QMenu> #include <QMenu>
class VModelingTool: public VAbstractTool class VModelingTool: public VAbstractTool{
{
Q_OBJECT Q_OBJECT
public: public:
VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); VModelingTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
virtual ~VModelingTool(); virtual ~VModelingTool(){}
virtual void setDialog(); virtual void setDialog(){}
void ignoreContextMenu(bool enable); inline void ignoreContextMenu(bool enable) {ignoreContextMenuEvent = enable;}
public slots: public slots:
virtual void FullUpdateFromGui(int result)=0; virtual void FullUpdateFromGui(int result)=0;
signals: signals:

View File

@ -8,31 +8,28 @@
class VModelingTriangle : public VModelingPoint{ class VModelingTriangle : public VModelingPoint{
Q_OBJECT Q_OBJECT
public: public:
VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, VModelingTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id,
const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &firstPointId, const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
Tool::Sources typeCreation, QGraphicsItem * parent = 0); virtual void setDialog();
virtual void setDialog(); static VModelingTriangle* Create(QSharedPointer<DialogTriangle> &dialog, VDomDocument *doc, VContainer *data);
static VModelingTriangle* Create(QSharedPointer<DialogTriangle> &dialog, VDomDocument *doc,
VContainer *data);
static VModelingTriangle* Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, static VModelingTriangle* Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id,
const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId,
const qint64 &secondPointId, const qreal &mx, const qreal &my, const qreal &mx, const qreal &my, VDomDocument *doc, VContainer *data,
VDomDocument *doc, VContainer *data, const Document::Documents &parse, const Document::Documents &parse, Tool::Sources typeCreation);
Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result); virtual void FullUpdateFromGui(int result);
protected: protected:
virtual void RemoveReferens(); virtual void RemoveReferens();
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile(); virtual void AddToFile();
private: private:
Q_DISABLE_COPY(VModelingTriangle) Q_DISABLE_COPY(VModelingTriangle)
qint64 axisP1Id; qint64 axisP1Id;
qint64 axisP2Id; qint64 axisP2Id;
qint64 firstPointId; qint64 firstPointId;
qint64 secondPointId; qint64 secondPointId;
QSharedPointer<DialogTriangle> dialogTriangle; QSharedPointer<DialogTriangle> dialogTriangle;
}; };

View File

@ -24,8 +24,7 @@
#include "../vabstracttool.h" #include "../vabstracttool.h"
class VAbstractNode : public VAbstractTool class VAbstractNode : public VAbstractTool{
{
Q_OBJECT Q_OBJECT
public: public:
VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode, VAbstractNode(VDomDocument *doc, VContainer *data, qint64 id, qint64 idNode,

View File

@ -25,8 +25,7 @@
#include "vabstractnode.h" #include "vabstractnode.h"
#include <QGraphicsPathItem> #include <QGraphicsPathItem>
class VNodeArc :public VAbstractNode, public QGraphicsPathItem class VNodeArc :public VAbstractNode, public QGraphicsPathItem{
{
Q_OBJECT Q_OBJECT
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,

View File

@ -25,30 +25,27 @@
#include "vabstractnode.h" #include "vabstractnode.h"
#include "widgets/vgraphicssimpletextitem.h" #include "widgets/vgraphicssimpletextitem.h"
class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem class VNodePoint: public VAbstractNode, public QGraphicsEllipseItem{
{
Q_OBJECT Q_OBJECT
public: public:
VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, Draw::Draws typeobject,
Draw::Draws typeobject, Tool::Sources typeCreation, Tool::Sources typeCreation, QGraphicsItem * parent = 0 );
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 Document::Documents &parse, Tool::Sources typeCreation);
Draw::Draws typeobject, const Document::Documents &parse,
Tool::Sources typeCreation);
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;
QGraphicsLineItem *lineName; QGraphicsLineItem *lineName;
virtual void AddToFile(); virtual void AddToFile();
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
virtual void UpdateNamePosition(qreal mx, qreal my); virtual void UpdateNamePosition(qreal mx, qreal my);
virtual void RefreshPointGeometry(const VPointF &point); virtual void RefreshPointGeometry(const VPointF &point);
void RefreshLine(); void RefreshLine();
private: private:
Q_DISABLE_COPY(VNodePoint) Q_DISABLE_COPY(VNodePoint)
}; };

View File

@ -25,23 +25,22 @@
#include "vabstractnode.h" #include "vabstractnode.h"
#include <QGraphicsPathItem> #include <QGraphicsPathItem>
class VNodeSpline:public VAbstractNode, public QGraphicsPathItem class VNodeSpline:public VAbstractNode, public QGraphicsPathItem{
{
Q_OBJECT Q_OBJECT
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,
Tool::Sources typeCreation, QGraphicsItem * parent = 0); Tool::Sources typeCreation, QGraphicsItem * parent = 0);
static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, Draw::Draws typeobject,
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation); const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile (); virtual void FullUpdateFromFile ();
protected: protected:
virtual void AddToFile (); virtual void AddToFile ();
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private: private:
void RefreshGeometry (); void RefreshGeometry ();
}; };
#endif // VNODESPLINE_H #endif // VNODESPLINE_H

View File

@ -25,15 +25,13 @@
#include "vabstractnode.h" #include "vabstractnode.h"
#include <QGraphicsPathItem> #include <QGraphicsPathItem>
class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem class VNodeSplinePath : public VAbstractNode, public QGraphicsPathItem{
{
Q_OBJECT Q_OBJECT
public: public:
VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline,
Draw::Draws typeobject, Tool::Sources typeCreation, Draw::Draws typeobject, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
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 Document::Documents &parse, Tool::Sources typeCreation);
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
protected: protected:

View File

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
#include "vabstracttool.h" #include "vabstracttool.h"
#include <QDebug>
VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent): VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent):
VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){ VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black){
@ -132,10 +131,6 @@ QPointF VAbstractTool::addVector(QPointF p, QPointF p1, QPointF p2, qreal k){
return QPointF (p.x() + (p2.x() - p1.x()) * k, p.y() + (p2.y() - p1.y()) * k); return QPointF (p.x() + (p2.x() - p1.x()) * k, p.y() + (p2.y() - p1.y()) * k);
} }
const VContainer *VAbstractTool::getData()const{
return &data;
}
void VAbstractTool::RemoveAllChild(QDomElement &domElement){ void VAbstractTool::RemoveAllChild(QDomElement &domElement){
if ( domElement.hasChildNodes() ){ if ( domElement.hasChildNodes() ){
while ( domElement.childNodes().length() >= 1 ){ while ( domElement.childNodes().length() >= 1 ){
@ -150,7 +145,3 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre
*b = line.p1().x() - line.p2().x(); *b = line.p1().x() - line.p2().x();
*c = - *a * line.p1().x() - *b * line.p1().y(); *c = - *a * line.p1().x() - *b * line.p1().y();
} }
qint64 VAbstractTool::getId() const{
return id;
}

View File

@ -22,40 +22,39 @@
#ifndef VABSTRACTTOOL_H #ifndef VABSTRACTTOOL_H
#define VABSTRACTTOOL_H #define VABSTRACTTOOL_H
#include "xml/vdomdocument.h"
#include "vdatatool.h" #include "vdatatool.h"
#include <xml/vdomdocument.h>
class VAbstractTool: public VDataTool{ class VAbstractTool: public VDataTool{
Q_OBJECT Q_OBJECT
public: public:
VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0);
virtual ~VAbstractTool(); virtual ~VAbstractTool();
static QPointF LineIntersectRect(QRectF rec, QLineF line); static QPointF LineIntersectRect(QRectF rec, QLineF line);
static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, static qint32 LineIntersectCircle(QPointF center, qreal radius, QLineF line, QPointF &p1, QPointF &p2);
QPointF &p2); static QPointF ClosestPoint(QLineF line, QPointF p);
static QPointF ClosestPoint(QLineF line, QPointF p); static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k);
static QPointF addVector (QPointF p, QPointF p1, QPointF p2, qreal k); inline qint64 getId() const {return id;}
qint64 getId() const; static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c);
public slots: public slots:
virtual void FullUpdateFromFile()=0; virtual void FullUpdateFromFile()=0;
signals: signals:
void toolhaveChange(); void toolhaveChange();
void ChoosedTool(qint64 id, Scene::Scenes type); void ChoosedTool(qint64 id, Scene::Scenes type);
void FullUpdateTree(); void FullUpdateTree();
protected: protected:
VDomDocument *doc; VDomDocument *doc;
const qint64 id; const qint64 id;
const Qt::GlobalColor baseColor; const Qt::GlobalColor baseColor;
Qt::GlobalColor currentColor; Qt::GlobalColor currentColor;
virtual void AddToFile()=0; virtual void AddToFile()=0;
void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value); void AddAttribute(QDomElement &domElement, const QString &name, const qint64 &value);
void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value); void AddAttribute(QDomElement &domElement, const QString &name, const qint32 &value);
void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value); void AddAttribute(QDomElement &domElement, const QString &name, const qreal &value);
void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); void AddAttribute(QDomElement &domElement, const QString &name, const QString &value);
const VContainer *getData() const; inline const VContainer *getData() const {return &data;}
virtual void RemoveReferens(){} virtual void RemoveReferens(){}
void RemoveAllChild(QDomElement &domElement); void RemoveAllChild(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VAbstractTool) Q_DISABLE_COPY(VAbstractTool)
}; };

View File

@ -27,10 +27,6 @@ VDataTool &VDataTool::operator =(const VDataTool &tool){
return *this; return *this;
} }
void VDataTool::setData(const VContainer *value){
data = *value;
}
void VDataTool::decrementReferens(){ void VDataTool::decrementReferens(){
if(_referens > 0){ if(_referens > 0){
--_referens; --_referens;

View File

@ -22,18 +22,17 @@
#ifndef VDATATOOL_H #ifndef VDATATOOL_H
#define VDATATOOL_H #define VDATATOOL_H
#include "container/vcontainer.h" #include <container/vcontainer.h>
//We need QObject class because we use qobject_cast. //We need QObject class because we use qobject_cast.
class VDataTool : public QObject{ class VDataTool : public QObject{
Q_OBJECT Q_OBJECT
public: public:
explicit VDataTool(VContainer *data, QObject *parent = 0) explicit VDataTool(VContainer *data, QObject *parent = 0): QObject(parent), data(*data), _referens(1){}
: QObject(parent), data(*data), _referens(1){}
virtual ~VDataTool(){} virtual ~VDataTool(){}
VDataTool &operator= (const VDataTool &tool); VDataTool &operator= (const VDataTool &tool);
inline VContainer getData() const { return data; } inline VContainer getData() const { return data; }
void setData(const VContainer *value); inline void setData(const VContainer *value) {data = *value;}
virtual inline qint64 referens() const {return _referens;} virtual inline qint64 referens() const {return _referens;}
virtual inline void incrementReferens(){++_referens;} virtual inline void incrementReferens(){++_referens;}
virtual void decrementReferens(); virtual void decrementReferens();

View File

@ -21,7 +21,6 @@
#include "vtooldetail.h" #include "vtooldetail.h"
#include "nodeDetails/nodedetails.h" #include "nodeDetails/nodedetails.h"
#include <QDebug>
#include "modelingTools/vmodelingtool.h" #include "modelingTools/vmodelingtool.h"
#include "modelingTools/modelingtools.h" #include "modelingTools/modelingtools.h"